tableReader.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-2016 OpenFOAM Foundation
9  Copyright (C) 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::tableReader
29 
30 Description
31  Base class to read table data for the interpolationTable
32 
33 SourceFiles
34  tableReader.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef tableReader_H
39 #define tableReader_H
40 
41 #include "fileName.H"
42 #include "wordList.H"
43 #include "vector.H"
44 #include "tensor.H"
45 #include "typeInfo.H"
46 #include "runTimeSelectionTables.H"
47 #include "autoPtr.H"
48 #include "dictionary.H"
49 #include "Tuple2.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class tableReader Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class Type>
61 class tableReader
62 {
63 public:
64 
65  //- Declare type-name, virtual type (with debug switch)
66  TypeName("tableReader");
67 
68 
69  // Declare run-time constructor selection table
70 
72  (
73  autoPtr,
75  dictionary,
76  (const dictionary& dict),
77  (dict)
78  );
79 
80 
81  // Constructors
82 
83  //- Default construct
84  tableReader() = default;
85 
86  //- Construct from dictionary
87  tableReader(const dictionary& dict);
88 
89  //- Construct and return a clone
90  virtual autoPtr<tableReader<Type>> clone() const = 0;
91 
92 
93  // Selectors
94 
95  //- Return a reference to the selected tableReader
96  static autoPtr<tableReader> New(const dictionary& spec);
97 
98 
99  //- Destructor
100  virtual ~tableReader() = default;
101 
102 
103  // Member Functions
104 
105  //- Read 1D table
106  virtual void operator()
107  (
108  const fileName& fName,
110  ) = 0;
111 
112  //- Read 2D table
113  virtual void operator()
114  (
115  const fileName& fName,
117  ) = 0;
118 
119  //- Write additional information
120  virtual void write(Ostream& os) const;
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #ifdef NoRepository
131  #include "tableReader.C"
132 #endif
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #endif
138 
139 // ************************************************************************* //
tableReader.C
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
typeInfo.H
Tuple2.H
Foam::tableReader
Base class to read table data for the interpolationTable.
Definition: tableReader.H:60
Foam::tableReader::TypeName
TypeName("tableReader")
Declare type-name, virtual type (with debug switch)
tensor.H
wordList.H
Foam::tableReader::tableReader
tableReader()=default
Default construct.
fileName.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::tableReader::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, tableReader, dictionary,(const dictionary &dict),(dict))
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
dictionary.H
Foam::tableReader::write
virtual void write(Ostream &os) const
Write additional information.
Definition: tableReader.C:72
vector.H
Foam::tableReader::clone
virtual autoPtr< tableReader< Type > > clone() const =0
Construct and return a clone.
Foam::tableReader::~tableReader
virtual ~tableReader()=default
Destructor.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::tableReader::New
static autoPtr< tableReader > New(const dictionary &spec)
Return a reference to the selected tableReader.
Definition: tableReader.C:35
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
autoPtr.H