FreeFOAM The Cross-Platform CFD Toolkit
IntegrationScheme.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 
25 Class
26  Foam::IntegrationScheme
27 
28 Description
29  Top level model for Integration schemes
30 
31 SourceFiles
32  IntegrationScheme.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef IntegrationScheme_H
37 #define IntegrationScheme_H
38 
39 #include <OpenFOAM/autoPtr.H>
41 #include <OpenFOAM/dictionary.H>
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class IntegrationScheme Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
54 {
55 
56 public:
57 
58  //- Helper class to supply results of integration
60  {
61  //- Integration value
62  Type value_;
63 
64  //- Average value across integration step
65  Type average_;
66 
67 
68  public:
69 
70  //- Constructor
72  :
73  value_(pTraits<Type>::zero),
74  average_(pTraits<Type>::zero)
75  {}
76 
77 
78  // Member functions
79 
80  // Access
81 
82  //- Return const access to the value
83  Type value() const
84  {
85  return value_;
86  }
87 
88  //- Return const access to the average
89  Type average() const
90  {
91  return average_;
92  }
93 
94 
95  // Edit
96 
97  //- Return access to the value for changing
98  Type& value()
99  {
100  return value_;
101  }
102 
103  //- Return access to the average for changing
104  Type& average()
105  {
106  return average_;
107  }
108  };
109 
110 
111 private:
112 
113  // Private data
114 
115  //- Name of the Integration variable
116  const word& phiName_;
117 
118  //- Reference to the dictionary
119  const dictionary& dict_;
120 
121 
122  // Private Member Functions
123 
124  //- Disallow default bitwise copy construct
126 
127  //- Disallow default bitwise assignment
128  void operator=(const IntegrationScheme&);
129 
130 
131 public:
132 
133  //- Runtime type information
134  TypeName("IntegrationScheme");
135 
136 
137  //- Declare runtime constructor selection table
138 
140  (
141  autoPtr,
143  dictionary,
144  (
145  const word& phiName,
146  const dictionary& dict
147  ),
148  (phiName, dict)
149  );
150 
151 
152  // Constructors
153 
154  //- Construct from components
155  IntegrationScheme(const word& phiName, const dictionary& dict);
156 
157 
158  // Selectors
159 
160  //- Return a reference to the selected radiation model
162  (
163  const word& phiName,
164  const dictionary& dict
165  );
166 
167 
168  //- Destructor
169  virtual ~IntegrationScheme();
170 
171 
172  // Member Functions
173 
174  //- Perform the Integration
175  virtual integrationResult integrate
176  (
177  const Type phi,
178  const scalar dt,
179  const Type alpha,
180  const scalar beta
181  ) const = 0;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #define makeIntegrationScheme(Type) \
192  \
193  defineNamedTemplateTypeNameAndDebug(IntegrationScheme<Type>, 0); \
194  \
195  defineTemplateRunTimeSelectionTable \
196  ( \
197  IntegrationScheme<Type>, \
198  dictionary \
199  );
200 
201 
202 #define makeIntegrationSchemeType(SS, Type) \
203  \
204  defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
205  \
206  IntegrationScheme<Type>::adddictionaryConstructorToTable<SS<Type> > \
207  add##SS##Type##ConstructorToTable_;
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #ifdef NoRepository
214 #endif
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************ vim: set sw=4 sts=4 et: ************************ //
221 
222