diff --git a/CHANGELOG.md b/CHANGELOG.md index ff81e1a4ab..6a6b5cde94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,11 +47,28 @@ method `ARKODE_VERNER_16_8_9`. Changed the `SUNProfiler` so that it does not rely on `MPI_WTime` in any case. This fixes https://github.com/LLNL/sundials/issues/312. -Updated the `N_VGetCommunicator`, `SUNLogger_Create`, and `SUNProfiler_Create` -functions to use a `SUNComm` rather than `void*`. `SUNComm` simply is a -typedef to an `int` for builds without MPI and a `MPI_Comm` for builds with MPI. -This allows for `MPI_Comm` to be passed and returned by value which solves -issues like the one described in https://github.com/LLNL/sundials/issues/275. +**Breaking change** +We have replaced the use of a type-erased (i.e., `void*`) pointer to a +communicator in place of `MPI_Comm` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to a `int` in builds without MPI +and a typedef to a `MPI_Comm` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + `SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the `comm` argument instead of + `NULL`. For MPI codes, pass the `MPI_Comm` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + `SUNLogger_Create` or `SUNProfiler_Create`. + +- Some users will need to update their calls to `N_VGetCommunicator`, and + update any custom `N_Vector` implementations tht provide + `N_VGetCommunicator`, since it now returns a `SUNComm`. + +The change away from type-erased pointers for `SUNComm` fixes problems like the +one described in `GitHub Issue #275 `. ## Changes to SUNDIALS in release 6.6.1 diff --git a/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu b/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu index b4be26d8d6..0b3bf1a9cc 100644 --- a/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu +++ b/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) printf(" number of tests %d \n", ntests); printf(" timing on/off %d \n", print_timing); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/hip/test_nvector_performance_hip.cpp b/benchmarks/nvector/hip/test_nvector_performance_hip.cpp index bb8b3fe350..a2d0899b05 100644 --- a/benchmarks/nvector/hip/test_nvector_performance_hip.cpp +++ b/benchmarks/nvector/hip/test_nvector_performance_hip.cpp @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) printf(" number of tests %d \n", ntests); printf(" timing on/off %d \n", print_timing); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/openmp/test_nvector_performance_openmp.c b/benchmarks/nvector/openmp/test_nvector_performance_openmp.c index 56d88738b5..de7279467f 100644 --- a/benchmarks/nvector/openmp/test_nvector_performance_openmp.c +++ b/benchmarks/nvector/openmp/test_nvector_performance_openmp.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) printf(" timing on/off %d \n", print_timing); printf(" number of threads %d \n", nthreads); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c b/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c index 18d7c286d3..1144b3af08 100644 --- a/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c +++ b/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) printf(" timing on/off %d \n", print_timing); printf(" number of threads %d \n", nthreads); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/benchmarks/nvector/serial/test_nvector_performance_serial.c b/benchmarks/nvector/serial/test_nvector_performance_serial.c index 5259de8d18..4da5469929 100644 --- a/benchmarks/nvector/serial/test_nvector_performance_serial.c +++ b/benchmarks/nvector/serial/test_nvector_performance_serial.c @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) printf(" number of tests %d \n", ntests); printf(" timing on/off %d \n", print_timing); - flag = SUNContext_Create(NULL, &ctx); + flag = SUNContext_Create(SUN_COMM_NULL, &ctx); if (flag) return flag; /* Create vectors */ diff --git a/doc/arkode/guide/source/Introduction.rst b/doc/arkode/guide/source/Introduction.rst index a2de9671b1..9c6ece560f 100644 --- a/doc/arkode/guide/source/Introduction.rst +++ b/doc/arkode/guide/source/Introduction.rst @@ -167,16 +167,28 @@ This fixes `GitHub Issue #312 `_. Added Fortran support for the LAPACK dense ``SUNLinearSolver`` implementation. -Updated the ``N_VGetCommunicator``, :c:func:`SUNLogger_Create`, and -:c:func:`SUNProfiler_Create` functions to use a :c:type:`SUNComm` rather than -``void*``. :c:type:`SUNComm` simply is a ``typedef`` to an ``int`` for builds -without MPI and a ``MPI_Comm`` for builds with MPI. This allows for ``MPI_Comm`` -to be passed and returned by value which solves issues like the one described in -`GitHub Issue #275 `. **This is a -breaking change** that will require users to update their calls to -``N_VGetCommunicator`` and update any custom ``N_Vector`` implementations that -provide ``N_VGetCommunicator``. - +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to a ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 `. Changes in v5.6.1 diff --git a/doc/cvode/guide/source/Introduction.rst b/doc/cvode/guide/source/Introduction.rst index a656cf7dc8..5f23ec2165 100644 --- a/doc/cvode/guide/source/Introduction.rst +++ b/doc/cvode/guide/source/Introduction.rst @@ -134,15 +134,28 @@ This fixes `GitHub Issue #312 `_. Added Fortran support for the LAPACK dense ``SUNLinearSolver`` implementation. -Updated the ``N_VGetCommunicator``, :c:func:`SUNLogger_Create`, and -:c:func:`SUNProfiler_Create` functions to use a :c:type:`SUNComm` rather than -``void*``. :c:type:`SUNComm` simply is a ``typedef`` to an ``int`` for builds -without MPI and a ``MPI_Comm`` for builds with MPI. This allows for ``MPI_Comm`` -to be passed and returned by value which solves issues like the one described in -`GitHub Issue #275 `. **This is a -breaking change** that will require users to update their calls to -``N_VGetCommunicator`` and update any custom ``N_Vector`` implementations that -provide ``N_VGetCommunicator``. +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to a ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 `. Changes in v6.6.1 ----------------- diff --git a/doc/cvodes/guide/source/Introduction.rst b/doc/cvodes/guide/source/Introduction.rst index 6111e26f36..7647df4491 100644 --- a/doc/cvodes/guide/source/Introduction.rst +++ b/doc/cvodes/guide/source/Introduction.rst @@ -137,15 +137,28 @@ This fixes `GitHub Issue #312 `_. Added Fortran support for the LAPACK dense ``SUNLinearSolver`` implementation. -Updated the ``N_VGetCommunicator``, :c:func:`SUNLogger_Create`, and -:c:func:`SUNProfiler_Create` functions to use a :c:type:`SUNComm` rather than -``void*``. :c:type:`SUNComm` simply is a ``typedef`` to an ``int`` for builds -without MPI and a ``MPI_Comm`` for builds with MPI. This allows for ``MPI_Comm`` -to be passed and returned by value which solves issues like the one described in -`GitHub Issue #275 `. **This is a -breaking change** that will require users to update their calls to -``N_VGetCommunicator`` and update any custom ``N_Vector`` implementations that -provide ``N_VGetCommunicator``. +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to a ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 `. Changes in v6.6.1 ----------------- diff --git a/doc/ida/guide/source/Introduction.rst b/doc/ida/guide/source/Introduction.rst index 17ff8c5eef..6ad63a5c07 100644 --- a/doc/ida/guide/source/Introduction.rst +++ b/doc/ida/guide/source/Introduction.rst @@ -95,15 +95,28 @@ This fixes `GitHub Issue #312 `_. Added Fortran support for the LAPACK dense ``SUNLinearSolver`` implementation. -Updated the ``N_VGetCommunicator``, :c:func:`SUNLogger_Create`, and -:c:func:`SUNProfiler_Create` functions to use a :c:type:`SUNComm` rather than -``void*``. :c:type:`SUNComm` simply is a ``typedef`` to an ``int`` for builds -without MPI and a ``MPI_Comm`` for builds with MPI. This allows for ``MPI_Comm`` -to be passed and returned by value which solves issues like the one described in -`GitHub Issue #275 `. **This is a -breaking change** that will require users to update their calls to -``N_VGetCommunicator`` and update any custom ``N_Vector`` implementations that -provide ``N_VGetCommunicator``. +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to a ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 `. Changes in v6.6.1 ----------------- diff --git a/doc/idas/guide/source/Introduction.rst b/doc/idas/guide/source/Introduction.rst index 1a895bdf83..c4fe9c3dd1 100644 --- a/doc/idas/guide/source/Introduction.rst +++ b/doc/idas/guide/source/Introduction.rst @@ -112,15 +112,28 @@ This fixes `GitHub Issue #312 `_. Added Fortran support for the LAPACK dense ``SUNLinearSolver`` implementation. -Updated the ``N_VGetCommunicator``, :c:func:`SUNLogger_Create`, and -:c:func:`SUNProfiler_Create` functions to use a :c:type:`SUNComm` rather than -``void*``. :c:type:`SUNComm` simply is a ``typedef`` to an ``int`` for builds -without MPI and a ``MPI_Comm`` for builds with MPI. This allows for ``MPI_Comm`` -to be passed and returned by value which solves issues like the one described in -`GitHub Issue #275 `. **This is a -breaking change** that will require users to update their calls to -``N_VGetCommunicator`` and update any custom ``N_Vector`` implementations that -provide ``N_VGetCommunicator``. +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to a ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 `. Changes in v5.6.1 ----------------- diff --git a/doc/kinsol/guide/source/Introduction.rst b/doc/kinsol/guide/source/Introduction.rst index 798dcee01b..87d5c86b45 100644 --- a/doc/kinsol/guide/source/Introduction.rst +++ b/doc/kinsol/guide/source/Introduction.rst @@ -104,15 +104,28 @@ CMake targets. Added Fortran support for the LAPACK dense ``SUNLinearSolver`` implementation. -Updated the ``N_VGetCommunicator``, :c:func:`SUNLogger_Create`, and -:c:func:`SUNProfiler_Create` functions to use a :c:type:`SUNComm` rather than -``void*``. :c:type:`SUNComm` simply is a ``typedef`` to an ``int`` for builds -without MPI and a ``MPI_Comm`` for builds with MPI. This allows for ``MPI_Comm`` -to be passed and returned by value which solves issues like the one described in -`GitHub Issue #275 `. **This is a -breaking change** that will require users to update their calls to -``N_VGetCommunicator`` and update any custom ``N_Vector`` implementations that -provide ``N_VGetCommunicator``. +**Breaking change** +We have replaced the use of a type-erased (i.e., ``void*``) pointer to a +communicator in place of ``MPI_Comm`` throughout the SUNDIALS API with a +:c:type:`SUNComm`, which is just a typedef to a ``int`` in builds without MPI +and a typedef to a ``MPI_Comm`` in builds with MPI. Here is what this means: + +- All users will need to update their codes because the call to + :c:func:`SUNContext_Create` now takes a :c:type:`SUNComm` instead + of type-erased pointer to a communicator. For non-MPI codes, + pass :c:type:`SUN_COMM_NULL` to the ``comm`` argument instead of + ``NULL``. For MPI codes, pass the ``MPI_Comm`` directly. + The required change should be doable with a find-and-replace. + +- The same change must be made for calls to + :c:func:`SUNLogger_Create` or :c:func:`SUNProfiler_Create`. + +- Some users will need to update their calls to ``N_VGetCommunicator``, and + update any custom ``N_Vector`` implementations tht provide + ``N_VGetCommunicator``, since it now returns a ``SUNComm``. + +The change away from type-erased pointers for :c:type:`SUNComm` fixes problems like the +one described in `GitHub Issue #275 `. Changes in v6.6.1 ----------------- diff --git a/doc/shared/sundials/Profiling.rst b/doc/shared/sundials/Profiling.rst index c064f70b09..32404a28ed 100644 --- a/doc/shared/sundials/Profiling.rst +++ b/doc/shared/sundials/Profiling.rst @@ -218,7 +218,7 @@ It is applicable to any of the SUNDIALS solver packages. SUNProfiler profobj; /* Create the SUNDIALS context */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); /* Get a reference to the profiler */ retval = SUNContext_GetProfiler(ctx, &profobj); diff --git a/doc/shared/sundials/SUNContext.rst b/doc/shared/sundials/SUNContext.rst index b324b8b5e4..77b0df7cf9 100644 --- a/doc/shared/sundials/SUNContext.rst +++ b/doc/shared/sundials/SUNContext.rst @@ -51,7 +51,7 @@ routines for different SUNDIALS classes/modules e.g., void* package_mem; N_Vector x; - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); package_mem = CVodeCreate(..., sunctx); package_mem = IDACreate(..., sunctx); diff --git a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp index 68e021c2cf..2f84c2593e 100644 --- a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp +++ b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) /* Create SUNDIALS context */ SUNContext ctx; - retval = SUNContext_Create(&comm, &ctx); + retval = SUNContext_Create(comm, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) MPI_Abort(comm, 1); /* Add scope to destroy objects before MPIFinalize */ diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp index b0da18e139..cc6857ceed 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp @@ -379,7 +379,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(&comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp index 18b5c245d9..65cfddb515 100644 --- a/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp +++ b/examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp @@ -337,7 +337,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(&comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp index 6aa1930a40..b33732fe3f 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_hypre_pfmg_xbraid.cpp @@ -373,7 +373,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(&comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp index 47681ca211..fafe3bb32e 100644 --- a/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp +++ b/examples/arkode/CXX_xbraid/ark_heat2D_p_xbraid.cpp @@ -330,7 +330,7 @@ int main(int argc, char* argv[]) // Create the SUNDIALS context object for this simulation SUNContext ctx; - flag = SUNContext_Create(&comm_w, &ctx); + flag = SUNContext_Create(comm_w, &ctx); if (check_flag(&flag, "SUNContext_Create", 1)) return 1; // Set output process flag diff --git a/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c b/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c index 4c88924628..21ab8b02c8 100644 --- a/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c +++ b/examples/arkode/C_parallel/ark_brusselator1D_task_local_nls.c @@ -369,7 +369,6 @@ int EvolveProblemIMEX(N_Vector y, UserData udata, UserOptions uopt, long int nfe, nfi; /* RHS stats */ long int nni, ncnf; /* nonlinear solver stats */ long int nli, npre, npsol; /* linear solver stats */ - char fname[MXSTR]; /* Create the ARK timestepper module */ arkode_mem = ARKStepCreate(Advection, Reaction, uopt->t0, y, ctx); @@ -520,7 +519,6 @@ int EvolveProblemExplicit(N_Vector y, UserData udata, UserOptions uopt, int iout; /* output counter */ long int nst, nst_a, netf; /* step stats */ long int nfe; /* RHS stats */ - char fname[MXSTR]; /* Create the ERK timestepper module */ arkode_mem = ERKStepCreate(AdvectionReaction, uopt->t0, y, ctx); diff --git a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c index 9e1377b783..feb2f15a0c 100644 --- a/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c +++ b/examples/arkode/C_parhyp/ark_diurnal_kry_ph.c @@ -213,7 +213,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context object for this simulation */ - flag = SUNContext_Create(&comm, &sunctx); + flag = SUNContext_Create(comm, &sunctx); if (check_flag(&flag, "SUNContext_Create", 1, my_pe)) return 1; /* Set local length */ diff --git a/examples/arkode/C_petsc/ark_petsc_ex25.c b/examples/arkode/C_petsc/ark_petsc_ex25.c index 9c144a9782..96665c1abb 100644 --- a/examples/arkode/C_petsc/ark_petsc_ex25.c +++ b/examples/arkode/C_petsc/ark_petsc_ex25.c @@ -90,7 +90,7 @@ int main(int argc, char **argv) ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr; /* Create SUNDIALS context */ - ierr = SUNContext_Create(&comm, &ctx); + ierr = SUNContext_Create(comm, &ctx); if (ierr) return ierr; /* Solution start and end time */ diff --git a/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 b/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 index 1c5252c846..b53c95505a 100644 --- a/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 +++ b/examples/arkode/F2003_custom/ark_analytic_complex_f2003.f90 @@ -141,7 +141,7 @@ program main !======= Internals ============ ! create the SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(0, sunctx) ! initial problem output print *, " " diff --git a/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 b/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 index 02cfe67386..00bda7d5e0 100644 --- a/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 +++ b/examples/arkode/F2003_custom/ark_brusselator1D_f2003.f90 @@ -300,7 +300,7 @@ program main print '(2(a,es8.1))', " reltol = ",reltol,", abstol = ",abstol ! create the SUNDIALS context for the simulation - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(0, sunctx) if (ierr /= 0) then write(*,*) 'Error in FSUNContext_Create' stop 1 diff --git a/examples/arkode/F2003_custom/test_fnvector_complex_mod.f90 b/examples/arkode/F2003_custom/test_fnvector_complex_mod.f90 index e48c0b7a2d..de0fe968ef 100644 --- a/examples/arkode/F2003_custom/test_fnvector_complex_mod.f90 +++ b/examples/arkode/F2003_custom/test_fnvector_complex_mod.f90 @@ -70,7 +70,7 @@ program main fails = 0 ! create SUNDIALS context - fails = FSUNContext_Create(c_null_ptr, sunctx) + fails = FSUNContext_Create(0, sunctx) ! create new vectors, using New, Make and Clone routines sU => FN_VMake_Complex(N, Udata, sunctx) diff --git a/examples/arkode/F2003_custom/test_fnvector_fortran_mod.f90 b/examples/arkode/F2003_custom/test_fnvector_fortran_mod.f90 index 03a3f79f8f..f575e50790 100644 --- a/examples/arkode/F2003_custom/test_fnvector_fortran_mod.f90 +++ b/examples/arkode/F2003_custom/test_fnvector_fortran_mod.f90 @@ -74,7 +74,7 @@ program main fails = 0 ! create SUNDIALS context - fails = FSUNContext_Create(c_null_ptr, sunctx) + fails = FSUNContext_Create(0, sunctx) ! create new vectors, using New, Make and Clone routines allocate(Udata(Nvar,N)) diff --git a/examples/arkode/F2003_custom/test_fsunlinsol_fortran_mod.f90 b/examples/arkode/F2003_custom/test_fsunlinsol_fortran_mod.f90 index 5a3aa1be2a..ab7aa26f48 100644 --- a/examples/arkode/F2003_custom/test_fsunlinsol_fortran_mod.f90 +++ b/examples/arkode/F2003_custom/test_fsunlinsol_fortran_mod.f90 @@ -97,7 +97,7 @@ program main fails = 0 ! create SUNDIALS context - fails = FSUNContext_Create(c_null_ptr, sunctx) + fails = FSUNContext_Create(0, sunctx) ! create new matrices and vectors sX => FN_VNew_Fortran(Nvar, N, sunctx) diff --git a/examples/arkode/F2003_custom/test_fsunmatrix_fortran_mod.f90 b/examples/arkode/F2003_custom/test_fsunmatrix_fortran_mod.f90 index 800ce30353..7335edfc14 100644 --- a/examples/arkode/F2003_custom/test_fsunmatrix_fortran_mod.f90 +++ b/examples/arkode/F2003_custom/test_fsunmatrix_fortran_mod.f90 @@ -140,7 +140,7 @@ program main fails = 0 ! create SUNDIALS context - fails = FSUNContext_Create(c_null_ptr, sunctx) + fails = FSUNContext_Create(0, sunctx) ! create new matrices and vectors sW => FN_VNew_Fortran(Nvar, N, sunctx) diff --git a/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 b/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 index be83b13d96..2b8bc60edd 100644 --- a/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 +++ b/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 @@ -998,7 +998,7 @@ function TaskLocalNewton(arkode_mem, sunvec_y) result(sunnls) use fsunlinsol_dense_mod use fsunmatrix_dense_mod - use ode_mod, only : sunctx, Nvar, comm, monitor + use ode_mod, only : sunctx, Nvar, comm !======= Declarations ========= implicit none @@ -1011,7 +1011,6 @@ function TaskLocalNewton(arkode_mem, sunvec_y) result(sunnls) type(SUNNonlinearSolver_Ops), pointer :: nlsops ! solver operations integer :: ierr ! MPI error status - integer(c_int) :: retval ! SUNDIALS error status !======= Internals ============ @@ -1084,7 +1083,6 @@ program main integer :: ierr ! MPI error status integer(c_int) :: retval ! SUNDIALS error status double precision :: starttime, endtime ! timing variables - integer, pointer :: commptr type(N_Vector), pointer :: sunvec_ys ! sundials serial vector type(N_Vector), pointer :: sunvec_y ! sundials MPI+X vector @@ -1103,7 +1101,7 @@ program main ! Create SUNDIALS simulation context comm = MPI_COMM_WORLD - retval = FSUNContext_Create(c_loc(commptr), sunctx) + retval = FSUNContext_Create(comm, sunctx) if (retval /= 0) then print *, "Error: FSUNContext_Create returned ",retval call MPI_Abort(comm, 1, ierr) @@ -1251,7 +1249,6 @@ subroutine EvolveProblemIMEX(sunvec_y) integer :: ierr ! MPI error status integer :: iout ! output counter double precision :: tout, dtout ! output time and update - character(len=100) :: outname ! diagnostics ouptput file !======= Internals ============ @@ -1543,7 +1540,6 @@ subroutine EvolveProblemExplicit(sunvec_y) integer :: ierr ! output counter integer :: iout ! output counter double precision :: tout, dtout ! output time and update - character(len=100) :: outname ! diagnostics ouptput file !======= Internals ============ diff --git a/examples/arkode/F2003_serial/ark_analytic_f2003.f90 b/examples/arkode/F2003_serial/ark_analytic_f2003.f90 index 9de6e47616..cd24bdd977 100644 --- a/examples/arkode/F2003_serial/ark_analytic_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_analytic_f2003.f90 @@ -129,7 +129,7 @@ program main !======= Internals ============ ! create the SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(0, ctx) ! initialize ODE tstart = 0.0d0 diff --git a/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 b/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 index d965486cb4..b5da426a8f 100644 --- a/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 +++ b/examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90 @@ -701,7 +701,7 @@ program main end select ! Create the SUNDIALS context object for this simulation - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(0, sunctx) call check_retval(retval, 'FSUNContext_Create') ! Create and initialize serial vector for the solution diff --git a/examples/cvode/C_mpimanyvector/cvDiurnal_kry_mpimanyvec.c b/examples/cvode/C_mpimanyvector/cvDiurnal_kry_mpimanyvec.c index 36cd2c31ce..49674662d2 100644 --- a/examples/cvode/C_mpimanyvector/cvDiurnal_kry_mpimanyvec.c +++ b/examples/cvode/C_mpimanyvector/cvDiurnal_kry_mpimanyvec.c @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) local_N = MXSUB*MYSUB; /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Allocate c[0], c[1], u, and set initial values and tolerances */ diff --git a/examples/cvode/F2003_serial/cv_analytic_fp_f2003.f90 b/examples/cvode/F2003_serial/cv_analytic_fp_f2003.f90 index 02aa41b818..3c05989c6b 100644 --- a/examples/cvode/F2003_serial/cv_analytic_fp_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_analytic_fp_f2003.f90 @@ -124,7 +124,7 @@ program main !======= Internals ============ - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(0, ctx) ! initialize ODE tstart = 0.0d0 diff --git a/examples/cvode/F2003_serial/cv_analytic_sys_dns_f2003.f90 b/examples/cvode/F2003_serial/cv_analytic_sys_dns_f2003.f90 index ec59845edb..01c39302d1 100644 --- a/examples/cvode/F2003_serial/cv_analytic_sys_dns_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_analytic_sys_dns_f2003.f90 @@ -173,7 +173,7 @@ program main yvec(3) = 1.0d0 ! create SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(0, ctx) ! create a serial vector sunvec_y => FN_VMake_Serial(neq, yvec, ctx) diff --git a/examples/cvode/F2003_serial/cv_analytic_sys_dns_jac_f2003.f90 b/examples/cvode/F2003_serial/cv_analytic_sys_dns_jac_f2003.f90 index 2fbeca0590..866916187f 100644 --- a/examples/cvode/F2003_serial/cv_analytic_sys_dns_jac_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_analytic_sys_dns_jac_f2003.f90 @@ -223,7 +223,7 @@ program main yvec(3) = 1.0d0 ! create SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(0, ctx) ! create SUNDIALS N_Vector sunvec_y => FN_VMake_Serial(neq, yvec, ctx) diff --git a/examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90 b/examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90 index bd3b36bf0e..b1e308d670 100644 --- a/examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90 @@ -233,7 +233,7 @@ program main yvec(2) = 1.0d0 yvec(3) = 1.0d0 - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(0, sunctx) if (ierr /= 0) then print *, 'ERROR: FSUNContext_Create returned non-zero' stop 1 diff --git a/examples/cvode/F2003_serial/cv_brusselator_dns_f2003.f90 b/examples/cvode/F2003_serial/cv_brusselator_dns_f2003.f90 index 8ce737b570..f7c03cf087 100644 --- a/examples/cvode/F2003_serial/cv_brusselator_dns_f2003.f90 +++ b/examples/cvode/F2003_serial/cv_brusselator_dns_f2003.f90 @@ -206,7 +206,7 @@ program main yvec(3) = 2.8d0 ! create SUNDIALS context - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(0, ctx) ! create SUNDIALS N_Vector sunvec_y => FN_VMake_Serial(neq, yvec, ctx) diff --git a/examples/cvode/parallel/cvAdvDiff_non_p.c b/examples/cvode/parallel/cvAdvDiff_non_p.c index cbb8768b9e..38eb39718b 100644 --- a/examples/cvode/parallel/cvAdvDiff_non_p.c +++ b/examples/cvode/parallel/cvAdvDiff_non_p.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local vector length. */ diff --git a/examples/cvode/parallel/cvDiurnal_kry_bbd_p.c b/examples/cvode/parallel/cvDiurnal_kry_bbd_p.c index c14316912e..fa5cb3d3d6 100644 --- a/examples/cvode/parallel/cvDiurnal_kry_bbd_p.c +++ b/examples/cvode/parallel/cvDiurnal_kry_bbd_p.c @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); if (npes != NPEX*NPEY) { diff --git a/examples/cvode/parallel/cvDiurnal_kry_p.c b/examples/cvode/parallel/cvDiurnal_kry_p.c index d56bb58111..1ba4e508bc 100644 --- a/examples/cvode/parallel/cvDiurnal_kry_p.c +++ b/examples/cvode/parallel/cvDiurnal_kry_p.c @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); if (npes != NPEX*NPEY) { diff --git a/examples/cvode/parhyp/cvAdvDiff_non_ph.c b/examples/cvode/parhyp/cvAdvDiff_non_ph.c index 3db5ab43aa..692bd8ca43 100644 --- a/examples/cvode/parhyp/cvAdvDiff_non_ph.c +++ b/examples/cvode/parhyp/cvAdvDiff_non_ph.c @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContex_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set partitioning. */ diff --git a/examples/cvode/petsc/cvAdvDiff_petsc.c b/examples/cvode/petsc/cvAdvDiff_petsc.c index 4cee5d6550..d67a472fab 100644 --- a/examples/cvode/petsc/cvAdvDiff_petsc.c +++ b/examples/cvode/petsc/cvAdvDiff_petsc.c @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) if(check_retval(&retval, "PetscInitialize", 1, my_pe)) MPI_Abort(comm, 1); /* Create SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local vector length. */ diff --git a/examples/cvode/petsc/cv_petsc_ex7.c b/examples/cvode/petsc/cv_petsc_ex7.c index 38299ef68a..50b8b013fe 100644 --- a/examples/cvode/petsc/cv_petsc_ex7.c +++ b/examples/cvode/petsc/cv_petsc_ex7.c @@ -82,7 +82,7 @@ int main(int argc,char **argv) Initialize program - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr; - ierr = SUNContext_Create(&comm, &sunctx);if (ierr) return ierr; + ierr = SUNContext_Create(comm, &sunctx);if (ierr) return ierr; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create distributed array (DMDA) to manage parallel grid and vectors diff --git a/examples/cvode/superludist/cvAdvDiff_sludist.cpp b/examples/cvode/superludist/cvAdvDiff_sludist.cpp index f5d5e4f9c6..0877b15196 100644 --- a/examples/cvode/superludist/cvAdvDiff_sludist.cpp +++ b/examples/cvode/superludist/cvAdvDiff_sludist.cpp @@ -143,7 +143,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &my_pe); /* Create the SUNDIALS context */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if(check_retval(&retval, "SUNContext_Create", 1, my_pe)) return(1); /* check for nprow and npcol arguments */ diff --git a/examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90 b/examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90 index 74967c5f8d..1bbcb87328 100644 --- a/examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90 +++ b/examples/cvodes/F2003_serial/cvsAdvDiff_FSA_non_f2003.f90 @@ -214,7 +214,7 @@ program main call ProcessArgs(sensi, sensi_meth, err_con) ! Create SUNDIALS simulation context - retval = FSUNContext_Create(c_null_ptr, ctx) + retval = FSUNContext_Create(0, ctx) if (retval /= 0) then print *, "Error: FSUNContext_Create returned ",retval stop 1 diff --git a/examples/cvodes/F2003_serial/cvs_analytic_fp_f2003.f90 b/examples/cvodes/F2003_serial/cvs_analytic_fp_f2003.f90 index 1cd48cb03a..c8e796cb31 100644 --- a/examples/cvodes/F2003_serial/cvs_analytic_fp_f2003.f90 +++ b/examples/cvodes/F2003_serial/cvs_analytic_fp_f2003.f90 @@ -124,7 +124,7 @@ program main !======= Internals ============ - ierr = FSUNContext_Create(c_null_ptr, ctx) + ierr = FSUNContext_Create(0, ctx) ! initialize ODE tstart = 0.0d0 diff --git a/examples/cvodes/parallel/cvsAdvDiff_ASAp_non_p.c b/examples/cvodes/parallel/cvsAdvDiff_ASAp_non_p.c index 4918ba26d9..fdc79428d0 100644 --- a/examples/cvodes/parallel/cvsAdvDiff_ASAp_non_p.c +++ b/examples/cvodes/parallel/cvsAdvDiff_ASAp_non_p.c @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &my_pe); - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); npes = nprocs - 1; /* pe's dedicated to PDE integration */ diff --git a/examples/cvodes/parallel/cvsAtmDisp_ASAi_kry_bbd_p.c b/examples/cvodes/parallel/cvsAtmDisp_ASAi_kry_bbd_p.c index 28c63f3db1..6314d273c3 100644 --- a/examples/cvodes/parallel/cvsAtmDisp_ASAi_kry_bbd_p.c +++ b/examples/cvodes/parallel/cvsAtmDisp_ASAi_kry_bbd_p.c @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(comm, &myId); /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, myId)) MPI_Abort(comm, 1); /* Check number of processes */ diff --git a/examples/cvodes/parallel/cvsDiurnal_FSA_kry_p.c b/examples/cvodes/parallel/cvsDiurnal_FSA_kry_p.c index 23d8fa282f..535c3db451 100644 --- a/examples/cvodes/parallel/cvsDiurnal_FSA_kry_p.c +++ b/examples/cvodes/parallel/cvsDiurnal_FSA_kry_p.c @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Process arguments */ diff --git a/examples/cvodes/parallel/cvsDiurnal_kry_bbd_p.c b/examples/cvodes/parallel/cvsDiurnal_kry_bbd_p.c index 4b45c8a183..e2b4948476 100644 --- a/examples/cvodes/parallel/cvsDiurnal_kry_bbd_p.c +++ b/examples/cvodes/parallel/cvsDiurnal_kry_bbd_p.c @@ -207,7 +207,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local length */ diff --git a/examples/cvodes/parallel/cvsDiurnal_kry_p.c b/examples/cvodes/parallel/cvsDiurnal_kry_p.c index ebc6a0494a..2d97e7511a 100644 --- a/examples/cvodes/parallel/cvsDiurnal_kry_p.c +++ b/examples/cvodes/parallel/cvsDiurnal_kry_p.c @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Set local length */ diff --git a/examples/cvodes/serial/cvsKrylovDemo_ls.c b/examples/cvodes/serial/cvsKrylovDemo_ls.c index c786682469..dc2b7aa465 100644 --- a/examples/cvodes/serial/cvsKrylovDemo_ls.c +++ b/examples/cvodes/serial/cvsKrylovDemo_ls.c @@ -216,7 +216,7 @@ int main(int argc, char* argv[]) retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; - retval = SUNLogger_Create(NULL, 0, &logger); + retval = SUNLogger_Create(SUN_COMM_NULL, 0, &logger); if (check_retval(&retval, "SUNLogger_Create", 1)) return 1; if (monitor) { diff --git a/examples/ida/F2003_serial/idaHeat2D_kry_f2003.f90 b/examples/ida/F2003_serial/idaHeat2D_kry_f2003.f90 index b3c3d8a764..7670a7dc6a 100644 --- a/examples/ida/F2003_serial/idaHeat2D_kry_f2003.f90 +++ b/examples/ida/F2003_serial/idaHeat2D_kry_f2003.f90 @@ -243,7 +243,7 @@ program main real(c_double), dimension(mgrid,mgrid) :: uu, up, res, constraints !======= Internals ============ - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(0, sunctx) ! Assign parameters in dae_mod dx = 1.d0/(mgrid-1) diff --git a/examples/ida/F2003_serial/idaRoberts_dns_f2003.f90 b/examples/ida/F2003_serial/idaRoberts_dns_f2003.f90 index 73392e6bc4..a543c28f2f 100644 --- a/examples/ida/F2003_serial/idaRoberts_dns_f2003.f90 +++ b/examples/ida/F2003_serial/idaRoberts_dns_f2003.f90 @@ -282,7 +282,7 @@ program main !======= Internals ============ - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(0, sunctx) ! initialize solution vectors and tolerances yval(1) = 1.d0 diff --git a/examples/ida/petsc/idaHeat2D_petsc_snes.c b/examples/ida/petsc/idaHeat2D_petsc_snes.c index 518c9bb295..b812cccdb5 100644 --- a/examples/ida/petsc/idaHeat2D_petsc_snes.c +++ b/examples/ida/petsc/idaHeat2D_petsc_snes.c @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) if(check_retval(&ierr, "PetscInitialize", 1, thispe)) MPI_Abort(comm, 1); /* Create SUNDIALS context */ - ierr = SUNContext_Create(&comm, &ctx); + ierr = SUNContext_Create(comm, &ctx); if(check_retval(&ierr, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1); /* Initialize user application context */ diff --git a/examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90 b/examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90 index 51ebe1c768..4f57e91a8c 100644 --- a/examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90 +++ b/examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90 @@ -285,7 +285,7 @@ program main H = 737.0d0 ! Create the SUNDIALS simulation context - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(0, sunctx) call check_retval(retval, "FSUNContext_Create") ! Allocate N-vectors. diff --git a/examples/idas/F2003_serial/idasHeat2D_kry_f2003.f90 b/examples/idas/F2003_serial/idasHeat2D_kry_f2003.f90 index 34cc887e7f..87d1e51b92 100644 --- a/examples/idas/F2003_serial/idasHeat2D_kry_f2003.f90 +++ b/examples/idas/F2003_serial/idasHeat2D_kry_f2003.f90 @@ -244,7 +244,7 @@ program main coeff = 1.d0/(dx * dx) ! Create the SUNDIALS simulation context - retval = FSUNContext_Create(c_null_ptr, sunctx) + retval = FSUNContext_Create(0, sunctx) if (retval /= 0) then print *, 'ERROR: FSUNContext_Create returned nonzero' stop 1 diff --git a/examples/kinsol/F2003_serial/kinLaplace_bnd_f2003.f90 b/examples/kinsol/F2003_serial/kinLaplace_bnd_f2003.f90 index e5fa0cda0c..f39c9b3431 100644 --- a/examples/kinsol/F2003_serial/kinLaplace_bnd_f2003.f90 +++ b/examples/kinsol/F2003_serial/kinLaplace_bnd_f2003.f90 @@ -162,7 +162,7 @@ program main print '(2(a,i2),a,i3)', "Problem size: ", nx, " x ", ny, " = ", neq ! ------------------------- - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(0, sunctx) if (ierr /= 0) then print *, 'ERROR in FSUNContext_Create' stop 1 diff --git a/examples/kinsol/F2003_serial/kinLaplace_picard_kry_f2003.f90 b/examples/kinsol/F2003_serial/kinLaplace_picard_kry_f2003.f90 index 21012626c8..66501d410e 100644 --- a/examples/kinsol/F2003_serial/kinLaplace_picard_kry_f2003.f90 +++ b/examples/kinsol/F2003_serial/kinLaplace_picard_kry_f2003.f90 @@ -242,7 +242,7 @@ program main ! ------------------------- ! Create the SUNDIALS context used for this simulation - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(0, sunctx) ! ------------------------- ! Create vectors for solution and scaling diff --git a/examples/kinsol/F2003_serial/kinRoboKin_dns_f2003.f90 b/examples/kinsol/F2003_serial/kinRoboKin_dns_f2003.f90 index 98c257a45d..155934a06f 100644 --- a/examples/kinsol/F2003_serial/kinRoboKin_dns_f2003.f90 +++ b/examples/kinsol/F2003_serial/kinRoboKin_dns_f2003.f90 @@ -348,7 +348,7 @@ program main ! ------------------------- ! Create the SUNDIALS context used for this simulation - ierr = FSUNContext_Create(c_null_ptr, sunctx) + ierr = FSUNContext_Create(0, sunctx) ! ------------------------- ! Create SUNDIALS vectors for solution, scales, and constraints diff --git a/examples/kinsol/parallel/kinFoodWeb_kry_bbd_p.c b/examples/kinsol/parallel/kinFoodWeb_kry_bbd_p.c index ee3b260159..bec316b156 100644 --- a/examples/kinsol/parallel/kinFoodWeb_kry_bbd_p.c +++ b/examples/kinsol/parallel/kinFoodWeb_kry_bbd_p.c @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS simulation context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Allocate memory, and set problem data, initial values, tolerances */ diff --git a/examples/kinsol/parallel/kinFoodWeb_kry_p.c b/examples/kinsol/parallel/kinFoodWeb_kry_p.c index 8a03c363a5..cfc3e167d5 100644 --- a/examples/kinsol/parallel/kinFoodWeb_kry_p.c +++ b/examples/kinsol/parallel/kinFoodWeb_kry_p.c @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) } /* Create the SUNDIALS context that all SUNDIALS objects require */ - retval = SUNContext_Create(&comm, &sunctx); + retval = SUNContext_Create(comm, &sunctx); if (check_retval(&retval, "SUNContext_Create", 1, my_pe)) MPI_Abort(comm, 1); /* Allocate memory, and set problem data, initial values, tolerances */ diff --git a/examples/nvector/C_openmp/test_fnvector_openmp_mod.f90 b/examples/nvector/C_openmp/test_fnvector_openmp_mod.f90 index 2ff2c52d0e..2f921fe897 100644 --- a/examples/nvector/C_openmp/test_fnvector_openmp_mod.f90 +++ b/examples/nvector/C_openmp/test_fnvector_openmp_mod.f90 @@ -191,7 +191,7 @@ program main !============== Introduction ============= print *, 'OpenMP N_Vector Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = smoke_tests() if (fails /= 0) then diff --git a/examples/nvector/C_openmp/test_nvector_openmp.c b/examples/nvector/C_openmp/test_nvector_openmp.c index ae82bad628..d43f17b181 100644 --- a/examples/nvector/C_openmp/test_nvector_openmp.c +++ b/examples/nvector/C_openmp/test_nvector_openmp.c @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) int print_timing; /* turn timing on/off */ int nthreads; /* number of OpenMP threads */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ diff --git a/examples/nvector/cuda/test_nvector_cuda.cu b/examples/nvector/cuda/test_nvector_cuda.cu index 6f92a864d9..11f8988287 100644 --- a/examples/nvector/cuda/test_nvector_cuda.cu +++ b/examples/nvector/cuda/test_nvector_cuda.cu @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) cudaStream_t stream; /* cuda stream */ int memtype, policy; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ diff --git a/examples/nvector/hip/test_nvector_hip.cpp b/examples/nvector/hip/test_nvector_hip.cpp index e09d1938e7..be4695ef3e 100644 --- a/examples/nvector/hip/test_nvector_hip.cpp +++ b/examples/nvector/hip/test_nvector_hip.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) hipStream_t stream; /* hip stream */ int memtype, policy; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ diff --git a/examples/nvector/kokkos/test_nvector_kokkos.cpp b/examples/nvector/kokkos/test_nvector_kokkos.cpp index 21dd286565..187bac2a56 100644 --- a/examples/nvector/kokkos/test_nvector_kokkos.cpp +++ b/examples/nvector/kokkos/test_nvector_kokkos.cpp @@ -48,7 +48,7 @@ int main(int argc, char* argv[]) sunindextype length; /* vector length */ int print_timing; /* turn timing on/off */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 3) diff --git a/examples/nvector/manyvector/test_fnvector_manyvector_mod.f90 b/examples/nvector/manyvector/test_fnvector_manyvector_mod.f90 index 98e498bd89..010232f90c 100644 --- a/examples/nvector/manyvector/test_fnvector_manyvector_mod.f90 +++ b/examples/nvector/manyvector/test_fnvector_manyvector_mod.f90 @@ -36,7 +36,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: x1data(N1), x2data(N2) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -222,7 +221,7 @@ program main !============== Introduction ============= print *, 'ManyVector N_Vector Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = smoke_tests() if (fails /= 0) then diff --git a/examples/nvector/manyvector/test_nvector_manyvector.c b/examples/nvector/manyvector/test_nvector_manyvector.c index 622d6eaebb..ce43cd668b 100644 --- a/examples/nvector/manyvector/test_nvector_manyvector.c +++ b/examples/nvector/manyvector/test_nvector_manyvector.c @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) N_Vector U, V, W, X, Y, Z; /* test vectors */ int print_timing; /* turn timing on/off */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ diff --git a/examples/nvector/mpicuda/test_nvector_mpicuda.cu b/examples/nvector/mpicuda/test_nvector_mpicuda.cu index 4a0789e37d..067a7dfe93 100644 --- a/examples/nvector/mpicuda/test_nvector_mpicuda.cu +++ b/examples/nvector/mpicuda/test_nvector_mpicuda.cu @@ -53,20 +53,20 @@ int main(int argc, char *argv[]) MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); - Test_Init(&comm); + Test_Init(comm); /* check inputs */ if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) X = (i==UNMANAGED) ? N_VNew_Cuda(local_length, sunctx) : N_VNewManaged_Cuda(local_length, sunctx); if (X == NULL) { if (myid == 0) printf("FAIL: Unable to create a new CUDA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Create the MPI+X vector */ @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) if (plusX == NULL) { N_VDestroy(X); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(plusX); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } plusZ = N_VClone(plusX); @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusX); N_VDestroy(plusY); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new CUDA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* create the MPIPlusX vector */ @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusZ); N_VDestroy(plusU); if (myid == 0) printf("FAIL: Unable to create a new CUDA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* create the MPIPlusX vector */ @@ -226,7 +226,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/mpimanyvector/test_fnvector_mpimanyvector_mod.f90 b/examples/nvector/mpimanyvector/test_fnvector_mpimanyvector_mod.f90 index ed18c0a536..966f7ddca1 100644 --- a/examples/nvector/mpimanyvector/test_fnvector_mpimanyvector_mod.f90 +++ b/examples/nvector/mpimanyvector/test_fnvector_mpimanyvector_mod.f90 @@ -30,7 +30,6 @@ module test_nvector_mpimanyvector integer(c_int), parameter :: nv = 3 ! length of vector arrays integer(c_long), parameter :: N = N1 + N2 ! overall manyvector length integer(c_int), target :: comm = MPI_COMM_WORLD ! default MPI communicator - integer(c_int), pointer :: commptr integer(c_int) :: nprocs ! number of MPI processes contains @@ -40,7 +39,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: x1data(N1), x2data(N2) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -250,12 +248,10 @@ program main stop 1 endif - commptr => comm - !============== Introduction ============= if (myid == 0) print *, 'MPIManyVector N_Vector Fortran 2003 interface test' - call Test_Init(c_loc(commptr)) + call Test_Init(comm) call MPI_Comm_size(comm, nprocs, fails) if (fails /= 0) then diff --git a/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel1.c b/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel1.c index c31d3bed60..739ee0bc33 100644 --- a/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel1.c +++ b/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel1.c @@ -50,32 +50,32 @@ int main(int argc, char *argv[]) if (retval != MPI_SUCCESS) return(1); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); retval = MPI_Comm_size(comm, &nprocs); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_rank(comm, &myid); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); /* check inputs */ if (argc < 4) { if (myid == 0) printf("ERROR: THREE (3) Inputs required: subvector 1 local vector length, subvector 2 local vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } loclen1 = (sunindextype) atol(argv[1]); if (loclen1 < 1) { if (myid == 0) printf("ERROR: local subvector 1 length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } loclen2 = (sunindextype) atol(argv[2]); if (loclen2 < 1) { if (myid == 0) printf("ERROR: local subvector 2 length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[3]); @@ -102,13 +102,13 @@ int main(int argc, char *argv[]) Xsub[0] = N_VNew_Serial(loclen1, sunctx); if (Xsub[0] == NULL) { printf("FAIL: Unable to create a new serial subvector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Xsub[1] = N_VNew_Parallel(comm, loclen2, globlen, sunctx); if (Xsub[1] == NULL) { N_VDestroy(Xsub[0]); printf("FAIL: Unable to create a new parallel subvector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Create a new MPIManyVector */ @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new MPIManyVector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Clone additional vectors for testing */ @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -223,7 +223,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel2.c b/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel2.c index 642686bfa3..c0e6f69a5d 100644 --- a/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel2.c +++ b/examples/nvector/mpimanyvector/test_nvector_mpimanyvector_parallel2.c @@ -52,32 +52,32 @@ int main(int argc, char *argv[]) if (retval != MPI_SUCCESS) return(1); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); retval = MPI_Comm_size(comm, &nprocs); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_rank(comm, &myid); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); /* check inputs */ if (argc < 4) { if (myid == 0) printf("ERROR: THREE (3) Inputs required: subvector 1 local vector length, subvector 2 local vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } loclen1 = (sunindextype) atol(argv[1]); if (loclen1 < 1) { if (myid == 0) printf("ERROR: local subvector 1 length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } loclen2 = (sunindextype) atol(argv[2]); if (loclen2 < 1) { if (myid == 0) printf("ERROR: local subvector 2 length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[3]); @@ -85,11 +85,11 @@ int main(int argc, char *argv[]) /* Split main communicator into even/odd subcommunicators */ retval = MPI_Comm_split(comm, myid%2, 0, &subcomm); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_size(subcomm, &subprocs); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_rank(subcomm, &subid); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); /* global parallel subvector length in subcommunicator */ globlen = subprocs*loclen2; @@ -121,13 +121,13 @@ int main(int argc, char *argv[]) Xsub[0] = N_VNew_Serial(loclen1, sunctx); if (Xsub[0] == NULL) { printf("FAIL: Unable to create a new serial subvector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Xsub[1] = N_VNew_Parallel(subcomm, loclen2, globlen, sunctx); if (Xsub[1] == NULL) { N_VDestroy(Xsub[0]); printf("FAIL: Unable to create a new parallel subvector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Make a ManyVector, where intercommunicator is specified */ @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new ManyVector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Clone additional vectors for testing */ @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -242,7 +242,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -274,7 +274,7 @@ int main(int argc, char *argv[]) N_VDestroy(Xsub[0]); N_VDestroy(Xsub[1]); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/mpiplusx/test_fnvector_mpiplusx_mod.f90 b/examples/nvector/mpiplusx/test_fnvector_mpiplusx_mod.f90 index bf675fa408..4028e4fa2f 100644 --- a/examples/nvector/mpiplusx/test_fnvector_mpiplusx_mod.f90 +++ b/examples/nvector/mpiplusx/test_fnvector_mpiplusx_mod.f90 @@ -26,7 +26,6 @@ module test_nvector_mpiplusx integer(c_long), parameter :: N = 100 ! overall manyvector length integer(c_int), target :: comm = MPI_COMM_WORLD ! default MPI communicator - integer(c_int), pointer :: commptr integer(c_int) :: nprocs ! number of MPI processes contains @@ -165,12 +164,10 @@ program main stop 1 endif - commptr => comm - !============== Introduction ============= if (myid == 0) print *, 'MPIPlusX N_Vector Fortran 2003 interface test' - call Test_Init(c_loc(commptr)) + call Test_Init(comm) call MPI_Comm_size(comm, nprocs, fails) if (fails /= 0) then diff --git a/examples/nvector/mpiplusx/test_nvector_mpiplusx.c b/examples/nvector/mpiplusx/test_nvector_mpiplusx.c index eb9018e3fe..23f4a1104a 100644 --- a/examples/nvector/mpiplusx/test_nvector_mpiplusx.c +++ b/examples/nvector/mpiplusx/test_nvector_mpiplusx.c @@ -48,25 +48,25 @@ int main(int argc, char *argv[]) if (retval != MPI_SUCCESS) return(1); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); retval = MPI_Comm_size(comm, &nprocs); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); retval = MPI_Comm_rank(comm, &myid); - if (retval != MPI_SUCCESS) Test_AbortMPI(&comm, -1); + if (retval != MPI_SUCCESS) Test_AbortMPI(comm, -1); /* check inputs */ if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector local length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) Xlocal = N_VNew_Serial(local_length, sunctx); if (Xlocal == NULL) { printf("FAIL: Unable to create a new serial vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Create a new MPIPlusX */ @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) if (X == NULL) { N_VDestroy(Xlocal); printf("FAIL: Unable to create a new MPIPlusX vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Clone additional vectors for testing */ @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) N_VDestroy(Y); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) N_VDestroy(Z); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -224,7 +224,7 @@ int main(int argc, char *argv[]) N_VDestroy(U); N_VDestroy(Xlocal); printf("FAIL: Unable to create a new vector, Proc %d\n\n", myid); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/mpiraja/test_nvector_mpiraja.cpp b/examples/nvector/mpiraja/test_nvector_mpiraja.cpp index c1021a704f..4eb02cf7ed 100644 --- a/examples/nvector/mpiraja/test_nvector_mpiraja.cpp +++ b/examples/nvector/mpiraja/test_nvector_mpiraja.cpp @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); @@ -62,14 +62,14 @@ int main(int argc, char *argv[]) if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } /* global length */ @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) X = (i == UNMANAGED) ? N_VNew_Raja(local_length, sunctx) : N_VNewManaged_Raja(local_length, sunctx); if (X == NULL) { if (myid == 0) printf("FAIL: Unable to create a new RAJA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Create the MPI+X vector */ @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) if (plusX == NULL) { N_VDestroy(X); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(plusX); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } plusZ = N_VClone(plusX); @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusX); N_VDestroy(plusY); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new RAJA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } plusU = N_VMake_MPIPlusX(comm, U, sunctx); @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -220,7 +220,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusZ); N_VDestroy(plusU); if (myid == 0) printf("FAIL: Unable to create a new RAJA vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* create the MPIPlusX vector */ @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) N_VDestroy(plusY); N_VDestroy(plusZ); if (myid == 0) printf("FAIL: Unable to create a new MPIPlusX vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/openmpdev/test_nvector_openmpdev.c b/examples/nvector/openmpdev/test_nvector_openmpdev.c index 0df9a44f6b..187b86db00 100644 --- a/examples/nvector/openmpdev/test_nvector_openmpdev.c +++ b/examples/nvector/openmpdev/test_nvector_openmpdev.c @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) N_Vector U, V, W, X, Y, Z; /* test vectors */ int print_timing; /* turn timing on/off */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 3){ diff --git a/examples/nvector/parallel/test_fnvector_parallel_mod.f90 b/examples/nvector/parallel/test_fnvector_parallel_mod.f90 index 0d43c70077..57ef683511 100644 --- a/examples/nvector/parallel/test_fnvector_parallel_mod.f90 +++ b/examples/nvector/parallel/test_fnvector_parallel_mod.f90 @@ -28,7 +28,6 @@ module test_nvector_parallel integer(c_int), parameter :: ns = 2 ! number of vector arrays integer(c_int), target :: comm = MPI_COMM_WORLD ! default MPI communicator - integer(c_int), pointer :: commptr integer(c_long) :: global_length ! vector global_length integer(c_int) :: nprocs ! number of MPI processes contains @@ -38,7 +37,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: xdata(local_length) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -215,12 +213,10 @@ program main stop 1 endif - commptr => comm - !============== Introduction ============= if (myid == 0) print *, 'Parallel N_Vector Fortran 2003 interface test' - call Test_Init(c_loc(commptr)) + call Test_Init(comm) call MPI_Comm_size(comm, nprocs, fails) if (fails /= 0) then diff --git a/examples/nvector/parallel/test_nvector_mpi.c b/examples/nvector/parallel/test_nvector_mpi.c index 89a72ab312..9627d8edd6 100644 --- a/examples/nvector/parallel/test_nvector_mpi.c +++ b/examples/nvector/parallel/test_nvector_mpi.c @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); @@ -52,14 +52,14 @@ int main(int argc, char *argv[]) if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -78,14 +78,14 @@ int main(int argc, char *argv[]) W = N_VNewEmpty_Parallel(comm, local_length, global_length, sunctx); if (W == NULL) { if (myid == 0) printf("FAIL: Unable to create a new empty vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } X = N_VNew_Parallel(comm, local_length, global_length, sunctx); if (X == NULL) { N_VDestroy(W); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) N_VDestroy(W); N_VDestroy(X); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); N_VDestroy(Y); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) N_VDestroy(Y); N_VDestroy(Z); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) N_VDestroy(Z); N_VDestroy(U); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/parhyp/test_nvector_parhyp.c b/examples/nvector/parhyp/test_nvector_parhyp.c index 6a5f8a0090..da2b66514d 100644 --- a/examples/nvector/parhyp/test_nvector_parhyp.c +++ b/examples/nvector/parhyp/test_nvector_parhyp.c @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); @@ -56,14 +56,14 @@ int main(int argc, char *argv[]) if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) if (local_length < 1) { printf("Using global partition.\n"); printf("I don't do this stuff. Now exiting...\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } } @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) N_VDestroy(Y); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) N_VDestroy(Z); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) N_VDestroy(U); HYPRE_ParVectorDestroy(Xhyp); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/petsc/test_nvector_petsc.c b/examples/nvector/petsc/test_nvector_petsc.c index 007b8a95d3..6eac644667 100644 --- a/examples/nvector/petsc/test_nvector_petsc.c +++ b/examples/nvector/petsc/test_nvector_petsc.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - Test_Init(&comm); + Test_Init(comm); MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &myid); @@ -57,14 +57,14 @@ int main(int argc, char *argv[]) if (argc < 3) { if (myid == 0) printf("ERROR: TWO (2) Inputs required: vector length, print timing \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } local_length = (sunindextype) atol(argv[1]); if (local_length < 1) { if (myid == 0) printf("ERROR: local vector length must be a positive integer \n"); - Test_AbortMPI(&comm, -1); + Test_AbortMPI(comm, -1); } print_timing = atoi(argv[2]); @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Check vector ID */ @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) N_VDestroy(X); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } Z = N_VClone(X); @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) N_VDestroy(Y); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* Standard vector operation tests */ @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) N_VDestroy(Z); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) N_VDestroy(U); VecDestroy(&xvec); if (myid == 0) printf("FAIL: Unable to create a new vector \n\n"); - Test_AbortMPI(&comm, 1); + Test_AbortMPI(comm, 1); } /* fused operations */ diff --git a/examples/nvector/pthreads/test_fnvector_pthreads_mod.f90 b/examples/nvector/pthreads/test_fnvector_pthreads_mod.f90 index 0d7e62fafa..86536bebdc 100644 --- a/examples/nvector/pthreads/test_fnvector_pthreads_mod.f90 +++ b/examples/nvector/pthreads/test_fnvector_pthreads_mod.f90 @@ -191,7 +191,7 @@ program main !============== Introduction ============= print *, 'Pthreads N_Vector Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = smoke_tests() if (fails /= 0) then diff --git a/examples/nvector/pthreads/test_nvector_pthreads.c b/examples/nvector/pthreads/test_nvector_pthreads.c index e6b34ed3ee..cbbbd6a233 100644 --- a/examples/nvector/pthreads/test_nvector_pthreads.c +++ b/examples/nvector/pthreads/test_nvector_pthreads.c @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) int print_timing; /* turn timing on/off */ int nthreads; /* number of POSIX threads */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4){ diff --git a/examples/nvector/raja/test_nvector_raja.cpp b/examples/nvector/raja/test_nvector_raja.cpp index ac9f4f8970..51dc5e19f8 100644 --- a/examples/nvector/raja/test_nvector_raja.cpp +++ b/examples/nvector/raja/test_nvector_raja.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) int print_timing; /* turn timing on/off */ int memtype; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 3){ diff --git a/examples/nvector/serial/test_fnvector_serial_mod.f90 b/examples/nvector/serial/test_fnvector_serial_mod.f90 index 2a24e0f8cf..70fe61fdd7 100644 --- a/examples/nvector/serial/test_fnvector_serial_mod.f90 +++ b/examples/nvector/serial/test_fnvector_serial_mod.f90 @@ -32,7 +32,6 @@ integer function smoke_tests() result(ret) integer(c_long) :: lenrw(1), leniw(1) ! real and int work space size integer(c_long) :: ival ! integer work value - type(c_ptr) :: cptr ! c_ptr work value real(c_double) :: rval ! real work value real(c_double) :: xdata(N) ! vector data array real(c_double), pointer :: xptr(:) ! pointer to vector data array @@ -181,6 +180,7 @@ end function has_data program main !======== Inclusions ========== use, intrinsic :: iso_c_binding + use fsundials_types_mod use test_nvector_serial !======== Declarations ======== @@ -190,7 +190,7 @@ program main !============== Introduction ============= print *, 'Serial N_Vector Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(SUN_COMM_NULL) fails = smoke_tests() if (fails /= 0) then diff --git a/examples/nvector/serial/test_nvector_serial.c b/examples/nvector/serial/test_nvector_serial.c index 2d81531849..28f4c1ebcd 100644 --- a/examples/nvector/serial/test_nvector_serial.c +++ b/examples/nvector/serial/test_nvector_serial.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) N_Vector U, V, W, X, Y, Z; /* test vectors */ int print_timing; /* turn timing on/off */ - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 3){ diff --git a/examples/nvector/sycl/test_nvector_sycl.cpp b/examples/nvector/sycl/test_nvector_sycl.cpp index b39be1bea2..f6b5b80174 100644 --- a/examples/nvector/sycl/test_nvector_sycl.cpp +++ b/examples/nvector/sycl/test_nvector_sycl.cpp @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) int threadsPerBlock; /* sycl block size */ int memtype, policy; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* check input and set vector length */ if (argc < 4) diff --git a/examples/nvector/test_mpinvector.c b/examples/nvector/test_mpinvector.c index 858b9dadd8..b74b71c218 100644 --- a/examples/nvector/test_mpinvector.c +++ b/examples/nvector/test_mpinvector.c @@ -23,10 +23,10 @@ #include "test_nvector.h" -void Test_AbortMPI(void* comm, int code) +void Test_AbortMPI(SUNComm comm, int code) { Test_Finalize(); - MPI_Abort(*((MPI_Comm*)comm), code); + MPI_Abort(comm, code); } /* ---------------------------------------------------------------------- diff --git a/examples/nvector/test_nvector.c b/examples/nvector/test_nvector.c index a1ab7e6ac2..0ecc441272 100644 --- a/examples/nvector/test_nvector.c +++ b/examples/nvector/test_nvector.c @@ -71,7 +71,7 @@ static int print_time = 0; #define FMT "%s Time: %22.15e\n\n" #define PRINT_TIME(test, time) if (print_time) printf(FMT, test, time) -int Test_Init(void* comm) +int Test_Init(SUNComm comm) { if (sunctx == NULL) { if (SUNContext_Create(comm, &sunctx)) { diff --git a/examples/nvector/test_nvector.h b/examples/nvector/test_nvector.h index 5605b319db..f29af71de5 100644 --- a/examples/nvector/test_nvector.h +++ b/examples/nvector/test_nvector.h @@ -44,10 +44,10 @@ double max_time(N_Vector X, double time); void sync_device(N_Vector X); /* Shared test initialization/finalization */ -int Test_Init(void* comm); +int Test_Init(SUNComm comm); int Test_Finalize(); void Test_Abort(int code); -void Test_AbortMPI(void* comm, int code); +void Test_AbortMPI(SUNComm comm, int code); /* Vector ID test */ int Test_N_VGetVectorID(N_Vector X, N_Vector_ID ID, int myid); diff --git a/examples/nvector/trilinos/test_nvector_trilinos.cpp b/examples/nvector/trilinos/test_nvector_trilinos.cpp index 1aef046d0c..b0e19b2045 100644 --- a/examples/nvector/trilinos/test_nvector_trilinos.cpp +++ b/examples/nvector/trilinos/test_nvector_trilinos.cpp @@ -43,7 +43,7 @@ int main (int argc, char *argv[]) typedef TpetraVectorInterface::vector_type vector_type; typedef vector_type::map_type map_type; - Test_Init(NULL); + Test_Init(SUN_COMM_NULL); /* Start an MPI session */ Tpetra::ScopeGuard tpetraScope(&argc, &argv); diff --git a/examples/sunlinsol/band/test_fsunlinsol_band_mod.f90 b/examples/sunlinsol/band/test_fsunlinsol_band_mod.f90 index 73b88e410b..f17306eb16 100644 --- a/examples/sunlinsol/band/test_fsunlinsol_band_mod.f90 +++ b/examples/sunlinsol/band/test_fsunlinsol_band_mod.f90 @@ -171,7 +171,7 @@ program main !============== Introduction ============= print *, 'Band SUNLinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/dense/test_fsunlinsol_dense_mod.f90 b/examples/sunlinsol/dense/test_fsunlinsol_dense_mod.f90 index 17806c16ec..50f8504d9d 100644 --- a/examples/sunlinsol/dense/test_fsunlinsol_dense_mod.f90 +++ b/examples/sunlinsol/dense/test_fsunlinsol_dense_mod.f90 @@ -170,7 +170,7 @@ program main !============== Introduction ============= print *, 'Dense SUNLinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/klu/test_fsunlinsol_klu_mod.f90 b/examples/sunlinsol/klu/test_fsunlinsol_klu_mod.f90 index c99a986a11..2479381689 100644 --- a/examples/sunlinsol/klu/test_fsunlinsol_klu_mod.f90 +++ b/examples/sunlinsol/klu/test_fsunlinsol_klu_mod.f90 @@ -166,7 +166,7 @@ program main !============== Introduction ============= print *, 'KLU SUNLinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/lapackdense/test_fsunlinsol_lapackdense_mod.f90 b/examples/sunlinsol/lapackdense/test_fsunlinsol_lapackdense_mod.f90 index 797c77ced5..4d768c8aa1 100644 --- a/examples/sunlinsol/lapackdense/test_fsunlinsol_lapackdense_mod.f90 +++ b/examples/sunlinsol/lapackdense/test_fsunlinsol_lapackdense_mod.f90 @@ -170,7 +170,7 @@ program main !============== Introduction ============= print *, 'LAPACK-Dense SUNLinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c b/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c index 76807cc872..2cde940d9c 100644 --- a/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c +++ b/examples/sunlinsol/pcg/parallel/test_sunlinsol_pcg_parallel.c @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } @@ -157,8 +157,8 @@ int main(int argc, char *argv[]) if (ProbData.myid == 0) { printf("\nPCG linear solver test:\n"); printf(" nprocs = %i\n", ProbData.nprocs); - printf(" local/global problem sizes = %ld/%ld\n", (long int) ProbData.Nloc, - (long int) ProbData.nprocs * ProbData.Nloc); + printf(" local/global problem sizes = %ld/%lld\n", (long int) ProbData.Nloc, + (long long int) ProbData.nprocs * ProbData.Nloc); printf(" Maximum Krylov subspace dimension = %i\n", maxl); printf(" Solver Tolerance = %g\n", tol); printf(" timing output flag = %i\n\n", print_timing); diff --git a/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90 b/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90 index bc62fcbc84..3fe8cfcdc0 100644 --- a/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90 +++ b/examples/sunlinsol/pcg/serial/test_fsunlinsol_pcg_mod_serial.f90 @@ -341,7 +341,7 @@ program main print *, 'PCG SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/spbcgs/parallel/test_sunlinsol_spbcgs_parallel.c b/examples/sunlinsol/spbcgs/parallel/test_sunlinsol_spbcgs_parallel.c index 4b67992d36..0b376c00aa 100644 --- a/examples/sunlinsol/spbcgs/parallel/test_sunlinsol_spbcgs_parallel.c +++ b/examples/sunlinsol/spbcgs/parallel/test_sunlinsol_spbcgs_parallel.c @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spbcgs/serial/test_fsunlinsol_spbcgs_mod_serial.f90 b/examples/sunlinsol/spbcgs/serial/test_fsunlinsol_spbcgs_mod_serial.f90 index e1a052d9ce..d1dc8eb205 100644 --- a/examples/sunlinsol/spbcgs/serial/test_fsunlinsol_spbcgs_mod_serial.f90 +++ b/examples/sunlinsol/spbcgs/serial/test_fsunlinsol_spbcgs_mod_serial.f90 @@ -332,7 +332,7 @@ program main print *, 'SPBCGS SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/spfgmr/parallel/test_sunlinsol_spfgmr_parallel.c b/examples/sunlinsol/spfgmr/parallel/test_sunlinsol_spfgmr_parallel.c index 0fd34e785a..5e3bc6e6b9 100644 --- a/examples/sunlinsol/spfgmr/parallel/test_sunlinsol_spfgmr_parallel.c +++ b/examples/sunlinsol/spfgmr/parallel/test_sunlinsol_spfgmr_parallel.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spfgmr/serial/test_fsunlinsol_spfgmr_mod_serial.f90 b/examples/sunlinsol/spfgmr/serial/test_fsunlinsol_spfgmr_mod_serial.f90 index 27e19cff89..009576ac45 100644 --- a/examples/sunlinsol/spfgmr/serial/test_fsunlinsol_spfgmr_mod_serial.f90 +++ b/examples/sunlinsol/spfgmr/serial/test_fsunlinsol_spfgmr_mod_serial.f90 @@ -334,7 +334,7 @@ program main print *, 'SPFGMR SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/spgmr/parallel/test_sunlinsol_spgmr_parallel.c b/examples/sunlinsol/spgmr/parallel/test_sunlinsol_spgmr_parallel.c index 42bcd041e5..27b6ece71d 100644 --- a/examples/sunlinsol/spgmr/parallel/test_sunlinsol_spgmr_parallel.c +++ b/examples/sunlinsol/spgmr/parallel/test_sunlinsol_spgmr_parallel.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/spgmr/serial/test_fsunlinsol_spgmr_mod_serial.f90 b/examples/sunlinsol/spgmr/serial/test_fsunlinsol_spgmr_mod_serial.f90 index febe3c6034..5e8f902f25 100644 --- a/examples/sunlinsol/spgmr/serial/test_fsunlinsol_spgmr_mod_serial.f90 +++ b/examples/sunlinsol/spgmr/serial/test_fsunlinsol_spgmr_mod_serial.f90 @@ -334,7 +334,7 @@ program main print *, 'SPGMR SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/sptfqmr/parallel/test_sunlinsol_sptfqmr_parallel.c b/examples/sunlinsol/sptfqmr/parallel/test_sunlinsol_sptfqmr_parallel.c index e74332086b..f9c3f13a89 100644 --- a/examples/sunlinsol/sptfqmr/parallel/test_sunlinsol_sptfqmr_parallel.c +++ b/examples/sunlinsol/sptfqmr/parallel/test_sunlinsol_sptfqmr_parallel.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) fails = MPI_Comm_rank(ProbData.comm, &(ProbData.myid)); if (check_flag(&fails, "MPI_Comm_rank", 1)) return 1; - if (SUNContext_Create(&ProbData.comm, &sunctx)) { + if (SUNContext_Create(ProbData.comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunlinsol/sptfqmr/serial/test_fsunlinsol_sptfqmr_mod_serial.f90 b/examples/sunlinsol/sptfqmr/serial/test_fsunlinsol_sptfqmr_mod_serial.f90 index 8d15238e67..43b87dca30 100644 --- a/examples/sunlinsol/sptfqmr/serial/test_fsunlinsol_sptfqmr_mod_serial.f90 +++ b/examples/sunlinsol/sptfqmr/serial/test_fsunlinsol_sptfqmr_mod_serial.f90 @@ -332,7 +332,7 @@ program main print *, 'SPTFQMR SUNLinearSolver Fortran 2003 interface test' print *, '' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunlinsol/superludist/test_sunlinsol_superludist.cpp b/examples/sunlinsol/superludist/test_sunlinsol_superludist.cpp index b43c2d5f42..7e24e0f3db 100644 --- a/examples/sunlinsol/superludist/test_sunlinsol_superludist.cpp +++ b/examples/sunlinsol/superludist/test_sunlinsol_superludist.cpp @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); comm = MPI_COMM_WORLD; - if (SUNContext_Create(&comm, &sunctx)) { + if (SUNContext_Create(comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/band/test_fsunmatrix_band_mod.f90 b/examples/sunmatrix/band/test_fsunmatrix_band_mod.f90 index 7a4ba62d68..86b54b07f5 100644 --- a/examples/sunmatrix/band/test_fsunmatrix_band_mod.f90 +++ b/examples/sunmatrix/band/test_fsunmatrix_band_mod.f90 @@ -182,7 +182,7 @@ program main !============== Introduction ============= print *, 'Band SUNMatrix Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90 b/examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90 index 87d9e0e46b..aa7b1747b6 100644 --- a/examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90 +++ b/examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90 @@ -167,7 +167,7 @@ program main !============== Introduction ============= print *, 'Dense SUNMatrix Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunmatrix/slunrloc/test_sunmatrix_slunrloc.cpp b/examples/sunmatrix/slunrloc/test_sunmatrix_slunrloc.cpp index 2de558b9b4..8a7313abb5 100644 --- a/examples/sunmatrix/slunrloc/test_sunmatrix_slunrloc.cpp +++ b/examples/sunmatrix/slunrloc/test_sunmatrix_slunrloc.cpp @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) MPI_Comm_size(comm, &nprocs); MPI_Comm_rank(comm, &rank); - if (SUNContext_Create(&comm, &sunctx)) { + if (SUNContext_Create(comm, &sunctx)) { printf("ERROR: SUNContext_Create failed\n"); return(-1); } diff --git a/examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90 b/examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90 index 51c5197ba7..1894a45b4c 100644 --- a/examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90 +++ b/examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90 @@ -183,7 +183,7 @@ program main !============== Introduction ============= print *, 'Sparse SUNMatrix Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunnonlinsol/fixedpoint/test_fsunnonlinsol_fixedpoint_mod.f90 b/examples/sunnonlinsol/fixedpoint/test_fsunnonlinsol_fixedpoint_mod.f90 index b9325be1a1..b366092cba 100644 --- a/examples/sunnonlinsol/fixedpoint/test_fsunnonlinsol_fixedpoint_mod.f90 +++ b/examples/sunnonlinsol/fixedpoint/test_fsunnonlinsol_fixedpoint_mod.f90 @@ -203,7 +203,7 @@ program main !============== Introduction ============= print *, 'fixedpoint SUNNonlinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) fails = unit_tests() if (fails /= 0) then diff --git a/examples/sunnonlinsol/newton/test_fsunnonlinsol_newton_mod.f90 b/examples/sunnonlinsol/newton/test_fsunnonlinsol_newton_mod.f90 index bc9111c163..b637d0bf11 100644 --- a/examples/sunnonlinsol/newton/test_fsunnonlinsol_newton_mod.f90 +++ b/examples/sunnonlinsol/newton/test_fsunnonlinsol_newton_mod.f90 @@ -334,7 +334,7 @@ program main !============== Introduction ============= print *, 'Newton SUNNonlinearSolver Fortran 2003 interface test' - call Test_Init(c_null_ptr) + call Test_Init(0) retval = unit_tests() if (retval /= 0) then diff --git a/examples/utilities/test_utilities.f90 b/examples/utilities/test_utilities.f90 index 7ff5c32fe2..fbe1300225 100644 --- a/examples/utilities/test_utilities.f90 +++ b/examples/utilities/test_utilities.f90 @@ -40,8 +40,8 @@ module test_utilities subroutine Test_Init(comm) implicit none - type(C_PTR), value :: comm - integer(C_INT) :: retval + integer(C_INT), value :: comm + integer(C_INT) :: retval retval = FSUNContext_Create(comm, sunctx) if (retval /= 0) then diff --git a/src/arkode/fmod/farkode_arkstep_mod.f90 b/src/arkode/fmod/farkode_arkstep_mod.f90 index 595bda2acf..4dfed8c935 100644 --- a/src/arkode/fmod/farkode_arkstep_mod.f90 +++ b/src/arkode/fmod/farkode_arkstep_mod.f90 @@ -20,6 +20,7 @@ module farkode_arkstep_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use farkode_mod use fsundials_nvector_mod use fsundials_context_mod @@ -34,7 +35,6 @@ module farkode_arkstep_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/arkode/fmod/farkode_erkstep_mod.f90 b/src/arkode/fmod/farkode_erkstep_mod.f90 index e91065ec09..2174068b50 100644 --- a/src/arkode/fmod/farkode_erkstep_mod.f90 +++ b/src/arkode/fmod/farkode_erkstep_mod.f90 @@ -20,6 +20,7 @@ module farkode_erkstep_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use farkode_mod use fsundials_nvector_mod use fsundials_context_mod @@ -34,7 +35,6 @@ module farkode_erkstep_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/arkode/fmod/farkode_mod.f90 b/src/arkode/fmod/farkode_mod.f90 index 511b082d84..5fed1a26f6 100644 --- a/src/arkode/fmod/farkode_mod.f90 +++ b/src/arkode/fmod/farkode_mod.f90 @@ -20,6 +20,7 @@ module farkode_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod @@ -33,7 +34,6 @@ module farkode_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/arkode/fmod/farkode_mristep_mod.f90 b/src/arkode/fmod/farkode_mristep_mod.f90 index d740e4e8a1..c03b5650f4 100644 --- a/src/arkode/fmod/farkode_mristep_mod.f90 +++ b/src/arkode/fmod/farkode_mristep_mod.f90 @@ -20,6 +20,7 @@ module farkode_mristep_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use farkode_mod use fsundials_nvector_mod use fsundials_context_mod @@ -34,7 +35,6 @@ module farkode_mristep_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/arkode/fmod/farkode_sprkstep_mod.f90 b/src/arkode/fmod/farkode_sprkstep_mod.f90 index ad9795aba2..000d208cfb 100644 --- a/src/arkode/fmod/farkode_sprkstep_mod.f90 +++ b/src/arkode/fmod/farkode_sprkstep_mod.f90 @@ -20,6 +20,7 @@ module farkode_sprkstep_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use farkode_mod use fsundials_nvector_mod use fsundials_context_mod @@ -34,7 +35,6 @@ module farkode_sprkstep_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/cvode/fmod/fcvode_mod.f90 b/src/cvode/fmod/fcvode_mod.f90 index 6cad0fc9f2..b3678dd74c 100644 --- a/src/cvode/fmod/fcvode_mod.f90 +++ b/src/cvode/fmod/fcvode_mod.f90 @@ -20,6 +20,7 @@ module fcvode_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod @@ -33,7 +34,6 @@ module fcvode_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/cvodes/fmod/fcvodes_mod.f90 b/src/cvodes/fmod/fcvodes_mod.f90 index d34ac805dd..14c7adc844 100644 --- a/src/cvodes/fmod/fcvodes_mod.f90 +++ b/src/cvodes/fmod/fcvodes_mod.f90 @@ -20,6 +20,7 @@ module fcvodes_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod @@ -33,7 +34,6 @@ module fcvodes_mod use fsundials_context_mod use fsundials_types_mod use fsundials_nonlinearsolver_mod - use fsundials_types_mod implicit none private diff --git a/src/nvector/manyvector/fmod/fnvector_manyvector_mod.f90 b/src/nvector/manyvector/fmod/fnvector_manyvector_mod.f90 index 61f1c49a7d..2fce7fef05 100644 --- a/src/nvector/manyvector/fmod/fnvector_manyvector_mod.f90 +++ b/src/nvector/manyvector/fmod/fnvector_manyvector_mod.f90 @@ -20,6 +20,7 @@ module fnvector_manyvector_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c index 18fe993650..040253fa57 100644 --- a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c +++ b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.c @@ -216,8 +216,12 @@ SWIGEXPORT N_Vector _wrap_FN_VMake_MPIManyVector(int const *farg1, int64_t const SUNContext arg4 = (SUNContext) 0 ; N_Vector result; -#ifdef SUNDIALS_MPI_ENABLED - arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); +#if SUNDIALS_MPI_ENABLED + if((*farg1)) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = 0; + } #else arg1 = *farg1; #endif @@ -369,8 +373,10 @@ SWIGEXPORT int _wrap_FN_VGetCommunicator_MPIManyVector(N_Vector farg1) { arg1 = (N_Vector)(farg1); result = N_VGetCommunicator_MPIManyVector(arg1); -#ifdef SUNDIALS_MPI_ENABLED - fresult = (int)(MPI_Comm_c2f(result)); +#if SUNDIALS_MPI_ENABLED + if (result != 0) { + fresult = (int)(MPI_Comm_c2f(result)); + } #else fresult = result; #endif diff --git a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 index 800c441604..09211fe5c9 100644 --- a/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 +++ b/src/nvector/manyvector/fmod/fnvector_mpimanyvector_mod.f90 @@ -20,6 +20,7 @@ module fnvector_mpimanyvector_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/nvector/mpiplusx/fmod/fnvector_mpiplusx_mod.c b/src/nvector/mpiplusx/fmod/fnvector_mpiplusx_mod.c index 800c1c9819..18aebcf2a6 100644 --- a/src/nvector/mpiplusx/fmod/fnvector_mpiplusx_mod.c +++ b/src/nvector/mpiplusx/fmod/fnvector_mpiplusx_mod.c @@ -215,8 +215,12 @@ SWIGEXPORT N_Vector _wrap_FN_VMake_MPIPlusX(int const *farg1, N_Vector farg2, vo SUNContext arg3 = (SUNContext) 0 ; N_Vector result; -#ifdef SUNDIALS_MPI_ENABLED - arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); +#if SUNDIALS_MPI_ENABLED + if((*farg1)) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = 0; + } #else arg1 = *farg1; #endif diff --git a/src/nvector/mpiplusx/fmod/fnvector_mpiplusx_mod.f90 b/src/nvector/mpiplusx/fmod/fnvector_mpiplusx_mod.f90 index c9d72182fc..bb3b1e681a 100644 --- a/src/nvector/mpiplusx/fmod/fnvector_mpiplusx_mod.f90 +++ b/src/nvector/mpiplusx/fmod/fnvector_mpiplusx_mod.f90 @@ -20,6 +20,7 @@ module fnvector_mpiplusx_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/nvector/openmp/fmod/fnvector_openmp_mod.f90 b/src/nvector/openmp/fmod/fnvector_openmp_mod.f90 index ab547e6c94..c950dc440d 100644 --- a/src/nvector/openmp/fmod/fnvector_openmp_mod.f90 +++ b/src/nvector/openmp/fmod/fnvector_openmp_mod.f90 @@ -20,6 +20,7 @@ module fnvector_openmp_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/nvector/parallel/fmod/fnvector_parallel_mod.c b/src/nvector/parallel/fmod/fnvector_parallel_mod.c index c03b540a44..adeb1be575 100644 --- a/src/nvector/parallel/fmod/fnvector_parallel_mod.c +++ b/src/nvector/parallel/fmod/fnvector_parallel_mod.c @@ -216,7 +216,7 @@ SWIGEXPORT N_Vector _wrap_FN_VNew_Parallel(int const *farg1, int64_t const *farg SUNContext arg4 = (SUNContext) 0 ; N_Vector result; -#ifdef SUNDIALS_MPI_ENABLED +#if SUNDIALS_MPI_ENABLED arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); #else arg1 = *farg1; @@ -238,7 +238,7 @@ SWIGEXPORT N_Vector _wrap_FN_VNewEmpty_Parallel(int const *farg1, int64_t const SUNContext arg4 = (SUNContext) 0 ; N_Vector result; -#ifdef SUNDIALS_MPI_ENABLED +#if SUNDIALS_MPI_ENABLED arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); #else arg1 = *farg1; @@ -261,7 +261,7 @@ SWIGEXPORT N_Vector _wrap_FN_VMake_Parallel(int const *farg1, int64_t const *far SUNContext arg5 = (SUNContext) 0 ; N_Vector result; -#ifdef SUNDIALS_MPI_ENABLED +#if SUNDIALS_MPI_ENABLED arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); #else arg1 = *farg1; @@ -391,7 +391,7 @@ SWIGEXPORT int _wrap_FN_VGetCommunicator_Parallel(N_Vector farg1) { arg1 = (N_Vector)(farg1); result = N_VGetCommunicator_Parallel(arg1); -#ifdef SUNDIALS_MPI_ENABLED +#if SUNDIALS_MPI_ENABLED fresult = (int)(MPI_Comm_c2f(result)); #else fresult = result; diff --git a/src/nvector/parallel/fmod/fnvector_parallel_mod.f90 b/src/nvector/parallel/fmod/fnvector_parallel_mod.f90 index 28a55bf32d..d02527af8a 100644 --- a/src/nvector/parallel/fmod/fnvector_parallel_mod.f90 +++ b/src/nvector/parallel/fmod/fnvector_parallel_mod.f90 @@ -20,6 +20,7 @@ module fnvector_parallel_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/nvector/pthreads/fmod/fnvector_pthreads_mod.f90 b/src/nvector/pthreads/fmod/fnvector_pthreads_mod.f90 index 40fac42471..a21f196028 100644 --- a/src/nvector/pthreads/fmod/fnvector_pthreads_mod.f90 +++ b/src/nvector/pthreads/fmod/fnvector_pthreads_mod.f90 @@ -20,6 +20,7 @@ module fnvector_pthreads_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/nvector/serial/fmod/fnvector_serial_mod.f90 b/src/nvector/serial/fmod/fnvector_serial_mod.f90 index 8bf8ca4fd9..e011f2ce47 100644 --- a/src/nvector/serial/fmod/fnvector_serial_mod.f90 +++ b/src/nvector/serial/fmod/fnvector_serial_mod.f90 @@ -20,6 +20,7 @@ module fnvector_serial_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sundials/fmod/fsundials_context_mod.c b/src/sundials/fmod/fsundials_context_mod.c index 3da738eeb8..9725c949ee 100644 --- a/src/sundials/fmod/fsundials_context_mod.c +++ b/src/sundials/fmod/fsundials_context_mod.c @@ -205,6 +205,28 @@ #include "sundials/sundials_context.h" +SWIGEXPORT int _wrap_FSUNContext_Create(int const *farg1, void *farg2) { + int fresult ; + SUNComm arg1 ; + SUNContext *arg2 = (SUNContext *) 0 ; + int result; + +#if SUNDIALS_MPI_ENABLED + if((*farg1)) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = SUN_COMM_NULL; + } +#else + arg1 = *farg1; +#endif + arg2 = (SUNContext *)(farg2); + result = (int)SUNContext_Create(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNContext_GetProfiler(void *farg1, void *farg2) { int fresult ; SUNContext arg1 = (SUNContext) 0 ; @@ -261,38 +283,16 @@ SWIGEXPORT int _wrap_FSUNContext_SetLogger(void *farg1, void *farg2) { } - SWIGEXPORT int _wrap_FSUNContext_Free(void *farg1) { int fresult ; SUNContext *arg1 = (SUNContext *) 0 ; int result; -#ifdef SUNDIALS_BUILD_WITH_PROFILING - SUNProfiler profiler; -#endif - + arg1 = (SUNContext *)(farg1); -#ifdef SUNDIALS_BUILD_WITH_PROFILING - result = (int)SUNContext_GetProfiler(*arg1,&profiler); - result = (int)SUNContext_Free(arg1); - result = (int)SUNProfiler_Free(&profiler); -#else result = (int)SUNContext_Free(arg1); -#endif fresult = (int)(result); return fresult; } -SWIGEXPORT int _wrap_FSUNContext_Create(void *farg1, void *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - SUNContext *arg2 = (SUNContext *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (SUNContext *)(farg2); - result = (int)SUNContext_Create(arg1,arg2); - fresult = (int)(result); - return fresult; -} diff --git a/src/sundials/fmod/fsundials_context_mod.f90 b/src/sundials/fmod/fsundials_context_mod.f90 index cc493ca5bd..3417e9892e 100644 --- a/src/sundials/fmod/fsundials_context_mod.f90 +++ b/src/sundials/fmod/fsundials_context_mod.f90 @@ -18,26 +18,31 @@ ! SUNDIALS Copyright End ! --------------------------------------------------------------- - -#include "sundials/sundials_config.h" - module fsundials_context_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod implicit none private ! DECLARATION CONSTRUCTS + public :: FSUNContext_Create public :: FSUNContext_GetProfiler public :: FSUNContext_SetProfiler public :: FSUNContext_GetLogger public :: FSUNContext_SetLogger - -public :: FSUNContext_Free -public :: FSUNContext_Create - + public :: FSUNContext_Free ! WRAPPER DECLARATIONS interface +function swigc_FSUNContext_Create(farg1, farg2) & +bind(C, name="_wrap_FSUNContext_Create") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +integer(C_INT), intent(in) :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + function swigc_FSUNContext_GetProfiler(farg1, farg2) & bind(C, name="_wrap_FSUNContext_GetProfiler") & result(fresult) @@ -74,7 +79,6 @@ function swigc_FSUNContext_SetLogger(farg1, farg2) & integer(C_INT) :: fresult end function - function swigc_FSUNContext_Free(farg1) & bind(C, name="_wrap_FSUNContext_Free") & result(fresult) @@ -83,21 +87,27 @@ function swigc_FSUNContext_Free(farg1) & integer(C_INT) :: fresult end function -function swigc_FSUNContext_Create(farg1, farg2) & -bind(C, name="_wrap_FSUNContext_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -integer(C_INT) :: fresult -end function - - end interface contains ! MODULE SUBPROGRAMS +function FSUNContext_Create(comm, ctx) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +integer :: comm +type(C_PTR), target, intent(inout) :: ctx +integer(C_INT) :: fresult +integer(C_INT) :: farg1 +type(C_PTR) :: farg2 + +farg1 = int(comm, C_INT) +farg2 = c_loc(ctx) +fresult = swigc_FSUNContext_Create(farg1, farg2) +swig_result = fresult +end function + function FSUNContext_GetProfiler(sunctx, profiler) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -162,45 +172,18 @@ function FSUNContext_SetLogger(sunctx, logger) & swig_result = fresult end function - function FSUNContext_Free(ctx) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result type(C_PTR), target, intent(inout) :: ctx -integer(C_INT) :: fresult -type(C_PTR) :: farg1 +integer(C_INT) :: fresult +type(C_PTR) :: farg1 farg1 = c_loc(ctx) fresult = swigc_FSUNContext_Free(farg1) swig_result = fresult end function -function FSUNContext_Create(comm, ctx) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -#ifdef SUNDIALS_BUILD_WITH_PROFILING -use fsundials_profiler_mod, only : FSUNProfiler_Create -#endif -integer(C_INT) :: swig_result -type(C_PTR) :: comm -type(C_PTR), target, intent(inout) :: ctx -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_PTR) :: farg2 -#ifdef SUNDIALS_BUILD_WITH_PROFILING -type(C_PTR) :: profiler -#endif - -farg1 = comm -farg2 = c_loc(ctx) -fresult = swigc_FSUNContext_Create(c_null_ptr, farg2) -#ifdef SUNDIALS_BUILD_WITH_PROFILING -fresult = FSUNProfiler_Create(farg1, "FSUNContext Default", profiler) -fresult = swigc_FSUNContext_SetProfiler(ctx, profiler) -#endif -swig_result = fresult -end function - end module diff --git a/src/sundials/fmod/fsundials_futils_mod.f90 b/src/sundials/fmod/fsundials_futils_mod.f90 index 13f5c8720e..32846cea30 100644 --- a/src/sundials/fmod/fsundials_futils_mod.f90 +++ b/src/sundials/fmod/fsundials_futils_mod.f90 @@ -20,6 +20,7 @@ module fsundials_futils_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod implicit none private diff --git a/src/sundials/fmod/fsundials_linearsolver_mod.f90 b/src/sundials/fmod/fsundials_linearsolver_mod.f90 index 2c4272768e..76a70e6330 100644 --- a/src/sundials/fmod/fsundials_linearsolver_mod.f90 +++ b/src/sundials/fmod/fsundials_linearsolver_mod.f90 @@ -5,8 +5,8 @@ ! the SWIG interface file instead. module fsundials_linearsolver_mod use, intrinsic :: ISO_C_BINDING - use fsundials_types_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sundials/fmod/fsundials_logger_mod.c b/src/sundials/fmod/fsundials_logger_mod.c index 957c470b20..a1e9d3fbcd 100644 --- a/src/sundials/fmod/fsundials_logger_mod.c +++ b/src/sundials/fmod/fsundials_logger_mod.c @@ -240,7 +240,15 @@ SWIGEXPORT int _wrap_FSUNLogger_Create(int const *farg1, int const *farg2, void SUNLogger *arg3 = (SUNLogger *) 0 ; int result; - arg1 = (SUNComm)(*farg1); +#if SUNDIALS_MPI_ENABLED + if((*farg1)) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = SUN_COMM_NULL; + } +#else + arg1 = *farg1; +#endif arg2 = (int)(*farg2); arg3 = (SUNLogger *)(farg3); result = (int)SUNLogger_Create(arg1,arg2,arg3); @@ -255,7 +263,15 @@ SWIGEXPORT int _wrap_FSUNLogger_CreateFromEnv(int const *farg1, void *farg2) { SUNLogger *arg2 = (SUNLogger *) 0 ; int result; - arg1 = (SUNComm)(*farg1); +#if SUNDIALS_MPI_ENABLED + if((*farg1)) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = SUN_COMM_NULL; + } +#else + arg1 = *farg1; +#endif arg2 = (SUNLogger *)(farg2); result = (int)SUNLogger_CreateFromEnv(arg1,arg2); fresult = (int)(result); diff --git a/src/sundials/fmod/fsundials_logger_mod.f90 b/src/sundials/fmod/fsundials_logger_mod.f90 index e38590a17b..d49cc1674c 100644 --- a/src/sundials/fmod/fsundials_logger_mod.f90 +++ b/src/sundials/fmod/fsundials_logger_mod.f90 @@ -20,6 +20,7 @@ module fsundials_logger_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod implicit none private @@ -160,7 +161,7 @@ function FSUNLogger_Create(comm, output_rank, logger) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result -integer(C_INT), intent(in) :: comm +integer :: comm integer(C_INT), intent(in) :: output_rank type(C_PTR), target, intent(inout) :: logger integer(C_INT) :: fresult @@ -168,7 +169,7 @@ function FSUNLogger_Create(comm, output_rank, logger) & integer(C_INT) :: farg2 type(C_PTR) :: farg3 -farg1 = comm +farg1 = int(comm, C_INT) farg2 = output_rank farg3 = c_loc(logger) fresult = swigc_FSUNLogger_Create(farg1, farg2, farg3) @@ -179,13 +180,13 @@ function FSUNLogger_CreateFromEnv(comm, logger) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result -integer(C_INT), intent(in) :: comm +integer :: comm type(C_PTR), target, intent(inout) :: logger integer(C_INT) :: fresult integer(C_INT) :: farg1 type(C_PTR) :: farg2 -farg1 = comm +farg1 = int(comm, C_INT) farg2 = c_loc(logger) fresult = swigc_FSUNLogger_CreateFromEnv(farg1, farg2) swig_result = fresult diff --git a/src/sundials/fmod/fsundials_matrix_mod.f90 b/src/sundials/fmod/fsundials_matrix_mod.f90 index 815cbfab7a..a995110793 100644 --- a/src/sundials/fmod/fsundials_matrix_mod.f90 +++ b/src/sundials/fmod/fsundials_matrix_mod.f90 @@ -5,8 +5,8 @@ ! the SWIG interface file instead. module fsundials_matrix_mod use, intrinsic :: ISO_C_BINDING - use fsundials_types_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sundials/fmod/fsundials_nonlinearsolver_mod.f90 b/src/sundials/fmod/fsundials_nonlinearsolver_mod.f90 index 44b6e60255..ec27ef8a79 100644 --- a/src/sundials/fmod/fsundials_nonlinearsolver_mod.f90 +++ b/src/sundials/fmod/fsundials_nonlinearsolver_mod.f90 @@ -5,8 +5,8 @@ ! the SWIG interface file instead. module fsundials_nonlinearsolver_mod use, intrinsic :: ISO_C_BINDING - use fsundials_types_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sundials/fmod/fsundials_nvector_mod.c b/src/sundials/fmod/fsundials_nvector_mod.c index 611557ebe3..4d44517f9f 100644 --- a/src/sundials/fmod/fsundials_nvector_mod.c +++ b/src/sundials/fmod/fsundials_nvector_mod.c @@ -297,7 +297,13 @@ SWIGEXPORT int _wrap_FN_VGetCommunicator(N_Vector farg1) { arg1 = (N_Vector)(farg1); result = (SUNComm)N_VGetCommunicator(arg1); - fresult = (SUNComm)(result); +#if SUNDIALS_MPI_ENABLED + if (result != SUN_COMM_NULL) { + fresult = (int)(MPI_Comm_c2f(result)); + } +#else + fresult = result; +#endif return fresult; } diff --git a/src/sundials/fmod/fsundials_nvector_mod.f90 b/src/sundials/fmod/fsundials_nvector_mod.f90 index 87e88203f0..3085309345 100644 --- a/src/sundials/fmod/fsundials_nvector_mod.f90 +++ b/src/sundials/fmod/fsundials_nvector_mod.f90 @@ -841,14 +841,14 @@ subroutine FN_VSetArrayPointer(v_data, v) function FN_VGetCommunicator(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(farg1) -swig_result = fresult +swig_result = int(fresult) end function function FN_VGetLength(v) & diff --git a/src/sundials/fmod/fsundials_profiler_mod.c b/src/sundials/fmod/fsundials_profiler_mod.c index 75599fa693..7317864150 100644 --- a/src/sundials/fmod/fsundials_profiler_mod.c +++ b/src/sundials/fmod/fsundials_profiler_mod.c @@ -233,6 +233,30 @@ SWIGINTERN SwigArrayWrapper SwigArrayWrapper_uninitialized() { return result; } +SWIGEXPORT int _wrap_FSUNProfiler_Create(int const *farg1, SwigArrayWrapper *farg2, void *farg3) { + int fresult ; + SUNComm arg1 ; + char *arg2 = (char *) 0 ; + SUNProfiler *arg3 = (SUNProfiler *) 0 ; + int result; + +#if SUNDIALS_MPI_ENABLED + if((*farg1)) { + arg1 = MPI_Comm_f2c((MPI_Fint)(*farg1)); + } else { + arg1 = SUN_COMM_NULL; + } +#else + arg1 = *farg1; +#endif + arg2 = (char *)(farg2->data); + arg3 = (SUNProfiler *)(farg3); + result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNProfiler_Free(void *farg1) { int fresult ; SUNProfiler *arg1 = (SUNProfiler *) 0 ; @@ -330,32 +354,3 @@ SWIGEXPORT int _wrap_FSUNProfiler_Reset(void *farg1) { -SWIGEXPORT int _wrap_FSUNProfiler_Create(void *farg1, SwigArrayWrapper *farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - char *arg2 = (char *) 0 ; - SUNProfiler *arg3 = (SUNProfiler *) 0 ; - int result; -#if SUNDIALS_MPI_ENABLED - MPI_Comm comm; -#endif - - arg1 = (void *)(farg1); - arg2 = (char *)(farg2->data); - arg3 = (SUNProfiler *)(farg3); -#if SUNDIALS_MPI_ENABLED - if (arg1 != NULL) { - comm = MPI_Comm_f2c(*((MPI_Fint *) arg1)); - result = (int)SUNProfiler_Create((void*)&comm,(char const *)arg2,arg3); - } - else { - result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); - } -#else - result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); -#endif - fresult = (int)(result); - return fresult; -} - - diff --git a/src/sundials/fmod/fsundials_profiler_mod.f90 b/src/sundials/fmod/fsundials_profiler_mod.f90 index 328243e3a3..f5f3eec902 100644 --- a/src/sundials/fmod/fsundials_profiler_mod.f90 +++ b/src/sundials/fmod/fsundials_profiler_mod.f90 @@ -20,15 +20,17 @@ module fsundials_profiler_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod implicit none private ! DECLARATION CONSTRUCTS - public :: FSUNProfiler_Free type, bind(C) :: SwigArrayWrapper type(C_PTR), public :: data = C_NULL_PTR integer(C_SIZE_T), public :: size = 0 end type + public :: FSUNProfiler_Create + public :: FSUNProfiler_Free public :: FSUNProfiler_Begin public :: FSUNProfiler_End public :: FSUNProfiler_GetTimerResolution @@ -36,11 +38,19 @@ module fsundials_profiler_mod public :: FSUNProfiler_Print public :: FSUNProfiler_Reset - public :: FSUNProfiler_Create - - ! WRAPPER DECLARATIONS interface +function swigc_FSUNProfiler_Create(farg1, farg2, farg3) & +bind(C, name="_wrap_FSUNProfiler_Create") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +integer(C_INT), intent(in) :: farg1 +type(SwigArrayWrapper) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FSUNProfiler_Free(farg1) & bind(C, name="_wrap_FSUNProfiler_Free") & result(fresult) @@ -106,36 +116,11 @@ function swigc_FSUNProfiler_Reset(farg1) & integer(C_INT) :: fresult end function - -function swigc_FSUNProfiler_Create(farg1, farg2, farg3) & -bind(C, name="_wrap_FSUNProfiler_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigarraywrapper -type(C_PTR), value :: farg1 -type(SwigArrayWrapper) :: farg2 -type(C_PTR), value :: farg3 -integer(C_INT) :: fresult -end function - end interface contains ! MODULE SUBPROGRAMS -function FSUNProfiler_Free(p) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR), target, intent(inout) :: p -integer(C_INT) :: fresult -type(C_PTR) :: farg1 - -farg1 = c_loc(p) -fresult = swigc_FSUNProfiler_Free(farg1) -swig_result = fresult -end function - subroutine SWIG_string_to_chararray(string, chars, wrap) use, intrinsic :: ISO_C_BINDING @@ -154,6 +139,39 @@ subroutine SWIG_string_to_chararray(string, chars, wrap) wrap%size = len(string) end subroutine +function FSUNProfiler_Create(comm, title, p) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +integer :: comm +character(kind=C_CHAR, len=*), target :: title +character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars +type(C_PTR), target, intent(inout) :: p +integer(C_INT) :: fresult +integer(C_INT) :: farg1 +type(SwigArrayWrapper) :: farg2 +type(C_PTR) :: farg3 + +farg1 = int(comm, C_INT) +call SWIG_string_to_chararray(title, farg2_chars, farg2) +farg3 = c_loc(p) +fresult = swigc_FSUNProfiler_Create(farg1, farg2, farg3) +swig_result = fresult +end function + +function FSUNProfiler_Free(p) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR), target, intent(inout) :: p +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = c_loc(p) +fresult = swigc_FSUNProfiler_Free(farg1) +swig_result = fresult +end function + function FSUNProfiler_Begin(p, name) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -254,25 +272,4 @@ function FSUNProfiler_Reset(p) & end function -function FSUNProfiler_Create(comm, title, p) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: comm -character(kind=C_CHAR, len=*), target :: title -character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars -type(C_PTR), target, intent(inout) :: p -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(SwigArrayWrapper) :: farg2 -type(C_PTR) :: farg3 - -farg1 = comm -call SWIG_string_to_chararray(title, farg2_chars, farg2) -farg3 = c_loc(p) -fresult = swigc_FSUNProfiler_Create(farg1, farg2, farg3) -swig_result = fresult -end function - - end module diff --git a/src/sundials/fmod/fsundials_types_mod.c b/src/sundials/fmod/fsundials_types_mod.c index e71eab7a3c..9105111119 100644 --- a/src/sundials/fmod/fsundials_types_mod.c +++ b/src/sundials/fmod/fsundials_types_mod.c @@ -7,21 +7,6 @@ * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ - -/* --------------------------------------------------------------- - * Programmer(s): Auto-generated by swig. - * --------------------------------------------------------------- - * SUNDIALS Copyright Start - * Copyright (c) 2002-2023, Lawrence Livermore National Security - * and Southern Methodist University. - * All rights reserved. - * - * See the top-level LICENSE and NOTICE files for details. - * - * SPDX-License-Identifier: BSD-3-Clause - * SUNDIALS Copyright End - * -------------------------------------------------------------*/ - /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -216,4 +201,10 @@ #error "The Fortran bindings are only targeted at 64-bit indices" #endif +SWIGEXPORT SWIGEXTERN int const _wrap_SUNFALSE = (int)(0); + +SWIGEXPORT SWIGEXTERN int const _wrap_SUNTRUE = (int)(1); + +SWIGEXPORT SWIGEXTERN int const _wrap_SUN_COMM_NULL = (int)(0); + diff --git a/src/sundials/fmod/fsundials_types_mod.f90 b/src/sundials/fmod/fsundials_types_mod.f90 index 566bf5e031..b4fda3af5b 100644 --- a/src/sundials/fmod/fsundials_types_mod.f90 +++ b/src/sundials/fmod/fsundials_types_mod.f90 @@ -3,29 +3,16 @@ ! ! Do not make changes to this file unless you know what you are doing--modify ! the SWIG interface file instead. - -! --------------------------------------------------------------- -! Programmer(s): Auto-generated by swig. -! --------------------------------------------------------------- -! SUNDIALS Copyright Start -! Copyright (c) 2002-2023, Lawrence Livermore National Security -! and Southern Methodist University. -! All rights reserved. -! -! See the top-level LICENSE and NOTICE files for details. -! -! SPDX-License-Identifier: BSD-3-Clause -! SUNDIALS Copyright End -! --------------------------------------------------------------- - module fsundials_types_mod use, intrinsic :: ISO_C_BINDING implicit none private ! DECLARATION CONSTRUCTS - integer(C_INT), parameter, public :: SUNFALSE = 0_C_INT - integer(C_INT), parameter, public :: SUNTRUE = 1_C_INT + integer(C_INT), protected, public, & + bind(C, name="_wrap_SUNFALSE") :: SUNFALSE + integer(C_INT), protected, public, & + bind(C, name="_wrap_SUNTRUE") :: SUNTRUE ! typedef enum SUNOutputFormat enum, bind(c) enumerator :: SUN_OUTPUTFORMAT_TABLE @@ -33,6 +20,7 @@ module fsundials_types_mod end enum integer, parameter, public :: SUNOutputFormat = kind(SUN_OUTPUTFORMAT_TABLE) public :: SUN_OUTPUTFORMAT_TABLE, SUN_OUTPUTFORMAT_CSV - integer(C_INT), parameter, public :: SUN_COMM_NULL = 0_C_INT + integer(C_INT), protected, public, & + bind(C, name="_wrap_SUN_COMM_NULL") :: SUN_COMM_NULL end module diff --git a/src/sundials/sundials_context.c b/src/sundials/sundials_context.c index 39b49497b4..f07d1affbf 100644 --- a/src/sundials/sundials_context.c +++ b/src/sundials/sundials_context.c @@ -77,8 +77,6 @@ int SUNContext_Create(SUNComm comm, SUNContext* sunctx) SUNLogger_SetDebugFilename(logger, ""); #endif - - *sunctx = NULL; *sunctx = (SUNContext)malloc(sizeof(struct _SUNContext)); @@ -296,7 +294,7 @@ void sunAdiakCollectMetadata() { adiak_namevalue("magma_version", 2, NULL, "%s", SUN_MAGMA_VERSION); #endif -#ifdef SUNDIALS_MPI_ENABLED +#if SUNDIALS_MPI_ENABLED adiak_namevalue("mpi_c_compiler", 2, NULL, "%s", SUN_MPI_C_COMPILER); adiak_namevalue("mpi_c_version", 2, NULL, "%s", SUN_MPI_C_VERSION); diff --git a/src/sundials/sundials_logger.c b/src/sundials/sundials_logger.c index 645a0a1f95..645b248f5a 100644 --- a/src/sundials/sundials_logger.c +++ b/src/sundials/sundials_logger.c @@ -167,6 +167,7 @@ int SUNLogger_Create(SUNComm comm, int output_rank, SUNLogger* logger_ptr) logger->comm = SUN_COMM_NULL; if (comm != SUN_COMM_NULL) { + printf(">>>> here\n"); MPI_Comm_dup(comm, &logger->comm); } #else diff --git a/src/sundials/sundials_profiler.c b/src/sundials/sundials_profiler.c index ff73b5fcc8..f2558a5b95 100644 --- a/src/sundials/sundials_profiler.c +++ b/src/sundials/sundials_profiler.c @@ -196,6 +196,7 @@ int SUNProfiler_Create(SUNComm comm, const char* title, SUNProfiler* p) profiler->comm = SUN_COMM_NULL; if (comm != SUN_COMM_NULL) { + printf(">>>> here 2\n"); MPI_Comm_dup(comm, &profiler->comm); } #else diff --git a/src/sunlinsol/band/fmod/fsunlinsol_band_mod.f90 b/src/sunlinsol/band/fmod/fsunlinsol_band_mod.f90 index f544eff42f..5009f36daa 100644 --- a/src/sunlinsol/band/fmod/fsunlinsol_band_mod.f90 +++ b/src/sunlinsol/band/fmod/fsunlinsol_band_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_band_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/dense/fmod/fsunlinsol_dense_mod.f90 b/src/sunlinsol/dense/fmod/fsunlinsol_dense_mod.f90 index 6234253719..3c2fe3b810 100644 --- a/src/sunlinsol/dense/fmod/fsunlinsol_dense_mod.f90 +++ b/src/sunlinsol/dense/fmod/fsunlinsol_dense_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_dense_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/klu/fmod/fsunlinsol_klu_mod.f90 b/src/sunlinsol/klu/fmod/fsunlinsol_klu_mod.f90 index a048d29508..c47191e8ec 100644 --- a/src/sunlinsol/klu/fmod/fsunlinsol_klu_mod.f90 +++ b/src/sunlinsol/klu/fmod/fsunlinsol_klu_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_klu_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/lapackdense/fmod/fsunlinsol_lapackdense_mod.f90 b/src/sunlinsol/lapackdense/fmod/fsunlinsol_lapackdense_mod.f90 index a615f9ba43..9d2f3bae85 100644 --- a/src/sunlinsol/lapackdense/fmod/fsunlinsol_lapackdense_mod.f90 +++ b/src/sunlinsol/lapackdense/fmod/fsunlinsol_lapackdense_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_lapackdense_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/pcg/fmod/fsunlinsol_pcg_mod.f90 b/src/sunlinsol/pcg/fmod/fsunlinsol_pcg_mod.f90 index 6334343b52..ddf9fb6d27 100644 --- a/src/sunlinsol/pcg/fmod/fsunlinsol_pcg_mod.f90 +++ b/src/sunlinsol/pcg/fmod/fsunlinsol_pcg_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_pcg_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/spbcgs/fmod/fsunlinsol_spbcgs_mod.f90 b/src/sunlinsol/spbcgs/fmod/fsunlinsol_spbcgs_mod.f90 index 2159bfe002..feb7ee8b83 100644 --- a/src/sunlinsol/spbcgs/fmod/fsunlinsol_spbcgs_mod.f90 +++ b/src/sunlinsol/spbcgs/fmod/fsunlinsol_spbcgs_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_spbcgs_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/spfgmr/fmod/fsunlinsol_spfgmr_mod.f90 b/src/sunlinsol/spfgmr/fmod/fsunlinsol_spfgmr_mod.f90 index c6ed64bf5b..1b36e4b129 100644 --- a/src/sunlinsol/spfgmr/fmod/fsunlinsol_spfgmr_mod.f90 +++ b/src/sunlinsol/spfgmr/fmod/fsunlinsol_spfgmr_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_spfgmr_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/spgmr/fmod/fsunlinsol_spgmr_mod.f90 b/src/sunlinsol/spgmr/fmod/fsunlinsol_spgmr_mod.f90 index 77873a000a..5846a864af 100644 --- a/src/sunlinsol/spgmr/fmod/fsunlinsol_spgmr_mod.f90 +++ b/src/sunlinsol/spgmr/fmod/fsunlinsol_spgmr_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_spgmr_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunlinsol/sptfqmr/fmod/fsunlinsol_sptfqmr_mod.f90 b/src/sunlinsol/sptfqmr/fmod/fsunlinsol_sptfqmr_mod.f90 index c4d9abe539..0dc98dbcff 100644 --- a/src/sunlinsol/sptfqmr/fmod/fsunlinsol_sptfqmr_mod.f90 +++ b/src/sunlinsol/sptfqmr/fmod/fsunlinsol_sptfqmr_mod.f90 @@ -20,9 +20,10 @@ module fsunlinsol_sptfqmr_mod use, intrinsic :: ISO_C_BINDING - use fsundials_linearsolver_mod use fsundials_types_mod + use fsundials_linearsolver_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunmatrix/band/fmod/fsunmatrix_band_mod.f90 b/src/sunmatrix/band/fmod/fsunmatrix_band_mod.f90 index 409f136608..359e2dc6df 100644 --- a/src/sunmatrix/band/fmod/fsunmatrix_band_mod.f90 +++ b/src/sunmatrix/band/fmod/fsunmatrix_band_mod.f90 @@ -20,9 +20,10 @@ module fsunmatrix_band_mod use, intrinsic :: ISO_C_BINDING - use fsundials_matrix_mod use fsundials_types_mod + use fsundials_matrix_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunmatrix/dense/fmod/fsunmatrix_dense_mod.f90 b/src/sunmatrix/dense/fmod/fsunmatrix_dense_mod.f90 index 4db62d8eef..ab91b59e15 100644 --- a/src/sunmatrix/dense/fmod/fsunmatrix_dense_mod.f90 +++ b/src/sunmatrix/dense/fmod/fsunmatrix_dense_mod.f90 @@ -20,9 +20,10 @@ module fsunmatrix_dense_mod use, intrinsic :: ISO_C_BINDING - use fsundials_matrix_mod use fsundials_types_mod + use fsundials_matrix_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunmatrix/sparse/fmod/fsunmatrix_sparse_mod.f90 b/src/sunmatrix/sparse/fmod/fsunmatrix_sparse_mod.f90 index 3fd0722991..20e2e9e855 100644 --- a/src/sunmatrix/sparse/fmod/fsunmatrix_sparse_mod.f90 +++ b/src/sunmatrix/sparse/fmod/fsunmatrix_sparse_mod.f90 @@ -20,9 +20,10 @@ module fsunmatrix_sparse_mod use, intrinsic :: ISO_C_BINDING - use fsundials_matrix_mod use fsundials_types_mod + use fsundials_matrix_mod use fsundials_context_mod + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunnonlinsol/fixedpoint/fmod/fsunnonlinsol_fixedpoint_mod.f90 b/src/sunnonlinsol/fixedpoint/fmod/fsunnonlinsol_fixedpoint_mod.f90 index a1b693a285..7ac874f459 100644 --- a/src/sunnonlinsol/fixedpoint/fmod/fsunnonlinsol_fixedpoint_mod.f90 +++ b/src/sunnonlinsol/fixedpoint/fmod/fsunnonlinsol_fixedpoint_mod.f90 @@ -20,6 +20,7 @@ module fsunnonlinsol_fixedpoint_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/src/sunnonlinsol/newton/fmod/fsunnonlinsol_newton_mod.f90 b/src/sunnonlinsol/newton/fmod/fsunnonlinsol_newton_mod.f90 index 634bc969c0..5b4eafb678 100644 --- a/src/sunnonlinsol/newton/fmod/fsunnonlinsol_newton_mod.f90 +++ b/src/sunnonlinsol/newton/fmod/fsunnonlinsol_newton_mod.f90 @@ -20,6 +20,7 @@ module fsunnonlinsol_newton_mod use, intrinsic :: ISO_C_BINDING + use fsundials_types_mod use fsundials_nvector_mod use fsundials_context_mod use fsundials_types_mod diff --git a/swig/arkode/farkode_mod.i b/swig/arkode/farkode_mod.i index caaad3f3c1..25480b9bc0 100644 --- a/swig/arkode/farkode_mod.i +++ b/swig/arkode/farkode_mod.i @@ -34,7 +34,7 @@ %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" %import "../sundials/fsundials_nonlinearsolver_mod.i" -%import "../sundials/fsundials_types_mod.i" + // Treat ARKodeButcherTable as an opaque pointer %apply void* { ARKodeButcherTable }; diff --git a/swig/cvode/fcvode_mod.i b/swig/cvode/fcvode_mod.i index 74afd3acf5..91cc6e2d50 100644 --- a/swig/cvode/fcvode_mod.i +++ b/swig/cvode/fcvode_mod.i @@ -32,7 +32,7 @@ %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" %import "../sundials/fsundials_nonlinearsolver_mod.i" -%import "../sundials/fsundials_types_mod.i" + // Process definitions from these files %include "cvode/cvode.h" diff --git a/swig/cvodes/fcvodes_mod.i b/swig/cvodes/fcvodes_mod.i index b498175b74..b8a5745807 100644 --- a/swig/cvodes/fcvodes_mod.i +++ b/swig/cvodes/fcvodes_mod.i @@ -31,7 +31,7 @@ %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" %import "../sundials/fsundials_nonlinearsolver_mod.i" -%import "../sundials/fsundials_types_mod.i" + // Process definitions from these files %include "cvodes/cvodes.h" diff --git a/swig/ida/fida_mod.i b/swig/ida/fida_mod.i index e5a0c74684..db0727e753 100644 --- a/swig/ida/fida_mod.i +++ b/swig/ida/fida_mod.i @@ -25,7 +25,7 @@ %} // Load the typedefs and generate a "use" statements in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_nvector_mod.i" %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" diff --git a/swig/idas/fidas_mod.i b/swig/idas/fidas_mod.i index 09fe7710b7..a214991975 100644 --- a/swig/idas/fidas_mod.i +++ b/swig/idas/fidas_mod.i @@ -25,7 +25,7 @@ %} // Load the typedefs and generate a "use" statements in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_nvector_mod.i" %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" diff --git a/swig/kinsol/fkinsol_mod.i b/swig/kinsol/fkinsol_mod.i index 0e2507789b..1642350655 100644 --- a/swig/kinsol/fkinsol_mod.i +++ b/swig/kinsol/fkinsol_mod.i @@ -25,7 +25,7 @@ %} // Load the typedefs and generate a "use" statements in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_nvector_mod.i" %import "../sundials/fsundials_matrix_mod.i" %import "../sundials/fsundials_linearsolver_mod.i" diff --git a/swig/nvector/fnvector_mpimanyvector_mod.i b/swig/nvector/fnvector_mpimanyvector_mod.i index 7c2a355f5a..31ca4f8db3 100644 --- a/swig/nvector/fnvector_mpimanyvector_mod.i +++ b/swig/nvector/fnvector_mpimanyvector_mod.i @@ -27,34 +27,6 @@ // nvector_impl macro defines some ignore and inserts with the vector name appended %nvector_impl(MPIManyVector) -// handle MPI comm -%include - -%apply int { MPI_Comm }; -%typemap(ftype) MPI_Comm - "integer" -%typemap(fin, noblock=1) MPI_Comm { - $1 = int($input, C_INT) -} -%typemap(fout, noblock=1) MPI_Comm { - $result = int($1) -} - -%typemap(in, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $1 = MPI_Comm_f2c(%static_cast(*$input, MPI_Fint)); -%#else - $1 = *$input; -%#endif -} -%typemap(out, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $result = %static_cast(MPI_Comm_c2f($1), int); -%#else - $result = $1; -%#endif -} - // Process and wrap functions in the following files %include "nvector/nvector_mpimanyvector.h" diff --git a/swig/nvector/fnvector_mpiplusx_mod.i b/swig/nvector/fnvector_mpiplusx_mod.i index 14f3a45c73..7e9360f1e2 100644 --- a/swig/nvector/fnvector_mpiplusx_mod.i +++ b/swig/nvector/fnvector_mpiplusx_mod.i @@ -27,34 +27,6 @@ // nvector_impl macro defines some ignore and inserts with the vector name appended %nvector_impl(MPIPlusX) -// handle MPI comm -%include - -%apply int { MPI_Comm }; -%typemap(ftype) MPI_Comm - "integer" -%typemap(fin, noblock=1) MPI_Comm { - $1 = int($input, C_INT) -} -%typemap(fout, noblock=1) MPI_Comm { - $result = int($1) -} - -%typemap(in, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $1 = MPI_Comm_f2c(%static_cast(*$input, MPI_Fint)); -%#else - $1 = *$input; -%#endif -} -%typemap(out, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED - $result = %static_cast(MPI_Comm_c2f($1), int); -%#else - $result = $1; -%#endif -} - // Process and wrap functions in the following files %include "nvector/nvector_mpiplusx.h" diff --git a/swig/nvector/fnvector_parallel_mod.i b/swig/nvector/fnvector_parallel_mod.i index 1501186b6e..322f67a933 100644 --- a/swig/nvector/fnvector_parallel_mod.i +++ b/swig/nvector/fnvector_parallel_mod.i @@ -41,14 +41,14 @@ } %typemap(in, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED +%#if SUNDIALS_MPI_ENABLED $1 = MPI_Comm_f2c(%static_cast(*$input, MPI_Fint)); %#else $1 = *$input; %#endif } %typemap(out, noblock=1) MPI_Comm { -%#ifdef SUNDIALS_MPI_ENABLED +%#if SUNDIALS_MPI_ENABLED $result = %static_cast(MPI_Comm_c2f($1), int); %#else $result = $1; diff --git a/swig/sundials/fsundials.i b/swig/sundials/fsundials.i index 7a8ec433d8..d50e38ec27 100644 --- a/swig/sundials/fsundials.i +++ b/swig/sundials/fsundials.i @@ -18,6 +18,15 @@ // By default, wrap all constants as native fortran PARAMETERs %fortranconst; +// Inform SWIG of the SUNDIALS_EXPORT macro +#define SUNDIALS_EXPORT +#define SUNDIALS_DEPRECATED_EXPORT +#define SUNDIALS_DEPRECATED_EXPORT_MSG(msg) +#define SUNDIALS_STATIC_INLINE + +// All modules need sundials_types +%import "../sundials/fsundials_types_mod.i" + // Prefix all functions with F // E.g. CVodeCreate -> FCVodeCreate %rename("F%s", %$isfunction) ""; @@ -59,19 +68,6 @@ // Treat all ** as an opaque pointer %apply void** { SWIGTYPE ** }; -// Treat SUNComm as an int. -// This means the newer type(MPI_Comm) in mpi_f08 cannot be used -// but we have to do so to avoid generating separate Fortran interfaces for -// the MPI and no-MPI cases. -%apply int { SUNComm }; - -// Inform SWIG of the SUNDIALS_EXPORT macro -#define SUNDIALS_EXPORT -#define SUNDIALS_DEPRECATED_EXPORT -#define SUNDIALS_DEPRECATED_EXPORT_MSG(msg) -#define SUNDIALS_STATIC_INLINE - - // Insert SUNDIALS copyright into generated C files. %insert(begin) %{ diff --git a/swig/sundials/fsundials_context_mod.i b/swig/sundials/fsundials_context_mod.i index 485c173e2e..3b1dc940b4 100644 --- a/swig/sundials/fsundials_context_mod.i +++ b/swig/sundials/fsundials_context_mod.i @@ -29,115 +29,5 @@ %apply void* { SUNLogger }; %apply void** { SUNLogger* }; -// We have to manually insert the wrapper code for SUNContext_Create, -// and SUNContext_Free to handle the Fortran to MPI MPI_Comm translation. -%ignore SUNContext_Create; -%ignore SUNContext_Free; - // Process and wrap functions in the following files %include "sundials/sundials_context.h" - -%insert("wrapper") %{ -SWIGEXPORT int _wrap_FSUNContext_Free(void *farg1) { - int fresult ; - SUNContext *arg1 = (SUNContext *) 0 ; - int result; -#ifdef SUNDIALS_BUILD_WITH_PROFILING - SUNProfiler profiler; -#endif - - arg1 = (SUNContext *)(farg1); -#ifdef SUNDIALS_BUILD_WITH_PROFILING - result = (int)SUNContext_GetProfiler(*arg1,&profiler); - result = (int)SUNContext_Free(arg1); - result = (int)SUNProfiler_Free(&profiler); -#else - result = (int)SUNContext_Free(arg1); -#endif - fresult = (int)(result); - return fresult; -} - -SWIGEXPORT int _wrap_FSUNContext_Create(void *farg1, void *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - SUNContext *arg2 = (SUNContext *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (SUNContext *)(farg2); - result = (int)SUNContext_Create(arg1,arg2); - fresult = (int)(result); - return fresult; -} -%} - -%insert("fbegin") %{ -#include "sundials/sundials_config.h" -%} - -%insert("fdecl") %{ -public :: FSUNContext_Free -public :: FSUNContext_Create -%} - -%insert("finterfaces") %{ -function swigc_FSUNContext_Free(farg1) & -bind(C, name="_wrap_FSUNContext_Free") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -integer(C_INT) :: fresult -end function - -function swigc_FSUNContext_Create(farg1, farg2) & -bind(C, name="_wrap_FSUNContext_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_PTR), value :: farg2 -integer(C_INT) :: fresult -end function - -%} - -%insert("fsubprograms") %{ -function FSUNContext_Free(ctx) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR), target, intent(inout) :: ctx -integer(C_INT) :: fresult -type(C_PTR) :: farg1 - -farg1 = c_loc(ctx) -fresult = swigc_FSUNContext_Free(farg1) -swig_result = fresult -end function - -function FSUNContext_Create(comm, ctx) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -#ifdef SUNDIALS_BUILD_WITH_PROFILING -use fsundials_profiler_mod, only : FSUNProfiler_Create -#endif -integer(C_INT) :: swig_result -type(C_PTR) :: comm -type(C_PTR), target, intent(inout) :: ctx -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_PTR) :: farg2 -#ifdef SUNDIALS_BUILD_WITH_PROFILING -type(C_PTR) :: profiler -#endif - -farg1 = comm -farg2 = c_loc(ctx) -fresult = swigc_FSUNContext_Create(c_null_ptr, farg2) -#ifdef SUNDIALS_BUILD_WITH_PROFILING -fresult = FSUNProfiler_Create(farg1, "FSUNContext Default", profiler) -fresult = swigc_FSUNContext_SetProfiler(ctx, profiler) -#endif -swig_result = fresult -end function -%} diff --git a/swig/sundials/fsundials_linearsolver_mod.i b/swig/sundials/fsundials_linearsolver_mod.i index fcb095c61d..cf80453f8c 100644 --- a/swig/sundials/fsundials_linearsolver_mod.i +++ b/swig/sundials/fsundials_linearsolver_mod.i @@ -17,7 +17,7 @@ %module fsundials_linearsolver_mod // Load the typedefs and generate a "use" statement in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_context_mod.i" %import "../sundials/fsundials_nvector_mod.i" %import "../sundials/fsundials_matrix_mod.i" diff --git a/swig/sundials/fsundials_matrix_mod.i b/swig/sundials/fsundials_matrix_mod.i index 8c4947f7d5..1af0682e8e 100644 --- a/swig/sundials/fsundials_matrix_mod.i +++ b/swig/sundials/fsundials_matrix_mod.i @@ -17,7 +17,7 @@ %module fsundials_matrix_mod // Load the typedefs and generate a "use" statement in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_context_mod.i" %import "../sundials/fsundials_nvector_mod.i" diff --git a/swig/sundials/fsundials_nonlinearsolver_mod.i b/swig/sundials/fsundials_nonlinearsolver_mod.i index 54e462e54e..f6a4762b7d 100644 --- a/swig/sundials/fsundials_nonlinearsolver_mod.i +++ b/swig/sundials/fsundials_nonlinearsolver_mod.i @@ -17,7 +17,7 @@ %module fsundials_nonlinearsolver_mod // Load the typedefs and generate a "use" statement in the module -%import "../sundials/fsundials_types_mod.i" + %import "../sundials/fsundials_context_mod.i" %import "../sundials/fsundials_nvector_mod.i" diff --git a/swig/sundials/fsundials_nvector_mod.i b/swig/sundials/fsundials_nvector_mod.i index b7bbce0130..44ef32bc3e 100644 --- a/swig/sundials/fsundials_nvector_mod.i +++ b/swig/sundials/fsundials_nvector_mod.i @@ -18,7 +18,7 @@ // Load the typedefs and generate a "use fsundials_types_mod" statement in the module %import "../sundials/fsundials_context_mod.i" -%import "../sundials/fsundials_types_mod.i" + // insert the include into the swig wrapper %{ diff --git a/swig/sundials/fsundials_profiler_mod.i b/swig/sundials/fsundials_profiler_mod.i index 1462343c95..06dc5bc079 100644 --- a/swig/sundials/fsundials_profiler_mod.i +++ b/swig/sundials/fsundials_profiler_mod.i @@ -32,78 +32,5 @@ // Utility class for C++ only. %ignore SUNProfilerMarkScope; -// We have to manually insert the wrapper code for SUNProfiler_Create -// to handle the Fortran to MPI MPI_Comm translation. -%ignore SUNProfiler_Create; - // Process and wrap functions in the following files %include "sundials/sundials_profiler.h" - -%insert("wrapper") %{ -SWIGEXPORT int _wrap_FSUNProfiler_Create(void *farg1, SwigArrayWrapper *farg2, void *farg3) { - int fresult ; - void *arg1 = (void *) 0 ; - char *arg2 = (char *) 0 ; - SUNProfiler *arg3 = (SUNProfiler *) 0 ; - int result; -#if SUNDIALS_MPI_ENABLED - MPI_Comm comm; -#endif - - arg1 = (void *)(farg1); - arg2 = (char *)(farg2->data); - arg3 = (SUNProfiler *)(farg3); -#if SUNDIALS_MPI_ENABLED - if (arg1 != NULL) { - comm = MPI_Comm_f2c(*((MPI_Fint *) arg1)); - result = (int)SUNProfiler_Create((void*)&comm,(char const *)arg2,arg3); - } - else { - result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); - } -#else - result = (int)SUNProfiler_Create(arg1,(char const *)arg2,arg3); -#endif - fresult = (int)(result); - return fresult; -} -%} - -%insert("fdecl") %{ - public :: FSUNProfiler_Create -%} - -%insert("finterfaces") %{ -function swigc_FSUNProfiler_Create(farg1, farg2, farg3) & -bind(C, name="_wrap_FSUNProfiler_Create") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -import :: swigarraywrapper -type(C_PTR), value :: farg1 -type(SwigArrayWrapper) :: farg2 -type(C_PTR), value :: farg3 -integer(C_INT) :: fresult -end function -%} - -%insert("fsubprograms") %{ -function FSUNProfiler_Create(comm, title, p) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: comm -character(kind=C_CHAR, len=*), target :: title -character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars -type(C_PTR), target, intent(inout) :: p -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(SwigArrayWrapper) :: farg2 -type(C_PTR) :: farg3 - -farg1 = comm -call SWIG_string_to_chararray(title, farg2_chars, farg2) -farg3 = c_loc(p) -fresult = swigc_FSUNProfiler_Create(farg1, farg2, farg3) -swig_result = fresult -end function -%} diff --git a/swig/sundials/fsundials_types_mod.i b/swig/sundials/fsundials_types_mod.i index 085b370c19..5e1fa61850 100644 --- a/swig/sundials/fsundials_types_mod.i +++ b/swig/sundials/fsundials_types_mod.i @@ -17,7 +17,6 @@ %module fsundials_types_mod -%include "../sundials/fsundials.i" %include // Inform SWIG of the configure-provided types @@ -26,6 +25,43 @@ #define SUNDIALS_DOUBLE_PRECISION #define sunbooleantype int +// Handle MPI_Comm and SUNComm +%include + +%apply int { MPI_Comm }; +%typemap(ftype) MPI_Comm + "integer" +%typemap(fin, noblock=1) MPI_Comm { + $1 = int($input, C_INT) +} +%typemap(fout, noblock=1) MPI_Comm { + $result = int($1) +} + +%typemap(in, noblock=1) MPI_Comm { +%#if SUNDIALS_MPI_ENABLED + if((*$input)) { + $1 = MPI_Comm_f2c(%static_cast(*$input, MPI_Fint)); + } else { + $1 = SUN_COMM_NULL; + } +%#else + $1 = *$input; +%#endif +} +%typemap(out, noblock=1) MPI_Comm { +%#if SUNDIALS_MPI_ENABLED + if ($1 != SUN_COMM_NULL) { + $result = %static_cast(MPI_Comm_c2f($1), int); + } +%#else + $result = $1; +%#endif +} + +%apply MPI_Comm { SUNComm }; + + // Insert code into the C wrapper to check that the sizes match %{ #include "sundials/sundials_types.h" diff --git a/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp b/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp index c207bf7d3d..f14f7599c2 100644 --- a/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp +++ b/test/unit_tests/arkode/CXX_parallel/ark_test_heat2D_mri.cpp @@ -108,7 +108,7 @@ static int FreeUserData(UserData *udata); int main(int argc, char* argv[]) { /* Create the SUNDIALS context object for this simulation. */ SUNContext ctx = NULL; - SUNContext_Create(NULL, &ctx); + SUNContext_Create(SUN_COMM_NULL, &ctx); // general problem parameters sunrealtype T0 = SUN_RCONST(0.0); // initial time diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp index e43b65d45a..159e3d3de2 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_analytic_sys_mri.cpp @@ -69,7 +69,7 @@ static SUNContext sunctx = NULL; int main(int argc, char* argv[]) { // Create the SUNDIALS context object for this simulation. - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); // general problem parameters sunrealtype T0 = SUN_RCONST(0.0); // initial time diff --git a/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c b/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c index 08818856a4..6b15e3dd05 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c +++ b/test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) printf(" abstol = %.1"ESYM"\n\n", abstol); /* Create the SUNDIALS context object for this simulation. */ - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); /* Create solution vector and initialize to zero */ y = N_VNew_Serial(NEQ, sunctx); diff --git a/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c b/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c index 14d027503d..d7447fb17b 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c +++ b/test/unit_tests/arkode/C_serial/ark_test_getuserdata.c @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/arkode/C_serial/ark_test_interp.c b/test/unit_tests/arkode/C_serial/ark_test_interp.c index cd79b34b07..182b14a680 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_interp.c +++ b/test/unit_tests/arkode/C_serial/ark_test_interp.c @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) /* Create the SUNDIALS context object for this simulation. */ SUNContext sunctx = NULL; - SUNContext_Create(NULL, &sunctx); + SUNContext_Create(SUN_COMM_NULL, &sunctx); /* general problem parameters */ T0 = SUN_RCONST(0.0); /* initial time */ diff --git a/test/unit_tests/arkode/C_serial/ark_test_reset.c b/test/unit_tests/arkode/C_serial/ark_test_reset.c index 3b191255c8..da2c483de7 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_reset.c +++ b/test/unit_tests/arkode/C_serial/ark_test_reset.c @@ -94,7 +94,7 @@ int main() printf("\nARKODE reset functionality tester:\n"); /* Create the SUNDIALS context object for this simulation */ - retval = SUNContext_Create(NULL, &ctx); + retval = SUNContext_Create(SUN_COMM_NULL, &ctx); if (check_retval(&retval, "SUNContext_Create", 1)) return 1; /* Initialize vector, matrix, and linaer solver data structures */ diff --git a/test/unit_tests/arkode/C_serial/ark_test_tstop.c b/test/unit_tests/arkode/C_serial/ark_test_tstop.c index 66a17b5a46..b5e72c03bc 100644 --- a/test/unit_tests/arkode/C_serial/ark_test_tstop.c +++ b/test/unit_tests/arkode/C_serial/ark_test_tstop.c @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/cvode/C_serial/cv_test_getuserdata.c b/test/unit_tests/cvode/C_serial/cv_test_getuserdata.c index 8b3a82ff88..2223ab19ba 100644 --- a/test/unit_tests/cvode/C_serial/cv_test_getuserdata.c +++ b/test/unit_tests/cvode/C_serial/cv_test_getuserdata.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/cvode/C_serial/cv_test_tstop.c b/test/unit_tests/cvode/C_serial/cv_test_tstop.c index 50c7e053d6..eb877fbd20 100644 --- a/test/unit_tests/cvode/C_serial/cv_test_tstop.c +++ b/test/unit_tests/cvode/C_serial/cv_test_tstop.c @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/cvodes/C_serial/cvs_test_getuserdata.c b/test/unit_tests/cvodes/C_serial/cvs_test_getuserdata.c index f108822af8..00cfb8dcc2 100644 --- a/test/unit_tests/cvodes/C_serial/cvs_test_getuserdata.c +++ b/test/unit_tests/cvodes/C_serial/cvs_test_getuserdata.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/cvodes/C_serial/cvs_test_tstop.c b/test/unit_tests/cvodes/C_serial/cvs_test_tstop.c index 5ce9c1c611..f9fd045ee6 100644 --- a/test/unit_tests/cvodes/C_serial/cvs_test_tstop.c +++ b/test/unit_tests/cvodes/C_serial/cvs_test_tstop.c @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/ida/C_serial/ida_test_getuserdata.c b/test/unit_tests/ida/C_serial/ida_test_getuserdata.c index 31e664c189..3bdd23c53a 100644 --- a/test/unit_tests/ida/C_serial/ida_test_getuserdata.c +++ b/test/unit_tests/ida/C_serial/ida_test_getuserdata.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/ida/C_serial/ida_test_tstop.c b/test/unit_tests/ida/C_serial/ida_test_tstop.c index 491910ae1b..d0fdb10e06 100644 --- a/test/unit_tests/ida/C_serial/ida_test_tstop.c +++ b/test/unit_tests/ida/C_serial/ida_test_tstop.c @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/idas/C_serial/idas_test_getuserdata.c b/test/unit_tests/idas/C_serial/idas_test_getuserdata.c index d1a42fde65..2e5148dd3a 100644 --- a/test/unit_tests/idas/C_serial/idas_test_getuserdata.c +++ b/test/unit_tests/idas/C_serial/idas_test_getuserdata.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval); diff --git a/test/unit_tests/idas/C_serial/idas_test_tstop.c b/test/unit_tests/idas/C_serial/idas_test_tstop.c index 6875fa4d79..7f73326dde 100644 --- a/test/unit_tests/idas/C_serial/idas_test_tstop.c +++ b/test/unit_tests/idas/C_serial/idas_test_tstop.c @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) * Create context * -------------- */ - flag = SUNContext_Create(NULL, &sunctx); + flag = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (flag) { fprintf(stderr, "SUNContext_Create returned %i\n", flag); diff --git a/test/unit_tests/kinsol/C_serial/kin_test_getuserdata.c b/test/unit_tests/kinsol/C_serial/kin_test_getuserdata.c index abe9491ca8..0cefda13e6 100644 --- a/test/unit_tests/kinsol/C_serial/kin_test_getuserdata.c +++ b/test/unit_tests/kinsol/C_serial/kin_test_getuserdata.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) void *udata_out = NULL; /* Create the SUNDIALS context object for this simulation. */ - retval = SUNContext_Create(NULL, &sunctx); + retval = SUNContext_Create(SUN_COMM_NULL, &sunctx); if (retval) { fprintf(stderr, "SUNContext_Create returned %i\n", retval);