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 | Copyright (C) 2011-2012 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 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  // Private Member Functions
87 
88  //- Disallow default bitwise copy construct
90  (
92  );
93 
94  //- Disallow default bitwise assignment
96 
97 
98 public:
99 
100  //- Runtime type information
101  virtual const word& type() const = 0;
102 
103 
104  // Declare run-time constructor selection tables
105 
107  (
108  tmp,
110  Istream,
111  (
112  const fvMesh& mesh,
113  const fieldTable& fields,
114  const surfaceScalarField& faceFlux,
115  Istream& is
116  ),
117  (mesh, fields, faceFlux, is)
118  );
119 
120 
121  // Constructors
122 
123  //- Construct for interpolating given field
125  (
126  const fvMesh& mesh,
127  const fieldTable& fields,
128  const surfaceScalarField& faceFlux,
129  Istream& schemeData
130  );
131 
132 
133  // Selectors
134 
135  //- Return a pointer to a new gradScheme created on freestore
137  (
138  const fvMesh& mesh,
139  const fieldTable& fields,
140  const surfaceScalarField& faceFlux,
141  Istream& schemeData
142  );
143 
144 
145  //- Destructor
147 
148 
149  // Member Functions
150 
151  //- Return mesh reference
152  const fvMesh& mesh() const
153  {
154  return mesh_;
155  }
156 
157  //- Return fields to be interpolated
158  const fieldTable& fields() const
159  {
160  return fields_;
161  }
162 
163 
164  // Member Operators
165 
166  //- surfaceInterpolationScheme sub-class returned by operator(field)
167  // which is used as the interpolation scheme for the field
168  class fieldScheme
169  :
170  public surfaceInterpolationScheme<Type>
171  {
172 
173  public:
174 
175  // Constructors
176 
178  (
180  )
181  :
182  surfaceInterpolationScheme<Type>(field.mesh())
183  {}
184 
185 
186  // Member Functions
187 
188  //- Return the interpolation weighting factors
189  virtual tmp<surfaceScalarField> weights
190  (
192  ) const = 0;
193  };
194 
196  (
198  ) const = 0;
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 // Add the patch constructor functions to the hash tables
210 #define makeMultivariateSurfaceInterpolationTypeScheme(SS, Type) \
211  \
212 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
213  \
214 multivariateSurfaceInterpolationScheme<Type>:: \
215 addIstreamConstructorToTable<SS<Type> > \
216  add##SS##Type##ConstructorToTable_;
217 
219 #define makeMultivariateSurfaceInterpolationScheme(SS) \
220  \
221 makeMultivariateSurfaceInterpolationTypeScheme(SS, scalar) \
222 makeMultivariateSurfaceInterpolationTypeScheme(SS, vector) \
223 makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor) \
224 makeMultivariateSurfaceInterpolationTypeScheme(SS, symmTensor) \
225 makeMultivariateSurfaceInterpolationTypeScheme(SS, tensor)
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #ifdef NoRepository
232 #endif
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #endif
237 
238 // ************************************************************************* //
virtual const word & type() const =0
Runtime type information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
labelList f(nPoints)
friend Ostream & operator(Ostream &, const HashTable< const GeometricField< Type, fvPatchField, volMesh > *, word, string::hash > &)
bool insert(const word &, const const GeometricField< Type, fvPatchField, volMesh > * &newElmt)
Insert a new hashedEntry.
An STL-conforming hash table.
Definition: HashTable.H:61
void operator=(const HashTable< const GeometricField< Type, fvPatchField, volMesh > *, word, string::hash > &)
Assignment.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const fvMesh & mesh() const
Return mesh reference.
A class for handling words, derived from string.
Definition: word.H:59
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.
void add(const GeometricField< Type, fvPatchField, volMesh > &f)
Namespace for OpenFOAM.
surfaceInterpolationScheme sub-class returned by operator(field)
declareRunTimeSelectionTable(tmp, multivariateSurfaceInterpolationScheme, Istream,( const fvMesh &mesh, const fieldTable &fields, const surfaceScalarField &faceFlux, Istream &is ),(mesh, fields, faceFlux, is))
Abstract base class for surface interpolation schemes.
const word & name() const
Return name.
Definition: IOobject.H:260
Reference counter for various OpenFOAM components.
Definition: refCount.H:45
Generic GeometricField class.
Abstract base class for surface interpolation schemes.
const fieldTable & fields() const
Return fields to be interpolated.
Abstract base class for multi-variate surface interpolation schemes.
A class for managing temporary objects.
Definition: PtrList.H:118