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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015 OpenFOAM Foundation
9  Copyright (C) 2018 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::parLagrangianRedistributor
29 
30 Description
31  Lagrangian field redistributor.
32 
33  Runs in parallel. Redistributes from fromMesh to toMesh.
34 
35 SourceFiles
36  parLagrangianRedistributor.C
37  parLagrangianRedistributorFields.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef parLagrangianRedistributor_H
42 #define parLagrangianRedistributor_H
43 
44 #include "PtrList.H"
45 #include "fvMesh.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declarations
53 class mapDistributePolyMesh;
54 class mapDistributeBase;
55 class IOobjectList;
56 class passivePositionParticleCloud;
57 
58 /*---------------------------------------------------------------------------*\
59  Class parLagrangianRedistributor Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 {
64  // Private data
65 
66  //- Source mesh reference
67  const fvMesh& srcMesh_;
68 
69  //- Destination mesh reference
70  const fvMesh& tgtMesh_;
71 
72  //- Distribution map reference
73  const mapDistributePolyMesh& distMap_;
74 
75  //- For every src cell the target processor
76  labelList destinationProcID_;
77 
78  //- For every src cell the target cell
79  labelList destinationCell_;
80 
81 
82  // Private Member Functions
83 
84  //- No copy construct
86 
87  //- No copy assignment
88  void operator=(const parLagrangianRedistributor&) = delete;
89 
90 
91 public:
92 
93  // Constructors
94 
95  //- Construct from components
97  (
98  const fvMesh& srcMesh,
99  const fvMesh& tgtMesh,
100  const label nOldCells,
101  const mapDistributePolyMesh& distMap
102  );
103 
104 
105  // Member Functions
106 
107  //- Find all clouds (on all processors) and for each cloud all
108  // the objects. Result will be synchronised on all processors
109  static void findClouds
110  (
111  const fvMesh&,
112  wordList& cloudNames,
113  List<wordList>& objectNames
114  );
115 
116  //- Redistribute and write lagrangian positions
118  (
120  ) const;
121 
122  //- Read, redistribute and write lagrangian positions
124  (
125  const word& cloudName
126  ) const;
127 
128  //- Pick up any fields of a given type
129  template<class Type>
130  static wordList filterObjects
131  (
132  const IOobjectList& objects,
133  const wordRes& selectedFields = wordRes()
134  );
135 
136  //- Read, redistribute and write all/selected lagrangian fields
137  template<class Type>
138  label redistributeFields
139  (
140  const mapDistributeBase& map,
141  const word& cloudName,
142  const IOobjectList& objects,
143  const wordRes& selectedFields = wordRes()
144  ) const;
145 
146  //- Read, redistribute and write all/selected lagrangian fieldFields
147  template<class Type>
149  (
150  const mapDistributeBase& map,
151  const word& cloudName,
152  const IOobjectList& objects,
153  const wordRes& selectedFields = wordRes()
154  ) const;
155 
156  //- Read and store all fields of a cloud
157  template<class Container>
158  static label readFields
159  (
161  const IOobjectList& objects,
162  const wordRes& selectedFields = wordRes()
163  );
164 
165  //- Redistribute and write stored lagrangian fields
166  template<class Container>
168  (
169  const mapDistributeBase& map,
171  ) const;
172 
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #ifdef NoRepository
184 #endif
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
Foam::parLagrangianRedistributor::redistributeFields
label redistributeFields(const mapDistributeBase &map, const word &cloudName, const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, redistribute and write all/selected lagrangian fields.
cloudName
const word cloudName(propsDict.get< word >("cloud"))
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::parLagrangianRedistributor::redistributeStoredFields
label redistributeStoredFields(const mapDistributeBase &map, passivePositionParticleCloud &cloud) const
Redistribute and write stored lagrangian fields.
Foam::parLagrangianRedistributor::redistributeFieldFields
label redistributeFieldFields(const mapDistributeBase &map, const word &cloudName, const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, redistribute and write all/selected lagrangian fieldFields.
parLagrangianRedistributorFields.C
Foam::parLagrangianRedistributor::findClouds
static void findClouds(const fvMesh &, wordList &cloudNames, List< wordList > &objectNames)
Find all clouds (on all processors) and for each cloud all.
Foam::parLagrangianRedistributor::filterObjects
static wordList filterObjects(const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Pick up any fields of a given type.
Foam::parLagrangianRedistributor
Lagrangian field redistributor.
Definition: parLagrangianRedistributor.H:61
Foam::parLagrangianRedistributor::redistributeLagrangianPositions
autoPtr< mapDistributeBase > redistributeLagrangianPositions(passivePositionParticleCloud &cloud) const
Redistribute and write lagrangian positions.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:55
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cloud
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:57
Foam::parLagrangianRedistributor::readFields
static label readFields(const passivePositionParticleCloud &cloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields of a cloud.
Foam::passivePositionParticleCloud
A Cloud of passive position particles.
Definition: passivePositionParticleCloud.H:51
Foam::List< label >
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::mapDistributeBase
Class containing processor-to-processor mapping information.
Definition: mapDistributeBase.H:103
PtrList.H
Foam::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition: mapDistributePolyMesh.H:66