ENH: define UPstream rangeType

- UPstream::rangeType as typedef for IntRange<int> for better use
  semantics
This commit is contained in:
Mark Olesen
2020-12-04 09:20:10 +01:00
parent e697ac277f
commit 08efeb1a03

View File

@ -63,6 +63,9 @@ class UPstream
{ {
public: public:
//- Int ranges are used for MPI ranks (processes)
typedef IntRange<int> rangeType;
//- Types of communications //- Types of communications
enum class commsTypes enum class commsTypes
{ {
@ -259,7 +262,7 @@ public:
ClassName("UPstream"); ClassName("UPstream");
// Static data // Static Data
//- Should compact transfer be used in which floats replace doubles //- Should compact transfer be used in which floats replace doubles
//- reducing the bandwidth requirement at the expense of some loss //- reducing the bandwidth requirement at the expense of some loss
@ -421,7 +424,7 @@ public:
return old; return old;
} }
//- Is this a parallel run? //- Test if this a parallel run, or allow modify access
static bool& parRun() static bool& parRun()
{ {
return parRun_; return parRun_;
@ -439,7 +442,7 @@ public:
return procIDs_[communicator].size(); return procIDs_[communicator].size();
} }
//- Process index of the master //- Process index of the master (always 0)
static constexpr int masterNo() noexcept static constexpr int masterNo() noexcept
{ {
return 0; return 0;
@ -469,17 +472,17 @@ public:
} }
//- Range of process indices for all processes //- Range of process indices for all processes
static IntRange<int> allProcs(const label communicator = 0) static rangeType allProcs(const label communicator = 0)
{ {
// Proc 0 -> nProcs // Proc 0 -> nProcs (int value)
return IntRange<int>(static_cast<int>(nProcs(communicator))); return rangeType(static_cast<int>(nProcs(communicator)));
} }
//- Range of process indices for sub-processes //- Range of process indices for sub-processes
static IntRange<int> subProcs(const label communicator = 0) static rangeType subProcs(const label communicator = 0)
{ {
// Proc 1 -> nProcs // Proc 1 -> nProcs (int value)
return IntRange<int>(1, static_cast<int>(nProcs(communicator)-1)); return rangeType(1, static_cast<int>(nProcs(communicator)-1));
} }
//- Communication schedule for linear all-to-master (proc 0) //- Communication schedule for linear all-to-master (proc 0)