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-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::parLagrangianDistributor
29
30Description
31 Lagrangian field redistributor.
32
33 Runs in parallel. Redistributes from fromMesh to toMesh.
34
35SourceFiles
36 parLagrangianDistributor.C
37 parLagrangianDistributorFields.C
38 parLagrangianDistributorTemplates.C
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
54class mapDistributePolyMesh;
55class mapDistributeBase;
56class IOobjectList;
57class passivePositionParticleCloud;
58
59/*---------------------------------------------------------------------------*\
60 Class parLagrangianDistributor Declaration
61\*---------------------------------------------------------------------------*/
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
83 // Private Member Functions
84
85 //- No copy construct
87
88 //- No copy assignment
89 void operator=(const parLagrangianDistributor&) = delete;
90
91
92public:
93
94 //- Output verbosity when writing
95 static int verbose_;
96
97
98 // Constructors
99
100 //- Construct from components
102 (
103 const fvMesh& srcMesh,
104 const fvMesh& tgtMesh,
105 const label nOldCells,
106 const mapDistributePolyMesh& distMap
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 wordList& cloudNames,
118 List<wordList>& objectNames
119 );
120
121 //- Pick up any fields of a given type
122 template<class Type>
124 (
125 const IOobjectList& objects,
126 const wordRes& selectedFields = wordRes()
127 );
128
129 //- Read and store all fields of a cloud
130 template<class Container>
131 static label readFields
132 (
134 const IOobjectList& objects,
135 const wordRes& selectedFields = wordRes()
136 );
137
138 //- Read and store all fields for known cloud field types
139 static label readAllFields
140 (
142 const IOobjectList& objects,
143 const wordRes& selectedFields = wordRes()
144 );
145
146 //- Read and store all fields for known cloud field types
147 // Uses the current cloud instance to obtain the IOobjectList
148 static label readAllFields
149 (
151 const wordRes& selectedFields = wordRes()
152 );
153
154
155 // Member Functions
156
157 //- Redistribute and write lagrangian positions
159 (
161 ) const;
162
163 //- Read, redistribute and write lagrangian positions
165 (
166 const word& cloudName
167 ) const;
168
169 //- Redistribute all fields for known cloud field types
171 (
172 const mapDistributeBase& lagrangianMap,
173 const word& cloudName,
174 const IOobjectList& cloudObjs,
175 const wordRes& selectedFields
176 ) const;
177
178 //- Redistribute and write all stored lagrangian fields
180 (
181 const mapDistributeBase& lagrangianMap,
183 ) const;
184
185
186 //- Read, redistribute and write all/selected lagrangian fields
187 template<class Type>
188 label distributeFields
189 (
190 const mapDistributeBase& map,
191 const word& cloudName,
192 const IOobjectList& objects,
193 const wordRes& selectedFields = wordRes()
194 ) const;
195
196 //- Read, redistribute and write all/selected lagrangian fieldFields
197 template<class Type>
199 (
200 const mapDistributeBase& map,
201 const word& cloudName,
202 const IOobjectList& objects,
203 const wordRes& selectedFields = wordRes()
204 ) const;
205
206 //- Redistribute and write stored lagrangian fields
207 template<class Container>
209 (
210 const mapDistributeBase& map,
212 ) const;
213};
214
215
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218} // End namespace Foam
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222#ifdef NoRepository
224#endif
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228#endif
229
230// ************************************************************************* //
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Class containing processor-to-processor mapping information.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Lagrangian field redistributor.
static void findClouds(const fvMesh &, wordList &cloudNames, List< wordList > &objectNames)
static wordList filterObjects(const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Pick up any fields of a given type.
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.
static label readFields(const passivePositionParticleCloud &cloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields of a cloud.
static label readAllFields(const passivePositionParticleCloud &cloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields for known cloud field types.
label distributeFieldFields(const mapDistributeBase &map, const word &cloudName, const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, redistribute and write all/selected lagrangian fieldFields.
autoPtr< mapDistributeBase > distributeLagrangianPositions(const word &cloudName) const
Read, redistribute and write lagrangian positions.
label distributeFields(const mapDistributeBase &map, const word &cloudName, const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, redistribute and write all/selected lagrangian fields.
label distributeAllStoredFields(const mapDistributeBase &lagrangianMap, passivePositionParticleCloud &cloud) const
Redistribute and write all stored lagrangian fields.
static int verbose_
Output verbosity when writing.
label distributeAllFields(const mapDistributeBase &lagrangianMap, const word &cloudName, const IOobjectList &cloudObjs, const wordRes &selectedFields) const
Redistribute all fields for known cloud field types.
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:54
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
const word cloudName(propsDict.get< word >("cloud"))