Loading...
Searching...
No Matches
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-2025 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.cxx
35 lagrangianFieldDecomposer.txx
36 lagrangianFieldDecomposerCache.cxx
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef Foam_lagrangianFieldDecomposer_H
41#define Foam_lagrangianFieldDecomposer_H
42
43#include "Cloud.H"
44#include "CompactIOField.H"
45#include "indexedParticle.H"
46#include "passiveParticle.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53// Forward Declarations
54class IOobjectList;
56/*---------------------------------------------------------------------------*\
57 Class lagrangianFieldDecomposer Declaration
58\*---------------------------------------------------------------------------*/
59
60class lagrangianFieldDecomposer
61{
62 // Private Data
63
64 //- Reference to processor mesh
65 const polyMesh& procMesh_;
66
67 //- Lagrangian positions for this processor
68 Cloud<passiveParticle> positions_;
69
70 //- The indices of the particles on this processor
71 labelList particleIndices_;
72
73
74 // Private Member Functions
75
76 //- No copy construct
77 lagrangianFieldDecomposer(const lagrangianFieldDecomposer&) = delete;
78
79 //- No copy assignment
80 void operator=(const lagrangianFieldDecomposer&) = delete;
81
82
83public:
84
85 // Public Classes
86 class fieldsCache;
87
88
89 // Constructors
90
91 //- Construct from components
92 lagrangianFieldDecomposer
93 (
94 const polyMesh& mesh,
95 const polyMesh& procMesh,
96 const labelUList& faceProcAddressing,
97 const labelUList& cellProcAddressing,
98 const word& cloudName,
99 const Cloud<indexedParticle>& lagrangianPositions,
100 const UList<SLList<indexedParticle*>*>& cellParticles
101 );
102
103
104 // Field Reading
105
106 //- Read the fields and store on the pointer list
107 template<class Type>
108 static void readFields
109 (
110 const label cloudi,
111 const IOobjectList& lagrangianObjects,
112 PtrList<PtrList<IOField<Type>>>& cloudFields
113 );
114
115 //- Read the field-fields and store on the pointer list
116 template<class Type>
117 static void readFieldFields
118 (
119 const label cloudi,
120 const IOobjectList& lagrangianObjects,
122 );
123
124
125 // Member Functions
126
127 //- Decompose field
128 template<class Type>
130 (
131 const word& cloudName,
132 const IOField<Type>& field
133 ) const;
134
135 //- Decompose field-field
136 template<class Type>
138 (
139 const word& cloudName,
141 ) const;
143
144 //- Decompose fields
145 template<class GeoField>
146 void decomposeFields
147 (
148 const word& cloudName,
150 ) const;
151
152 //- Decompose field-fields
153 template<class GeoField>
155 (
156 const word& cloudName,
158 ) const;
159};
160
161
162/*---------------------------------------------------------------------------*\
163 Class lagrangianFieldDecomposer::fieldsCache Declaration
164\*---------------------------------------------------------------------------*/
165
167{
168 class privateCache;
169 std::unique_ptr<privateCache> cache_;
170
171 //- No copy construct
172 fieldsCache(const fieldsCache&) = delete;
174 //- No copy assignment
175 void operator=(const fieldsCache&) = delete;
176
177
178public:
179
180 // Constructors
181
182 //- Default construct (no clouds)
183 fieldsCache();
184
185 //- Construct for given number of clouds
186 explicit fieldsCache(label nClouds);
187
188
189 //- Destructor
190 ~fieldsCache();
191
192
193 // Member Functions
194
195 //- No clouds
196 bool empty() const noexcept;
197
198 //- Number of clouds
199 label size() const noexcept;
200
201 //- Clear out
202 void clear();
203
204 //- Resize for the number of clouds
205 void resize(label nClouds);
206
207
208 //- Read all fields and field-fields for given cloud and objects
209 void readAllFields
210 (
211 const label cloudi,
212 const IOobjectList& lagrangianObjects
213 );
214
215 //- Decompose and write all fields and field-fields for given cloud
217 (
218 const label cloudi,
219 const fileName& cloudDir,
220 const lagrangianFieldDecomposer& decomposer,
221 bool report = false
222 ) const;
223};
224
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228} // End namespace Foam
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#ifdef NoRepository
233 #include "lagrangianFieldDecomposer.txx"
234#endif
235
236// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238#endif
239
240// ************************************************************************* //
const word cloudName(propsDict.get< word >("cloud"))
Base cloud calls templated on particle type.
Definition Cloud.H:64
A Field of objects of type <T> with automated input and output using a compact storage....
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
A primitive field of type <T> with automated input and output.
Definition IOField.H:53
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
A class for handling file names.
Definition fileName.H:75
void readAllFields(const label cloudi, const IOobjectList &lagrangianObjects)
Read all fields and field-fields for given cloud and objects.
bool empty() const noexcept
No clouds.
fieldsCache()
Default construct (no clouds).
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.
label size() const noexcept
Number of clouds.
fieldsCache(label nClouds)
Construct for given number of clouds.
void resize(label nClouds)
Resize for the number of clouds.
static void readFields(const label cloudi, const IOobjectList &lagrangianObjects, PtrList< PtrList< IOField< Type > > > &cloudFields)
Read the fields and store on the pointer list.
static void readFieldFields(const label cloudi, const IOobjectList &lagrangianObjects, PtrList< PtrList< CompactIOField< Field< Type > > > > &cloudFields)
Read the field-fields and store on the pointer list.
tmp< IOField< Type > > decomposeField(const word &cloudName, const IOField< Type > &field) const
Decompose field.
lagrangianFieldDecomposer(const polyMesh &mesh, const polyMesh &procMesh, const labelUList &faceProcAddressing, const labelUList &cellProcAddressing, const word &cloudName, const Cloud< indexedParticle > &lagrangianPositions, const UList< SLList< indexedParticle * > * > &cellParticles)
Construct from components.
tmp< CompactIOField< Field< Type > > > decomposeFieldField(const word &cloudName, const CompactIOField< Field< Type > > &field) const
Decompose field-field.
void decomposeFields(const word &cloudName, const UPtrList< GeoField > &fields) const
Decompose fields.
void decomposeFieldFields(const word &cloudName, const UPtrList< GeoField > &fields) const
Decompose field-fields.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
dynamicFvMesh & mesh
Namespace for OpenFOAM.
LList< SLListBase, T > SLList
Definition SLListFwd.H:41
List< label > labelList
A List of labels.
Definition List.H:62
const direction noexcept
Definition scalarImpl.H:265
UList< label > labelUList
A UList of labels.
Definition UList.H:75
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields