cellPointLagrangianAccumulator.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::cellPointLagrangianAccumulator
26 
27 Description
28  Helper class for the cell-point Lagrangian accumulation scheme. This is a
29  mesh object in order to provide a place to store reusable accumulation
30  weights and workspace.
31 
32 SourceFiles
33  cellPointLagrangianAccumulator.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef cellPointLagrangianAccumulator_H
38 #define cellPointLagrangianAccumulator_H
39 
40 #include "CompactListList.H"
41 #include "DemandDrivenMeshObject.H"
42 #include "LagrangianSubFieldsFwd.H"
43 #include "polyMesh.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class cellPointLagrangianAccumulator Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
57  <
58  polyMesh,
59  MoveableMeshObject,
60  cellPointLagrangianAccumulator
61  >
62 {
63  // Private Data
64 
65  //- Weights used to accumulate the point-field back into the cell-field
66  CompactListList<scalar> pointCellWeights_;
67 
68  //- Map from point to accumulating point
69  mutable labelList pointAccumulatingPoint_;
70 
71  //- Map from accumulating point to point
72  mutable DynamicList<label> accumulatingPointPoint_;
73 
74  //- Accumulated values on each accumulating point
75  #define DECLARE_ACCUMULATING_POINT_TYPES(Type, nullArg) \
76  mutable autoPtr<DynamicList<Type>> \
77  CAT3(accumulatingPoint, CAPITALIZE(Type), ValuesPtr_);
78  FOR_ALL_FIELD_TYPES(DECLARE_ACCUMULATING_POINT_TYPES);
79  #undef DECLARE_ACCUMULATING_POINT_TYPES
80 
81 
82  // Private Member Functions
83 
84  //- Calculate the point-cell weights
85  void calcPointCellWeights();
86 
87  //- Access accumulated values
88  template<class Type>
89  DynamicList<Type>& accumulatingPointValues() const;
90 
91 
92 protected:
93 
94  // Protected Constructors
95 
96  //- Allow the base mesh object to use the protected constructor
97  friend class DemandDrivenMeshObject
98  <
99  polyMesh,
102  >;
103 
104  //- Construct from mesh
106 
107 
108 public:
109 
110  // Static Data Members
111 
112  //- Runtime type information
113  TypeName("cellPointLagrangianAccumulator");
114 
115 
116  // Constructors
117 
118  //- Disallow default bitwise copy construction
120  delete;
121 
122 
123  //- Destructor
125 
126 
127  // Member Functions
128 
129  //- Update for mesh motion
130  virtual bool movePoints();
131 
132  //- Accumulate the Lagrangian field into a primitive cell field
133  template<class Type>
134  void accumulate
135  (
136  const LagrangianSubSubField<Type>& lPsi,
137  Field<Type>& cPsi
138  ) const;
139 
140 
141  // Member Operators
142 
143  //- Disallow default bitwise assignment
144  void operator=(const cellPointLagrangianAccumulator&) = delete;
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #ifdef NoRepository
156 #endif
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
#define DECLARE_ACCUMULATING_POINT_TYPES(Type, nullArg)
Accumulated values on each accumulating point.
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
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
Helper class for the cell-point Lagrangian accumulation scheme. This is a mesh object in order to pro...
virtual bool movePoints()
Update for mesh motion.
cellPointLagrangianAccumulator(const polyMesh &mesh)
Construct from mesh.
TypeName("cellPointLagrangianAccumulator")
Runtime type information.
void operator=(const cellPointLagrangianAccumulator &)=delete
Disallow default bitwise assignment.
void accumulate(const LagrangianSubSubField< Type > &lPsi, Field< Type > &cPsi) const
Accumulate the Lagrangian field into a primitive cell field.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Namespace for OpenFOAM.