EmbeddedTableReader.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "EmbeddedTableReader.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Coordinate, class Value>
32 :
33  TableReader<Coordinate, Value>()
34 {}
35 
36 
37 template<class Coordinate, class Value>
39 (
40  const word& name,
41  const Function1s::unitSets& units,
42  const dictionary& dict
43 )
44 :
45  TableReader<Coordinate, Value>()
46 {}
47 
48 
49 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
50 
51 template<class Coordinate, class Value>
53 {}
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
58 template<class Coordinate, class Value>
61 (
62  const Function1s::unitSets& defaultUnits,
63  const dictionary& dict,
64  const word& valuesKeyword
65 ) const
66 {
67  Istream& is = dict.lookup(valuesKeyword);
68  if (dict.found("units"))
69  {
70  Function1s::unitSets units(defaultUnits);
71  units.read(dict.lookup("units"));
73  }
74  else
75  {
76  return TableReader<Coordinate, Value>::convertRead(defaultUnits, is);
77  }
78 }
79 
80 
81 template<class Coordinate, class Value>
84 (
85  const Function1s::unitSets& units,
86  Istream& is
87 )
88 {
90 }
91 
92 
93 template<class Coordinate, class Value>
95 (
96  Ostream& os,
97  const Function1s::unitSets& units,
99  const word& valuesKeyword
100 ) const
101 {
102  writeEntry
103  (
104  os,
105  valuesKeyword,
107  );
108 }
109 
110 
111 // ************************************************************************* //
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
void convertRead(const Function1s::unitSets &units, List< Tuple2< Coordinate, Value >> &table) const
Do unit conversions on input data.
Definition: TableReader.C:32
virtual List< Tuple2< Coordinate, Value > > read(const Function1s::unitSets &units, const dictionary &dict, const word &valuesKeyword="values") const
Read values.
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
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
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dictionary dict
Struct containing two unitSets for use in converting both the argument and the value of a Function1.
void read(Istream &is)
Update from stream.