44 #ifndef Foam_globalIndex_H 45 #define Foam_globalIndex_H 60 Istream&
operator>>(Istream& is, globalIndex& gi);
89 static void reportOverflowAndExit
143 const label comm =
UPstream::worldComm,
144 const
bool parallel =
UPstream::parRun()
152 const label comm = -1
164 const label comm =
UPstream::worldComm
177 const label comm =
UPstream::worldComm
188 inline
bool empty() const;
191 inline label
size() const;
240 const label comm =
UPstream::worldComm,
241 const
bool parallel =
UPstream::parRun()
250 const
bool checkOverflow = false
258 const label comm = -1
270 const label comm =
UPstream::worldComm
283 const label comm =
UPstream::worldComm
310 inline
bool isLocal(const label i) const;
313 inline label
toGlobal(const label i) const;
323 inline label
toLocal(const label i) const;
329 inline label
localStart(const label proci) const;
332 inline label
localSize(const label proci) const;
341 inline
bool isLocal(const label proci, const label i) const;
344 inline label
toGlobal(const label proci, const label i) const;
362 inline label
toLocal(const label proci, const label i) const;
391 const label proci = 0
398 inline label proci()
const noexcept;
401 inline label start()
const;
404 inline label
size()
const;
443 const
bool checkOverflow = false
448 template<class SubListType>
451 const
List<SubListType>& lists,
452 const
bool checkOverflow = false
460 const
bool checkOverflow = false
465 template<class ProcIDsContainer, class Type>
469 const ProcIDsContainer& procIDs,
470 const Type& localValue,
471 List<Type>& allValues,
472 const
int tag =
UPstream::msgType(),
478 template<class ProcIDsContainer, class Type>
483 const ProcIDsContainer& procIDs,
486 const
int tag =
UPstream::msgType(),
492 template<class Type, class Addr>
497 const
UList<
int>& procIDs,
500 const
int tag =
UPstream::msgType(),
509 template<class ProcIDsContainer, class Type>
514 const ProcIDsContainer& procIDs,
516 const
int tag =
UPstream::msgType(),
524 fld.transfer(allData);
530 template<
class ProcIDsContainer,
class Type>
534 const ProcIDsContainer& procIDs,
541 gather(offsets_, comm, procIDs,
fld, allFld, tag, ct);
547 template<
class ProcIDsContainer,
class Type>
551 const ProcIDsContainer& procIDs,
557 gather(offsets_, comm, procIDs,
fld, tag, ct);
569 const UList<Type>& sendData,
579 template<
class Type,
class Addr>
582 const IndirectListBase<Type, Addr>& sendData,
594 template<
class Type,
class OutputContainer = List<Type>>
597 const UList<Type>& sendData,
607 template<
class Type,
class Addr,
class OutputContainer = List<Type>>
610 const IndirectListBase<Type, Addr>& sendData,
636 template<
class Type,
class OutputContainer = List<Type>>
639 const UList<Type>& sendData,
640 OutputContainer& allData,
655 template<
class Type,
class OutputContainer = List<Type>>
658 const UList<Type>& sendData,
693 template<
class Type,
class OutputContainer = List<Type>>
697 OutputContainer& allData,
710 template<
class Type,
class OutputContainer = List<Type>>
758 template<
class Type,
class Addr>
773 template<
class Type,
class OutputContainer = List<Type>>
787 template<
class Type,
class Addr,
class OutputContainer = List<Type>>
816 template<
class ProcIDsContainer,
class Type>
821 const ProcIDsContainer& procIDs,
832 template<
class ProcIDsContainer,
class Type>
836 const ProcIDsContainer& procIDs,
844 scatter(offsets_, comm, procIDs, allFld,
fld, tag, ct);
865 template<
class Type,
class OutputContainer = List<Type>>
880 template<
class Type,
class CombineOp>
885 const CombineOp& cop,
904 const label comm = -1
914 const globalIndex::gatherOnly,
960 const globalIndex::gatherOnly,
bool isLocal(const label i) const
Is on local processor.
void reset(const label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun())
Reset from local size, using gather/broadcast with default/specified communicator if parallel...
static void mpiGatherOp(const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy)...
static List< labelRange > calcRanges(const labelUList &localLens, const bool checkOverflow=false)
Calculate ranges (offset/size) from a list of local sizes, with optional check for label overflow...
commsTypes
Types of communications.
List< labelRange > ranges() const
Return start/size ranges for all data.
A range or interval of labels defined by a start and a size.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
friend Ostream & operator<<(Ostream &os, const globalIndex &gi)
Dispatch tag. Construct 'one-sided' from local sizes, using gather but no broadcast.
static int & msgType() noexcept
Message tag of standard messages.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
void inplaceToGlobal(labelUList &labels) const
From local to global index (inplace)
static label worldComm
Default world communicator (all processors). May differ from globalComm if local worlds are in use...
friend Istream & operator>>(Istream &is, globalIndex &gi)
labelList localSizes() const
The local sizes.
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
labelRange range() const
Return start/size range of local processor data.
label nProcs() const noexcept
The number of processors covered by the offsets.
globalIndex() noexcept=default
Default construct (empty)
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
const labelList & offsets() const noexcept
Const-access to the offsets.
static void mpiGatherInplaceOp(List< Type > &fld, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op)...
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Dispatch tag. Construct with a single (local size) entry, no communication.
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
static labelList calcListOffsets(const List< SubListType > &lists, const bool checkOverflow=false)
Calculate offsets from list of lists, with optional check for label overflow.
void mpiGather(const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy)...
Forward input iterator with const access.
const_iterator cbegin() const noexcept
A const_iterator set to the beginning.
label offset(const label proci) const
Prefer localStart() to avoid confusing with offsets()
const_iterator begin() const noexcept
A const_iterator set to the beginning.
void mpiGatherInplace(List< Type > &fld, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op)...
Istream & operator>>(Istream &, directionInfo &)
label size() const
Global sum of localSizes. Same as totalSize()
void setLocalSize(const label proci, const label len)
Alter local size for given processor.
label toLocal(const label i) const
From global to local on current processor.
label whichProcID(const label i) const
Which processor does global id come from?
A packed storage unstructured matrix of objects of type <T> using an offset table for access...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
labelList sizes() const
The local sizes. Same as localSizes()
static void gatherValues(const label comm, const ProcIDsContainer &procIDs, const Type &localValue, List< Type > &allValues, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
Collect single values in processor order on master (== procIDs[0]).
OBJstream os(runTime.globalPath()/outputName)
static const UList< label > & null()
Return a UList reference to a nullObject.
const const_iterator end() const noexcept
A const_iterator set to beyond the end.
labelRange subProcs() const noexcept
Range of process indices for addressed sub-offsets (processes)
labelRange allProcs() const noexcept
Range of process indices for all addressed offsets (processes)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
label toGlobal(const label i) const
From local to global index.
static void gatherInplaceOp(List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Inplace collect data in processor order on master (in serial: a no-op).
"nonBlocking" : (MPI_Isend, MPI_Irecv)
void gatherInplace(List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
Inplace collect data in processor order on master (in serial: a no-op).
accessType
Disambiguation tag (list construction dispatch)
bool operator!=(const eddy &a, const eddy &b)
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
label localStart() const
My local start.
bool empty() const
Check for default constructed or global sum == 0.
const const_iterator cend() const noexcept
A const_iterator set to beyond the end.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
static void gatherOp(const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Collect data in processor order on master (in serial: performs a simple copy).
label maxSize() const
Global max of localSizes.
Inter-processor communications stream.
void clear()
Reset to be empty (no offsets)
static labelList calcOffsets(const labelUList &localLens, const bool checkOverflow=false)
Calculate offsets from a list of local sizes, with optional check for label overflow.
Dispatch tag. Construct 'one-sided' from the non-master local sizes using gather but no broadcast...
label totalSize() const
Global sum of localSizes.
static void scatter(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
Distribute data in processor order.
label maxNonLocalSize() const
The max of localSizes, excluding current processor.
label localSize() const
My local size.
const labelUList localStarts() const
The local starts.