parLagrangianRedistributor.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 | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::parLagrangianRedistributor
26 
27 Description
28  Lagrangian field redistributor.
29 
30  Runs in parallel. Redistributes from fromMesh to toMesh.
31 
32 SourceFiles
33  parLagrangianRedistributor.C
34  parLagrangianRedistributorRedistributeFields.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef parLagrangianRedistributor_H
39 #define parLagrangianRedistributor_H
40 
41 #include "PtrList.H"
42 #include "fvMesh.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class mapDistributePolyMesh;
50 class mapDistributeBase;
51 class IOobjectList;
52 class passiveParticleCloud;
53 
54 /*---------------------------------------------------------------------------*\
55  Class parLagrangianRedistributor Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 {
60  // Private data
61 
62  //- Source mesh reference
63  const fvMesh& srcMesh_;
64 
65  //- Destination mesh reference
66  const fvMesh& tgtMesh_;
67 
68  //- Distribution map reference
70 
71  //- For every src cell the target processor
73 
74  //- For every src cell the target cell
76 
77 
78  // Private Member Functions
79 
80  //- Disallow default bitwise copy construct
82 
83  //- Disallow default bitwise assignment
85 
86 
87 public:
88 
89  // Constructors
90 
91  //- Construct from components
93  (
94  const fvMesh& srcMesh,
95  const fvMesh& tgtMesh,
96  const label nOldCells,
97  const mapDistributePolyMesh& distMap
98  );
99 
100 
101  // Member Functions
102 
103  //- Find all clouds (on all processors) and for each cloud all
104  // the objects. Result will be synchronised on all processors
105  static void findClouds
106  (
107  const fvMesh&,
108  wordList& cloudNames,
109  List<wordList>& objectNames
110  );
111 
112  //- Redistribute and write lagrangian positions
114  (
116  ) const;
117 
118  //- Read, redistribute and write lagrangian positions
120  (
121  const word& cloudName
122  ) const;
123 
124  //- Pick up any fields of a given type
125  template<class Type>
126  static wordList filterObjects
127  (
128  const IOobjectList& objects,
129  const HashSet<word>& selectedFields
130  );
131 
132  //- Read, redistribute and write all/selected lagrangian fields
133  template<class Type>
135  (
136  const mapDistributeBase& map,
137  const word& cloudName,
138  const IOobjectList& objects,
139  const HashSet<word>& selectedFields
140  ) const;
141 
142  //- Read, redistribute and write all/selected lagrangian fieldFields
143  template<class Type>
145  (
146  const mapDistributeBase& map,
147  const word& cloudName,
148  const IOobjectList& objects,
149  const HashSet<word>& selectedFields
150  ) const;
151 
152  //- Read and store all fields of a cloud
153  template<class Container>
154  static void readLagrangianFields
155  (
157  const IOobjectList& objects,
158  const HashSet<word>& selectedFields
159  );
160 
161  //- Redistribute and write stored lagrangian fields
162  template<class Container>
164  (
165  const mapDistributeBase& map,
167  ) const;
168 
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #ifdef NoRepository
179 # include "parLagrangianRedistributorRedistributeFields.C"
180 #endif
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
Foam::parLagrangianRedistributor::redistributeStoredLagrangianFields
void redistributeStoredLagrangianFields(const mapDistributeBase &map, passiveParticleCloud &cloud) const
Redistribute and write stored lagrangian fields.
Definition: parLagrangianRedistributorRedistributeFields.C:273
Foam::parLagrangianRedistributor::readLagrangianFields
static void readLagrangianFields(const passiveParticleCloud &cloud, const IOobjectList &objects, const HashSet< word > &selectedFields)
Read and store all fields of a cloud.
Definition: parLagrangianRedistributorRedistributeFields.C:225
Foam::parLagrangianRedistributor::operator=
void operator=(const parLagrangianRedistributor &)
Disallow default bitwise assignment.
Foam::parLagrangianRedistributor::redistributeLagrangianPositions
autoPtr< mapDistributeBase > redistributeLagrangianPositions(passiveParticleCloud &cloud) const
Redistribute and write lagrangian positions.
Definition: parLagrangianRedistributor.C:130
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::parLagrangianRedistributor::tgtMesh_
const fvMesh & tgtMesh_
Destination mesh reference.
Definition: parLagrangianRedistributor.H:65
Foam::parLagrangianRedistributor::srcMesh_
const fvMesh & srcMesh_
Source mesh reference.
Definition: parLagrangianRedistributor.H:62
Foam::parLagrangianRedistributor::parLagrangianRedistributor
parLagrangianRedistributor(const parLagrangianRedistributor &)
Disallow default bitwise copy construct.
Foam::HashSet
A HashTable with keys but without contents.
Definition: HashSet.H:59
Foam::parLagrangianRedistributor::redistributeLagrangianFields
void redistributeLagrangianFields(const mapDistributeBase &map, const word &cloudName, const IOobjectList &objects, const HashSet< word > &selectedFields) const
Read, redistribute and write all/selected lagrangian fields.
Definition: parLagrangianRedistributorRedistributeFields.C:68
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::parLagrangianRedistributor
Lagrangian field redistributor.
Definition: parLagrangianRedistributor.H:57
Foam::passiveParticleCloud
A Cloud of passive particles.
Definition: passiveParticleCloud.H:49
Foam::parLagrangianRedistributor::filterObjects
static wordList filterObjects(const IOobjectList &objects, const HashSet< word > &selectedFields)
Pick up any fields of a given type.
Foam::parLagrangianRedistributor::findClouds
static void findClouds(const fvMesh &, wordList &cloudNames, List< wordList > &objectNames)
Find all clouds (on all processors) and for each cloud all.
Definition: parLagrangianRedistributor.C:60
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:50
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::cloud
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
Foam::parLagrangianRedistributor::destinationProcID_
labelList destinationProcID_
For every src cell the target processor.
Definition: parLagrangianRedistributor.H:71
Foam::parLagrangianRedistributor::distMap_
const mapDistributePolyMesh & distMap_
Distribution map reference.
Definition: parLagrangianRedistributor.H:68
Foam::parLagrangianRedistributor::redistributeLagrangianFieldFields
void redistributeLagrangianFieldFields(const mapDistributeBase &map, const word &cloudName, const IOobjectList &objects, const HashSet< word > &selectedFields) const
Read, redistribute and write all/selected lagrangian fieldFields.
Definition: parLagrangianRedistributorRedistributeFields.C:140
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
cloudName
const word cloudName(propsDict.lookup("cloudName"))
Foam::mapDistributeBase
Class containing processor-to-processor mapping information.
Definition: mapDistributeBase.H:91
PtrList.H
Foam::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition: mapDistributePolyMesh.H:57
Foam::parLagrangianRedistributor::destinationCell_
labelList destinationCell_
For every src cell the target cell.
Definition: parLagrangianRedistributor.H:74