parLagrangianDistributorFields.C
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) 2022-2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 
31 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 
34 (
35  const passivePositionParticleCloud& cloud,
36  const bool haveCloud,
37  const IOobjectList& cloudObjs,
38  const wordRes& selectedFields
39 )
40 {
41  label nTotal = 0;
42 
43  do
44  {
45  #undef doLocalCode
46  #define doLocalCode(Type) \
47  { \
48  nTotal += parLagrangianDistributor::readFields \
49  <IOField<Type>> \
50  ( \
51  cloud, \
52  haveCloud, \
53  cloudObjs, \
54  selectedFields \
55  ); \
56  \
57  nTotal += parLagrangianDistributor::readFields \
58  <IOField<Field<Type>>> \
59  ( \
60  cloud, \
61  haveCloud, \
62  cloudObjs, \
63  selectedFields \
64  ); \
65  \
66  nTotal += parLagrangianDistributor::readFields \
67  <CompactIOField<Field<Type>, Type>> \
68  ( \
69  cloud, \
70  haveCloud, \
71  cloudObjs, \
72  selectedFields \
73  ); \
74  }
75 
76  doLocalCode(label);
77  doLocalCode(scalar);
82 
83  #undef doLocalCode
84  }
85  while (false);
86 
87  return nTotal;
88 }
89 
90 
91 //Foam::label Foam::parLagrangianDistributor::readAllFields
92 //(
93 // const passivePositionParticleCloud& cloud,
94 // const wordRes& selectedFields
95 //)
96 //{
97 // IOobjectList cloudObjs(cloud, cloud.time().timeName());
98 // return readAllFields(cloud, cloudObjs, selectedFields);
99 //}
100 
101 
103 (
104  const mapDistributeBase& lagrangianMap,
105  const word& cloudName,
106  const bool haveCloud,
107  const IOobjectList& cloudObjs,
108  const wordRes& selectedFields
109 ) const
110 {
111  label nTotal = 0;
112 
113  do
114  {
115  #undef doLocalCode
116  #define doLocalCode(Type) \
117  { \
118  nTotal += this->distributeFields<Type> \
119  ( \
120  lagrangianMap, \
121  cloudName, \
122  haveCloud, \
123  cloudObjs, \
124  selectedFields \
125  ); \
126  \
127  nTotal += this->distributeFieldFields<Type> \
128  ( \
129  lagrangianMap, \
130  cloudName, \
131  haveCloud, \
132  cloudObjs, \
133  selectedFields \
134  ); \
135  }
136 
137  doLocalCode(label);
138  doLocalCode(scalar);
143 
144  #undef doLocalCode
145  }
146  while (false);
147 
148  return nTotal;
149 }
150 
151 
153 (
154  const mapDistributeBase& lagrangianMap,
155  passivePositionParticleCloud& cloud
156 ) const
157 {
158  label nTotal = 0;
159 
160  do
161  {
162  #undef doLocalCode
163  #define doLocalCode(Type) \
164  { \
165  nTotal += this->distributeStoredFields \
166  <IOField<Type>> \
167  ( \
168  lagrangianMap, \
169  cloud \
170  ); \
171  \
172  nTotal += this->distributeStoredFields \
173  <IOField<Field<Type>>> \
174  ( \
175  lagrangianMap, \
176  cloud \
177  ); \
178  \
179  nTotal += this->distributeStoredFields \
180  <CompactIOField<Field<Type>, Type>> \
181  ( \
182  lagrangianMap, \
183  cloud \
184  ); \
185  }
186 
187  doLocalCode(label);
188  doLocalCode(scalar);
193 
194  #undef doLocalCode
195  }
196  while (false);
197 
198  return nTotal;
199 }
200 
201 
202 // ************************************************************************* //
Tensor< scalar > tensor
Definition: symmTensor.H:57
label distributeAllStoredFields(const mapDistributeBase &lagrangianMap, passivePositionParticleCloud &cloud) const
Redistribute and write all stored lagrangian fields.
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.
#define doLocalCode(FieldType, Variable)
const word cloudName(propsDict.get< word >("cloud"))
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:55
Vector< scalar > vector
Definition: vector.H:57
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.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.