Loading...
Searching...
No Matches
surfaceReader.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) 2015-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::surfaceReader
28
29Description
30 Abstract base class for surface readers with fields.
31
32 Some readers support different input options, these are typically
33 specified as 'readOptions' in the containing dictionary.
34
35 \verbatim
36 readOptions
37 {
38 default
39 {
40 verbose false;
41 }
42
43 ensight
44 {
45 masterOnly false;
46 }
47 }
48 \endverbatim
49
50SourceFiles
51 surfaceReader.C
52
53\*---------------------------------------------------------------------------*/
54
55#ifndef Foam_surfaceReader_H
56#define Foam_surfaceReader_H
57
58#include "typeInfo.H"
59#include "autoPtr.H"
60#include "MeshedSurfaces.H"
62
63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64
65namespace Foam
66{
68/*---------------------------------------------------------------------------*\
69 Class surfaceReader Declaration
70\*---------------------------------------------------------------------------*/
71
72class surfaceReader
73{
74protected:
75
76 //- File name
78
79
80public:
81
82 //- Runtime type information
83 TypeName("surfaceReader");
84
85
86 // Declare run-time constructor selection table
89 (
90 autoPtr,
93 (
94 const fileName& fName,
95 const dictionary& options
96 ),
97 (fName, options)
98 );
99
100
101 // Helpers
102
103 //- Same as fileFormats::getFormatOptions
105 (
106 const dictionary& dict,
107 const word& formatName,
108 const word& entryName = "formatOptions"
109 );
110
111
112 // Selectors
113
114 //- Return a reference to the selected surfaceReader
116 (
117 const word& readType,
118 const fileName& fName,
119 const dictionary& options = dictionary()
120 );
121
122
123 // Constructors
124
125 //- Construct from fileName
126 explicit surfaceReader(const fileName& fName);
127
128 //- Construct from fileName and specified options
129 surfaceReader(const fileName& fName, const dictionary& options);
130
131
132 //- Destructor
133 virtual ~surfaceReader() = default;
134
135
136 // Member Functions
137
138 //- Return a reference to the surface geometry
139 virtual const meshedSurface& geometry(const label timeIndex) = 0;
140
141 //- Return a list of the available times
142 virtual instantList times() const = 0;
143
144 //- Return a list of the available fields at a given time
145 virtual wordList fieldNames(const label timeIndex) const = 0;
146
147 //- Return a scalar field at a given time
148 virtual tmp<Field<scalar>> field
149 (
150 const label timeIndex,
151 const label fieldIndex,
152 const scalar& refValue = pTraits<scalar>::zero
153 ) const = 0;
154
155 //- Return a vector field at a given time
156 virtual tmp<Field<vector>> field
157 (
158 const label timeIndex,
159 const label fieldIndex,
161 ) const = 0;
162
163 //- Return a sphericalTensor field at a given time
166 const label timeIndex,
167 const label fieldIndex,
169 ) const = 0;
170
171 //- Return a symmTensor field at a given time
173 (
174 const label timeIndex,
175 const label fieldIndex,
176 const symmTensor& refValue = pTraits<symmTensor>::zero
177 ) const = 0;
178
179 //- Return a tensor field at a given time
180 virtual tmp<Field<tensor>> field
181 (
182 const label timeIndex,
183 const label fieldIndex,
184 const tensor& refValue = pTraits<tensor>::zero
185 ) const = 0;
186};
187
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191} // End namespace Foam
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
196#endif
197
198// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
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
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
virtual instantList times() const =0
Return a list of the available times.
virtual tmp< Field< sphericalTensor > > field(const label timeIndex, const label fieldIndex, const sphericalTensor &refValue=pTraits< sphericalTensor >::zero) const =0
Return a sphericalTensor field at a given time.
virtual tmp< Field< vector > > field(const label timeIndex, const label fieldIndex, const vector &refValue=pTraits< vector >::zero) const =0
Return a vector field at a given time.
virtual wordList fieldNames(const label timeIndex) const =0
Return a list of the available fields at a given time.
surfaceReader(const fileName &fName)
Construct from fileName.
virtual tmp< Field< symmTensor > > field(const label timeIndex, const label fieldIndex, const symmTensor &refValue=pTraits< symmTensor >::zero) const =0
Return a symmTensor field at a given time.
declareRunTimeSelectionTable(autoPtr, surfaceReader, fileName,(const fileName &fName, const dictionary &options),(fName, options))
virtual const meshedSurface & geometry(const label timeIndex)=0
Return a reference to the surface geometry.
virtual ~surfaceReader()=default
Destructor.
virtual tmp< Field< tensor > > field(const label timeIndex, const label fieldIndex, const tensor &refValue=pTraits< tensor >::zero) const =0
Return a tensor field at a given time.
static autoPtr< surfaceReader > New(const word &readType, const fileName &fName, const dictionary &options=dictionary())
Return a reference to the selected surfaceReader.
virtual tmp< Field< scalar > > field(const label timeIndex, const label fieldIndex, const scalar &refValue=pTraits< scalar >::zero) const =0
Return a scalar field at a given time.
fileName fileName_
File name.
TypeName("surfaceReader")
Runtime type information.
static dictionary formatOptions(const dictionary &dict, const word &formatName, const word &entryName="formatOptions")
Same as fileFormats::getFormatOptions.
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()
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
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
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
dictionary dict
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68