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 | Copyright (C) 2011 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 the interpolationTable
29 
30 SourceFiles
31  tableReader.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef tableReader_H
36 #define tableReader_H
37 
38 #include "fileName.H"
39 #include "wordList.H"
40 #include "vector.H"
41 #include "tensor.H"
42 #include "typeInfo.H"
43 #include "runTimeSelectionTables.H"
44 #include "autoPtr.H"
45 #include "dictionary.H"
46 #include "Tuple2.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class tableReader Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
58 class tableReader
59 {
60 
61 public:
62 
63  //- Runtime type information
64  TypeName("tableReader");
65 
66  // Declare run-time constructor selection table
67 
69  (
70  autoPtr,
72  dictionary,
73  (const dictionary& dict),
74  (dict)
75  );
76 
77 
78  // Constructors
79 
80  //- Construct from dictionary
81  tableReader(const dictionary& dict);
82 
83  //- Construct and return a clone
84  virtual autoPtr<tableReader<Type> > clone() const = 0;
85 
86 
87  // Selectors
88 
89  //- Return a reference to the selected tableReader
90  static autoPtr<tableReader> New(const dictionary& spec);
91 
92 
93  //- Destructor
94  virtual ~tableReader();
95 
96 
97  // Member functions
98 
99  //- Read the table
100  virtual void operator()
101  (
102  const fileName&,
104  ) = 0;
105 
106  //- Read the 2D table
107  virtual void operator()
108  (
109  const fileName&,
111  ) = 0;
112 
113  //- Write additional information
114  virtual void write(Ostream& os) const;
115 };
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #ifdef NoRepository
125 # include "tableReader.C"
126 #endif
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #endif
132 
133 // ************************************************************************* //
declareRunTimeSelectionTable(autoPtr, tableReader, dictionary,(const dictionary &dict),(dict))
virtual void write(Ostream &os) const
Write additional information.
Definition: tableReader.C:79
Macros to ease declaration of run-time selection tables.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
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
dictionary dict
static autoPtr< tableReader > New(const dictionary &spec)
Return a reference to the selected tableReader.
Definition: tableReader.C:32
Base class to read table data for the interpolationTable.
Definition: tableReader.H:57
virtual ~tableReader()
Destructor.
Definition: tableReader.C:72
A class for handling file names.
Definition: fileName.H:69
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual autoPtr< tableReader< Type > > clone() const =0
Construct and return a clone.
tableReader(const dictionary &dict)
Construct from dictionary.
Definition: tableReader.C:65
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
TypeName("tableReader")
Runtime type information.