FreeFOAM The Cross-Platform CFD Toolkit
interpolation.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::interpolation
26 
27 Description
28  Abstract base class for interpolation
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef interpolation_H
33 #define interpolation_H
34 
35 #include <OpenFOAM/faceList.H>
37 #include <OpenFOAM/pointFields.H>
38 #include <OpenFOAM/typeInfo.H>
39 #include <OpenFOAM/autoPtr.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class polyMesh;
48 
49 /*---------------------------------------------------------------------------*\
50  Class interpolation Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class Type>
55 {
56 
57 protected:
58 
59  // Protected data
60 
62 
63  const polyMesh& pMesh_;
68 
69 
70 public:
71 
72  //- Runtime type information
73  virtual const word& type() const = 0;
74 
75 
76  // Declare run-time constructor selection table
77 
79  (
80  autoPtr,
82  dictionary,
83  (
85  ),
86  (psi)
87  );
88 
89 
90  // Selectors
91 
92  //- Return a reference to the specified interpolation scheme
94  (
95  const word& interpolationType,
97  );
98 
99  //- Return a reference to the selected interpolation scheme
101  (
102  const dictionary& interpolationSchemes,
104  );
105 
106 
107  // Constructors
108 
109  //- Construct from components
111  (
113  );
114 
115 
116  // Destructor
117 
118  virtual ~interpolation()
119  {}
120 
121 
122  // Member Functions
123 
124  //- Return the field to be interpolated
126  {
127  return psi_;
128  }
129 
130  //- Interpolate field to the given point in the given cell
131  virtual Type interpolate
132  (
133  const vector& position,
134  const label nCell,
135  const label facei = -1
136  ) const = 0;
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #define makeInterpolationType(SS, Type) \
147  \
148 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
149  \
150 interpolation<Type>::adddictionaryConstructorToTable<SS<Type> > \
151  add##SS##Type##ConstructorToTable_;
152 
153 
154 #define makeInterpolation(SS) \
155  \
156 makeInterpolationType(SS, scalar) \
157 makeInterpolationType(SS, vector) \
158 makeInterpolationType(SS, sphericalTensor) \
159 makeInterpolationType(SS, symmTensor) \
160 makeInterpolationType(SS, tensor)
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #ifdef NoRepository
167 #endif
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************ vim: set sw=4 sts=4 et: ************************ //