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 -------------------------------------------------------------------------------
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::multivariateSurfaceInterpolationScheme
28 
29 Description
30  Abstract base class for multi-variate surface interpolation schemes.
31 
32 SourceFiles
33  multivariateSurfaceInterpolationScheme.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef multivariateSurfaceInterpolationScheme_H
38 #define multivariateSurfaceInterpolationScheme_H
39 
41 #include "HashTable.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class multivariateSurfaceInterpolationScheme Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
54 :
55  public refCount
56 {
57 
58 public:
59 
60  //- fieldTable
61  class fieldTable
62  :
63  public HashTable<const GeometricField<Type, fvPatchField, volMesh>*>
64  {
65  public:
66 
67  fieldTable()
68  {}
69 
71  {
72  this->insert(f.name(), &f);
73  }
74  };
75 
76 
77 private:
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 
100 public:
101 
102  //- Runtime type information
103  virtual const word& type() const = 0;
104 
105 
106  // Declare run-time constructor selection tables
107 
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
178 
180  (
182  )
183  :
185  {}
186 
187 
188  // Member Functions
189 
190  //- Return the interpolation weighting factors
192  (
194  ) const = 0;
195  };
196 
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
211 
212 #define makeMultivariateSurfaceInterpolationTypeScheme(SS, Type) \
213  \
214 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
215  \
216 multivariateSurfaceInterpolationScheme<Type>:: \
217 addIstreamConstructorToTable<SS<Type>> \
218  add##SS##Type##ConstructorToTable_;
219 
220 
221 #define makeMultivariateSurfaceInterpolationScheme(SS) \
222  \
223 makeMultivariateSurfaceInterpolationTypeScheme(SS, scalar) \
224 makeMultivariateSurfaceInterpolationTypeScheme(SS, vector) \
225 makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor) \
226 makeMultivariateSurfaceInterpolationTypeScheme(SS, symmTensor) \
227 makeMultivariateSurfaceInterpolationTypeScheme(SS, tensor)
228 
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #ifdef NoRepository
234 #endif
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
HashTable.H
Foam::multivariateSurfaceInterpolationScheme::New
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.
Definition: multivariateSurfaceInterpolationScheme.C:56
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Foam::multivariateSurfaceInterpolationScheme::type
virtual const word & type() const =0
Runtime type information.
Foam::multivariateSurfaceInterpolationScheme::fieldScheme::fieldScheme
fieldScheme(const GeometricField< Type, fvPatchField, volMesh > &field)
Definition: multivariateSurfaceInterpolationScheme.H:179
Foam::HashTable< const GeometricField< Type, fvPatchField, volMesh > * >::insert
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
Foam::multivariateSurfaceInterpolationScheme::fieldScheme::weights
virtual tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &field) const =0
Return the interpolation weighting factors.
Foam::multivariateSurfaceInterpolationScheme::fieldTable::add
void add(const GeometricField< Type, fvPatchField, volMesh > &f)
Definition: multivariateSurfaceInterpolationScheme.H:69
Foam::multivariateSurfaceInterpolationScheme::fieldScheme
surfaceInterpolationScheme sub-class returned by operator(field)
Definition: multivariateSurfaceInterpolationScheme.H:169
multivariateSurfaceInterpolationScheme.C
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::multivariateSurfaceInterpolationScheme::~multivariateSurfaceInterpolationScheme
virtual ~multivariateSurfaceInterpolationScheme()=default
Destructor.
Foam::multivariateSurfaceInterpolationScheme::declareRunTimeSelectionTable
declareRunTimeSelectionTable(tmp, multivariateSurfaceInterpolationScheme, Istream,(const fvMesh &mesh, const fieldTable &fields, const surfaceScalarField &faceFlux, Istream &is),(mesh, fields, faceFlux, is))
Foam::multivariateSurfaceInterpolationScheme
Abstract base class for multi-variate surface interpolation schemes.
Definition: multivariateSurfaceInterpolationScheme.H:52
field
rDeltaTY field()
Foam::multivariateSurfaceInterpolationScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: multivariateSurfaceInterpolationScheme.H:153
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition: HashTable.H:105
Foam::multivariateSurfaceInterpolationScheme::fields
const fieldTable & fields() const
Return fields to be interpolated.
Definition: multivariateSurfaceInterpolationScheme.H:159
f
labelList f(nPoints)
Foam::surfaceInterpolationScheme
Abstract base class for surface interpolation schemes.
Definition: surfaceInterpolationScheme.H:57
Foam::surfaceInterpolationScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: surfaceInterpolationScheme.H:144
Foam::multivariateSurfaceInterpolationScheme::fieldTable::fieldTable
fieldTable()
Definition: multivariateSurfaceInterpolationScheme.H:66
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::multivariateSurfaceInterpolationScheme::fieldTable
fieldTable
Definition: multivariateSurfaceInterpolationScheme.H:60
surfaceInterpolationScheme.H