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 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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 IOobjectList& cloudObjs,
37 const wordRes& selectedFields
38)
39{
40 label nTotal = 0;
41
42 do
43 {
44 #undef doLocalCode
45 #define doLocalCode(Type) \
46 { \
47 nTotal += parLagrangianDistributor::readFields \
48 <IOField<Type>> \
49 ( \
50 cloud, \
51 cloudObjs, \
52 selectedFields \
53 ); \
54 \
55 nTotal += parLagrangianDistributor::readFields \
56 <IOField<Field<Type>>> \
57 ( \
58 cloud, \
59 cloudObjs, \
60 selectedFields \
61 ); \
62 \
63 nTotal += parLagrangianDistributor::readFields \
64 <CompactIOField<Field<Type>, Type>> \
65 ( \
66 cloud, \
67 cloudObjs, \
68 selectedFields \
69 ); \
70 }
71
72 doLocalCode(label);
73 doLocalCode(scalar);
78
79 #undef doLocalCode
80 }
81 while (false);
82
83 return nTotal;
84}
85
86
88(
89 const passivePositionParticleCloud& cloud,
90 const wordRes& selectedFields
91)
92{
93 IOobjectList cloudObjs(cloud, cloud.time().timeName());
94 return readAllFields(cloud, cloudObjs, selectedFields);
95}
96
97
99(
100 const mapDistributeBase& lagrangianMap,
101 const word& cloudName,
102 const IOobjectList& cloudObjs,
103 const wordRes& selectedFields
104) const
105{
106 label nTotal = 0;
107
108 do
109 {
110 #undef doLocalCode
111 #define doLocalCode(Type) \
112 { \
113 nTotal += this->distributeFields<Type> \
114 ( \
115 lagrangianMap, \
116 cloudName, \
117 cloudObjs, \
118 selectedFields \
119 ); \
120 \
121 nTotal += this->distributeFieldFields<Type> \
122 ( \
123 lagrangianMap, \
124 cloudName, \
125 cloudObjs, \
126 selectedFields \
127 ); \
128 }
129
130 doLocalCode(label);
131 doLocalCode(scalar);
136
137 #undef doLocalCode
138 }
139 while (false);
140
141 return nTotal;
142}
143
144
146(
147 const mapDistributeBase& lagrangianMap,
148 passivePositionParticleCloud& cloud
149) const
150{
151 label nTotal = 0;
152
153 do
154 {
155 #undef doLocalCode
156 #define doLocalCode(Type) \
157 { \
158 nTotal += this->distributeStoredFields \
159 <IOField<Type>> \
160 ( \
161 lagrangianMap, \
162 cloud \
163 ); \
164 \
165 nTotal += this->distributeStoredFields \
166 <IOField<Field<Type>>> \
167 ( \
168 lagrangianMap, \
169 cloud \
170 ); \
171 \
172 nTotal += this->distributeStoredFields \
173 <CompactIOField<Field<Type>, Type>> \
174 ( \
175 lagrangianMap, \
176 cloud \
177 ); \
178 }
179
180 doLocalCode(label);
181 doLocalCode(scalar);
186
187 #undef doLocalCode
188 }
189 while (false);
190
191 return nTotal;
192}
193
194
195// ************************************************************************* //
static label readAllFields(const passivePositionParticleCloud &cloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields for known cloud field types.
label distributeAllStoredFields(const mapDistributeBase &lagrangianMap, passivePositionParticleCloud &cloud) const
Redistribute and write all stored lagrangian fields.
label distributeAllFields(const mapDistributeBase &lagrangianMap, const word &cloudName, const IOobjectList &cloudObjs, const wordRes &selectedFields) const
Redistribute all fields for known cloud field types.
Tensor of scalars, i.e. Tensor<scalar>.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:59
const word cloudName(propsDict.get< word >("cloud"))
#define doLocalCode(GeoField)