TableFile.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-2015 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::TableFile
26 
27 Description
28  Templated table container data entry where data is read from file.
29 
30  \verbatim
31  <entryName> tableFile;
32  <entryName>Coeffs
33  {
34  dimensions [0 0 1 0 0]; // optional dimensions
35  fileName dataFile; // name of data file
36  outOfBounds clamp; // optional out-of-bounds handling
37  interpolationScheme linear; // optional interpolation method
38  }
39  \endverbatim
40 
41  Items are stored in a list of Tuple2's. First column is always stored as
42  scalar entries. Data is read in the form, e.g. for an entry <entryName>
43  that is (scalar, vector):
44  \verbatim
45  (
46  (0.0 (1 2 3))
47  (1.0 (4 5 6))
48  );
49  \endverbatim
50 
51 
52 SourceFiles
53  TableFile.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef TableFile_H
58 #define TableFile_H
59 
60 #include "DataEntry.H"
61 #include "Tuple2.H"
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 
68 template<class Type>
69 class TableFile;
70 
71 template<class Type>
72 Ostream& operator<<
73 (
74  Ostream&,
75  const TableFile<Type>&
76 );
77 
78 /*---------------------------------------------------------------------------*\
79  Class TableFile Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 template<class Type>
83 class TableFile
84 :
85  public TableBase<Type>
86 {
87  // Private data
88 
89  //- File name for csv table (optional)
91 
92 
93  // Private Member Functions
94 
95  //- Disallow default bitwise assignment
96  void operator=(const TableFile<Type>&);
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("tableFile");
103 
104 
105  // Constructors
106 
107  //- Construct from entry name and Istream
108  TableFile(const word& entryName, const dictionary& dict);
109 
110  //- Copy constructor
111  TableFile(const TableFile<Type>& tbl);
112 
113  //- Construct and return a clone
114  virtual tmp<DataEntry<Type> > clone() const
115  {
116  return tmp<DataEntry<Type> >(new TableFile<Type>(*this));
117  }
118 
119 
120  //- Destructor
121  virtual ~TableFile();
122 
123 
124  // I/O
125 
126  //- Write in dictionary format
127  virtual void writeData(Ostream& os) const;
128 };
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace Foam
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #ifdef NoRepository
138 # include "TableFile.C"
139 #endif
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
Foam::TableFile
Templated table container data entry where data is read from file.
Definition: TableFile.H:68
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::TableFile::~TableFile
virtual ~TableFile()
Destructor.
Definition: TableFile.C:72
Tuple2.H
TableFile.C
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::TableFile::writeData
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition: TableFileIO.C:31
Foam::TableFile::fName_
fileName fName_
File name for csv table (optional)
Definition: TableFile.H:89
Foam::TableFile::TableFile
TableFile(const word &entryName, const dictionary &dict)
Construct from entry name and Istream.
Definition: TableFile.C:31
DataEntry.H
Foam::TableFile::operator=
void operator=(const TableFile< Type > &)
Disallow default bitwise assignment.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::TableFile::clone
virtual tmp< DataEntry< Type > > clone() const
Construct and return a clone.
Definition: TableFile.H:113
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::TableFile::TypeName
TypeName("tableFile")
Runtime type information.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::TableBase
Base class for table with bounds handling, interpolation and integration.
Definition: TableBase.H:47