diff --git a/include/nvector/nvector_mpimanyvector.h b/include/nvector/nvector_mpimanyvector.h index e9a501548b..7d1f1d14c3 100644 --- a/include/nvector/nvector_mpimanyvector.h +++ b/include/nvector/nvector_mpimanyvector.h @@ -93,7 +93,7 @@ SUNDIALS_EXPORT N_Vector N_VClone_MPIManyVector(N_Vector w); SUNDIALS_EXPORT void N_VDestroy_MPIManyVector(N_Vector v); SUNDIALS_EXPORT void N_VSpace_MPIManyVector(N_Vector v, sunindextype *lrw, sunindextype *liw); -SUNDIALS_EXPORT SUNComm N_VGetCommunicator_MPIManyVector(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_MPIManyVector(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength_MPIManyVector(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetSubvectorLocalLength_MPIManyVector(N_Vector v, sunindextype vec_num); SUNDIALS_EXPORT void N_VLinearSum_MPIManyVector(sunrealtype a, N_Vector x, diff --git a/include/nvector/nvector_parallel.h b/include/nvector/nvector_parallel.h index a99bec81e8..d00d605d5e 100644 --- a/include/nvector/nvector_parallel.h +++ b/include/nvector/nvector_parallel.h @@ -122,7 +122,7 @@ SUNDIALS_EXPORT void N_VSpace_Parallel(N_Vector v, sunindextype *lrw, sunindextype *liw); SUNDIALS_EXPORT sunrealtype *N_VGetArrayPointer_Parallel(N_Vector v); SUNDIALS_EXPORT void N_VSetArrayPointer_Parallel(sunrealtype *v_data, N_Vector v); -SUNDIALS_EXPORT SUNComm N_VGetCommunicator_Parallel(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_Parallel(N_Vector v); /* standard vector operations */ SUNDIALS_EXPORT void N_VLinearSum_Parallel(sunrealtype a, N_Vector x, sunrealtype b, N_Vector y, N_Vector z); diff --git a/include/nvector/nvector_parhyp.h b/include/nvector/nvector_parhyp.h index 1287ac5128..bab5b1505d 100644 --- a/include/nvector/nvector_parhyp.h +++ b/include/nvector/nvector_parhyp.h @@ -98,7 +98,7 @@ SUNDIALS_EXPORT void N_VSpace_ParHyp(N_Vector v, sunindextype *lrw, sunindextype *liw); SUNDIALS_EXPORT sunrealtype *N_VGetArrayPointer_ParHyp(N_Vector v); SUNDIALS_EXPORT void N_VSetArrayPointer_ParHyp(sunrealtype *v_data, N_Vector v); -SUNDIALS_EXPORT void *N_VGetCommunicator_ParHyp(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_ParHyp(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength_ParHyp(N_Vector v); /* standard vector operations */ diff --git a/include/nvector/nvector_petsc.h b/include/nvector/nvector_petsc.h index 0edf01e560..908a891cbb 100644 --- a/include/nvector/nvector_petsc.h +++ b/include/nvector/nvector_petsc.h @@ -92,7 +92,7 @@ SUNDIALS_EXPORT N_Vector N_VClone_Petsc(N_Vector w); SUNDIALS_EXPORT void N_VDestroy_Petsc(N_Vector v); SUNDIALS_EXPORT void N_VSpace_Petsc(N_Vector v, sunindextype *lrw, sunindextype *liw); SUNDIALS_EXPORT void N_VSetArrayPointer_Petsc(sunrealtype *v_data, N_Vector v); -SUNDIALS_EXPORT void *N_VGetCommunicator_Petsc(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_Petsc(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength_Petsc(N_Vector v); /* standard vector operations */ diff --git a/include/nvector/nvector_trilinos.h b/include/nvector/nvector_trilinos.h index bc98564880..c9bbeb30ee 100644 --- a/include/nvector/nvector_trilinos.h +++ b/include/nvector/nvector_trilinos.h @@ -98,7 +98,7 @@ SUNDIALS_EXPORT N_Vector N_VCloneEmpty_Trilinos(N_Vector w); SUNDIALS_EXPORT N_Vector N_VClone_Trilinos(N_Vector w); SUNDIALS_EXPORT void N_VDestroy_Trilinos(N_Vector v); SUNDIALS_EXPORT void N_VSpace_Trilinos(N_Vector v, sunindextype *lrw, sunindextype *liw); -SUNDIALS_EXPORT void *N_VGetCommunicator_Trilinos(N_Vector v); +SUNDIALS_EXPORT MPI_Comm N_VGetCommunicator_Trilinos(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength_Trilinos(N_Vector v); SUNDIALS_EXPORT void N_VLinearSum_Trilinos(sunrealtype a, N_Vector x, sunrealtype b, N_Vector y, N_Vector z); SUNDIALS_EXPORT void N_VConst_Trilinos(sunrealtype c, N_Vector z); diff --git a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c index 8853616c80..18fe993650 100644 --- a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c +++ b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c @@ -365,11 +365,15 @@ SWIGEXPORT void _wrap_FN_VSpace_MPIManyVector(N_Vector farg1, int64_t *farg2, in SWIGEXPORT int _wrap_FN_VGetCommunicator_MPIManyVector(N_Vector farg1) { int fresult ; N_Vector arg1 = (N_Vector) 0 ; - SUNComm result; + MPI_Comm result; arg1 = (N_Vector)(farg1); - result = (SUNComm)N_VGetCommunicator_MPIManyVector(arg1); - fresult = (SUNComm)(result); + result = N_VGetCommunicator_MPIManyVector(arg1); +#ifdef SUNDIALS_MPI_ENABLED + fresult = (int)(MPI_Comm_c2f(result)); +#else + fresult = result; +#endif return fresult; } diff --git a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 index e8f53294a3..800c441604 100644 --- a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 +++ b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 @@ -883,14 +883,14 @@ subroutine FN_VSpace_MPIManyVector(v, lrw, liw) function FN_VGetCommunicator_MPIManyVector(v) & result(swig_result) use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result +integer :: swig_result type(N_Vector), target, intent(inout) :: v integer(C_INT) :: fresult type(C_PTR) :: farg1 farg1 = c_loc(v) fresult = swigc_FN_VGetCommunicator_MPIManyVector(farg1) -swig_result = fresult +swig_result = int(fresult) end function function FN_VGetLength_MPIManyVector(v) & diff --git a/src/nvector/parallel/fmod/fnvector_parallel_mod.c b/src/nvector/parallel/fmod/fnvector_parallel_mod.c index 21e278e9d8..c03b540a44 100644 --- a/src/nvector/parallel/fmod/fnvector_parallel_mod.c +++ b/src/nvector/parallel/fmod/fnvector_parallel_mod.c @@ -387,11 +387,15 @@ SWIGEXPORT void _wrap_FN_VSetArrayPointer_Parallel(double *farg1, N_Vector farg2 SWIGEXPORT int _wrap_FN_VGetCommunicator_Parallel(N_Vector farg1) { int fresult ; N_Vector arg1 = (N_Vector) 0 ; - SUNComm result; + MPI_Comm result; arg1 = (N_Vector)(farg1); - result = (SUNComm)N_VGetCommunicator_Parallel(arg1); - fresult = (SUNComm)(result); + result = N_VGetCommunicator_Parallel(arg1); +#ifdef SUNDIALS_MPI_ENABLED + fresult = (int)(MPI_Comm_c2f(result)); +#else + fresult = result; +#endif return fresult; } diff --git a/src/nvector/parallel/fmod/fnvector_parallel_mod.f90 b/src/nvector/parallel/fmod/fnvector_parallel_mod.f90 index 217b478708..28a55bf32d 100644 --- a/src/nvector/parallel/fmod/fnvector_parallel_mod.f90 +++ b/src/nvector/parallel/fmod/fnvector_parallel_mod.f90 @@ -891,14 +891,14 @@ subroutine FN_VSetArrayPointer_Parallel(v_data, v) function FN_VGetCommunicator_Parallel(v) & result(swig_result) use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result +integer :: swig_result type(N_Vector), target, intent(inout) :: v integer(C_INT) :: fresult type(C_PTR) :: farg1 farg1 = c_loc(v) fresult = swigc_FN_VGetCommunicator_Parallel(farg1) -swig_result = fresult +swig_result = int(fresult) end function subroutine FN_VLinearSum_Parallel(a, x, b, y, z)