EmbeddedTableReader.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2020-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::TableReaders::Embedded
26 
27 Description
28  Reads an interpolation table from the \c values entry in OpenFOAM-format.
29 
30  This is a list of Tuple2's where the first (x) column is scalar, and the
31  second (y) column is the type to be interpolated.
32 
33 Usage
34  \verbatim
35  values
36  (
37  (0.0 (1 2 3))
38  (1.0 (4 5 6))
39  );
40  \endverbatim
41 
42 SourceFiles
43  Embedded.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef EmbeddedTableReader_H
48 #define EmbeddedTableReader_H
49 
50 #include "TableReader.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 namespace TableReaders
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class Foam Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class Coordinate, class Value>
64 class Embedded
65 :
66  public TableReader<Coordinate, Value>
67 {
68 public:
69 
70  //- Runtime type information
71  TypeName("embedded");
72 
73 
74  // Constructors
75 
76  //- Default construct
77  Embedded();
78 
79  //- Construct from name and dictionary
80  Embedded
81  (
82  const word& name,
83  const Function1s::unitSets& units,
84  const dictionary& dict
85  );
86 
87  //- Construct and return a copy
89  {
90  return
92  (
94  );
95  }
96 
97 
98  //- Destructor
99  virtual ~Embedded();
100 
101 
102  // Member Functions
103 
104  //- Read values
106  (
107  const Function1s::unitSets& units,
108  const dictionary& dict,
109  const word& valuesKeyword="values"
110  ) const;
111 
112  //- Read values
114  (
115  const Function1s::unitSets& units,
116  Istream& is
117  );
118 
119  //- Write settings and values
120  virtual void write
121  (
122  Ostream& os,
123  const Function1s::unitSets& units,
125  const word& valuesKeyword="values"
126  ) const;
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace TableReaders
133 } // End namespace Foam
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #ifdef NoRepository
138  #include "EmbeddedTableReader.C"
139 #endif
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Base class to read table data for tables.
Definition: TableReader.H:51
Reads an interpolation table from the values entry in OpenFOAM-format.
virtual autoPtr< TableReader< Coordinate, Value > > clone() const
Construct and return a copy.
virtual List< Tuple2< Coordinate, Value > > read(const Function1s::unitSets &units, const dictionary &dict, const word &valuesKeyword="values") const
Read values.
TypeName("embedded")
Runtime type information.
virtual ~Embedded()
Destructor.
virtual void write(Ostream &os, const Function1s::unitSets &units, const List< Tuple2< Coordinate, Value >> &table, const word &valuesKeyword="values") const
Write settings and values.
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:66
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A class for handling words, derived from string.
Definition: word.H:63
const HashTable< dimensionSet > table
Table of dimensions.
Definition: dimensions.C:74
Namespace for OpenFOAM.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict
Struct containing two unitSets for use in converting both the argument and the value of a Function1.