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 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::surfaceReader
28 
29 Description
30  Base class for surface readers
31 
32 SourceFiles
33  surfaceReader.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef surfaceReader_H
38 #define surfaceReader_H
39 
40 #include "typeInfo.H"
41 #include "autoPtr.H"
42 #include "MeshedSurfaces.H"
43 #include "runTimeSelectionTables.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class surfaceReader Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class surfaceReader
55 {
56 protected:
57 
58  //- File name
60 
61 
62 public:
63 
64  //- Runtime type information
65  TypeName("surfaceReader");
66 
67  // Declare run-time constructor selection table
68 
70  (
71  autoPtr,
73  fileName,
74  (
75  const fileName& fName
76  ),
77  (fName)
78  );
79 
80 
81  // Selectors
82 
83  //- Return a reference to the selected surfaceReader
85  (
86  const word& readType,
87  const fileName& fName
88  );
89 
90 
91  // Constructors
92 
93  //- Construct from fileName
94  surfaceReader(const fileName& fName);
95 
96 
97  //- Destructor
98  virtual ~surfaceReader() = default;
99 
100 
101  // Member Functions
102 
103  //- Return a reference to the surface geometry
104  virtual const meshedSurface& geometry(const label timeIndex) = 0;
105 
106  //- Return a list of the available times
107  virtual instantList times() const = 0;
108 
109  //- Return a list of the available fields at a given time
110  virtual wordList fieldNames(const label timeIndex) const = 0;
111 
112  //- Return a scalar field at a given time
113  virtual tmp<Field<scalar>> field
114  (
115  const label timeIndex,
116  const label fieldIndex,
117  const scalar& refValue = pTraits<scalar>::zero
118  ) const = 0;
119 
120  //- Return a vector field at a given time
121  virtual tmp<Field<vector>> field
122  (
123  const label timeIndex,
124  const label fieldIndex,
125  const vector& refValue = pTraits<vector>::zero
126  ) const = 0;
127 
128  //- Return a sphericalTensor field at a given time
130  (
131  const label timeIndex,
132  const label fieldIndex,
134  ) const = 0;
135 
136  //- Return a symmTensor field at a given time
138  (
139  const label timeIndex,
140  const label fieldIndex,
141  const symmTensor& refValue = pTraits<symmTensor>::zero
142  ) const = 0;
143 
144  //- Return a tensor field at a given time
145  virtual tmp<Field<tensor>> field
146  (
147  const label timeIndex,
148  const label fieldIndex,
149  const tensor& refValue = pTraits<tensor>::zero
150  ) const = 0;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 
161 #endif
162 
163 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::SymmTensor< scalar >
Foam::surfaceReader
Base class for surface readers.
Definition: surfaceReader.H:53
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
typeInfo.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::surfaceReader::New
static autoPtr< surfaceReader > New(const word &readType, const fileName &fName)
Return a reference to the selected surfaceReader.
Definition: surfaceReaderNew.C:33
Foam::surfaceReader::surfaceReader
surfaceReader(const fileName &fName)
Construct from fileName.
Definition: surfaceReader.C:41
Foam::surfaceReader::fieldNames
virtual wordList fieldNames(const label timeIndex) const =0
Return a list of the available fields at a given time.
Foam::surfaceReader::~surfaceReader
virtual ~surfaceReader()=default
Destructor.
Foam::surfaceReader::fileName_
fileName fileName_
File name.
Definition: surfaceReader.H:58
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor< scalar >
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::surfaceReader::field
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.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::surfaceReader::times
virtual instantList times() const =0
Return a list of the available times.
Foam::Vector< scalar >
Foam::surfaceReader::geometry
virtual const meshedSurface & geometry(const label timeIndex)=0
Return a reference to the surface geometry.
Foam::List< instant >
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
MeshedSurfaces.H
Foam::surfaceReader::TypeName
TypeName("surfaceReader")
Runtime type information.
Foam::surfaceReader::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, surfaceReader, fileName,(const fileName &fName),(fName))
timeIndex
label timeIndex
Definition: getTimeIndex.H:30
Foam::MeshedSurface< face >
autoPtr.H