93 const label nProcGroup
96 const label jump = processorGroup.
size()/nProcGroup;
97 const label jumpb = jump + 1;
98 const label fstProcessorGroup = processorGroup.
size() - jump*nProcGroup;
105 for (j=0; j<fstProcessorGroup; j++)
107 for (label
k=0;
k<jumpb;
k++)
109 processorGroup[ind++] = j;
114 for (; j<nProcGroup; j++)
116 for (label
k=0;
k<jump;
k++)
118 processorGroup[ind++] = j;
127 const label nProcGroup,
130 const scalar summedWeights
143 const scalar jump = summedWeights/nProcGroup;
144 const label nProcGroupM1 = nProcGroup - 1;
146 scalar sumWeights = 0;
151 for (j=0; j<nProcGroupM1; j++)
153 const scalar
limit = jump*scalar(j + 1);
154 while (sumWeights <
limit)
156 sumWeights += weights[indices[ind]];
157 processorGroup[ind++] = j;
161 while (ind < processorGroup.size())
163 processorGroup[ind++] = nProcGroupM1;
186 vectorLessOp sorter(rotatedPoints);
201 finalDecomp[pointIndices[i]] = processorGroups[i];
215 finalDecomp[pointIndices[i]] +=
n_.x()*processorGroups[i];
229 finalDecomp[pointIndices[i]] +=
n_.x()*
n_.y()*processorGroups[i];
244 return decomposeOneProc(
points);
267 const scalar summedWeights =
sum(weights);
279 finalDecomp[pointIndices[i]] = processorGroups[i];
300 finalDecomp[pointIndices[i]] += n_.x()*processorGroups[i];
321 finalDecomp[pointIndices[i]] += n_.x()*n_.y()*processorGroups[i];
361 return decomposeOneProc(
points, weights);
365 return decomposeOneProc(
points);
380 allWeights = globalNumbers.gather(weights);
387 allDecomp = decomposeOneProc(allPoints, allWeights);
391 allDecomp = decomposeOneProc(allPoints);
397 return globalNumbers.scatter(allDecomp);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
void clear()
Clear the list, i.e. set size to zero.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Abstract base class for domain decomposition.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
tmp< pointField > adjustPoints(const pointField &) const
Apply delta (jitter) or rotation to coordinates.
Vector< label > n_
The divisions.
geomDecomp(const Vector< label > &divisions)
Construct with number of x/y/z division (no coefficients or constraints).
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, UList< Type > &allFld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
static void scatter(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Distribute data in processor order.
Simple geometric decomposition, selectable as simple.
simpleGeomDecomp(const simpleGeomDecomp &)=delete
No copy construct.
virtual labelList decompose(const pointField &points, const scalarField &weights=scalarField::null()) const
Return for every coordinate the wanted processor number. using uniform or specified point weights.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
List< label > labelList
A List of labels.
complex limit(const complex &c1, const complex &c2)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
void sort(UList< T > &list)
Sort the list.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static void assignToProcessorGroup(labelList &processorGroup, const label nProcGroup)
vectorField pointField
pointField is a vectorField.
#define forAll(list, i)
Loop across all elements in list.
void setComponent(direction cmpt)
bool operator()(const label a, const label b) const
vectorLessOp(const UList< vector > &list, direction cmpt=vector::X)
const UList< vector > & values