Loading...
Searching...
No Matches
boundaryDataSurfaceReader.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) 2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::boundaryDataSurfaceReader
28
29Description
30 A boundaryData format surface reader.
31 However, the "surface" represented by boundaryData is actually only
32 point data!
33
34 // Points
35 <case>/constant/region0/"boundaryData"/patchName/points
36
37 // Values
38 <case>/constant/region0/"boundaryData"/patchName/TIME/field
39
40 \verbatim
41 readOptions
42 {
43 boundaryData
44 {
45 points points;
46 }
47 }
48 \endverbatim
49
50 Format options for boundaryData:
51 \table
52 Property | Description | Required | Default
53 points | Name of the "points" file | no | points
54 \endtable
55
56SourceFiles
57 boundaryDataSurfaceReader.C
58 boundaryDataSurfaceReader.txx
59
60\*---------------------------------------------------------------------------*/
61
62#ifndef Foam_boundaryDataSurfaceReader_H
63#define Foam_boundaryDataSurfaceReader_H
64
65#include "surfaceReader.H"
66
67// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68
69namespace Foam
70{
71
72// Forward Declarations
73class Time;
74
75/*---------------------------------------------------------------------------*\
76 Class boundaryDataSurfaceReader Declaration
77\*---------------------------------------------------------------------------*/
78
80:
81 public surfaceReader
82{
83 // Private Data
85 //- Base directory
86 fileName baseDir_;
87
88 //- Name of the 'points' file
89 word pointsName_;
90
91 //- Times
92 instantList timeValues_;
93
94 //- Field names
95 mutable List<word> fieldNames_;
96
97 //- Pointer to the surface
99
100
101 // Private Member Functions
102
103 //- Populate time instances
104 void readCase();
105
106 //- Read geometry
107 void readGeometry(meshedSurface& surf, const label timeIndex);
108
109 //- Read and return given field
110 template<class Type>
111 tmp<Field<Type>> readFieldTemplate
112 (
113 const label timeIndex,
114 const label fieldIndex
115 ) const;
116
117
118public:
119
120 //- Runtime type information
121 TypeName("boundaryData");
122
123
124 // Constructors
125
126 //- Construct from fileName
128 (
129 const fileName& fName,
130 const word& pointsName = "points"
131 );
132
133 //- Construct from fileName with reader options
135 (
136 const fileName& fName,
137 const dictionary& options,
138 const word& pointsName = "points"
139 );
140
141
142 //- Destructor
143 virtual ~boundaryDataSurfaceReader() = default;
145
146 // Static Member Functions
147
148 //- Read points file
150 (
151 const Time& runTime,
152 const fileName& baseDir,
153 const word& pointsName = "points"
154 );
155
156 //- Read points file
158 (
159 const fileName& baseDir,
160 const word& pointsName = "points"
161 );
162
163 //- Read and return given field
164 template<class Type>
166 (
167 const Time& runTime,
168 const fileName& baseDir,
169 const instant& timeDir,
170 const word& fieldName,
171 Type& avg
172 );
173
174 //- Read and return given field
175 template<class Type>
177 (
178 const fileName& baseDir,
179 const instant& timeDir,
180 const word& fieldName,
181 Type& avg
182 );
183
184
185 // Member Functions
186
187 //- Return a reference to the surface geometry
188 virtual const meshedSurface& geometry(const label timeIndex);
189
190 //- Return a list of the available times
191 virtual instantList times() const;
192
193 //- Return a list of the available fields at a given time
194 virtual wordList fieldNames(const label timeIndex) const;
195
196 //- Return a scalar field at a given time
197 virtual tmp<Field<scalar>> field
198 (
199 const label timeIndex,
200 const label fieldIndex,
201 const scalar& refValue = pTraits<scalar>::zero
202 ) const;
203
204 //- Return a vector field at a given time
205 virtual tmp<Field<vector>> field
206 (
207 const label timeIndex,
208 const label fieldIndex,
209 const vector& refValue = pTraits<vector>::zero
210 ) const;
211
212 //- Return a sphericalTensor field at a given time
214 (
215 const label timeIndex,
216 const label fieldIndex,
218 ) const;
219
220 //- Return a symmTensor field at a given time
222 (
223 const label timeIndex,
224 const label fieldIndex,
225 const symmTensor& refValue = pTraits<symmTensor>::zero
226 ) const;
227
228 //- Return a tensor field at a given time
229 virtual tmp<Field<tensor>> field
230 (
231 const label timeIndex,
232 const label fieldIndex,
233 const tensor& refValue = pTraits<tensor>::zero
234 ) const;
235};
236
237
238// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239
240} // End namespace Foam
241
242// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243
244#ifdef NoRepository
245 #include "boundaryDataSurfaceReader.txx"
246#endif
247
248// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249
250#endif
251
252// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A boundaryData format surface reader. However, the "surface" represented by boundaryData is actually ...
virtual instantList times() const
Return a list of the available times.
virtual ~boundaryDataSurfaceReader()=default
Destructor.
boundaryDataSurfaceReader(const fileName &fName, const word &pointsName="points")
Construct from fileName.
static tmp< Field< Type > > readField(const fileName &baseDir, const instant &timeDir, const word &fieldName, Type &avg)
Read and return given field.
static pointField readPoints(const Time &runTime, const fileName &baseDir, const word &pointsName="points")
Read points file.
static tmp< Field< Type > > readField(const Time &runTime, const fileName &baseDir, const instant &timeDir, const word &fieldName, Type &avg)
Read and return given field.
virtual const meshedSurface & geometry(const label timeIndex)
Return a reference to the surface geometry.
TypeName("boundaryData")
Runtime type information.
virtual wordList fieldNames(const label timeIndex) const
Return a list of the available fields at a given time.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Definition instant.H:56
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
Abstract base class for surface readers with fields.
surfaceReader(const fileName &fName)
Construct from fileName.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
engineTime & runTime
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
List< instant > instantList
List of instants.
Definition instantList.H:41
Tensor< scalar > tensor
Definition symmTensor.H:57
MeshedSurface< face > meshedSurface
vectorField pointField
pointField is a vectorField.
Vector< scalar > vector
Definition vector.H:57
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition symmTensor.H:55
label timeIndex
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68