Loading...
Searching...
No Matches
parLagrangianDistributor.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) 2015 OpenFOAM Foundation
9 Copyright (C) 2018-2023 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::parLagrangianDistributor
29
30Description
31 Lagrangian field redistributor.
32
33 Runs in parallel. Redistributes from fromMesh to toMesh.
34
35SourceFiles
36 parLagrangianDistributor.cxx
37 parLagrangianDistributor.txx
38 parLagrangianDistributorFields.cxx
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef Foam_parLagrangianDistributor_H
43#define Foam_parLagrangianDistributor_H
44
45#include "PtrList.H"
46#include "fvMesh.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53// Forward Declarations
56class IOobjectList;
59/*---------------------------------------------------------------------------*\
60 Class parLagrangianDistributor Declaration
61\*---------------------------------------------------------------------------*/
62
64{
65 // Private Data
66
67 //- Source mesh reference
68 const fvMesh& srcMesh_;
69
70 //- Destination mesh reference
71 const fvMesh& tgtMesh_;
72
73 //- Distribution map reference
74 const mapDistributePolyMesh& distMap_;
75
76 //- For every src cell the target processor
77 labelList destinationProcID_;
78
79 //- For every src cell the target cell
80 labelList destinationCell_;
81
82
83public:
84
85 //- Output verbosity when writing
86 static int verbose_;
87
88
89 // Generated Methods
90
91 //- No copy construct
94 //- No copy assignment
95 void operator=(const parLagrangianDistributor&) = delete;
96
97
98 // Constructors
99
100 //- Construct from components
102 (
103 const fvMesh& srcMesh,
104 const fvMesh& tgtMesh,
105 const label nOldCells,
107 );
108
109
110 // Static Functions
111
112 //- Find all clouds (on all processors) and for each cloud all
113 //- the objects. Result will be synchronised on all processors
114 static void findClouds
115 (
116 const fvMesh&,
117
119 wordList& cloudNames,
120
122 boolList& haveClouds,
123
125 List<wordList>& objectNames
126 );
127
128 //- Pick up any fields of a given type
129 template<class Type>
131 (
132 const IOobjectList& objects,
133 const wordRes& selectedFields = wordRes()
134 );
135
136 //- Read and store all fields of a cloud
137 template<class Container>
138 static label readFields
139 (
141 const bool haveCloud,
142 const IOobjectList& objects,
143 const wordRes& selectedFields = wordRes()
144 );
145
146 //- Read and store all fields for known cloud field types
147 static label readAllFields
148 (
150 const bool haveCloud,
151 const IOobjectList& objects,
152 const wordRes& selectedFields = wordRes()
153 );
154
155
156 // Member Functions
158 //- Redistribute and write lagrangian positions
160 (
162 ) const;
163
164 //- Read, redistribute and write lagrangian positions
166 (
167 const word& cloudName
168 ) const;
169
170 //- Redistribute all fields for known cloud field types
172 (
173 const mapDistributeBase& lagrangianMap,
174 const word& cloudName,
175 const bool haveCloud,
176 const IOobjectList& cloudObjs,
177 const wordRes& selectedFields
178 ) const;
179
180 //- Redistribute and write all stored lagrangian fields
183 const mapDistributeBase& lagrangianMap,
185 ) const;
186
187
188 //- Read, redistribute and write all/selected lagrangian fields
189 template<class Type>
191 (
192 const mapDistributeBase& map,
193 const word& cloudName,
194 const bool haveCloud,
195 const IOobjectList& objects,
196 const wordRes& selectedFields = wordRes()
197 ) const;
199 //- Read, redistribute and write all/selected lagrangian fieldFields
200 template<class Type>
202 (
203 const mapDistributeBase& map,
204 const word& cloudName,
205 const bool haveCloud,
206 const IOobjectList& objects,
207 const wordRes& selectedFields = wordRes()
208 ) const;
209
210 //- Redistribute and write stored lagrangian fields.
211 // Note: does no reading so no need to check for existence
212 // of lagrangian files
213 template<class Container>
215 (
216 const mapDistributeBase& map,
218 ) const;
219};
220
222// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223
224} // End namespace Foam
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228#ifdef NoRepository
229# include "parLagrangianDistributor.txx"
230#endif
231
232// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233
234#endif
235
236// ************************************************************************* //
const word cloudName(propsDict.get< word >("cloud"))
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A cloud is a registry collection of lagrangian particles.
Definition cloud.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Class containing processor-to-processor mapping information.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
label distributeAllFields(const mapDistributeBase &lagrangianMap, const word &cloudName, const bool haveCloud, const IOobjectList &cloudObjs, const wordRes &selectedFields) const
Redistribute all fields for known cloud field types.
static wordList filterObjects(const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Pick up any fields of a given type.
label distributeFieldFields(const mapDistributeBase &map, const word &cloudName, const bool haveCloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, redistribute and write all/selected lagrangian fieldFields.
autoPtr< mapDistributeBase > distributeLagrangianPositions(passivePositionParticleCloud &cloud) const
Redistribute and write lagrangian positions.
label distributeStoredFields(const mapDistributeBase &map, passivePositionParticleCloud &cloud) const
Redistribute and write stored lagrangian fields.
label distributeFields(const mapDistributeBase &map, const word &cloudName, const bool haveCloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, redistribute and write all/selected lagrangian fields.
static label readFields(const passivePositionParticleCloud &cloud, const bool haveCloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields of a cloud.
static label readAllFields(const passivePositionParticleCloud &cloud, const bool haveCloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields for known cloud field types.
autoPtr< mapDistributeBase > distributeLagrangianPositions(const word &cloudName) const
Read, redistribute and write lagrangian positions.
label distributeAllStoredFields(const mapDistributeBase &lagrangianMap, passivePositionParticleCloud &cloud) const
Redistribute and write all stored lagrangian fields.
void operator=(const parLagrangianDistributor &)=delete
No copy assignment.
parLagrangianDistributor(const parLagrangianDistributor &)=delete
No copy construct.
static int verbose_
Output verbosity when writing.
static void findClouds(const fvMesh &, wordList &cloudNames, boolList &haveClouds, List< wordList > &objectNames)
Find all clouds (on all processors) and for each cloud all the objects. Result will be synchronised o...
parLagrangianDistributor(const fvMesh &srcMesh, const fvMesh &tgtMesh, const label nOldCells, const mapDistributePolyMesh &distMap)
Construct from components.
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
List< label > labelList
A List of labels.
Definition List.H:62
List< bool > boolList
A List of bools.
Definition List.H:60