template <
typename VectorType,
typename std::enable_if_t<!IsBlockVector<VectorType>::value, int> = 0>
- MPI_Comm
+ const MPI_Comm &
get_communicator(N_Vector v);
template <
typename VectorType,
typename std::enable_if_t<IsBlockVector<VectorType>::value, int> = 0>
- MPI_Comm
+ const MPI_Comm &
get_communicator(N_Vector v);
/**
template <typename VectorType,
std::enable_if_t<IsBlockVector<VectorType>::value, int>>
-MPI_Comm
+const MPI_Comm &
SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector v)
{
return unwrap_nvector_const<VectorType>(v)->block(0).get_mpi_communicator();
template <typename VectorType,
std::enable_if_t<!IsBlockVector<VectorType>::value, int>>
-MPI_Comm
+const MPI_Comm &
SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector v)
{
return unwrap_nvector_const<VectorType>(v)->get_mpi_communicator();
(void)v;
return nullptr;
# else
- return get_communicator<VectorType>(v);
+ // We need to cast away const here, as SUNDIALS demands a pure `void *`.
+ return &(const_cast<MPI_Comm &>(get_communicator<VectorType>(v)));
# endif
}