TableReader.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) 2011-2020 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::TableReader
26 
27 Description
28  Base class to read table data for tables
29 
30 SourceFiles
31  TableReader.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef TableReader_H
36 #define TableReader_H
37 
38 #include "dictionary.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class TableReader Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class Type>
50 class TableReader
51 {
52 
53 public:
54 
55  //- Runtime type information
56  TypeName("TableReader");
57 
58 
59  // Declare run-time constructor selection table
60 
62  (
63  autoPtr,
65  dictionary,
66  (
67  const word& name,
68  const dictionary& dict,
70  ),
71  (name, dict, table)
72  );
73 
74 
75  // Constructors
76 
77  //- Construct from dictionary
78  TableReader(const dictionary& dict);
79 
80  //- Construct and return a clone
81  virtual autoPtr<TableReader<Type>> clone() const = 0;
82 
83 
84  // Selector
86  (
87  const word& name,
88  const dictionary& dict,
90  );
91 
92 
93  //- Destructor
94  virtual ~TableReader();
95 
96 
97  // Member Functions
98 
99  //- Write additional information
100  virtual void write
101  (
102  Ostream& os,
103  const List<Tuple2<scalar, Type>>& table
104  ) const;
105 };
106 
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 } // End namespace Foam
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 #define defineTableReader(Type) \
115  \
116  defineNamedTemplateTypeNameAndDebug(TableReader<Type>, 0); \
117  \
118  defineTemplateRunTimeSelectionTable(TableReader<Type>, dictionary);
119 
121 #define makeTableReader(SS, Type) \
122  \
123  defineNamedTemplateTypeNameAndDebug(TableReaders::SS<Type>, 0); \
124  \
125  TableReader<Type>::adddictionaryConstructorToTable<TableReaders::SS<Type>> \
126  add##SS##Type##ConstructorToTable_;
128 #define makeTableReaders(Type) \
129  defineTableReader(Type); \
130  makeTableReader(Embedded, Type); \
131  makeTableReader(Foam, Type); \
132  makeTableReader(Csv, Type)
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #ifdef NoRepository
138  #include "TableReader.C"
139  #include "TableReaderNew.C"
140 #endif
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
Base class to read table data for tables.
Definition: TableReader.H:49
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A 2-tuple for storing two objects of different types.
Definition: HashTable.H:65
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
declareRunTimeSelectionTable(autoPtr, TableReader, dictionary,(const word &name, const dictionary &dict, List< Tuple2< scalar, Type >> &table),(name, dict, table))
A class for handling words, derived from string.
Definition: word.H:59
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
TableReader(const dictionary &dict)
Construct from dictionary.
Definition: TableReader.C:31
virtual autoPtr< TableReader< Type > > clone() const =0
Construct and return a clone.
TypeName("TableReader")
Runtime type information.
virtual ~TableReader()
Destructor.
Definition: TableReader.C:38
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
static autoPtr< TableReader< Type > > New(const word &name, const dictionary &dict, List< Tuple2< scalar, Type >> &table)
virtual void write(Ostream &os, const List< Tuple2< scalar, Type >> &table) const
Write additional information.
Definition: TableReader.C:46
Namespace for OpenFOAM.