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 &
get_communicator(N_Vector v)
{
return unwrap_nvector_const<VectorType>(v)
template <typename VectorType,
std::enable_if_t<!IsBlockVector<VectorType>::value, int>>
- MPI_Comm
+ const MPI_Comm &
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
}
{
auto vector = create_test_vector<VectorType>();
auto n_vector = make_nvector_view(vector);
- Assert(N_VGetCommunicator(n_vector) == MPI_COMM_WORLD, NVectorTestError());
+ Assert(*static_cast<MPI_Comm *>(N_VGetCommunicator(n_vector)) ==
+ MPI_COMM_WORLD,
+ NVectorTestError());
deallog << "test_get_communicator OK" << std::endl;
}