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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::parLagrangianDistributor
29 
30 Description
31  Lagrangian field redistributor.
32 
33  Runs in parallel. Redistributes from fromMesh to toMesh.
34 
35 SourceFiles
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 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class mapDistributePolyMesh;
55 class mapDistributeBase;
56 class IOobjectList;
57 class passivePositionParticleCloud;
58 
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 
83 public:
84 
85  //- Output verbosity when writing
86  static int verbose_;
87 
88 
89  // Generated Methods
90 
91  //- No copy construct
93 
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,
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>
123  static wordList filterObjects
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
170  label distributeAllFields
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 // ************************************************************************* //
static void findClouds(const fvMesh &, wordList &cloudNames, List< wordList > &objectNames)
Find all clouds (on all processors) and for each cloud all the objects. Result will be synchronised o...
static int verbose_
Output verbosity when writing.
label distributeFields(const mapDistributeBase &map, const word &cloudName, const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, redistribute and write all/selected lagrangian fields.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
Definition: IOobjectList.H:55
label distributeAllStoredFields(const mapDistributeBase &lagrangianMap, passivePositionParticleCloud &cloud) const
Redistribute and write all stored lagrangian fields.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void operator=(const parLagrangianDistributor &)=delete
No copy assignment.
const word cloudName(propsDict.get< word >("cloud"))
label distributeAllFields(const mapDistributeBase &lagrangianMap, const word &cloudName, const IOobjectList &cloudObjs, const wordRes &selectedFields) const
Redistribute all fields for known cloud field types.
A class for handling words, derived from Foam::string.
Definition: word.H:63
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:53
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:53
Class containing processor-to-processor mapping information.
label distributeFieldFields(const mapDistributeBase &map, const word &cloudName, const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, redistribute and write all/selected lagrangian fieldFields.
static wordList filterObjects(const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Pick up any fields of a given type.
parLagrangianDistributor(const parLagrangianDistributor &)=delete
No copy construct.
Lagrangian field redistributor.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:79
static label readFields(const passivePositionParticleCloud &cloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields of a cloud.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
static label readAllFields(const passivePositionParticleCloud &cloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields for known cloud field types.
label distributeStoredFields(const mapDistributeBase &map, passivePositionParticleCloud &cloud) const
Redistribute and write stored lagrangian fields.
Namespace for OpenFOAM.
autoPtr< mapDistributeBase > distributeLagrangianPositions(passivePositionParticleCloud &cloud) const
Redistribute and write lagrangian positions.