54 <<
"PstreamGlobals out of sync with UPstream data. Problem." 78 PstreamGlobals::DataTypeCountLookupTable::max_size()
79 == (
int(UPstream::dataTypes::DataTypes_end)+1),
80 "Data count lookup table size != number of dataTypes enumerations" 84 PstreamGlobals::DataTypeLookupTable::max_size()
85 == (
int(UPstream::dataTypes::DataTypes_end)+1),
86 "Lookup table size != number of dataTypes enumerations" 92 #define defineType(Idx, BaseType) \ 94 dataTypesCount_[int(UPstream::dataTypes::Idx)] = 1; \ 95 MPIdataTypes_[int(UPstream::dataTypes::Idx)] = BaseType; \ 108 defineType(type_long_double, MPI_LONG_DOUBLE);
113 #undef defineUserType 114 #define defineUserType(Idx, Count, BaseType, Name) \ 116 dataTypesCount_[int(UPstream::dataTypes::Idx)] = Count; \ 117 auto& dt = MPIdataTypes_[int(UPstream::dataTypes::Idx)]; \ 118 MPI_Type_contiguous(Count, BaseType, &dt); \ 119 MPI_Type_set_name(dt, Name); \ 120 MPI_Type_commit(&dt); \ 131 #undef defineUserType 147 for (; first != last; ++first)
149 if (MPI_DATATYPE_NULL != *first)
151 MPI_Type_free(&(*first));
170 for (; (first != last); ++first)
172 if (MPI_DATATYPE_NULL == *first)
188 (MPI_SUCCESS != MPI_Comm_rank(MPI_COMM_WORLD, &
rank))
195 const auto print = [&](
auto firstIndex,
auto lastIndex)
206 for (; (first != last); ++first)
216 std::cerr <<
"enumerated data types:\n";
219 UPstream::dataTypes::Basic_begin,
220 UPstream::dataTypes::Basic_end
226 std::cerr <<
"enumerated user-defined data types:\n";
230 UPstream::dataTypes::User_begin,
231 UPstream::dataTypes::User_end
238 if (MPI_DATATYPE_NULL == datatype)
240 return std::string(
"(null)");
243 char buf[MPI_MAX_OBJECT_NAME];
246 if (MPI_SUCCESS == MPI_Type_get_name(datatype, buf, &len))
250 return std::string(buf, len);
254 return std::string(
"(anon)");
258 return std::string(
"???");
268 PstreamGlobals::OpCodesLookupTable::max_size()
269 == (
int(UPstream::opCodes::OpCodes_end)+1),
270 "Lookup table size != number of opCodes enumerations" 275 #define defineCode(Idx, CodeType) \ 276 MPIopCodes_[int(UPstream::opCodes::Idx)] = CodeType; 316 for (; (first != last); ++first)
318 if (MPI_OP_NULL == *first)
#define defineCode(Idx, CodeType)
DynamicList< MPI_Request > outstandingRequests_
Outstanding non-blocking operations.
void deinitOpCodes()
Free any user-defined op codes.
A 1D vector of objects of type <T> with a fixed length <N>.
iterator begin() noexcept
Return an iterator to begin traversing the FixedList.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
DynamicList< MPI_Comm > MPICommunicators_
void initDataTypes()
Create mapping into MPIdataTypes_ and define user data types.
bool checkOpCodes()
Debugging only: check if op code mappings are non-null.
DynamicList< bool > pendingMPIFree_
#define defineType(Idx, BaseType)
void initOpCodes()
Create mapping into MPIopCodes_.
#define defineUserType(Idx, Count, BaseType, Name)
T & emplace_back(Args &&... args)
Construct an element at the end of the list, return reference to the new list element.
#define FOAM_UNLIKELY(cond)
errorManip< error > abort(error &err)
void initCommunicator(const label index)
Initialize bookkeeping for MPI communicator index.
void printDataTypes(bool all=false)
Debugging only: print data type names (all or just user-defined)
void deinitDataTypes()
Free any user data types.
DataTypeCountLookupTable dataTypesCount_
Fundamental count for each valid UPstream::dataTypes entry Indexed by UPstream::dataTypes enum...
bool checkDataTypes()
Debugging only: check if data type mappings are non-null.
bool all(const UList< bool > &bools)
True if all entries are 'true' or if the set is empty.
::Foam::direction rank(const expressions::valueTypeCode) noexcept
The vector-space rank associated with given valueTypeCode.
OpCodesLookupTable MPIopCodes_
MPI operation types, indexed by UPstream::opCodes enum.
DataTypeLookupTable MPIdataTypes_
MPI data types corresponding to fundamental and OpenFOAM types. Indexed by UPstream::dataTypes enum...
std::string dataType_name(MPI_Datatype datatype)
Return MPI internal name for specified MPI_Datatype.