LagrangianAccumulationScheme.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025 OpenFOAM Foundation
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::Lagrangian::accumulationScheme
26 
27 Description
28  Abstract base class for Lagrangian accumulation schemes
29 
30 SourceFiles
31  LagrangianAccumulationScheme.C
32  LagrangianAccumulationSchemes.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef LagrangianAccumulationScheme_H
37 #define LagrangianAccumulationScheme_H
38 
39 #include "tmp.H"
40 #include "dimensionedType.H"
41 #include "LagrangianFieldsFwd.H"
42 #include "LagrangianSubFieldsFwd.H"
43 #include "runTimeSelectionTables.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 class LagrangianMesh;
51 
52 template<class Type>
53 class LagrangianEqn;
54 
55 namespace Lagrangian
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class accumulationScheme Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class Type>
64 :
65  public tmp<accumulationScheme<Type>>::refCount
66 {
67 private:
68 
69  // Private Member Functions
70 
71  //- Accumulate the Lagrangian field into a primitive cell field
72  virtual void accumulate
73  (
74  const LagrangianSubSubField<Type>& lPsi,
75  Field<Type>& cPsi
76  ) = 0;
77 
78 
79 protected:
80 
81  // Protected Data
82 
83  //- Reference to the mesh
84  const LagrangianMesh& mesh_;
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("accumulationScheme");
91 
92 
93  //- Declare run-time constructor selection tables
95  (
96  tmp,
98  Istream,
99  (const LagrangianMesh& mesh, Istream& is),
100  (mesh, is)
101  );
102 
103 
104  // Constructors
105 
106  //- Construct from a mesh
108  :
109  mesh_(mesh)
110  {}
111 
112  //- Construct from a mesh and a stream
114  :
115  mesh_(mesh)
116  {}
117 
118  //- Disallow default bitwise copy construction
119  accumulationScheme(const accumulationScheme&) = delete;
120 
121 
122  // Selectors
123 
124  //- Return a pointer to a new accumulationScheme
126  (
127  const LagrangianMesh& mesh,
128  Istream& is
129  );
130 
131 
132  //- Destructor
133  virtual ~accumulationScheme();
134 
135 
136  // Member Functions
137 
138  //- Return mesh reference
139  const LagrangianMesh& mesh() const
140  {
141  return mesh_;
142  }
143 
144  //- Accumulate a Lagrangian field into a finite volume field
145  template<class CellMesh, template<class> class PrimitiveField>
147  (
149  );
150 
151  //- Accumulate a Lagrangian sub-field into a finite volume field
152  template<class CellMesh, template<class> class PrimitiveField>
153  void accumulate
154  (
157  );
158 
159 
160  // Member Operators
161 
162  //- Disallow default bitwise assignment
163  void operator=(const accumulationScheme&) = delete;
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Lagrangian
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #define defineLagrangianAccumulationScheme(Type, nullArg) \
175  \
176  namespace Foam \
177  { \
178  namespace Lagrangian \
179  { \
180  typedef accumulationScheme<Type> Type##AccumulationScheme; \
181  \
182  defineNamedTemplateTypeNameAndDebug \
183  ( \
184  Type##AccumulationScheme, \
185  0 \
186  ); \
187  \
188  defineTemplateRunTimeSelectionTable \
189  ( \
190  Type##AccumulationScheme, \
191  Istream \
192  ); \
193  } \
194  }
195 
196 
197 #define makeLagrangianAccumulationScheme(Type, AccumulationSchemeType) \
198  \
199  namespace Foam \
200  { \
201  namespace Lagrangian \
202  { \
203  typedef accumulationScheme<Type> Type##AccumulationScheme; \
204  \
205  namespace accumulationSchemes \
206  { \
207  typedef AccumulationSchemeType<Type> \
208  Type##AccumulationSchemeType; \
209  \
210  defineNamedTemplateTypeNameAndDebug \
211  ( \
212  Type##AccumulationSchemeType, \
213  0 \
214  ); \
215  \
216  addToRunTimeSelectionTable \
217  ( \
218  Type##AccumulationScheme, \
219  Type##AccumulationSchemeType, \
220  Istream \
221  ); \
222  } \
223  } \
224  }
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:83
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
Class containing Lagrangian geometry and topology.
Basic cell Lagrangian accumulation scheme.
accumulationScheme(const LagrangianMesh &mesh)
Construct from a mesh.
TypeName("accumulationScheme")
Runtime type information.
declareRunTimeSelectionTable(tmp, accumulationScheme, Istream,(const LagrangianMesh &mesh, Istream &is),(mesh, is))
Declare run-time constructor selection tables.
static tmp< accumulationScheme< Type > > New(const LagrangianMesh &mesh, Istream &is)
Return a pointer to a new accumulationScheme.
void operator=(const accumulationScheme &)=delete
Disallow default bitwise assignment.
const LagrangianMesh & mesh_
Reference to the mesh.
const LagrangianMesh & mesh() const
Return mesh reference.
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
Macros to ease declaration of run-time selection tables.