1#define NoConstructFromTmp
2#include "ITHACAparallel.H"
3#undef NoConstructFromTmp
12 M_Assert(instance ==
nullptr,
13 "ITHACAparallel is already initialized, call ITHACAparallel::getInstance() to return an instance of ITHACAparallel");
21 M_Assert(instance !=
nullptr,
22 "ITHACAparallel needs to be initialized, call ITHACAparallel::getInstance(mesh, runTime) first");
34 for (label i = 0; i < mesh.boundaryMesh().size(); i++)
36 if (mesh.boundaryMesh()[i].type() !=
"processor")
78 Gsize_BF = autoPtr<labelList>(
new labelList (
N_BF, label(0)));
80 labelList(label(0), label(0))));
82 for (label i = 0; i <
N_BF; i++)
85 reduce(
Gsize_BF()[i], sumOp<label>());
88 for (label k = 0; k <
mesh.boundaryMesh()[i].size(); k++)
94 Start = autoPtr<labelList> (
new labelList(
N_BF, 0));
96 for (label i = 0; i <
N_BF; i++)
100 Start()[i] = INT_MAX;
104 Start()[i] = INT_MAX;
112 reduce(
Start()[i], minOp<label>());
118 Pstream::parRun() =
false;
119 label comm = Pstream::worldComm;
127 label comm = Pstream::worldComm;
129 Pstream::parRun() =
true;
134 GeometricField<scalar, fvPatchField, volMesh>& field)
136 List<List< scalar >> GlobField(field.boundaryFieldRef().size() + 1);
140 for (label i = 0; i < field.size(); i++)
142 GlobField[0][
indices()[i]] = field[i];
145 reduce(GlobField[0], sumOp<List<scalar >> ());
148 for (label i = 0; i <
N_BF; i++)
150 GlobField[i + 1].resize(
Gsize_BF()[i]);
151 Field<scalar> zero(
Gsize_BF()[i], 0.0);
152 GlobField[i + 1] = zero;
155 for (label i = 0; i <
N_BF; i++)
157 for (label k = 0; k < field.boundaryFieldRef()[i].size(); k++)
160 && field.boundaryFieldRef()[i].type() !=
"zeroGradient"
161 && field.boundaryFieldRef()[i].type() !=
"processor" )
164 field.boundaryFieldRef()[i][k];
168 reduce(GlobField[i + 1], sumOp<List<scalar >> ());
176 GeometricField<vector, fvPatchField, volMesh>& field)
178 List<List< vector >> GlobField(field.boundaryFieldRef().size() + 1);
180 GlobField[0] = GlobField[0] * 0;
183 for (label i = 0; i < field.size(); i++)
185 GlobField[0][
indices()[i]] = field[i];
188 reduce(GlobField[0], sumOp<List<vector >> ());
191 for (label i = 0; i <
N_BF; i++)
193 GlobField[i + 1].resize(
Gsize_BF()[i]);
194 List<vector> zero(
Gsize_BF()[i], vector(0.0, 0.0, 0.0));
195 GlobField[i + 1] = zero;
198 for (label i = 0; i <
N_BF; i++)
200 for (label k = 0; k < field.boundaryFieldRef()[i].size(); k++)
203 && field.boundaryFieldRef()[i].type() !=
"zeroGradient"
204 && field.boundaryFieldRef()[i].type() !=
"processor" )
207 field.boundaryFieldRef()[i][k];
211 reduce(GlobField[i + 1], sumOp<List<vector >> ());
Class for parallel handling, it has several functions to deal with parallel problems,...
autoPtr< labelList > Start
StartFace on the gloabl Mesh.
autoPtr< labelIOList > indices
Cell proc addressing.
static void suspendMPI()
Function to sumpend MPI.
fvMesh & mesh
Mesh object defined locally.
ITHACAparallel()=delete
Delete empty constructor.
static ITHACAparallel * getInstance()
Gets an instance of ithacaparallel, to be used if the instance is already existing.
autoPtr< List< labelList > > IndFaceLocal
Indexing.
static void resumeMPI()
Function to resume MPI.
label N_IF_glob
Totoal number of internal field cells.
static List< int > newProcIDs_
ID of the NEW process.
autoPtr< labelIOList > indicesF
Face proc addressing.
static List< int > oldProcIDs_
ID of the OLD process.
autoPtr< labelList > Gsize_BF
Boundary Field variables representing the total number of faces for each processor.
List< List< Type > > combineFields(GeometricField< Type, fvPatchField, volMesh > &field)
Function to get a global field from a parallel one.
label N_BF
Number of Boundary Patches without considering processors.