FreeFOAM The Cross-Platform CFD Toolkit
laplacianScheme.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::fv::laplacianScheme
26 
27 Description
28  Abstract base class for laplacian schemes.
29 
30 SourceFiles
31  laplacianScheme.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef laplacianScheme_H
36 #define laplacianScheme_H
37 
38 #include <OpenFOAM/tmp.H>
41 #include <finiteVolume/linear.H>
43 #include <OpenFOAM/typeInfo.H>
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 template<class Type>
52 class fvMatrix;
53 
54 class fvMesh;
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace fv
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class laplacianScheme Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Type, class GType>
67 :
68  public refCount
69 {
70 
71 protected:
72 
73  // Protected data
74 
75  const fvMesh& mesh_;
78 
79 
80  // Private Member Functions
81 
82  //- Disallow copy construct
84 
85  //- Disallow default bitwise assignment
86  void operator=(const laplacianScheme&);
87 
88 
89 public:
90 
91  //- Runtime type information
92  virtual const word& type() const = 0;
93 
94 
95  // Declare run-time constructor selection tables
96 
98  (
99  tmp,
101  Istream,
102  (const fvMesh& mesh, Istream& schemeData),
103  (mesh, schemeData)
104  );
105 
106 
107  // Constructors
108 
109  //- Construct from mesh
110  laplacianScheme(const fvMesh& mesh)
111  :
112  mesh_(mesh),
113  tinterpGammaScheme_(new linear<GType>(mesh)),
114  tsnGradScheme_(new correctedSnGrad<Type>(mesh))
115  {}
116 
117  //- Construct from mesh and Istream
118  laplacianScheme(const fvMesh& mesh, Istream& is)
119  :
120  mesh_(mesh),
121  tinterpGammaScheme_(NULL),
122  tsnGradScheme_(NULL)
123  {
125  (
127  );
128 
130  (
131  snGradScheme<Type>::New(mesh, is)
132  );
133  }
134 
135  //- Construct from mesh, interpolation and snGradScheme schemes
137  (
138  const fvMesh& mesh,
140  const tmp<snGradScheme<Type> >& sngs
141  )
142  :
143  mesh_(mesh),
144  tinterpGammaScheme_(igs),
145  tsnGradScheme_(sngs)
146  {}
147 
148 
149  // Selectors
150 
151  //- Return a pointer to a new laplacianScheme created on freestore
153  (
154  const fvMesh& mesh,
155  Istream& schemeData
156  );
157 
158 
159  // Destructor
160 
161  virtual ~laplacianScheme();
162 
163 
164  // Member Functions
165 
166  //- Return mesh reference
167  const fvMesh& mesh() const
168  {
169  return mesh_;
170  }
171 
173  (
176  ) = 0;
177 
179  (
182  );
183 
185  (
187  ) = 0;
188 
190  (
193  ) = 0;
194 
196  (
199  );
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace fv
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 // Add the patch constructor functions to the hash tables
214 
215 #define makeFvLaplacianTypeScheme(SS, Type, GType) \
216  \
217  typedef SS<Type, GType> SS##Type##GType; \
218  defineNamedTemplateTypeNameAndDebug(SS##Type##GType, 0); \
219  \
220  laplacianScheme<Type, GType>:: \
221  addIstreamConstructorToTable<SS<Type, GType> > \
222  add##SS##Type##GType##IstreamConstructorToTable_;
223 
224 
225 #define makeFvLaplacianScheme(SS) \
226  \
227 makeFvLaplacianTypeScheme(SS, scalar, scalar) \
228 makeFvLaplacianTypeScheme(SS, scalar, symmTensor) \
229 makeFvLaplacianTypeScheme(SS, scalar, tensor) \
230 makeFvLaplacianTypeScheme(SS, vector, scalar) \
231 makeFvLaplacianTypeScheme(SS, sphericalTensor, scalar) \
232 makeFvLaplacianTypeScheme(SS, symmTensor, scalar) \
233 makeFvLaplacianTypeScheme(SS, tensor, scalar) \
234 
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #ifdef NoRepository
240 #endif
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************ vim: set sw=4 sts=4 et: ************************ //