Loading...
Searching...
No Matches
pointFieldDecomposer.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) 2021-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::pointFieldDecomposer
29
30Description
31 Point field decomposer.
32
33SourceFiles
34 pointFieldDecomposer.cxx
35 pointFieldDecomposer.txx
36 pointFieldDecomposerCache.cxx
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef Foam_pointFieldDecomposer_H
41#define Foam_pointFieldDecomposer_H
42
43#include "pointMesh.H"
44#include "pointFields.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// Forward Declarations
53class IOobjectList;
55/*---------------------------------------------------------------------------*\
56 Class pointFieldDecomposer Declaration
57\*---------------------------------------------------------------------------*/
58
60{
61public:
62
63 // Public Classes
64
65 //- Internal caching for field reading
66 class fieldsCache;
67
68 //- Point patch field decomposer class
70 :
72 {
73 // Private Data
74
75 labelList directAddressing_;
76
77 //- Does map contain any unmapped values
78 bool hasUnmapped_;
79
80 public:
81
82 // Constructors
83
84 //- Construct given addressing
86 (
87 const pointPatch& completeMeshPatch,
88 const pointPatch& procMeshPatch,
89 const labelUList& directAddr
90 );
91
92
93 // Member Functions
94
95 label size() const noexcept
96 {
97 return directAddressing_.size();
98 }
99
100 bool direct() const noexcept
101 {
102 return true;
104
105 bool hasUnmapped() const noexcept
106 {
107 return hasUnmapped_;
109
111 {
112 return directAddressing_;
114 };
115
116
117private:
118
119 // Private Data
120
121 //- Reference to processor mesh
122 const pointMesh& procMesh_;
123
124 //- Reference to point addressing
125 const labelUList& pointAddressing_;
126
127 //- Reference to boundary addressing
128 const labelUList& boundaryAddressing_;
129
130 //- List of patch field decomposers
131 PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
132
133
134public:
135
136 //- No copy construct
138
139 //- No copy assignment
140 void operator=(const pointFieldDecomposer&) = delete;
141
142
143 // Constructors
144
145 //- Construct without mappers, added later with reset()
147 (
149 const pointMesh& procMesh,
150 const labelUList& pointAddressing,
151 const labelUList& boundaryAddressing
152 );
153
154 //- Construct from components
156 (
157 const pointMesh& completeMesh,
158 const pointMesh& procMesh,
159 const labelUList& pointAddressing,
160 const labelUList& boundaryAddressing
161 );
162
164 //- Destructor
165 ~pointFieldDecomposer() = default;
166
167
168 // Member Functions
169
170 //- True if no mappers have been allocated
171 bool empty() const noexcept;
172
173 //- Remove all mappers
174 void clear();
175
176 //- Reset mappers using information from the complete mesh
177 void reset(const pointMesh& completeMesh);
178
179
180 // Mapping
181
182 //- Decompose point field
183 template<class Type>
188 ) const;
189
190 //- Decompose list of fields
191 template<class GeoField>
192 void decomposeFields(const UPtrList<GeoField>& fields) const;
193};
195
196/*---------------------------------------------------------------------------*\
197 Class pointFieldDecomposer::fieldsCache Declaration
198\*---------------------------------------------------------------------------*/
201{
202 class privateCache;
203 std::unique_ptr<privateCache> cache_;
205 //- No copy construct
206 fieldsCache(const fieldsCache&) = delete;
207
208 //- No copy assignment
209 void operator=(const fieldsCache&) = delete;
210
211
212public:
213
214 // Constructors
215
216 //- Default construct
217 fieldsCache();
218
219
220 //- Destructor
221 ~fieldsCache();
222
224 // Member Functions
225
226 //- No fields
227 bool empty() const noexcept;
228
229 //- Total number of fields
230 label size() const noexcept;
232 //- Clear out
233 void clear();
234
235
236 //- Read all fields given mesh and objects
237 void readAllFields
238 (
239 const pointMesh& mesh,
240 const IOobjectList& objects
241 );
242
243 //- Decompose and write all fields
245 (
246 const pointFieldDecomposer& decomposer,
247 bool report = false
248 ) const;
249};
250
251
252// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253
254} // End namespace Foam
255
256// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257
258#ifdef NoRepository
259 #include "pointFieldDecomposer.txx"
260#endif
261
262// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263
264#endif
265
266// ************************************************************************* //
Generic GeometricField class.
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 list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
void readAllFields(const pointMesh &mesh, const IOobjectList &objects)
Read all fields given mesh and objects.
bool empty() const noexcept
No fields.
label size() const noexcept
Total number of fields.
void decomposeAllFields(const pointFieldDecomposer &decomposer, bool report=false) const
Decompose and write all fields.
bool hasUnmapped() const noexcept
Any unmapped values?
bool direct() const noexcept
Is it a direct (non-interpolating) mapper?
patchFieldDecomposer(const pointPatch &completeMeshPatch, const pointPatch &procMeshPatch, const labelUList &directAddr)
Construct given addressing.
label size() const noexcept
The size of the mapper.
const labelUList & directAddressing() const noexcept
Return the direct addressing values.
Point field decomposer.
void decomposeFields(const UPtrList< GeoField > &fields) const
Decompose list of fields.
bool empty() const noexcept
True if no mappers have been allocated.
pointFieldDecomposer(Foam::zero, const pointMesh &procMesh, const labelUList &pointAddressing, const labelUList &boundaryAddressing)
Construct without mappers, added later with reset().
pointFieldDecomposer(const pointFieldDecomposer &)=delete
No copy construct.
void operator=(const pointFieldDecomposer &)=delete
No copy assignment.
pointFieldDecomposer(const pointMesh &completeMesh, const pointMesh &procMesh, const labelUList &pointAddressing, const labelUList &boundaryAddressing)
Construct from components.
void reset(const pointMesh &completeMesh)
Reset mappers using information from the complete mesh.
~pointFieldDecomposer()=default
Destructor.
tmp< GeometricField< Type, pointPatchField, pointMesh > > decomposeField(const GeometricField< Type, pointPatchField, pointMesh > &) const
Decompose point field.
void clear()
Remove all mappers.
Mesh representing a set of points created from polyMesh.
Definition pointMesh.H:49
pointPatchFieldMapper()=default
Default construct.
Abstract base class for point-mesh patch fields.
Basic pointPatch represents a set of points from the mesh.
Definition pointPatch.H:67
A class for managing temporary objects.
Definition tmp.H:75
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
dynamicFvMesh & mesh
Namespace for OpenFOAM.
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