FreeFOAM The Cross-Platform CFD Toolkit
divScheme.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::divScheme
26 
27 Description
28  Abstract base class for div schemes.
29 
30 SourceFiles
31  divScheme.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef divScheme_H
36 #define divScheme_H
37 
38 #include <OpenFOAM/tmp.H>
41 #include <finiteVolume/linear.H>
42 #include <OpenFOAM/typeInfo.H>
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 template<class Type>
51 class fvMatrix;
52 
53 class fvMesh;
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace fv
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class divScheme Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Type>
65 class divScheme
66 :
67  public refCount
68 {
69 
70 protected:
71 
72  // Protected data
73 
74  const fvMesh& mesh_;
76 
77 
78  // Private Member Functions
79 
80  //- Disallow copy construct
81  divScheme(const divScheme&);
82 
83  //- Disallow default bitwise assignment
84  void operator=(const divScheme&);
85 
86 
87 public:
88 
89  //- Runtime type information
90  virtual const word& type() const = 0;
91 
92 
93  // Declare run-time constructor selection tables
94 
96  (
97  tmp,
98  divScheme,
99  Istream,
100  (const fvMesh& mesh, Istream& schemeData),
101  (mesh, schemeData)
102  );
103 
104 
105  // Constructors
106 
107  //- Construct from mesh
108  divScheme(const fvMesh& mesh)
109  :
110  mesh_(mesh),
111  tinterpScheme_(new linear<Type>(mesh))
112  {}
113 
114  //- Construct from mesh and Istream
115  divScheme(const fvMesh& mesh, Istream& is)
116  :
117  mesh_(mesh),
119  {}
120 
121 
122  // Selectors
123 
124  //- Return a pointer to a new divScheme created on freestore
125  static tmp<divScheme<Type> > New
126  (
127  const fvMesh& mesh,
128  Istream& schemeData
129  );
130 
131 
132  // Destructor
133 
134  virtual ~divScheme();
135 
136 
137  // Member Functions
138 
139  //- Return mesh reference
140  const fvMesh& mesh() const
141  {
142  return mesh_;
143  }
144 
145  virtual tmp
146  <
149  > fvcDiv
150  (
152  ) = 0;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace fv
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 // Add the patch constructor functions to the hash tables
167 
168 #define makeFvDivTypeScheme(SS, Type) \
169  \
170 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
171  \
172 divScheme<Type>::addIstreamConstructorToTable<SS<Type> > \
173  add##SS##Type##IstreamConstructorToTable_;
174 
175 
176 #define makeFvDivScheme(SS) \
177  \
178 makeFvDivTypeScheme(SS, vector) \
179 makeFvDivTypeScheme(SS, sphericalTensor) \
180 makeFvDivTypeScheme(SS, symmTensor) \
181 makeFvDivTypeScheme(SS, tensor)
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #ifdef NoRepository
187 # include <finiteVolume/divScheme.C>
188 #endif
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************ vim: set sw=4 sts=4 et: ************************ //