FoamTableReader.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::TableReaders::Foam
26 
27 Description
28  Reads an interpolation table from a file in OpenFOAM-format. This is a list
29  of Tuple2's where the first (x) column is scalar, and the second (y) column
30  is the type to be interpolated.
31 
32  Usage:
33  \verbatim
34  (
35  (0.0 (1 2 3))
36  (1.0 (4 5 6))
37  );
38  \endverbatim
39 
40 SourceFiles
41  FoamTableReader.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef FoamTableReader_H
46 #define FoamTableReader_H
47 
48 #include "TableFileReader.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 namespace TableReaders
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class Foam Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Type>
62 class Foam
63 :
64  public TableFileReader<Type>
65 {
66  // Private Member Functions
67 
68  //- Read a 1D table
69  virtual void read(ISstream&, List<Tuple2<scalar, Type>> &) const;
70 
71 
72 public:
73 
74  //- Runtime type information
75  TypeName("foam");
76 
77 
78  // Constructors
79 
80  //- Construct from dictionary
81  Foam
82  (
83  const word& name,
84  const dictionary &dict,
86  );
87 
88  //- Construct and return a copy
89  virtual autoPtr<TableReader<Type>> clone() const
90  {
91  return autoPtr<TableReader<Type>>(new Foam<Type>(*this));
92  }
93 
94 
95  //- Destructor
96  virtual ~Foam();
97 };
98 
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 } // End namespace TableReaders
103 } // End namespace Foam
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 #ifdef NoRepository
108  #include "FoamTableReader.C"
109 #endif
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 #endif
114 
115 // ************************************************************************* //
TypeName("foam")
Runtime type information.
dictionary dict
virtual autoPtr< TableReader< Type > > clone() const
Construct and return a copy.
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
Reads an interpolation table from a file in OpenFOAM-format. This is a list of Tuple2&#39;s where the fir...
Base class to read table data for tables.
virtual ~Foam()
Destructor.
A class for handling words, derived from string.
Definition: word.H:59
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Generic input stream.
Definition: ISstream.H:52
Foam(const word &name, const dictionary &dict, List< Tuple2< scalar, Type >> &table)
Construct from dictionary.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Namespace for OpenFOAM.