From: Timo Heister Date: Sat, 25 Dec 2021 17:30:45 +0000 (-0500) Subject: fix sundials compilation X-Git-Tag: v9.3.3~8^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13123%2Fhead;p=dealii.git fix sundials compilation --- diff --git a/include/deal.II/sundials/n_vector.templates.h b/include/deal.II/sundials/n_vector.templates.h index 2b49e3efc9..746f63a03b 100644 --- a/include/deal.II/sundials/n_vector.templates.h +++ b/include/deal.II/sundials/n_vector.templates.h @@ -253,13 +253,13 @@ namespace SUNDIALS template < typename VectorType, typename std::enable_if_t::value, int> = 0> - MPI_Comm + const MPI_Comm & get_communicator(N_Vector v); template < typename VectorType, typename std::enable_if_t::value, int> = 0> - MPI_Comm + const MPI_Comm & get_communicator(N_Vector v); /** @@ -481,7 +481,7 @@ SUNDIALS::internal::NVectorOperations::destroy(N_Vector v) template ::value, int>> -MPI_Comm +const MPI_Comm & SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector v) { return unwrap_nvector_const(v)->block(0).get_mpi_communicator(); @@ -491,7 +491,7 @@ SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector v) template ::value, int>> -MPI_Comm +const MPI_Comm & SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector v) { return unwrap_nvector_const(v)->get_mpi_communicator(); @@ -519,7 +519,8 @@ SUNDIALS::internal::NVectorOperations::get_communicator_as_void_ptr(N_Vector v) (void)v; return nullptr; # else - return get_communicator(v); + // We need to cast away const here, as SUNDIALS demands a pure `void *`. + return &(const_cast(get_communicator(v))); # endif }