multivariateSurfaceInterpolationScheme.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-2016 OpenFOAM Foundation
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::multivariateSurfaceInterpolationScheme
28
29Description
30 Abstract base class for multi-variate surface interpolation schemes.
31
32SourceFiles
33 multivariateSurfaceInterpolationScheme.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef multivariateSurfaceInterpolationScheme_H
38#define multivariateSurfaceInterpolationScheme_H
39
41#include "HashTable.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class multivariateSurfaceInterpolationScheme Declaration
50\*---------------------------------------------------------------------------*/
51
52template<class Type>
54:
55 public refCount
56{
57
58public:
59
60 //- fieldTable
61 class fieldTable
62 :
63 public HashTable<const GeometricField<Type, fvPatchField, volMesh>*>
64 {
65 public:
68 {}
71 {
72 this->insert(f.name(), &f);
73 }
74 };
75
76
77private:
78
79 // Private data
80
81 //- Hold reference to mesh
82 const fvMesh& mesh_;
83
84 //- HashTable of pointers to the field set
85 const fieldTable& fields_;
86
87
88 // Private Member Functions
89
90 //- No copy construct
92 (
94 ) = delete;
95
96 //- No copy assignment
97 void operator=(const multivariateSurfaceInterpolationScheme&) = delete;
98
99
100public:
101
102 //- Runtime type information
103 virtual const word& type() const = 0;
104
105
106 // Declare run-time constructor selection tables
109 (
110 tmp,
112 Istream,
113 (
114 const fvMesh& mesh,
115 const fieldTable& fields,
116 const surfaceScalarField& faceFlux,
117 Istream& is
118 ),
119 (mesh, fields, faceFlux, is)
120 );
121
122
123 // Constructors
124
125 //- Construct for interpolating given field
127 (
128 const fvMesh& mesh,
129 const fieldTable& fields,
130 const surfaceScalarField& faceFlux,
131 Istream& schemeData
132 );
133
134
135 // Selectors
136
137 //- Return a pointer to a new gradScheme created on freestore
139 (
140 const fvMesh& mesh,
141 const fieldTable& fields,
142 const surfaceScalarField& faceFlux,
143 Istream& schemeData
144 );
145
146
147 //- Destructor
148 virtual ~multivariateSurfaceInterpolationScheme() = default;
149
150
151 // Member Functions
152
153 //- Return mesh reference
154 const fvMesh& mesh() const
155 {
156 return mesh_;
157 }
158
159 //- Return fields to be interpolated
160 const fieldTable& fields() const
161 {
162 return fields_;
163 }
164
165
166 // Member Operators
167
168 //- surfaceInterpolationScheme sub-class returned by operator(field)
169 // which is used as the interpolation scheme for the field
170 class fieldScheme
171 :
172 public surfaceInterpolationScheme<Type>
173 {
174
175 public:
176
177 // Constructors
180 (
182 )
183 :
185 {}
186
187
188 // Member Functions
189
190 //- Return the interpolation weighting factors
192 (
194 ) const = 0;
195 };
197 virtual tmp<surfaceInterpolationScheme<Type>> operator()
198 (
200 ) const = 0;
201};
202
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206} // End namespace Foam
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210// Add the patch constructor functions to the hash tables
212#define makeMultivariateSurfaceInterpolationTypeScheme(SS, Type) \
213 \
214defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
215 \
216multivariateSurfaceInterpolationScheme<Type>:: \
217addIstreamConstructorToTable<SS<Type>> \
218 add##SS##Type##ConstructorToTable_;
219
221#define makeMultivariateSurfaceInterpolationScheme(SS) \
222 \
223makeMultivariateSurfaceInterpolationTypeScheme(SS, scalar) \
224makeMultivariateSurfaceInterpolationTypeScheme(SS, vector) \
225makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor) \
226makeMultivariateSurfaceInterpolationTypeScheme(SS, symmTensor) \
227makeMultivariateSurfaceInterpolationTypeScheme(SS, tensor)
228
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#ifdef NoRepository
234#endif
235
236// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237
238#endif
239
240// ************************************************************************* //
Generic GeometricField class.
A HashTable similar to std::unordered_map.
Definition: HashTable.H:123
bool insert(const word &key, const const GeometricField< Type, fvPatchField, volMesh > * &obj)
Copy insert a new entry, not overwriting existing entries.
Definition: HashTableI.H:180
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
surfaceInterpolationScheme sub-class returned by operator(field)
virtual tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &field) const =0
Return the interpolation weighting factors.
fieldScheme(const GeometricField< Type, fvPatchField, volMesh > &field)
void add(const GeometricField< Type, fvPatchField, volMesh > &f)
Abstract base class for multi-variate surface interpolation schemes.
virtual ~multivariateSurfaceInterpolationScheme()=default
Destructor.
static tmp< multivariateSurfaceInterpolationScheme< Type > > New(const fvMesh &mesh, const fieldTable &fields, const surfaceScalarField &faceFlux, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
const fieldTable & fields() const
Return fields to be interpolated.
declareRunTimeSelectionTable(tmp, multivariateSurfaceInterpolationScheme, Istream,(const fvMesh &mesh, const fieldTable &fields, const surfaceScalarField &faceFlux, Istream &is),(mesh, fields, faceFlux, is))
multivariateSurfaceInterpolationScheme(const fvMesh &mesh, const fieldTable &fields, const surfaceScalarField &faceFlux, Istream &schemeData)
Construct for interpolating given field.
virtual const word & type() const =0
Runtime type information.
Reference counter for various OpenFOAM components.
Definition: refCount.H:51
Abstract base class for surface interpolation schemes.
const fvMesh & mesh() const
Return mesh reference.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
Namespace for OpenFOAM.
labelList f(nPoints)
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)