32 const label localSize,
38 offsets_(Pstream::nProcs(comm)+1)
40 labelList localSizes(Pstream::nProcs(comm), 0);
41 localSizes[Pstream::myProcNo(comm)] = localSize;
44 Pstream::gatherList(localSizes, tag, comm);
45 Pstream::scatterList(localSizes, tag, comm);
50 for (
label proci = 0; proci < Pstream::nProcs(comm); proci++)
52 label oldOffset = offset;
53 offset += localSizes[proci];
55 if (offset < oldOffset)
58 <<
"Overflow : sum of sizes " << localSizes
59 <<
" exceeds capability of label (" <<
labelMax 60 <<
"). Please recompile with larger datatype for label." 63 offsets_[proci+1] = offset;
82 offset += localSizes[proci];
84 if (offset < oldOffset)
87 <<
"Overflow : sum of sizes " << localSizes
88 <<
" exceeds capability of label (" <<
labelMax 89 <<
"). Please recompile with larger datatype for label." 92 offsets_[proci+1] =
offset;
113 return is >> gi.offsets_;
119 return os << gi.offsets_;
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static int & msgType()
Message tag of standard messages.
label offset(const label proci) const
Start of proci data.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
globalIndex()
Construct null.
Istream & operator>>(Istream &, directionInfo &)
Inter-processor communications stream.
static const label labelMax
labelList & offsets()
Change after construction.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Ostream & operator<<(Ostream &, const ensightPart &)
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
label localSize() const
My local size.