FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/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 
66  {}
67 
69  {
70  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
95  void operator=(const multivariateSurfaceInterpolationScheme&);
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
146 
148 
149 
150  // Member Functions
151 
152  //- Return mesh reference
153  const fvMesh& mesh() const
154  {
155  return mesh_;
156  }
157 
158  //- Return fields to be interpolated
159  const fieldTable& fields() const
160  {
161  return fields_;
162  }
163 
164 
165  // Member Operators
166 
167  //- surfaceInterpolationScheme sub-class returned by operator(field)
168  // which is used as the interpolation scheme for the field
170  :
171  public surfaceInterpolationScheme<Type>
172  {
173 
174  public:
175 
176  // Constructors
177 
179  (
181  )
182  :
184  {}
185 
186 
187  // Member Functions
188 
189  //- Return the interpolation weighting factors
191  (
193  ) const = 0;
194  };
195 
196  virtual tmp<surfaceInterpolationScheme<Type> > operator()
197  (
199  ) const = 0;
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 // Add the patch constructor functions to the hash tables
210 
211 #define makeMultivariateSurfaceInterpolationTypeScheme(SS, Type) \
212  \
213 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
214  \
215 multivariateSurfaceInterpolationScheme<Type>:: \
216 addIstreamConstructorToTable<SS<Type> > \
217  add##SS##Type##ConstructorToTable_;
218 
219 
220 #define makeMultivariateSurfaceInterpolationScheme(SS) \
221  \
222 makeMultivariateSurfaceInterpolationTypeScheme(SS, scalar) \
223 makeMultivariateSurfaceInterpolationTypeScheme(SS, vector) \
224 makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor) \
225 makeMultivariateSurfaceInterpolationTypeScheme(SS, symmTensor) \
226 makeMultivariateSurfaceInterpolationTypeScheme(SS, tensor)
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #ifdef NoRepository
233 #endif
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************ vim: set sw=4 sts=4 et: ************************ //