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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::Function1Types::TableFile
29
30Description
31 Templated table container function where data are read from file.
32
33 Usage:
34 \verbatim
35 <entryName> tableFile;
36 <entryName>Coeffs
37 {
38 file dataFile; // name of data file
39 outOfBounds clamp; // optional out-of-bounds handling
40 interpolationScheme linear; // optional interpolation method
41 }
42 \endverbatim
43
44 Data are stored as a list of Tuple2's. First column is always stored as
45 scalar entries. Data are read in the form, e.g. for an entry <entryName>
46 that is (scalar, vector):
47 \verbatim
48 (
49 (0.0 (1 2 3))
50 (1.0 (4 5 6))
51 );
52 \endverbatim
53
54See Also
55 Foam::Function1Types::Table
56
57SourceFiles
58 TableFile.C
59
60\*---------------------------------------------------------------------------*/
61
62#ifndef Function1Types_TableFile_H
63#define Function1Types_TableFile_H
64
65#include "TableBase.H"
66
67// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68
69namespace Foam
70{
71namespace Function1Types
72{
73
74/*---------------------------------------------------------------------------*\
75 Class TableFile Declaration
76\*---------------------------------------------------------------------------*/
77
78template<class Type>
79class TableFile
80:
81 public TableBase<Type>
82{
83 // Private Data
84
85 //- File name for table (mandatory)
86 fileName fName_;
87
88
89 // Private Member Functions
90
91 //- No copy assignment
92 void operator=(const TableFile<Type>&) = delete;
93
94
95public:
96
97 //- Runtime type information
98 TypeName("tableFile");
99
100
101 // Constructors
102
103 //- Construct from entry name and "file" found in dictionary
105 (
106 const word& entryName,
107 const dictionary& dict,
108 const objectRegistry* obrPtr = nullptr
109 );
110
111 //- Copy construct
112 explicit TableFile(const TableFile<Type>& tbl);
113
114 //- Construct and return a clone
115 virtual tmp<Function1<Type>> clone() const
116 {
117 return tmp<Function1<Type>>(new TableFile<Type>(*this));
118 }
119
120
121 //- Destructor
122 virtual ~TableFile() = default;
123
124
125 // Member Functions
126
127 //- Write in dictionary format
128 virtual void writeData(Ostream& os) const;
129};
130
131
132// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133
134} // End namespace Function1Types
135} // End namespace Foam
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139#ifdef NoRepository
140 #include "TableFile.C"
141#endif
142
143// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
145#endif
146
147// ************************************************************************* //
Base class for table with bounds handling, interpolation and integration.
Definition: TableBase.H:63
Templated table container function where data are read from file.
Definition: TableFile.H:81
TypeName("tableFile")
Runtime type information.
virtual tmp< Function1< Type > > clone() const
Construct and return a clone.
Definition: TableFile.H:114
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition: TableFile.C:75
virtual ~TableFile()=default
Destructor.
const word const dictionary & dict
Definition: Function1.H:134
const word const dictionary const objectRegistry * obrPtr
Definition: Function1.H:136
const word & entryName
Definition: Function1.H:133
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
Registry of regIOobjects.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73