TableFile.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::Function1Types::TableFile
29 
30 Description
31  Templated table container function where data are read from file.
32 
33  Usage:
34  \verbatim
35  <entryName> tableFile;
36  <entryName>Coeffs
37  {
38  file dataFile; // name of data file
39  outOfBounds clamp; // optional out-of-bounds handling
40  interpolationScheme linear; // optional interpolation method
41  }
42  \endverbatim
43 
44  Data are stored as a list of Tuple2's. First column is always stored as
45  scalar entries. Data are read in the form, e.g. for an entry <entryName>
46  that is (scalar, vector):
47  \verbatim
48  (
49  (0.0 (1 2 3))
50  (1.0 (4 5 6))
51  );
52  \endverbatim
53 
54 SourceFiles
55  TableFile.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef TableFile_H
60 #define TableFile_H
61 
62 #include "Function1.H"
63 #include "Tuple2.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace Function1Types
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class TableFile Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class Type>
77 class TableFile
78 :
79  public TableBase<Type>
80 {
81  // Private Data
82 
83  //- File name for csv table (optional)
84  fileName fName_;
85 
86 
87  // Private Member Functions
88 
89  //- No copy assignment
90  void operator=(const TableFile<Type>&) = delete;
91 
92 
93 public:
94 
95  //- Runtime type information
96  TypeName("tableFile");
97 
98 
99  // Constructors
100 
101  //- Construct from entry name and "file" found in dictionary
102  TableFile(const word& entryName, const dictionary& dict);
103 
104  //- Copy constructor
105  explicit TableFile(const TableFile<Type>& tbl);
106 
107 
108  //- Destructor
109  virtual ~TableFile() = default;
110 
111 
112  // Member Functions
113 
114  //- Write in dictionary format
115  virtual void writeData(Ostream& os) const;
116 };
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace Function1Types
122 } // End namespace Foam
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #ifdef NoRepository
127  #include "TableFile.C"
128 #endif
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
Foam::Function1Types::TableFile::writeData
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition: TableFile.C:74
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Tuple2.H
TableFile.C
Foam::Function1::entryName
const word & entryName
Definition: Function1.H:125
Function1.H
Foam::Function1Types::TableFile::TableFile
TableFile(const word &entryName, const dictionary &dict)
Construct from entry name and "file" found in dictionary.
Definition: TableFile.C:35
Foam::Function1Types::TableFile::TypeName
TypeName("tableFile")
Runtime type information.
Foam::Function1::dict
const word const dictionary & dict
Definition: Function1.H:127
Foam::Function1Types::TableFile
Templated table container function where data are read from file.
Definition: TableFile.H:76
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Function1Types::TableFile::~TableFile
virtual ~TableFile()=default
Destructor.
Foam::Function1Types::TableBase
Base class for table with bounds handling, interpolation and integration.
Definition: TableBase.H:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56