Skip to content
Snippets Groups Projects
Commit 14e5e305 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Use static_assert indepedently of MPI presence

parent ec4cd3ba
No related branches found
No related tags found
1 merge request!37Feature/language
...@@ -298,10 +298,10 @@ class Messenger ...@@ -298,10 +298,10 @@ class Messenger
DataType DataType
allReduceMin(const DataType& data) const allReduceMin(const DataType& data) const
{ {
#ifdef PUGS_HAS_MPI
static_assert(not std::is_const_v<DataType>); static_assert(not std::is_const_v<DataType>);
static_assert(std::is_arithmetic_v<DataType>); static_assert(std::is_arithmetic_v<DataType>);
#ifdef PUGS_HAS_MPI
MPI_Datatype mpi_datatype = Messenger::helper::mpiType<DataType>(); MPI_Datatype mpi_datatype = Messenger::helper::mpiType<DataType>();
DataType min_data = data; DataType min_data = data;
...@@ -317,10 +317,10 @@ class Messenger ...@@ -317,10 +317,10 @@ class Messenger
DataType DataType
allReduceMax(const DataType& data) const allReduceMax(const DataType& data) const
{ {
#ifdef PUGS_HAS_MPI
static_assert(not std::is_const_v<DataType>); static_assert(not std::is_const_v<DataType>);
static_assert(std::is_arithmetic_v<DataType>); static_assert(std::is_arithmetic_v<DataType>);
#ifdef PUGS_HAS_MPI
MPI_Datatype mpi_datatype = Messenger::helper::mpiType<DataType>(); MPI_Datatype mpi_datatype = Messenger::helper::mpiType<DataType>();
DataType max_data = data; DataType max_data = data;
...@@ -336,8 +336,10 @@ class Messenger ...@@ -336,8 +336,10 @@ class Messenger
DataType DataType
allReduceSum(const DataType& data) const allReduceSum(const DataType& data) const
{ {
#ifdef PUGS_HAS_MPI
static_assert(not std::is_const_v<DataType>); static_assert(not std::is_const_v<DataType>);
static_assert(std::is_arithmetic_v<DataType>);
#ifdef PUGS_HAS_MPI
if constexpr (std::is_arithmetic_v<DataType>) { if constexpr (std::is_arithmetic_v<DataType>) {
MPI_Datatype mpi_datatype = Messenger::helper::mpiType<DataType>(); MPI_Datatype mpi_datatype = Messenger::helper::mpiType<DataType>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment