template <
typename VectorType,
- typename std::enable_if_t<is_serial_vector<VectorType>::value, int> = 0>
- MPI_Comm get_communicator(N_Vector);
-
- template <
- typename VectorType,
- typename std::enable_if_t<!is_serial_vector<VectorType>::value &&
- !IsBlockVector<VectorType>::value,
- int> = 0>
+ typename std::enable_if_t<!IsBlockVector<VectorType>::value, int> = 0>
MPI_Comm
get_communicator(N_Vector v);
template <
typename VectorType,
- typename std::enable_if_t<!is_serial_vector<VectorType>::value &&
- IsBlockVector<VectorType>::value,
- int> = 0>
+ typename std::enable_if_t<IsBlockVector<VectorType>::value, int> = 0>
MPI_Comm
get_communicator(N_Vector v);
* Sundials likes a void* but we want to use the above functions
* internally with a safe type.
*/
- template <typename VectorType>
+ template <
+ typename VectorType,
+ typename std::enable_if_t<is_serial_vector<VectorType>::value, int> = 0>
inline void *
- get_communicator_as_void_ptr(N_Vector v)
- {
-# ifndef DEAL_II_WITH_MPI
- (void)v;
- return nullptr;
-# else
- return get_communicator<VectorType>(v);
-# endif
- }
+ get_communicator_as_void_ptr(N_Vector v);
+
+ template <typename VectorType,
+ typename std::enable_if_t<!is_serial_vector<VectorType>::value,
+ int> = 0>
+ inline void *
+ get_communicator_as_void_ptr(N_Vector v);
} // namespace NVectorOperations
} // namespace internal
template <typename VectorType,
- std::enable_if_t<is_serial_vector<VectorType>::value, int>>
-MPI_Comm SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector)
+ std::enable_if_t<IsBlockVector<VectorType>::value, int>>
+MPI_Comm
+SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector v)
{
- return MPI_COMM_SELF;
+ return unwrap_nvector_const<VectorType>(v)->block(0).get_mpi_communicator();
}
template <typename VectorType,
- std::enable_if_t<!is_serial_vector<VectorType>::value &&
- IsBlockVector<VectorType>::value,
- int>>
+ std::enable_if_t<!IsBlockVector<VectorType>::value, int>>
MPI_Comm
SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector v)
{
- return unwrap_nvector_const<VectorType>(v)->block(0).get_mpi_communicator();
+ return unwrap_nvector_const<VectorType>(v)->get_mpi_communicator();
}
template <typename VectorType,
- std::enable_if_t<!is_serial_vector<VectorType>::value &&
- !IsBlockVector<VectorType>::value,
- int>>
-MPI_Comm
-SUNDIALS::internal::NVectorOperations::get_communicator(N_Vector v)
+ typename std::enable_if_t<is_serial_vector<VectorType>::value, int>>
+void *
+ SUNDIALS::internal::NVectorOperations::get_communicator_as_void_ptr(N_Vector)
{
- return unwrap_nvector_const<VectorType>(v)->get_mpi_communicator();
+ // required by SUNDIALS: MPI-unaware vectors should return the nullptr as comm
+ return nullptr;
+}
+
+
+
+template <typename VectorType,
+ typename std::enable_if_t<!is_serial_vector<VectorType>::value, int>>
+void *
+SUNDIALS::internal::NVectorOperations::get_communicator_as_void_ptr(N_Vector v)
+{
+# ifndef DEAL_II_WITH_MPI
+ (void)v;
+ return nullptr;
+# else
+ return get_communicator<VectorType>(v);
+# endif
}