multivariateSurfaceInterpolationScheme.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::multivariateSurfaceInterpolationScheme
26 
27 Description
28  Abstract base class for multi-variate surface interpolation schemes.
29 
30 SourceFiles
31  multivariateSurfaceInterpolationScheme.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef multivariateSurfaceInterpolationScheme_H
36 #define multivariateSurfaceInterpolationScheme_H
37 
39 #include "HashTable.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class multivariateSurfaceInterpolationScheme Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class Type>
52 :
53  public tmp<multivariateSurfaceInterpolationScheme<Type>>::refCount
54 {
55 
56 public:
57 
58  //- fieldTable
59  class fieldTable
60  :
61  public HashTable<const GeometricField<Type, fvPatchField, volMesh>*>
62  {
63  public:
64 
65  fieldTable()
66  {}
67 
69  {
70  this->insert(f.name(), &f);
71  }
72  };
73 
74 
75 private:
76 
77  // Private Data
78 
79  //- Hold reference to mesh
80  const fvMesh& mesh_;
81 
82  //- HashTable of pointers to the field set
83  const fieldTable& fields_;
84 
85 
86 public:
87 
88  //- Runtime type information
89  virtual const word& type() const = 0;
90 
91 
92  // Declare run-time constructor selection tables
93 
95  (
96  tmp,
98  Istream,
99  (
100  const fvMesh& mesh,
101  const fieldTable& fields,
102  const surfaceScalarField& faceFlux,
103  Istream& is
104  ),
105  (mesh, fields, faceFlux, is)
106  );
107 
108 
109  // Constructors
110 
111  //- Construct for interpolating given field
113  (
114  const fvMesh& mesh,
115  const fieldTable& fields,
116  const surfaceScalarField& faceFlux,
117  Istream& schemeData
118  );
119 
120  //- Disallow default bitwise copy construction
122  (
124  );
125 
126 
127  // Selectors
128 
129  //- Return a pointer to a new gradScheme created on freestore
131  (
132  const fvMesh& mesh,
133  const fieldTable& fields,
134  const surfaceScalarField& faceFlux,
135  Istream& schemeData
136  );
137 
138 
139  //- Destructor
141 
142 
143  // Member Functions
144 
145  //- Return mesh reference
146  const fvMesh& mesh() const
147  {
148  return mesh_;
149  }
150 
151  //- Return fields to be interpolated
152  const fieldTable& fields() const
153  {
154  return fields_;
155  }
156 
157 
158  // Member Operators
159 
160  //- Disallow default bitwise assignment
162 
163  //- surfaceInterpolationScheme sub-class returned by operator(field)
164  // which is used as the interpolation scheme for the field
165  class fieldScheme
166  :
167  public surfaceInterpolationScheme<Type>
168  {
169 
170  public:
171 
172  // Constructors
173 
175  (
177  )
178  :
179  surfaceInterpolationScheme<Type>(field.mesh())
180  {}
181 
182 
183  // Member Functions
184 
185  //- Return the interpolation weighting factors
186  virtual tmp<surfaceScalarField> weights
187  (
189  ) const = 0;
190  };
191 
193  (
195  ) const = 0;
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 // Add the patch constructor functions to the hash tables
207 #define makeMultivariateSurfaceInterpolationTypeScheme(SS, Type) \
208  \
209 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
210  \
211 multivariateSurfaceInterpolationScheme<Type>:: \
212 addIstreamConstructorToTable<SS<Type>> \
213  add##SS##Type##ConstructorToTable_;
214 
216 #define makeMultivariateSurfaceInterpolationScheme(SS) \
217  \
218 makeMultivariateSurfaceInterpolationTypeScheme(SS, scalar) \
219 makeMultivariateSurfaceInterpolationTypeScheme(SS, vector) \
220 makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor) \
221 makeMultivariateSurfaceInterpolationTypeScheme(SS, symmTensor) \
222 makeMultivariateSurfaceInterpolationTypeScheme(SS, tensor)
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #ifdef NoRepository
229 #endif
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
const word & name() const
Return name.
Definition: IOobject.H:315
Reference counter for various OpenFOAM components.
Definition: refCount.H:49
declareRunTimeSelectionTable(tmp, multivariateSurfaceInterpolationScheme, Istream,(const fvMesh &mesh, const fieldTable &fields, const surfaceScalarField &faceFlux, Istream &is),(mesh, fields, faceFlux, is))
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void operator=(const HashTable< const GeometricField< Type, fvPatchField, volMesh > *, word, string::hash > &)
Assignment operator.
Definition: HashTable.C:537
const fieldTable & fields() const
Return fields to be interpolated.
Generic GeometricField class.
bool insert(const word &, const const GeometricField< Type, fvPatchField, volMesh > * &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
A class for handling words, derived from string.
Definition: word.H:59
friend Ostream & operator(Ostream &, const HashTable< const GeometricField< Type, fvPatchField, volMesh > *, word, string::hash > &)
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.
An STL-conforming hash table.
Definition: HashTable.H:61
virtual const word & type() const =0
Runtime type information.
labelList f(nPoints)
surfaceInterpolationScheme sub-class returned by operator(field)
multivariateSurfaceInterpolationScheme(const fvMesh &mesh, const fieldTable &fields, const surfaceScalarField &faceFlux, Istream &schemeData)
Construct for interpolating given field.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Abstract base class for multi-variate surface interpolation schemes.
rDeltaTY field()
A class for managing temporary objects.
Definition: PtrList.H:53
void add(const GeometricField< Type, fvPatchField, volMesh > &f)
Abstract base class for surface interpolation schemes.
Abstract base class for surface interpolation schemes.
Namespace for OpenFOAM.