lagrangianFieldDecomposer.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::lagrangianFieldDecomposer
29
30Description
31 Lagrangian field decomposer.
32
33SourceFiles
34 lagrangianFieldDecomposer.C
35 lagrangianFieldDecomposerCache.C
36 lagrangianFieldDecomposerReadFields.C
37 lagrangianFieldDecomposerTemplates.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef Foam_lagrangianFieldDecomposer_H
42#define Foam_lagrangianFieldDecomposer_H
43
44#include "Cloud.H"
45#include "CompactIOField.H"
46#include "indexedParticle.H"
47#include "passiveParticle.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward Declarations
55class IOobjectList;
56
57/*---------------------------------------------------------------------------*\
58 Class lagrangianFieldDecomposer Declaration
59\*---------------------------------------------------------------------------*/
62{
63 // Private Data
64
65 //- Reference to processor mesh
66 const polyMesh& procMesh_;
67
68 //- Lagrangian positions for this processor
69 Cloud<passiveParticle> positions_;
70
71 //- The indices of the particles on this processor
72 labelList particleIndices_;
73
74
75 // Private Member Functions
76
77 //- No copy construct
79
80 //- No copy assignment
81 void operator=(const lagrangianFieldDecomposer&) = delete;
82
83
84public:
85
86 // Public Classes
87 class fieldsCache;
88
89
90 // Constructors
91
92 //- Construct from components
94 (
95 const polyMesh& mesh, //<! unused
96 const polyMesh& procMesh,
97 const labelList& faceProcAddressing,
98 const labelList& cellProcAddressing,
99 const word& cloudName,
100 const Cloud<indexedParticle>& lagrangianPositions,
101 const List<SLList<indexedParticle*>*>& cellParticles
102 );
103
104
105 // Field Reading
106
107 //- Read the fields and store on the pointer list
108 template<class Type>
109 static void readFields
110 (
111 const label cloudi,
112 const IOobjectList& lagrangianObjects,
113 PtrList<PtrList<IOField<Type>>>& cloudFields
114 );
115
116 //- Read the field-fields and store on the pointer list
117 template<class Type>
118 static void readFieldFields
119 (
120 const label cloudi,
121 const IOobjectList& lagrangianObjects,
122 PtrList<PtrList<CompactIOField<Field<Type>, Type>>>& cloudFields
123 );
124
125
126 // Member Functions
127
128 //- Decompose volume field
129 template<class Type>
131 (
132 const word& cloudName,
133 const IOField<Type>& field
134 ) const;
135
136 template<class Type>
138 (
139 const word& cloudName,
140 const CompactIOField<Field<Type>, Type>& field
141 ) const;
142
143
144 template<class GeoField>
145 void decomposeFields
146 (
147 const word& cloudName,
149 ) const;
150
151 template<class GeoField>
153 (
154 const word& cloudName,
156 ) const;
157};
158
159
160/*---------------------------------------------------------------------------*\
161 Class lagrangianFieldDecomposer::fieldsCache Declaration
162\*---------------------------------------------------------------------------*/
165{
166 // Private Data
167
168 class privateCache;
169
170 //- All field and field-field types for lagrangian
171 std::unique_ptr<privateCache> cache_;
172
173
174 // Private Member Functions
175
176 //- No copy construct
177 fieldsCache(const fieldsCache&) = delete;
178
179 //- No copy assignment
180 void operator=(const fieldsCache&) = delete;
181
182
183public:
184
185 // Constructors
186
187 //- Default construct (no clouds)
188 fieldsCache();
189
190 //- Construct for given number of clouds
191 explicit fieldsCache(const label nClouds);
192
193
194 //- Destructor
195 ~fieldsCache();
196
197
198 // Member Functions
199
200 //- No clouds
201 bool empty() const;
202
203 //- Number of clouds
204 label size() const;
205
206 //- Clear out
207 void clear();
208
209 //- Resize for the number of clouds
210 void resize(const label nClouds);
211
212
213 //- Read all fields and field-fields for given cloud and objects
214 void readAllFields
215 (
216 const label cloudi,
217 const IOobjectList& lagrangianObjects
218 );
219
220 //- Decompose and write all fields and field-fields for given cloud
222 (
223 const label cloudi,
224 const fileName& cloudDir,
225 const lagrangianFieldDecomposer& decomposer,
226 bool report = false
227 ) const;
228};
229
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233} // End namespace Foam
234
235// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236
237#ifdef NoRepository
240#endif
241
242// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243
244#endif
245
246// ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:68
A Field of objects of type <T> with automated input and output using a compact storage....
Generic templated field type.
Definition: Field.H:82
A primitive field of type <T> with automated input and output.
Definition: IOField.H:58
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:59
Template class for non-intrusive linked lists.
Definition: LList.H:79
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
A class for handling file names.
Definition: fileName.H:76
void readAllFields(const label cloudi, const IOobjectList &lagrangianObjects)
Read all fields and field-fields for given cloud and objects.
void decomposeAllFields(const label cloudi, const fileName &cloudDir, const lagrangianFieldDecomposer &decomposer, bool report=false) const
Decompose and write all fields and field-fields for given cloud.
void resize(const label nClouds)
Resize for the number of clouds.
tmp< IOField< Type > > decomposeField(const word &cloudName, const IOField< Type > &field) const
Decompose volume field.
static void readFields(const label cloudi, const IOobjectList &lagrangianObjects, PtrList< PtrList< IOField< Type > > > &cloudFields)
Read the fields and store on the pointer list.
void decomposeFields(const word &cloudName, const PtrList< GeoField > &fields) const
tmp< CompactIOField< Field< Type >, Type > > decomposeFieldField(const word &cloudName, const CompactIOField< Field< Type >, Type > &field) const
static void readFieldFields(const label cloudi, const IOobjectList &lagrangianObjects, PtrList< PtrList< CompactIOField< Field< Type >, Type > > > &cloudFields)
Read the field-fields and store on the pointer list.
void decomposeFieldFields(const word &cloudName, const PtrList< GeoField > &fields) const
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
dynamicFvMesh & mesh
Namespace for OpenFOAM.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
const word cloudName(propsDict.get< word >("cloud"))