|
opm-simulators
|
Generic MPI traits implementation for structs. More...
#include <ReservoirCouplingMpiTraits.hpp>
Static Public Member Functions | |
| static MPI_Datatype | getType () |
Static Public Attributes | |
| static constexpr bool | is_intrinsic = false |
Generic MPI traits implementation for structs.
This class template provides automatic MPI datatype creation for C++ structs by analyzing the struct's member pointers. It generates an MPI_Datatype that correctly represents the memory layout of the struct, allowing it to be sent via MPI communication functions.
The implementation handles:
Thread Safety: The MPI datatype is created exactly once using std::call_once() to ensure thread-safe initialization in case this code is called from multiple threads.
Usage Example:
| Struct | The struct type for which to create an MPI datatype |
| Members | Variadic pack of pointers-to-members listing all fields to include |
Assumptions: Each field of the struct must be either: