Loading...
Searching...
No Matches
Table.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-2024 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::Function1Types::Table
29
30Description
31 Templated table container function.
32
33 Items are stored in a list of Tuple2, with the first column always
34 being a scalar and the second column (the lookup value) in
35 required data type.
36
37 Usage:
38 Inline specification.
39 \verbatim
40 <entryName> table
41 (
42 (0.0 (1 2 3))
43 (1.0 (4 5 6))
44 );
45 \endverbatim
46
47 Dictionary specification, external data reference.
48 \verbatim
49 <entryName>
50 {
51 type table;
52 file "<case>/path/tableValues";
53 }
54 \endverbatim
55
56 Dictionary specification, embedded content
57 Dictionary form.
58 \verbatim
59 <entryName>
60 {
61 type table;
62 values
63 (
64 (0.0 (1 2 3))
65 (1.0 (4 5 6))
66 );
67 }
68 \endverbatim
69
70Note
71 The external data reference (using the \c file keyword) is
72 used in preference to the \c values specification.
73
74See Also
75 Foam::Function1Types::TableFile
76
77SourceFiles
78 Table.C
79
80\*---------------------------------------------------------------------------*/
81
82#ifndef Foam_Function1Types_Table_H
83#define Foam_Function1Types_Table_H
84
85#include "TableBase.H"
86
87// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88
89namespace Foam
90{
91namespace Function1Types
92{
93
94/*---------------------------------------------------------------------------*\
95 Class Table Declaration
96\*---------------------------------------------------------------------------*/
97
98template<class Type>
99class Table
100:
101 public TableBase<Type>
102{
103 // Private Data
104
105 //- Input name for file-based input (optional)
106 fileName fName_;
107
108
109 // Private Member Functions
110
111 //- No copy assignment
112 void operator=(const Table<Type>&) = delete;
113
114public:
115
116 //- Runtime type information
117 TypeName("table");
119
120 // Constructors
121
122 //- Construct from entry name, dictionary and optional registry
123 Table
124 (
125 const word& entryName,
126 const dictionary& dict,
127 const objectRegistry* obrPtr = nullptr
128 );
129
130 //- Copy construct
131 explicit Table(const Table<Type>& tbl);
132
133 //- Return a clone
134 virtual tmp<Function1<Type>> clone() const
135 {
136 return Function1<Type>::Clone(*this);
137 }
138
139
140 //- Destructor
141 virtual ~Table() = default;
142
143
144 // Member Functions
145
146 //- Write coefficients in dictionary format
147 virtual void writeData(Ostream& os) const;
148};
149
151// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152
153} // End namespace Function1Types
154} // End namespace Foam
155
156// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157
158#ifdef NoRepository
159 #include "Table.C"
160#endif
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164#endif
165
166// ************************************************************************* //
TableBase(const word &name, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from dictionary - note table is not populated.
Definition TableBase.C:56
TypeName("table")
Runtime type information.
virtual tmp< Function1< Type > > clone() const
Return a clone.
Definition Table.H:141
Table(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from entry name, dictionary and optional registry.
Definition Table.C:28
virtual ~Table()=default
Destructor.
virtual void writeData(Ostream &os) const
Write coefficients in dictionary format.
Definition Table.C:96
static tmp< Function1< Type > > Clone(const Derived &fun)
Clone a Function1.
Definition Function1.H:190
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
Registry of regIOobjects.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68