diff --git a/.gitignore b/.gitignore index 9d1c6fe6e6..84b2d13c25 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ /.pydevproject .vscode compile_commands.json +.venv .clangd # custom test environment setup script @@ -82,3 +83,7 @@ uberenv_libs # tools /tools/suntools/__pycache__ + +# python +.pytest_cache +__pycache__ diff --git a/doc/shared/nvectors/NVector_Kokkos.rst b/doc/shared/nvectors/NVector_Kokkos.rst index 17ff29252e..7d086fd7fc 100644 --- a/doc/shared/nvectors/NVector_Kokkos.rst +++ b/doc/shared/nvectors/NVector_Kokkos.rst @@ -64,14 +64,14 @@ To use the NVECTOR_KOKKOS module, we construct an instance of the ``Vector`` cla Instances of the ``Vector`` class are implicitly or explicitly (using the -:cpp:func:`~Vector::Convert` method) convertible to a :c:type:`N_Vector` +:cpp:func:`~Vector::get` method) convertible to a :c:type:`N_Vector` e.g., .. code-block:: cpp sundials::kokkos::Vector<> x{length, sunctx}; - N_Vector x2 = x; // implicit conversion to N_Vector - N_Vector x3 = x.Convert(); // explicit conversion to N_Vector + N_Vector x2 = x; // implicit conversion to N_Vector + N_Vector x3 = x.get(); // explicit conversion to N_Vector No further interaction with a ``Vector`` is required from this point, and it is possible to use the :c:type:`N_Vector` API to operate on ``x2`` or ``x3``. @@ -184,11 +184,11 @@ class. Implicit conversion to a :c:type:`N_Vector`. - .. cpp:function:: N_Vector Convert() override + .. cpp:function:: N_Vector get() override Explicit conversion to a :c:type:`N_Vector`. - .. cpp:function:: N_Vector Convert() const override + .. cpp:function:: N_Vector get() const override Explicit conversion to a :c:type:`N_Vector`. diff --git a/doc/shared/sundials/Fortran.rst b/doc/shared/sundials/Fortran.rst index 994062bd46..aaaeae20c1 100644 --- a/doc/shared/sundials/Fortran.rst +++ b/doc/shared/sundials/Fortran.rst @@ -488,6 +488,11 @@ a C file pointer, SUNDIALS provides two utility functions for creating a .. c:function:: SUNErrCode SUNDIALSFileOpen(const char* filename, const char* mode, FILE** fp) + Deprecated alias to :c:func:`SUNFileOpen`. + + +.. c:function:: SUNErrCode SUNFileOpen(const char* filename, const char* mode, FILE** fp) + The function allocates a ``FILE*`` by calling the C function ``fopen`` with the provided filename and I/O mode. @@ -522,7 +527,7 @@ a C file pointer, SUNDIALS provides two utility functions for creating a type(c_ptr) :: fp ! Open up the file output.log for writing - ierr = FSUNDIALSFileOpen("output.log", "w+", fp) + ierr = FSUNFileOpen("output.log", "w+", fp) ! The C function ARKStepPrintMem takes void* arkode_mem and FILE* fp as arguments call FARKStepPrintMem(arkode_mem, fp) @@ -530,25 +535,28 @@ a C file pointer, SUNDIALS provides two utility functions for creating a ! Close the file ierr = FSUNDIALSFileClose(fp) - .. versionchanged:: 7.0.0 + .. versionadded:: X.Y.Z - The function signature was updated to return a `SUNErrCode` and take a `FILE**` as the last input parameter rather then return a `FILE*`. .. c:function:: SUNErrCode SUNDIALSFileClose(FILE** fp) + Deprecated alias to :c:func:`SUNFileOpen` + + .. deprecated:: X.Y.Z + + +.. c:function:: SUNErrCode SUNFileClose(FILE** fp) + The function deallocates a C ``FILE*`` by calling the C function ``fclose`` with the provided pointer. :param fp: the C ``FILE*`` that was previously obtained from ``fopen``. This should have the Fortran type ``type(c_ptr)``. Note that if either - ``stdout`` or ``stderr`` were opened using :c:func:`SUNDIALSFileOpen()` + ``stdout`` or ``stderr`` were opened using :c:func:`SUNFileOpen()` :return: A :c:type:`SUNErrCode` - - .. versionchanged:: 7.0.0 - - The function signature was updated to return a `SUNErrCode` and the `fp` parameter was changed from `FILE*` to `FILE**`. - + + .. versionadded:: X.Y.Z .. _SUNDIALS.Fortran.Portability: diff --git a/doc/shared/sundials/SUNContext.rst b/doc/shared/sundials/SUNContext.rst index 22b7921618..f1da6d3f88 100644 --- a/doc/shared/sundials/SUNContext.rst +++ b/doc/shared/sundials/SUNContext.rst @@ -302,11 +302,11 @@ For C++ users a RAII safe class, ``sundials::Context``, is provided: Context& operator=(const Context&) = delete; Context& operator=(Context&&) = default; - SUNContext Convert() override + SUNContext get() override { return *sunctx_.get(); } - SUNContext Convert() const override + SUNContext get() const override { return *sunctx_.get(); } diff --git a/doc/shared/sundials/Types.rst b/doc/shared/sundials/Types.rst index 07c908e588..acae2393f0 100644 --- a/doc/shared/sundials/Types.rst +++ b/doc/shared/sundials/Types.rst @@ -88,6 +88,21 @@ code can use SUNDIALS without modifying the code to use ``sunrealtype``, ``SUN_RCONST``, or the ``SUNR`` macros so long as the SUNDIALS libraries are built to use the corresponding precision (see :numref:`Installation.Options`). +For implementation reasons, SUNDIALS also defines the types: + +.. c:type:: sunrealtype1d + + This is a ``sunrealtype*`` which should be treated as 1D contiguous array. + +.. c:type:: sunrealtype2d + + This is a ``sunrealtype**`` which should be treated as 2D contiguous array. + +.. c:type:: sunrealtype3d + + This is a ``sunrealtype***`` which should be treated as 3D contiguous array. + + Integer types used for indexing ------------------------------- @@ -116,6 +131,20 @@ SUNDIALS without modifying the code to use ``sunindextype``, so long as the SUNDIALS libraries use the appropriate index storage type (for details see :numref:`Installation.Options`). +For implementation reasons, SUNDIALS also defines the types: + +.. c:type:: sunindextype1d + + This is a ``sunindextype*`` which should be treated as 1D contiguous array. + +.. c:type:: sunindextype2d + + This is a ``sunindextype**`` which should be treated as 2D contiguous array. + +.. c:type:: sunindextype3d + + This is a ``sunindextype***`` which should be treated as 3D contiguous array. + Integer type used for counters ------------------------------ diff --git a/doc/shared/sunlinsol/SUNLinSol_Ginkgo.rst b/doc/shared/sunlinsol/SUNLinSol_Ginkgo.rst index ddc2703c8e..702b7a52e6 100644 --- a/doc/shared/sunlinsol/SUNLinSol_Ginkgo.rst +++ b/doc/shared/sunlinsol/SUNLinSol_Ginkgo.rst @@ -89,7 +89,7 @@ expecting a ``SUNLinearSolver`` object through the implicit conversion operator // Alternatively with explicit conversion of LS to a SUNLinearSolver // and A to a SUNMatrix: - CVodeSetLinearSolver(cvode_mem, LS->Convert(), A->Convert()); + CVodeSetLinearSolver(cvode_mem, LS->get(), A->get()); .. warning:: @@ -139,11 +139,11 @@ In this section we list the public API of the :cpp:type:`sundials::ginkgo::Linea Implicit conversion to a :c:type:`SUNLinearSolver`. - .. cpp:function:: SUNLinearSolver Convert() override + .. cpp:function:: SUNLinearSolver get() override Explicit conversion to a :c:type:`SUNLinearSolver`. - .. cpp:function:: SUNLinearSolver Convert() const override + .. cpp:function:: SUNLinearSolver get() const override Explicit conversion to a :c:type:`SUNLinearSolver`. diff --git a/doc/shared/sunlinsol/SUNLinSol_KokkosDense.rst b/doc/shared/sunlinsol/SUNLinSol_KokkosDense.rst index 8ec91184dc..59aac8acd6 100644 --- a/doc/shared/sunlinsol/SUNLinSol_KokkosDense.rst +++ b/doc/shared/sunlinsol/SUNLinSol_KokkosDense.rst @@ -55,14 +55,14 @@ instance of a dense linear solver e.g., sundials::kokkos::DenseLinearSolver<> LS{sunctx}; Instances of the ``DenseLinearSolver`` class are implicitly or explicitly (using -the :cpp:func:`~DenseLinearSolver::Convert` method) convertible to a +the :cpp:func:`~DenseLinearSolver::get` method) convertible to a :c:type:`SUNLinearSolver` e.g., .. code-block:: cpp sundials::kokkos::DenseLinearSolver<> LS{sunctx}; SUNLinearSolver LSA = LS; // implicit conversion to SUNLinearSolver - SUNLinearSolver LSB = LS.Convert(); // explicit conversion to SUNLinearSolver + SUNLinearSolver LSB = LS.get(); // explicit conversion to SUNLinearSolver .. warning:: @@ -118,10 +118,10 @@ In this section we list the public API of the Implicit conversion to a :c:type:`SUNLinearSolver`. - .. cpp:function:: SUNLinearSolver Convert() override + .. cpp:function:: SUNLinearSolver get() override Explicit conversion to a :c:type:`SUNLinearSolver`. - .. cpp:function:: SUNLinearSolver Convert() const override + .. cpp:function:: SUNLinearSolver get() const override Explicit conversion to a :c:type:`SUNLinearSolver`. diff --git a/doc/shared/sunmatrix/SUNMatrix_Ginkgo.rst b/doc/shared/sunmatrix/SUNMatrix_Ginkgo.rst index d7636c1895..1c0c60beb1 100644 --- a/doc/shared/sunmatrix/SUNMatrix_Ginkgo.rst +++ b/doc/shared/sunmatrix/SUNMatrix_Ginkgo.rst @@ -75,12 +75,12 @@ and then fill the diagonal of the matrix with ones to make an identity matrix: After we have a Ginkgo matrix object, we wrap it in an instance of the ``sundials::ginkgo::Matrix`` class. This object can be provided to other SUNDIALS functions that expect a ``SUNMatrix`` object -via implicit conversion, or the ``Convert()`` method: +via implicit conversion, or the ``get()`` method: .. code-block:: cpp sundials::ginkgo::Matrix matrix{gko_matrix, sunctx}; - SUNMatrix I1 = matrix.Convert(); // explicit conversion to SUNMatrix + SUNMatrix I1 = matrix.get(); // explicit conversion to SUNMatrix SUNMatrix I2 = matrix; // implicit conversion to SUNMatrix No further interaction with ``matrix`` is required from this point, and it is possible to @@ -156,10 +156,10 @@ In this section we list the public API of the ``sundials::ginkgo::Matrix`` class Implicit conversion to a :c:type:`SUNMatrix`. - .. cpp:function:: SUNMatrix Convert() override + .. cpp:function:: SUNMatrix get() override Explicit conversion to a :c:type:`SUNMatrix`. - .. cpp:function:: SUNMatrix Convert() const override + .. cpp:function:: SUNMatrix get() const override Explicit conversion to a :c:type:`SUNMatrix`. diff --git a/doc/shared/sunmatrix/SUNMatrix_KokkosDense.rst b/doc/shared/sunmatrix/SUNMatrix_KokkosDense.rst index 765e19fe98..0c9d618f4d 100644 --- a/doc/shared/sunmatrix/SUNMatrix_KokkosDense.rst +++ b/doc/shared/sunmatrix/SUNMatrix_KokkosDense.rst @@ -69,14 +69,14 @@ the Kokkos dense matrix e.g., sunctx}; Instances of the ``DenseMatrix`` class are implicitly or explicitly (using the -:cpp:func:`~DenseMatrix::Convert` method) convertible to a :c:type:`SUNMatrix` +:cpp:func:`~DenseMatrix::get` method) convertible to a :c:type:`SUNMatrix` e.g., .. code-block:: cpp sundials::kokkos::DenseMatrix<> A{rows, cols, sunctx}; SUNMatrix B = A; // implicit conversion to SUNMatrix - SUNMatrix C = A.Convert(); // explicit conversion to SUNMatrix + SUNMatrix C = A.get(); // explicit conversion to SUNMatrix No further interaction with a ``DenseMatrix`` is required from this point, and it is possible to use the :c:type:`SUNMatrix` API to operate on ``B`` or ``C``. @@ -232,11 +232,11 @@ class. Implicit conversion to a :c:type:`SUNMatrix`. - .. cpp:function:: SUNMatrix Convert() override + .. cpp:function:: SUNMatrix get() override Explicit conversion to a :c:type:`SUNMatrix`. - .. cpp:function:: SUNMatrix Convert() const override + .. cpp:function:: SUNMatrix get() const override Explicit conversion to a :c:type:`SUNMatrix`. diff --git a/examples/cvode/kokkos/cv_bruss_batched_kokkos.cpp b/examples/cvode/kokkos/cv_bruss_batched_kokkos.cpp index 316851a6d0..88a7f18df5 100644 --- a/examples/cvode/kokkos/cv_bruss_batched_kokkos.cpp +++ b/examples/cvode/kokkos/cv_bruss_batched_kokkos.cpp @@ -243,7 +243,7 @@ int main(int argc, char* argv[]) LS = std::make_unique(sunctx); // Attach the matrix and linear solver to CVODE - retval = CVodeSetLinearSolver(cvode_mem, LS->Convert(), A->Convert()); + retval = CVodeSetLinearSolver(cvode_mem, LS->get(), A->get()); if (check_flag(retval, "CVodeSetLinearSolver")) { return 1; } // Set the user-supplied Jacobian function @@ -257,7 +257,7 @@ int main(int argc, char* argv[]) SUNLinSol_SPGMR(y, SUN_PREC_NONE, 0, sunctx)); // Attach the linear solver to CVODE - retval = CVodeSetLinearSolver(cvode_mem, LS->Convert(), nullptr); + retval = CVodeSetLinearSolver(cvode_mem, LS->get(), nullptr); if (check_flag(retval, "CVodeSetLinearSolver")) { return 1; } } diff --git a/examples/cvode/kokkos/cv_bruss_batched_kokkos_2D.cpp b/examples/cvode/kokkos/cv_bruss_batched_kokkos_2D.cpp index 7507e8f15b..1432efab39 100644 --- a/examples/cvode/kokkos/cv_bruss_batched_kokkos_2D.cpp +++ b/examples/cvode/kokkos/cv_bruss_batched_kokkos_2D.cpp @@ -255,7 +255,7 @@ int main(int argc, char* argv[]) LS = std::make_unique(sunctx); // Attach the matrix and linear solver to CVODE - retval = CVodeSetLinearSolver(cvode_mem, LS->Convert(), A->Convert()); + retval = CVodeSetLinearSolver(cvode_mem, LS->get(), A->get()); if (check_flag(retval, "CVodeSetLinearSolver")) { return 1; } // Set the user-supplied Jacobian function @@ -269,7 +269,7 @@ int main(int argc, char* argv[]) SUNLinSol_SPGMR(y, SUN_PREC_NONE, 0, sunctx)); // Attach the linear solver to CVODE - retval = CVodeSetLinearSolver(cvode_mem, LS->Convert(), nullptr); + retval = CVodeSetLinearSolver(cvode_mem, LS->get(), nullptr); if (check_flag(retval, "CVodeSetLinearSolver")) { return 1; } } diff --git a/include/arkode/arkode.h b/include/arkode/arkode.h index 046c52f336..e6a587f36b 100644 --- a/include/arkode/arkode.h +++ b/include/arkode/arkode.h @@ -163,7 +163,7 @@ extern "C" { typedef int (*ARKRhsFn)(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); -typedef int (*ARKRootFn)(sunrealtype t, N_Vector y, sunrealtype* gout, +typedef int (*ARKRootFn)(sunrealtype t, N_Vector y, sunrealtype1d gout, void* user_data); typedef int (*ARKEwtFn)(N_Vector y, N_Vector ewt, void* user_data); @@ -197,24 +197,31 @@ typedef _SUNDIALS_STRUCT_ _MRIStepInnerStepper* MRIStepInnerStepper; /* -------------------------- * Relaxation Solver Options * -------------------------- */ - -typedef enum +enum ARKRelaxSolver { ARK_RELAX_BRENT, ARK_RELAX_NEWTON -} ARKRelaxSolver; +}; + +#ifndef SWIG +typedef enum ARKRelaxSolver ARKRelaxSolver; +#endif /* -------------------------- * Error Accumulation Options * -------------------------- */ -typedef enum +enum ARKAccumError { ARK_ACCUMERROR_NONE, ARK_ACCUMERROR_MAX, ARK_ACCUMERROR_SUM, ARK_ACCUMERROR_AVG -} ARKAccumError; +}; + +#ifndef SWIG +typedef enum ARKAccumError ARKAccumError; +#endif /* -------------------------- * Shared API routines diff --git a/include/arkode/arkode.hpp b/include/arkode/arkode.hpp new file mode 100644 index 0000000000..1f11e5d1ee --- /dev/null +++ b/include/arkode/arkode.hpp @@ -0,0 +1,76 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * ----------------------------------------------------------------------------- + * C++ specific ARKODE definitions. + * ---------------------------------------------------------------------------*/ + +#ifndef _SUNDIALS_ARKODE_HPP +#define _SUNDIALS_ARKODE_HPP + +#include +#include + +namespace sundials { +namespace experimental { + +struct ARKodeDeleter +{ + void operator()(void* v) + { + if (v) { ARKodeFree(&v); } + } +}; + +class ARKodeView : public ClassView +{ +public: + using ClassView::ClassView; + template + static ARKodeView Create(Args&&... args); +}; + +template +ARKodeView ARKodeView::Create(Args&&... args) +{ + return ARKodeView(std::forward(args)...); +} + +struct ARKodeButcherTableDeleter +{ + void operator()(ARKodeButcherTable t) + { + if (t) { ARKodeButcherTable_Free(t); } + } +}; + +class ARKodeButcherTableView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static ARKodeButcherTableView Create(Args&&... args); +}; + +template +ARKodeButcherTableView ARKodeButcherTableView::Create(Args&&... args) +{ + ARKodeButcherTable table = + ARKodeButcherTable_Create(std::forward(args)...); + return ARKodeButcherTableView(table); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/arkode/arkode_arkstep.h b/include/arkode/arkode_arkstep.h index 8500723cff..33723f1e26 100644 --- a/include/arkode/arkode_arkstep.h +++ b/include/arkode/arkode_arkstep.h @@ -18,6 +18,7 @@ #define _ARKSTEP_H #include +#include #include #include #include @@ -100,312 +101,6 @@ SUNDIALS_EXPORT int ARKStepGetTimestepperStats( long int* step_attempts, long int* nfe_evals, long int* nfi_evals, long int* nlinsetups, long int* netfails); -/* -------------------------------------------------------------------------- - * Deprecated Functions -- all are superseded by shared ARKODE-level routines - * -------------------------------------------------------------------------- */ - -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeCreateMRIStepInnerStepper instead") -int ARKStepCreateMRIStepInnerStepper(void* arkode_mem, - MRIStepInnerStepper* stepper); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") -int ARKStepResize(void* arkode_mem, N_Vector ynew, sunrealtype hscale, - sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") -int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") -int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") -int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") -int ARKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResStolerance instead") -int ARKStepResStolerance(void* arkode_mem, sunrealtype rabstol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResVtolerance instead") -int ARKStepResVtolerance(void* arkode_mem, N_Vector rabstol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResFtolerance instead") -int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolver instead") -int ARKStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassLinearSolver instead") -int ARKStepSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, - SUNMatrix M, sunbooleantype time_dep); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") -int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") -int ARKStepSetDefaults(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("adjust parameters individually instead") -int ARKStepSetOptimalParams(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") -int ARKStepSetOrder(void* arkode_mem, int maxord); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") -int ARKStepSetInterpolantType(void* arkode_mem, int itype); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") -int ARKStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") -int ARKStepSetDenseOrder(void* arkode_mem, int dord); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinearSolver instead") -int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNlsRhsFn instead") -int ARKStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinear instead") -int ARKStepSetLinear(void* arkode_mem, int timedepend); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinear instead") -int ARKStepSetNonlinear(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeduceImplicitRhs instead") -int ARKStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptController instead") -int ARKStepSetAdaptController(void* arkode_mem, SUNAdaptController C); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptivityAdjustment instead") -int ARKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetCFLFraction instead") -int ARKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSafetyFactor instead") -int ARKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety); -SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") -int ARKStepSetErrorBias(void* arkode_mem, sunrealtype bias); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxGrowth instead") -int ARKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinReduction instead") -int ARKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStepBounds instead") -int ARKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub); -SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") -int ARKStepSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, - int pq, sunrealtype adapt_params[3]); -SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") -int ARKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxFirstGrowth instead") -int ARKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxEFailGrowth instead") -int ARKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSmallNumEFails instead") -int ARKStepSetSmallNumEFails(void* arkode_mem, int small_nef); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxCFailGrowth instead") -int ARKStepSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinCRDown instead") -int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinRDiv instead") -int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeltaGammaMax instead") -int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSetupFrequency instead") -int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPredictorMethod instead") -int ARKStepSetPredictorMethod(void* arkode_mem, int method); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStabilityFn instead") -int ARKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxErrTestFails instead") -int ARKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNonlinIters instead") -int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxConvFails instead") -int ARKStepSetMaxConvFails(void* arkode_mem, int maxncf); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinConvCoef instead") -int ARKStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetConstraints instead") -int ARKStepSetConstraints(void* arkode_mem, N_Vector constraints); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") -int ARKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") -int ARKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInitStep instead") -int ARKStepSetInitStep(void* arkode_mem, sunrealtype hin); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinStep instead") -int ARKStepSetMinStep(void* arkode_mem, sunrealtype hmin); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxStep instead") -int ARKStepSetMaxStep(void* arkode_mem, sunrealtype hmax); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") -int ARKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") -int ARKStepSetStopTime(void* arkode_mem, sunrealtype tstop); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") -int ARKStepClearStopTime(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") -int ARKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumConstrFails instead") -int ARKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") -int ARKStepSetRootDirection(void* arkode_mem, int* rootdir); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") -int ARKStepSetNoInactiveRootWarn(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") -int ARKStepSetUserData(void* arkode_mem, void* user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") -int ARKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") -int ARKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStagePredictFn instead") -int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacFn instead") -int ARKStepSetJacFn(void* arkode_mem, ARKLsJacFn jac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassFn instead") -int ARKStepSetMassFn(void* arkode_mem, ARKLsMassFn mass); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacEvalFrequency instead") -int ARKStepSetJacEvalFrequency(void* arkode_mem, long int msbj); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolutionScaling instead") -int ARKStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetEpsLin instead") -int ARKStepSetEpsLin(void* arkode_mem, sunrealtype eplifac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassEpsLin instead") -int ARKStepSetMassEpsLin(void* arkode_mem, sunrealtype eplifac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSNormFactor instead") -int ARKStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassLSNormFactor instead") -int ARKStepSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPreconditioner instead") -int ARKStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, - ARKLsPrecSolveFn psolve); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassPreconditioner instead") -int ARKStepSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, - ARKLsMassPrecSolveFn psolve); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimes instead") -int ARKStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, - ARKLsJacTimesVecFn jtimes); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimesRhsFn instead") -int ARKStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassTimes instead") -int ARKStepSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn msetup, - ARKLsMassTimesVecFn mtimes, void* mtimes_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinSysFn instead") -int ARKStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") -int ARKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") -int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeComputeState instead") -int ARKStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumExpSteps instead") -int ARKStepGetNumExpSteps(void* arkode_mem, long int* expsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumAccSteps instead") -int ARKStepGetNumAccSteps(void* arkode_mem, long int* accsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepAttempts instead") -int ARKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinSolvSetups instead") -int ARKStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumErrTestFails instead") -int ARKStepGetNumErrTestFails(void* arkode_mem, long int* netfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetEstLocalErrors instead") -int ARKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele); -SUNDIALS_DEPRECATED_EXPORT_MSG( - "Work space functions will be removed in version 8.0.0") -int ARKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") -int ARKStepGetNumSteps(void* arkode_mem, long int* nsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetActualInitStep instead") -int ARKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") -int ARKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentStep instead") -int ARKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") -int ARKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") -int ARKStepGetCurrentState(void* arkode_mem, N_Vector* state); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentGamma instead") -int ARKStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentMassMatrix instead") -int ARKStepGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") -int ARKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") -int ARKStepGetErrWeights(void* arkode_mem, N_Vector eweight); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetResWeights instead") -int ARKStepGetResWeights(void* arkode_mem, N_Vector rweight); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") -int ARKStepGetNumGEvals(void* arkode_mem, long int* ngevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") -int ARKStepGetRootInfo(void* arkode_mem, int* rootsfound); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumConstrFails instead") -int ARKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") -int ARKStepGetUserData(void* arkode_mem, void** user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") -int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") -char* ARKStepGetReturnFlagName(long int flag); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") -int ARKStepWriteParameters(void* arkode_mem, FILE* fp); -SUNDIALS_DEPRECATED_EXPORT_MSG( - "use ARKStepGetCurrentButcherTables and ARKodeButcherTable_Write instead") -int ARKStepWriteButcher(void* arkode_mem, FILE* fp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") -int ARKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, - sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinearSystemData instead") -int ARKStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, - N_Vector* zpred, N_Vector* z, N_Vector* Fi, - sunrealtype* gamma, N_Vector* sdata, - void** user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvIters instead") -int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvConvFails instead") -int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinSolvStats instead") -int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, - long int* nnfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepSolveFails instead") -int ARKStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJac instead") -int ARKStepGetJac(void* arkode_mem, SUNMatrix* J); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacTime instead") -int ARKStepGetJacTime(void* arkode_mem, sunrealtype* t_J); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacNumSteps instead") -int ARKStepGetJacNumSteps(void* arkode_mem, long int* nst_J); -SUNDIALS_DEPRECATED_EXPORT_MSG( - "Work space functions will be removed in version 8.0.0") -int ARKStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, - long int* leniwLS); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJacEvals instead") -int ARKStepGetNumJacEvals(void* arkode_mem, long int* njevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecEvals instead") -int ARKStepGetNumPrecEvals(void* arkode_mem, long int* npevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecSolves instead") -int ARKStepGetNumPrecSolves(void* arkode_mem, long int* npsolves); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinIters instead") -int ARKStepGetNumLinIters(void* arkode_mem, long int* nliters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinConvFails instead") -int ARKStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJTSetupEvals instead") -int ARKStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJtimesEvals instead") -int ARKStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinRhsEvals instead") -int ARKStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastLinFlag instead") -int ARKStepGetLastLinFlag(void* arkode_mem, long int* flag); - -SUNDIALS_DEPRECATED_EXPORT_MSG( - "Work space functions will be removed in version 8.0.0") -int ARKStepGetMassWorkSpace(void* arkode_mem, long int* lenrwMLS, - long int* leniwMLS); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassSetups instead") -int ARKStepGetNumMassSetups(void* arkode_mem, long int* nmsetups); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassMultSetups instead") -int ARKStepGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassMult instead") -int ARKStepGetNumMassMult(void* arkode_mem, long int* nmvevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassSolves instead") -int ARKStepGetNumMassSolves(void* arkode_mem, long int* nmsolves); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassPrecEvals instead") -int ARKStepGetNumMassPrecEvals(void* arkode_mem, long int* nmpevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassPrecSolves instead") -int ARKStepGetNumMassPrecSolves(void* arkode_mem, long int* nmpsolves); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassIters instead") -int ARKStepGetNumMassIters(void* arkode_mem, long int* nmiters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassConvFails instead") -int ARKStepGetNumMassConvFails(void* arkode_mem, long int* nmcfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMTSetups instead") -int ARKStepGetNumMTSetups(void* arkode_mem, long int* nmtsetups); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastMassFlag instead") -int ARKStepGetLastMassFlag(void* arkode_mem, long int* flag); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinReturnFlagName instead") -char* ARKStepGetLinReturnFlagName(long int flag); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") -void ARKStepFree(void** arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") -void ARKStepPrintMem(void* arkode_mem, FILE* outfile); - /* Adjoint solver functions */ SUNDIALS_EXPORT int ARKStepCreateAdjointStepper(void* arkode_mem, SUNAdjRhsFn adj_fe, @@ -413,41 +108,6 @@ int ARKStepCreateAdjointStepper(void* arkode_mem, SUNAdjRhsFn adj_fe, SUNContext sunctx, SUNAdjointStepper* adj_stepper_ptr); -/* Relaxation functions */ -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxFn instead") -int ARKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxEtaFail instead") -int ARKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxLowerBound instead") -int ARKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxFails instead") -int ARKStepSetRelaxMaxFails(void* arkode_mem, int max_fails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxIters instead") -int ARKStepSetRelaxMaxIters(void* arkode_mem, int max_iters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxSolver instead") -int ARKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxResTol instead") -int ARKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxTol instead") -int ARKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, - sunrealtype abs_tol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxUpperBound instead") -int ARKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFnEvals instead") -int ARKStepGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxJacEvals instead") -int ARKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFails instead") -int ARKStepGetNumRelaxFails(void* arkode_mem, long int* relax_fails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxBoundFails instead") -int ARKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveFails instead") -int ARKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveIters instead") -int ARKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") -int ARKStepGetNumRhsEvals(void* arkode_mem, long int* nfe_evals, - long int* nfi_evals); #ifdef __cplusplus } #endif diff --git a/include/arkode/arkode_arkstep_deprecated.h b/include/arkode/arkode_arkstep_deprecated.h new file mode 100644 index 0000000000..b8773e856f --- /dev/null +++ b/include/arkode/arkode_arkstep_deprecated.h @@ -0,0 +1,371 @@ +/* ----------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * -----------------------------------------------------------------*/ + +#ifndef _ARKSTEP_DEPRECATED_H +#define _ARKSTEP_DEPRECATED_H + +#include +#include + +#ifdef __cplusplus /* wrapper to enable C++ usage */ +extern "C" { +#endif + +/* -------------------------------------------------------------------------- + * Deprecated Functions -- all are superseded by shared ARKODE-level routines + * -------------------------------------------------------------------------- */ + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeCreateMRIStepInnerStepper instead") +int ARKStepCreateMRIStepInnerStepper(void* arkode_mem, + MRIStepInnerStepper* stepper); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") +int ARKStepResize(void* arkode_mem, N_Vector ynew, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") +int ARKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") +int ARKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") +int ARKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") +int ARKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResStolerance instead") +int ARKStepResStolerance(void* arkode_mem, sunrealtype rabstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResVtolerance instead") +int ARKStepResVtolerance(void* arkode_mem, N_Vector rabstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResFtolerance instead") +int ARKStepResFtolerance(void* arkode_mem, ARKRwtFn rfun); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolver instead") +int ARKStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassLinearSolver instead") +int ARKStepSetMassLinearSolver(void* arkode_mem, SUNLinearSolver LS, + SUNMatrix M, sunbooleantype time_dep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") +int ARKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") +int ARKStepSetDefaults(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("adjust parameters individually instead") +int ARKStepSetOptimalParams(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") +int ARKStepSetOrder(void* arkode_mem, int maxord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") +int ARKStepSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int ARKStepSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int ARKStepSetDenseOrder(void* arkode_mem, int dord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinearSolver instead") +int ARKStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNlsRhsFn instead") +int ARKStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fi); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinear instead") +int ARKStepSetLinear(void* arkode_mem, int timedepend); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinear instead") +int ARKStepSetNonlinear(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeduceImplicitRhs instead") +int ARKStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptController instead") +int ARKStepSetAdaptController(void* arkode_mem, SUNAdaptController C); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptivityAdjustment instead") +int ARKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetCFLFraction instead") +int ARKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSafetyFactor instead") +int ARKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety); +SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") +int ARKStepSetErrorBias(void* arkode_mem, sunrealtype bias); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxGrowth instead") +int ARKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinReduction instead") +int ARKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStepBounds instead") +int ARKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub); +SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") +int ARKStepSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, + int pq, sunrealtype adapt_params[3]); +SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") +int ARKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxFirstGrowth instead") +int ARKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxEFailGrowth instead") +int ARKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSmallNumEFails instead") +int ARKStepSetSmallNumEFails(void* arkode_mem, int small_nef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxCFailGrowth instead") +int ARKStepSetMaxCFailGrowth(void* arkode_mem, sunrealtype etacf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinCRDown instead") +int ARKStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinRDiv instead") +int ARKStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeltaGammaMax instead") +int ARKStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSetupFrequency instead") +int ARKStepSetLSetupFrequency(void* arkode_mem, int msbp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPredictorMethod instead") +int ARKStepSetPredictorMethod(void* arkode_mem, int method); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStabilityFn instead") +int ARKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxErrTestFails instead") +int ARKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNonlinIters instead") +int ARKStepSetMaxNonlinIters(void* arkode_mem, int maxcor); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxConvFails instead") +int ARKStepSetMaxConvFails(void* arkode_mem, int maxncf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinConvCoef instead") +int ARKStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetConstraints instead") +int ARKStepSetConstraints(void* arkode_mem, N_Vector constraints); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") +int ARKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") +int ARKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInitStep instead") +int ARKStepSetInitStep(void* arkode_mem, sunrealtype hin); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinStep instead") +int ARKStepSetMinStep(void* arkode_mem, sunrealtype hmin); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxStep instead") +int ARKStepSetMaxStep(void* arkode_mem, sunrealtype hmax); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") +int ARKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") +int ARKStepSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") +int ARKStepClearStopTime(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") +int ARKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumConstrFails instead") +int ARKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") +int ARKStepSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") +int ARKStepSetNoInactiveRootWarn(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") +int ARKStepSetUserData(void* arkode_mem, void* user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") +int ARKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") +int ARKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStagePredictFn instead") +int ARKStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacFn instead") +int ARKStepSetJacFn(void* arkode_mem, ARKLsJacFn jac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassFn instead") +int ARKStepSetMassFn(void* arkode_mem, ARKLsMassFn mass); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacEvalFrequency instead") +int ARKStepSetJacEvalFrequency(void* arkode_mem, long int msbj); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolutionScaling instead") +int ARKStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetEpsLin instead") +int ARKStepSetEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassEpsLin instead") +int ARKStepSetMassEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSNormFactor instead") +int ARKStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassLSNormFactor instead") +int ARKStepSetMassLSNormFactor(void* arkode_mem, sunrealtype nrmfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPreconditioner instead") +int ARKStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, + ARKLsPrecSolveFn psolve); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassPreconditioner instead") +int ARKStepSetMassPreconditioner(void* arkode_mem, ARKLsMassPrecSetupFn psetup, + ARKLsMassPrecSolveFn psolve); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimes instead") +int ARKStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, + ARKLsJacTimesVecFn jtimes); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimesRhsFn instead") +int ARKStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMassTimes instead") +int ARKStepSetMassTimes(void* arkode_mem, ARKLsMassTimesSetupFn msetup, + ARKLsMassTimesVecFn mtimes, void* mtimes_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinSysFn instead") +int ARKStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") +int ARKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") +int ARKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeComputeState instead") +int ARKStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumExpSteps instead") +int ARKStepGetNumExpSteps(void* arkode_mem, long int* expsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumAccSteps instead") +int ARKStepGetNumAccSteps(void* arkode_mem, long int* accsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepAttempts instead") +int ARKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinSolvSetups instead") +int ARKStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumErrTestFails instead") +int ARKStepGetNumErrTestFails(void* arkode_mem, long int* netfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetEstLocalErrors instead") +int ARKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele); +SUNDIALS_DEPRECATED_EXPORT_MSG( + "Work space functions will be removed in version 8.0.0") +int ARKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") +int ARKStepGetNumSteps(void* arkode_mem, long int* nsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetActualInitStep instead") +int ARKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") +int ARKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentStep instead") +int ARKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") +int ARKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") +int ARKStepGetCurrentState(void* arkode_mem, N_Vector* state); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentGamma instead") +int ARKStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentMassMatrix instead") +int ARKStepGetCurrentMassMatrix(void* arkode_mem, SUNMatrix* M); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") +int ARKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") +int ARKStepGetErrWeights(void* arkode_mem, N_Vector eweight); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetResWeights instead") +int ARKStepGetResWeights(void* arkode_mem, N_Vector rweight); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") +int ARKStepGetNumGEvals(void* arkode_mem, long int* ngevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") +int ARKStepGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumConstrFails instead") +int ARKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") +int ARKStepGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") +int ARKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") +char* ARKStepGetReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") +int ARKStepWriteParameters(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG( + "use ARKStepGetCurrentButcherTables and ARKodeButcherTable_Write instead") +int ARKStepWriteButcher(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") +int ARKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, + sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinearSystemData instead") +int ARKStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* Fi, + sunrealtype* gamma, N_Vector* sdata, + void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvIters instead") +int ARKStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvConvFails instead") +int ARKStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinSolvStats instead") +int ARKStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepSolveFails instead") +int ARKStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJac instead") +int ARKStepGetJac(void* arkode_mem, SUNMatrix* J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacTime instead") +int ARKStepGetJacTime(void* arkode_mem, sunrealtype* t_J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacNumSteps instead") +int ARKStepGetJacNumSteps(void* arkode_mem, long int* nst_J); +SUNDIALS_DEPRECATED_EXPORT_MSG( + "Work space functions will be removed in version 8.0.0") +int ARKStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, + long int* leniwLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJacEvals instead") +int ARKStepGetNumJacEvals(void* arkode_mem, long int* njevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecEvals instead") +int ARKStepGetNumPrecEvals(void* arkode_mem, long int* npevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecSolves instead") +int ARKStepGetNumPrecSolves(void* arkode_mem, long int* npsolves); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinIters instead") +int ARKStepGetNumLinIters(void* arkode_mem, long int* nliters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinConvFails instead") +int ARKStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJTSetupEvals instead") +int ARKStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJtimesEvals instead") +int ARKStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinRhsEvals instead") +int ARKStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastLinFlag instead") +int ARKStepGetLastLinFlag(void* arkode_mem, long int* flag); + +SUNDIALS_DEPRECATED_EXPORT_MSG( + "Work space functions will be removed in version 8.0.0") +int ARKStepGetMassWorkSpace(void* arkode_mem, long int* lenrwMLS, + long int* leniwMLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassSetups instead") +int ARKStepGetNumMassSetups(void* arkode_mem, long int* nmsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassMultSetups instead") +int ARKStepGetNumMassMultSetups(void* arkode_mem, long int* nmvsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassMult instead") +int ARKStepGetNumMassMult(void* arkode_mem, long int* nmvevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassSolves instead") +int ARKStepGetNumMassSolves(void* arkode_mem, long int* nmsolves); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassPrecEvals instead") +int ARKStepGetNumMassPrecEvals(void* arkode_mem, long int* nmpevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassPrecSolves instead") +int ARKStepGetNumMassPrecSolves(void* arkode_mem, long int* nmpsolves); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassIters instead") +int ARKStepGetNumMassIters(void* arkode_mem, long int* nmiters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMassConvFails instead") +int ARKStepGetNumMassConvFails(void* arkode_mem, long int* nmcfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumMTSetups instead") +int ARKStepGetNumMTSetups(void* arkode_mem, long int* nmtsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastMassFlag instead") +int ARKStepGetLastMassFlag(void* arkode_mem, long int* flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinReturnFlagName instead") +char* ARKStepGetLinReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") +void ARKStepFree(void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") +void ARKStepPrintMem(void* arkode_mem, FILE* outfile); + +/* Relaxation functions */ +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxFn instead") +int ARKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxEtaFail instead") +int ARKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxLowerBound instead") +int ARKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxFails instead") +int ARKStepSetRelaxMaxFails(void* arkode_mem, int max_fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxIters instead") +int ARKStepSetRelaxMaxIters(void* arkode_mem, int max_iters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxSolver instead") +int ARKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxResTol instead") +int ARKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxTol instead") +int ARKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, + sunrealtype abs_tol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxUpperBound instead") +int ARKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFnEvals instead") +int ARKStepGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxJacEvals instead") +int ARKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFails instead") +int ARKStepGetNumRelaxFails(void* arkode_mem, long int* relax_fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxBoundFails instead") +int ARKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveFails instead") +int ARKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveIters instead") +int ARKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") +int ARKStepGetNumRhsEvals(void* arkode_mem, long int* nfe_evals, + long int* nfi_evals); + +#ifdef __cplusplus +} +#endif + +#endif /* _ARKSTEP_DEPRECATED_H */ diff --git a/include/arkode/arkode_butcher.h b/include/arkode/arkode_butcher.h index 798957904d..1f2759e924 100644 --- a/include/arkode/arkode_butcher.h +++ b/include/arkode/arkode_butcher.h @@ -32,10 +32,10 @@ struct ARKodeButcherTableMem int q; /* method order of accuracy */ int p; /* embedding order of accuracy */ int stages; /* number of stages */ - sunrealtype** A; /* Butcher table coefficients */ - sunrealtype* c; /* canopy node coefficients */ - sunrealtype* b; /* root node coefficients */ - sunrealtype* d; /* embedding coefficients */ + sunrealtype2d A; /* Butcher table coefficients */ + sunrealtype1d c; /* canopy node coefficients */ + sunrealtype1d b; /* root node coefficients */ + sunrealtype1d d; /* embedding coefficients */ }; typedef _SUNDIALS_STRUCT_ ARKodeButcherTableMem* ARKodeButcherTable; @@ -44,10 +44,10 @@ typedef _SUNDIALS_STRUCT_ ARKodeButcherTableMem* ARKodeButcherTable; SUNDIALS_EXPORT ARKodeButcherTable ARKodeButcherTable_Alloc(int stages, sunbooleantype embedded); SUNDIALS_EXPORT ARKodeButcherTable ARKodeButcherTable_Create(int s, int q, int p, - sunrealtype* c, - sunrealtype* A, - sunrealtype* b, - sunrealtype* d); + sunrealtype1d c, + sunrealtype1d A, + sunrealtype1d b, + sunrealtype1d d); SUNDIALS_EXPORT ARKodeButcherTable ARKodeButcherTable_Copy(ARKodeButcherTable B); SUNDIALS_DEPRECATED_EXPORT_MSG( diff --git a/include/arkode/arkode_butcher_dirk.h b/include/arkode/arkode_butcher_dirk.h index 9aa37dddfe..efa556deb2 100644 --- a/include/arkode/arkode_butcher_dirk.h +++ b/include/arkode/arkode_butcher_dirk.h @@ -23,7 +23,7 @@ extern "C" { #endif -typedef enum +enum ARKODE_DIRKTableID { ARKODE_DIRK_NONE = -1, /* ensure enum is signed int */ ARKODE_MIN_DIRK_NUM = 100, @@ -55,7 +55,11 @@ typedef enum ARKODE_IMPLICIT_MIDPOINT_1_2, ARKODE_IMPLICIT_TRAPEZOIDAL_2_2, ARKODE_MAX_DIRK_NUM = ARKODE_IMPLICIT_TRAPEZOIDAL_2_2 -} ARKODE_DIRKTableID; +}; + +#ifndef SWIG +typedef enum ARKODE_DIRKTableID ARKODE_DIRKTableID; +#endif /* Accessor routine to load built-in DIRK table */ SUNDIALS_EXPORT ARKodeButcherTable diff --git a/include/arkode/arkode_butcher_erk.h b/include/arkode/arkode_butcher_erk.h index ec96c050c6..3c3198247e 100644 --- a/include/arkode/arkode_butcher_erk.h +++ b/include/arkode/arkode_butcher_erk.h @@ -23,7 +23,7 @@ extern "C" { #endif -typedef enum +enum ARKODE_ERKTableID { ARKODE_ERK_NONE = -1, /* ensure enum is signed int */ ARKODE_MIN_ERK_NUM = 0, @@ -55,7 +55,11 @@ typedef enum ARKODE_RALSTON_3_1_2, ARKODE_TSITOURAS_7_4_5, ARKODE_MAX_ERK_NUM = ARKODE_TSITOURAS_7_4_5 -} ARKODE_ERKTableID; +}; + +#ifndef SWIG +typedef enum ARKODE_ERKTableID ARKODE_ERKTableID; +#endif /* Accessor routine to load built-in ERK table */ SUNDIALS_EXPORT ARKodeButcherTable diff --git a/include/arkode/arkode_erkstep.h b/include/arkode/arkode_erkstep.h index 574c7fd3fd..6f9e2490e7 100644 --- a/include/arkode/arkode_erkstep.h +++ b/include/arkode/arkode_erkstep.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -75,186 +76,6 @@ int ERKStepCreateAdjointStepper(void* arkode_mem, SUNAdjRhsFn adj_f, sunrealtype tf, N_Vector sf, SUNContext sunctx, SUNAdjointStepper* adj_stepper_ptr); -/* -------------------------------------------------------------------------- - * Deprecated Functions -- all are superseded by shared ARKODE-level routines - * -------------------------------------------------------------------------- */ - -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") -int ERKStepResize(void* arkode_mem, N_Vector ynew, sunrealtype hscale, - sunrealtype t0, ARKVecResizeFn resize, void* resize_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") -int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") -int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") -int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") -int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") -int ERKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") -int ERKStepSetDefaults(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") -int ERKStepSetOrder(void* arkode_mem, int maxord); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") -int ERKStepSetInterpolantType(void* arkode_mem, int itype); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") -int ERKStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") -int ERKStepSetDenseOrder(void* arkode_mem, int dord); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptController instead") -int ERKStepSetAdaptController(void* arkode_mem, SUNAdaptController C); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptivityAdjustment instead") -int ERKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetCFLFraction instead") -int ERKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSafetyFactor instead") -int ERKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety); -SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") -int ERKStepSetErrorBias(void* arkode_mem, sunrealtype bias); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxGrowth instead") -int ERKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinReduction instead") -int ERKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStepBounds instead") -int ERKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub); -SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") -int ERKStepSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, - int pq, sunrealtype adapt_params[3]); -SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") -int ERKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxFirstGrowth instead") -int ERKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxEFailGrowth instead") -int ERKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSmallNumEFails instead") -int ERKStepSetSmallNumEFails(void* arkode_mem, int small_nef); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStabilityFn instead") -int ERKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxErrTestFails instead") -int ERKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetConstraints instead") -int ERKStepSetConstraints(void* arkode_mem, N_Vector constraints); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") -int ERKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") -int ERKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInitStep instead") -int ERKStepSetInitStep(void* arkode_mem, sunrealtype hin); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinStep instead") -int ERKStepSetMinStep(void* arkode_mem, sunrealtype hmin); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxStep instead") -int ERKStepSetMaxStep(void* arkode_mem, sunrealtype hmax); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") -int ERKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") -int ERKStepSetStopTime(void* arkode_mem, sunrealtype tstop); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") -int ERKStepClearStopTime(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") -int ERKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumConstrFails instead") -int ERKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") -int ERKStepSetRootDirection(void* arkode_mem, int* rootdir); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") -int ERKStepSetNoInactiveRootWarn(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") -int ERKStepSetUserData(void* arkode_mem, void* user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") -int ERKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") -int ERKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") -int ERKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") -int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumExpSteps instead") -int ERKStepGetNumExpSteps(void* arkode_mem, long int* expsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumAccSteps instead") -int ERKStepGetNumAccSteps(void* arkode_mem, long int* accsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepAttempts instead") -int ERKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumErrTestFails instead") -int ERKStepGetNumErrTestFails(void* arkode_mem, long int* netfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetEstLocalErrors instead") -int ERKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele); -SUNDIALS_DEPRECATED_EXPORT_MSG( - "Work space functions will be removed in version 8.0.0") -int ERKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") -int ERKStepGetNumSteps(void* arkode_mem, long int* nsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetActualInitStep instead") -int ERKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") -int ERKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentStep instead") -int ERKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") -int ERKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") -int ERKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") -int ERKStepGetErrWeights(void* arkode_mem, N_Vector eweight); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") -int ERKStepGetNumGEvals(void* arkode_mem, long int* ngevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") -int ERKStepGetRootInfo(void* arkode_mem, int* rootsfound); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumConstrFails instead") -int ERKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") -int ERKStepGetUserData(void* arkode_mem, void** user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") -int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") -char* ERKStepGetReturnFlagName(long int flag); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") -int ERKStepWriteParameters(void* arkode_mem, FILE* fp); -SUNDIALS_DEPRECATED_EXPORT_MSG( - "use ERKStepGetCurrentButcherTable and ARKodeButcherTable_Write instead") -int ERKStepWriteButcher(void* arkode_mem, FILE* fp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") -int ERKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, - sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") -void ERKStepFree(void** arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") -void ERKStepPrintMem(void* arkode_mem, FILE* outfile); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxFn instead") -int ERKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxEtaFail instead") -int ERKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxLowerBound instead") -int ERKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxFails instead") -int ERKStepSetRelaxMaxFails(void* arkode_mem, int max_fails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxIters instead") -int ERKStepSetRelaxMaxIters(void* arkode_mem, int max_iters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxSolver instead") -int ERKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxResTol instead") -int ERKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxTol instead") -int ERKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, - sunrealtype abs_tol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxUpperBound instead") -int ERKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFnEvals instead") -int ERKStepGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxJacEvals instead") -int ERKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFails instead") -int ERKStepGetNumRelaxFails(void* arkode_mem, long int* relax_fails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxBoundFails instead") -int ERKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveFails instead") -int ERKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveIters instead") -int ERKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") -int ERKStepGetNumRhsEvals(void* arkode_mem, long int* nfevals); - #ifdef __cplusplus } #endif diff --git a/include/arkode/arkode_erkstep_deprecated.h b/include/arkode/arkode_erkstep_deprecated.h new file mode 100644 index 0000000000..2a88ebb0be --- /dev/null +++ b/include/arkode/arkode_erkstep_deprecated.h @@ -0,0 +1,204 @@ +/* ----------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * -----------------------------------------------------------------*/ + +#ifndef _ERKSTEP_DEPRECATED_H +#define _ERKSTEP_DEPRECATED_H + +#include + +#ifdef __cplusplus /* wrapper to enable C++ usage */ +extern "C" { +#endif + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") +int ERKStepResize(void* arkode_mem, N_Vector ynew, sunrealtype hscale, + sunrealtype t0, ARKVecResizeFn resize, void* resize_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") +int ERKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") +int ERKStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") +int ERKStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") +int ERKStepWFtolerances(void* arkode_mem, ARKEwtFn efun); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") +int ERKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") +int ERKStepSetDefaults(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") +int ERKStepSetOrder(void* arkode_mem, int maxord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") +int ERKStepSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int ERKStepSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int ERKStepSetDenseOrder(void* arkode_mem, int dord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptController instead") +int ERKStepSetAdaptController(void* arkode_mem, SUNAdaptController C); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetAdaptivityAdjustment instead") +int ERKStepSetAdaptivityAdjustment(void* arkode_mem, int adjust); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetCFLFraction instead") +int ERKStepSetCFLFraction(void* arkode_mem, sunrealtype cfl_frac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSafetyFactor instead") +int ERKStepSetSafetyFactor(void* arkode_mem, sunrealtype safety); +SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") +int ERKStepSetErrorBias(void* arkode_mem, sunrealtype bias); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxGrowth instead") +int ERKStepSetMaxGrowth(void* arkode_mem, sunrealtype mx_growth); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinReduction instead") +int ERKStepSetMinReduction(void* arkode_mem, sunrealtype eta_min); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStepBounds instead") +int ERKStepSetFixedStepBounds(void* arkode_mem, sunrealtype lb, sunrealtype ub); +SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") +int ERKStepSetAdaptivityMethod(void* arkode_mem, int imethod, int idefault, + int pq, sunrealtype adapt_params[3]); +SUNDIALS_DEPRECATED_EXPORT_MSG("use SUNAdaptController instead") +int ERKStepSetAdaptivityFn(void* arkode_mem, ARKAdaptFn hfun, void* h_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxFirstGrowth instead") +int ERKStepSetMaxFirstGrowth(void* arkode_mem, sunrealtype etamx1); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxEFailGrowth instead") +int ERKStepSetMaxEFailGrowth(void* arkode_mem, sunrealtype etamxf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetSmallNumEFails instead") +int ERKStepSetSmallNumEFails(void* arkode_mem, int small_nef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStabilityFn instead") +int ERKStepSetStabilityFn(void* arkode_mem, ARKExpStabFn EStab, void* estab_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxErrTestFails instead") +int ERKStepSetMaxErrTestFails(void* arkode_mem, int maxnef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetConstraints instead") +int ERKStepSetConstraints(void* arkode_mem, N_Vector constraints); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") +int ERKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") +int ERKStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInitStep instead") +int ERKStepSetInitStep(void* arkode_mem, sunrealtype hin); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMinStep instead") +int ERKStepSetMinStep(void* arkode_mem, sunrealtype hmin); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxStep instead") +int ERKStepSetMaxStep(void* arkode_mem, sunrealtype hmax); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") +int ERKStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") +int ERKStepSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") +int ERKStepClearStopTime(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") +int ERKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumConstrFails instead") +int ERKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") +int ERKStepSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") +int ERKStepSetNoInactiveRootWarn(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") +int ERKStepSetUserData(void* arkode_mem, void* user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") +int ERKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") +int ERKStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") +int ERKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") +int ERKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumExpSteps instead") +int ERKStepGetNumExpSteps(void* arkode_mem, long int* expsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumAccSteps instead") +int ERKStepGetNumAccSteps(void* arkode_mem, long int* accsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepAttempts instead") +int ERKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumErrTestFails instead") +int ERKStepGetNumErrTestFails(void* arkode_mem, long int* netfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetEstLocalErrors instead") +int ERKStepGetEstLocalErrors(void* arkode_mem, N_Vector ele); +SUNDIALS_DEPRECATED_EXPORT_MSG( + "Work space functions will be removed in version 8.0.0") +int ERKStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") +int ERKStepGetNumSteps(void* arkode_mem, long int* nsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetActualInitStep instead") +int ERKStepGetActualInitStep(void* arkode_mem, sunrealtype* hinused); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") +int ERKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentStep instead") +int ERKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") +int ERKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") +int ERKStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") +int ERKStepGetErrWeights(void* arkode_mem, N_Vector eweight); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") +int ERKStepGetNumGEvals(void* arkode_mem, long int* ngevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") +int ERKStepGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumConstrFails instead") +int ERKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") +int ERKStepGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") +int ERKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") +char* ERKStepGetReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") +int ERKStepWriteParameters(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG( + "use ERKStepGetCurrentButcherTable and ARKodeButcherTable_Write instead") +int ERKStepWriteButcher(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") +int ERKStepGetStepStats(void* arkode_mem, long int* nsteps, sunrealtype* hinused, + sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") +void ERKStepFree(void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") +void ERKStepPrintMem(void* arkode_mem, FILE* outfile); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxFn instead") +int ERKStepSetRelaxFn(void* arkode_mem, ARKRelaxFn rfn, ARKRelaxJacFn rjac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxEtaFail instead") +int ERKStepSetRelaxEtaFail(void* arkode_mem, sunrealtype eta_rf); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxLowerBound instead") +int ERKStepSetRelaxLowerBound(void* arkode_mem, sunrealtype lower); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxFails instead") +int ERKStepSetRelaxMaxFails(void* arkode_mem, int max_fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxMaxIters instead") +int ERKStepSetRelaxMaxIters(void* arkode_mem, int max_iters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxSolver instead") +int ERKStepSetRelaxSolver(void* arkode_mem, ARKRelaxSolver solver); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxResTol instead") +int ERKStepSetRelaxResTol(void* arkode_mem, sunrealtype res_tol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxTol instead") +int ERKStepSetRelaxTol(void* arkode_mem, sunrealtype rel_tol, + sunrealtype abs_tol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRelaxUpperBound instead") +int ERKStepSetRelaxUpperBound(void* arkode_mem, sunrealtype upper); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFnEvals instead") +int ERKStepGetNumRelaxFnEvals(void* arkode_mem, long int* r_evals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxJacEvals instead") +int ERKStepGetNumRelaxJacEvals(void* arkode_mem, long int* J_evals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxFails instead") +int ERKStepGetNumRelaxFails(void* arkode_mem, long int* relax_fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxBoundFails instead") +int ERKStepGetNumRelaxBoundFails(void* arkode_mem, long int* fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveFails instead") +int ERKStepGetNumRelaxSolveFails(void* arkode_mem, long int* fails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRelaxSolveIters instead") +int ERKStepGetNumRelaxSolveIters(void* arkode_mem, long int* iters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") +int ERKStepGetNumRhsEvals(void* arkode_mem, long int* nfevals); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arkode/arkode_lsrkstep.h b/include/arkode/arkode_lsrkstep.h index a8262b2344..a2cbfec539 100644 --- a/include/arkode/arkode_lsrkstep.h +++ b/include/arkode/arkode_lsrkstep.h @@ -32,14 +32,18 @@ typedef int (*ARKDomEigFn)(sunrealtype t, N_Vector y, N_Vector fn, * LSRKStep Constants * ------------------ */ -typedef enum +enum ARKODE_LSRKMethodType { ARKODE_LSRK_RKC_2, ARKODE_LSRK_RKL_2, ARKODE_LSRK_SSP_S_2, ARKODE_LSRK_SSP_S_3, ARKODE_LSRK_SSP_10_4 -} ARKODE_LSRKMethodType; +}; + +#ifndef SWIG +typedef enum ARKODE_LSRKMethodType ARKODE_LSRKMethodType; +#endif /* ------------------- * Exported Functions diff --git a/include/arkode/arkode_mristep.h b/include/arkode/arkode_mristep.h index cb3cf3016d..efce5e9c9f 100644 --- a/include/arkode/arkode_mristep.h +++ b/include/arkode/arkode_mristep.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -34,21 +35,25 @@ extern "C" { * ----------------- */ /* MRIStep method types */ -typedef enum +enum MRISTEP_METHOD_TYPE { MRISTEP_EXPLICIT, MRISTEP_IMPLICIT, MRISTEP_IMEX, MRISTEP_MERK, MRISTEP_SR -} MRISTEP_METHOD_TYPE; +}; + +#ifndef SWIG +typedef enum MRISTEP_METHOD_TYPE MRISTEP_METHOD_TYPE; +#endif /* MRI coupling table IDs */ -typedef enum +enum ARKODE_MRITableID { ARKODE_MRI_NONE = -1, /* ensure enum is signed int */ ARKODE_MIN_MRI_NUM = 200, - ARKODE_MIS_KW3 = ARKODE_MIN_MRI_NUM, + ARKODE_MIS_KW3 = 200, ARKODE_MRI_GARK_ERK33a, ARKODE_MRI_GARK_ERK45a, ARKODE_MRI_GARK_IRK21a, @@ -75,7 +80,11 @@ typedef enum ARKODE_IMEX_MRI_SR32, ARKODE_IMEX_MRI_SR43, ARKODE_MAX_MRI_NUM = ARKODE_IMEX_MRI_SR43 -} ARKODE_MRITableID; +}; + +#ifndef SWIG +typedef enum ARKODE_MRITableID ARKODE_MRITableID; +#endif /* Default MRI coupling tables for each order and type */ static const int MRISTEP_DEFAULT_EXPL_1 = ARKODE_MRI_GARK_FORWARD_EULER; @@ -128,13 +137,13 @@ typedef int (*MRIStepInnerSetRTol)(MRIStepInnerStepper stepper, sunrealtype rtol struct MRIStepCouplingMem { MRISTEP_METHOD_TYPE type; /* flag to encode the MRI method type */ - int nmat; /* number of MRI coupling matrices */ - int stages; /* size of coupling matrices ((stages+1) * stages) */ - int q; /* method order of accuracy */ - int p; /* embedding order of accuracy */ - sunrealtype* c; /* stage abscissae */ - sunrealtype*** W; /* explicit coupling matrices [nmat][stages+1][stages] */ - sunrealtype*** G; /* implicit coupling matrices [nmat][stages+1][stages] */ + int nmat; /* number of MRI coupling matrices */ + int stages; /* size of coupling matrices ((stages+1) * stages) */ + int q; /* method order of accuracy */ + int p; /* embedding order of accuracy */ + sunrealtype1d c; /* stage abscissae */ + sunrealtype3d W; /* explicit coupling matrices [nmat][stages+1][stages] */ + sunrealtype3d G; /* implicit coupling matrices [nmat][stages+1][stages] */ int ngroup; /* number of stage groups (MERK-specific) */ int** group; /* stages to integrate together (MERK-specific) */ @@ -153,9 +162,9 @@ SUNDIALS_EXPORT MRIStepCoupling MRIStepCoupling_Alloc(int nmat, int stages, MRISTEP_METHOD_TYPE type); SUNDIALS_EXPORT MRIStepCoupling MRIStepCoupling_Create(int nmat, int stages, int q, int p, - sunrealtype* W, - sunrealtype* G, - sunrealtype* c); + sunrealtype1d W, + sunrealtype1d G, + sunrealtype1d c); SUNDIALS_EXPORT MRIStepCoupling MRIStepCoupling_MIStoMRI(ARKodeButcherTable B, int q, int p); SUNDIALS_EXPORT MRIStepCoupling MRIStepCoupling_Copy(MRIStepCoupling MRIC); @@ -170,7 +179,7 @@ SUNDIALS_EXPORT void MRIStepCoupling_Write(MRIStepCoupling MRIC, FILE* outfile); * User-Supplied Function Types * ------------------------------ */ -typedef int (*MRIStepPreInnerFn)(sunrealtype t, N_Vector* f, int nvecs, +typedef int (*MRIStepPreInnerFn)(sunrealtype t, N_Vector1d f, int nvecs, void* user_data); typedef int (*MRIStepPostInnerFn)(sunrealtype t, N_Vector y, void* user_data); @@ -230,196 +239,6 @@ SUNDIALS_EXPORT int MRIStepInnerStepper_GetForcingData( MRIStepInnerStepper stepper, sunrealtype* tshift, sunrealtype* tscale, N_Vector** forcing, int* nforcing); -/* -------------------------------------------------------------------------- - * Deprecated Functions -- all are superseded by shared ARKODE-level routines - * -------------------------------------------------------------------------- */ - -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") -int MRIStepResize(void* arkode_mem, N_Vector ynew, sunrealtype t0, - ARKVecResizeFn resize, void* resize_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") -int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") -int MRIStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") -int MRIStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") -int MRIStepWFtolerances(void* arkode_mem, ARKEwtFn efun); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolver instead") -int MRIStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") -int MRIStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") -int MRIStepSetDefaults(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") -int MRIStepSetOrder(void* arkode_mem, int ord); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") -int MRIStepSetInterpolantType(void* arkode_mem, int itype); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") -int MRIStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") -int MRIStepSetDenseOrder(void* arkode_mem, int dord); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinearSolver instead") -int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNlsRhsFn instead") -int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fs); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinear instead") -int MRIStepSetLinear(void* arkode_mem, int timedepend); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinear instead") -int MRIStepSetNonlinear(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") -int MRIStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinCRDown instead") -int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinRDiv instead") -int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeltaGammaMax instead") -int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSetupFrequency instead") -int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPredictorMethod instead") -int MRIStepSetPredictorMethod(void* arkode_mem, int method); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNonlinIters instead") -int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinConvCoef instead") -int MRIStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") -int MRIStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") -int MRIStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") -int MRIStepSetStopTime(void* arkode_mem, sunrealtype tstop); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") -int MRIStepClearStopTime(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") -int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hsfixed); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") -int MRIStepSetRootDirection(void* arkode_mem, int* rootdir); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") -int MRIStepSetNoInactiveRootWarn(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") -int MRIStepSetUserData(void* arkode_mem, void* user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") -int MRIStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") -int MRIStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStagePredictFn instead") -int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeduceImplicitRhs instead") -int MRIStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacFn instead") -int MRIStepSetJacFn(void* arkode_mem, ARKLsJacFn jac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacEvalFrequency instead") -int MRIStepSetJacEvalFrequency(void* arkode_mem, long int msbj); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolutionScaling instead") -int MRIStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetEpsLin instead") -int MRIStepSetEpsLin(void* arkode_mem, sunrealtype eplifac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSNormFactor instead") -int MRIStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPreconditioner instead") -int MRIStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, - ARKLsPrecSolveFn psolve); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimes instead") -int MRIStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, - ARKLsJacTimesVecFn jtimes); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimesRhsFn instead") -int MRIStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinSysFn instead") -int MRIStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") -int MRIStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") -int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeComputeState instead") -int MRIStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinSolvSetups instead") -int MRIStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); -SUNDIALS_DEPRECATED_EXPORT_MSG( - "Work space functions will be removed in version 8.0.0") -int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") -int MRIStepGetNumSteps(void* arkode_mem, long int* nssteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") -int MRIStepGetLastStep(void* arkode_mem, sunrealtype* hlast); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") -int MRIStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") -int MRIStepGetCurrentState(void* arkode_mem, N_Vector* state); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentGamma instead") -int MRIStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") -int MRIStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") -int MRIStepGetErrWeights(void* arkode_mem, N_Vector eweight); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") -int MRIStepGetNumGEvals(void* arkode_mem, long int* ngevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") -int MRIStepGetRootInfo(void* arkode_mem, int* rootsfound); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") -int MRIStepGetUserData(void* arkode_mem, void** user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") -int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") -char* MRIStepGetReturnFlagName(long int flag); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") -int MRIStepWriteParameters(void* arkode_mem, FILE* fp); -SUNDIALS_DEPRECATED_EXPORT_MSG( - "use MRIStepGetCurrentCoupling and MRIStepCoupling_Write instead") -int MRIStepWriteCoupling(void* arkode_mem, FILE* fp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinearSystemData instead") -int MRIStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, - N_Vector* zpred, N_Vector* z, N_Vector* F, - sunrealtype* gamma, N_Vector* sdata, - void** user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvIters instead") -int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvConvFails instead") -int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinSolvStats instead") -int MRIStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, - long int* nnfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepSolveFails instead") -int MRIStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJac instead") -int MRIStepGetJac(void* arkode_mem, SUNMatrix* J); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacTime instead") -int MRIStepGetJacTime(void* arkode_mem, sunrealtype* t_J); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacNumSteps instead") -int MRIStepGetJacNumSteps(void* arkode_mem, long* nst_J); -SUNDIALS_DEPRECATED_EXPORT_MSG( - "Work space functions will be removed in version 8.0.0") -int MRIStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, - long int* leniwLS); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJacEvals instead") -int MRIStepGetNumJacEvals(void* arkode_mem, long int* njevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecEvals instead") -int MRIStepGetNumPrecEvals(void* arkode_mem, long int* npevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecSolves instead") -int MRIStepGetNumPrecSolves(void* arkode_mem, long int* npsolves); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinIters instead") -int MRIStepGetNumLinIters(void* arkode_mem, long int* nliters); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinConvFails instead") -int MRIStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJTSetupEvals instead") -int MRIStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJtimesEvals instead") -int MRIStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinRhsEvals instead") -int MRIStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastLinFlag instead") -int MRIStepGetLastLinFlag(void* arkode_mem, long int* flag); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinReturnFlagName instead") -char* MRIStepGetLinReturnFlagName(long int flag); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") -void MRIStepFree(void** arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") -void MRIStepPrintMem(void* arkode_mem, FILE* outfile); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") -int MRIStepGetNumRhsEvals(void* arkode_mem, long int* nfse_evals, - long int* nfsi_evals); - #ifdef __cplusplus } #endif diff --git a/include/arkode/arkode_mristep.hpp b/include/arkode/arkode_mristep.hpp new file mode 100644 index 0000000000..b418a2ff5c --- /dev/null +++ b/include/arkode/arkode_mristep.hpp @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * ----------------------------------------------------------------------------- + * C++ specific ARKODE definitions. + * ---------------------------------------------------------------------------*/ + +#ifndef _SUNDIALS_ARKODE_MRISTEP_HPP +#define _SUNDIALS_ARKODE_MRISTEP_HPP + +#include +#include + +namespace sundials { +namespace experimental { + +struct MRIStepCouplingDeleter +{ + void operator()(MRIStepCoupling t) + { + if (t) { MRIStepCoupling_Free(t); } + } +}; + +class MRIStepCouplingView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static MRIStepCouplingView Create(Args&&... args); +}; + +template +MRIStepCouplingView MRIStepCouplingView::Create(Args&&... args) +{ + MRIStepCoupling table = MRIStepCoupling_Create(std::forward(args)...); + return MRIStepCouplingView(table); +} + +struct MRIStepInnerStepperDeleter +{ + void operator()(MRIStepInnerStepper s) + { + if (s) { MRIStepInnerStepper_Free(&s); } + } +}; + +class MRIStepInnerStepperView + : public ClassView +{ +public: + using ClassView::ClassView; + + template + static MRIStepInnerStepperView Create(Args&&... args); +}; + +template +MRIStepInnerStepperView MRIStepInnerStepperView::Create(Args&&... args) +{ + return MRIStepInnerStepperView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/arkode/arkode_mristep_deprecated.h b/include/arkode/arkode_mristep_deprecated.h new file mode 100644 index 0000000000..be56afa269 --- /dev/null +++ b/include/arkode/arkode_mristep_deprecated.h @@ -0,0 +1,218 @@ +/* ----------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * -----------------------------------------------------------------*/ + +#ifndef _MRISTEP_DEPRECATED_H +#define _MRISTEP_DEPRECATED_H + +#include + +#ifdef __cplusplus /* wrapper to enable C++ usage */ +extern "C" { +#endif + +/* -------------------------------------------------------------------------- + * Deprecated Functions -- all are superseded by shared ARKODE-level routines + * -------------------------------------------------------------------------- */ + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeResize instead") +int MRIStepResize(void* arkode_mem, N_Vector ynew, sunrealtype t0, + ARKVecResizeFn resize, void* resize_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") +int MRIStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSStolerances instead") +int MRIStepSStolerances(void* arkode_mem, sunrealtype reltol, sunrealtype abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSVtolerances instead") +int MRIStepSVtolerances(void* arkode_mem, sunrealtype reltol, N_Vector abstol); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWFtolerances instead") +int MRIStepWFtolerances(void* arkode_mem, ARKEwtFn efun); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolver instead") +int MRIStepSetLinearSolver(void* arkode_mem, SUNLinearSolver LS, SUNMatrix A); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") +int MRIStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") +int MRIStepSetDefaults(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") +int MRIStepSetOrder(void* arkode_mem, int ord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") +int MRIStepSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int MRIStepSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int MRIStepSetDenseOrder(void* arkode_mem, int dord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinearSolver instead") +int MRIStepSetNonlinearSolver(void* arkode_mem, SUNNonlinearSolver NLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNlsRhsFn instead") +int MRIStepSetNlsRhsFn(void* arkode_mem, ARKRhsFn nls_fs); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinear instead") +int MRIStepSetLinear(void* arkode_mem, int timedepend); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinear instead") +int MRIStepSetNonlinear(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") +int MRIStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinCRDown instead") +int MRIStepSetNonlinCRDown(void* arkode_mem, sunrealtype crdown); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinRDiv instead") +int MRIStepSetNonlinRDiv(void* arkode_mem, sunrealtype rdiv); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeltaGammaMax instead") +int MRIStepSetDeltaGammaMax(void* arkode_mem, sunrealtype dgmax); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSetupFrequency instead") +int MRIStepSetLSetupFrequency(void* arkode_mem, int msbp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPredictorMethod instead") +int MRIStepSetPredictorMethod(void* arkode_mem, int method); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNonlinIters instead") +int MRIStepSetMaxNonlinIters(void* arkode_mem, int maxcor); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNonlinConvCoef instead") +int MRIStepSetNonlinConvCoef(void* arkode_mem, sunrealtype nlscoef); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxHnilWarns instead") +int MRIStepSetMaxHnilWarns(void* arkode_mem, int mxhnil); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolateStopTime instead") +int MRIStepSetInterpolateStopTime(void* arkode_mem, sunbooleantype interp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") +int MRIStepSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeClearStopTime instead") +int MRIStepClearStopTime(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") +int MRIStepSetFixedStep(void* arkode_mem, sunrealtype hsfixed); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") +int MRIStepSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") +int MRIStepSetNoInactiveRootWarn(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") +int MRIStepSetUserData(void* arkode_mem, void* user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") +int MRIStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") +int MRIStepSetPostprocessStageFn(void* arkode_mem, ARKPostProcessFn ProcessStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStagePredictFn instead") +int MRIStepSetStagePredictFn(void* arkode_mem, ARKStagePredictFn PredictStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDeduceImplicitRhs instead") +int MRIStepSetDeduceImplicitRhs(void* arkode_mem, sunbooleantype deduce); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacFn instead") +int MRIStepSetJacFn(void* arkode_mem, ARKLsJacFn jac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacEvalFrequency instead") +int MRIStepSetJacEvalFrequency(void* arkode_mem, long int msbj); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinearSolutionScaling instead") +int MRIStepSetLinearSolutionScaling(void* arkode_mem, sunbooleantype onoff); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetEpsLin instead") +int MRIStepSetEpsLin(void* arkode_mem, sunrealtype eplifac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLSNormFactor instead") +int MRIStepSetLSNormFactor(void* arkode_mem, sunrealtype nrmfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPreconditioner instead") +int MRIStepSetPreconditioner(void* arkode_mem, ARKLsPrecSetupFn psetup, + ARKLsPrecSolveFn psolve); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimes instead") +int MRIStepSetJacTimes(void* arkode_mem, ARKLsJacTimesSetupFn jtsetup, + ARKLsJacTimesVecFn jtimes); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetJacTimesRhsFn instead") +int MRIStepSetJacTimesRhsFn(void* arkode_mem, ARKRhsFn jtimesRhsFn); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetLinSysFn instead") +int MRIStepSetLinSysFn(void* arkode_mem, ARKLsLinSysFn linsys); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") +int MRIStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") +int MRIStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeComputeState instead") +int MRIStepComputeState(void* arkode_mem, N_Vector zcor, N_Vector z); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinSolvSetups instead") +int MRIStepGetNumLinSolvSetups(void* arkode_mem, long int* nlinsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG( + "Work space functions will be removed in version 8.0.0") +int MRIStepGetWorkSpace(void* arkode_mem, long int* lenrw, long int* leniw); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") +int MRIStepGetNumSteps(void* arkode_mem, long int* nssteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") +int MRIStepGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") +int MRIStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") +int MRIStepGetCurrentState(void* arkode_mem, N_Vector* state); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentGamma instead") +int MRIStepGetCurrentGamma(void* arkode_mem, sunrealtype* gamma); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetTolScaleFactor instead") +int MRIStepGetTolScaleFactor(void* arkode_mem, sunrealtype* tolsfac); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetErrWeights instead") +int MRIStepGetErrWeights(void* arkode_mem, N_Vector eweight); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumGEvals instead") +int MRIStepGetNumGEvals(void* arkode_mem, long int* ngevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") +int MRIStepGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") +int MRIStepGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") +int MRIStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") +char* MRIStepGetReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") +int MRIStepWriteParameters(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG( + "use MRIStepGetCurrentCoupling and MRIStepCoupling_Write instead") +int MRIStepWriteCoupling(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinearSystemData instead") +int MRIStepGetNonlinearSystemData(void* arkode_mem, sunrealtype* tcur, + N_Vector* zpred, N_Vector* z, N_Vector* F, + sunrealtype* gamma, N_Vector* sdata, + void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvIters instead") +int MRIStepGetNumNonlinSolvIters(void* arkode_mem, long int* nniters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumNonlinSolvConvFails instead") +int MRIStepGetNumNonlinSolvConvFails(void* arkode_mem, long int* nnfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNonlinSolvStats instead") +int MRIStepGetNonlinSolvStats(void* arkode_mem, long int* nniters, + long int* nnfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepSolveFails instead") +int MRIStepGetNumStepSolveFails(void* arkode_mem, long int* nncfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJac instead") +int MRIStepGetJac(void* arkode_mem, SUNMatrix* J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacTime instead") +int MRIStepGetJacTime(void* arkode_mem, sunrealtype* t_J); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetJacNumSteps instead") +int MRIStepGetJacNumSteps(void* arkode_mem, long* nst_J); +SUNDIALS_DEPRECATED_EXPORT_MSG( + "Work space functions will be removed in version 8.0.0") +int MRIStepGetLinWorkSpace(void* arkode_mem, long int* lenrwLS, + long int* leniwLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJacEvals instead") +int MRIStepGetNumJacEvals(void* arkode_mem, long int* njevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecEvals instead") +int MRIStepGetNumPrecEvals(void* arkode_mem, long int* npevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumPrecSolves instead") +int MRIStepGetNumPrecSolves(void* arkode_mem, long int* npsolves); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinIters instead") +int MRIStepGetNumLinIters(void* arkode_mem, long int* nliters); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinConvFails instead") +int MRIStepGetNumLinConvFails(void* arkode_mem, long int* nlcfails); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJTSetupEvals instead") +int MRIStepGetNumJTSetupEvals(void* arkode_mem, long int* njtsetups); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumJtimesEvals instead") +int MRIStepGetNumJtimesEvals(void* arkode_mem, long int* njvevals); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumLinRhsEvals instead") +int MRIStepGetNumLinRhsEvals(void* arkode_mem, long int* nfevalsLS); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastLinFlag instead") +int MRIStepGetLastLinFlag(void* arkode_mem, long int* flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLinReturnFlagName instead") +char* MRIStepGetLinReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") +void MRIStepFree(void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintMem instead") +void MRIStepPrintMem(void* arkode_mem, FILE* outfile); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") +int MRIStepGetNumRhsEvals(void* arkode_mem, long int* nfse_evals, + long int* nfsi_evals); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arkode/arkode_splittingstep.h b/include/arkode/arkode_splittingstep.h index 63cf117a30..afeb38d12a 100644 --- a/include/arkode/arkode_splittingstep.h +++ b/include/arkode/arkode_splittingstep.h @@ -30,8 +30,8 @@ extern "C" { ---------------------------------------------------------------*/ struct SplittingStepCoefficientsMem { - sunrealtype* alpha; /* weights for sum over sequential splitting methods */ - sunrealtype*** beta; /* subintegration nodes, indexed by the sequential method, stage, and partition */ + sunrealtype1d alpha; /* weights for sum over sequential splitting methods */ + sunrealtype3d beta; /* subintegration nodes, indexed by the sequential method, stage, and partition */ int sequential_methods; /* number of sequential splitting methods */ int stages; /* number of stages within each sequential splitting method */ int partitions; /* number of RHS partitions */ @@ -42,11 +42,12 @@ typedef _SUNDIALS_STRUCT_ SplittingStepCoefficientsMem* SplittingStepCoefficient /* Splitting names use the convention * ARKODE_SPLITTING____ */ -typedef enum +enum ARKODE_SplittingCoefficientsID { - ARKODE_SPLITTING_NONE = -1, /* ensure enum is signed int */ - ARKODE_MIN_SPLITTING_NUM = 0, - ARKODE_SPLITTING_LIE_TROTTER_1_1_2 = ARKODE_MIN_SPLITTING_NUM, + ARKODE_SPLITTING_NONE = -1, /* ensure enum is signed int */ + ARKODE_MIN_SPLITTING_NUM = 0, + ARKODE_SPLITTING_LIE_TROTTER_1_1_2 = + 0, /* setting this to ARKODE_MIN_SPLITTING_NUM confuses the python interface generator */ ARKODE_SPLITTING_STRANG_2_2_2, ARKODE_SPLITTING_BEST_2_2_2, ARKODE_SPLITTING_SUZUKI_3_3_2, @@ -54,14 +55,18 @@ typedef enum ARKODE_SPLITTING_YOSHIDA_4_4_2, ARKODE_SPLITTING_YOSHIDA_8_6_2, ARKODE_MAX_SPLITTING_NUM = ARKODE_SPLITTING_YOSHIDA_8_6_2 -} ARKODE_SplittingCoefficientsID; +}; + +#ifndef SWIG +typedef enum ARKODE_SplittingCoefficientsID ARKODE_SplittingCoefficientsID; +#endif /* Coefficient memory management */ SUNDIALS_EXPORT SplittingStepCoefficients SplittingStepCoefficients_Alloc( int sequential_methods, int stages, int partitions); SUNDIALS_EXPORT SplittingStepCoefficients SplittingStepCoefficients_Create( int sequential_methods, int stages, int partitions, int order, - sunrealtype* alpha, sunrealtype* beta); + sunrealtype1d alpha, sunrealtype1d beta); SUNDIALS_EXPORT void SplittingStepCoefficients_Destroy( SplittingStepCoefficients* coefficients); SUNDIALS_EXPORT SplittingStepCoefficients diff --git a/include/arkode/arkode_sprk.h b/include/arkode/arkode_sprk.h index 7925b96652..6d80ba4008 100644 --- a/include/arkode/arkode_sprk.h +++ b/include/arkode/arkode_sprk.h @@ -24,11 +24,11 @@ extern "C" { #endif -typedef enum +enum ARKODE_SPRKMethodID { ARKODE_SPRK_NONE = -1, /* ensure enum is signed int */ ARKODE_MIN_SPRK_NUM = 0, - ARKODE_SPRK_EULER_1_1 = ARKODE_MIN_SPRK_NUM, + ARKODE_SPRK_EULER_1_1 = 0, ARKODE_SPRK_LEAPFROG_2_2, ARKODE_SPRK_PSEUDO_LEAPFROG_2_2, ARKODE_SPRK_RUTH_3_3, @@ -41,7 +41,11 @@ typedef enum ARKODE_SPRK_SUZUKI_UMENO_8_16, ARKODE_SPRK_SOFRONIOU_10_36, ARKODE_MAX_SPRK_NUM = ARKODE_SPRK_SOFRONIOU_10_36 -} ARKODE_SPRKMethodID; +}; + +#ifndef SWIG +typedef enum ARKODE_SPRKMethodID ARKODE_SPRKMethodID; +#endif struct ARKodeSPRKTableMem { @@ -50,17 +54,17 @@ struct ARKodeSPRKTableMem /* number of stages */ int stages; /* the a_i coefficients generate the explicit Butcher table */ - sunrealtype* a; + sunrealtype1d a; /* the ahat_i coefficients generate the diagonally-implicit Butcher table */ - sunrealtype* ahat; + sunrealtype1d ahat; }; typedef _SUNDIALS_STRUCT_ ARKodeSPRKTableMem* ARKodeSPRKTable; /* Utility routines to allocate/free/output SPRK structures */ SUNDIALS_EXPORT -ARKodeSPRKTable ARKodeSPRKTable_Create(int s, int q, const sunrealtype* a, - const sunrealtype* ahat); +ARKodeSPRKTable ARKodeSPRKTable_Create(int s, int q, sunrealtype1d a, + sunrealtype1d ahat); SUNDIALS_EXPORT ARKodeSPRKTable ARKodeSPRKTable_Alloc(int stages); diff --git a/include/arkode/arkode_sprk.hpp b/include/arkode/arkode_sprk.hpp new file mode 100644 index 0000000000..ed176b3b2f --- /dev/null +++ b/include/arkode/arkode_sprk.hpp @@ -0,0 +1,51 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * ---------------------------------------------------------------------------*/ + +#ifndef _SUNDIALS_ARKODE_SPRKSTEP_HPP +#define _SUNDIALS_ARKODE_SPRKSTEP_HPP + +#include +#include + +namespace sundials { +namespace experimental { + +struct ARKodeSPRKTableDeleter +{ + void operator()(ARKodeSPRKTable t) + { + if (t) { ARKodeSPRKTable_Free(t); } + } +}; + +class ARKodeSPRKTableView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static ARKodeSPRKTableView Create(Args&&... args); +}; + +template +ARKodeSPRKTableView ARKodeSPRKTableView::Create(Args&&... args) +{ + ARKodeSPRKTable table = ARKodeSPRKTable_Create(std::forward(args)...); + return ARKodeSPRKTableView(table); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/arkode/arkode_sprkstep.h b/include/arkode/arkode_sprkstep.h index 6b6f27cacb..7b3ee486f5 100644 --- a/include/arkode/arkode_sprkstep.h +++ b/include/arkode/arkode_sprkstep.h @@ -19,6 +19,7 @@ #include #include +#include #ifdef __cplusplus /* wrapper to enable C++ usage */ extern "C" { @@ -48,8 +49,6 @@ SUNDIALS_EXPORT int SPRKStepReInit(void* arkode_mem, ARKRhsFn f1, ARKRhsFn f2, sunrealtype t0, N_Vector y0); /* Optional input functions -- must be called AFTER SPRKStepCreate */ -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUseCompensatedSums instead") -int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff); SUNDIALS_EXPORT int SPRKStepSetMethod(void* arkode_mem, ARKodeSPRKTable sprk_storage); SUNDIALS_EXPORT int SPRKStepSetMethodName(void* arkode_mem, const char* method); @@ -58,75 +57,6 @@ SUNDIALS_EXPORT int SPRKStepSetMethodName(void* arkode_mem, const char* method); SUNDIALS_EXPORT int SPRKStepGetCurrentMethod(void* arkode_mem, ARKodeSPRKTable* sprk_storage); -/* -------------------------------------------------------------------------- - * Deprecated Functions -- all are superseded by shared ARKODE-level routines - * -------------------------------------------------------------------------- */ - -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") -int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") -int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") -int SPRKStepSetRootDirection(void* arkode_mem, int* rootdir); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") -int SPRKStepSetNoInactiveRootWarn(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") -int SPRKStepSetDefaults(void* arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") -int SPRKStepSetOrder(void* arkode_mem, int maxord); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") -int SPRKStepSetInterpolantType(void* arkode_mem, int itype); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") -int SPRKStepSetInterpolantDegree(void* arkode_mem, int degree); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") -int SPRKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") -int SPRKStepSetStopTime(void* arkode_mem, sunrealtype tstop); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") -int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") -int SPRKStepSetUserData(void* arkode_mem, void* user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") -int SPRKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") -int SPRKStepSetPostprocessStageFn(void* arkode_mem, - ARKPostProcessFn ProcessStage); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") -int SPRKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, - sunrealtype* tret, int itask); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") -int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") -char* SPRKStepGetReturnFlagName(long int flag); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") -int SPRKStepGetCurrentState(void* arkode_mem, N_Vector* state); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentStep instead") -int SPRKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") -int SPRKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") -int SPRKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepAttempts instead") -int SPRKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") -int SPRKStepGetNumSteps(void* arkode_mem, long int* nsteps); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") -int SPRKStepGetRootInfo(void* arkode_mem, int* rootsfound); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") -int SPRKStepGetUserData(void* arkode_mem, void** user_data); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") -int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") -int SPRKStepWriteParameters(void* arkode_mem, FILE* fp); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") -int SPRKStepGetStepStats(void* arkode_mem, long int* nsteps, - sunrealtype* hinused, sunrealtype* hlast, - sunrealtype* hcur, sunrealtype* tcur); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") -void SPRKStepFree(void** arkode_mem); -SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") -int SPRKStepGetNumRhsEvals(void* arkode_mem, long int* nf1, long int* nf2); - #ifdef __cplusplus } #endif diff --git a/include/arkode/arkode_sprkstep_deprecated.h b/include/arkode/arkode_sprkstep_deprecated.h new file mode 100644 index 0000000000..50566df9db --- /dev/null +++ b/include/arkode/arkode_sprkstep_deprecated.h @@ -0,0 +1,99 @@ +/* ----------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * -----------------------------------------------------------------*/ + +#ifndef _SPRKSTEP_DEPRECATED_H +#define _SPRKSTEP_DEPRECATED_H + +#include + +#ifdef __cplusplus /* wrapper to enable C++ usage */ +extern "C" { +#endif + +/* -------------------------------------------------------------------------- + * Deprecated Functions -- all are superseded by shared ARKODE-level routines + * -------------------------------------------------------------------------- */ + +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeReset instead") +int SPRKStepReset(void* arkode_mem, sunrealtype tR, N_Vector yR); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeRootInit instead") +int SPRKStepRootInit(void* arkode_mem, int nrtfn, ARKRootFn g); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetRootDirection instead") +int SPRKStepSetRootDirection(void* arkode_mem, int* rootdir); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetNoInactiveRootWarn instead") +int SPRKStepSetNoInactiveRootWarn(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetDefaults instead") +int SPRKStepSetDefaults(void* arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetOrder instead") +int SPRKStepSetOrder(void* arkode_mem, int maxord); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantType instead") +int SPRKStepSetInterpolantType(void* arkode_mem, int itype); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetInterpolantDegree instead") +int SPRKStepSetInterpolantDegree(void* arkode_mem, int degree); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetMaxNumSteps instead") +int SPRKStepSetMaxNumSteps(void* arkode_mem, long int mxsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetStopTime instead") +int SPRKStepSetStopTime(void* arkode_mem, sunrealtype tstop); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetFixedStep instead") +int SPRKStepSetFixedStep(void* arkode_mem, sunrealtype hfixed); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUserData instead") +int SPRKStepSetUserData(void* arkode_mem, void* user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStepFn instead") +int SPRKStepSetPostprocessStepFn(void* arkode_mem, ARKPostProcessFn ProcessStep); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetPostprocessStageFn instead") +int SPRKStepSetPostprocessStageFn(void* arkode_mem, + ARKPostProcessFn ProcessStage); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeEvolve instead") +int SPRKStepEvolve(void* arkode_mem, sunrealtype tout, N_Vector yout, + sunrealtype* tret, int itask); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetDky instead") +int SPRKStepGetDky(void* arkode_mem, sunrealtype t, int k, N_Vector dky); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetReturnFlagName instead") +char* SPRKStepGetReturnFlagName(long int flag); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentState instead") +int SPRKStepGetCurrentState(void* arkode_mem, N_Vector* state); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentStep instead") +int SPRKStepGetCurrentStep(void* arkode_mem, sunrealtype* hcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetCurrentTime instead") +int SPRKStepGetCurrentTime(void* arkode_mem, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetLastStep instead") +int SPRKStepGetLastStep(void* arkode_mem, sunrealtype* hlast); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumStepAttempts instead") +int SPRKStepGetNumStepAttempts(void* arkode_mem, long int* step_attempts); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumSteps instead") +int SPRKStepGetNumSteps(void* arkode_mem, long int* nsteps); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetRootInfo instead") +int SPRKStepGetRootInfo(void* arkode_mem, int* rootsfound); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetUserData instead") +int SPRKStepGetUserData(void* arkode_mem, void** user_data); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodePrintAllStats instead") +int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeWriteParameters instead") +int SPRKStepWriteParameters(void* arkode_mem, FILE* fp); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetStepStats instead") +int SPRKStepGetStepStats(void* arkode_mem, long int* nsteps, + sunrealtype* hinused, sunrealtype* hlast, + sunrealtype* hcur, sunrealtype* tcur); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeFree instead") +void SPRKStepFree(void** arkode_mem); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeGetNumRhsEvals instead") +int SPRKStepGetNumRhsEvals(void* arkode_mem, long int* nf1, long int* nf2); +SUNDIALS_DEPRECATED_EXPORT_MSG("use ARKodeSetUseCompensatedSums instead") +int SPRKStepSetUseCompensatedSums(void* arkode_mem, sunbooleantype onoff); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/cvode/cvode.h b/include/cvode/cvode.h index ec5a621340..f3553ee523 100644 --- a/include/cvode/cvode.h +++ b/include/cvode/cvode.h @@ -89,7 +89,7 @@ extern "C" { typedef int (*CVRhsFn)(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); -typedef int (*CVRootFn)(sunrealtype t, N_Vector y, sunrealtype* gout, +typedef int (*CVRootFn)(sunrealtype t, N_Vector y, sunrealtype1d gout, void* user_data); typedef int (*CVEwtFn)(N_Vector y, N_Vector ewt, void* user_data); @@ -106,8 +106,8 @@ SUNDIALS_EXPORT void* CVodeCreate(int lmm, SUNContext sunctx); SUNDIALS_EXPORT int CVodeInit(void* cvode_mem, CVRhsFn f, sunrealtype t0, N_Vector y0); SUNDIALS_EXPORT int CVodeReInit(void* cvode_mem, sunrealtype t0, N_Vector y0); -SUNDIALS_EXPORT int CVodeResizeHistory(void* cvode_mem, sunrealtype* t_hist, - N_Vector* y_hist, N_Vector* f_hist, +SUNDIALS_EXPORT int CVodeResizeHistory(void* cvode_mem, sunrealtype1d t_hist, + N_Vector1d y_hist, N_Vector1d f_hist, int num_y_hist, int num_f_hist); /* Tolerance input functions */ diff --git a/include/cvode/cvode.hpp b/include/cvode/cvode.hpp new file mode 100644 index 0000000000..6456fd43ec --- /dev/null +++ b/include/cvode/cvode.hpp @@ -0,0 +1,54 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * ----------------------------------------------------------------------------- + * C++ specific CVODE definitions. + * ---------------------------------------------------------------------------*/ + +#ifndef _CVODE_HPP +#define _CVODE_HPP + +extern "C" { +#include +} + +#include + +namespace sundials { +namespace experimental { + +struct CVodeDeleter +{ + void operator()(void* v) + { + if (v) { CVodeFree(&v); } + } +}; + +class CVodeView : public ClassView +{ +public: + using ClassView::ClassView; + template + static CVodeView Create(Args&&... args); +}; + +template +CVodeView CVodeView::Create(Args&&... args) +{ + return CVodeView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/cvodes/cvodes.h b/include/cvodes/cvodes.h index 03676006a7..8d5cc621f9 100644 --- a/include/cvodes/cvodes.h +++ b/include/cvodes/cvodes.h @@ -133,7 +133,7 @@ extern "C" { typedef int (*CVRhsFn)(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); -typedef int (*CVRootFn)(sunrealtype t, N_Vector y, sunrealtype* gout, +typedef int (*CVRootFn)(sunrealtype t, N_Vector y, sunrealtype1d gout, void* user_data); typedef int (*CVEwtFn)(N_Vector y, N_Vector ewt, void* user_data); @@ -144,27 +144,27 @@ typedef int (*CVQuadRhsFn)(sunrealtype t, N_Vector y, N_Vector yQdot, void* user_data); typedef int (*CVSensRhsFn)(int Ns, sunrealtype t, N_Vector y, N_Vector ydot, - N_Vector* yS, N_Vector* ySdot, void* user_data, + N_Vector1d yS, N_Vector1d ySdot, void* user_data, N_Vector tmp1, N_Vector tmp2); typedef int (*CVSensRhs1Fn)(int Ns, sunrealtype t, N_Vector y, N_Vector ydot, int iS, N_Vector yS, N_Vector ySdot, void* user_data, N_Vector tmp1, N_Vector tmp2); -typedef int (*CVQuadSensRhsFn)(int Ns, sunrealtype t, N_Vector y, N_Vector* yS, - N_Vector yQdot, N_Vector* yQSdot, +typedef int (*CVQuadSensRhsFn)(int Ns, sunrealtype t, N_Vector y, N_Vector1d yS, + N_Vector yQdot, N_Vector1d yQSdot, void* user_data, N_Vector tmp, N_Vector tmpQ); typedef int (*CVRhsFnB)(sunrealtype t, N_Vector y, N_Vector yB, N_Vector yBdot, void* user_dataB); -typedef int (*CVRhsFnBS)(sunrealtype t, N_Vector y, N_Vector* yS, N_Vector yB, +typedef int (*CVRhsFnBS)(sunrealtype t, N_Vector y, N_Vector1d yS, N_Vector yB, N_Vector yBdot, void* user_dataB); typedef int (*CVQuadRhsFnB)(sunrealtype t, N_Vector y, N_Vector yB, N_Vector qBdot, void* user_dataB); -typedef int (*CVQuadRhsFnBS)(sunrealtype t, N_Vector y, N_Vector* yS, +typedef int (*CVQuadRhsFnBS)(sunrealtype t, N_Vector y, N_Vector1d yS, N_Vector yB, N_Vector qBdot, void* user_dataB); /* --------------------------------------- @@ -177,8 +177,8 @@ SUNDIALS_EXPORT void* CVodeCreate(int lmm, SUNContext sunctx); SUNDIALS_EXPORT int CVodeInit(void* cvode_mem, CVRhsFn f, sunrealtype t0, N_Vector y0); SUNDIALS_EXPORT int CVodeReInit(void* cvode_mem, sunrealtype t0, N_Vector y0); -SUNDIALS_EXPORT int CVodeResizeHistory(void* cvode_mem, sunrealtype* t_hist, - N_Vector* y_hist, N_Vector* f_hist, +SUNDIALS_EXPORT int CVodeResizeHistory(void* cvode_mem, sunrealtype1d t_hist, + N_Vector1d y_hist, N_Vector1d f_hist, int num_y_hist, int num_f_hist); /* Tolerance input functions */ @@ -255,8 +255,8 @@ SUNDIALS_EXPORT int CVode(void* cvode_mem, sunrealtype tout, N_Vector yout, /* Utility functions to update/compute y based on ycor */ SUNDIALS_EXPORT int CVodeComputeState(void* cvode_mem, N_Vector ycor, N_Vector y); -SUNDIALS_EXPORT int CVodeComputeStateSens(void* cvode_mem, N_Vector* yScor, - N_Vector* yS); +SUNDIALS_EXPORT int CVodeComputeStateSens(void* cvode_mem, N_Vector1d yScor, + N_Vector1d yS); SUNDIALS_EXPORT int CVodeComputeStateSens1(void* cvode_mem, int idx, N_Vector yScor1, N_Vector yS1); @@ -281,8 +281,8 @@ SUNDIALS_EXPORT int CVodeGetNumStabLimOrderReds(void* cvode_mem, SUNDIALS_EXPORT int CVodeGetActualInitStep(void* cvode_mem, sunrealtype* hinused); SUNDIALS_EXPORT int CVodeGetLastStep(void* cvode_mem, sunrealtype* hlast); SUNDIALS_EXPORT int CVodeGetCurrentStep(void* cvode_mem, sunrealtype* hcur); -SUNDIALS_EXPORT int CVodeGetCurrentState(void* cvode_mem, N_Vector* y); -SUNDIALS_EXPORT int CVodeGetCurrentStateSens(void* cvode_mem, N_Vector** yS); +SUNDIALS_EXPORT int CVodeGetCurrentState(void* cvode_mem, N_Vector1d y); +SUNDIALS_EXPORT int CVodeGetCurrentStateSens(void* cvode_mem, N_Vector1d* yS); SUNDIALS_EXPORT int CVodeGetCurrentSensSolveIndex(void* cvode_mem, int* index); SUNDIALS_EXPORT int CVodeGetCurrentTime(void* cvode_mem, sunrealtype* tcur); SUNDIALS_EXPORT int CVodeGetTolScaleFactor(void* cvode_mem, sunrealtype* tolsfac); @@ -294,15 +294,13 @@ SUNDIALS_EXPORT int CVodeGetIntegratorStats( void* cvode_mem, long int* nsteps, long int* nfevals, long int* nlinsetups, long int* netfails, int* qlast, int* qcur, sunrealtype* hinused, sunrealtype* hlast, sunrealtype* hcur, sunrealtype* tcur); -SUNDIALS_EXPORT int CVodeGetNonlinearSystemData(void* cvode_mem, - sunrealtype* tcur, - N_Vector* ypred, N_Vector* yn, - N_Vector* fn, sunrealtype* gamma, - sunrealtype* rl1, N_Vector* zn1, - void** user_data); +SUNDIALS_EXPORT int CVodeGetNonlinearSystemData( + void* cvode_mem, sunrealtype* tcur, N_Vector1d ypred, N_Vector1d yn, + N_Vector1d fn, sunrealtype* gamma, sunrealtype* rl1, N_Vector1d zn1, + void** user_data); SUNDIALS_EXPORT int CVodeGetNonlinearSystemDataSens( - void* cvode_mem, sunrealtype* tcur, N_Vector** ySpred, N_Vector** ySn, - sunrealtype* gamma, sunrealtype* rl1, N_Vector** zn1, void** user_data); + void* cvode_mem, sunrealtype* tcur, N_Vector1d* ySpred, N_Vector1d* ySn, + sunrealtype* gamma, sunrealtype* rl1, N_Vector1d* zn1, void** user_data); SUNDIALS_EXPORT int CVodeGetNumNonlinSolvIters(void* cvode_mem, long int* nniters); SUNDIALS_EXPORT int CVodeGetNumNonlinSolvConvFails(void* cvode_mem, @@ -362,16 +360,16 @@ SUNDIALS_EXPORT void CVodeQuadFree(void* cvode_mem); /* Initialization functions */ SUNDIALS_EXPORT int CVodeSensInit(void* cvode_mem, int Ns, int ism, - CVSensRhsFn fS, N_Vector* yS0); + CVSensRhsFn fS, N_Vector1d yS0); SUNDIALS_EXPORT int CVodeSensInit1(void* cvode_mem, int Ns, int ism, - CVSensRhs1Fn fS1, N_Vector* yS0); -SUNDIALS_EXPORT int CVodeSensReInit(void* cvode_mem, int ism, N_Vector* yS0); + CVSensRhs1Fn fS1, N_Vector1d yS0); +SUNDIALS_EXPORT int CVodeSensReInit(void* cvode_mem, int ism, N_Vector1d yS0); /* Tolerance input functions */ SUNDIALS_EXPORT int CVodeSensSStolerances(void* cvode_mem, sunrealtype reltolS, - sunrealtype* abstolS); + sunrealtype1d abstolS); SUNDIALS_EXPORT int CVodeSensSVtolerances(void* cvode_mem, sunrealtype reltolS, - N_Vector* abstolS); + N_Vector1d abstolS); SUNDIALS_EXPORT int CVodeSensEEtolerances(void* cvode_mem); /* Optional input specification functions */ @@ -379,8 +377,8 @@ SUNDIALS_EXPORT int CVodeSetSensDQMethod(void* cvode_mem, int DQtype, sunrealtype DQrhomax); SUNDIALS_EXPORT int CVodeSetSensErrCon(void* cvode_mem, sunbooleantype errconS); SUNDIALS_EXPORT int CVodeSetSensMaxNonlinIters(void* cvode_mem, int maxcorS); -SUNDIALS_EXPORT int CVodeSetSensParams(void* cvode_mem, sunrealtype* p, - sunrealtype* pbar, int* plist); +SUNDIALS_EXPORT int CVodeSetSensParams(void* cvode_mem, sunrealtype1d p, + sunrealtype1d pbar, int1d plist); /* Integrator nonlinear solver specification functions */ SUNDIALS_EXPORT int CVodeSetNonlinearSolverSensSim(void* cvode_mem, @@ -395,12 +393,12 @@ SUNDIALS_EXPORT int CVodeSensToggleOff(void* cvode_mem); /* Extraction and dense output functions */ SUNDIALS_EXPORT int CVodeGetSens(void* cvode_mem, sunrealtype* tret, - N_Vector* ySout); + N_Vector1d ySout); SUNDIALS_EXPORT int CVodeGetSens1(void* cvode_mem, sunrealtype* tret, int is, N_Vector ySout); SUNDIALS_EXPORT int CVodeGetSensDky(void* cvode_mem, sunrealtype t, int k, - N_Vector* dkyA); + N_Vector1d dkyA); SUNDIALS_EXPORT int CVodeGetSensDky1(void* cvode_mem, sunrealtype t, int k, int is, N_Vector dky); @@ -411,7 +409,7 @@ SUNDIALS_EXPORT int CVodeGetSensNumErrTestFails(void* cvode_mem, long int* nSetfails); SUNDIALS_EXPORT int CVodeGetSensNumLinSolvSetups(void* cvode_mem, long int* nlinsetupsS); -SUNDIALS_EXPORT int CVodeGetSensErrWeights(void* cvode_mem, N_Vector* eSweight); +SUNDIALS_EXPORT int CVodeGetSensErrWeights(void* cvode_mem, N_Vector1d eSweight); SUNDIALS_EXPORT int CVodeGetSensStats(void* cvode_mem, long int* nfSevals, long int* nfevalsS, long int* nSetfails, long int* nlinsetupsS); @@ -443,16 +441,16 @@ SUNDIALS_EXPORT void CVodeSensFree(void* cvode_mem); /* Initialization functions */ SUNDIALS_EXPORT int CVodeQuadSensInit(void* cvode_mem, CVQuadSensRhsFn fQS, - N_Vector* yQS0); -SUNDIALS_EXPORT int CVodeQuadSensReInit(void* cvode_mem, N_Vector* yQS0); + N_Vector1d yQS0); +SUNDIALS_EXPORT int CVodeQuadSensReInit(void* cvode_mem, N_Vector1d yQS0); /* Tolerance input functions */ SUNDIALS_EXPORT int CVodeQuadSensSStolerances(void* cvode_mem, sunrealtype reltolQS, - sunrealtype* abstolQS); + sunrealtype1d abstolQS); SUNDIALS_EXPORT int CVodeQuadSensSVtolerances(void* cvode_mem, sunrealtype reltolQS, - N_Vector* abstolQS); + N_Vector1d abstolQS); SUNDIALS_EXPORT int CVodeQuadSensEEtolerances(void* cvode_mem); /* Optional input specification functions */ @@ -461,12 +459,12 @@ SUNDIALS_EXPORT int CVodeSetQuadSensErrCon(void* cvode_mem, /* Extraction and dense output functions */ SUNDIALS_EXPORT int CVodeGetQuadSens(void* cvode_mem, sunrealtype* tret, - N_Vector* yQSout); + N_Vector1d yQSout); SUNDIALS_EXPORT int CVodeGetQuadSens1(void* cvode_mem, sunrealtype* tret, int is, N_Vector yQSout); SUNDIALS_EXPORT int CVodeGetQuadSensDky(void* cvode_mem, sunrealtype t, int k, - N_Vector* dkyQS_all); + N_Vector1d dkyQS_all); SUNDIALS_EXPORT int CVodeGetQuadSensDky1(void* cvode_mem, sunrealtype t, int k, int is, N_Vector dkyQS); @@ -476,7 +474,7 @@ SUNDIALS_EXPORT int CVodeGetQuadSensNumRhsEvals(void* cvode_mem, SUNDIALS_EXPORT int CVodeGetQuadSensNumErrTestFails(void* cvode_mem, long int* nQSetfails); SUNDIALS_EXPORT int CVodeGetQuadSensErrWeights(void* cvode_mem, - N_Vector* eQSweight); + N_Vector1d eQSweight); SUNDIALS_EXPORT int CVodeGetQuadSensStats(void* cvode_mem, long int* nfQSevals, long int* nQSetfails); @@ -567,6 +565,9 @@ SUNDIALS_EXPORT int CVodeGetQuadB(void* cvode_mem, int which, /* Optional Output Functions For Backward Problems */ +SUNDIALS_EXPORT int CVodeGetUserDataB(void* cvode_mem, int which, + void** user_dataB); + SUNDIALS_EXPORT void* CVodeGetAdjCVodeBmem(void* cvode_mem, int which); SUNDIALS_EXPORT int CVodeGetAdjY(void* cvode_mem, sunrealtype t, N_Vector y); diff --git a/include/cvodes/cvodes.hpp b/include/cvodes/cvodes.hpp new file mode 100644 index 0000000000..750c7cefd5 --- /dev/null +++ b/include/cvodes/cvodes.hpp @@ -0,0 +1,54 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * ----------------------------------------------------------------------------- + * C++ specific CVODES definitions. + * ---------------------------------------------------------------------------*/ + +#ifndef _CVODES_HPP +#define _CVODES_HPP + +extern "C" { +#include +} + +#include + +namespace sundials { +namespace experimental { + +struct CVodeDeleter +{ + void operator()(void* v) + { + if (v) { CVodeFree(&v); } + } +}; + +class CVodeView : public ClassView +{ +public: + using ClassView::ClassView; + template + static CVodeView Create(Args&&... args); +}; + +template +CVodeView CVodeView::Create(Args&&... args) +{ + return CVodeView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/cvodes/cvodes_ls.h b/include/cvodes/cvodes_ls.h index f8addf1cb5..341f849e8e 100644 --- a/include/cvodes/cvodes_ls.h +++ b/include/cvodes/cvodes_ls.h @@ -143,7 +143,7 @@ typedef int (*CVLsJacFnB)(sunrealtype t, N_Vector y, N_Vector yB, N_Vector fyB, SUNMatrix JB, void* user_dataB, N_Vector tmp1B, N_Vector tmp2B, N_Vector tmp3B); -typedef int (*CVLsJacFnBS)(sunrealtype t, N_Vector y, N_Vector* yS, N_Vector yB, +typedef int (*CVLsJacFnBS)(sunrealtype t, N_Vector y, N_Vector1d yS, N_Vector yB, N_Vector fyB, SUNMatrix JB, void* user_dataB, N_Vector tmp1B, N_Vector tmp2B, N_Vector tmp3B); @@ -152,7 +152,7 @@ typedef int (*CVLsPrecSetupFnB)(sunrealtype t, N_Vector y, N_Vector yB, sunbooleantype* jcurPtrB, sunrealtype gammaB, void* user_dataB); -typedef int (*CVLsPrecSetupFnBS)(sunrealtype t, N_Vector y, N_Vector* yS, +typedef int (*CVLsPrecSetupFnBS)(sunrealtype t, N_Vector y, N_Vector1d yS, N_Vector yB, N_Vector fyB, sunbooleantype jokB, sunbooleantype* jcurPtrB, sunrealtype gammaB, void* user_dataB); @@ -162,24 +162,24 @@ typedef int (*CVLsPrecSolveFnB)(sunrealtype t, N_Vector y, N_Vector yB, sunrealtype gammaB, sunrealtype deltaB, int lrB, void* user_dataB); -typedef int (*CVLsPrecSolveFnBS)(sunrealtype t, N_Vector y, N_Vector* yS, +typedef int (*CVLsPrecSolveFnBS)(sunrealtype t, N_Vector y, N_Vector1d yS, N_Vector yB, N_Vector fyB, N_Vector rB, N_Vector zB, sunrealtype gammaB, sunrealtype deltaB, int lrB, void* user_dataB); typedef int (*CVLsJacTimesSetupFnB)(sunrealtype t, N_Vector y, N_Vector yB, - N_Vector fyB, void* jac_dataB); + N_Vector fyB, void* user_dataB); -typedef int (*CVLsJacTimesSetupFnBS)(sunrealtype t, N_Vector y, N_Vector* yS, - N_Vector yB, N_Vector fyB, void* jac_dataB); +typedef int (*CVLsJacTimesSetupFnBS)(sunrealtype t, N_Vector y, N_Vector1d yS, + N_Vector yB, N_Vector fyB, void* user_dataB); typedef int (*CVLsJacTimesVecFnB)(N_Vector vB, N_Vector JvB, sunrealtype t, N_Vector y, N_Vector yB, N_Vector fyB, - void* jac_dataB, N_Vector tmpB); + void* user_dataB, N_Vector tmpB); typedef int (*CVLsJacTimesVecFnBS)(N_Vector vB, N_Vector JvB, sunrealtype t, - N_Vector y, N_Vector* yS, N_Vector yB, - N_Vector fyB, void* jac_dataB, N_Vector tmpB); + N_Vector y, N_Vector1d yS, N_Vector yB, + N_Vector fyB, void* user_dataB, N_Vector tmpB); typedef int (*CVLsLinSysFnB)(sunrealtype t, N_Vector y, N_Vector yB, N_Vector fyB, SUNMatrix AB, sunbooleantype jokB, @@ -187,7 +187,7 @@ typedef int (*CVLsLinSysFnB)(sunrealtype t, N_Vector y, N_Vector yB, void* user_dataB, N_Vector tmp1B, N_Vector tmp2B, N_Vector tmp3B); -typedef int (*CVLsLinSysFnBS)(sunrealtype t, N_Vector y, N_Vector* yS, +typedef int (*CVLsLinSysFnBS)(sunrealtype t, N_Vector y, N_Vector1d yS, N_Vector yB, N_Vector fyB, SUNMatrix AB, sunbooleantype jokB, sunbooleantype* jcurB, sunrealtype gammaB, void* user_dataB, diff --git a/include/ida/ida.h b/include/ida/ida.h index 335b44085b..0aefcee475 100644 --- a/include/ida/ida.h +++ b/include/ida/ida.h @@ -88,7 +88,7 @@ typedef int (*IDAResFn)(sunrealtype tt, N_Vector yy, N_Vector yp, N_Vector rr, void* user_data); typedef int (*IDARootFn)(sunrealtype t, N_Vector y, N_Vector yp, - sunrealtype* gout, void* user_data); + sunrealtype1d gout, void* user_data); typedef int (*IDAEwtFn)(N_Vector y, N_Vector ewt, void* user_data); diff --git a/include/ida/ida.hpp b/include/ida/ida.hpp new file mode 100644 index 0000000000..e49088bd8c --- /dev/null +++ b/include/ida/ida.hpp @@ -0,0 +1,54 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * ----------------------------------------------------------------------------- + * C++ specific IDA definitions. + * ---------------------------------------------------------------------------*/ + +#ifndef _IDA_HPP +#define _IDA_HPP + +extern "C" { +#include +} + +#include + +namespace sundials { +namespace experimental { + +struct IDADeleter +{ + void operator()(void* v) + { + if (v) { IDAFree(&v); } + } +}; + +class IDAView : public ClassView +{ +public: + using ClassView::ClassView; + template + static IDAView Create(Args&&... args); +}; + +template +IDAView IDAView::Create(Args&&... args) +{ + return IDAView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/idas/idas.h b/include/idas/idas.h index c378ac56d9..f187ef1734 100644 --- a/include/idas/idas.h +++ b/include/idas/idas.h @@ -124,7 +124,7 @@ typedef int (*IDAResFn)(sunrealtype tt, N_Vector yy, N_Vector yp, N_Vector rr, void* user_data); typedef int (*IDARootFn)(sunrealtype t, N_Vector y, N_Vector yp, - sunrealtype* gout, void* user_data); + sunrealtype1d gout, void* user_data); typedef int (*IDAEwtFn)(N_Vector y, N_Vector ewt, void* user_data); @@ -132,20 +132,20 @@ typedef int (*IDAQuadRhsFn)(sunrealtype tres, N_Vector yy, N_Vector yp, N_Vector rrQ, void* user_data); typedef int (*IDASensResFn)(int Ns, sunrealtype t, N_Vector yy, N_Vector yp, - N_Vector resval, N_Vector* yyS, N_Vector* ypS, - N_Vector* resvalS, void* user_data, N_Vector tmp1, + N_Vector resval, N_Vector1d yyS, N_Vector1d ypS, + N_Vector1d resvalS, void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3); typedef int (*IDAQuadSensRhsFn)(int Ns, sunrealtype t, N_Vector yy, N_Vector yp, - N_Vector* yyS, N_Vector* ypS, N_Vector rrQ, - N_Vector* rhsvalQS, void* user_data, + N_Vector1d yyS, N_Vector1d ypS, N_Vector rrQ, + N_Vector1d rhsvalQS, void* user_data, N_Vector yytmp, N_Vector yptmp, N_Vector tmpQS); typedef int (*IDAResFnB)(sunrealtype tt, N_Vector yy, N_Vector yp, N_Vector yyB, N_Vector ypB, N_Vector rrB, void* user_dataB); typedef int (*IDAResFnBS)(sunrealtype t, N_Vector yy, N_Vector yp, - N_Vector* yyS, N_Vector* ypS, N_Vector yyB, + N_Vector1d yyS, N_Vector1d ypS, N_Vector yyB, N_Vector ypB, N_Vector rrBS, void* user_dataB); typedef int (*IDAQuadRhsFnB)(sunrealtype tt, N_Vector yy, N_Vector yp, @@ -153,7 +153,7 @@ typedef int (*IDAQuadRhsFnB)(sunrealtype tt, N_Vector yy, N_Vector yp, void* user_dataB); typedef int (*IDAQuadRhsFnBS)(sunrealtype t, N_Vector yy, N_Vector yp, - N_Vector* yyS, N_Vector* ypS, N_Vector yyB, + N_Vector1d yyS, N_Vector1d ypS, N_Vector yyB, N_Vector ypB, N_Vector rhsvalBQS, void* user_dataB); /* --------------------------------------- @@ -242,9 +242,10 @@ SUNDIALS_EXPORT int IDASolve(void* ida_mem, sunrealtype tout, sunrealtype* tret, /* Utility functions to update/compute y and yp based on ycor */ SUNDIALS_EXPORT int IDAComputeY(void* ida_mem, N_Vector ycor, N_Vector y); SUNDIALS_EXPORT int IDAComputeYp(void* ida_mem, N_Vector ycor, N_Vector yp); -SUNDIALS_EXPORT int IDAComputeYSens(void* ida_mem, N_Vector* ycor, N_Vector* yyS); -SUNDIALS_EXPORT int IDAComputeYpSens(void* ida_mem, N_Vector* ycor, - N_Vector* ypS); +SUNDIALS_EXPORT int IDAComputeYSens(void* ida_mem, N_Vector1d ycor, + N_Vector1d yyS); +SUNDIALS_EXPORT int IDAComputeYpSens(void* ida_mem, N_Vector1d ycor, + N_Vector1d ypS); /* Dense output function */ SUNDIALS_EXPORT int IDAGetDky(void* ida_mem, sunrealtype t, int k, N_Vector dky); @@ -264,9 +265,9 @@ SUNDIALS_EXPORT int IDAGetLastOrder(void* ida_mem, int* klast); SUNDIALS_EXPORT int IDAGetCurrentOrder(void* ida_mem, int* kcur); SUNDIALS_EXPORT int IDAGetCurrentCj(void* ida_mem, sunrealtype* cj); SUNDIALS_EXPORT int IDAGetCurrentY(void* ida_mem, N_Vector* ycur); -SUNDIALS_EXPORT int IDAGetCurrentYSens(void* ida_mem, N_Vector** yS); +SUNDIALS_EXPORT int IDAGetCurrentYSens(void* ida_mem, N_Vector1d* yS); SUNDIALS_EXPORT int IDAGetCurrentYp(void* ida_mem, N_Vector* ypcur); -SUNDIALS_EXPORT int IDAGetCurrentYpSens(void* ida_mem, N_Vector** ypS); +SUNDIALS_EXPORT int IDAGetCurrentYpSens(void* ida_mem, N_Vector1d* ypS); SUNDIALS_EXPORT int IDAGetActualInitStep(void* ida_mem, sunrealtype* hinused); SUNDIALS_EXPORT int IDAGetLastStep(void* ida_mem, sunrealtype* hlast); SUNDIALS_EXPORT int IDAGetCurrentStep(void* ida_mem, sunrealtype* hcur); @@ -288,8 +289,8 @@ SUNDIALS_EXPORT int IDAGetNonlinearSystemData(void* ida_mem, sunrealtype* tcur, N_Vector* ypn, N_Vector* res, sunrealtype* cj, void** user_data); SUNDIALS_EXPORT int IDAGetNonlinearSystemDataSens( - void* ida_mem, sunrealtype* tcur, N_Vector** yySpred, N_Vector** ypSpred, - N_Vector** yySn, N_Vector** ypSn, sunrealtype* cj, void** user_data); + void* ida_mem, sunrealtype* tcur, N_Vector1d* yySpred, N_Vector1d* ypSpred, + N_Vector1d* yySn, N_Vector1d* ypSn, sunrealtype* cj, void** user_data); SUNDIALS_EXPORT int IDAGetNumNonlinSolvIters(void* ida_mem, long int* nniters); SUNDIALS_EXPORT int IDAGetNumNonlinSolvConvFails(void* ida_mem, long int* nnfails); @@ -344,29 +345,29 @@ SUNDIALS_EXPORT void IDAQuadFree(void* ida_mem); * ------------------------------------ */ /* Initialization functions */ -SUNDIALS_EXPORT int IDASensInit(void* ida_mem, int Ns, int ism, - IDASensResFn resS, N_Vector* yS0, N_Vector* ypS0); -SUNDIALS_EXPORT int IDASensReInit(void* ida_mem, int ism, N_Vector* yS0, - N_Vector* ypS0); +SUNDIALS_EXPORT int IDASensInit(void* ida_mem, int Ns, int ism, IDASensResFn resS, + N_Vector1d yS0, N_Vector1d ypS0); +SUNDIALS_EXPORT int IDASensReInit(void* ida_mem, int ism, N_Vector1d yS0, + N_Vector1d ypS0); /* Tolerance input functions */ SUNDIALS_EXPORT int IDASensSStolerances(void* ida_mem, sunrealtype reltolS, sunrealtype* abstolS); SUNDIALS_EXPORT int IDASensSVtolerances(void* ida_mem, sunrealtype reltolS, - N_Vector* abstolS); + N_Vector1d abstolS); SUNDIALS_EXPORT int IDASensEEtolerances(void* ida_mem); /* Initial condition calculation function */ -SUNDIALS_EXPORT int IDAGetSensConsistentIC(void* ida_mem, N_Vector* yyS0, - N_Vector* ypS0); +SUNDIALS_EXPORT int IDAGetSensConsistentIC(void* ida_mem, N_Vector1d yyS0, + N_Vector1d ypS0); /* Optional input specification functions */ SUNDIALS_EXPORT int IDASetSensDQMethod(void* ida_mem, int DQtype, sunrealtype DQrhomax); SUNDIALS_EXPORT int IDASetSensErrCon(void* ida_mem, sunbooleantype errconS); SUNDIALS_EXPORT int IDASetSensMaxNonlinIters(void* ida_mem, int maxcorS); -SUNDIALS_EXPORT int IDASetSensParams(void* ida_mem, sunrealtype* p, - sunrealtype* pbar, int* plist); +SUNDIALS_EXPORT int IDASetSensParams(void* ida_mem, sunrealtype1d p, + sunrealtype1d pbar, int1d plist); /* Integrator nonlinear solver specification functions */ SUNDIALS_EXPORT int IDASetNonlinearSolverSensSim(void* ida_mem, @@ -379,12 +380,12 @@ SUNDIALS_EXPORT int IDASensToggleOff(void* ida_mem); /* Extraction and dense output functions */ SUNDIALS_EXPORT int IDAGetSens(void* ida_mem, sunrealtype* tret, - N_Vector* yySout); + N_Vector1d yySout); SUNDIALS_EXPORT int IDAGetSens1(void* ida_mem, sunrealtype* tret, int is, N_Vector yySret); SUNDIALS_EXPORT int IDAGetSensDky(void* ida_mem, sunrealtype t, int k, - N_Vector* dkyS); + N_Vector1d dkyS); SUNDIALS_EXPORT int IDAGetSensDky1(void* ida_mem, sunrealtype t, int k, int is, N_Vector dkyS); @@ -394,7 +395,7 @@ SUNDIALS_EXPORT int IDAGetNumResEvalsSens(void* ida_mem, long int* nresevalsS); SUNDIALS_EXPORT int IDAGetSensNumErrTestFails(void* ida_mem, long int* nSetfails); SUNDIALS_EXPORT int IDAGetSensNumLinSolvSetups(void* ida_mem, long int* nlinsetupsS); -SUNDIALS_EXPORT int IDAGetSensErrWeights(void* ida_mem, N_Vector_S eSweight); +SUNDIALS_EXPORT int IDAGetSensErrWeights(void* ida_mem, N_Vector1d eSweight); SUNDIALS_EXPORT int IDAGetSensStats(void* ida_mem, long int* nresSevals, long int* nresevalsS, long int* nSetfails, long int* nlinsetupsS); @@ -416,14 +417,14 @@ SUNDIALS_EXPORT void IDASensFree(void* ida_mem); /* Initialization functions */ SUNDIALS_EXPORT int IDAQuadSensInit(void* ida_mem, IDAQuadSensRhsFn resQS, - N_Vector* yQS0); -SUNDIALS_EXPORT int IDAQuadSensReInit(void* ida_mem, N_Vector* yQS0); + N_Vector1d yQS0); +SUNDIALS_EXPORT int IDAQuadSensReInit(void* ida_mem, N_Vector1d yQS0); /* Tolerance input functions */ SUNDIALS_EXPORT int IDAQuadSensSStolerances(void* ida_mem, sunrealtype reltolQS, sunrealtype* abstolQS); SUNDIALS_EXPORT int IDAQuadSensSVtolerances(void* ida_mem, sunrealtype reltolQS, - N_Vector* abstolQS); + N_Vector1d abstolQS); SUNDIALS_EXPORT int IDAQuadSensEEtolerances(void* ida_mem); /* Optional input specification functions */ @@ -431,11 +432,11 @@ SUNDIALS_EXPORT int IDASetQuadSensErrCon(void* ida_mem, sunbooleantype errconQS) /* Extraction and dense output functions */ SUNDIALS_EXPORT int IDAGetQuadSens(void* ida_mem, sunrealtype* tret, - N_Vector* yyQSout); + N_Vector1d yyQSout); SUNDIALS_EXPORT int IDAGetQuadSens1(void* ida_mem, sunrealtype* tret, int is, N_Vector yyQSret); SUNDIALS_EXPORT int IDAGetQuadSensDky(void* ida_mem, sunrealtype t, int k, - N_Vector* dkyQS); + N_Vector1d dkyQS); SUNDIALS_EXPORT int IDAGetQuadSensDky1(void* ida_mem, sunrealtype t, int k, int is, N_Vector dkyQS); @@ -444,7 +445,7 @@ SUNDIALS_EXPORT int IDAGetQuadSensNumRhsEvals(void* ida_mem, long int* nrhsQSevals); SUNDIALS_EXPORT int IDAGetQuadSensNumErrTestFails(void* ida_mem, long int* nQSetfails); -SUNDIALS_EXPORT int IDAGetQuadSensErrWeights(void* ida_mem, N_Vector* eQSweight); +SUNDIALS_EXPORT int IDAGetQuadSensErrWeights(void* ida_mem, N_Vector1d eQSweight); SUNDIALS_EXPORT int IDAGetQuadSensStats(void* ida_mem, long int* nrhsQSevals, long int* nQSetfails); @@ -501,8 +502,8 @@ SUNDIALS_EXPORT int IDACalcICB(void* ida_mem, int which, sunrealtype tout1, N_Vector yy0, N_Vector yp0); SUNDIALS_EXPORT int IDACalcICBS(void* ida_mem, int which, sunrealtype tout1, - N_Vector yy0, N_Vector yp0, N_Vector* yyS0, - N_Vector* ypS0); + N_Vector yy0, N_Vector yp0, N_Vector1d yyS0, + N_Vector1d ypS0); /* Solver Function For Forward Problems */ @@ -543,6 +544,8 @@ SUNDIALS_EXPORT int IDAGetQuadB(void* ida_mem, int which, sunrealtype* tret, /* Optional Output Functions For Backward Problems */ +SUNDIALS_EXPORT int IDAGetUserDataB(void* ida_mem, int which, void** user_data); + SUNDIALS_EXPORT void* IDAGetAdjIDABmem(void* ida_mem, int which); SUNDIALS_EXPORT int IDAGetConsistentICB(void* ida_mem, int which, N_Vector yyB0, diff --git a/include/idas/idas.hpp b/include/idas/idas.hpp new file mode 100644 index 0000000000..a0782ee38a --- /dev/null +++ b/include/idas/idas.hpp @@ -0,0 +1,54 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * ----------------------------------------------------------------------------- + * C++ specific IDAS definitions. + * ---------------------------------------------------------------------------*/ + +#ifndef _IDAS_HPP +#define _IDAS_HPP + +extern "C" { +#include +} + +#include + +namespace sundials { +namespace experimental { + +struct IDADeleter +{ + void operator()(void* v) + { + if (v) { IDAFree(&v); } + } +}; + +class IDAView : public ClassView +{ +public: + using ClassView::ClassView; + template + static IDAView Create(Args&&... args); +}; + +template +IDAView IDAView::Create(Args&&... args) +{ + return IDAView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/idas/idas_ls.h b/include/idas/idas_ls.h index 0112d17589..d10b41f0be 100644 --- a/include/idas/idas_ls.h +++ b/include/idas/idas_ls.h @@ -134,7 +134,7 @@ typedef int (*IDALsJacFnB)(sunrealtype tt, sunrealtype c_jB, N_Vector yy, N_Vector tmp1B, N_Vector tmp2B, N_Vector tmp3B); typedef int (*IDALsJacFnBS)(sunrealtype tt, sunrealtype c_jB, N_Vector yy, - N_Vector yp, N_Vector* yS, N_Vector* ypS, + N_Vector yp, N_Vector1d yS, N_Vector1d ypS, N_Vector yyB, N_Vector ypB, N_Vector rrB, SUNMatrix JacB, void* user_dataB, N_Vector tmp1B, N_Vector tmp2B, N_Vector tmp3B); @@ -144,7 +144,7 @@ typedef int (*IDALsPrecSetupFnB)(sunrealtype tt, N_Vector yy, N_Vector yp, sunrealtype c_jB, void* user_dataB); typedef int (*IDALsPrecSetupFnBS)(sunrealtype tt, N_Vector yy, N_Vector yp, - N_Vector* yyS, N_Vector* ypS, N_Vector yyB, + N_Vector1d yyS, N_Vector1d ypS, N_Vector yyB, N_Vector ypB, N_Vector rrB, sunrealtype c_jB, void* user_dataB); @@ -154,7 +154,7 @@ typedef int (*IDALsPrecSolveFnB)(sunrealtype tt, N_Vector yy, N_Vector yp, sunrealtype deltaB, void* user_dataB); typedef int (*IDALsPrecSolveFnBS)(sunrealtype tt, N_Vector yy, N_Vector yp, - N_Vector* yyS, N_Vector* ypS, N_Vector yyB, + N_Vector1d yyS, N_Vector1d ypS, N_Vector yyB, N_Vector ypB, N_Vector rrB, N_Vector rvecB, N_Vector zvecB, sunrealtype c_jB, sunrealtype deltaB, void* user_dataB); @@ -164,7 +164,7 @@ typedef int (*IDALsJacTimesSetupFnB)(sunrealtype t, N_Vector yy, N_Vector yp, sunrealtype c_jB, void* user_dataB); typedef int (*IDALsJacTimesSetupFnBS)(sunrealtype t, N_Vector yy, N_Vector yp, - N_Vector* yyS, N_Vector* ypS, + N_Vector1d yyS, N_Vector1d ypS, N_Vector yyB, N_Vector ypB, N_Vector rrB, sunrealtype c_jB, void* user_dataB); @@ -175,9 +175,9 @@ typedef int (*IDALsJacTimesVecFnB)(sunrealtype t, N_Vector yy, N_Vector yp, N_Vector tmp2B); typedef int (*IDALsJacTimesVecFnBS)(sunrealtype t, N_Vector yy, N_Vector yp, - N_Vector* yyS, N_Vector* ypS, N_Vector yyB, - N_Vector ypB, N_Vector rrB, N_Vector vB, - N_Vector JvB, sunrealtype c_jB, + N_Vector1d yyS, N_Vector1d ypS, + N_Vector yyB, N_Vector ypB, N_Vector rrB, + N_Vector vB, N_Vector JvB, sunrealtype c_jB, void* user_dataB, N_Vector tmp1B, N_Vector tmp2B); diff --git a/include/kinsol/kinsol.h b/include/kinsol/kinsol.h index f85e0b692c..9e569e22a5 100644 --- a/include/kinsol/kinsol.h +++ b/include/kinsol/kinsol.h @@ -81,9 +81,6 @@ extern "C" { typedef int (*KINSysFn)(N_Vector uu, N_Vector fval, void* user_data); -typedef void (*KINInfoHandlerFn)(const char* module, const char* function, - char* msg, void* user_data); - typedef int (*KINDampingFn)(long int iter, N_Vector u_val, N_Vector g_val, sunrealtype* qt_fn, long int depth, void* user_data, sunrealtype* damping_factor); diff --git a/include/kinsol/kinsol.hpp b/include/kinsol/kinsol.hpp new file mode 100644 index 0000000000..feac102f83 --- /dev/null +++ b/include/kinsol/kinsol.hpp @@ -0,0 +1,54 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * ----------------------------------------------------------------------------- + * C++ specific KINSOL definitions. + * ---------------------------------------------------------------------------*/ + +#ifndef _KINSOL_HPP +#define _KINSOL_HPP + +extern "C" { +#include +} + +#include + +namespace sundials { +namespace experimental { + +struct KINDeleter +{ + void operator()(void* v) + { + if (v) { KINFree(&v); } + } +}; + +class KINView : public ClassView +{ +public: + using ClassView::ClassView; + template + static KINView Create(Args&&... args); +}; + +template +KINView KINView::Create(Args&&... args) +{ + return KINView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/kinsol/kinsol_ls.h b/include/kinsol/kinsol_ls.h index 5ede2e3567..3e7e15d871 100644 --- a/include/kinsol/kinsol_ls.h +++ b/include/kinsol/kinsol_ls.h @@ -58,7 +58,7 @@ typedef int (*KINLsPrecSolveFn)(N_Vector uu, N_Vector uscale, N_Vector fval, N_Vector fscale, N_Vector vv, void* user_data); typedef int (*KINLsJacTimesVecFn)(N_Vector v, N_Vector Jv, N_Vector uu, - sunbooleantype* new_uu, void* J_data); + sunbooleantype* new_uu, void* user_data); /*================================================================== KINLS Exported functions diff --git a/include/nvector/nvector_kokkos.hpp b/include/nvector/nvector_kokkos.hpp index 6e6df2220a..b4fb45de5b 100644 --- a/include/nvector/nvector_kokkos.hpp +++ b/include/nvector/nvector_kokkos.hpp @@ -75,7 +75,7 @@ N_Vector N_VClone_Kokkos(N_Vector w) { auto vec{GetVec(w)}; auto new_vec{new VectorType(*vec)}; - return new_vec->Convert(); + return new_vec->get(); } template @@ -567,9 +567,9 @@ class Vector : public sundials::impl::BaseNVector, operator N_Vector() const override { return object_.get(); } - N_Vector Convert() override { return object_.get(); } + N_Vector get() override { return object_.get(); } - N_Vector Convert() const override { return object_.get(); } + N_Vector get() const override { return object_.get(); } private: view_type view_; diff --git a/include/sunadaptcontroller/sunadaptcontroller_mrihtol.h b/include/sunadaptcontroller/sunadaptcontroller_mrihtol.h index 38e8affd9c..132e96fe27 100644 --- a/include/sunadaptcontroller/sunadaptcontroller_mrihtol.h +++ b/include/sunadaptcontroller/sunadaptcontroller_mrihtol.h @@ -47,7 +47,6 @@ SUNDIALS_EXPORT SUNAdaptController SUNAdaptController_MRIHTol(SUNAdaptController HControl, SUNAdaptController TolControl, SUNContext sunctx); - SUNDIALS_EXPORT SUNErrCode SUNAdaptController_SetParams_MRIHTol(SUNAdaptController C, sunrealtype inner_max_relch, @@ -87,7 +86,6 @@ SUNDIALS_EXPORT int SUNAdaptController_UpdateMRIHTol_MRIHTol(SUNAdaptController C, sunrealtype H, sunrealtype tolfac, sunrealtype DSM, sunrealtype dsm); - SUNDIALS_DEPRECATED_EXPORT_MSG( "Work space functions will be removed in version 8.0.0") int SUNAdaptController_Space_MRIHTol(SUNAdaptController C, long int* lenrw, diff --git a/include/sundials/sundials_adaptcontroller.h b/include/sundials/sundials_adaptcontroller.h index 86eb1a5ece..03194877de 100644 --- a/include/sundials/sundials_adaptcontroller.h +++ b/include/sundials/sundials_adaptcontroller.h @@ -37,12 +37,16 @@ extern "C" { * MRI_H_TOL - controls slow step and fast relative tolerances * ----------------------------------------------------------------- */ -typedef enum +enum SUNAdaptController_Type { SUN_ADAPTCONTROLLER_NONE, SUN_ADAPTCONTROLLER_H, SUN_ADAPTCONTROLLER_MRI_H_TOL -} SUNAdaptController_Type; +}; + +#ifndef SWIG +typedef enum SUNAdaptController_Type SUNAdaptController_Type; +#endif /* ----------------------------------------------------------------- * Generic definition of SUNAdaptController diff --git a/include/sundials/sundials_adaptcontroller.hpp b/include/sundials/sundials_adaptcontroller.hpp new file mode 100644 index 0000000000..b198a72b59 --- /dev/null +++ b/include/sundials/sundials_adaptcontroller.hpp @@ -0,0 +1,53 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * ----------------------------------------------------------------------------- + * C++ view of SUNDIALS SUNAdaptController + * ---------------------------------------------------------------------------*/ + +#ifndef _SUNDIALS_ADAPTCONTROLLER_HPP +#define _SUNDIALS_ADAPTCONTROLLER_HPP + +#include +#include +#include "sundials_nvector.h" + +namespace sundials { +namespace experimental { + +struct SUNAdaptControllerDeleter +{ + void operator()(SUNAdaptController C) + { + if (C) { SUNAdaptController_Destroy(C); } + } +}; + +class SUNAdaptControllerView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static SUNAdaptControllerView Create(Args&&... args); +}; + +template +SUNAdaptControllerView SUNAdaptControllerView::Create(Args&&... args) +{ + return SUNAdaptControllerView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/sundials/sundials_adjointcheckpointscheme.h b/include/sundials/sundials_adjointcheckpointscheme.h index bff46081a5..57ee743cd2 100644 --- a/include/sundials/sundials_adjointcheckpointscheme.h +++ b/include/sundials/sundials_adjointcheckpointscheme.h @@ -22,7 +22,7 @@ extern "C" { #endif -typedef struct SUNAdjointCheckpointScheme_* SUNAdjointCheckpointScheme; +typedef _SUNDIALS_STRUCT_ SUNAdjointCheckpointScheme_* SUNAdjointCheckpointScheme; typedef SUNErrCode (*SUNAdjointCheckpointSchemeNeedsSavingFn)( SUNAdjointCheckpointScheme check_scheme, suncountertype step_num, diff --git a/include/sundials/sundials_adjointcheckpointscheme.hpp b/include/sundials/sundials_adjointcheckpointscheme.hpp new file mode 100644 index 0000000000..ed6e32e955 --- /dev/null +++ b/include/sundials/sundials_adjointcheckpointscheme.hpp @@ -0,0 +1,52 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * ----------------------------------------------------------------------------- + * C++ view of SUNDIALS SUNAdjointCheckpointScheme + * ---------------------------------------------------------------------------*/ + +#ifndef _SUNDIALS_ADJOINTCHECKPOINTSCHEME_HPP +#define _SUNDIALS_ADJOINTCHECKPOINTSCHEME_HPP + +#include +#include + +namespace sundials { +namespace experimental { + +struct SUNAdjointCheckpointSchemeDeleter +{ + void operator()(SUNAdjointCheckpointScheme self) + { + if (self) { SUNAdjointCheckpointScheme_Destroy(&self); } + } +}; + +class SUNAdjointCheckpointSchemeView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static SUNAdjointCheckpointSchemeView Create(Args&&... args); +}; + +template +SUNAdjointCheckpointSchemeView SUNAdjointCheckpointSchemeView::Create(Args&&... args) +{ + return SUNAdjointCheckpointSchemeView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/sundials/sundials_adjointstepper.hpp b/include/sundials/sundials_adjointstepper.hpp new file mode 100644 index 0000000000..4b840324af --- /dev/null +++ b/include/sundials/sundials_adjointstepper.hpp @@ -0,0 +1,54 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * ----------------------------------------------------------------------------- + * C++ view of SUNDIALS SUNAdjointStepper + * ---------------------------------------------------------------------------*/ + +#ifndef _SUNDIALS_ADJOINTSTEPPER_HPP +#define _SUNDIALS_ADJOINTSTEPPER_HPP + +#include +#include + +namespace sundials { +namespace experimental { + +struct SUNAdjointStepperDeleter +{ + void operator()(SUNAdjointStepper self) + { + if (self) { SUNAdjointStepper_Destroy(&self); } + } +}; + +class SUNAdjointStepperView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static SUNAdjointStepperView Create(Args&&... args); +}; + +template +SUNAdjointStepperView SUNAdjointStepperView::Create(Args&&... args) +{ + SUNAdjointStepper stepper; + SUNAdjointStepper_Create(std::forward(args)..., &stepper); + return SUNAdjointStepperView(stepper); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/sundials/sundials_base.hpp b/include/sundials/sundials_base.hpp index f356b31308..a08ef98d0e 100644 --- a/include/sundials/sundials_base.hpp +++ b/include/sundials/sundials_base.hpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace sundials { namespace impl { @@ -119,32 +120,48 @@ class ClassView : public sundials::ConvertibleTo public: ClassView() : object_(nullptr) {} - ClassView(T&& object) : object_(std::make_unique(object)) {} + ClassView(T& object) : object_(object) {} - ClassView(const ClassView&) = delete; - ClassView(ClassView&& other) = default; + ClassView(T&& object) : object_(object) {} + + ClassView(const ClassView&) = delete; + + ClassView(ClassView&& other) noexcept + : object_(std::exchange(other.object_, nullptr)) + {} ClassView& operator=(const ClassView&) = delete; - ClassView& operator=(ClassView&& rhs) = default; + + ClassView& operator=(ClassView&& rhs) noexcept + { + this->object_ = std::exchange(rhs.object_, nullptr); + return *this; + }; ~ClassView() { - if (object_) { Deleter{}(this->Convert()); } + if (object_) { Deleter{}(this->get()); } }; // Override ConvertibleTo functions - T Convert() override { return *object_.get(); } + T get() override { return object_; } - T Convert() const override { return *object_.get(); } + T get() const override { return object_; } - operator T() override { return *object_.get(); } + operator T() override { return object_; } - operator T() const override { return *object_.get(); } + operator T() const override { return object_; } private: - std::unique_ptr object_; + T object_; }; +template +T Create(Args&&... args) +{ + return ClassView(Func(std::forward(args)...)); +} + } // namespace experimental } // namespace sundials diff --git a/include/sundials/sundials_context.hpp b/include/sundials/sundials_context.hpp index ce3ea10234..71637ffd3b 100644 --- a/include/sundials/sundials_context.hpp +++ b/include/sundials/sundials_context.hpp @@ -28,12 +28,14 @@ namespace sundials { class Context : public sundials::ConvertibleTo { public: - explicit Context(SUNComm comm = SUN_COMM_NULL) + Context(SUNComm comm = SUN_COMM_NULL) { sunctx_ = std::make_unique(); SUNContext_Create(comm, sunctx_.get()); } + Context(SUNContext sunctx) { sunctx_.reset(&sunctx); } + /* disallow copy, but allow move construction */ Context(const Context&) = delete; Context(Context&&) = default; @@ -42,14 +44,17 @@ class Context : public sundials::ConvertibleTo Context& operator=(const Context&) = delete; Context& operator=(Context&&) = default; - SUNContext Convert() override { return *sunctx_.get(); } + SUNContext get() override { return *sunctx_.get(); } - SUNContext Convert() const override { return *sunctx_.get(); } + SUNContext get() const override { return *sunctx_.get(); } operator SUNContext() override { return *sunctx_.get(); } operator SUNContext() const override { return *sunctx_.get(); } + template + static Context Create(Args&&... args); + ~Context() { if (sunctx_) { SUNContext_Free(sunctx_.get()); } @@ -59,6 +64,14 @@ class Context : public sundials::ConvertibleTo std::unique_ptr sunctx_; }; +template +Context Context::Create(Args&&... args) +{ + return Context(std::forward(args)...); +} + +using SUNContextView = Context; + } // namespace sundials #endif // _SUNDIALS_CONTEXT_HPP diff --git a/include/sundials/sundials_convertibleto.hpp b/include/sundials/sundials_convertibleto.hpp index f7ab97710b..7a2be0573f 100644 --- a/include/sundials/sundials_convertibleto.hpp +++ b/include/sundials/sundials_convertibleto.hpp @@ -24,8 +24,8 @@ class ConvertibleTo { public: // Explicit conversion to the underlying type - virtual T Convert() = 0; - virtual T Convert() const = 0; + virtual T get() = 0; + virtual T get() const = 0; // Implicit conversion to the underlying type virtual operator T() = 0; diff --git a/include/sundials/sundials_domeigestimator.h b/include/sundials/sundials_domeigestimator.h index 52dfa316ec..2f2c8f4740 100644 --- a/include/sundials/sundials_domeigestimator.h +++ b/include/sundials/sundials_domeigestimator.h @@ -64,6 +64,7 @@ struct SUNDomEigEstimator_Ops_ struct SUNDomEigEstimator_ { void* content; + void* python; SUNDomEigEstimator_Ops ops; SUNContext sunctx; }; diff --git a/include/sundials/sundials_domeigestimator.hpp b/include/sundials/sundials_domeigestimator.hpp new file mode 100644 index 0000000000..af06517660 --- /dev/null +++ b/include/sundials/sundials_domeigestimator.hpp @@ -0,0 +1,56 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * ----------------------------------------------------------------------------- + * C++ view of SUNDIALS SUNDomEigEstimator + * ---------------------------------------------------------------------------*/ + +#ifndef _SUNDIALS_DOMEIGESTIMATOR_HPP +#define _SUNDIALS_DOMEIGESTIMATOR_HPP + +#include +#include + +namespace sundials { +namespace impl { +using BaseDomEigEstimator = + BaseObject; +} // namespace impl + +namespace experimental { +struct SUNDomEigEstimatorDeleter +{ + void operator()(SUNDomEigEstimator DEE) + { + if (DEE) { SUNDomEigEstimator_Destroy(&DEE); } + } +}; + +class SUNDomEigEstimatorView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static SUNDomEigEstimatorView Create(Args&&... args); +}; + +template +SUNDomEigEstimatorView SUNDomEigEstimatorView::Create(Args&&... args) +{ + return SUNDomEigEstimatorView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/sundials/sundials_errors.h b/include/sundials/sundials_errors.h index 55293a288f..29802bfdd3 100644 --- a/include/sundials/sundials_errors.h +++ b/include/sundials/sundials_errors.h @@ -88,7 +88,7 @@ codes, and old/deprecated codes for matrix and (non)linear solvers. */ /* clang-format off */ -enum +enum SUNErrCode_ { SUN_ERR_MINIMUM = -10000, SUN_ERR_CODE_LIST(SUN_EXPAND_TO_ENUM) diff --git a/include/sundials/sundials_futils.h b/include/sundials/sundials_futils.h index 8e9b5ba371..6a26557f68 100644 --- a/include/sundials/sundials_futils.h +++ b/include/sundials/sundials_futils.h @@ -11,27 +11,34 @@ * SPDX-License-Identifier: BSD-3-Clause * SUNDIALS Copyright End * ----------------------------------------------------------------- - * SUNDIALS Fortran 2003 interface utility definitions. + * SUNDIALS FILE utility definitions. * -----------------------------------------------------------------*/ #ifndef _SUNDIALS_FUTILS_H #define _SUNDIALS_FUTILS_H #include -#include -#include "sundials/sundials_types.h" +#include +#include #ifdef __cplusplus /* wrapper to enable C++ usage */ extern "C" { #endif /* Create a file pointer with the given file name and mode. */ -SUNDIALS_EXPORT SUNErrCode SUNDIALSFileOpen(const char* filename, - const char* modes, FILE** fp); +SUNDIALS_EXPORT +SUNErrCode SUNFileOpen(const char* filename, const char* modes, FILE** fp); + +SUNDIALS_DEPRECATED_EXPORT_MSG("Use SUNFileOpen") +SUNErrCode SUNDIALSFileOpen(const char* filename, const char* modes, FILE** fp); /* Close a file pointer with the given file name. */ -SUNDIALS_EXPORT SUNErrCode SUNDIALSFileClose(FILE** fp); +SUNDIALS_EXPORT +SUNErrCode SUNFileClose(FILE** fp); + +SUNDIALS_DEPRECATED_EXPORT_MSG("Use SUNFileClose") +SUNErrCode SUNDIALSFileClose(FILE** fp); #ifdef __cplusplus } diff --git a/include/sundials/sundials_iterative.h b/include/sundials/sundials_iterative.h index a0e7de7bfc..b285caa9b7 100644 --- a/include/sundials/sundials_iterative.h +++ b/include/sundials/sundials_iterative.h @@ -53,7 +53,7 @@ extern "C" { * ----------------------------------------------------------------- */ -enum +enum SUN_PREC_ID { SUN_PREC_NONE, SUN_PREC_LEFT, @@ -75,7 +75,7 @@ enum * ----------------------------------------------------------------- */ -enum +enum SUN_GRAMSCHMIDT_ID { SUN_MODIFIED_GS = 1, SUN_CLASSICAL_GS = 2 @@ -161,7 +161,7 @@ typedef int (*SUNPSolveFn)(void* P_data, N_Vector r, N_Vector z, * ----------------------------------------------------------------- */ -typedef int (*SUNQRAddFn)(N_Vector* Q, sunrealtype* R, N_Vector f, int m, +typedef int (*SUNQRAddFn)(N_Vector1d Q, sunrealtype1d R, N_Vector f, int m, int mMax, void* QR_data); /* @@ -201,7 +201,7 @@ typedef int (*SUNQRAddFn)(N_Vector* Q, sunrealtype* R, N_Vector f, int m, */ SUNDIALS_EXPORT -SUNErrCode SUNModifiedGS(N_Vector* v, sunrealtype** h, int k, int p, +SUNErrCode SUNModifiedGS(N_Vector1d v, sunrealtype2d h, int k, int p, sunrealtype* new_vk_norm); /* @@ -225,9 +225,9 @@ SUNErrCode SUNModifiedGS(N_Vector* v, sunrealtype** h, int k, int p, */ SUNDIALS_EXPORT -SUNErrCode SUNClassicalGS(N_Vector* v, sunrealtype** h, int k, int p, - sunrealtype* new_vk_norm, sunrealtype* stemp, - N_Vector* vtemp); +SUNErrCode SUNClassicalGS(N_Vector1d v, sunrealtype2d h, int k, int p, + sunrealtype* new_vk_norm, sunrealtype1d stemp, + N_Vector1d vtemp); /* * ----------------------------------------------------------------- @@ -262,7 +262,7 @@ SUNErrCode SUNClassicalGS(N_Vector* v, sunrealtype** h, int k, int p, */ SUNDIALS_EXPORT -int SUNQRfact(int n, sunrealtype** h, sunrealtype* q, int job); +int SUNQRfact(int n, sunrealtype2d h, sunrealtype1d q, int job); /* * ----------------------------------------------------------------- @@ -297,7 +297,7 @@ int SUNQRfact(int n, sunrealtype** h, sunrealtype* q, int job); */ SUNDIALS_EXPORT -int SUNQRsol(int n, sunrealtype** h, sunrealtype* q, sunrealtype* b); +int SUNQRsol(int n, sunrealtype2d h, sunrealtype1d q, sunrealtype1d b); /* * ----------------------------------------------------------------- @@ -328,7 +328,7 @@ int SUNQRsol(int n, sunrealtype** h, sunrealtype* q, sunrealtype* b); */ SUNDIALS_EXPORT -SUNErrCode SUNQRAdd_MGS(N_Vector* Q, sunrealtype* R, N_Vector df, int m, +SUNErrCode SUNQRAdd_MGS(N_Vector1d Q, sunrealtype1d R, N_Vector df, int m, int mMax, void* QRdata); /* @@ -366,7 +366,7 @@ SUNErrCode SUNQRAdd_MGS(N_Vector* Q, sunrealtype* R, N_Vector df, int m, */ SUNDIALS_EXPORT -SUNErrCode SUNQRAdd_ICWY(N_Vector* Q, sunrealtype* R, N_Vector df, int m, +SUNErrCode SUNQRAdd_ICWY(N_Vector1d Q, sunrealtype1d R, N_Vector df, int m, int mMax, void* QRdata); /* @@ -379,7 +379,7 @@ SUNErrCode SUNQRAdd_ICWY(N_Vector* Q, sunrealtype* R, N_Vector df, int m, */ SUNDIALS_EXPORT -SUNErrCode SUNQRAdd_ICWY_SB(N_Vector* Q, sunrealtype* R, N_Vector df, int m, +SUNErrCode SUNQRAdd_ICWY_SB(N_Vector1d Q, sunrealtype1d R, N_Vector df, int m, int mMax, void* QRdata); /* @@ -414,7 +414,7 @@ SUNErrCode SUNQRAdd_ICWY_SB(N_Vector* Q, sunrealtype* R, N_Vector df, int m, */ SUNDIALS_EXPORT -SUNErrCode SUNQRAdd_CGS2(N_Vector* Q, sunrealtype* R, N_Vector df, int m, +SUNErrCode SUNQRAdd_CGS2(N_Vector1d Q, sunrealtype1d R, N_Vector df, int m, int mMax, void* QRdata); /* @@ -451,7 +451,7 @@ SUNErrCode SUNQRAdd_CGS2(N_Vector* Q, sunrealtype* R, N_Vector df, int m, */ SUNDIALS_EXPORT -SUNErrCode SUNQRAdd_DCGS2(N_Vector* Q, sunrealtype* R, N_Vector df, int m, +SUNErrCode SUNQRAdd_DCGS2(N_Vector1d Q, sunrealtype1d R, N_Vector df, int m, int mMax, void* QRdata); /* @@ -464,7 +464,7 @@ SUNErrCode SUNQRAdd_DCGS2(N_Vector* Q, sunrealtype* R, N_Vector df, int m, */ SUNDIALS_EXPORT -SUNErrCode SUNQRAdd_DCGS2_SB(N_Vector* Q, sunrealtype* R, N_Vector df, int m, +SUNErrCode SUNQRAdd_DCGS2_SB(N_Vector1d Q, sunrealtype1d R, N_Vector df, int m, int mMax, void* QRdata); #ifdef __cplusplus diff --git a/include/sundials/sundials_linearsolver.h b/include/sundials/sundials_linearsolver.h index c3cd942c29..8d8c3301c6 100644 --- a/include/sundials/sundials_linearsolver.h +++ b/include/sundials/sundials_linearsolver.h @@ -69,15 +69,19 @@ extern "C" { * Implemented SUNLinearSolver types and IDs: * ----------------------------------------------------------------- */ -typedef enum +enum SUNLinearSolver_Type { SUNLINEARSOLVER_DIRECT, SUNLINEARSOLVER_ITERATIVE, SUNLINEARSOLVER_MATRIX_ITERATIVE, SUNLINEARSOLVER_MATRIX_EMBEDDED -} SUNLinearSolver_Type; +}; + +#ifndef SWIG +typedef enum SUNLinearSolver_Type SUNLinearSolver_Type; +#endif -typedef enum +enum SUNLinearSolver_ID { SUNLINEARSOLVER_BAND, SUNLINEARSOLVER_DENSE, @@ -97,7 +101,11 @@ typedef enum SUNLINEARSOLVER_GINKGO, SUNLINEARSOLVER_KOKKOSDENSE, SUNLINEARSOLVER_CUSTOM -} SUNLinearSolver_ID; +}; + +#ifndef SWIG +typedef enum SUNLinearSolver_ID SUNLinearSolver_ID; +#endif /* ----------------------------------------------------------------- * Generic definition of SUNLinearSolver @@ -138,6 +146,7 @@ struct _generic_SUNLinearSolver_Ops struct _generic_SUNLinearSolver { void* content; + void* python; SUNLinearSolver_Ops ops; SUNContext sunctx; }; diff --git a/include/sundials/sundials_linearsolver.hpp b/include/sundials/sundials_linearsolver.hpp index 36a1013f8b..b71c2b6e05 100644 --- a/include/sundials/sundials_linearsolver.hpp +++ b/include/sundials/sundials_linearsolver.hpp @@ -36,7 +36,21 @@ struct SUNLinearSolverDeleter } }; -using SUNLinearSolverView = ClassView; +class SUNLinearSolverView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static SUNLinearSolverView Create(Args&&... args); +}; + +template +SUNLinearSolverView SUNLinearSolverView::Create(Args&&... args) +{ + return SUNLinearSolverView(std::forward(args)...); +} + } // namespace experimental } // namespace sundials diff --git a/include/sundials/sundials_logger.h b/include/sundials/sundials_logger.h index 45ddd923a9..397be0db8f 100644 --- a/include/sundials/sundials_logger.h +++ b/include/sundials/sundials_logger.h @@ -23,7 +23,7 @@ extern "C" { #endif -typedef enum +enum SUNLogLevel { SUN_LOGLEVEL_ALL = -1, SUN_LOGLEVEL_NONE = 0, @@ -31,7 +31,11 @@ typedef enum SUN_LOGLEVEL_WARNING = 2, SUN_LOGLEVEL_INFO = 3, SUN_LOGLEVEL_DEBUG = 4 -} SUNLogLevel; +}; + +#ifndef SWIG +typedef enum SUNLogLevel SUNLogLevel; +#endif SUNDIALS_EXPORT SUNErrCode SUNLogger_Create(SUNComm comm, int output_rank, SUNLogger* logger); diff --git a/include/sundials/sundials_logger.hpp b/include/sundials/sundials_logger.hpp new file mode 100644 index 0000000000..ce74d7e59c --- /dev/null +++ b/include/sundials/sundials_logger.hpp @@ -0,0 +1,79 @@ +/* ----------------------------------------------------------------- + * Programmer: Cody J. Balos @ LLNL + * ----------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * -----------------------------------------------------------------*/ + +#ifndef _SUNDIALS_LOGGER_HPP +#define _SUNDIALS_LOGGER_HPP + +#include +#include +#include + +namespace sundials { +namespace experimental { + +class SUNLoggerView : public sundials::ConvertibleTo +{ +public: + SUNLoggerView(SUNComm comm, int output_rank) + { + logger_ = std::make_unique(); + SUNLogger_Create(comm, output_rank, logger_.get()); + } + + SUNLoggerView(SUNComm comm) + { + logger_ = std::make_unique(); + SUNLogger_CreateFromEnv(comm, logger_.get()); + } + + SUNLoggerView(SUNLogger sunlogger) { logger_.reset(&sunlogger); } + + /* disallow copy, but allow move construction */ + SUNLoggerView(const SUNLoggerView&) = delete; + SUNLoggerView(SUNLoggerView&&) = default; + + /* disallow copy, but allow move operators */ + SUNLoggerView& operator=(const SUNLoggerView&) = delete; + SUNLoggerView& operator=(SUNLoggerView&&) = default; + + SUNLogger get() override { return *logger_.get(); } + + SUNLogger get() const override { return *logger_.get(); } + + operator SUNLogger() override { return *logger_.get(); } + + operator SUNLogger() const override { return *logger_.get(); } + + template + static SUNLoggerView Create(Args&&... args); + + ~SUNLoggerView() + { + if (logger_) { SUNLogger_Destroy(logger_.get()); } + } + +private: + std::unique_ptr logger_; +}; + +template +SUNLoggerView SUNLoggerView::Create(Args&&... args) +{ + return SUNLoggerView(std::forward(args)...); +} + +} // namespace experimental +} // namespace sundials + +#endif /* SUNDIALS_LOGGER_HPP */ diff --git a/include/sundials/sundials_matrix.h b/include/sundials/sundials_matrix.h index 1acb16fd86..0940a90628 100644 --- a/include/sundials/sundials_matrix.h +++ b/include/sundials/sundials_matrix.h @@ -57,7 +57,7 @@ extern "C" { * Implemented SUNMatrix types * ----------------------------------------------------------------- */ -typedef enum +enum SUNMatrix_ID { SUNMATRIX_DENSE, SUNMATRIX_MAGMADENSE, @@ -69,7 +69,11 @@ typedef enum SUNMATRIX_GINKGO, SUNMATRIX_KOKKOSDENSE, SUNMATRIX_CUSTOM -} SUNMatrix_ID; +}; + +#ifndef SWIG +typedef enum SUNMatrix_ID SUNMatrix_ID; +#endif /* ----------------------------------------------------------------- * Generic definition of SUNMatrix diff --git a/include/sundials/sundials_matrix.hpp b/include/sundials/sundials_matrix.hpp index 07d521e761..9b65e9f481 100644 --- a/include/sundials/sundials_matrix.hpp +++ b/include/sundials/sundials_matrix.hpp @@ -35,7 +35,20 @@ struct SUNMatrixDeleter } }; -using SUNMatrixView = ClassView; +class SUNMatrixView : public ClassView +{ +public: + using ClassView::ClassView; + template + static SUNMatrixView Create(Args&&... args); +}; + +template +SUNMatrixView SUNMatrixView::Create(Args&&... args) +{ + return SUNMatrixView(std::forward(args)...); +} + } // namespace experimental } // namespace sundials diff --git a/include/sundials/sundials_memory.h b/include/sundials/sundials_memory.h index 2640525345..75ccab81de 100644 --- a/include/sundials/sundials_memory.h +++ b/include/sundials/sundials_memory.h @@ -25,14 +25,17 @@ extern "C" { #endif -typedef enum +enum SUNMemoryType { SUNMEMTYPE_HOST, /* pageable memory accessible on the host */ SUNMEMTYPE_PINNED, /* page-locked memory accessible on the host */ SUNMEMTYPE_DEVICE, /* memory accessible from the device */ SUNMEMTYPE_UVM /* memory accessible from the host or device */ -} SUNMemoryType; +}; +#ifndef SWIG +typedef enum SUNMemoryType SUNMemoryType; +#endif /* * SUNMemory is a simple abstraction of a pointer to some * contiguous memory, so that we can keep track of its type diff --git a/include/sundials/sundials_memory.hpp b/include/sundials/sundials_memory.hpp index 8b327a0d8e..fbb77acaad 100644 --- a/include/sundials/sundials_memory.hpp +++ b/include/sundials/sundials_memory.hpp @@ -35,7 +35,21 @@ struct SUNMemoryHelperDeleter } }; -using SUNMemoryHelperView = ClassView; +class SUNMemoryHelperView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static SUNMemoryHelperView Create(Args&&... args); +}; + +template +SUNMemoryHelperView SUNMemoryHelperView::Create(Args&&... args) +{ + return SUNMemoryHelperView(std::forward(args)...); +} + } // namespace experimental } // namespace sundials diff --git a/include/sundials/sundials_nonlinearsolver.h b/include/sundials/sundials_nonlinearsolver.h index ca1566cd8e..588faa5011 100644 --- a/include/sundials/sundials_nonlinearsolver.h +++ b/include/sundials/sundials_nonlinearsolver.h @@ -86,11 +86,15 @@ typedef int (*SUNNonlinSolConvTestFn)(SUNNonlinearSolver NLS, N_Vector y, * SUNNonlinearSolver types * ---------------------------------------------------------------------------*/ -typedef enum +enum SUNNonlinearSolver_Type { SUNNONLINEARSOLVER_ROOTFIND, SUNNONLINEARSOLVER_FIXEDPOINT -} SUNNonlinearSolver_Type; +}; + +#ifndef SWIG +typedef enum SUNNonlinearSolver_Type SUNNonlinearSolver_Type; +#endif /* ----------------------------------------------------------------------------- * Generic definition of SUNNonlinearSolver @@ -123,6 +127,7 @@ struct _generic_SUNNonlinearSolver_Ops struct _generic_SUNNonlinearSolver { void* content; + void* python; SUNNonlinearSolver_Ops ops; SUNContext sunctx; }; diff --git a/include/sundials/sundials_nonlinearsolver.hpp b/include/sundials/sundials_nonlinearsolver.hpp index 8289e2d138..48f56a0fa4 100644 --- a/include/sundials/sundials_nonlinearsolver.hpp +++ b/include/sundials/sundials_nonlinearsolver.hpp @@ -36,8 +36,21 @@ struct SUNNonlinearSolverDeleter } }; -using SUNNonlinearSolverView = - ClassView; +class SUNNonlinearSolverView + : public ClassView +{ +public: + using ClassView::ClassView; + template + static SUNNonlinearSolverView Create(Args&&... args); +}; + +template +SUNNonlinearSolverView SUNNonlinearSolverView::Create(Args&&... args) +{ + return SUNNonlinearSolverView(std::forward(args)...); +} + } // namespace experimental } // namespace sundials diff --git a/include/sundials/sundials_nvector.h b/include/sundials/sundials_nvector.h index 7385210b4c..af82b421b6 100644 --- a/include/sundials/sundials_nvector.h +++ b/include/sundials/sundials_nvector.h @@ -60,7 +60,7 @@ extern "C" { * Implemented N_Vector types * ----------------------------------------------------------------- */ -typedef enum +enum N_Vector_ID { SUNDIALS_NVEC_SERIAL, SUNDIALS_NVEC_PARALLEL, @@ -79,7 +79,11 @@ typedef enum SUNDIALS_NVEC_MPIMANYVECTOR, SUNDIALS_NVEC_MPIPLUSX, SUNDIALS_NVEC_CUSTOM -} N_Vector_ID; +}; + +#ifndef SWIG +typedef enum N_Vector_ID N_Vector_ID; +#endif /* ----------------------------------------------------------------- * Generic definition of N_Vector @@ -93,6 +97,8 @@ typedef _SUNDIALS_STRUCT_ _generic_N_Vector* N_Vector; /* Define array of N_Vectors */ typedef N_Vector* N_Vector_S; +typedef N_Vector* N_Vector1d; +typedef N_Vector** N_Vector2d; /* Structure containing function pointers to vector operations */ struct _generic_N_Vector_Ops @@ -109,9 +115,9 @@ struct _generic_N_Vector_Ops N_Vector (*nvcloneempty)(N_Vector); void (*nvdestroy)(N_Vector); void (*nvspace)(N_Vector, sunindextype*, sunindextype*); - sunrealtype* (*nvgetarraypointer)(N_Vector); - sunrealtype* (*nvgetdevicearraypointer)(N_Vector); - void (*nvsetarraypointer)(sunrealtype*, N_Vector); + sunrealtype1d (*nvgetarraypointer)(N_Vector); + sunrealtype1d (*nvgetdevicearraypointer)(N_Vector); + void (*nvsetarraypointer)(sunrealtype1d, N_Vector); SUNComm (*nvgetcommunicator)(N_Vector); sunindextype (*nvgetlength)(N_Vector); sunindextype (*nvgetlocallength)(N_Vector); @@ -144,23 +150,23 @@ struct _generic_N_Vector_Ops */ /* OPTIONAL fused vector operations */ - SUNErrCode (*nvlinearcombination)(int, sunrealtype*, N_Vector*, N_Vector); - SUNErrCode (*nvscaleaddmulti)(int, sunrealtype*, N_Vector, N_Vector*, - N_Vector*); - SUNErrCode (*nvdotprodmulti)(int, N_Vector, N_Vector*, sunrealtype*); + SUNErrCode (*nvlinearcombination)(int, sunrealtype1d, N_Vector1d, N_Vector); + SUNErrCode (*nvscaleaddmulti)(int, sunrealtype1d, N_Vector, N_Vector1d, + N_Vector1d); + SUNErrCode (*nvdotprodmulti)(int, N_Vector, N_Vector1d, sunrealtype1d); /* OPTIONAL vector array operations */ - SUNErrCode (*nvlinearsumvectorarray)(int, sunrealtype, N_Vector*, sunrealtype, - N_Vector*, N_Vector*); - SUNErrCode (*nvscalevectorarray)(int, sunrealtype*, N_Vector*, N_Vector*); - SUNErrCode (*nvconstvectorarray)(int, sunrealtype, N_Vector*); - SUNErrCode (*nvwrmsnormvectorarray)(int, N_Vector*, N_Vector*, sunrealtype*); - SUNErrCode (*nvwrmsnormmaskvectorarray)(int, N_Vector*, N_Vector*, N_Vector, - sunrealtype*); - SUNErrCode (*nvscaleaddmultivectorarray)(int, int, sunrealtype*, N_Vector*, - N_Vector**, N_Vector**); - SUNErrCode (*nvlinearcombinationvectorarray)(int, int, sunrealtype*, - N_Vector**, N_Vector*); + SUNErrCode (*nvlinearsumvectorarray)(int, sunrealtype, N_Vector1d, + sunrealtype, N_Vector1d, N_Vector1d); + SUNErrCode (*nvscalevectorarray)(int, sunrealtype1d, N_Vector1d, N_Vector1d); + SUNErrCode (*nvconstvectorarray)(int, sunrealtype, N_Vector1d); + SUNErrCode (*nvwrmsnormvectorarray)(int, N_Vector1d, N_Vector1d, sunrealtype1d); + SUNErrCode (*nvwrmsnormmaskvectorarray)(int, N_Vector1d, N_Vector1d, N_Vector, + sunrealtype1d); + SUNErrCode (*nvscaleaddmultivectorarray)(int, int, sunrealtype1d, N_Vector1d, + N_Vector2d, N_Vector2d); + SUNErrCode (*nvlinearcombinationvectorarray)(int, int, sunrealtype1d, + N_Vector2d, N_Vector1d); /* * OPTIONAL operations with no default implementation. @@ -178,8 +184,8 @@ struct _generic_N_Vector_Ops sunrealtype (*nvwsqrsummasklocal)(N_Vector, N_Vector, N_Vector); /* Single buffer reduction operations */ - SUNErrCode (*nvdotprodmultilocal)(int, N_Vector, N_Vector*, sunrealtype*); - SUNErrCode (*nvdotprodmultiallreduce)(int, N_Vector, sunrealtype*); + SUNErrCode (*nvdotprodmultilocal)(int, N_Vector, N_Vector1d, sunrealtype1d); + SUNErrCode (*nvdotprodmultiallreduce)(int, N_Vector, sunrealtype1d); /* XBraid interface operations */ SUNErrCode (*nvbufsize)(N_Vector, sunindextype*); @@ -205,7 +211,7 @@ struct _generic_N_Vector * Functions exported by NVECTOR module * ----------------------------------------------------------------- */ -SUNDIALS_EXPORT N_Vector N_VNewEmpty(SUNContext sunctx); +SUNDIALS_EXPORT N_Vector N_VNewEmpty(SUNContext sunctx); // py::return_value_policy::reference SUNDIALS_EXPORT void N_VFreeEmpty(N_Vector v); SUNDIALS_EXPORT SUNErrCode N_VCopyOps(N_Vector w, N_Vector v); @@ -214,15 +220,15 @@ SUNDIALS_EXPORT SUNErrCode N_VCopyOps(N_Vector w, N_Vector v); */ SUNDIALS_EXPORT N_Vector_ID N_VGetVectorID(N_Vector w); -SUNDIALS_EXPORT N_Vector N_VClone(N_Vector w); -SUNDIALS_EXPORT N_Vector N_VCloneEmpty(N_Vector w); +SUNDIALS_EXPORT N_Vector N_VClone(N_Vector w); // py::return_value_policy::reference +SUNDIALS_EXPORT N_Vector N_VCloneEmpty(N_Vector w); // py::return_value_policy::reference SUNDIALS_EXPORT void N_VDestroy(N_Vector v); SUNDIALS_DEPRECATED_EXPORT_MSG( "Work space functions will be removed in version 8.0.0") void N_VSpace(N_Vector v, sunindextype* lrw, sunindextype* liw); -SUNDIALS_EXPORT sunrealtype* N_VGetArrayPointer(N_Vector v); -SUNDIALS_EXPORT sunrealtype* N_VGetDeviceArrayPointer(N_Vector v); -SUNDIALS_EXPORT void N_VSetArrayPointer(sunrealtype* v_data, N_Vector v); +SUNDIALS_EXPORT sunrealtype1d N_VGetArrayPointer(N_Vector v); +SUNDIALS_EXPORT sunrealtype1d N_VGetDeviceArrayPointer(N_Vector v); +SUNDIALS_EXPORT void N_VSetArrayPointer(sunrealtype1d v_data, N_Vector v); SUNDIALS_EXPORT SUNComm N_VGetCommunicator(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLength(N_Vector v); SUNDIALS_EXPORT sunindextype N_VGetLocalLength(N_Vector v); @@ -255,44 +261,48 @@ SUNDIALS_EXPORT sunrealtype N_VMinQuotient(N_Vector num, N_Vector denom); /* fused vector operations */ SUNDIALS_EXPORT -SUNErrCode N_VLinearCombination(int nvec, sunrealtype* c, N_Vector* X, +SUNErrCode N_VLinearCombination(int nvec, sunrealtype1d c_arr, N_Vector1d X_arr, N_Vector z); SUNDIALS_EXPORT -SUNErrCode N_VScaleAddMulti(int nvec, sunrealtype* a, N_Vector x, N_Vector* Y, - N_Vector* Z); +SUNErrCode N_VScaleAddMulti(int nvec, sunrealtype1d a, N_Vector x, + N_Vector1d Y_arr, N_Vector1d Z_arr); SUNDIALS_EXPORT -SUNErrCode N_VDotProdMulti(int nvec, N_Vector x, N_Vector* Y, - sunrealtype* dotprods); +SUNErrCode N_VDotProdMulti(int nvec, N_Vector x, N_Vector1d Y_arr, + sunrealtype1d dotprods); /* vector array operations */ SUNDIALS_EXPORT -SUNErrCode N_VLinearSumVectorArray(int nvec, sunrealtype a, N_Vector* X, - sunrealtype b, N_Vector* Y, N_Vector* Z); +SUNErrCode N_VLinearSumVectorArray(int nvec, sunrealtype a, N_Vector1d X_arr, + sunrealtype b, N_Vector1d Y_arr, + N_Vector1d Z_arr); SUNDIALS_EXPORT -SUNErrCode N_VScaleVectorArray(int nvec, sunrealtype* c, N_Vector* X, - N_Vector* Z); +SUNErrCode N_VScaleVectorArray(int nvec, sunrealtype1d c, N_Vector1d X_arr, + N_Vector1d Z_arr); SUNDIALS_EXPORT -SUNErrCode N_VConstVectorArray(int nvec, sunrealtype c, N_Vector* Z); +SUNErrCode N_VConstVectorArray(int nvec, sunrealtype c, N_Vector1d Z_arr); SUNDIALS_EXPORT -SUNErrCode N_VWrmsNormVectorArray(int nvec, N_Vector* X, N_Vector* W, - sunrealtype* nrm); +SUNErrCode N_VWrmsNormVectorArray(int nvec, N_Vector1d X_arr, N_Vector1d W_arr, + sunrealtype1d nrm); SUNDIALS_EXPORT -SUNErrCode N_VWrmsNormMaskVectorArray(int nvec, N_Vector* X, N_Vector* W, - N_Vector id, sunrealtype* nrm); +SUNErrCode N_VWrmsNormMaskVectorArray(int nvec, N_Vector1d X_arr, + N_Vector1d W_arr, N_Vector id, + sunrealtype1d nrm); SUNDIALS_EXPORT -SUNErrCode N_VScaleAddMultiVectorArray(int nvec, int nsum, sunrealtype* a, - N_Vector* X, N_Vector** Y, N_Vector** Z); +SUNErrCode N_VScaleAddMultiVectorArray(int nvec, int nsum, sunrealtype1d a, + N_Vector1d X_arr, N_Vector2d Y_arr, + N_Vector2d Z_arr); SUNDIALS_EXPORT -SUNErrCode N_VLinearCombinationVectorArray(int nvec, int nsum, sunrealtype* c, - N_Vector** X, N_Vector* Z); +SUNErrCode N_VLinearCombinationVectorArray(int nvec, int nsum, + sunrealtype1d c_arr, + N_Vector2d X_arr, N_Vector1d Z_arr); /* * OPTIONAL operations with no default implementation. @@ -312,10 +322,11 @@ SUNDIALS_EXPORT sunbooleantype N_VConstrMaskLocal(N_Vector c, N_Vector x, SUNDIALS_EXPORT sunrealtype N_VMinQuotientLocal(N_Vector num, N_Vector denom); /* single buffer reduction operations */ -SUNDIALS_EXPORT SUNErrCode N_VDotProdMultiLocal(int nvec, N_Vector x, N_Vector* Y, - sunrealtype* dotprods); +SUNDIALS_EXPORT SUNErrCode N_VDotProdMultiLocal(int nvec, N_Vector x, + N_Vector1d Y_arr, + sunrealtype1d dotprods); SUNDIALS_EXPORT SUNErrCode N_VDotProdMultiAllReduce(int nvec_total, N_Vector x, - sunrealtype* sum); + sunrealtype1d sum); /* XBraid interface operations */ SUNDIALS_EXPORT SUNErrCode N_VBufSize(N_Vector x, sunindextype* size); @@ -326,14 +337,15 @@ SUNDIALS_EXPORT SUNErrCode N_VBufUnpack(N_Vector x, void* buf); * Additional functions exported by NVECTOR module * ----------------------------------------------------------------- */ -SUNDIALS_EXPORT N_Vector* N_VNewVectorArray(int count, SUNContext sunctx); -SUNDIALS_EXPORT N_Vector* N_VCloneEmptyVectorArray(int count, N_Vector w); -SUNDIALS_EXPORT N_Vector* N_VCloneVectorArray(int count, N_Vector w); -SUNDIALS_EXPORT void N_VDestroyVectorArray(N_Vector* vs, int count); +SUNDIALS_EXPORT N_Vector1d N_VNewVectorArray(int count, SUNContext sunctx); +SUNDIALS_EXPORT N_Vector1d N_VCloneEmptyVectorArray(int count, N_Vector w); +SUNDIALS_EXPORT N_Vector1d N_VCloneVectorArray(int count, N_Vector w); +SUNDIALS_EXPORT void N_VDestroyVectorArray(N_Vector1d vs_arr, int count); /* These function are really only for users of the Fortran interface */ -SUNDIALS_EXPORT N_Vector N_VGetVecAtIndexVectorArray(N_Vector* vs, int index); -SUNDIALS_EXPORT void N_VSetVecAtIndexVectorArray(N_Vector* vs, int index, +SUNDIALS_EXPORT N_Vector N_VGetVecAtIndexVectorArray( + N_Vector1d vs_arr, int index); // py::return_value_policy::reference +SUNDIALS_EXPORT void N_VSetVecAtIndexVectorArray(N_Vector1d vs_arr, int index, N_Vector w); /* ----------------------------------------------------------------- diff --git a/include/sundials/sundials_nvector.hpp b/include/sundials/sundials_nvector.hpp index cd40a3f847..842c4c16ad 100644 --- a/include/sundials/sundials_nvector.hpp +++ b/include/sundials/sundials_nvector.hpp @@ -17,9 +17,9 @@ #ifndef _SUNDIALS_NVECTOR_HPP #define _SUNDIALS_NVECTOR_HPP -#include #include #include +#include "sundials_nvector.h" namespace sundials { namespace impl { @@ -27,6 +27,7 @@ using BaseNVector = BaseObject<_generic_N_Vector, _generic_N_Vector_Ops>; } // namespace impl namespace experimental { + struct NVectorDeleter { void operator()(N_Vector v) @@ -35,7 +36,20 @@ struct NVectorDeleter } }; -using NVectorView = ClassView; +class NVectorView : public ClassView +{ +public: + using ClassView::ClassView; + template + static NVectorView Create(Args&&... args); +}; + +template +NVectorView NVectorView::Create(Args&&... args) +{ + return NVectorView(std::forward(args)...); +} + } // namespace experimental } // namespace sundials diff --git a/include/sundials/sundials_nvector_senswrapper.h b/include/sundials/sundials_nvector_senswrapper.h index 25b1468715..dd6404de57 100644 --- a/include/sundials/sundials_nvector_senswrapper.h +++ b/include/sundials/sundials_nvector_senswrapper.h @@ -39,7 +39,7 @@ extern "C" { struct _N_VectorContent_SensWrapper { - N_Vector* vecs; /* array of wrapped vectors */ + N_Vector1d vecs; /* array of wrapped vectors */ int nvecs; /* number of wrapped vectors */ sunbooleantype own_vecs; /* flag indicating if wrapper owns vectors */ }; diff --git a/include/sundials/sundials_profiler.hpp b/include/sundials/sundials_profiler.hpp index 017d613612..f9f06303f7 100644 --- a/include/sundials/sundials_profiler.hpp +++ b/include/sundials/sundials_profiler.hpp @@ -16,6 +16,7 @@ #define _SUNDIALS_PROFILER_HPP #include +#include #include #include @@ -47,6 +48,56 @@ class ProfilerMarkScope SUNProfiler prof_; const char* name_; }; + +namespace experimental { + +class SUNProfilerView : public sundials::ConvertibleTo +{ +public: + SUNProfilerView(SUNComm comm, const char* title) + { + profiler_ = std::make_unique(); + SUNProfiler_Create(comm, title, profiler_.get()); + } + + SUNProfilerView(SUNProfiler sunctx) { profiler_.reset(&sunctx); } + + /* disallow copy, but allow move construction */ + SUNProfilerView(const SUNProfilerView&) = delete; + SUNProfilerView(SUNProfilerView&&) = default; + + /* disallow copy, but allow move operators */ + SUNProfilerView& operator=(const SUNProfilerView&) = delete; + SUNProfilerView& operator=(SUNProfilerView&&) = default; + + SUNProfiler get() override { return *profiler_.get(); } + + SUNProfiler get() const override { return *profiler_.get(); } + + operator SUNProfiler() override { return *profiler_.get(); } + + operator SUNProfiler() const override { return *profiler_.get(); } + + template + static SUNProfilerView Create(Args&&... args); + + ~SUNProfilerView() + { + if (profiler_) { SUNProfiler_Free(profiler_.get()); } + } + +private: + std::unique_ptr profiler_; +}; + +template +SUNProfilerView SUNProfilerView::Create(Args&&... args) +{ + return SUNProfilerView(std::forward(args)...); +} + +} // namespace experimental + } // namespace sundials #endif /* SUNDIALS_PROFILER_HPP */ diff --git a/include/sundials/sundials_stepper.h b/include/sundials/sundials_stepper.h index bfd802a944..b462e4df22 100644 --- a/include/sundials/sundials_stepper.h +++ b/include/sundials/sundials_stepper.h @@ -21,12 +21,16 @@ extern "C" { #endif -typedef enum +enum SUNFullRhsMode { SUN_FULLRHS_START, SUN_FULLRHS_END, SUN_FULLRHS_OTHER -} SUNFullRhsMode; +}; + +#ifndef SWIG +typedef enum SUNFullRhsMode SUNFullRhsMode; +#endif typedef int (*SUNRhsJacFn)(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac, void* user_data, N_Vector tmp1, @@ -66,7 +70,7 @@ typedef SUNErrCode (*SUNStepperSetStepDirectionFn)(SUNStepper stepper, typedef SUNErrCode (*SUNStepperSetForcingFn)(SUNStepper stepper, sunrealtype tshift, sunrealtype tscale, - N_Vector* forcing, int nforcing); + N_Vector1d forcing, int nforcing); typedef SUNErrCode (*SUNStepperGetNumStepsFn)(SUNStepper stepper, suncountertype* nst); @@ -109,7 +113,7 @@ SUNErrCode SUNStepper_SetStepDirection(SUNStepper stepper, sunrealtype stepdir); SUNDIALS_EXPORT SUNErrCode SUNStepper_SetForcing(SUNStepper stepper, sunrealtype tshift, - sunrealtype tscale, N_Vector* forcing, + sunrealtype tscale, N_Vector1d forcing, int nforcing); SUNDIALS_EXPORT diff --git a/include/sundials/sundials_stepper.hpp b/include/sundials/sundials_stepper.hpp new file mode 100644 index 0000000000..684503b388 --- /dev/null +++ b/include/sundials/sundials_stepper.hpp @@ -0,0 +1,62 @@ +/* ----------------------------------------------------------------------------- + * Programmer(s): Cody J. Balos @ LLNL + * ----------------------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2025, 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 + * ----------------------------------------------------------------------------- + * C++ view of SUNDIALS SUNStepper + * ---------------------------------------------------------------------------*/ + +#ifndef _SUNDIALS_STEPPER_HPP +#define _SUNDIALS_STEPPER_HPP + +#include +#include +#include + +namespace sundials { + +namespace experimental { + +struct SUNStepperDeleter +{ + void operator()(SUNStepper self) + { + if (self) { SUNStepper_Destroy(&self); } + } +}; + +class SUNStepperView : public ClassView +{ +public: + using ClassView::ClassView; + + template + static SUNStepperView Create(Args&&... args); +}; + +template<> +SUNStepperView SUNStepperView::Create(SUNStepper&& stepper) +{ + return SUNStepperView(std::forward(stepper)); +} + +template +SUNStepperView SUNStepperView::Create(Args&&... args) +{ + SUNStepper stepper; + SUNStepper_Create(std::forward(args)..., &stepper); + return SUNStepperView(std::move(stepper)); +} + +} // namespace experimental +} // namespace sundials + +#endif diff --git a/include/sundials/sundials_types.h b/include/sundials/sundials_types.h index 1e38985ff0..c78867285f 100644 --- a/include/sundials/sundials_types.h +++ b/include/sundials/sundials_types.h @@ -124,6 +124,19 @@ typedef long double sunrealtype; #endif +/* + *----------------------------------------------------------------------------- + * Type(s): sunrealtype1d, sunrealtype2d, sunrealtype3d + * These types are to be used in place of sunrealtype*, sunrealtype**, and + * sunrealtype*** when semantically these map to arrays. I.e., if sunrealtype* + * refers to an array, then use sunrealtype1d. If it refers to a + * a pointer to a singular value (for "out" params), use sunrealtype*. + *----------------------------------------------------------------------------- + */ +typedef sunrealtype* sunrealtype1d; +typedef sunrealtype** sunrealtype2d; +typedef sunrealtype*** sunrealtype3d; + /* *------------------------------------------------------------------ * Type : sunindextype @@ -137,6 +150,19 @@ typedef long double sunrealtype; typedef SUNDIALS_INDEX_TYPE sunindextype; +/* + *----------------------------------------------------------------------------- + * Type(s): sunindextype1d, sunindextype2d, sunindextype3d + * These types are to be used in place of sunindextype*, sunindextype**, and + * sunindextype*** when semantically these map to arrays. I.e., if sunindextype* + * refers to an array, then use sunindextype1d. If it refers to a + * a pointer to a singular value (for "out" params), use sunindextype*. + *----------------------------------------------------------------------------- + */ +typedef sunindextype* sunindextype1d; +typedef sunindextype** sunindextype2d; +typedef sunindextype*** sunindextype3d; + /* *------------------------------------------------------------------ * Type : suncountertype @@ -176,6 +202,16 @@ typedef SUNDIALS_COUNTER_TYPE suncountertype; #define SUNTRUE 1 #endif +/* + *------------------------------------------------------------------ + * Type : int1d + *------------------------------------------------------------------ + * typedef for an int* which should be treated as an array of int. + *------------------------------------------------------------------ + */ + +typedef int* int1d; + /* *------------------------------------------------------------------ * Type : SUNOutputFormat @@ -184,11 +220,15 @@ typedef SUNDIALS_COUNTER_TYPE suncountertype; *------------------------------------------------------------------ */ -typedef enum +enum SUNOutputFormat { SUN_OUTPUTFORMAT_TABLE, SUN_OUTPUTFORMAT_CSV -} SUNOutputFormat; +}; + +#ifndef SWIG +typedef enum SUNOutputFormat SUNOutputFormat; +#endif /* *------------------------------------------------------------------ @@ -238,15 +278,17 @@ typedef void (*SUNErrHandlerFn)(int line, const char* func, const char* file, because we manually insert the wrapper code for SUN_COMM_NULL (and %ignoring it in the SWIG code doesn't seem to work). */ +#ifndef SWIG +#define SUN_COMM_NULL 0 +#endif + #if SUNDIALS_MPI_ENABLED #ifndef SWIG +#undef SUN_COMM_NULL #define SUN_COMM_NULL MPI_COMM_NULL #endif typedef MPI_Comm SUNComm; #else -#ifndef SWIG -#define SUN_COMM_NULL 0 -#endif typedef int SUNComm; #endif @@ -263,9 +305,13 @@ typedef int SUNComm; *------------------------------------------------------------------ */ -typedef enum +enum SUNDataIOMode { SUNDATAIOMODE_INMEM, -} SUNDataIOMode; +}; + +#ifndef SWIG +typedef enum SUNDataIOMode SUNDataIOMode; +#endif #endif /* _SUNDIALS_TYPES_H */ diff --git a/include/sunlinsol/sunlinsol_ginkgo.hpp b/include/sunlinsol/sunlinsol_ginkgo.hpp index b6fe7c0f4e..a1a834db95 100644 --- a/include/sunlinsol/sunlinsol_ginkgo.hpp +++ b/include/sunlinsol/sunlinsol_ginkgo.hpp @@ -251,10 +251,10 @@ class LinearSolver : public ConvertibleTo operator SUNLinearSolver() const override { return sunlinsol_.get(); } /// Explicit conversion to a :c:type:`SUNLinearSolver` - SUNLinearSolver Convert() override { return sunlinsol_.get(); } + SUNLinearSolver get() override { return sunlinsol_.get(); } /// Explicit conversion to a :c:type:`SUNLinearSolver` - SUNLinearSolver Convert() const override { return sunlinsol_.get(); } + SUNLinearSolver get() const override { return sunlinsol_.get(); } /// Get the ``gko::Executor`` associated with the Ginkgo solver std::shared_ptr GkoExec() const diff --git a/include/sunlinsol/sunlinsol_kokkosdense.hpp b/include/sunlinsol/sunlinsol_kokkosdense.hpp index ac0672e224..d95ecb4b54 100644 --- a/include/sunlinsol/sunlinsol_kokkosdense.hpp +++ b/include/sunlinsol/sunlinsol_kokkosdense.hpp @@ -206,10 +206,10 @@ class DenseLinearSolver : public sundials::impl::BaseLinearSolver, operator SUNLinearSolver() const override { return object_.get(); } // Explicit conversion to a SUNLinearSolver - SUNLinearSolver Convert() override { return object_.get(); } + SUNLinearSolver get() override { return object_.get(); } // Explicit conversion to a SUNLinearSolver - SUNLinearSolver Convert() const override { return object_.get(); } + SUNLinearSolver get() const override { return object_.get(); } private: void initSUNLinearSolver() diff --git a/include/sunmatrix/sunmatrix_band.h b/include/sunmatrix/sunmatrix_band.h index a1b0a58532..10edadf17e 100644 --- a/include/sunmatrix/sunmatrix_band.h +++ b/include/sunmatrix/sunmatrix_band.h @@ -108,9 +108,9 @@ SUNDIALS_EXPORT sunindextype SUNBandMatrix_UpperBandwidth(SUNMatrix A); SUNDIALS_EXPORT sunindextype SUNBandMatrix_StoredUpperBandwidth(SUNMatrix A); SUNDIALS_EXPORT sunindextype SUNBandMatrix_LDim(SUNMatrix A); SUNDIALS_EXPORT sunindextype SUNBandMatrix_LData(SUNMatrix A); -SUNDIALS_EXPORT sunrealtype* SUNBandMatrix_Data(SUNMatrix A); -SUNDIALS_EXPORT sunrealtype** SUNBandMatrix_Cols(SUNMatrix A); -SUNDIALS_EXPORT sunrealtype* SUNBandMatrix_Column(SUNMatrix A, sunindextype j); +SUNDIALS_EXPORT sunrealtype1d SUNBandMatrix_Data(SUNMatrix A); +SUNDIALS_EXPORT sunrealtype2d SUNBandMatrix_Cols(SUNMatrix A); +SUNDIALS_EXPORT sunrealtype1d SUNBandMatrix_Column(SUNMatrix A, sunindextype j); SUNDIALS_EXPORT SUNMatrix_ID SUNMatGetID_Band(SUNMatrix A); SUNDIALS_EXPORT SUNMatrix SUNMatClone_Band(SUNMatrix A); diff --git a/include/sunmatrix/sunmatrix_dense.h b/include/sunmatrix/sunmatrix_dense.h index 6d22492c4d..f5f7b93cb8 100644 --- a/include/sunmatrix/sunmatrix_dense.h +++ b/include/sunmatrix/sunmatrix_dense.h @@ -85,9 +85,9 @@ SUNDIALS_EXPORT void SUNDenseMatrix_Print(SUNMatrix A, FILE* outfile); SUNDIALS_EXPORT sunindextype SUNDenseMatrix_Rows(SUNMatrix A); SUNDIALS_EXPORT sunindextype SUNDenseMatrix_Columns(SUNMatrix A); SUNDIALS_EXPORT sunindextype SUNDenseMatrix_LData(SUNMatrix A); -SUNDIALS_EXPORT sunrealtype* SUNDenseMatrix_Data(SUNMatrix A); -SUNDIALS_EXPORT sunrealtype** SUNDenseMatrix_Cols(SUNMatrix A); -SUNDIALS_EXPORT sunrealtype* SUNDenseMatrix_Column(SUNMatrix A, sunindextype j); +SUNDIALS_EXPORT sunrealtype1d SUNDenseMatrix_Data(SUNMatrix A); +SUNDIALS_EXPORT sunrealtype2d SUNDenseMatrix_Cols(SUNMatrix A); +SUNDIALS_EXPORT sunrealtype1d SUNDenseMatrix_Column(SUNMatrix A, sunindextype j); SUNDIALS_EXPORT SUNMatrix_ID SUNMatGetID_Dense(SUNMatrix A); SUNDIALS_EXPORT SUNMatrix SUNMatClone_Dense(SUNMatrix A); diff --git a/include/sunmatrix/sunmatrix_ginkgo.hpp b/include/sunmatrix/sunmatrix_ginkgo.hpp index 13002dc570..0e33e16f72 100644 --- a/include/sunmatrix/sunmatrix_ginkgo.hpp +++ b/include/sunmatrix/sunmatrix_ginkgo.hpp @@ -92,7 +92,7 @@ SUNMatrix SUNMatClone_Ginkgo(SUNMatrix A) { auto A_mat{static_cast*>(A->content)}; auto new_mat{new Matrix(*A_mat)}; // NOLINT - return new_mat->Convert(); + return new_mat->get(); } template @@ -229,10 +229,10 @@ class Matrix : public sundials::impl::BaseMatrix, operator SUNMatrix() const override { return object_.get(); } /// Explicit conversion to a :c:type:`SUNMatrix` - SUNMatrix Convert() override { return object_.get(); } + SUNMatrix get() override { return object_.get(); } /// Explicit conversion to a :c:type:`SUNMatrix` - SUNMatrix Convert() const override { return object_.get(); } + SUNMatrix get() const override { return object_.get(); } private: std::shared_ptr gkomtx_; diff --git a/include/sunmatrix/sunmatrix_kokkosdense.hpp b/include/sunmatrix/sunmatrix_kokkosdense.hpp index 793dd8e0e7..4c5490bd73 100644 --- a/include/sunmatrix/sunmatrix_kokkosdense.hpp +++ b/include/sunmatrix/sunmatrix_kokkosdense.hpp @@ -56,7 +56,7 @@ SUNMatrix SUNMatClone_KokkosDense(SUNMatrix A) { auto A_mat{GetDenseMat(A)}; auto new_mat{new MatrixType(*A_mat)}; - return new_mat->Convert(); + return new_mat->get(); } template @@ -373,10 +373,10 @@ class DenseMatrix : public sundials::impl::BaseMatrix, operator SUNMatrix() const override { return object_.get(); } // Explicit conversion to a SUNMatrix - SUNMatrix Convert() override { return object_.get(); } + SUNMatrix get() override { return object_.get(); } // Explicit conversion to a SUNMatrix - SUNMatrix Convert() const override { return object_.get(); } + SUNMatrix get() const override { return object_.get(); } private: exec_space exec_space_; // Kokkos execution space diff --git a/include/sunmatrix/sunmatrix_sparse.h b/include/sunmatrix/sunmatrix_sparse.h index 697812dbb4..159f7f1e69 100644 --- a/include/sunmatrix/sunmatrix_sparse.h +++ b/include/sunmatrix/sunmatrix_sparse.h @@ -143,13 +143,13 @@ SUNDIALS_EXPORT int SUNSparseMatrix_SparseType(SUNMatrix A); SUNDIALS_EXPORT -sunrealtype* SUNSparseMatrix_Data(SUNMatrix A); +sunrealtype1d SUNSparseMatrix_Data(SUNMatrix A); SUNDIALS_EXPORT -sunindextype* SUNSparseMatrix_IndexValues(SUNMatrix A); +sunindextype1d SUNSparseMatrix_IndexValues(SUNMatrix A); SUNDIALS_EXPORT -sunindextype* SUNSparseMatrix_IndexPointers(SUNMatrix A); +sunindextype1d SUNSparseMatrix_IndexPointers(SUNMatrix A); SUNDIALS_EXPORT SUNMatrix_ID SUNMatGetID_Sparse(SUNMatrix A); diff --git a/src/arkode/CMakeLists.txt b/src/arkode/CMakeLists.txt index 9b92e7a0e7..a0178d6b7e 100644 --- a/src/arkode/CMakeLists.txt +++ b/src/arkode/CMakeLists.txt @@ -56,19 +56,23 @@ set(arkode_SOURCES set(arkode_HEADERS arkode.h arkode_arkstep.h + arkode_arkstep_deprecated.h arkode_bandpre.h arkode_bbdpre.h arkode_butcher.h arkode_butcher_dirk.h arkode_butcher_erk.h arkode_erkstep.h + arkode_erkstep_deprecated.h arkode_forcingstep.h arkode_ls.h arkode_lsrkstep.h arkode_mristep.h + arkode_mristep_deprecated.h arkode_splittingstep.h arkode_sprk.h - arkode_sprkstep.h) + arkode_sprkstep.h + arkode_sprkstep_deprecated.h) # Add prefix with complete path to the ARKODE header files add_prefix(${SUNDIALS_SOURCE_DIR}/include/arkode/ arkode_HEADERS) diff --git a/src/arkode/arkode.c b/src/arkode/arkode.c index 8ee3920ed7..1f7b7b4613 100644 --- a/src/arkode/arkode.c +++ b/src/arkode/arkode.c @@ -1277,6 +1277,13 @@ void ARKodeFree(void** arkode_mem) ark_mem->relax_mem = NULL; } + /* free user data if ARKODE owns it */ + if (ark_mem->own_user_data && (ark_mem->user_data != NULL)) + { + free(ark_mem->user_data); + ark_mem->user_data = NULL; + } + free(*arkode_mem); *arkode_mem = NULL; } @@ -1592,7 +1599,8 @@ ARKodeMem arkCreate(SUNContext sunctx) ark_mem->ProcessStage = NULL; /* No user_data pointer yet */ - ark_mem->user_data = NULL; + ark_mem->user_data = NULL; + ark_mem->own_user_data = SUNFALSE; /* Allocate step adaptivity structure and note storage */ ark_mem->hadapt_mem = arkAdaptInit(); diff --git a/src/arkode/arkode_impl.h b/src/arkode/arkode_impl.h index fe645a941c..4738c9b1b7 100644 --- a/src/arkode/arkode_impl.h +++ b/src/arkode/arkode_impl.h @@ -378,26 +378,27 @@ struct ARKodeMemRec sunrealtype uround; /* machine unit roundoff */ /* Problem specification data */ - void* user_data; /* user ptr passed to supplied functions */ - int itol; /* itol = ARK_SS (scalar, default), + void* user_data; /* user ptr passed to supplied functions */ + sunbooleantype own_user_data; /* SUNTRUE if we own user_data and should free it */ + int itol; /* itol = ARK_SS (scalar, default), ARK_SV (vector), ARK_WF (user weight function) */ - int ritol; /* itol = ARK_SS (scalar, default), + int ritol; /* itol = ARK_SS (scalar, default), ARK_SV (vector), ARK_WF (user weight function) */ - sunrealtype reltol; /* relative tolerance */ - sunrealtype Sabstol; /* scalar absolute solution tolerance */ - N_Vector Vabstol; /* vector absolute solution tolerance */ - sunbooleantype atolmin0; /* flag indicating that min(abstol) = 0 */ - sunrealtype SRabstol; /* scalar absolute residual tolerance */ - N_Vector VRabstol; /* vector absolute residual tolerance */ - sunbooleantype Ratolmin0; /* flag indicating that min(Rabstol) = 0 */ - sunbooleantype user_efun; /* SUNTRUE if user sets efun */ - ARKEwtFn efun; /* function to set ewt */ - void* e_data; /* user pointer passed to efun */ - sunbooleantype user_rfun; /* SUNTRUE if user sets rfun */ - ARKRwtFn rfun; /* function to set rwt */ - void* r_data; /* user pointer passed to rfun */ + sunrealtype reltol; /* relative tolerance */ + sunrealtype Sabstol; /* scalar absolute solution tolerance */ + N_Vector Vabstol; /* vector absolute solution tolerance */ + sunbooleantype atolmin0; /* flag indicating that min(abstol) = 0 */ + sunrealtype SRabstol; /* scalar absolute residual tolerance */ + N_Vector VRabstol; /* vector absolute residual tolerance */ + sunbooleantype Ratolmin0; /* flag indicating that min(Rabstol) = 0 */ + sunbooleantype user_efun; /* SUNTRUE if user sets efun */ + ARKEwtFn efun; /* function to set ewt */ + void* e_data; /* user pointer passed to efun */ + sunbooleantype user_rfun; /* SUNTRUE if user sets rfun */ + ARKRwtFn rfun; /* function to set rwt */ + void* r_data; /* user pointer passed to rfun */ sunbooleantype constraintsSet; /* check inequality constraints */ /* Time stepper module -- general */ @@ -694,6 +695,10 @@ SUNErrCode arkSUNStepperSelfDestruct(SUNStepper stepper); int arkSetForcePass(void* arkode_mem, sunbooleantype force_pass); int arkGetLastKFlag(void* arkode_mem, int* last_kflag); +/* Utility function to tell ARKode to free the user data. + This is used by the Python interfaces. */ +int ARKodeSetOwnUserData(void* ark_mem, sunbooleantype own_user_data); + /*=============================================================== Reusable ARKODE Error Messages ===============================================================*/ diff --git a/src/arkode/arkode_io.c b/src/arkode/arkode_io.c index bdbc1e47e2..0c1573d8db 100644 --- a/src/arkode/arkode_io.c +++ b/src/arkode/arkode_io.c @@ -879,6 +879,29 @@ int ARKodeSetUserData(void* arkode_mem, void* user_data) return (ARK_SUCCESS); } +/*--------------------------------------------------------------- + ARKodeSetOwnUserData: + + Set whether the ARKodeMem structure owns the user data pointer. + If set to SUNTRUE, ARKode will free the user data pointer when + ARKodeFree is called. + ---------------------------------------------------------------*/ +int ARKodeSetOwnUserData(void* arkode_mem, sunbooleantype own_user_data) +{ + ARKodeMem ark_mem; + if (arkode_mem == NULL) + { + arkProcessError(NULL, ARK_MEM_NULL, __LINE__, __func__, __FILE__, + MSG_ARK_NO_MEM); + return (ARK_MEM_NULL); + } + ark_mem = (ARKodeMem)arkode_mem; + + ark_mem->own_user_data = own_user_data; + + return (ARK_SUCCESS); +} + /*--------------------------------------------------------------- ARKodeSetAdaptController: diff --git a/src/arkode/arkode_mristep.c b/src/arkode/arkode_mristep.c index cdd0508fda..99437ca857 100644 --- a/src/arkode/arkode_mristep.c +++ b/src/arkode/arkode_mristep.c @@ -4324,6 +4324,9 @@ int MRIStepInnerStepper_Free(MRIStepInnerStepper* stepper) /* free operations structure */ free((*stepper)->ops); + /* free python data */ + free((*stepper)->python); + /* free inner stepper mem */ free(*stepper); *stepper = NULL; diff --git a/src/arkode/arkode_mristep_impl.h b/src/arkode/arkode_mristep_impl.h index b029714399..e33b9937b8 100644 --- a/src/arkode/arkode_mristep_impl.h +++ b/src/arkode/arkode_mristep_impl.h @@ -183,6 +183,7 @@ struct _MRIStepInnerStepper { /* stepper specific content and operations */ void* content; + void* python; MRIStepInnerStepper_Ops ops; /* stepper context */ diff --git a/src/arkode/arkode_sprk.c b/src/arkode/arkode_sprk.c index e65a5fb496..faf4f12846 100644 --- a/src/arkode/arkode_sprk.c +++ b/src/arkode/arkode_sprk.c @@ -401,8 +401,8 @@ static ARKodeSPRKTable arkodeSymplecticSofroniou10(void) return sprk_table; } -ARKodeSPRKTable ARKodeSPRKTable_Create(int s, int q, const sunrealtype* a, - const sunrealtype* ahat) +ARKodeSPRKTable ARKodeSPRKTable_Create(int s, int q, sunrealtype1d a, + sunrealtype1d ahat) { if (s < 1 || !a || !ahat) { return NULL; } diff --git a/src/arkode/fmod_int32/farkode_arkstep_mod.c b/src/arkode/fmod_int32/farkode_arkstep_mod.c index 6a7f52aeeb..bf38271434 100644 --- a/src/arkode/fmod_int32/farkode_arkstep_mod.c +++ b/src/arkode/fmod_int32/farkode_arkstep_mod.c @@ -204,6 +204,7 @@ #include "arkode/arkode_arkstep.h" +#include "arkode/arkode_arkstep_deprecated.h" #include @@ -403,6 +404,30 @@ SWIGEXPORT int _wrap_FARKStepGetTimestepperStats(void *farg1, long *farg2, long } +SWIGEXPORT int _wrap_FARKStepCreateAdjointStepper(void *farg1, SUNAdjRhsFn farg2, SUNAdjRhsFn farg3, double const *farg4, N_Vector farg5, void *farg6, void *farg7) { + int fresult ; + void *arg1 = (void *) 0 ; + SUNAdjRhsFn arg2 = (SUNAdjRhsFn) 0 ; + SUNAdjRhsFn arg3 = (SUNAdjRhsFn) 0 ; + sunrealtype arg4 ; + N_Vector arg5 = (N_Vector) 0 ; + SUNContext arg6 = (SUNContext) 0 ; + SUNAdjointStepper *arg7 = (SUNAdjointStepper *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (SUNAdjRhsFn)(farg2); + arg3 = (SUNAdjRhsFn)(farg3); + arg4 = (sunrealtype)(*farg4); + arg5 = (N_Vector)(farg5); + arg6 = (SUNContext)(farg6); + arg7 = (SUNAdjointStepper *)(farg7); + result = (int)ARKStepCreateAdjointStepper(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FARKStepCreateMRIStepInnerStepper(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; @@ -2427,30 +2452,6 @@ SWIGEXPORT void _wrap_FARKStepPrintMem(void *farg1, void *farg2) { } -SWIGEXPORT int _wrap_FARKStepCreateAdjointStepper(void *farg1, SUNAdjRhsFn farg2, SUNAdjRhsFn farg3, double const *farg4, N_Vector farg5, void *farg6, void *farg7) { - int fresult ; - void *arg1 = (void *) 0 ; - SUNAdjRhsFn arg2 = (SUNAdjRhsFn) 0 ; - SUNAdjRhsFn arg3 = (SUNAdjRhsFn) 0 ; - sunrealtype arg4 ; - N_Vector arg5 = (N_Vector) 0 ; - SUNContext arg6 = (SUNContext) 0 ; - SUNAdjointStepper *arg7 = (SUNAdjointStepper *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (SUNAdjRhsFn)(farg2); - arg3 = (SUNAdjRhsFn)(farg3); - arg4 = (sunrealtype)(*farg4); - arg5 = (N_Vector)(farg5); - arg6 = (SUNContext)(farg6); - arg7 = (SUNAdjointStepper *)(farg7); - result = (int)ARKStepCreateAdjointStepper(arg1,arg2,arg3,arg4,arg5,arg6,arg7); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FARKStepSetRelaxFn(void *farg1, ARKRelaxFn farg2, ARKRelaxJacFn farg3) { int fresult ; void *arg1 = (void *) 0 ; diff --git a/src/arkode/fmod_int32/farkode_arkstep_mod.f90 b/src/arkode/fmod_int32/farkode_arkstep_mod.f90 index c2b234d819..85f5e4ed67 100644 --- a/src/arkode/fmod_int32/farkode_arkstep_mod.f90 +++ b/src/arkode/fmod_int32/farkode_arkstep_mod.f90 @@ -62,6 +62,7 @@ module farkode_arkstep_mod public :: FARKStepSetTableName public :: FARKStepGetCurrentButcherTables public :: FARKStepGetTimestepperStats + public :: FARKStepCreateAdjointStepper public :: FARKStepCreateMRIStepInnerStepper public :: FARKStepResize public :: FARKStepReset @@ -202,7 +203,6 @@ module farkode_arkstep_mod public :: FARKStepGetLinReturnFlagName public :: FARKStepFree public :: FARKStepPrintMem - public :: FARKStepCreateAdjointStepper public :: FARKStepSetRelaxFn public :: FARKStepSetRelaxEtaFail public :: FARKStepSetRelaxLowerBound @@ -328,6 +328,20 @@ function swigc_FARKStepGetTimestepperStats(farg1, farg2, farg3, farg4, farg5, fa integer(C_INT) :: fresult end function +function swigc_FARKStepCreateAdjointStepper(farg1, farg2, farg3, farg4, farg5, farg6, farg7) & +bind(C, name="_wrap_FARKStepCreateAdjointStepper") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +real(C_DOUBLE), intent(in) :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR), value :: farg6 +type(C_PTR), value :: farg7 +integer(C_INT) :: fresult +end function + function swigc_FARKStepCreateMRIStepInnerStepper(farg1, farg2) & bind(C, name="_wrap_FARKStepCreateMRIStepInnerStepper") & result(fresult) @@ -1626,20 +1640,6 @@ subroutine swigc_FARKStepPrintMem(farg1, farg2) & type(C_PTR), value :: farg2 end subroutine -function swigc_FARKStepCreateAdjointStepper(farg1, farg2, farg3, farg4, farg5, farg6, farg7) & -bind(C, name="_wrap_FARKStepCreateAdjointStepper") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_FUNPTR), value :: farg2 -type(C_FUNPTR), value :: farg3 -real(C_DOUBLE), intent(in) :: farg4 -type(C_PTR), value :: farg5 -type(C_PTR), value :: farg6 -type(C_PTR), value :: farg7 -integer(C_INT) :: fresult -end function - function swigc_FARKStepSetRelaxFn(farg1, farg2, farg3) & bind(C, name="_wrap_FARKStepSetRelaxFn") & result(fresult) @@ -2018,6 +2018,37 @@ function FARKStepGetTimestepperStats(arkode_mem, expsteps, accsteps, step_attemp swig_result = fresult end function +function FARKStepCreateAdjointStepper(arkode_mem, adj_fe, adj_fi, tf, sf, sunctx, adj_stepper_ptr) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: adj_fe +type(C_FUNPTR), intent(in), value :: adj_fi +real(C_DOUBLE), intent(in) :: tf +type(N_Vector), target, intent(inout) :: sf +type(C_PTR) :: sunctx +type(C_PTR), target, intent(inout) :: adj_stepper_ptr +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 +real(C_DOUBLE) :: farg4 +type(C_PTR) :: farg5 +type(C_PTR) :: farg6 +type(C_PTR) :: farg7 + +farg1 = arkode_mem +farg2 = adj_fe +farg3 = adj_fi +farg4 = tf +farg5 = c_loc(sf) +farg6 = sunctx +farg7 = c_loc(adj_stepper_ptr) +fresult = swigc_FARKStepCreateAdjointStepper(farg1, farg2, farg3, farg4, farg5, farg6, farg7) +swig_result = fresult +end function + function FARKStepCreateMRIStepInnerStepper(arkode_mem, stepper) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -4371,37 +4402,6 @@ subroutine FARKStepPrintMem(arkode_mem, outfile) call swigc_FARKStepPrintMem(farg1, farg2) end subroutine -function FARKStepCreateAdjointStepper(arkode_mem, adj_fe, adj_fi, tf, sf, sunctx, adj_stepper_ptr) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -type(C_FUNPTR), intent(in), value :: adj_fe -type(C_FUNPTR), intent(in), value :: adj_fi -real(C_DOUBLE), intent(in) :: tf -type(N_Vector), target, intent(inout) :: sf -type(C_PTR) :: sunctx -type(C_PTR), target, intent(inout) :: adj_stepper_ptr -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_FUNPTR) :: farg2 -type(C_FUNPTR) :: farg3 -real(C_DOUBLE) :: farg4 -type(C_PTR) :: farg5 -type(C_PTR) :: farg6 -type(C_PTR) :: farg7 - -farg1 = arkode_mem -farg2 = adj_fe -farg3 = adj_fi -farg4 = tf -farg5 = c_loc(sf) -farg6 = sunctx -farg7 = c_loc(adj_stepper_ptr) -fresult = swigc_FARKStepCreateAdjointStepper(farg1, farg2, farg3, farg4, farg5, farg6, farg7) -swig_result = fresult -end function - function FARKStepSetRelaxFn(arkode_mem, rfn, rjac) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/arkode/fmod_int32/farkode_erkstep_mod.c b/src/arkode/fmod_int32/farkode_erkstep_mod.c index 02404f1e1b..6497ea0802 100644 --- a/src/arkode/fmod_int32/farkode_erkstep_mod.c +++ b/src/arkode/fmod_int32/farkode_erkstep_mod.c @@ -204,6 +204,7 @@ #include "arkode/arkode_erkstep.h" +#include "arkode/arkode_erkstep_deprecated.h" #include diff --git a/src/arkode/fmod_int32/farkode_lsrkstep_mod.f90 b/src/arkode/fmod_int32/farkode_lsrkstep_mod.f90 index eb54169668..42477f620d 100644 --- a/src/arkode/fmod_int32/farkode_lsrkstep_mod.f90 +++ b/src/arkode/fmod_int32/farkode_lsrkstep_mod.f90 @@ -26,7 +26,7 @@ module farkode_lsrkstep_mod private ! DECLARATION CONSTRUCTS - ! typedef enum ARKODE_LSRKMethodType + ! enum ARKODE_LSRKMethodType enum, bind(c) enumerator :: ARKODE_LSRK_RKC_2 enumerator :: ARKODE_LSRK_RKL_2 diff --git a/src/arkode/fmod_int32/farkode_mod.c b/src/arkode/fmod_int32/farkode_mod.c index e37559cad2..861d146ce2 100644 --- a/src/arkode/fmod_int32/farkode_mod.c +++ b/src/arkode/fmod_int32/farkode_mod.c @@ -2603,11 +2603,11 @@ SWIGEXPORT int _wrap_ARKodeButcherTableMem_stages_get(SwigClassWrapper const *fa SWIGEXPORT void _wrap_ARKodeButcherTableMem_A_set(SwigClassWrapper const *farg1, void *farg2) { struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::A", return ); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - arg2 = (sunrealtype **)(farg2); + arg2 = (sunrealtype2d)(farg2); if (arg1) (arg1)->A = arg2; } @@ -2615,11 +2615,11 @@ SWIGEXPORT void _wrap_ARKodeButcherTableMem_A_set(SwigClassWrapper const *farg1, SWIGEXPORT void * _wrap_ARKodeButcherTableMem_A_get(SwigClassWrapper const *farg1) { void * fresult ; struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype **result = 0 ; + sunrealtype2d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::A", return 0); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - result = (sunrealtype **) ((arg1)->A); + result = (sunrealtype2d) ((arg1)->A); fresult = result; return fresult; } @@ -2627,11 +2627,11 @@ SWIGEXPORT void * _wrap_ARKodeButcherTableMem_A_get(SwigClassWrapper const *farg SWIGEXPORT void _wrap_ARKodeButcherTableMem_c_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::c", return ); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->c = arg2; } @@ -2639,11 +2639,11 @@ SWIGEXPORT void _wrap_ARKodeButcherTableMem_c_set(SwigClassWrapper const *farg1, SWIGEXPORT double * _wrap_ARKodeButcherTableMem_c_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::c", return 0); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->c); + result = (sunrealtype1d) ((arg1)->c); fresult = result; return fresult; } @@ -2651,11 +2651,11 @@ SWIGEXPORT double * _wrap_ARKodeButcherTableMem_c_get(SwigClassWrapper const *fa SWIGEXPORT void _wrap_ARKodeButcherTableMem_b_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::b", return ); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->b = arg2; } @@ -2663,11 +2663,11 @@ SWIGEXPORT void _wrap_ARKodeButcherTableMem_b_set(SwigClassWrapper const *farg1, SWIGEXPORT double * _wrap_ARKodeButcherTableMem_b_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::b", return 0); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->b); + result = (sunrealtype1d) ((arg1)->b); fresult = result; return fresult; } @@ -2675,11 +2675,11 @@ SWIGEXPORT double * _wrap_ARKodeButcherTableMem_b_get(SwigClassWrapper const *fa SWIGEXPORT void _wrap_ARKodeButcherTableMem_d_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::d", return ); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->d = arg2; } @@ -2687,11 +2687,11 @@ SWIGEXPORT void _wrap_ARKodeButcherTableMem_d_set(SwigClassWrapper const *farg1, SWIGEXPORT double * _wrap_ARKodeButcherTableMem_d_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::d", return 0); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->d); + result = (sunrealtype1d) ((arg1)->d); fresult = result; return fresult; } @@ -2747,19 +2747,19 @@ SWIGEXPORT void * _wrap_FARKodeButcherTable_Create(int const *farg1, int const * int arg1 ; int arg2 ; int arg3 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; - sunrealtype *arg5 = (sunrealtype *) 0 ; - sunrealtype *arg6 = (sunrealtype *) 0 ; - sunrealtype *arg7 = (sunrealtype *) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; + sunrealtype1d arg5 = (sunrealtype1d) 0 ; + sunrealtype1d arg6 = (sunrealtype1d) 0 ; + sunrealtype1d arg7 = (sunrealtype1d) 0 ; ARKodeButcherTable result; arg1 = (int)(*farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); - arg4 = (sunrealtype *)(farg4); - arg5 = (sunrealtype *)(farg5); - arg6 = (sunrealtype *)(farg6); - arg7 = (sunrealtype *)(farg7); + arg4 = (sunrealtype1d)(farg4); + arg5 = (sunrealtype1d)(farg5); + arg6 = (sunrealtype1d)(farg6); + arg7 = (sunrealtype1d)(farg7); result = (ARKodeButcherTable)ARKodeButcherTable_Create(arg1,arg2,arg3,arg4,arg5,arg6,arg7); fresult = result; return fresult; @@ -2982,11 +2982,11 @@ SWIGEXPORT int _wrap_ARKodeSPRKTableMem_stages_get(SwigClassWrapper const *farg1 SWIGEXPORT void _wrap_ARKodeSPRKTableMem_a_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeSPRKTableMem *arg1 = (struct ARKodeSPRKTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeSPRKTableMem *", "ARKodeSPRKTableMem", "ARKodeSPRKTableMem::a", return ); arg1 = (struct ARKodeSPRKTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->a = arg2; } @@ -2994,11 +2994,11 @@ SWIGEXPORT void _wrap_ARKodeSPRKTableMem_a_set(SwigClassWrapper const *farg1, do SWIGEXPORT double * _wrap_ARKodeSPRKTableMem_a_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeSPRKTableMem *arg1 = (struct ARKodeSPRKTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeSPRKTableMem *", "ARKodeSPRKTableMem", "ARKodeSPRKTableMem::a", return 0); arg1 = (struct ARKodeSPRKTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->a); + result = (sunrealtype1d) ((arg1)->a); fresult = result; return fresult; } @@ -3006,11 +3006,11 @@ SWIGEXPORT double * _wrap_ARKodeSPRKTableMem_a_get(SwigClassWrapper const *farg1 SWIGEXPORT void _wrap_ARKodeSPRKTableMem_ahat_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeSPRKTableMem *arg1 = (struct ARKodeSPRKTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeSPRKTableMem *", "ARKodeSPRKTableMem", "ARKodeSPRKTableMem::ahat", return ); arg1 = (struct ARKodeSPRKTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->ahat = arg2; } @@ -3018,11 +3018,11 @@ SWIGEXPORT void _wrap_ARKodeSPRKTableMem_ahat_set(SwigClassWrapper const *farg1, SWIGEXPORT double * _wrap_ARKodeSPRKTableMem_ahat_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeSPRKTableMem *arg1 = (struct ARKodeSPRKTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeSPRKTableMem *", "ARKodeSPRKTableMem", "ARKodeSPRKTableMem::ahat", return 0); arg1 = (struct ARKodeSPRKTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->ahat); + result = (sunrealtype1d) ((arg1)->ahat); fresult = result; return fresult; } @@ -3063,15 +3063,15 @@ SWIGEXPORT void * _wrap_FARKodeSPRKTable_Create(int const *farg1, int const *far void * fresult ; int arg1 ; int arg2 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; ARKodeSPRKTable result; arg1 = (int)(*farg1); arg2 = (int)(*farg2); - arg3 = (sunrealtype *)(farg3); - arg4 = (sunrealtype *)(farg4); - result = (ARKodeSPRKTable)ARKodeSPRKTable_Create(arg1,arg2,(double const *)arg3,(double const *)arg4); + arg3 = (sunrealtype1d)(farg3); + arg4 = (sunrealtype1d)(farg4); + result = (ARKodeSPRKTable)ARKodeSPRKTable_Create(arg1,arg2,arg3,arg4); fresult = result; return fresult; } diff --git a/src/arkode/fmod_int32/farkode_mod.f90 b/src/arkode/fmod_int32/farkode_mod.f90 index 426332015a..e5c63d9ca6 100644 --- a/src/arkode/fmod_int32/farkode_mod.f90 +++ b/src/arkode/fmod_int32/farkode_mod.f90 @@ -103,14 +103,14 @@ module farkode_mod integer(C_INT), parameter, public :: ARK_SUNADJSTEPPER_ERR = -55_C_INT integer(C_INT), parameter, public :: ARK_DEE_FAIL = -56_C_INT integer(C_INT), parameter, public :: ARK_UNRECOGNIZED_ERROR = -99_C_INT - ! typedef enum ARKRelaxSolver + ! enum ARKRelaxSolver enum, bind(c) enumerator :: ARK_RELAX_BRENT enumerator :: ARK_RELAX_NEWTON end enum integer, parameter, public :: ARKRelaxSolver = kind(ARK_RELAX_BRENT) public :: ARK_RELAX_BRENT, ARK_RELAX_NEWTON - ! typedef enum ARKAccumError + ! enum ARKAccumError enum, bind(c) enumerator :: ARK_ACCUMERROR_NONE enumerator :: ARK_ACCUMERROR_MAX @@ -318,7 +318,7 @@ module farkode_mod public :: FARKodeButcherTable_IsStifflyAccurate public :: FARKodeButcherTable_CheckOrder public :: FARKodeButcherTable_CheckARKOrder - ! typedef enum ARKODE_DIRKTableID + ! enum ARKODE_DIRKTableID enum, bind(c) enumerator :: ARKODE_DIRK_NONE = -1 enumerator :: ARKODE_MIN_DIRK_NUM = 100 @@ -362,7 +362,7 @@ module farkode_mod public :: FARKodeButcherTable_LoadDIRK public :: FARKodeButcherTable_LoadDIRKByName public :: FARKodeButcherTable_DIRKIDToName - ! typedef enum ARKODE_ERKTableID + ! enum ARKODE_ERKTableID enum, bind(c) enumerator :: ARKODE_ERK_NONE = -1 enumerator :: ARKODE_MIN_ERK_NUM = 0 @@ -407,11 +407,11 @@ module farkode_mod public :: FARKodeButcherTable_LoadERK public :: FARKodeButcherTable_LoadERKByName public :: FARKodeButcherTable_ERKIDToName - ! typedef enum ARKODE_SPRKMethodID + ! enum ARKODE_SPRKMethodID enum, bind(c) enumerator :: ARKODE_SPRK_NONE = -1 enumerator :: ARKODE_MIN_SPRK_NUM = 0 - enumerator :: ARKODE_SPRK_EULER_1_1 = ARKODE_MIN_SPRK_NUM + enumerator :: ARKODE_SPRK_EULER_1_1 = 0 enumerator :: ARKODE_SPRK_LEAPFROG_2_2 enumerator :: ARKODE_SPRK_PSEUDO_LEAPFROG_2_2 enumerator :: ARKODE_SPRK_RUTH_3_3 diff --git a/src/arkode/fmod_int32/farkode_mristep_mod.c b/src/arkode/fmod_int32/farkode_mristep_mod.c index b066acc94d..a1cbf7e308 100644 --- a/src/arkode/fmod_int32/farkode_mristep_mod.c +++ b/src/arkode/fmod_int32/farkode_mristep_mod.c @@ -233,6 +233,7 @@ enum { #include "arkode/arkode_mristep.h" +#include "arkode/arkode_mristep_deprecated.h" typedef struct { @@ -430,11 +431,11 @@ SWIGEXPORT int _wrap_MRIStepCouplingMem_p_get(SwigClassWrapper const *farg1) { SWIGEXPORT void _wrap_MRIStepCouplingMem_c_set(SwigClassWrapper const *farg1, double *farg2) { struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::c", return ); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->c = arg2; } @@ -442,11 +443,11 @@ SWIGEXPORT void _wrap_MRIStepCouplingMem_c_set(SwigClassWrapper const *farg1, do SWIGEXPORT double * _wrap_MRIStepCouplingMem_c_get(SwigClassWrapper const *farg1) { double * fresult ; struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::c", return 0); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->c); + result = (sunrealtype1d) ((arg1)->c); fresult = result; return fresult; } @@ -454,11 +455,11 @@ SWIGEXPORT double * _wrap_MRIStepCouplingMem_c_get(SwigClassWrapper const *farg1 SWIGEXPORT void _wrap_MRIStepCouplingMem_W_set(SwigClassWrapper const *farg1, void *farg2) { struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype ***arg2 = (sunrealtype ***) 0 ; + sunrealtype3d arg2 = (sunrealtype3d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::W", return ); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - arg2 = (sunrealtype ***)(farg2); + arg2 = (sunrealtype3d)(farg2); if (arg1) (arg1)->W = arg2; } @@ -466,11 +467,11 @@ SWIGEXPORT void _wrap_MRIStepCouplingMem_W_set(SwigClassWrapper const *farg1, vo SWIGEXPORT void * _wrap_MRIStepCouplingMem_W_get(SwigClassWrapper const *farg1) { void * fresult ; struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype ***result = 0 ; + sunrealtype3d result; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::W", return 0); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - result = (sunrealtype ***) ((arg1)->W); + result = (sunrealtype3d) ((arg1)->W); fresult = result; return fresult; } @@ -478,11 +479,11 @@ SWIGEXPORT void * _wrap_MRIStepCouplingMem_W_get(SwigClassWrapper const *farg1) SWIGEXPORT void _wrap_MRIStepCouplingMem_G_set(SwigClassWrapper const *farg1, void *farg2) { struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype ***arg2 = (sunrealtype ***) 0 ; + sunrealtype3d arg2 = (sunrealtype3d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::G", return ); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - arg2 = (sunrealtype ***)(farg2); + arg2 = (sunrealtype3d)(farg2); if (arg1) (arg1)->G = arg2; } @@ -490,11 +491,11 @@ SWIGEXPORT void _wrap_MRIStepCouplingMem_G_set(SwigClassWrapper const *farg1, vo SWIGEXPORT void * _wrap_MRIStepCouplingMem_G_get(SwigClassWrapper const *farg1) { void * fresult ; struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype ***result = 0 ; + sunrealtype3d result; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::G", return 0); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - result = (sunrealtype ***) ((arg1)->G); + result = (sunrealtype3d) ((arg1)->G); fresult = result; return fresult; } @@ -625,18 +626,18 @@ SWIGEXPORT void * _wrap_FMRIStepCoupling_Create(int const *farg1, int const *far int arg2 ; int arg3 ; int arg4 ; - sunrealtype *arg5 = (sunrealtype *) 0 ; - sunrealtype *arg6 = (sunrealtype *) 0 ; - sunrealtype *arg7 = (sunrealtype *) 0 ; + sunrealtype1d arg5 = (sunrealtype1d) 0 ; + sunrealtype1d arg6 = (sunrealtype1d) 0 ; + sunrealtype1d arg7 = (sunrealtype1d) 0 ; MRIStepCoupling result; arg1 = (int)(*farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (int)(*farg4); - arg5 = (sunrealtype *)(farg5); - arg6 = (sunrealtype *)(farg6); - arg7 = (sunrealtype *)(farg7); + arg5 = (sunrealtype1d)(farg5); + arg6 = (sunrealtype1d)(farg6); + arg7 = (sunrealtype1d)(farg7); result = (MRIStepCoupling)MRIStepCoupling_Create(arg1,arg2,arg3,arg4,arg5,arg6,arg7); fresult = result; return fresult; diff --git a/src/arkode/fmod_int32/farkode_mristep_mod.f90 b/src/arkode/fmod_int32/farkode_mristep_mod.f90 index 37c167ba05..3647be34f2 100644 --- a/src/arkode/fmod_int32/farkode_mristep_mod.f90 +++ b/src/arkode/fmod_int32/farkode_mristep_mod.f90 @@ -26,7 +26,7 @@ module farkode_mristep_mod private ! DECLARATION CONSTRUCTS - ! typedef enum MRISTEP_METHOD_TYPE + ! enum MRISTEP_METHOD_TYPE enum, bind(c) enumerator :: MRISTEP_EXPLICIT enumerator :: MRISTEP_IMPLICIT @@ -36,11 +36,11 @@ module farkode_mristep_mod end enum integer, parameter, public :: MRISTEP_METHOD_TYPE = kind(MRISTEP_EXPLICIT) public :: MRISTEP_EXPLICIT, MRISTEP_IMPLICIT, MRISTEP_IMEX, MRISTEP_MERK, MRISTEP_SR - ! typedef enum ARKODE_MRITableID + ! enum ARKODE_MRITableID enum, bind(c) enumerator :: ARKODE_MRI_NONE = -1 enumerator :: ARKODE_MIN_MRI_NUM = 200 - enumerator :: ARKODE_MIS_KW3 = ARKODE_MIN_MRI_NUM + enumerator :: ARKODE_MIS_KW3 = 200 enumerator :: ARKODE_MRI_GARK_ERK33a enumerator :: ARKODE_MRI_GARK_ERK45a enumerator :: ARKODE_MRI_GARK_IRK21a diff --git a/src/arkode/fmod_int32/farkode_splittingstep_mod.c b/src/arkode/fmod_int32/farkode_splittingstep_mod.c index 6e27365f0f..791ef3a906 100644 --- a/src/arkode/fmod_int32/farkode_splittingstep_mod.c +++ b/src/arkode/fmod_int32/farkode_splittingstep_mod.c @@ -310,11 +310,11 @@ SWIGINTERN SwigArrayWrapper SwigArrayWrapper_uninitialized() { SWIGEXPORT void _wrap_SplittingStepCoefficientsMem_alpha_set(SwigClassWrapper const *farg1, double *farg2) { struct SplittingStepCoefficientsMem *arg1 = (struct SplittingStepCoefficientsMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct SplittingStepCoefficientsMem *", "SplittingStepCoefficientsMem", "SplittingStepCoefficientsMem::alpha", return ); arg1 = (struct SplittingStepCoefficientsMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->alpha = arg2; } @@ -322,11 +322,11 @@ SWIGEXPORT void _wrap_SplittingStepCoefficientsMem_alpha_set(SwigClassWrapper co SWIGEXPORT double * _wrap_SplittingStepCoefficientsMem_alpha_get(SwigClassWrapper const *farg1) { double * fresult ; struct SplittingStepCoefficientsMem *arg1 = (struct SplittingStepCoefficientsMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct SplittingStepCoefficientsMem *", "SplittingStepCoefficientsMem", "SplittingStepCoefficientsMem::alpha", return 0); arg1 = (struct SplittingStepCoefficientsMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->alpha); + result = (sunrealtype1d) ((arg1)->alpha); fresult = result; return fresult; } @@ -334,11 +334,11 @@ SWIGEXPORT double * _wrap_SplittingStepCoefficientsMem_alpha_get(SwigClassWrappe SWIGEXPORT void _wrap_SplittingStepCoefficientsMem_beta_set(SwigClassWrapper const *farg1, void *farg2) { struct SplittingStepCoefficientsMem *arg1 = (struct SplittingStepCoefficientsMem *) 0 ; - sunrealtype ***arg2 = (sunrealtype ***) 0 ; + sunrealtype3d arg2 = (sunrealtype3d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct SplittingStepCoefficientsMem *", "SplittingStepCoefficientsMem", "SplittingStepCoefficientsMem::beta", return ); arg1 = (struct SplittingStepCoefficientsMem *)(farg1->cptr); - arg2 = (sunrealtype ***)(farg2); + arg2 = (sunrealtype3d)(farg2); if (arg1) (arg1)->beta = arg2; } @@ -346,11 +346,11 @@ SWIGEXPORT void _wrap_SplittingStepCoefficientsMem_beta_set(SwigClassWrapper con SWIGEXPORT void * _wrap_SplittingStepCoefficientsMem_beta_get(SwigClassWrapper const *farg1) { void * fresult ; struct SplittingStepCoefficientsMem *arg1 = (struct SplittingStepCoefficientsMem *) 0 ; - sunrealtype ***result = 0 ; + sunrealtype3d result; SWIG_check_mutable_nonnull(*farg1, "struct SplittingStepCoefficientsMem *", "SplittingStepCoefficientsMem", "SplittingStepCoefficientsMem::beta", return 0); arg1 = (struct SplittingStepCoefficientsMem *)(farg1->cptr); - result = (sunrealtype ***) ((arg1)->beta); + result = (sunrealtype3d) ((arg1)->beta); fresult = result; return fresult; } @@ -506,16 +506,16 @@ SWIGEXPORT SwigClassWrapper _wrap_FSplittingStepCoefficients_Create(int const *f int arg2 ; int arg3 ; int arg4 ; - sunrealtype *arg5 = (sunrealtype *) 0 ; - sunrealtype *arg6 = (sunrealtype *) 0 ; + sunrealtype1d arg5 = (sunrealtype1d) 0 ; + sunrealtype1d arg6 = (sunrealtype1d) 0 ; SplittingStepCoefficients result; arg1 = (int)(*farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (int)(*farg4); - arg5 = (sunrealtype *)(farg5); - arg6 = (sunrealtype *)(farg6); + arg5 = (sunrealtype1d)(farg5); + arg6 = (sunrealtype1d)(farg6); result = (SplittingStepCoefficients)SplittingStepCoefficients_Create(arg1,arg2,arg3,arg4,arg5,arg6); fresult.cptr = result; fresult.cmemflags = SWIG_MEM_RVALUE | (0 ? SWIG_MEM_OWN : 0); diff --git a/src/arkode/fmod_int32/farkode_splittingstep_mod.f90 b/src/arkode/fmod_int32/farkode_splittingstep_mod.f90 index 7e73277f29..c8fdcc198c 100644 --- a/src/arkode/fmod_int32/farkode_splittingstep_mod.f90 +++ b/src/arkode/fmod_int32/farkode_splittingstep_mod.f90 @@ -57,11 +57,11 @@ module farkode_splittingstep_mod interface SplittingStepCoefficientsMem module procedure swigf_create_SplittingStepCoefficientsMem end interface - ! typedef enum ARKODE_SplittingCoefficientsID + ! enum ARKODE_SplittingCoefficientsID enum, bind(c) enumerator :: ARKODE_SPLITTING_NONE = -1 enumerator :: ARKODE_MIN_SPLITTING_NUM = 0 - enumerator :: ARKODE_SPLITTING_LIE_TROTTER_1_1_2 = ARKODE_MIN_SPLITTING_NUM + enumerator :: ARKODE_SPLITTING_LIE_TROTTER_1_1_2 = 0 enumerator :: ARKODE_SPLITTING_STRANG_2_2_2 enumerator :: ARKODE_SPLITTING_BEST_2_2_2 enumerator :: ARKODE_SPLITTING_SUZUKI_3_3_2 diff --git a/src/arkode/fmod_int32/farkode_sprkstep_mod.c b/src/arkode/fmod_int32/farkode_sprkstep_mod.c index c73dfc0cbd..07026c7d58 100644 --- a/src/arkode/fmod_int32/farkode_sprkstep_mod.c +++ b/src/arkode/fmod_int32/farkode_sprkstep_mod.c @@ -204,6 +204,7 @@ #include "arkode/arkode_sprkstep.h" +#include "arkode/arkode_sprkstep_deprecated.h" #include @@ -273,20 +274,6 @@ SWIGEXPORT int _wrap_FSPRKStepReInit(void *farg1, ARKRhsFn farg2, ARKRhsFn farg3 } -SWIGEXPORT int _wrap_FSPRKStepSetUseCompensatedSums(void *farg1, int const *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - int arg2 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (int)(*farg2); - result = (int)SPRKStepSetUseCompensatedSums(arg1,arg2); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FSPRKStepSetMethod(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; @@ -764,4 +751,18 @@ SWIGEXPORT int _wrap_FSPRKStepGetNumRhsEvals(void *farg1, long *farg2, long *far } +SWIGEXPORT int _wrap_FSPRKStepSetUseCompensatedSums(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)SPRKStepSetUseCompensatedSums(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + diff --git a/src/arkode/fmod_int32/farkode_sprkstep_mod.f90 b/src/arkode/fmod_int32/farkode_sprkstep_mod.f90 index d0b1db875f..4c3491c224 100644 --- a/src/arkode/fmod_int32/farkode_sprkstep_mod.f90 +++ b/src/arkode/fmod_int32/farkode_sprkstep_mod.f90 @@ -36,7 +36,6 @@ module farkode_sprkstep_mod integer(C_INT), parameter, public :: SPRKSTEP_DEFAULT_10 = ARKODE_SPRK_SOFRONIOU_10_36 public :: FSPRKStepCreate public :: FSPRKStepReInit - public :: FSPRKStepSetUseCompensatedSums public :: FSPRKStepSetMethod type, bind(C) :: SwigArrayWrapper type(C_PTR), public :: data = C_NULL_PTR @@ -74,6 +73,7 @@ module farkode_sprkstep_mod public :: FSPRKStepGetStepStats public :: FSPRKStepFree public :: FSPRKStepGetNumRhsEvals + public :: FSPRKStepSetUseCompensatedSums ! WRAPPER DECLARATIONS interface @@ -101,15 +101,6 @@ function swigc_FSPRKStepReInit(farg1, farg2, farg3, farg4, farg5) & integer(C_INT) :: fresult end function -function swigc_FSPRKStepSetUseCompensatedSums(farg1, farg2) & -bind(C, name="_wrap_FSPRKStepSetUseCompensatedSums") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -integer(C_INT), intent(in) :: farg2 -integer(C_INT) :: fresult -end function - function swigc_FSPRKStepSetMethod(farg1, farg2) & bind(C, name="_wrap_FSPRKStepSetMethod") & result(fresult) @@ -421,6 +412,15 @@ function swigc_FSPRKStepGetNumRhsEvals(farg1, farg2, farg3) & integer(C_INT) :: fresult end function +function swigc_FSPRKStepSetUseCompensatedSums(farg1, farg2) & +bind(C, name="_wrap_FSPRKStepSetUseCompensatedSums") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + end interface @@ -476,22 +476,6 @@ function FSPRKStepReInit(arkode_mem, f1, f2, t0, y0) & swig_result = fresult end function -function FSPRKStepSetUseCompensatedSums(arkode_mem, onoff) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -integer(C_INT), intent(in) :: onoff -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -integer(C_INT) :: farg2 - -farg1 = arkode_mem -farg2 = onoff -fresult = swigc_FSPRKStepSetUseCompensatedSums(farg1, farg2) -swig_result = fresult -end function - function FSPRKStepSetMethod(arkode_mem, sprk_storage) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -1077,5 +1061,21 @@ function FSPRKStepGetNumRhsEvals(arkode_mem, nf1, nf2) & swig_result = fresult end function +function FSPRKStepSetUseCompensatedSums(arkode_mem, onoff) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: onoff +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = onoff +fresult = swigc_FSPRKStepSetUseCompensatedSums(farg1, farg2) +swig_result = fresult +end function + end module diff --git a/src/arkode/fmod_int64/farkode_arkstep_mod.c b/src/arkode/fmod_int64/farkode_arkstep_mod.c index 6a7f52aeeb..bf38271434 100644 --- a/src/arkode/fmod_int64/farkode_arkstep_mod.c +++ b/src/arkode/fmod_int64/farkode_arkstep_mod.c @@ -204,6 +204,7 @@ #include "arkode/arkode_arkstep.h" +#include "arkode/arkode_arkstep_deprecated.h" #include @@ -403,6 +404,30 @@ SWIGEXPORT int _wrap_FARKStepGetTimestepperStats(void *farg1, long *farg2, long } +SWIGEXPORT int _wrap_FARKStepCreateAdjointStepper(void *farg1, SUNAdjRhsFn farg2, SUNAdjRhsFn farg3, double const *farg4, N_Vector farg5, void *farg6, void *farg7) { + int fresult ; + void *arg1 = (void *) 0 ; + SUNAdjRhsFn arg2 = (SUNAdjRhsFn) 0 ; + SUNAdjRhsFn arg3 = (SUNAdjRhsFn) 0 ; + sunrealtype arg4 ; + N_Vector arg5 = (N_Vector) 0 ; + SUNContext arg6 = (SUNContext) 0 ; + SUNAdjointStepper *arg7 = (SUNAdjointStepper *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (SUNAdjRhsFn)(farg2); + arg3 = (SUNAdjRhsFn)(farg3); + arg4 = (sunrealtype)(*farg4); + arg5 = (N_Vector)(farg5); + arg6 = (SUNContext)(farg6); + arg7 = (SUNAdjointStepper *)(farg7); + result = (int)ARKStepCreateAdjointStepper(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FARKStepCreateMRIStepInnerStepper(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; @@ -2427,30 +2452,6 @@ SWIGEXPORT void _wrap_FARKStepPrintMem(void *farg1, void *farg2) { } -SWIGEXPORT int _wrap_FARKStepCreateAdjointStepper(void *farg1, SUNAdjRhsFn farg2, SUNAdjRhsFn farg3, double const *farg4, N_Vector farg5, void *farg6, void *farg7) { - int fresult ; - void *arg1 = (void *) 0 ; - SUNAdjRhsFn arg2 = (SUNAdjRhsFn) 0 ; - SUNAdjRhsFn arg3 = (SUNAdjRhsFn) 0 ; - sunrealtype arg4 ; - N_Vector arg5 = (N_Vector) 0 ; - SUNContext arg6 = (SUNContext) 0 ; - SUNAdjointStepper *arg7 = (SUNAdjointStepper *) 0 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (SUNAdjRhsFn)(farg2); - arg3 = (SUNAdjRhsFn)(farg3); - arg4 = (sunrealtype)(*farg4); - arg5 = (N_Vector)(farg5); - arg6 = (SUNContext)(farg6); - arg7 = (SUNAdjointStepper *)(farg7); - result = (int)ARKStepCreateAdjointStepper(arg1,arg2,arg3,arg4,arg5,arg6,arg7); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FARKStepSetRelaxFn(void *farg1, ARKRelaxFn farg2, ARKRelaxJacFn farg3) { int fresult ; void *arg1 = (void *) 0 ; diff --git a/src/arkode/fmod_int64/farkode_arkstep_mod.f90 b/src/arkode/fmod_int64/farkode_arkstep_mod.f90 index c2b234d819..85f5e4ed67 100644 --- a/src/arkode/fmod_int64/farkode_arkstep_mod.f90 +++ b/src/arkode/fmod_int64/farkode_arkstep_mod.f90 @@ -62,6 +62,7 @@ module farkode_arkstep_mod public :: FARKStepSetTableName public :: FARKStepGetCurrentButcherTables public :: FARKStepGetTimestepperStats + public :: FARKStepCreateAdjointStepper public :: FARKStepCreateMRIStepInnerStepper public :: FARKStepResize public :: FARKStepReset @@ -202,7 +203,6 @@ module farkode_arkstep_mod public :: FARKStepGetLinReturnFlagName public :: FARKStepFree public :: FARKStepPrintMem - public :: FARKStepCreateAdjointStepper public :: FARKStepSetRelaxFn public :: FARKStepSetRelaxEtaFail public :: FARKStepSetRelaxLowerBound @@ -328,6 +328,20 @@ function swigc_FARKStepGetTimestepperStats(farg1, farg2, farg3, farg4, farg5, fa integer(C_INT) :: fresult end function +function swigc_FARKStepCreateAdjointStepper(farg1, farg2, farg3, farg4, farg5, farg6, farg7) & +bind(C, name="_wrap_FARKStepCreateAdjointStepper") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +real(C_DOUBLE), intent(in) :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR), value :: farg6 +type(C_PTR), value :: farg7 +integer(C_INT) :: fresult +end function + function swigc_FARKStepCreateMRIStepInnerStepper(farg1, farg2) & bind(C, name="_wrap_FARKStepCreateMRIStepInnerStepper") & result(fresult) @@ -1626,20 +1640,6 @@ subroutine swigc_FARKStepPrintMem(farg1, farg2) & type(C_PTR), value :: farg2 end subroutine -function swigc_FARKStepCreateAdjointStepper(farg1, farg2, farg3, farg4, farg5, farg6, farg7) & -bind(C, name="_wrap_FARKStepCreateAdjointStepper") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -type(C_FUNPTR), value :: farg2 -type(C_FUNPTR), value :: farg3 -real(C_DOUBLE), intent(in) :: farg4 -type(C_PTR), value :: farg5 -type(C_PTR), value :: farg6 -type(C_PTR), value :: farg7 -integer(C_INT) :: fresult -end function - function swigc_FARKStepSetRelaxFn(farg1, farg2, farg3) & bind(C, name="_wrap_FARKStepSetRelaxFn") & result(fresult) @@ -2018,6 +2018,37 @@ function FARKStepGetTimestepperStats(arkode_mem, expsteps, accsteps, step_attemp swig_result = fresult end function +function FARKStepCreateAdjointStepper(arkode_mem, adj_fe, adj_fi, tf, sf, sunctx, adj_stepper_ptr) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: adj_fe +type(C_FUNPTR), intent(in), value :: adj_fi +real(C_DOUBLE), intent(in) :: tf +type(N_Vector), target, intent(inout) :: sf +type(C_PTR) :: sunctx +type(C_PTR), target, intent(inout) :: adj_stepper_ptr +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 +real(C_DOUBLE) :: farg4 +type(C_PTR) :: farg5 +type(C_PTR) :: farg6 +type(C_PTR) :: farg7 + +farg1 = arkode_mem +farg2 = adj_fe +farg3 = adj_fi +farg4 = tf +farg5 = c_loc(sf) +farg6 = sunctx +farg7 = c_loc(adj_stepper_ptr) +fresult = swigc_FARKStepCreateAdjointStepper(farg1, farg2, farg3, farg4, farg5, farg6, farg7) +swig_result = fresult +end function + function FARKStepCreateMRIStepInnerStepper(arkode_mem, stepper) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -4371,37 +4402,6 @@ subroutine FARKStepPrintMem(arkode_mem, outfile) call swigc_FARKStepPrintMem(farg1, farg2) end subroutine -function FARKStepCreateAdjointStepper(arkode_mem, adj_fe, adj_fi, tf, sf, sunctx, adj_stepper_ptr) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -type(C_FUNPTR), intent(in), value :: adj_fe -type(C_FUNPTR), intent(in), value :: adj_fi -real(C_DOUBLE), intent(in) :: tf -type(N_Vector), target, intent(inout) :: sf -type(C_PTR) :: sunctx -type(C_PTR), target, intent(inout) :: adj_stepper_ptr -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -type(C_FUNPTR) :: farg2 -type(C_FUNPTR) :: farg3 -real(C_DOUBLE) :: farg4 -type(C_PTR) :: farg5 -type(C_PTR) :: farg6 -type(C_PTR) :: farg7 - -farg1 = arkode_mem -farg2 = adj_fe -farg3 = adj_fi -farg4 = tf -farg5 = c_loc(sf) -farg6 = sunctx -farg7 = c_loc(adj_stepper_ptr) -fresult = swigc_FARKStepCreateAdjointStepper(farg1, farg2, farg3, farg4, farg5, farg6, farg7) -swig_result = fresult -end function - function FARKStepSetRelaxFn(arkode_mem, rfn, rjac) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/arkode/fmod_int64/farkode_erkstep_mod.c b/src/arkode/fmod_int64/farkode_erkstep_mod.c index 02404f1e1b..6497ea0802 100644 --- a/src/arkode/fmod_int64/farkode_erkstep_mod.c +++ b/src/arkode/fmod_int64/farkode_erkstep_mod.c @@ -204,6 +204,7 @@ #include "arkode/arkode_erkstep.h" +#include "arkode/arkode_erkstep_deprecated.h" #include diff --git a/src/arkode/fmod_int64/farkode_lsrkstep_mod.f90 b/src/arkode/fmod_int64/farkode_lsrkstep_mod.f90 index eb54169668..42477f620d 100644 --- a/src/arkode/fmod_int64/farkode_lsrkstep_mod.f90 +++ b/src/arkode/fmod_int64/farkode_lsrkstep_mod.f90 @@ -26,7 +26,7 @@ module farkode_lsrkstep_mod private ! DECLARATION CONSTRUCTS - ! typedef enum ARKODE_LSRKMethodType + ! enum ARKODE_LSRKMethodType enum, bind(c) enumerator :: ARKODE_LSRK_RKC_2 enumerator :: ARKODE_LSRK_RKL_2 diff --git a/src/arkode/fmod_int64/farkode_mod.c b/src/arkode/fmod_int64/farkode_mod.c index 2a73314fba..e80695216b 100644 --- a/src/arkode/fmod_int64/farkode_mod.c +++ b/src/arkode/fmod_int64/farkode_mod.c @@ -2603,11 +2603,11 @@ SWIGEXPORT int _wrap_ARKodeButcherTableMem_stages_get(SwigClassWrapper const *fa SWIGEXPORT void _wrap_ARKodeButcherTableMem_A_set(SwigClassWrapper const *farg1, void *farg2) { struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::A", return ); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - arg2 = (sunrealtype **)(farg2); + arg2 = (sunrealtype2d)(farg2); if (arg1) (arg1)->A = arg2; } @@ -2615,11 +2615,11 @@ SWIGEXPORT void _wrap_ARKodeButcherTableMem_A_set(SwigClassWrapper const *farg1, SWIGEXPORT void * _wrap_ARKodeButcherTableMem_A_get(SwigClassWrapper const *farg1) { void * fresult ; struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype **result = 0 ; + sunrealtype2d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::A", return 0); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - result = (sunrealtype **) ((arg1)->A); + result = (sunrealtype2d) ((arg1)->A); fresult = result; return fresult; } @@ -2627,11 +2627,11 @@ SWIGEXPORT void * _wrap_ARKodeButcherTableMem_A_get(SwigClassWrapper const *farg SWIGEXPORT void _wrap_ARKodeButcherTableMem_c_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::c", return ); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->c = arg2; } @@ -2639,11 +2639,11 @@ SWIGEXPORT void _wrap_ARKodeButcherTableMem_c_set(SwigClassWrapper const *farg1, SWIGEXPORT double * _wrap_ARKodeButcherTableMem_c_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::c", return 0); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->c); + result = (sunrealtype1d) ((arg1)->c); fresult = result; return fresult; } @@ -2651,11 +2651,11 @@ SWIGEXPORT double * _wrap_ARKodeButcherTableMem_c_get(SwigClassWrapper const *fa SWIGEXPORT void _wrap_ARKodeButcherTableMem_b_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::b", return ); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->b = arg2; } @@ -2663,11 +2663,11 @@ SWIGEXPORT void _wrap_ARKodeButcherTableMem_b_set(SwigClassWrapper const *farg1, SWIGEXPORT double * _wrap_ARKodeButcherTableMem_b_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::b", return 0); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->b); + result = (sunrealtype1d) ((arg1)->b); fresult = result; return fresult; } @@ -2675,11 +2675,11 @@ SWIGEXPORT double * _wrap_ARKodeButcherTableMem_b_get(SwigClassWrapper const *fa SWIGEXPORT void _wrap_ARKodeButcherTableMem_d_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::d", return ); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->d = arg2; } @@ -2687,11 +2687,11 @@ SWIGEXPORT void _wrap_ARKodeButcherTableMem_d_set(SwigClassWrapper const *farg1, SWIGEXPORT double * _wrap_ARKodeButcherTableMem_d_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeButcherTableMem *arg1 = (struct ARKodeButcherTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeButcherTableMem *", "ARKodeButcherTableMem", "ARKodeButcherTableMem::d", return 0); arg1 = (struct ARKodeButcherTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->d); + result = (sunrealtype1d) ((arg1)->d); fresult = result; return fresult; } @@ -2747,19 +2747,19 @@ SWIGEXPORT void * _wrap_FARKodeButcherTable_Create(int const *farg1, int const * int arg1 ; int arg2 ; int arg3 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; - sunrealtype *arg5 = (sunrealtype *) 0 ; - sunrealtype *arg6 = (sunrealtype *) 0 ; - sunrealtype *arg7 = (sunrealtype *) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; + sunrealtype1d arg5 = (sunrealtype1d) 0 ; + sunrealtype1d arg6 = (sunrealtype1d) 0 ; + sunrealtype1d arg7 = (sunrealtype1d) 0 ; ARKodeButcherTable result; arg1 = (int)(*farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); - arg4 = (sunrealtype *)(farg4); - arg5 = (sunrealtype *)(farg5); - arg6 = (sunrealtype *)(farg6); - arg7 = (sunrealtype *)(farg7); + arg4 = (sunrealtype1d)(farg4); + arg5 = (sunrealtype1d)(farg5); + arg6 = (sunrealtype1d)(farg6); + arg7 = (sunrealtype1d)(farg7); result = (ARKodeButcherTable)ARKodeButcherTable_Create(arg1,arg2,arg3,arg4,arg5,arg6,arg7); fresult = result; return fresult; @@ -2982,11 +2982,11 @@ SWIGEXPORT int _wrap_ARKodeSPRKTableMem_stages_get(SwigClassWrapper const *farg1 SWIGEXPORT void _wrap_ARKodeSPRKTableMem_a_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeSPRKTableMem *arg1 = (struct ARKodeSPRKTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeSPRKTableMem *", "ARKodeSPRKTableMem", "ARKodeSPRKTableMem::a", return ); arg1 = (struct ARKodeSPRKTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->a = arg2; } @@ -2994,11 +2994,11 @@ SWIGEXPORT void _wrap_ARKodeSPRKTableMem_a_set(SwigClassWrapper const *farg1, do SWIGEXPORT double * _wrap_ARKodeSPRKTableMem_a_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeSPRKTableMem *arg1 = (struct ARKodeSPRKTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeSPRKTableMem *", "ARKodeSPRKTableMem", "ARKodeSPRKTableMem::a", return 0); arg1 = (struct ARKodeSPRKTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->a); + result = (sunrealtype1d) ((arg1)->a); fresult = result; return fresult; } @@ -3006,11 +3006,11 @@ SWIGEXPORT double * _wrap_ARKodeSPRKTableMem_a_get(SwigClassWrapper const *farg1 SWIGEXPORT void _wrap_ARKodeSPRKTableMem_ahat_set(SwigClassWrapper const *farg1, double *farg2) { struct ARKodeSPRKTableMem *arg1 = (struct ARKodeSPRKTableMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeSPRKTableMem *", "ARKodeSPRKTableMem", "ARKodeSPRKTableMem::ahat", return ); arg1 = (struct ARKodeSPRKTableMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->ahat = arg2; } @@ -3018,11 +3018,11 @@ SWIGEXPORT void _wrap_ARKodeSPRKTableMem_ahat_set(SwigClassWrapper const *farg1, SWIGEXPORT double * _wrap_ARKodeSPRKTableMem_ahat_get(SwigClassWrapper const *farg1) { double * fresult ; struct ARKodeSPRKTableMem *arg1 = (struct ARKodeSPRKTableMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct ARKodeSPRKTableMem *", "ARKodeSPRKTableMem", "ARKodeSPRKTableMem::ahat", return 0); arg1 = (struct ARKodeSPRKTableMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->ahat); + result = (sunrealtype1d) ((arg1)->ahat); fresult = result; return fresult; } @@ -3063,15 +3063,15 @@ SWIGEXPORT void * _wrap_FARKodeSPRKTable_Create(int const *farg1, int const *far void * fresult ; int arg1 ; int arg2 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; ARKodeSPRKTable result; arg1 = (int)(*farg1); arg2 = (int)(*farg2); - arg3 = (sunrealtype *)(farg3); - arg4 = (sunrealtype *)(farg4); - result = (ARKodeSPRKTable)ARKodeSPRKTable_Create(arg1,arg2,(double const *)arg3,(double const *)arg4); + arg3 = (sunrealtype1d)(farg3); + arg4 = (sunrealtype1d)(farg4); + result = (ARKodeSPRKTable)ARKodeSPRKTable_Create(arg1,arg2,arg3,arg4); fresult = result; return fresult; } diff --git a/src/arkode/fmod_int64/farkode_mod.f90 b/src/arkode/fmod_int64/farkode_mod.f90 index df2167c214..97f97883ef 100644 --- a/src/arkode/fmod_int64/farkode_mod.f90 +++ b/src/arkode/fmod_int64/farkode_mod.f90 @@ -103,14 +103,14 @@ module farkode_mod integer(C_INT), parameter, public :: ARK_SUNADJSTEPPER_ERR = -55_C_INT integer(C_INT), parameter, public :: ARK_DEE_FAIL = -56_C_INT integer(C_INT), parameter, public :: ARK_UNRECOGNIZED_ERROR = -99_C_INT - ! typedef enum ARKRelaxSolver + ! enum ARKRelaxSolver enum, bind(c) enumerator :: ARK_RELAX_BRENT enumerator :: ARK_RELAX_NEWTON end enum integer, parameter, public :: ARKRelaxSolver = kind(ARK_RELAX_BRENT) public :: ARK_RELAX_BRENT, ARK_RELAX_NEWTON - ! typedef enum ARKAccumError + ! enum ARKAccumError enum, bind(c) enumerator :: ARK_ACCUMERROR_NONE enumerator :: ARK_ACCUMERROR_MAX @@ -318,7 +318,7 @@ module farkode_mod public :: FARKodeButcherTable_IsStifflyAccurate public :: FARKodeButcherTable_CheckOrder public :: FARKodeButcherTable_CheckARKOrder - ! typedef enum ARKODE_DIRKTableID + ! enum ARKODE_DIRKTableID enum, bind(c) enumerator :: ARKODE_DIRK_NONE = -1 enumerator :: ARKODE_MIN_DIRK_NUM = 100 @@ -362,7 +362,7 @@ module farkode_mod public :: FARKodeButcherTable_LoadDIRK public :: FARKodeButcherTable_LoadDIRKByName public :: FARKodeButcherTable_DIRKIDToName - ! typedef enum ARKODE_ERKTableID + ! enum ARKODE_ERKTableID enum, bind(c) enumerator :: ARKODE_ERK_NONE = -1 enumerator :: ARKODE_MIN_ERK_NUM = 0 @@ -407,11 +407,11 @@ module farkode_mod public :: FARKodeButcherTable_LoadERK public :: FARKodeButcherTable_LoadERKByName public :: FARKodeButcherTable_ERKIDToName - ! typedef enum ARKODE_SPRKMethodID + ! enum ARKODE_SPRKMethodID enum, bind(c) enumerator :: ARKODE_SPRK_NONE = -1 enumerator :: ARKODE_MIN_SPRK_NUM = 0 - enumerator :: ARKODE_SPRK_EULER_1_1 = ARKODE_MIN_SPRK_NUM + enumerator :: ARKODE_SPRK_EULER_1_1 = 0 enumerator :: ARKODE_SPRK_LEAPFROG_2_2 enumerator :: ARKODE_SPRK_PSEUDO_LEAPFROG_2_2 enumerator :: ARKODE_SPRK_RUTH_3_3 diff --git a/src/arkode/fmod_int64/farkode_mristep_mod.c b/src/arkode/fmod_int64/farkode_mristep_mod.c index 733d62ecca..f805f0b9f9 100644 --- a/src/arkode/fmod_int64/farkode_mristep_mod.c +++ b/src/arkode/fmod_int64/farkode_mristep_mod.c @@ -233,6 +233,7 @@ enum { #include "arkode/arkode_mristep.h" +#include "arkode/arkode_mristep_deprecated.h" typedef struct { @@ -430,11 +431,11 @@ SWIGEXPORT int _wrap_MRIStepCouplingMem_p_get(SwigClassWrapper const *farg1) { SWIGEXPORT void _wrap_MRIStepCouplingMem_c_set(SwigClassWrapper const *farg1, double *farg2) { struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::c", return ); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->c = arg2; } @@ -442,11 +443,11 @@ SWIGEXPORT void _wrap_MRIStepCouplingMem_c_set(SwigClassWrapper const *farg1, do SWIGEXPORT double * _wrap_MRIStepCouplingMem_c_get(SwigClassWrapper const *farg1) { double * fresult ; struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::c", return 0); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->c); + result = (sunrealtype1d) ((arg1)->c); fresult = result; return fresult; } @@ -454,11 +455,11 @@ SWIGEXPORT double * _wrap_MRIStepCouplingMem_c_get(SwigClassWrapper const *farg1 SWIGEXPORT void _wrap_MRIStepCouplingMem_W_set(SwigClassWrapper const *farg1, void *farg2) { struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype ***arg2 = (sunrealtype ***) 0 ; + sunrealtype3d arg2 = (sunrealtype3d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::W", return ); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - arg2 = (sunrealtype ***)(farg2); + arg2 = (sunrealtype3d)(farg2); if (arg1) (arg1)->W = arg2; } @@ -466,11 +467,11 @@ SWIGEXPORT void _wrap_MRIStepCouplingMem_W_set(SwigClassWrapper const *farg1, vo SWIGEXPORT void * _wrap_MRIStepCouplingMem_W_get(SwigClassWrapper const *farg1) { void * fresult ; struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype ***result = 0 ; + sunrealtype3d result; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::W", return 0); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - result = (sunrealtype ***) ((arg1)->W); + result = (sunrealtype3d) ((arg1)->W); fresult = result; return fresult; } @@ -478,11 +479,11 @@ SWIGEXPORT void * _wrap_MRIStepCouplingMem_W_get(SwigClassWrapper const *farg1) SWIGEXPORT void _wrap_MRIStepCouplingMem_G_set(SwigClassWrapper const *farg1, void *farg2) { struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype ***arg2 = (sunrealtype ***) 0 ; + sunrealtype3d arg2 = (sunrealtype3d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::G", return ); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - arg2 = (sunrealtype ***)(farg2); + arg2 = (sunrealtype3d)(farg2); if (arg1) (arg1)->G = arg2; } @@ -490,11 +491,11 @@ SWIGEXPORT void _wrap_MRIStepCouplingMem_G_set(SwigClassWrapper const *farg1, vo SWIGEXPORT void * _wrap_MRIStepCouplingMem_G_get(SwigClassWrapper const *farg1) { void * fresult ; struct MRIStepCouplingMem *arg1 = (struct MRIStepCouplingMem *) 0 ; - sunrealtype ***result = 0 ; + sunrealtype3d result; SWIG_check_mutable_nonnull(*farg1, "struct MRIStepCouplingMem *", "MRIStepCouplingMem", "MRIStepCouplingMem::G", return 0); arg1 = (struct MRIStepCouplingMem *)(farg1->cptr); - result = (sunrealtype ***) ((arg1)->G); + result = (sunrealtype3d) ((arg1)->G); fresult = result; return fresult; } @@ -625,18 +626,18 @@ SWIGEXPORT void * _wrap_FMRIStepCoupling_Create(int const *farg1, int const *far int arg2 ; int arg3 ; int arg4 ; - sunrealtype *arg5 = (sunrealtype *) 0 ; - sunrealtype *arg6 = (sunrealtype *) 0 ; - sunrealtype *arg7 = (sunrealtype *) 0 ; + sunrealtype1d arg5 = (sunrealtype1d) 0 ; + sunrealtype1d arg6 = (sunrealtype1d) 0 ; + sunrealtype1d arg7 = (sunrealtype1d) 0 ; MRIStepCoupling result; arg1 = (int)(*farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (int)(*farg4); - arg5 = (sunrealtype *)(farg5); - arg6 = (sunrealtype *)(farg6); - arg7 = (sunrealtype *)(farg7); + arg5 = (sunrealtype1d)(farg5); + arg6 = (sunrealtype1d)(farg6); + arg7 = (sunrealtype1d)(farg7); result = (MRIStepCoupling)MRIStepCoupling_Create(arg1,arg2,arg3,arg4,arg5,arg6,arg7); fresult = result; return fresult; diff --git a/src/arkode/fmod_int64/farkode_mristep_mod.f90 b/src/arkode/fmod_int64/farkode_mristep_mod.f90 index fe7521c877..4593e9c361 100644 --- a/src/arkode/fmod_int64/farkode_mristep_mod.f90 +++ b/src/arkode/fmod_int64/farkode_mristep_mod.f90 @@ -26,7 +26,7 @@ module farkode_mristep_mod private ! DECLARATION CONSTRUCTS - ! typedef enum MRISTEP_METHOD_TYPE + ! enum MRISTEP_METHOD_TYPE enum, bind(c) enumerator :: MRISTEP_EXPLICIT enumerator :: MRISTEP_IMPLICIT @@ -36,11 +36,11 @@ module farkode_mristep_mod end enum integer, parameter, public :: MRISTEP_METHOD_TYPE = kind(MRISTEP_EXPLICIT) public :: MRISTEP_EXPLICIT, MRISTEP_IMPLICIT, MRISTEP_IMEX, MRISTEP_MERK, MRISTEP_SR - ! typedef enum ARKODE_MRITableID + ! enum ARKODE_MRITableID enum, bind(c) enumerator :: ARKODE_MRI_NONE = -1 enumerator :: ARKODE_MIN_MRI_NUM = 200 - enumerator :: ARKODE_MIS_KW3 = ARKODE_MIN_MRI_NUM + enumerator :: ARKODE_MIS_KW3 = 200 enumerator :: ARKODE_MRI_GARK_ERK33a enumerator :: ARKODE_MRI_GARK_ERK45a enumerator :: ARKODE_MRI_GARK_IRK21a diff --git a/src/arkode/fmod_int64/farkode_splittingstep_mod.c b/src/arkode/fmod_int64/farkode_splittingstep_mod.c index 6e27365f0f..791ef3a906 100644 --- a/src/arkode/fmod_int64/farkode_splittingstep_mod.c +++ b/src/arkode/fmod_int64/farkode_splittingstep_mod.c @@ -310,11 +310,11 @@ SWIGINTERN SwigArrayWrapper SwigArrayWrapper_uninitialized() { SWIGEXPORT void _wrap_SplittingStepCoefficientsMem_alpha_set(SwigClassWrapper const *farg1, double *farg2) { struct SplittingStepCoefficientsMem *arg1 = (struct SplittingStepCoefficientsMem *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct SplittingStepCoefficientsMem *", "SplittingStepCoefficientsMem", "SplittingStepCoefficientsMem::alpha", return ); arg1 = (struct SplittingStepCoefficientsMem *)(farg1->cptr); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); if (arg1) (arg1)->alpha = arg2; } @@ -322,11 +322,11 @@ SWIGEXPORT void _wrap_SplittingStepCoefficientsMem_alpha_set(SwigClassWrapper co SWIGEXPORT double * _wrap_SplittingStepCoefficientsMem_alpha_get(SwigClassWrapper const *farg1) { double * fresult ; struct SplittingStepCoefficientsMem *arg1 = (struct SplittingStepCoefficientsMem *) 0 ; - sunrealtype *result = 0 ; + sunrealtype1d result; SWIG_check_mutable_nonnull(*farg1, "struct SplittingStepCoefficientsMem *", "SplittingStepCoefficientsMem", "SplittingStepCoefficientsMem::alpha", return 0); arg1 = (struct SplittingStepCoefficientsMem *)(farg1->cptr); - result = (sunrealtype *) ((arg1)->alpha); + result = (sunrealtype1d) ((arg1)->alpha); fresult = result; return fresult; } @@ -334,11 +334,11 @@ SWIGEXPORT double * _wrap_SplittingStepCoefficientsMem_alpha_get(SwigClassWrappe SWIGEXPORT void _wrap_SplittingStepCoefficientsMem_beta_set(SwigClassWrapper const *farg1, void *farg2) { struct SplittingStepCoefficientsMem *arg1 = (struct SplittingStepCoefficientsMem *) 0 ; - sunrealtype ***arg2 = (sunrealtype ***) 0 ; + sunrealtype3d arg2 = (sunrealtype3d) 0 ; SWIG_check_mutable_nonnull(*farg1, "struct SplittingStepCoefficientsMem *", "SplittingStepCoefficientsMem", "SplittingStepCoefficientsMem::beta", return ); arg1 = (struct SplittingStepCoefficientsMem *)(farg1->cptr); - arg2 = (sunrealtype ***)(farg2); + arg2 = (sunrealtype3d)(farg2); if (arg1) (arg1)->beta = arg2; } @@ -346,11 +346,11 @@ SWIGEXPORT void _wrap_SplittingStepCoefficientsMem_beta_set(SwigClassWrapper con SWIGEXPORT void * _wrap_SplittingStepCoefficientsMem_beta_get(SwigClassWrapper const *farg1) { void * fresult ; struct SplittingStepCoefficientsMem *arg1 = (struct SplittingStepCoefficientsMem *) 0 ; - sunrealtype ***result = 0 ; + sunrealtype3d result; SWIG_check_mutable_nonnull(*farg1, "struct SplittingStepCoefficientsMem *", "SplittingStepCoefficientsMem", "SplittingStepCoefficientsMem::beta", return 0); arg1 = (struct SplittingStepCoefficientsMem *)(farg1->cptr); - result = (sunrealtype ***) ((arg1)->beta); + result = (sunrealtype3d) ((arg1)->beta); fresult = result; return fresult; } @@ -506,16 +506,16 @@ SWIGEXPORT SwigClassWrapper _wrap_FSplittingStepCoefficients_Create(int const *f int arg2 ; int arg3 ; int arg4 ; - sunrealtype *arg5 = (sunrealtype *) 0 ; - sunrealtype *arg6 = (sunrealtype *) 0 ; + sunrealtype1d arg5 = (sunrealtype1d) 0 ; + sunrealtype1d arg6 = (sunrealtype1d) 0 ; SplittingStepCoefficients result; arg1 = (int)(*farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (int)(*farg4); - arg5 = (sunrealtype *)(farg5); - arg6 = (sunrealtype *)(farg6); + arg5 = (sunrealtype1d)(farg5); + arg6 = (sunrealtype1d)(farg6); result = (SplittingStepCoefficients)SplittingStepCoefficients_Create(arg1,arg2,arg3,arg4,arg5,arg6); fresult.cptr = result; fresult.cmemflags = SWIG_MEM_RVALUE | (0 ? SWIG_MEM_OWN : 0); diff --git a/src/arkode/fmod_int64/farkode_splittingstep_mod.f90 b/src/arkode/fmod_int64/farkode_splittingstep_mod.f90 index 7e73277f29..c8fdcc198c 100644 --- a/src/arkode/fmod_int64/farkode_splittingstep_mod.f90 +++ b/src/arkode/fmod_int64/farkode_splittingstep_mod.f90 @@ -57,11 +57,11 @@ module farkode_splittingstep_mod interface SplittingStepCoefficientsMem module procedure swigf_create_SplittingStepCoefficientsMem end interface - ! typedef enum ARKODE_SplittingCoefficientsID + ! enum ARKODE_SplittingCoefficientsID enum, bind(c) enumerator :: ARKODE_SPLITTING_NONE = -1 enumerator :: ARKODE_MIN_SPLITTING_NUM = 0 - enumerator :: ARKODE_SPLITTING_LIE_TROTTER_1_1_2 = ARKODE_MIN_SPLITTING_NUM + enumerator :: ARKODE_SPLITTING_LIE_TROTTER_1_1_2 = 0 enumerator :: ARKODE_SPLITTING_STRANG_2_2_2 enumerator :: ARKODE_SPLITTING_BEST_2_2_2 enumerator :: ARKODE_SPLITTING_SUZUKI_3_3_2 diff --git a/src/arkode/fmod_int64/farkode_sprkstep_mod.c b/src/arkode/fmod_int64/farkode_sprkstep_mod.c index c73dfc0cbd..07026c7d58 100644 --- a/src/arkode/fmod_int64/farkode_sprkstep_mod.c +++ b/src/arkode/fmod_int64/farkode_sprkstep_mod.c @@ -204,6 +204,7 @@ #include "arkode/arkode_sprkstep.h" +#include "arkode/arkode_sprkstep_deprecated.h" #include @@ -273,20 +274,6 @@ SWIGEXPORT int _wrap_FSPRKStepReInit(void *farg1, ARKRhsFn farg2, ARKRhsFn farg3 } -SWIGEXPORT int _wrap_FSPRKStepSetUseCompensatedSums(void *farg1, int const *farg2) { - int fresult ; - void *arg1 = (void *) 0 ; - int arg2 ; - int result; - - arg1 = (void *)(farg1); - arg2 = (int)(*farg2); - result = (int)SPRKStepSetUseCompensatedSums(arg1,arg2); - fresult = (int)(result); - return fresult; -} - - SWIGEXPORT int _wrap_FSPRKStepSetMethod(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; @@ -764,4 +751,18 @@ SWIGEXPORT int _wrap_FSPRKStepGetNumRhsEvals(void *farg1, long *farg2, long *far } +SWIGEXPORT int _wrap_FSPRKStepSetUseCompensatedSums(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)SPRKStepSetUseCompensatedSums(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + diff --git a/src/arkode/fmod_int64/farkode_sprkstep_mod.f90 b/src/arkode/fmod_int64/farkode_sprkstep_mod.f90 index d0b1db875f..4c3491c224 100644 --- a/src/arkode/fmod_int64/farkode_sprkstep_mod.f90 +++ b/src/arkode/fmod_int64/farkode_sprkstep_mod.f90 @@ -36,7 +36,6 @@ module farkode_sprkstep_mod integer(C_INT), parameter, public :: SPRKSTEP_DEFAULT_10 = ARKODE_SPRK_SOFRONIOU_10_36 public :: FSPRKStepCreate public :: FSPRKStepReInit - public :: FSPRKStepSetUseCompensatedSums public :: FSPRKStepSetMethod type, bind(C) :: SwigArrayWrapper type(C_PTR), public :: data = C_NULL_PTR @@ -74,6 +73,7 @@ module farkode_sprkstep_mod public :: FSPRKStepGetStepStats public :: FSPRKStepFree public :: FSPRKStepGetNumRhsEvals + public :: FSPRKStepSetUseCompensatedSums ! WRAPPER DECLARATIONS interface @@ -101,15 +101,6 @@ function swigc_FSPRKStepReInit(farg1, farg2, farg3, farg4, farg5) & integer(C_INT) :: fresult end function -function swigc_FSPRKStepSetUseCompensatedSums(farg1, farg2) & -bind(C, name="_wrap_FSPRKStepSetUseCompensatedSums") & -result(fresult) -use, intrinsic :: ISO_C_BINDING -type(C_PTR), value :: farg1 -integer(C_INT), intent(in) :: farg2 -integer(C_INT) :: fresult -end function - function swigc_FSPRKStepSetMethod(farg1, farg2) & bind(C, name="_wrap_FSPRKStepSetMethod") & result(fresult) @@ -421,6 +412,15 @@ function swigc_FSPRKStepGetNumRhsEvals(farg1, farg2, farg3) & integer(C_INT) :: fresult end function +function swigc_FSPRKStepSetUseCompensatedSums(farg1, farg2) & +bind(C, name="_wrap_FSPRKStepSetUseCompensatedSums") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + end interface @@ -476,22 +476,6 @@ function FSPRKStepReInit(arkode_mem, f1, f2, t0, y0) & swig_result = fresult end function -function FSPRKStepSetUseCompensatedSums(arkode_mem, onoff) & -result(swig_result) -use, intrinsic :: ISO_C_BINDING -integer(C_INT) :: swig_result -type(C_PTR) :: arkode_mem -integer(C_INT), intent(in) :: onoff -integer(C_INT) :: fresult -type(C_PTR) :: farg1 -integer(C_INT) :: farg2 - -farg1 = arkode_mem -farg2 = onoff -fresult = swigc_FSPRKStepSetUseCompensatedSums(farg1, farg2) -swig_result = fresult -end function - function FSPRKStepSetMethod(arkode_mem, sprk_storage) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -1077,5 +1061,21 @@ function FSPRKStepGetNumRhsEvals(arkode_mem, nf1, nf2) & swig_result = fresult end function +function FSPRKStepSetUseCompensatedSums(arkode_mem, onoff) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: onoff +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = onoff +fresult = swigc_FSPRKStepSetUseCompensatedSums(farg1, farg2) +swig_result = fresult +end function + end module diff --git a/src/cvode/cvode.c b/src/cvode/cvode.c index ef03280257..0d33f5e932 100644 --- a/src/cvode/cvode.c +++ b/src/cvode/cvode.c @@ -272,6 +272,7 @@ void* CVodeCreate(int lmm, SUNContext sunctx) /* Set default values for integrator optional inputs */ cv_mem->cv_f = NULL; cv_mem->cv_user_data = NULL; + cv_mem->cv_own_user_data = SUNFALSE; cv_mem->cv_itol = CV_NN; cv_mem->cv_atolmin0 = SUNTRUE; cv_mem->cv_user_efun = SUNFALSE; @@ -1815,6 +1816,8 @@ void CVodeFree(void** cvode_mem) if (cv_mem->proj_mem) { cvProjFree(&(cv_mem->proj_mem)); } + if (cv_mem->cv_own_user_data) { free(cv_mem->cv_user_data); } + free(*cvode_mem); *cvode_mem = NULL; } diff --git a/src/cvode/cvode_impl.h b/src/cvode/cvode_impl.h index edf5b0a3c1..4a9d732811 100644 --- a/src/cvode/cvode_impl.h +++ b/src/cvode/cvode_impl.h @@ -202,8 +202,9 @@ typedef struct CVodeMemRec CVRhsFn cv_f; /* y' = f(t,y(t)) */ void* cv_user_data; /* user pointer passed to f */ - int cv_lmm; /* lmm = CV_ADAMS or CV_BDF */ - int cv_itol; /* itol = CV_SS, CV_SV, CV_WF, CV_NN */ + sunbooleantype cv_own_user_data; /* SUNTRUE if we own user_data and should free it */ + int cv_lmm; /* lmm = CV_ADAMS or CV_BDF */ + int cv_itol; /* itol = CV_SS, CV_SV, CV_WF, CV_NN */ sunrealtype cv_reltol; /* relative tolerance */ sunrealtype cv_Sabstol; /* scalar absolute tolerance */ @@ -661,6 +662,11 @@ int cvDiagSetup_buildM(const sunrealtype fract, const sunrealtype uround, int cvDiagSolve_updateM(const sunrealtype r, N_Vector M); #endif +/* Utility function to tell CVODE to free the user data. + This is used by the Python interfaces. */ + +int CVodeSetOwnUserData(void* cvode_mem, sunbooleantype own_user_data); + /* * ================================================================= * E R R O R M E S S A G E S diff --git a/src/cvode/cvode_io.c b/src/cvode/cvode_io.c index fc16633d2f..6c2c47d9da 100644 --- a/src/cvode/cvode_io.c +++ b/src/cvode/cvode_io.c @@ -81,6 +81,29 @@ int CVodeSetUserData(void* cvode_mem, void* user_data) return (CV_SUCCESS); } +/* + * CVodeSetOwnUserData + * + * Specifies whether the integrator owns the user data pointer. + */ + +int CVodeSetOwnUserData(void* cvode_mem, sunbooleantype own_user_data) +{ + CVodeMem cv_mem; + + if (cvode_mem == NULL) + { + cvProcessError(NULL, CV_MEM_NULL, __LINE__, __func__, __FILE__, MSGCV_NO_MEM); + return (CV_MEM_NULL); + } + + cv_mem = (CVodeMem)cvode_mem; + + cv_mem->cv_own_user_data = own_user_data; + + return (CV_SUCCESS); +} + /* * CVodeSetMonitorFn * diff --git a/src/cvode/fmod_int32/fcvode_mod.c b/src/cvode/fmod_int32/fcvode_mod.c index bfd166d327..6ea17b0efa 100644 --- a/src/cvode/fmod_int32/fcvode_mod.c +++ b/src/cvode/fmod_int32/fcvode_mod.c @@ -289,17 +289,17 @@ SWIGEXPORT int _wrap_FCVodeReInit(void *farg1, double const *farg2, N_Vector far SWIGEXPORT int _wrap_FCVodeResizeHistory(void *farg1, double *farg2, void *farg3, void *farg4, int const *farg5, int const *farg6) { int fresult ; void *arg1 = (void *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int arg5 ; int arg6 ; int result; arg1 = (void *)(farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); arg5 = (int)(*farg5); arg6 = (int)(*farg6); result = (int)CVodeResizeHistory(arg1,arg2,arg3,arg4,arg5,arg6); diff --git a/src/cvode/fmod_int64/fcvode_mod.c b/src/cvode/fmod_int64/fcvode_mod.c index 199e1ae5da..57e4520d47 100644 --- a/src/cvode/fmod_int64/fcvode_mod.c +++ b/src/cvode/fmod_int64/fcvode_mod.c @@ -289,17 +289,17 @@ SWIGEXPORT int _wrap_FCVodeReInit(void *farg1, double const *farg2, N_Vector far SWIGEXPORT int _wrap_FCVodeResizeHistory(void *farg1, double *farg2, void *farg3, void *farg4, int const *farg5, int const *farg6) { int fresult ; void *arg1 = (void *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int arg5 ; int arg6 ; int result; arg1 = (void *)(farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); arg5 = (int)(*farg5); arg6 = (int)(*farg6); result = (int)CVodeResizeHistory(arg1,arg2,arg3,arg4,arg5,arg6); diff --git a/src/cvodes/cvodea.c b/src/cvodes/cvodea.c index 96e00e59f2..7291a109f2 100644 --- a/src/cvodes/cvodea.c +++ b/src/cvodes/cvodea.c @@ -726,7 +726,8 @@ int CVodeCreateB(void* cvode_mem, int lmmB, int* which) new_cvB_mem->cv_fQ = NULL; new_cvB_mem->cv_fQs = NULL; - new_cvB_mem->cv_user_data = NULL; + new_cvB_mem->cv_user_data = NULL; + new_cvB_mem->cv_own_user_data = SUNFALSE; new_cvB_mem->cv_lmem = NULL; new_cvB_mem->cv_lfree = NULL; diff --git a/src/cvodes/cvodea_io.c b/src/cvodes/cvodea_io.c index 1d23c5a42c..10bbf2e364 100644 --- a/src/cvodes/cvodea_io.c +++ b/src/cvodes/cvodea_io.c @@ -171,6 +171,92 @@ int CVodeSetUserDataB(void* cvode_mem, int which, void* user_dataB) return (CV_SUCCESS); } +int CVodeSetOwnUserDataB(void* cvode_mem, int which, sunbooleantype own_user_data) +{ + CVodeMem cv_mem; + CVadjMem ca_mem; + CVodeBMem cvB_mem; + + /* Check if cvode_mem exists */ + if (cvode_mem == NULL) + { + cvProcessError(NULL, CV_MEM_NULL, __LINE__, __func__, __FILE__, MSGCV_NO_MEM); + return (CV_MEM_NULL); + } + cv_mem = (CVodeMem)cvode_mem; + + /* Was ASA initialized? */ + if (cv_mem->cv_adjMallocDone == SUNFALSE) + { + cvProcessError(cv_mem, CV_NO_ADJ, __LINE__, __func__, __FILE__, MSGCV_NO_ADJ); + return (CV_NO_ADJ); + } + ca_mem = cv_mem->cv_adj_mem; + + /* Check which */ + if (which >= ca_mem->ca_nbckpbs) + { + cvProcessError(cv_mem, CV_ILL_INPUT, __LINE__, __func__, __FILE__, + MSGCV_BAD_WHICH); + return (CV_ILL_INPUT); + } + + /* Find the CVodeBMem entry in the linked list corresponding to which */ + cvB_mem = ca_mem->cvB_mem; + while (cvB_mem != NULL) + { + if (which == cvB_mem->cv_index) { break; } + cvB_mem = cvB_mem->cv_next; + } + + cvB_mem->cv_own_user_data = own_user_data; + + return (CV_SUCCESS); +} + +int CVodeGetUserDataB(void* cvode_mem, int which, void** user_dataB) +{ + CVodeMem cv_mem; + CVadjMem ca_mem; + CVodeBMem cvB_mem; + + /* Check if cvode_mem exists */ + if (cvode_mem == NULL) + { + cvProcessError(NULL, CV_MEM_NULL, __LINE__, __func__, __FILE__, MSGCV_NO_MEM); + return (CV_MEM_NULL); + } + cv_mem = (CVodeMem)cvode_mem; + + /* Was ASA initialized? */ + if (cv_mem->cv_adjMallocDone == SUNFALSE) + { + cvProcessError(cv_mem, CV_NO_ADJ, __LINE__, __func__, __FILE__, MSGCV_NO_ADJ); + return (CV_NO_ADJ); + } + ca_mem = cv_mem->cv_adj_mem; + + /* Check which */ + if (which >= ca_mem->ca_nbckpbs) + { + cvProcessError(cv_mem, CV_ILL_INPUT, __LINE__, __func__, __FILE__, + MSGCV_BAD_WHICH); + return (CV_ILL_INPUT); + } + + /* Find the CVodeBMem entry in the linked list corresponding to which */ + cvB_mem = ca_mem->cvB_mem; + while (cvB_mem != NULL) + { + if (which == cvB_mem->cv_index) { break; } + cvB_mem = cvB_mem->cv_next; + } + + *user_dataB = cvB_mem->cv_user_data; + + return (CV_SUCCESS); +} + int CVodeSetMaxOrdB(void* cvode_mem, int which, int maxordB) { CVodeMem cv_mem; diff --git a/src/cvodes/cvodes.c b/src/cvodes/cvodes.c index 2e4f559d18..c3de1eee7c 100644 --- a/src/cvodes/cvodes.c +++ b/src/cvodes/cvodes.c @@ -507,6 +507,7 @@ void* CVodeCreate(int lmm, SUNContext sunctx) /* Set default values for integrator optional inputs */ cv_mem->cv_f = NULL; cv_mem->cv_user_data = NULL; + cv_mem->cv_own_user_data = SUNFALSE; cv_mem->cv_itol = CV_NN; cv_mem->cv_atolmin0 = SUNTRUE; cv_mem->cv_user_efun = SUNFALSE; @@ -4453,6 +4454,8 @@ void CVodeFree(void** cvode_mem) if (cv_mem->proj_mem) { cvProjFree(&(cv_mem->proj_mem)); } + if (cv_mem->cv_own_user_data) { free(cv_mem->cv_user_data); } + free(*cvode_mem); *cvode_mem = NULL; } diff --git a/src/cvodes/cvodes_impl.h b/src/cvodes/cvodes_impl.h index 3b202aec63..f2429b300d 100644 --- a/src/cvodes/cvodes_impl.h +++ b/src/cvodes/cvodes_impl.h @@ -233,8 +233,9 @@ typedef struct CVodeMemRec CVRhsFn cv_f; /* y' = f(t,y(t)) */ void* cv_user_data; /* user pointer passed to f */ - int cv_lmm; /* lmm = CV_ADAMS or CV_BDF */ - int cv_itol; /* itol = CV_SS, CV_SV, CV_WF, CV_NN */ + sunbooleantype cv_own_user_data; /* SUNTRUE if we own user_data and should free it */ + int cv_lmm; /* lmm = CV_ADAMS or CV_BDF */ + int cv_itol; /* itol = CV_SS, CV_SV, CV_WF, CV_NN */ sunrealtype cv_reltol; /* relative tolerance */ sunrealtype cv_Sabstol; /* scalar absolute tolerance */ @@ -851,6 +852,7 @@ struct CVodeBMemRec /* User user_data */ void* cv_user_data; + sunbooleantype cv_own_user_data; /* Memory block for a linear solver's interface to CVODEA */ void* cv_lmem; @@ -1180,6 +1182,14 @@ int cvSensRhs1InternalDQ(int Ns, sunrealtype t, N_Vector y, N_Vector ydot, int is, N_Vector yS, N_Vector ySdot, void* fS_data, N_Vector tempv, N_Vector ftemp); +/* Utility functions to tell CVODE to free the user data. + This is used by the Python interfaces. */ + +int CVodeSetOwnUserData(void* cvode_mem, sunbooleantype own_user_data); + +int CVodeSetOwnUserDataB(void* cvode_mem, int which, + sunbooleantype own_user_data); + /* * ================================================================= * E R R O R M E S S A G E S diff --git a/src/cvodes/cvodes_io.c b/src/cvodes/cvodes_io.c index 7087ddd853..d6e9035fd8 100644 --- a/src/cvodes/cvodes_io.c +++ b/src/cvodes/cvodes_io.c @@ -81,6 +81,29 @@ int CVodeSetUserData(void* cvode_mem, void* user_data) return (CV_SUCCESS); } +/* + * CVodeSetOwnUserData + * + * Specifies whether the user data pointer is owned by CVODES. + */ + +int CVodeSetOwnUserData(void* cvode_mem, sunbooleantype own_user_data) +{ + CVodeMem cv_mem; + + if (cvode_mem == NULL) + { + cvProcessError(NULL, CV_MEM_NULL, __LINE__, __func__, __FILE__, MSGCV_NO_MEM); + return (CV_MEM_NULL); + } + + cv_mem = (CVodeMem)cvode_mem; + + cv_mem->cv_own_user_data = own_user_data; + + return (CV_SUCCESS); +} + /* * CVodeSetMonitorFn * diff --git a/src/cvodes/fmod_int32/fcvodes_mod.c b/src/cvodes/fmod_int32/fcvodes_mod.c index fe19fb2fcb..f219ee7e36 100644 --- a/src/cvodes/fmod_int32/fcvodes_mod.c +++ b/src/cvodes/fmod_int32/fcvodes_mod.c @@ -363,17 +363,17 @@ SWIGEXPORT int _wrap_FCVodeReInit(void *farg1, double const *farg2, N_Vector far SWIGEXPORT int _wrap_FCVodeResizeHistory(void *farg1, double *farg2, void *farg3, void *farg4, int const *farg5, int const *farg6) { int fresult ; void *arg1 = (void *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int arg5 ; int arg6 ; int result; arg1 = (void *)(farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); arg5 = (int)(*farg5); arg6 = (int)(*farg6); result = (int)CVodeResizeHistory(arg1,arg2,arg3,arg4,arg5,arg6); @@ -957,13 +957,13 @@ SWIGEXPORT int _wrap_FCVodeComputeState(void *farg1, N_Vector farg2, N_Vector fa SWIGEXPORT int _wrap_FCVodeComputeStateSens(void *farg1, void *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeComputeStateSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1179,11 +1179,11 @@ SWIGEXPORT int _wrap_FCVodeGetCurrentStep(void *farg1, double *farg2) { SWIGEXPORT int _wrap_FCVodeGetCurrentState(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)CVodeGetCurrentState(arg1,arg2); fresult = (int)(result); return fresult; @@ -1193,11 +1193,11 @@ SWIGEXPORT int _wrap_FCVodeGetCurrentState(void *farg1, void *farg2) { SWIGEXPORT int _wrap_FCVodeGetCurrentStateSens(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector **arg2 = (N_Vector **) 0 ; + N_Vector1d *arg2 = (N_Vector1d *) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector **)(farg2); + arg2 = (N_Vector1d *)(farg2); result = (int)CVodeGetCurrentStateSens(arg1,arg2); fresult = (int)(result); return fresult; @@ -1338,23 +1338,23 @@ SWIGEXPORT int _wrap_FCVodeGetNonlinearSystemData(void *farg1, double *farg2, vo int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; sunrealtype *arg6 = (sunrealtype *) 0 ; sunrealtype *arg7 = (sunrealtype *) 0 ; - N_Vector *arg8 = (N_Vector *) 0 ; + N_Vector1d arg8 = (N_Vector1d) 0 ; void **arg9 = (void **) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); - arg5 = (N_Vector *)(farg5); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); + arg5 = (N_Vector1d)(farg5); arg6 = (sunrealtype *)(farg6); arg7 = (sunrealtype *)(farg7); - arg8 = (N_Vector *)(farg8); + arg8 = (N_Vector1d)(farg8); arg9 = (void **)(farg9); result = (int)CVodeGetNonlinearSystemData(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); fresult = (int)(result); @@ -1366,21 +1366,21 @@ SWIGEXPORT int _wrap_FCVodeGetNonlinearSystemDataSens(void *farg1, double *farg2 int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector **arg3 = (N_Vector **) 0 ; - N_Vector **arg4 = (N_Vector **) 0 ; + N_Vector1d *arg3 = (N_Vector1d *) 0 ; + N_Vector1d *arg4 = (N_Vector1d *) 0 ; sunrealtype *arg5 = (sunrealtype *) 0 ; sunrealtype *arg6 = (sunrealtype *) 0 ; - N_Vector **arg7 = (N_Vector **) 0 ; + N_Vector1d *arg7 = (N_Vector1d *) 0 ; void **arg8 = (void **) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector **)(farg3); - arg4 = (N_Vector **)(farg4); + arg3 = (N_Vector1d *)(farg3); + arg4 = (N_Vector1d *)(farg4); arg5 = (sunrealtype *)(farg5); arg6 = (sunrealtype *)(farg6); - arg7 = (N_Vector **)(farg7); + arg7 = (N_Vector1d *)(farg7); arg8 = (void **)(farg8); result = (int)CVodeGetNonlinearSystemDataSens(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); fresult = (int)(result); @@ -1693,14 +1693,14 @@ SWIGEXPORT int _wrap_FCVodeSensInit(void *farg1, int const *farg2, int const *fa int arg2 ; int arg3 ; CVSensRhsFn arg4 = (CVSensRhsFn) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (CVSensRhsFn)(farg4); - arg5 = (N_Vector *)(farg5); + arg5 = (N_Vector1d)(farg5); result = (int)CVodeSensInit(arg1,arg2,arg3,arg4,arg5); fresult = (int)(result); return fresult; @@ -1713,14 +1713,14 @@ SWIGEXPORT int _wrap_FCVodeSensInit1(void *farg1, int const *farg2, int const *f int arg2 ; int arg3 ; CVSensRhs1Fn arg4 = (CVSensRhs1Fn) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (CVSensRhs1Fn)(farg4); - arg5 = (N_Vector *)(farg5); + arg5 = (N_Vector1d)(farg5); result = (int)CVodeSensInit1(arg1,arg2,arg3,arg4,arg5); fresult = (int)(result); return fresult; @@ -1731,12 +1731,12 @@ SWIGEXPORT int _wrap_FCVodeSensReInit(void *farg1, int const *farg2, void *farg3 int fresult ; void *arg1 = (void *) 0 ; int arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeSensReInit(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1747,12 +1747,12 @@ SWIGEXPORT int _wrap_FCVodeSensSStolerances(void *farg1, double const *farg2, do int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (sunrealtype *)(farg3); + arg3 = (sunrealtype1d)(farg3); result = (int)CVodeSensSStolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1763,12 +1763,12 @@ SWIGEXPORT int _wrap_FCVodeSensSVtolerances(void *farg1, double const *farg2, vo int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeSensSVtolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1834,15 +1834,15 @@ SWIGEXPORT int _wrap_FCVodeSetSensMaxNonlinIters(void *farg1, int const *farg2) SWIGEXPORT int _wrap_FCVodeSetSensParams(void *farg1, double *farg2, double *farg3, int *farg4) { int fresult ; void *arg1 = (void *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; - int *arg4 = (int *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; + int1d arg4 = (int1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (sunrealtype *)(farg3); - arg4 = (int *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (sunrealtype1d)(farg3); + arg4 = (int1d)(farg4); result = (int)CVodeSetSensParams(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -1907,12 +1907,12 @@ SWIGEXPORT int _wrap_FCVodeGetSens(void *farg1, double *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeGetSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1942,13 +1942,13 @@ SWIGEXPORT int _wrap_FCVodeGetSensDky(void *farg1, double const *farg2, int cons void *arg1 = (void *) 0 ; sunrealtype arg2 ; int arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (int)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); result = (int)CVodeGetSensDky(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -2034,11 +2034,11 @@ SWIGEXPORT int _wrap_FCVodeGetSensNumLinSolvSetups(void *farg1, long *farg2) { SWIGEXPORT int _wrap_FCVodeGetSensErrWeights(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)CVodeGetSensErrWeights(arg1,arg2); fresult = (int)(result); return fresult; @@ -2193,12 +2193,12 @@ SWIGEXPORT int _wrap_FCVodeQuadSensInit(void *farg1, CVQuadSensRhsFn farg2, void int fresult ; void *arg1 = (void *) 0 ; CVQuadSensRhsFn arg2 = (CVQuadSensRhsFn) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (CVQuadSensRhsFn)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeQuadSensInit(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2208,11 +2208,11 @@ SWIGEXPORT int _wrap_FCVodeQuadSensInit(void *farg1, CVQuadSensRhsFn farg2, void SWIGEXPORT int _wrap_FCVodeQuadSensReInit(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)CVodeQuadSensReInit(arg1,arg2); fresult = (int)(result); return fresult; @@ -2223,12 +2223,12 @@ SWIGEXPORT int _wrap_FCVodeQuadSensSStolerances(void *farg1, double const *farg2 int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (sunrealtype *)(farg3); + arg3 = (sunrealtype1d)(farg3); result = (int)CVodeQuadSensSStolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2239,12 +2239,12 @@ SWIGEXPORT int _wrap_FCVodeQuadSensSVtolerances(void *farg1, double const *farg2 int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeQuadSensSVtolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2281,12 +2281,12 @@ SWIGEXPORT int _wrap_FCVodeGetQuadSens(void *farg1, double *farg2, void *farg3) int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeGetQuadSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2316,13 +2316,13 @@ SWIGEXPORT int _wrap_FCVodeGetQuadSensDky(void *farg1, double const *farg2, int void *arg1 = (void *) 0 ; sunrealtype arg2 ; int arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (int)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); result = (int)CVodeGetQuadSensDky(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -2380,11 +2380,11 @@ SWIGEXPORT int _wrap_FCVodeGetQuadSensNumErrTestFails(void *farg1, long *farg2) SWIGEXPORT int _wrap_FCVodeGetQuadSensErrWeights(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)CVodeGetQuadSensErrWeights(arg1,arg2); fresult = (int)(result); return fresult; @@ -2895,6 +2895,22 @@ SWIGEXPORT int _wrap_FCVodeGetQuadB(void *farg1, int const *farg2, double *farg3 } +SWIGEXPORT int _wrap_FCVodeGetUserDataB(void *farg1, int const *farg2, void *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + void **arg3 = (void **) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + arg3 = (void **)(farg3); + result = (int)CVodeGetUserDataB(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void * _wrap_FCVodeGetAdjCVodeBmem(void *farg1, int const *farg2) { void * fresult ; void *arg1 = (void *) 0 ; diff --git a/src/cvodes/fmod_int32/fcvodes_mod.f90 b/src/cvodes/fmod_int32/fcvodes_mod.f90 index 6dfbe9bd7a..0ff13b5ee1 100644 --- a/src/cvodes/fmod_int32/fcvodes_mod.f90 +++ b/src/cvodes/fmod_int32/fcvodes_mod.f90 @@ -267,6 +267,7 @@ module fcvodes_mod public :: FCVodeSetNonlinearSolverB public :: FCVodeGetB public :: FCVodeGetQuadB + public :: FCVodeGetUserDataB public :: FCVodeGetAdjCVodeBmem public :: FCVodeGetAdjY @@ -2019,6 +2020,16 @@ function swigc_FCVodeGetQuadB(farg1, farg2, farg3, farg4) & integer(C_INT) :: fresult end function +function swigc_FCVodeGetUserDataB(farg1, farg2, farg3) & +bind(C, name="_wrap_FCVodeGetUserDataB") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FCVodeGetAdjCVodeBmem(farg1, farg2) & bind(C, name="_wrap_FCVodeGetAdjCVodeBmem") & result(fresult) @@ -5823,6 +5834,25 @@ function FCVodeGetQuadB(cvode_mem, which, tbret, qb) & swig_result = fresult end function +function FCVodeGetUserDataB(cvode_mem, which, user_datab) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: cvode_mem +integer(C_INT), intent(in) :: which +type(C_PTR), target, intent(inout) :: user_datab +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 +type(C_PTR) :: farg3 + +farg1 = cvode_mem +farg2 = which +farg3 = c_loc(user_datab) +fresult = swigc_FCVodeGetUserDataB(farg1, farg2, farg3) +swig_result = fresult +end function + function FCVodeGetAdjCVodeBmem(cvode_mem, which) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/cvodes/fmod_int64/fcvodes_mod.c b/src/cvodes/fmod_int64/fcvodes_mod.c index 9f76cd3e89..6954bfcace 100644 --- a/src/cvodes/fmod_int64/fcvodes_mod.c +++ b/src/cvodes/fmod_int64/fcvodes_mod.c @@ -363,17 +363,17 @@ SWIGEXPORT int _wrap_FCVodeReInit(void *farg1, double const *farg2, N_Vector far SWIGEXPORT int _wrap_FCVodeResizeHistory(void *farg1, double *farg2, void *farg3, void *farg4, int const *farg5, int const *farg6) { int fresult ; void *arg1 = (void *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int arg5 ; int arg6 ; int result; arg1 = (void *)(farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); arg5 = (int)(*farg5); arg6 = (int)(*farg6); result = (int)CVodeResizeHistory(arg1,arg2,arg3,arg4,arg5,arg6); @@ -957,13 +957,13 @@ SWIGEXPORT int _wrap_FCVodeComputeState(void *farg1, N_Vector farg2, N_Vector fa SWIGEXPORT int _wrap_FCVodeComputeStateSens(void *farg1, void *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeComputeStateSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1179,11 +1179,11 @@ SWIGEXPORT int _wrap_FCVodeGetCurrentStep(void *farg1, double *farg2) { SWIGEXPORT int _wrap_FCVodeGetCurrentState(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)CVodeGetCurrentState(arg1,arg2); fresult = (int)(result); return fresult; @@ -1193,11 +1193,11 @@ SWIGEXPORT int _wrap_FCVodeGetCurrentState(void *farg1, void *farg2) { SWIGEXPORT int _wrap_FCVodeGetCurrentStateSens(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector **arg2 = (N_Vector **) 0 ; + N_Vector1d *arg2 = (N_Vector1d *) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector **)(farg2); + arg2 = (N_Vector1d *)(farg2); result = (int)CVodeGetCurrentStateSens(arg1,arg2); fresult = (int)(result); return fresult; @@ -1338,23 +1338,23 @@ SWIGEXPORT int _wrap_FCVodeGetNonlinearSystemData(void *farg1, double *farg2, vo int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; sunrealtype *arg6 = (sunrealtype *) 0 ; sunrealtype *arg7 = (sunrealtype *) 0 ; - N_Vector *arg8 = (N_Vector *) 0 ; + N_Vector1d arg8 = (N_Vector1d) 0 ; void **arg9 = (void **) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); - arg5 = (N_Vector *)(farg5); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); + arg5 = (N_Vector1d)(farg5); arg6 = (sunrealtype *)(farg6); arg7 = (sunrealtype *)(farg7); - arg8 = (N_Vector *)(farg8); + arg8 = (N_Vector1d)(farg8); arg9 = (void **)(farg9); result = (int)CVodeGetNonlinearSystemData(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); fresult = (int)(result); @@ -1366,21 +1366,21 @@ SWIGEXPORT int _wrap_FCVodeGetNonlinearSystemDataSens(void *farg1, double *farg2 int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector **arg3 = (N_Vector **) 0 ; - N_Vector **arg4 = (N_Vector **) 0 ; + N_Vector1d *arg3 = (N_Vector1d *) 0 ; + N_Vector1d *arg4 = (N_Vector1d *) 0 ; sunrealtype *arg5 = (sunrealtype *) 0 ; sunrealtype *arg6 = (sunrealtype *) 0 ; - N_Vector **arg7 = (N_Vector **) 0 ; + N_Vector1d *arg7 = (N_Vector1d *) 0 ; void **arg8 = (void **) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector **)(farg3); - arg4 = (N_Vector **)(farg4); + arg3 = (N_Vector1d *)(farg3); + arg4 = (N_Vector1d *)(farg4); arg5 = (sunrealtype *)(farg5); arg6 = (sunrealtype *)(farg6); - arg7 = (N_Vector **)(farg7); + arg7 = (N_Vector1d *)(farg7); arg8 = (void **)(farg8); result = (int)CVodeGetNonlinearSystemDataSens(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); fresult = (int)(result); @@ -1693,14 +1693,14 @@ SWIGEXPORT int _wrap_FCVodeSensInit(void *farg1, int const *farg2, int const *fa int arg2 ; int arg3 ; CVSensRhsFn arg4 = (CVSensRhsFn) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (CVSensRhsFn)(farg4); - arg5 = (N_Vector *)(farg5); + arg5 = (N_Vector1d)(farg5); result = (int)CVodeSensInit(arg1,arg2,arg3,arg4,arg5); fresult = (int)(result); return fresult; @@ -1713,14 +1713,14 @@ SWIGEXPORT int _wrap_FCVodeSensInit1(void *farg1, int const *farg2, int const *f int arg2 ; int arg3 ; CVSensRhs1Fn arg4 = (CVSensRhs1Fn) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (CVSensRhs1Fn)(farg4); - arg5 = (N_Vector *)(farg5); + arg5 = (N_Vector1d)(farg5); result = (int)CVodeSensInit1(arg1,arg2,arg3,arg4,arg5); fresult = (int)(result); return fresult; @@ -1731,12 +1731,12 @@ SWIGEXPORT int _wrap_FCVodeSensReInit(void *farg1, int const *farg2, void *farg3 int fresult ; void *arg1 = (void *) 0 ; int arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeSensReInit(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1747,12 +1747,12 @@ SWIGEXPORT int _wrap_FCVodeSensSStolerances(void *farg1, double const *farg2, do int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (sunrealtype *)(farg3); + arg3 = (sunrealtype1d)(farg3); result = (int)CVodeSensSStolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1763,12 +1763,12 @@ SWIGEXPORT int _wrap_FCVodeSensSVtolerances(void *farg1, double const *farg2, vo int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeSensSVtolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1834,15 +1834,15 @@ SWIGEXPORT int _wrap_FCVodeSetSensMaxNonlinIters(void *farg1, int const *farg2) SWIGEXPORT int _wrap_FCVodeSetSensParams(void *farg1, double *farg2, double *farg3, int *farg4) { int fresult ; void *arg1 = (void *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; - int *arg4 = (int *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; + int1d arg4 = (int1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (sunrealtype *)(farg3); - arg4 = (int *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (sunrealtype1d)(farg3); + arg4 = (int1d)(farg4); result = (int)CVodeSetSensParams(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -1907,12 +1907,12 @@ SWIGEXPORT int _wrap_FCVodeGetSens(void *farg1, double *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeGetSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1942,13 +1942,13 @@ SWIGEXPORT int _wrap_FCVodeGetSensDky(void *farg1, double const *farg2, int cons void *arg1 = (void *) 0 ; sunrealtype arg2 ; int arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (int)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); result = (int)CVodeGetSensDky(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -2034,11 +2034,11 @@ SWIGEXPORT int _wrap_FCVodeGetSensNumLinSolvSetups(void *farg1, long *farg2) { SWIGEXPORT int _wrap_FCVodeGetSensErrWeights(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)CVodeGetSensErrWeights(arg1,arg2); fresult = (int)(result); return fresult; @@ -2193,12 +2193,12 @@ SWIGEXPORT int _wrap_FCVodeQuadSensInit(void *farg1, CVQuadSensRhsFn farg2, void int fresult ; void *arg1 = (void *) 0 ; CVQuadSensRhsFn arg2 = (CVQuadSensRhsFn) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (CVQuadSensRhsFn)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeQuadSensInit(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2208,11 +2208,11 @@ SWIGEXPORT int _wrap_FCVodeQuadSensInit(void *farg1, CVQuadSensRhsFn farg2, void SWIGEXPORT int _wrap_FCVodeQuadSensReInit(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)CVodeQuadSensReInit(arg1,arg2); fresult = (int)(result); return fresult; @@ -2223,12 +2223,12 @@ SWIGEXPORT int _wrap_FCVodeQuadSensSStolerances(void *farg1, double const *farg2 int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (sunrealtype *)(farg3); + arg3 = (sunrealtype1d)(farg3); result = (int)CVodeQuadSensSStolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2239,12 +2239,12 @@ SWIGEXPORT int _wrap_FCVodeQuadSensSVtolerances(void *farg1, double const *farg2 int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeQuadSensSVtolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2281,12 +2281,12 @@ SWIGEXPORT int _wrap_FCVodeGetQuadSens(void *farg1, double *farg2, void *farg3) int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)CVodeGetQuadSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2316,13 +2316,13 @@ SWIGEXPORT int _wrap_FCVodeGetQuadSensDky(void *farg1, double const *farg2, int void *arg1 = (void *) 0 ; sunrealtype arg2 ; int arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (int)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); result = (int)CVodeGetQuadSensDky(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -2380,11 +2380,11 @@ SWIGEXPORT int _wrap_FCVodeGetQuadSensNumErrTestFails(void *farg1, long *farg2) SWIGEXPORT int _wrap_FCVodeGetQuadSensErrWeights(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)CVodeGetQuadSensErrWeights(arg1,arg2); fresult = (int)(result); return fresult; @@ -2895,6 +2895,22 @@ SWIGEXPORT int _wrap_FCVodeGetQuadB(void *farg1, int const *farg2, double *farg3 } +SWIGEXPORT int _wrap_FCVodeGetUserDataB(void *farg1, int const *farg2, void *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + void **arg3 = (void **) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + arg3 = (void **)(farg3); + result = (int)CVodeGetUserDataB(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void * _wrap_FCVodeGetAdjCVodeBmem(void *farg1, int const *farg2) { void * fresult ; void *arg1 = (void *) 0 ; diff --git a/src/cvodes/fmod_int64/fcvodes_mod.f90 b/src/cvodes/fmod_int64/fcvodes_mod.f90 index 345d17dc55..7ba5ef3286 100644 --- a/src/cvodes/fmod_int64/fcvodes_mod.f90 +++ b/src/cvodes/fmod_int64/fcvodes_mod.f90 @@ -267,6 +267,7 @@ module fcvodes_mod public :: FCVodeSetNonlinearSolverB public :: FCVodeGetB public :: FCVodeGetQuadB + public :: FCVodeGetUserDataB public :: FCVodeGetAdjCVodeBmem public :: FCVodeGetAdjY @@ -2019,6 +2020,16 @@ function swigc_FCVodeGetQuadB(farg1, farg2, farg3, farg4) & integer(C_INT) :: fresult end function +function swigc_FCVodeGetUserDataB(farg1, farg2, farg3) & +bind(C, name="_wrap_FCVodeGetUserDataB") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FCVodeGetAdjCVodeBmem(farg1, farg2) & bind(C, name="_wrap_FCVodeGetAdjCVodeBmem") & result(fresult) @@ -5823,6 +5834,25 @@ function FCVodeGetQuadB(cvode_mem, which, tbret, qb) & swig_result = fresult end function +function FCVodeGetUserDataB(cvode_mem, which, user_datab) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: cvode_mem +integer(C_INT), intent(in) :: which +type(C_PTR), target, intent(inout) :: user_datab +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 +type(C_PTR) :: farg3 + +farg1 = cvode_mem +farg2 = which +farg3 = c_loc(user_datab) +fresult = swigc_FCVodeGetUserDataB(farg1, farg2, farg3) +swig_result = fresult +end function + function FCVodeGetAdjCVodeBmem(cvode_mem, which) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/ida/ida.c b/src/ida/ida.c index 364d4364ef..17cc9269e9 100644 --- a/src/ida/ida.c +++ b/src/ida/ida.c @@ -301,6 +301,7 @@ void* IDACreate(SUNContext sunctx) /* Set default values for integrator optional inputs */ IDA_mem->ida_res = NULL; IDA_mem->ida_user_data = NULL; + IDA_mem->ida_own_user_data = SUNFALSE; IDA_mem->ida_itol = IDA_NN; IDA_mem->ida_atolmin0 = SUNTRUE; IDA_mem->ida_user_efun = SUNFALSE; @@ -1718,6 +1719,8 @@ void IDAFree(void** ida_mem) IDA_mem->ida_gactive = NULL; } + if (IDA_mem->ida_own_user_data) { free(IDA_mem->ida_user_data); } + free(*ida_mem); *ida_mem = NULL; } diff --git a/src/ida/ida_impl.h b/src/ida/ida_impl.h index ead0816242..5496ef1739 100644 --- a/src/ida/ida_impl.h +++ b/src/ida/ida_impl.h @@ -94,8 +94,9 @@ typedef struct IDAMemRec Problem Specification Data --------------------------*/ - IDAResFn ida_res; /* F(t,y(t),y'(t))=0; the function F */ - void* ida_user_data; /* user pointer passed to res */ + IDAResFn ida_res; /* F(t,y(t),y'(t))=0; the function F */ + void* ida_user_data; /* user pointer passed to res */ + sunbooleantype ida_own_user_data; /* SUNTRUE if we own user_data and should free it */ int ida_itol; /* itol = IDA_SS, IDA_SV, IDA_WF, IDA_NN */ sunrealtype ida_rtol; /* relative tolerance */ @@ -446,6 +447,11 @@ sunrealtype IDAWrmsNorm(IDAMem IDA_mem, N_Vector x, N_Vector w, int idaNlsInit(IDAMem IDA_mem); +/* Utility function to tell IDA to free the user data. + This is used by the Python interfaces. */ + +int IDASetOwnUserData(void* ida_mem, sunbooleantype own_user_data); + /* * ================================================================= * E R R O R M E S S A G E S diff --git a/src/ida/ida_io.c b/src/ida/ida_io.c index 6a820126ce..04aa69f4ba 100644 --- a/src/ida/ida_io.c +++ b/src/ida/ida_io.c @@ -74,6 +74,25 @@ int IDASetUserData(void* ida_mem, void* user_data) /*-----------------------------------------------------------------*/ +int IDASetOwnUserData(void* ida_mem, sunbooleantype own_user_data) +{ + IDAMem IDA_mem; + + if (ida_mem == NULL) + { + IDAProcessError(NULL, IDA_MEM_NULL, __LINE__, __func__, __FILE__, MSG_NO_MEM); + return (IDA_MEM_NULL); + } + + IDA_mem = (IDAMem)ida_mem; + + IDA_mem->ida_own_user_data = own_user_data; + + return (IDA_SUCCESS); +} + +/*-----------------------------------------------------------------*/ + int IDASetEtaFixedStepBounds(void* ida_mem, sunrealtype eta_min_fx, sunrealtype eta_max_fx) { diff --git a/src/idas/fmod_int32/fidas_mod.c b/src/idas/fmod_int32/fidas_mod.c index c39dff4a1f..d7bc720a9e 100644 --- a/src/idas/fmod_int32/fidas_mod.c +++ b/src/idas/fmod_int32/fidas_mod.c @@ -955,13 +955,13 @@ SWIGEXPORT int _wrap_FIDAComputeYp(void *farg1, N_Vector farg2, N_Vector farg3) SWIGEXPORT int _wrap_FIDAComputeYSens(void *farg1, void *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); result = (int)IDAComputeYSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -971,13 +971,13 @@ SWIGEXPORT int _wrap_FIDAComputeYSens(void *farg1, void *farg2, void *farg3) { SWIGEXPORT int _wrap_FIDAComputeYpSens(void *farg1, void *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); result = (int)IDAComputeYpSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1163,11 +1163,11 @@ SWIGEXPORT int _wrap_FIDAGetCurrentY(void *farg1, void *farg2) { SWIGEXPORT int _wrap_FIDAGetCurrentYSens(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector **arg2 = (N_Vector **) 0 ; + N_Vector1d *arg2 = (N_Vector1d *) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector **)(farg2); + arg2 = (N_Vector1d *)(farg2); result = (int)IDAGetCurrentYSens(arg1,arg2); fresult = (int)(result); return fresult; @@ -1191,11 +1191,11 @@ SWIGEXPORT int _wrap_FIDAGetCurrentYp(void *farg1, void *farg2) { SWIGEXPORT int _wrap_FIDAGetCurrentYpSens(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector **arg2 = (N_Vector **) 0 ; + N_Vector1d *arg2 = (N_Vector1d *) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector **)(farg2); + arg2 = (N_Vector1d *)(farg2); result = (int)IDAGetCurrentYpSens(arg1,arg2); fresult = (int)(result); return fresult; @@ -1392,20 +1392,20 @@ SWIGEXPORT int _wrap_FIDAGetNonlinearSystemDataSens(void *farg1, double *farg2, int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector **arg3 = (N_Vector **) 0 ; - N_Vector **arg4 = (N_Vector **) 0 ; - N_Vector **arg5 = (N_Vector **) 0 ; - N_Vector **arg6 = (N_Vector **) 0 ; + N_Vector1d *arg3 = (N_Vector1d *) 0 ; + N_Vector1d *arg4 = (N_Vector1d *) 0 ; + N_Vector1d *arg5 = (N_Vector1d *) 0 ; + N_Vector1d *arg6 = (N_Vector1d *) 0 ; sunrealtype *arg7 = (sunrealtype *) 0 ; void **arg8 = (void **) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector **)(farg3); - arg4 = (N_Vector **)(farg4); - arg5 = (N_Vector **)(farg5); - arg6 = (N_Vector **)(farg6); + arg3 = (N_Vector1d *)(farg3); + arg4 = (N_Vector1d *)(farg4); + arg5 = (N_Vector1d *)(farg5); + arg6 = (N_Vector1d *)(farg6); arg7 = (sunrealtype *)(farg7); arg8 = (void **)(farg8); result = (int)IDAGetNonlinearSystemDataSens(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); @@ -1719,16 +1719,16 @@ SWIGEXPORT int _wrap_FIDASensInit(void *farg1, int const *farg2, int const *farg int arg2 ; int arg3 ; IDASensResFn arg4 = (IDASensResFn) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; - N_Vector *arg6 = (N_Vector *) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; + N_Vector1d arg6 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (IDASensResFn)(farg4); - arg5 = (N_Vector *)(farg5); - arg6 = (N_Vector *)(farg6); + arg5 = (N_Vector1d)(farg5); + arg6 = (N_Vector1d)(farg6); result = (int)IDASensInit(arg1,arg2,arg3,arg4,arg5,arg6); fresult = (int)(result); return fresult; @@ -1739,14 +1739,14 @@ SWIGEXPORT int _wrap_FIDASensReInit(void *farg1, int const *farg2, void *farg3, int fresult ; void *arg1 = (void *) 0 ; int arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); result = (int)IDASensReInit(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -1773,12 +1773,12 @@ SWIGEXPORT int _wrap_FIDASensSVtolerances(void *farg1, double const *farg2, void int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDASensSVtolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1800,13 +1800,13 @@ SWIGEXPORT int _wrap_FIDASensEEtolerances(void *farg1) { SWIGEXPORT int _wrap_FIDAGetSensConsistentIC(void *farg1, void *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); result = (int)IDAGetSensConsistentIC(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1860,15 +1860,15 @@ SWIGEXPORT int _wrap_FIDASetSensMaxNonlinIters(void *farg1, int const *farg2) { SWIGEXPORT int _wrap_FIDASetSensParams(void *farg1, double *farg2, double *farg3, int *farg4) { int fresult ; void *arg1 = (void *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; - int *arg4 = (int *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; + int1d arg4 = (int1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (sunrealtype *)(farg3); - arg4 = (int *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (sunrealtype1d)(farg3); + arg4 = (int1d)(farg4); result = (int)IDASetSensParams(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -1919,12 +1919,12 @@ SWIGEXPORT int _wrap_FIDAGetSens(void *farg1, double *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDAGetSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1954,13 +1954,13 @@ SWIGEXPORT int _wrap_FIDAGetSensDky(void *farg1, double const *farg2, int const void *arg1 = (void *) 0 ; sunrealtype arg2 ; int arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (int)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); result = (int)IDAGetSensDky(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -2046,11 +2046,11 @@ SWIGEXPORT int _wrap_FIDAGetSensNumLinSolvSetups(void *farg1, long *farg2) { SWIGEXPORT int _wrap_FIDAGetSensErrWeights(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector_S arg2 = (N_Vector_S) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector_S)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)IDAGetSensErrWeights(arg1,arg2); fresult = (int)(result); return fresult; @@ -2147,12 +2147,12 @@ SWIGEXPORT int _wrap_FIDAQuadSensInit(void *farg1, IDAQuadSensRhsFn farg2, void int fresult ; void *arg1 = (void *) 0 ; IDAQuadSensRhsFn arg2 = (IDAQuadSensRhsFn) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (IDAQuadSensRhsFn)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDAQuadSensInit(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2162,11 +2162,11 @@ SWIGEXPORT int _wrap_FIDAQuadSensInit(void *farg1, IDAQuadSensRhsFn farg2, void SWIGEXPORT int _wrap_FIDAQuadSensReInit(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)IDAQuadSensReInit(arg1,arg2); fresult = (int)(result); return fresult; @@ -2193,12 +2193,12 @@ SWIGEXPORT int _wrap_FIDAQuadSensSVtolerances(void *farg1, double const *farg2, int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDAQuadSensSVtolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2235,12 +2235,12 @@ SWIGEXPORT int _wrap_FIDAGetQuadSens(void *farg1, double *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDAGetQuadSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2270,13 +2270,13 @@ SWIGEXPORT int _wrap_FIDAGetQuadSensDky(void *farg1, double const *farg2, int co void *arg1 = (void *) 0 ; sunrealtype arg2 ; int arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (int)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); result = (int)IDAGetQuadSensDky(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -2334,11 +2334,11 @@ SWIGEXPORT int _wrap_FIDAGetQuadSensNumErrTestFails(void *farg1, long *farg2) { SWIGEXPORT int _wrap_FIDAGetQuadSensErrWeights(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)IDAGetQuadSensErrWeights(arg1,arg2); fresult = (int)(result); return fresult; @@ -2634,8 +2634,8 @@ SWIGEXPORT int _wrap_FIDACalcICBS(void *farg1, int const *farg2, double const *f sunrealtype arg3 ; N_Vector arg4 = (N_Vector) 0 ; N_Vector arg5 = (N_Vector) 0 ; - N_Vector *arg6 = (N_Vector *) 0 ; - N_Vector *arg7 = (N_Vector *) 0 ; + N_Vector1d arg6 = (N_Vector1d) 0 ; + N_Vector1d arg7 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); @@ -2643,8 +2643,8 @@ SWIGEXPORT int _wrap_FIDACalcICBS(void *farg1, int const *farg2, double const *f arg3 = (sunrealtype)(*farg3); arg4 = (N_Vector)(farg4); arg5 = (N_Vector)(farg5); - arg6 = (N_Vector *)(farg6); - arg7 = (N_Vector *)(farg7); + arg6 = (N_Vector1d)(farg6); + arg7 = (N_Vector1d)(farg7); result = (int)IDACalcICBS(arg1,arg2,arg3,arg4,arg5,arg6,arg7); fresult = (int)(result); return fresult; @@ -2901,6 +2901,22 @@ SWIGEXPORT int _wrap_FIDAGetQuadB(void *farg1, int const *farg2, double *farg3, } +SWIGEXPORT int _wrap_FIDAGetUserDataB(void *farg1, int const *farg2, void *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + void **arg3 = (void **) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + arg3 = (void **)(farg3); + result = (int)IDAGetUserDataB(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void * _wrap_FIDAGetAdjIDABmem(void *farg1, int const *farg2) { void * fresult ; void *arg1 = (void *) 0 ; diff --git a/src/idas/fmod_int32/fidas_mod.f90 b/src/idas/fmod_int32/fidas_mod.f90 index db6f376bfc..1184a5a7be 100644 --- a/src/idas/fmod_int32/fidas_mod.f90 +++ b/src/idas/fmod_int32/fidas_mod.f90 @@ -258,6 +258,7 @@ module fidas_mod public :: FIDASetNonlinearSolverB public :: FIDAGetB public :: FIDAGetQuadB + public :: FIDAGetUserDataB public :: FIDAGetAdjIDABmem public :: FIDAGetConsistentICB public :: FIDAGetAdjY @@ -1991,6 +1992,16 @@ function swigc_FIDAGetQuadB(farg1, farg2, farg3, farg4) & integer(C_INT) :: fresult end function +function swigc_FIDAGetUserDataB(farg1, farg2, farg3) & +bind(C, name="_wrap_FIDAGetUserDataB") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FIDAGetAdjIDABmem(farg1, farg2) & bind(C, name="_wrap_FIDAGetAdjIDABmem") & result(fresult) @@ -5693,6 +5704,25 @@ function FIDAGetQuadB(ida_mem, which, tret, qb) & swig_result = fresult end function +function FIDAGetUserDataB(ida_mem, which, user_data) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: ida_mem +integer(C_INT), intent(in) :: which +type(C_PTR), target, intent(inout) :: user_data +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 +type(C_PTR) :: farg3 + +farg1 = ida_mem +farg2 = which +farg3 = c_loc(user_data) +fresult = swigc_FIDAGetUserDataB(farg1, farg2, farg3) +swig_result = fresult +end function + function FIDAGetAdjIDABmem(ida_mem, which) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/idas/fmod_int64/fidas_mod.c b/src/idas/fmod_int64/fidas_mod.c index 196fd9f52b..a26e2b86bb 100644 --- a/src/idas/fmod_int64/fidas_mod.c +++ b/src/idas/fmod_int64/fidas_mod.c @@ -955,13 +955,13 @@ SWIGEXPORT int _wrap_FIDAComputeYp(void *farg1, N_Vector farg2, N_Vector farg3) SWIGEXPORT int _wrap_FIDAComputeYSens(void *farg1, void *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); result = (int)IDAComputeYSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -971,13 +971,13 @@ SWIGEXPORT int _wrap_FIDAComputeYSens(void *farg1, void *farg2, void *farg3) { SWIGEXPORT int _wrap_FIDAComputeYpSens(void *farg1, void *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); result = (int)IDAComputeYpSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1163,11 +1163,11 @@ SWIGEXPORT int _wrap_FIDAGetCurrentY(void *farg1, void *farg2) { SWIGEXPORT int _wrap_FIDAGetCurrentYSens(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector **arg2 = (N_Vector **) 0 ; + N_Vector1d *arg2 = (N_Vector1d *) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector **)(farg2); + arg2 = (N_Vector1d *)(farg2); result = (int)IDAGetCurrentYSens(arg1,arg2); fresult = (int)(result); return fresult; @@ -1191,11 +1191,11 @@ SWIGEXPORT int _wrap_FIDAGetCurrentYp(void *farg1, void *farg2) { SWIGEXPORT int _wrap_FIDAGetCurrentYpSens(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector **arg2 = (N_Vector **) 0 ; + N_Vector1d *arg2 = (N_Vector1d *) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector **)(farg2); + arg2 = (N_Vector1d *)(farg2); result = (int)IDAGetCurrentYpSens(arg1,arg2); fresult = (int)(result); return fresult; @@ -1392,20 +1392,20 @@ SWIGEXPORT int _wrap_FIDAGetNonlinearSystemDataSens(void *farg1, double *farg2, int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector **arg3 = (N_Vector **) 0 ; - N_Vector **arg4 = (N_Vector **) 0 ; - N_Vector **arg5 = (N_Vector **) 0 ; - N_Vector **arg6 = (N_Vector **) 0 ; + N_Vector1d *arg3 = (N_Vector1d *) 0 ; + N_Vector1d *arg4 = (N_Vector1d *) 0 ; + N_Vector1d *arg5 = (N_Vector1d *) 0 ; + N_Vector1d *arg6 = (N_Vector1d *) 0 ; sunrealtype *arg7 = (sunrealtype *) 0 ; void **arg8 = (void **) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector **)(farg3); - arg4 = (N_Vector **)(farg4); - arg5 = (N_Vector **)(farg5); - arg6 = (N_Vector **)(farg6); + arg3 = (N_Vector1d *)(farg3); + arg4 = (N_Vector1d *)(farg4); + arg5 = (N_Vector1d *)(farg5); + arg6 = (N_Vector1d *)(farg6); arg7 = (sunrealtype *)(farg7); arg8 = (void **)(farg8); result = (int)IDAGetNonlinearSystemDataSens(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); @@ -1719,16 +1719,16 @@ SWIGEXPORT int _wrap_FIDASensInit(void *farg1, int const *farg2, int const *farg int arg2 ; int arg3 ; IDASensResFn arg4 = (IDASensResFn) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; - N_Vector *arg6 = (N_Vector *) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; + N_Vector1d arg6 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); arg3 = (int)(*farg3); arg4 = (IDASensResFn)(farg4); - arg5 = (N_Vector *)(farg5); - arg6 = (N_Vector *)(farg6); + arg5 = (N_Vector1d)(farg5); + arg6 = (N_Vector1d)(farg6); result = (int)IDASensInit(arg1,arg2,arg3,arg4,arg5,arg6); fresult = (int)(result); return fresult; @@ -1739,14 +1739,14 @@ SWIGEXPORT int _wrap_FIDASensReInit(void *farg1, int const *farg2, void *farg3, int fresult ; void *arg1 = (void *) 0 ; int arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (int)(*farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); result = (int)IDASensReInit(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -1773,12 +1773,12 @@ SWIGEXPORT int _wrap_FIDASensSVtolerances(void *farg1, double const *farg2, void int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDASensSVtolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1800,13 +1800,13 @@ SWIGEXPORT int _wrap_FIDASensEEtolerances(void *farg1) { SWIGEXPORT int _wrap_FIDAGetSensConsistentIC(void *farg1, void *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); result = (int)IDAGetSensConsistentIC(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1860,15 +1860,15 @@ SWIGEXPORT int _wrap_FIDASetSensMaxNonlinIters(void *farg1, int const *farg2) { SWIGEXPORT int _wrap_FIDASetSensParams(void *farg1, double *farg2, double *farg3, int *farg4) { int fresult ; void *arg1 = (void *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; - int *arg4 = (int *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; + int1d arg4 = (int1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (sunrealtype *)(farg3); - arg4 = (int *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (sunrealtype1d)(farg3); + arg4 = (int1d)(farg4); result = (int)IDASetSensParams(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -1919,12 +1919,12 @@ SWIGEXPORT int _wrap_FIDAGetSens(void *farg1, double *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDAGetSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -1954,13 +1954,13 @@ SWIGEXPORT int _wrap_FIDAGetSensDky(void *farg1, double const *farg2, int const void *arg1 = (void *) 0 ; sunrealtype arg2 ; int arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (int)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); result = (int)IDAGetSensDky(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -2046,11 +2046,11 @@ SWIGEXPORT int _wrap_FIDAGetSensNumLinSolvSetups(void *farg1, long *farg2) { SWIGEXPORT int _wrap_FIDAGetSensErrWeights(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector_S arg2 = (N_Vector_S) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector_S)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)IDAGetSensErrWeights(arg1,arg2); fresult = (int)(result); return fresult; @@ -2147,12 +2147,12 @@ SWIGEXPORT int _wrap_FIDAQuadSensInit(void *farg1, IDAQuadSensRhsFn farg2, void int fresult ; void *arg1 = (void *) 0 ; IDAQuadSensRhsFn arg2 = (IDAQuadSensRhsFn) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (IDAQuadSensRhsFn)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDAQuadSensInit(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2162,11 +2162,11 @@ SWIGEXPORT int _wrap_FIDAQuadSensInit(void *farg1, IDAQuadSensRhsFn farg2, void SWIGEXPORT int _wrap_FIDAQuadSensReInit(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)IDAQuadSensReInit(arg1,arg2); fresult = (int)(result); return fresult; @@ -2193,12 +2193,12 @@ SWIGEXPORT int _wrap_FIDAQuadSensSVtolerances(void *farg1, double const *farg2, int fresult ; void *arg1 = (void *) 0 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDAQuadSensSVtolerances(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2235,12 +2235,12 @@ SWIGEXPORT int _wrap_FIDAGetQuadSens(void *farg1, double *farg2, void *farg3) { int fresult ; void *arg1 = (void *) 0 ; sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (int)IDAGetQuadSens(arg1,arg2,arg3); fresult = (int)(result); return fresult; @@ -2270,13 +2270,13 @@ SWIGEXPORT int _wrap_FIDAGetQuadSensDky(void *farg1, double const *farg2, int co void *arg1 = (void *) 0 ; sunrealtype arg2 ; int arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (int)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); result = (int)IDAGetQuadSensDky(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -2334,11 +2334,11 @@ SWIGEXPORT int _wrap_FIDAGetQuadSensNumErrTestFails(void *farg1, long *farg2) { SWIGEXPORT int _wrap_FIDAGetQuadSensErrWeights(void *farg1, void *farg2) { int fresult ; void *arg1 = (void *) 0 ; - N_Vector *arg2 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); - arg2 = (N_Vector *)(farg2); + arg2 = (N_Vector1d)(farg2); result = (int)IDAGetQuadSensErrWeights(arg1,arg2); fresult = (int)(result); return fresult; @@ -2634,8 +2634,8 @@ SWIGEXPORT int _wrap_FIDACalcICBS(void *farg1, int const *farg2, double const *f sunrealtype arg3 ; N_Vector arg4 = (N_Vector) 0 ; N_Vector arg5 = (N_Vector) 0 ; - N_Vector *arg6 = (N_Vector *) 0 ; - N_Vector *arg7 = (N_Vector *) 0 ; + N_Vector1d arg6 = (N_Vector1d) 0 ; + N_Vector1d arg7 = (N_Vector1d) 0 ; int result; arg1 = (void *)(farg1); @@ -2643,8 +2643,8 @@ SWIGEXPORT int _wrap_FIDACalcICBS(void *farg1, int const *farg2, double const *f arg3 = (sunrealtype)(*farg3); arg4 = (N_Vector)(farg4); arg5 = (N_Vector)(farg5); - arg6 = (N_Vector *)(farg6); - arg7 = (N_Vector *)(farg7); + arg6 = (N_Vector1d)(farg6); + arg7 = (N_Vector1d)(farg7); result = (int)IDACalcICBS(arg1,arg2,arg3,arg4,arg5,arg6,arg7); fresult = (int)(result); return fresult; @@ -2901,6 +2901,22 @@ SWIGEXPORT int _wrap_FIDAGetQuadB(void *farg1, int const *farg2, double *farg3, } +SWIGEXPORT int _wrap_FIDAGetUserDataB(void *farg1, int const *farg2, void *farg3) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + void **arg3 = (void **) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + arg3 = (void **)(farg3); + result = (int)IDAGetUserDataB(arg1,arg2,arg3); + fresult = (int)(result); + return fresult; +} + + SWIGEXPORT void * _wrap_FIDAGetAdjIDABmem(void *farg1, int const *farg2) { void * fresult ; void *arg1 = (void *) 0 ; diff --git a/src/idas/fmod_int64/fidas_mod.f90 b/src/idas/fmod_int64/fidas_mod.f90 index b379e13d36..7f56044910 100644 --- a/src/idas/fmod_int64/fidas_mod.f90 +++ b/src/idas/fmod_int64/fidas_mod.f90 @@ -258,6 +258,7 @@ module fidas_mod public :: FIDASetNonlinearSolverB public :: FIDAGetB public :: FIDAGetQuadB + public :: FIDAGetUserDataB public :: FIDAGetAdjIDABmem public :: FIDAGetConsistentICB public :: FIDAGetAdjY @@ -1991,6 +1992,16 @@ function swigc_FIDAGetQuadB(farg1, farg2, farg3, farg4) & integer(C_INT) :: fresult end function +function swigc_FIDAGetUserDataB(farg1, farg2, farg3) & +bind(C, name="_wrap_FIDAGetUserDataB") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FIDAGetAdjIDABmem(farg1, farg2) & bind(C, name="_wrap_FIDAGetAdjIDABmem") & result(fresult) @@ -5693,6 +5704,25 @@ function FIDAGetQuadB(ida_mem, which, tret, qb) & swig_result = fresult end function +function FIDAGetUserDataB(ida_mem, which, user_data) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: ida_mem +integer(C_INT), intent(in) :: which +type(C_PTR), target, intent(inout) :: user_data +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 +type(C_PTR) :: farg3 + +farg1 = ida_mem +farg2 = which +farg3 = c_loc(user_data) +fresult = swigc_FIDAGetUserDataB(farg1, farg2, farg3) +swig_result = fresult +end function + function FIDAGetAdjIDABmem(ida_mem, which) & result(swig_result) use, intrinsic :: ISO_C_BINDING diff --git a/src/idas/idaa_io.c b/src/idas/idaa_io.c index 29e17f652a..4f4a956f40 100644 --- a/src/idas/idaa_io.c +++ b/src/idas/idaa_io.c @@ -726,6 +726,53 @@ int IDAGetConsistentICB(void* ida_mem, int which, N_Vector yyB0_mod, return (flag); } +/*-----------------------------------------------------------------*/ + +int IDAGetUserDataB(void* ida_mem, int which, void** user_dataB) +{ + IDAMem IDA_mem; + IDAadjMem IDAa_mem; + IDABMem IDAB_mem; + + /* Check if IDA_mem exists */ + if (ida_mem == NULL) + { + IDAProcessError(NULL, IDA_MEM_NULL, __LINE__, __func__, __FILE__, + MSGAM_NULL_IDAMEM); + return (IDA_MEM_NULL); + } + IDA_mem = (IDAMem)ida_mem; + + /* Was ASA initialized? */ + if (IDA_mem->ida_adjMallocDone == SUNFALSE) + { + IDAProcessError(IDA_mem, IDA_NO_ADJ, __LINE__, __func__, __FILE__, + MSGAM_NO_ADJ); + return (IDA_NO_ADJ); + } + IDAa_mem = IDA_mem->ida_adj_mem; + + /* Check which */ + if (which >= IDAa_mem->ia_nbckpbs) + { + IDAProcessError(IDA_mem, IDA_ILL_INPUT, __LINE__, __func__, __FILE__, + MSGAM_BAD_WHICH); + return (IDA_ILL_INPUT); + } + + /* Find the IDABMem entry in the linked list corresponding to which */ + IDAB_mem = IDAa_mem->IDAB_mem; + while (IDAB_mem != NULL) + { + if (which == IDAB_mem->ida_index) { break; } + IDAB_mem = IDAB_mem->ida_next; + } + + *user_dataB = IDAB_mem->ida_user_data; + + return (IDA_SUCCESS); +} + /* * ----------------------------------------------------------------- * Undocumented development user-callable functions diff --git a/src/idas/idas.c b/src/idas/idas.c index ebfab1d8f1..fb7fb8601a 100644 --- a/src/idas/idas.c +++ b/src/idas/idas.c @@ -430,6 +430,7 @@ void* IDACreate(SUNContext sunctx) /* Set default values for integrator optional inputs */ IDA_mem->ida_res = NULL; IDA_mem->ida_user_data = NULL; + IDA_mem->ida_own_user_data = SUNFALSE; IDA_mem->ida_itol = IDA_NN; IDA_mem->ida_atolmin0 = SUNTRUE; IDA_mem->ida_user_efun = SUNFALSE; @@ -4094,6 +4095,8 @@ void IDAFree(void** ida_mem) free(IDA_mem->ida_Zvecs); IDA_mem->ida_Zvecs = NULL; + if (IDA_mem->ida_own_user_data) { free(IDA_mem->ida_user_data); } + free(*ida_mem); *ida_mem = NULL; } diff --git a/src/idas/idas_impl.h b/src/idas/idas_impl.h index 656bd9070b..f15ff0b2ee 100644 --- a/src/idas/idas_impl.h +++ b/src/idas/idas_impl.h @@ -104,8 +104,9 @@ typedef struct IDAMemRec Problem Specification Data --------------------------*/ - IDAResFn ida_res; /* F(t,y(t),y'(t))=0; the function F */ - void* ida_user_data; /* user pointer passed to res */ + IDAResFn ida_res; /* F(t,y(t),y'(t))=0; the function F */ + void* ida_user_data; /* user pointer passed to res */ + sunbooleantype ida_own_user_data; /* SUNTRUE if we own user_data and should free it */ int ida_itol; /* itol = IDA_SS, IDA_SV, IDA_WF, IDA_NN */ sunrealtype ida_rtol; /* relative tolerance */ @@ -974,6 +975,11 @@ int IDASensResDQ(int Ns, sunrealtype t, N_Vector yy, N_Vector yp, N_Vector* resvalS, void* user_dataS, N_Vector ytemp, N_Vector yptemp, N_Vector restemp); +/* Utility function to tell IDA to free the user data. + This is used by the Python interfaces. */ + +int IDASetOwnUserData(void* ida_mem, sunbooleantype own_user_data); + /* * ================================================================= * E R R O R M E S S A G E S diff --git a/src/idas/idas_io.c b/src/idas/idas_io.c index e297762256..c8a930ece8 100644 --- a/src/idas/idas_io.c +++ b/src/idas/idas_io.c @@ -73,6 +73,25 @@ int IDASetUserData(void* ida_mem, void* user_data) /*-----------------------------------------------------------------*/ +int IDASetOwnUserData(void* ida_mem, sunbooleantype own_user_data) +{ + IDAMem IDA_mem; + + if (ida_mem == NULL) + { + IDAProcessError(NULL, IDA_MEM_NULL, __LINE__, __func__, __FILE__, MSG_NO_MEM); + return (IDA_MEM_NULL); + } + + IDA_mem = (IDAMem)ida_mem; + + IDA_mem->ida_own_user_data = own_user_data; + + return (IDA_SUCCESS); +} + +/*-----------------------------------------------------------------*/ + int IDASetEtaFixedStepBounds(void* ida_mem, sunrealtype eta_min_fx, sunrealtype eta_max_fx) { diff --git a/src/kinsol/kinsol.c b/src/kinsol/kinsol.c index b64e02ce56..0d2d00083c 100644 --- a/src/kinsol/kinsol.c +++ b/src/kinsol/kinsol.c @@ -244,6 +244,7 @@ void* KINCreate(SUNContext sunctx) kin_mem->kin_func = NULL; kin_mem->kin_user_data = NULL; + kin_mem->kin_own_user_data = SUNFALSE; kin_mem->kin_uu = NULL; kin_mem->kin_unew = NULL; kin_mem->kin_fval = NULL; @@ -793,6 +794,8 @@ void KINFree(void** kinmem) /* free orthogonalization workspace */ KINFreeOrth(kin_mem); + if (kin_mem->kin_own_user_data) { free(kin_mem->kin_user_data); } + free(*kinmem); *kinmem = NULL; } diff --git a/src/kinsol/kinsol_impl.h b/src/kinsol/kinsol_impl.h index ad4a292d32..17a105b438 100644 --- a/src/kinsol/kinsol_impl.h +++ b/src/kinsol/kinsol_impl.h @@ -76,9 +76,10 @@ typedef struct KINMemRec /* problem specification data */ - KINSysFn kin_func; /* nonlinear system function implementation */ - void* kin_user_data; /* work space available to func routine */ - sunrealtype kin_fnormtol; /* stopping tolerance on L2-norm of function + KINSysFn kin_func; /* nonlinear system function implementation */ + void* kin_user_data; /* work space available to func routine */ + sunbooleantype kin_own_user_data; /* SUNTRUE if we own user_data and should free it */ + sunrealtype kin_fnormtol; /* stopping tolerance on L2-norm of function value */ sunrealtype kin_scsteptol; /* scaled step length tolerance */ int kin_globalstrategy; /* choices are KIN_NONE, KIN_LINESEARCH @@ -396,6 +397,10 @@ void KINFreeAA(KINMem kin_mem); int KINInitOrth(KINMem kin_mem); void KINFreeOrth(KINMem kin_mem); +/* Utility function to tell KINSOL to free the user data. + This is used by the Python interfaces. */ +int KINSetOwnUserData(void* kinmem, sunbooleantype own_user_data); + /* * ================================================================= * K I N S O L E R R O R M E S S A G E S diff --git a/src/kinsol/kinsol_io.c b/src/kinsol/kinsol_io.c index 3457a9d3b7..f0a87ee016 100644 --- a/src/kinsol/kinsol_io.c +++ b/src/kinsol/kinsol_io.c @@ -62,6 +62,28 @@ int KINSetUserData(void* kinmem, void* user_data) return (KIN_SUCCESS); } +/* + * ----------------------------------------------------------------- + * Function : KINSetOwnUserData + * ----------------------------------------------------------------- + */ + +int KINSetOwnUserData(void* kinmem, sunbooleantype own_user_data) +{ + KINMem kin_mem; + + if (kinmem == NULL) + { + KINProcessError(NULL, KIN_MEM_NULL, __LINE__, __func__, __FILE__, MSG_NO_MEM); + return (KIN_MEM_NULL); + } + + kin_mem = (KINMem)kinmem; + kin_mem->kin_own_user_data = own_user_data; + + return (KIN_SUCCESS); +} + /* * ----------------------------------------------------------------- * Function : KINSetDamping diff --git a/src/sundials/CMakeLists.txt b/src/sundials/CMakeLists.txt index b7899d66b5..590378bc10 100644 --- a/src/sundials/CMakeLists.txt +++ b/src/sundials/CMakeLists.txt @@ -22,8 +22,11 @@ install(CODE "MESSAGE(\"\nInstall shared components\n\")") # Add variable sundials_HEADERS with the exported SUNDIALS header files set(sundials_HEADERS sundials_adaptcontroller.h + sundials_adaptcontroller.hpp sundials_adjointcheckpointscheme.h + sundials_adjointcheckpointscheme.hpp sundials_adjointstepper.h + sundials_adjointstepper.hpp sundials_band.h sundials_base.hpp sundials_context.h @@ -34,12 +37,14 @@ set(sundials_HEADERS sundials_dense.h sundials_direct.h sundials_domeigestimator.h + sundials_domeigestimator.hpp sundials_errors.h sundials_futils.h sundials_iterative.h sundials_linearsolver.h sundials_linearsolver.hpp sundials_logger.h + sundials_logger.hpp sundials_math.h sundials_matrix.h sundials_matrix.hpp diff --git a/src/sundials/fmod_int32/fsundials_core_mod.c b/src/sundials/fmod_int32/fsundials_core_mod.c index 991e20ba54..6e35234e76 100644 --- a/src/sundials/fmod_int32/fsundials_core_mod.c +++ b/src/sundials/fmod_int32/fsundials_core_mod.c @@ -802,6 +802,22 @@ SWIGEXPORT int _wrap_FSUNLogger_Destroy(void *farg1) { } +SWIGEXPORT int _wrap_FSUNFileOpen(SwigArrayWrapper *farg1, SwigArrayWrapper *farg2, void *farg3) { + int fresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + FILE **arg3 = (FILE **) 0 ; + SUNErrCode result; + + arg1 = (char *)(farg1->data); + arg2 = (char *)(farg2->data); + arg3 = (FILE **)(farg3); + result = (SUNErrCode)SUNFileOpen((char const *)arg1,(char const *)arg2,arg3); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDIALSFileOpen(SwigArrayWrapper *farg1, SwigArrayWrapper *farg2, void *farg3) { int fresult ; char *arg1 = (char *) 0 ; @@ -818,6 +834,18 @@ SWIGEXPORT int _wrap_FSUNDIALSFileOpen(SwigArrayWrapper *farg1, SwigArrayWrapper } +SWIGEXPORT int _wrap_FSUNFileClose(void *farg1) { + int fresult ; + FILE **arg1 = (FILE **) 0 ; + SUNErrCode result; + + arg1 = (FILE **)(farg1); + result = (SUNErrCode)SUNFileClose(arg1); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDIALSFileClose(void *farg1) { int fresult ; FILE **arg1 = (FILE **) 0 ; @@ -921,10 +949,10 @@ SWIGEXPORT void _wrap_FN_VSpace(N_Vector farg1, int32_t *farg2, int32_t *farg3) SWIGEXPORT void _wrap_FN_VSetArrayPointer(double *farg1, N_Vector farg2) { - sunrealtype *arg1 = (sunrealtype *) 0 ; + sunrealtype1d arg1 = (sunrealtype1d) 0 ; N_Vector arg2 = (N_Vector) 0 ; - arg1 = (sunrealtype *)(farg1); + arg1 = (sunrealtype1d)(farg1); arg2 = (N_Vector)(farg2); N_VSetArrayPointer(arg1,arg2); } @@ -1223,14 +1251,14 @@ SWIGEXPORT double _wrap_FN_VMinQuotient(N_Vector farg1, N_Vector farg2) { SWIGEXPORT int _wrap_FN_VLinearCombination(int const *farg1, double *farg2, void *farg3, N_Vector farg4) { int fresult ; int arg1 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; N_Vector arg4 = (N_Vector) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (sunrealtype1d)(farg2); + arg3 = (N_Vector1d)(farg3); arg4 = (N_Vector)(farg4); result = (SUNErrCode)N_VLinearCombination(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); @@ -1241,17 +1269,17 @@ SWIGEXPORT int _wrap_FN_VLinearCombination(int const *farg1, double *farg2, void SWIGEXPORT int _wrap_FN_VScaleAddMulti(int const *farg1, double *farg2, N_Vector farg3, void *farg4, void *farg5) { int fresult ; int arg1 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); - arg4 = (N_Vector *)(farg4); - arg5 = (N_Vector *)(farg5); + arg4 = (N_Vector1d)(farg4); + arg5 = (N_Vector1d)(farg5); result = (SUNErrCode)N_VScaleAddMulti(arg1,arg2,arg3,arg4,arg5); fresult = (SUNErrCode)(result); return fresult; @@ -1262,14 +1290,14 @@ SWIGEXPORT int _wrap_FN_VDotProdMulti(int const *farg1, N_Vector farg2, void *fa int fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (sunrealtype *)(farg4); + arg3 = (N_Vector1d)(farg3); + arg4 = (sunrealtype1d)(farg4); result = (SUNErrCode)N_VDotProdMulti(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); return fresult; @@ -1280,18 +1308,18 @@ SWIGEXPORT int _wrap_FN_VLinearSumVectorArray(int const *farg1, double const *fa int fresult ; int arg1 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; sunrealtype arg4 ; - N_Vector *arg5 = (N_Vector *) 0 ; - N_Vector *arg6 = (N_Vector *) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; + N_Vector1d arg6 = (N_Vector1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); arg4 = (sunrealtype)(*farg4); - arg5 = (N_Vector *)(farg5); - arg6 = (N_Vector *)(farg6); + arg5 = (N_Vector1d)(farg5); + arg6 = (N_Vector1d)(farg6); result = (SUNErrCode)N_VLinearSumVectorArray(arg1,arg2,arg3,arg4,arg5,arg6); fresult = (SUNErrCode)(result); return fresult; @@ -1301,15 +1329,15 @@ SWIGEXPORT int _wrap_FN_VLinearSumVectorArray(int const *farg1, double const *fa SWIGEXPORT int _wrap_FN_VScaleVectorArray(int const *farg1, double *farg2, void *farg3, void *farg4) { int fresult ; int arg1 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); result = (SUNErrCode)N_VScaleVectorArray(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); return fresult; @@ -1320,12 +1348,12 @@ SWIGEXPORT int _wrap_FN_VConstVectorArray(int const *farg1, double const *farg2, int fresult ; int arg1 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (SUNErrCode)N_VConstVectorArray(arg1,arg2,arg3); fresult = (SUNErrCode)(result); return fresult; @@ -1335,15 +1363,15 @@ SWIGEXPORT int _wrap_FN_VConstVectorArray(int const *farg1, double const *farg2, SWIGEXPORT int _wrap_FN_VWrmsNormVectorArray(int const *farg1, void *farg2, void *farg3, double *farg4) { int fresult ; int arg1 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (sunrealtype *)(farg4); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); + arg4 = (sunrealtype1d)(farg4); result = (SUNErrCode)N_VWrmsNormVectorArray(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); return fresult; @@ -1353,17 +1381,17 @@ SWIGEXPORT int _wrap_FN_VWrmsNormVectorArray(int const *farg1, void *farg2, void SWIGEXPORT int _wrap_FN_VWrmsNormMaskVectorArray(int const *farg1, void *farg2, void *farg3, N_Vector farg4, double *farg5) { int fresult ; int arg1 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; N_Vector arg4 = (N_Vector) 0 ; - sunrealtype *arg5 = (sunrealtype *) 0 ; + sunrealtype1d arg5 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); arg4 = (N_Vector)(farg4); - arg5 = (sunrealtype *)(farg5); + arg5 = (sunrealtype1d)(farg5); result = (SUNErrCode)N_VWrmsNormMaskVectorArray(arg1,arg2,arg3,arg4,arg5); fresult = (SUNErrCode)(result); return fresult; @@ -1498,14 +1526,14 @@ SWIGEXPORT int _wrap_FN_VDotProdMultiLocal(int const *farg1, N_Vector farg2, voi int fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (sunrealtype *)(farg4); + arg3 = (N_Vector1d)(farg3); + arg4 = (sunrealtype1d)(farg4); result = (SUNErrCode)N_VDotProdMultiLocal(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); return fresult; @@ -1516,12 +1544,12 @@ SWIGEXPORT int _wrap_FN_VDotProdMultiAllReduce(int const *farg1, N_Vector farg2, int fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - arg3 = (sunrealtype *)(farg3); + arg3 = (sunrealtype1d)(farg3); result = (SUNErrCode)N_VDotProdMultiAllReduce(arg1,arg2,arg3); fresult = (SUNErrCode)(result); return fresult; @@ -1574,11 +1602,11 @@ SWIGEXPORT void * _wrap_FN_VNewVectorArray(int const *farg1, void *farg2) { void * fresult ; int arg1 ; SUNContext arg2 = (SUNContext) 0 ; - N_Vector *result = 0 ; + N_Vector1d result; arg1 = (int)(*farg1); arg2 = (SUNContext)(farg2); - result = (N_Vector *)N_VNewVectorArray(arg1,arg2); + result = (N_Vector1d)N_VNewVectorArray(arg1,arg2); fresult = result; return fresult; } @@ -1588,11 +1616,11 @@ SWIGEXPORT void * _wrap_FN_VCloneEmptyVectorArray(int const *farg1, N_Vector far void * fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - N_Vector *result = 0 ; + N_Vector1d result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - result = (N_Vector *)N_VCloneEmptyVectorArray(arg1,arg2); + result = (N_Vector1d)N_VCloneEmptyVectorArray(arg1,arg2); fresult = result; return fresult; } @@ -1602,21 +1630,21 @@ SWIGEXPORT void * _wrap_FN_VCloneVectorArray(int const *farg1, N_Vector farg2) { void * fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - N_Vector *result = 0 ; + N_Vector1d result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - result = (N_Vector *)N_VCloneVectorArray(arg1,arg2); + result = (N_Vector1d)N_VCloneVectorArray(arg1,arg2); fresult = result; return fresult; } SWIGEXPORT void _wrap_FN_VDestroyVectorArray(void *farg1, int const *farg2) { - N_Vector *arg1 = (N_Vector *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; int arg2 ; - arg1 = (N_Vector *)(farg1); + arg1 = (N_Vector1d)(farg1); arg2 = (int)(*farg2); N_VDestroyVectorArray(arg1,arg2); } @@ -1624,11 +1652,11 @@ SWIGEXPORT void _wrap_FN_VDestroyVectorArray(void *farg1, int const *farg2) { SWIGEXPORT N_Vector _wrap_FN_VGetVecAtIndexVectorArray(void *farg1, int const *farg2) { N_Vector fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; int arg2 ; N_Vector result; - arg1 = (N_Vector *)(farg1); + arg1 = (N_Vector1d)(farg1); arg2 = (int)(*farg2); result = (N_Vector)N_VGetVecAtIndexVectorArray(arg1,arg2); fresult = result; @@ -1637,11 +1665,11 @@ SWIGEXPORT N_Vector _wrap_FN_VGetVecAtIndexVectorArray(void *farg1, int const *f SWIGEXPORT void _wrap_FN_VSetVecAtIndexVectorArray(void *farg1, int const *farg2, N_Vector farg3) { - N_Vector *arg1 = (N_Vector *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; int arg2 ; N_Vector arg3 = (N_Vector) 0 ; - arg1 = (N_Vector *)(farg1); + arg1 = (N_Vector1d)(farg1); arg2 = (int)(*farg2); arg3 = (N_Vector)(farg3); N_VSetVecAtIndexVectorArray(arg1,arg2,arg3); @@ -1872,15 +1900,15 @@ SWIGEXPORT int _wrap_FSUNMatSpace(SUNMatrix farg1, long *farg2, long *farg3) { SWIGEXPORT int _wrap_FSUNModifiedGS(void *farg1, void *farg2, int const *farg3, int const *farg4, double *farg5) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; int arg3 ; int arg4 ; sunrealtype *arg5 = (sunrealtype *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype **)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype2d)(farg2); arg3 = (int)(*farg3); arg4 = (int)(*farg4); arg5 = (sunrealtype *)(farg5); @@ -1892,22 +1920,22 @@ SWIGEXPORT int _wrap_FSUNModifiedGS(void *farg1, void *farg2, int const *farg3, SWIGEXPORT int _wrap_FSUNClassicalGS(void *farg1, void *farg2, int const *farg3, int const *farg4, double *farg5, double *farg6, void *farg7) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; int arg3 ; int arg4 ; sunrealtype *arg5 = (sunrealtype *) 0 ; - sunrealtype *arg6 = (sunrealtype *) 0 ; - N_Vector *arg7 = (N_Vector *) 0 ; + sunrealtype1d arg6 = (sunrealtype1d) 0 ; + N_Vector1d arg7 = (N_Vector1d) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype **)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype2d)(farg2); arg3 = (int)(*farg3); arg4 = (int)(*farg4); arg5 = (sunrealtype *)(farg5); - arg6 = (sunrealtype *)(farg6); - arg7 = (N_Vector *)(farg7); + arg6 = (sunrealtype1d)(farg6); + arg7 = (N_Vector1d)(farg7); result = (SUNErrCode)SUNClassicalGS(arg1,arg2,arg3,arg4,arg5,arg6,arg7); fresult = (SUNErrCode)(result); return fresult; @@ -1917,14 +1945,14 @@ SWIGEXPORT int _wrap_FSUNClassicalGS(void *farg1, void *farg2, int const *farg3, SWIGEXPORT int _wrap_FSUNQRfact(int const *farg1, void *farg2, double *farg3, int const *farg4) { int fresult ; int arg1 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; int arg4 ; int result; arg1 = (int)(*farg1); - arg2 = (sunrealtype **)(farg2); - arg3 = (sunrealtype *)(farg3); + arg2 = (sunrealtype2d)(farg2); + arg3 = (sunrealtype1d)(farg3); arg4 = (int)(*farg4); result = (int)SUNQRfact(arg1,arg2,arg3,arg4); fresult = (int)(result); @@ -1935,15 +1963,15 @@ SWIGEXPORT int _wrap_FSUNQRfact(int const *farg1, void *farg2, double *farg3, in SWIGEXPORT int _wrap_FSUNQRsol(int const *farg1, void *farg2, double *farg3, double *farg4) { int fresult ; int arg1 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; int result; arg1 = (int)(*farg1); - arg2 = (sunrealtype **)(farg2); - arg3 = (sunrealtype *)(farg3); - arg4 = (sunrealtype *)(farg4); + arg2 = (sunrealtype2d)(farg2); + arg3 = (sunrealtype1d)(farg3); + arg4 = (sunrealtype1d)(farg4); result = (int)SUNQRsol(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -1952,16 +1980,16 @@ SWIGEXPORT int _wrap_FSUNQRsol(int const *farg1, void *farg2, double *farg3, dou SWIGEXPORT int _wrap_FSUNQRAdd_MGS(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -1974,16 +2002,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_MGS(void *farg1, double *farg2, N_Vector farg3, i SWIGEXPORT int _wrap_FSUNQRAdd_ICWY(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -1996,16 +2024,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_ICWY(void *farg1, double *farg2, N_Vector farg3, SWIGEXPORT int _wrap_FSUNQRAdd_ICWY_SB(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -2018,16 +2046,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_ICWY_SB(void *farg1, double *farg2, N_Vector farg SWIGEXPORT int _wrap_FSUNQRAdd_CGS2(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -2040,16 +2068,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_CGS2(void *farg1, double *farg2, N_Vector farg3, SWIGEXPORT int _wrap_FSUNQRAdd_DCGS2(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -2062,16 +2090,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_DCGS2(void *farg1, double *farg2, N_Vector farg3, SWIGEXPORT int _wrap_FSUNQRAdd_DCGS2_SB(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -2877,14 +2905,14 @@ SWIGEXPORT int _wrap_FSUNStepper_SetForcing(void *farg1, double const *farg2, do SUNStepper arg1 = (SUNStepper) 0 ; sunrealtype arg2 ; sunrealtype arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int arg5 ; SUNErrCode result; arg1 = (SUNStepper)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (sunrealtype)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); arg5 = (int)(*farg5); result = (SUNErrCode)SUNStepper_SetForcing(arg1,arg2,arg3,arg4,arg5); fresult = (SUNErrCode)(result); diff --git a/src/sundials/fmod_int32/fsundials_core_mod.f90 b/src/sundials/fmod_int32/fsundials_core_mod.f90 index 0c360c7ae3..0d3e71f894 100644 --- a/src/sundials/fmod_int32/fsundials_core_mod.f90 +++ b/src/sundials/fmod_int32/fsundials_core_mod.f90 @@ -49,19 +49,20 @@ module fsundials_core_mod integer(C_INT), parameter, public :: SUNFALSE = 0_C_INT integer(C_INT), parameter, public :: SUNTRUE = 1_C_INT - ! typedef enum SUNOutputFormat + ! enum SUNOutputFormat enum, bind(c) enumerator :: SUN_OUTPUTFORMAT_TABLE enumerator :: SUN_OUTPUTFORMAT_CSV end enum integer, parameter, public :: SUNOutputFormat = kind(SUN_OUTPUTFORMAT_TABLE) public :: SUN_OUTPUTFORMAT_TABLE, SUN_OUTPUTFORMAT_CSV - ! typedef enum SUNDataIOMode + ! enum SUNDataIOMode enum, bind(c) enumerator :: SUNDATAIOMODE_INMEM end enum integer, parameter, public :: SUNDataIOMode = kind(SUNDATAIOMODE_INMEM) public :: SUNDATAIOMODE_INMEM + ! enum SUNErrCode_ enum, bind(c) enumerator :: SUN_ERR_MINIMUM = -10000 enumerator :: SUN_ERR_ARG_CORRUPT @@ -97,6 +98,7 @@ module fsundials_core_mod enumerator :: SUN_ERR_MAXIMUM = -1000 enumerator :: SUN_SUCCESS = 0 end enum + integer, parameter, public :: SUNErrCode_ = kind(SUN_ERR_MINIMUM) public :: SUN_ERR_MINIMUM, SUN_ERR_ARG_CORRUPT, SUN_ERR_ARG_INCOMPATIBLE, SUN_ERR_ARG_OUTOFRANGE, SUN_ERR_ARG_WRONGTYPE, & SUN_ERR_ARG_DIMSMISMATCH, SUN_ERR_GENERIC, SUN_ERR_CORRUPT, SUN_ERR_OUTOFRANGE, SUN_ERR_FILE_OPEN, SUN_ERR_OP_FAIL, & SUN_ERR_MEM_FAIL, SUN_ERR_MALLOC_FAIL, SUN_ERR_EXT_FAIL, SUN_ERR_DESTROY_FAIL, SUN_ERR_NOT_IMPLEMENTED, & @@ -130,7 +132,7 @@ module fsundials_core_mod public :: FSUNProfiler_GetElapsedTime public :: FSUNProfiler_Print public :: FSUNProfiler_Reset - ! typedef enum SUNLogLevel + ! enum SUNLogLevel enum, bind(c) enumerator :: SUN_LOGLEVEL_ALL = -1 enumerator :: SUN_LOGLEVEL_NONE = 0 @@ -152,9 +154,11 @@ module fsundials_core_mod public :: FSUNLogger_Flush public :: FSUNLogger_GetOutputRank public :: FSUNLogger_Destroy + public :: FSUNFileOpen public :: FSUNDIALSFileOpen + public :: FSUNFileClose public :: FSUNDIALSFileClose - ! typedef enum N_Vector_ID + ! enum N_Vector_ID enum, bind(c) enumerator :: SUNDIALS_NVEC_SERIAL enumerator :: SUNDIALS_NVEC_PARALLEL @@ -309,7 +313,7 @@ module fsundials_core_mod public :: FN_VGetArrayPointer public :: FN_VGetDeviceArrayPointer - ! typedef enum SUNMatrix_ID + ! enum SUNMatrix_ID enum, bind(c) enumerator :: SUNMATRIX_DENSE enumerator :: SUNMATRIX_MAGMADENSE @@ -359,17 +363,21 @@ module fsundials_core_mod public :: FSUNMatMatvec public :: FSUNMatHermitianTransposeVec public :: FSUNMatSpace + ! enum SUN_PREC_ID enum, bind(c) enumerator :: SUN_PREC_NONE enumerator :: SUN_PREC_LEFT enumerator :: SUN_PREC_RIGHT enumerator :: SUN_PREC_BOTH end enum + integer, parameter, public :: SUN_PREC_ID = kind(SUN_PREC_NONE) public :: SUN_PREC_NONE, SUN_PREC_LEFT, SUN_PREC_RIGHT, SUN_PREC_BOTH + ! enum SUN_GRAMSCHMIDT_ID enum, bind(c) enumerator :: SUN_MODIFIED_GS = 1 enumerator :: SUN_CLASSICAL_GS = 2 end enum + integer, parameter, public :: SUN_GRAMSCHMIDT_ID = kind(SUN_MODIFIED_GS) public :: SUN_MODIFIED_GS, SUN_CLASSICAL_GS public :: FSUNModifiedGS public :: FSUNClassicalGS @@ -381,7 +389,7 @@ module fsundials_core_mod public :: FSUNQRAdd_CGS2 public :: FSUNQRAdd_DCGS2 public :: FSUNQRAdd_DCGS2_SB - ! typedef enum SUNLinearSolver_Type + ! enum SUNLinearSolver_Type enum, bind(c) enumerator :: SUNLINEARSOLVER_DIRECT enumerator :: SUNLINEARSOLVER_ITERATIVE @@ -391,7 +399,7 @@ module fsundials_core_mod integer, parameter, public :: SUNLinearSolver_Type = kind(SUNLINEARSOLVER_DIRECT) public :: SUNLINEARSOLVER_DIRECT, SUNLINEARSOLVER_ITERATIVE, SUNLINEARSOLVER_MATRIX_ITERATIVE, & SUNLINEARSOLVER_MATRIX_EMBEDDED - ! typedef enum SUNLinearSolver_ID + ! enum SUNLinearSolver_ID enum, bind(c) enumerator :: SUNLINEARSOLVER_BAND enumerator :: SUNLINEARSOLVER_DENSE @@ -440,6 +448,7 @@ module fsundials_core_mod ! struct struct _generic_SUNLinearSolver type, bind(C), public :: SUNLinearSolver type(C_PTR), public :: content + type(C_PTR), public :: python type(C_PTR), public :: ops type(C_PTR), public :: sunctx end type SUNLinearSolver @@ -476,7 +485,7 @@ module fsundials_core_mod integer(C_INT), parameter, public :: SUNLS_PACKAGE_FAIL_REC = 806_C_INT integer(C_INT), parameter, public :: SUNLS_QRFACT_FAIL = 807_C_INT integer(C_INT), parameter, public :: SUNLS_LUFACT_FAIL = 808_C_INT - ! typedef enum SUNNonlinearSolver_Type + ! enum SUNNonlinearSolver_Type enum, bind(c) enumerator :: SUNNONLINEARSOLVER_ROOTFIND enumerator :: SUNNONLINEARSOLVER_FIXEDPOINT @@ -503,6 +512,7 @@ module fsundials_core_mod ! struct struct _generic_SUNNonlinearSolver type, bind(C), public :: SUNNonlinearSolver type(C_PTR), public :: content + type(C_PTR), public :: python type(C_PTR), public :: ops type(C_PTR), public :: sunctx end type SUNNonlinearSolver @@ -523,7 +533,7 @@ module fsundials_core_mod public :: FSUNNonlinSolGetNumConvFails integer(C_INT), parameter, public :: SUN_NLS_CONTINUE = +901_C_INT integer(C_INT), parameter, public :: SUN_NLS_CONV_RECVR = +902_C_INT - ! typedef enum SUNAdaptController_Type + ! enum SUNAdaptController_Type enum, bind(c) enumerator :: SUN_ADAPTCONTROLLER_NONE enumerator :: SUN_ADAPTCONTROLLER_H @@ -565,7 +575,7 @@ module fsundials_core_mod public :: FSUNAdaptController_UpdateH public :: FSUNAdaptController_UpdateMRIHTol public :: FSUNAdaptController_Space - ! typedef enum SUNFullRhsMode + ! enum SUNFullRhsMode enum, bind(c) enumerator :: SUN_FULLRHS_START enumerator :: SUN_FULLRHS_END @@ -600,7 +610,7 @@ module fsundials_core_mod public :: FSUNStepper_SetForcingFn public :: FSUNStepper_SetGetNumStepsFn public :: FSUNStepper_SetDestroyFn - ! typedef enum SUNMemoryType + ! enum SUNMemoryType enum, bind(c) enumerator :: SUNMEMTYPE_HOST enumerator :: SUNMEMTYPE_PINNED @@ -684,6 +694,7 @@ module fsundials_core_mod ! struct struct SUNDomEigEstimator_ type, bind(C), public :: SUNDomEigEstimator type(C_PTR), public :: content + type(C_PTR), public :: python type(C_PTR), public :: ops type(C_PTR), public :: sunctx end type SUNDomEigEstimator @@ -1013,6 +1024,17 @@ function swigc_FSUNLogger_Destroy(farg1) & integer(C_INT) :: fresult end function +function swigc_FSUNFileOpen(farg1, farg2, farg3) & +bind(C, name="_wrap_FSUNFileOpen") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +type(SwigArrayWrapper) :: farg1 +type(SwigArrayWrapper) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FSUNDIALSFileOpen(farg1, farg2, farg3) & bind(C, name="_wrap_FSUNDIALSFileOpen") & result(fresult) @@ -1024,6 +1046,14 @@ function swigc_FSUNDIALSFileOpen(farg1, farg2, farg3) & integer(C_INT) :: fresult end function +function swigc_FSUNFileClose(farg1) & +bind(C, name="_wrap_FSUNFileClose") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT) :: fresult +end function + function swigc_FSUNDIALSFileClose(farg1) & bind(C, name="_wrap_FSUNDIALSFileClose") & result(fresult) @@ -3578,6 +3608,27 @@ function FSUNLogger_Destroy(logger) & swig_result = fresult end function +function FSUNFileOpen(filename, modes, fp) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +character(kind=C_CHAR, len=*), target :: filename +character(kind=C_CHAR), dimension(:), allocatable, target :: farg1_chars +character(kind=C_CHAR, len=*), target :: modes +character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars +type(C_PTR), target, intent(inout) :: fp +integer(C_INT) :: fresult +type(SwigArrayWrapper) :: farg1 +type(SwigArrayWrapper) :: farg2 +type(C_PTR) :: farg3 + +call SWIG_string_to_chararray(filename, farg1_chars, farg1) +call SWIG_string_to_chararray(modes, farg2_chars, farg2) +farg3 = c_loc(fp) +fresult = swigc_FSUNFileOpen(farg1, farg2, farg3) +swig_result = fresult +end function + function FSUNDIALSFileOpen(filename, modes, fp) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -3599,6 +3650,19 @@ function FSUNDIALSFileOpen(filename, modes, fp) & swig_result = fresult end function +function FSUNFileClose(fp) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR), target, intent(inout) :: fp +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = c_loc(fp) +fresult = swigc_FSUNFileClose(farg1) +swig_result = fresult +end function + function FSUNDIALSFileClose(fp) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -4053,13 +4117,13 @@ function FN_VMinQuotient(num, denom) & swig_result = fresult end function -function FN_VLinearCombination(nvec, c, x, z) & +function FN_VLinearCombination(nvec, c_arr, x_arr, z) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec -real(C_DOUBLE), dimension(*), target, intent(inout) :: c -type(C_PTR) :: x +real(C_DOUBLE), dimension(*), target, intent(inout) :: c_arr +type(C_PTR) :: x_arr type(N_Vector), target, intent(inout) :: z integer(C_INT) :: fresult integer(C_INT) :: farg1 @@ -4068,22 +4132,22 @@ function FN_VLinearCombination(nvec, c, x, z) & type(C_PTR) :: farg4 farg1 = nvec -farg2 = c_loc(c(1)) -farg3 = x +farg2 = c_loc(c_arr(1)) +farg3 = x_arr farg4 = c_loc(z) fresult = swigc_FN_VLinearCombination(farg1, farg2, farg3, farg4) swig_result = fresult end function -function FN_VScaleAddMulti(nvec, a, x, y, z) & +function FN_VScaleAddMulti(nvec, a, x, y_arr, z_arr) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec real(C_DOUBLE), dimension(*), target, intent(inout) :: a type(N_Vector), target, intent(inout) :: x -type(C_PTR) :: y -type(C_PTR) :: z +type(C_PTR) :: y_arr +type(C_PTR) :: z_arr integer(C_INT) :: fresult integer(C_INT) :: farg1 type(C_PTR) :: farg2 @@ -4094,19 +4158,19 @@ function FN_VScaleAddMulti(nvec, a, x, y, z) & farg1 = nvec farg2 = c_loc(a(1)) farg3 = c_loc(x) -farg4 = y -farg5 = z +farg4 = y_arr +farg5 = z_arr fresult = swigc_FN_VScaleAddMulti(farg1, farg2, farg3, farg4, farg5) swig_result = fresult end function -function FN_VDotProdMulti(nvec, x, y, dotprods) & +function FN_VDotProdMulti(nvec, x, y_arr, dotprods) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec type(N_Vector), target, intent(inout) :: x -type(C_PTR) :: y +type(C_PTR) :: y_arr real(C_DOUBLE), dimension(*), target, intent(inout) :: dotprods integer(C_INT) :: fresult integer(C_INT) :: farg1 @@ -4116,22 +4180,22 @@ function FN_VDotProdMulti(nvec, x, y, dotprods) & farg1 = nvec farg2 = c_loc(x) -farg3 = y +farg3 = y_arr farg4 = c_loc(dotprods(1)) fresult = swigc_FN_VDotProdMulti(farg1, farg2, farg3, farg4) swig_result = fresult end function -function FN_VLinearSumVectorArray(nvec, a, x, b, y, z) & +function FN_VLinearSumVectorArray(nvec, a, x_arr, b, y_arr, z_arr) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec real(C_DOUBLE), intent(in) :: a -type(C_PTR) :: x +type(C_PTR) :: x_arr real(C_DOUBLE), intent(in) :: b -type(C_PTR) :: y -type(C_PTR) :: z +type(C_PTR) :: y_arr +type(C_PTR) :: z_arr integer(C_INT) :: fresult integer(C_INT) :: farg1 real(C_DOUBLE) :: farg2 @@ -4142,22 +4206,22 @@ function FN_VLinearSumVectorArray(nvec, a, x, b, y, z) & farg1 = nvec farg2 = a -farg3 = x +farg3 = x_arr farg4 = b -farg5 = y -farg6 = z +farg5 = y_arr +farg6 = z_arr fresult = swigc_FN_VLinearSumVectorArray(farg1, farg2, farg3, farg4, farg5, farg6) swig_result = fresult end function -function FN_VScaleVectorArray(nvec, c, x, z) & +function FN_VScaleVectorArray(nvec, c, x_arr, z_arr) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec real(C_DOUBLE), dimension(*), target, intent(inout) :: c -type(C_PTR) :: x -type(C_PTR) :: z +type(C_PTR) :: x_arr +type(C_PTR) :: z_arr integer(C_INT) :: fresult integer(C_INT) :: farg1 type(C_PTR) :: farg2 @@ -4166,19 +4230,19 @@ function FN_VScaleVectorArray(nvec, c, x, z) & farg1 = nvec farg2 = c_loc(c(1)) -farg3 = x -farg4 = z +farg3 = x_arr +farg4 = z_arr fresult = swigc_FN_VScaleVectorArray(farg1, farg2, farg3, farg4) swig_result = fresult end function -function FN_VConstVectorArray(nvec, c, z) & +function FN_VConstVectorArray(nvec, c, z_arr) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec real(C_DOUBLE), intent(in) :: c -type(C_PTR) :: z +type(C_PTR) :: z_arr integer(C_INT) :: fresult integer(C_INT) :: farg1 real(C_DOUBLE) :: farg2 @@ -4186,18 +4250,18 @@ function FN_VConstVectorArray(nvec, c, z) & farg1 = nvec farg2 = c -farg3 = z +farg3 = z_arr fresult = swigc_FN_VConstVectorArray(farg1, farg2, farg3) swig_result = fresult end function -function FN_VWrmsNormVectorArray(nvec, x, w, nrm) & +function FN_VWrmsNormVectorArray(nvec, x_arr, w_arr, nrm) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec -type(C_PTR) :: x -type(C_PTR) :: w +type(C_PTR) :: x_arr +type(C_PTR) :: w_arr real(C_DOUBLE), dimension(*), target, intent(inout) :: nrm integer(C_INT) :: fresult integer(C_INT) :: farg1 @@ -4206,20 +4270,20 @@ function FN_VWrmsNormVectorArray(nvec, x, w, nrm) & type(C_PTR) :: farg4 farg1 = nvec -farg2 = x -farg3 = w +farg2 = x_arr +farg3 = w_arr farg4 = c_loc(nrm(1)) fresult = swigc_FN_VWrmsNormVectorArray(farg1, farg2, farg3, farg4) swig_result = fresult end function -function FN_VWrmsNormMaskVectorArray(nvec, x, w, id, nrm) & +function FN_VWrmsNormMaskVectorArray(nvec, x_arr, w_arr, id, nrm) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec -type(C_PTR) :: x -type(C_PTR) :: w +type(C_PTR) :: x_arr +type(C_PTR) :: w_arr type(N_Vector), target, intent(inout) :: id real(C_DOUBLE), dimension(*), target, intent(inout) :: nrm integer(C_INT) :: fresult @@ -4230,8 +4294,8 @@ function FN_VWrmsNormMaskVectorArray(nvec, x, w, id, nrm) & type(C_PTR) :: farg5 farg1 = nvec -farg2 = x -farg3 = w +farg2 = x_arr +farg3 = w_arr farg4 = c_loc(id) farg5 = c_loc(nrm(1)) fresult = swigc_FN_VWrmsNormMaskVectorArray(farg1, farg2, farg3, farg4, farg5) @@ -4379,13 +4443,13 @@ function FN_VMinQuotientLocal(num, denom) & swig_result = fresult end function -function FN_VDotProdMultiLocal(nvec, x, y, dotprods) & +function FN_VDotProdMultiLocal(nvec, x, y_arr, dotprods) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec type(N_Vector), target, intent(inout) :: x -type(C_PTR) :: y +type(C_PTR) :: y_arr real(C_DOUBLE), dimension(*), target, intent(inout) :: dotprods integer(C_INT) :: fresult integer(C_INT) :: farg1 @@ -4395,7 +4459,7 @@ function FN_VDotProdMultiLocal(nvec, x, y, dotprods) & farg1 = nvec farg2 = c_loc(x) -farg3 = y +farg3 = y_arr farg4 = c_loc(dotprods(1)) fresult = swigc_FN_VDotProdMultiLocal(farg1, farg2, farg3, farg4) swig_result = fresult @@ -4516,44 +4580,44 @@ function FN_VCloneVectorArray(count, w) & swig_result = fresult end function -subroutine FN_VDestroyVectorArray(vs, count) +subroutine FN_VDestroyVectorArray(vs_arr, count) use, intrinsic :: ISO_C_BINDING -type(C_PTR) :: vs +type(C_PTR) :: vs_arr integer(C_INT), intent(in) :: count type(C_PTR) :: farg1 integer(C_INT) :: farg2 -farg1 = vs +farg1 = vs_arr farg2 = count call swigc_FN_VDestroyVectorArray(farg1, farg2) end subroutine -function FN_VGetVecAtIndexVectorArray(vs, index) & +function FN_VGetVecAtIndexVectorArray(vs_arr, index) & result(swig_result) use, intrinsic :: ISO_C_BINDING type(N_Vector), pointer :: swig_result -type(C_PTR) :: vs +type(C_PTR) :: vs_arr integer(C_INT), intent(in) :: index type(C_PTR) :: fresult type(C_PTR) :: farg1 integer(C_INT) :: farg2 -farg1 = vs +farg1 = vs_arr farg2 = index fresult = swigc_FN_VGetVecAtIndexVectorArray(farg1, farg2) call c_f_pointer(fresult, swig_result) end function -subroutine FN_VSetVecAtIndexVectorArray(vs, index, w) +subroutine FN_VSetVecAtIndexVectorArray(vs_arr, index, w) use, intrinsic :: ISO_C_BINDING -type(C_PTR) :: vs +type(C_PTR) :: vs_arr integer(C_INT), intent(in) :: index type(N_Vector), target, intent(inout) :: w type(C_PTR) :: farg1 integer(C_INT) :: farg2 type(C_PTR) :: farg3 -farg1 = vs +farg1 = vs_arr farg2 = index farg3 = c_loc(w) call swigc_FN_VSetVecAtIndexVectorArray(farg1, farg2, farg3) diff --git a/src/sundials/fmod_int64/fsundials_core_mod.c b/src/sundials/fmod_int64/fsundials_core_mod.c index d64a069203..96ae9cb679 100644 --- a/src/sundials/fmod_int64/fsundials_core_mod.c +++ b/src/sundials/fmod_int64/fsundials_core_mod.c @@ -802,6 +802,22 @@ SWIGEXPORT int _wrap_FSUNLogger_Destroy(void *farg1) { } +SWIGEXPORT int _wrap_FSUNFileOpen(SwigArrayWrapper *farg1, SwigArrayWrapper *farg2, void *farg3) { + int fresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + FILE **arg3 = (FILE **) 0 ; + SUNErrCode result; + + arg1 = (char *)(farg1->data); + arg2 = (char *)(farg2->data); + arg3 = (FILE **)(farg3); + result = (SUNErrCode)SUNFileOpen((char const *)arg1,(char const *)arg2,arg3); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDIALSFileOpen(SwigArrayWrapper *farg1, SwigArrayWrapper *farg2, void *farg3) { int fresult ; char *arg1 = (char *) 0 ; @@ -818,6 +834,18 @@ SWIGEXPORT int _wrap_FSUNDIALSFileOpen(SwigArrayWrapper *farg1, SwigArrayWrapper } +SWIGEXPORT int _wrap_FSUNFileClose(void *farg1) { + int fresult ; + FILE **arg1 = (FILE **) 0 ; + SUNErrCode result; + + arg1 = (FILE **)(farg1); + result = (SUNErrCode)SUNFileClose(arg1); + fresult = (SUNErrCode)(result); + return fresult; +} + + SWIGEXPORT int _wrap_FSUNDIALSFileClose(void *farg1) { int fresult ; FILE **arg1 = (FILE **) 0 ; @@ -921,10 +949,10 @@ SWIGEXPORT void _wrap_FN_VSpace(N_Vector farg1, int64_t *farg2, int64_t *farg3) SWIGEXPORT void _wrap_FN_VSetArrayPointer(double *farg1, N_Vector farg2) { - sunrealtype *arg1 = (sunrealtype *) 0 ; + sunrealtype1d arg1 = (sunrealtype1d) 0 ; N_Vector arg2 = (N_Vector) 0 ; - arg1 = (sunrealtype *)(farg1); + arg1 = (sunrealtype1d)(farg1); arg2 = (N_Vector)(farg2); N_VSetArrayPointer(arg1,arg2); } @@ -1223,14 +1251,14 @@ SWIGEXPORT double _wrap_FN_VMinQuotient(N_Vector farg1, N_Vector farg2) { SWIGEXPORT int _wrap_FN_VLinearCombination(int const *farg1, double *farg2, void *farg3, N_Vector farg4) { int fresult ; int arg1 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; N_Vector arg4 = (N_Vector) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (sunrealtype1d)(farg2); + arg3 = (N_Vector1d)(farg3); arg4 = (N_Vector)(farg4); result = (SUNErrCode)N_VLinearCombination(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); @@ -1241,17 +1269,17 @@ SWIGEXPORT int _wrap_FN_VLinearCombination(int const *farg1, double *farg2, void SWIGEXPORT int _wrap_FN_VScaleAddMulti(int const *farg1, double *farg2, N_Vector farg3, void *farg4, void *farg5) { int fresult ; int arg1 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; - N_Vector *arg5 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (sunrealtype *)(farg2); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); - arg4 = (N_Vector *)(farg4); - arg5 = (N_Vector *)(farg5); + arg4 = (N_Vector1d)(farg4); + arg5 = (N_Vector1d)(farg5); result = (SUNErrCode)N_VScaleAddMulti(arg1,arg2,arg3,arg4,arg5); fresult = (SUNErrCode)(result); return fresult; @@ -1262,14 +1290,14 @@ SWIGEXPORT int _wrap_FN_VDotProdMulti(int const *farg1, N_Vector farg2, void *fa int fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (sunrealtype *)(farg4); + arg3 = (N_Vector1d)(farg3); + arg4 = (sunrealtype1d)(farg4); result = (SUNErrCode)N_VDotProdMulti(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); return fresult; @@ -1280,18 +1308,18 @@ SWIGEXPORT int _wrap_FN_VLinearSumVectorArray(int const *farg1, double const *fa int fresult ; int arg1 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; sunrealtype arg4 ; - N_Vector *arg5 = (N_Vector *) 0 ; - N_Vector *arg6 = (N_Vector *) 0 ; + N_Vector1d arg5 = (N_Vector1d) 0 ; + N_Vector1d arg6 = (N_Vector1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); arg4 = (sunrealtype)(*farg4); - arg5 = (N_Vector *)(farg5); - arg6 = (N_Vector *)(farg6); + arg5 = (N_Vector1d)(farg5); + arg6 = (N_Vector1d)(farg6); result = (SUNErrCode)N_VLinearSumVectorArray(arg1,arg2,arg3,arg4,arg5,arg6); fresult = (SUNErrCode)(result); return fresult; @@ -1301,15 +1329,15 @@ SWIGEXPORT int _wrap_FN_VLinearSumVectorArray(int const *farg1, double const *fa SWIGEXPORT int _wrap_FN_VScaleVectorArray(int const *farg1, double *farg2, void *farg3, void *farg4) { int fresult ; int arg1 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - N_Vector *arg4 = (N_Vector *) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (sunrealtype *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (N_Vector *)(farg4); + arg2 = (sunrealtype1d)(farg2); + arg3 = (N_Vector1d)(farg3); + arg4 = (N_Vector1d)(farg4); result = (SUNErrCode)N_VScaleVectorArray(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); return fresult; @@ -1320,12 +1348,12 @@ SWIGEXPORT int _wrap_FN_VConstVectorArray(int const *farg1, double const *farg2, int fresult ; int arg1 ; sunrealtype arg2 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (sunrealtype)(*farg2); - arg3 = (N_Vector *)(farg3); + arg3 = (N_Vector1d)(farg3); result = (SUNErrCode)N_VConstVectorArray(arg1,arg2,arg3); fresult = (SUNErrCode)(result); return fresult; @@ -1335,15 +1363,15 @@ SWIGEXPORT int _wrap_FN_VConstVectorArray(int const *farg1, double const *farg2, SWIGEXPORT int _wrap_FN_VWrmsNormVectorArray(int const *farg1, void *farg2, void *farg3, double *farg4) { int fresult ; int arg1 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (sunrealtype *)(farg4); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); + arg4 = (sunrealtype1d)(farg4); result = (SUNErrCode)N_VWrmsNormVectorArray(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); return fresult; @@ -1353,17 +1381,17 @@ SWIGEXPORT int _wrap_FN_VWrmsNormVectorArray(int const *farg1, void *farg2, void SWIGEXPORT int _wrap_FN_VWrmsNormMaskVectorArray(int const *farg1, void *farg2, void *farg3, N_Vector farg4, double *farg5) { int fresult ; int arg1 ; - N_Vector *arg2 = (N_Vector *) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; + N_Vector1d arg2 = (N_Vector1d) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; N_Vector arg4 = (N_Vector) 0 ; - sunrealtype *arg5 = (sunrealtype *) 0 ; + sunrealtype1d arg5 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); - arg2 = (N_Vector *)(farg2); - arg3 = (N_Vector *)(farg3); + arg2 = (N_Vector1d)(farg2); + arg3 = (N_Vector1d)(farg3); arg4 = (N_Vector)(farg4); - arg5 = (sunrealtype *)(farg5); + arg5 = (sunrealtype1d)(farg5); result = (SUNErrCode)N_VWrmsNormMaskVectorArray(arg1,arg2,arg3,arg4,arg5); fresult = (SUNErrCode)(result); return fresult; @@ -1498,14 +1526,14 @@ SWIGEXPORT int _wrap_FN_VDotProdMultiLocal(int const *farg1, N_Vector farg2, voi int fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - N_Vector *arg3 = (N_Vector *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + N_Vector1d arg3 = (N_Vector1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - arg3 = (N_Vector *)(farg3); - arg4 = (sunrealtype *)(farg4); + arg3 = (N_Vector1d)(farg3); + arg4 = (sunrealtype1d)(farg4); result = (SUNErrCode)N_VDotProdMultiLocal(arg1,arg2,arg3,arg4); fresult = (SUNErrCode)(result); return fresult; @@ -1516,12 +1544,12 @@ SWIGEXPORT int _wrap_FN_VDotProdMultiAllReduce(int const *farg1, N_Vector farg2, int fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; SUNErrCode result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - arg3 = (sunrealtype *)(farg3); + arg3 = (sunrealtype1d)(farg3); result = (SUNErrCode)N_VDotProdMultiAllReduce(arg1,arg2,arg3); fresult = (SUNErrCode)(result); return fresult; @@ -1574,11 +1602,11 @@ SWIGEXPORT void * _wrap_FN_VNewVectorArray(int const *farg1, void *farg2) { void * fresult ; int arg1 ; SUNContext arg2 = (SUNContext) 0 ; - N_Vector *result = 0 ; + N_Vector1d result; arg1 = (int)(*farg1); arg2 = (SUNContext)(farg2); - result = (N_Vector *)N_VNewVectorArray(arg1,arg2); + result = (N_Vector1d)N_VNewVectorArray(arg1,arg2); fresult = result; return fresult; } @@ -1588,11 +1616,11 @@ SWIGEXPORT void * _wrap_FN_VCloneEmptyVectorArray(int const *farg1, N_Vector far void * fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - N_Vector *result = 0 ; + N_Vector1d result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - result = (N_Vector *)N_VCloneEmptyVectorArray(arg1,arg2); + result = (N_Vector1d)N_VCloneEmptyVectorArray(arg1,arg2); fresult = result; return fresult; } @@ -1602,21 +1630,21 @@ SWIGEXPORT void * _wrap_FN_VCloneVectorArray(int const *farg1, N_Vector farg2) { void * fresult ; int arg1 ; N_Vector arg2 = (N_Vector) 0 ; - N_Vector *result = 0 ; + N_Vector1d result; arg1 = (int)(*farg1); arg2 = (N_Vector)(farg2); - result = (N_Vector *)N_VCloneVectorArray(arg1,arg2); + result = (N_Vector1d)N_VCloneVectorArray(arg1,arg2); fresult = result; return fresult; } SWIGEXPORT void _wrap_FN_VDestroyVectorArray(void *farg1, int const *farg2) { - N_Vector *arg1 = (N_Vector *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; int arg2 ; - arg1 = (N_Vector *)(farg1); + arg1 = (N_Vector1d)(farg1); arg2 = (int)(*farg2); N_VDestroyVectorArray(arg1,arg2); } @@ -1624,11 +1652,11 @@ SWIGEXPORT void _wrap_FN_VDestroyVectorArray(void *farg1, int const *farg2) { SWIGEXPORT N_Vector _wrap_FN_VGetVecAtIndexVectorArray(void *farg1, int const *farg2) { N_Vector fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; int arg2 ; N_Vector result; - arg1 = (N_Vector *)(farg1); + arg1 = (N_Vector1d)(farg1); arg2 = (int)(*farg2); result = (N_Vector)N_VGetVecAtIndexVectorArray(arg1,arg2); fresult = result; @@ -1637,11 +1665,11 @@ SWIGEXPORT N_Vector _wrap_FN_VGetVecAtIndexVectorArray(void *farg1, int const *f SWIGEXPORT void _wrap_FN_VSetVecAtIndexVectorArray(void *farg1, int const *farg2, N_Vector farg3) { - N_Vector *arg1 = (N_Vector *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; int arg2 ; N_Vector arg3 = (N_Vector) 0 ; - arg1 = (N_Vector *)(farg1); + arg1 = (N_Vector1d)(farg1); arg2 = (int)(*farg2); arg3 = (N_Vector)(farg3); N_VSetVecAtIndexVectorArray(arg1,arg2,arg3); @@ -1872,15 +1900,15 @@ SWIGEXPORT int _wrap_FSUNMatSpace(SUNMatrix farg1, long *farg2, long *farg3) { SWIGEXPORT int _wrap_FSUNModifiedGS(void *farg1, void *farg2, int const *farg3, int const *farg4, double *farg5) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; int arg3 ; int arg4 ; sunrealtype *arg5 = (sunrealtype *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype **)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype2d)(farg2); arg3 = (int)(*farg3); arg4 = (int)(*farg4); arg5 = (sunrealtype *)(farg5); @@ -1892,22 +1920,22 @@ SWIGEXPORT int _wrap_FSUNModifiedGS(void *farg1, void *farg2, int const *farg3, SWIGEXPORT int _wrap_FSUNClassicalGS(void *farg1, void *farg2, int const *farg3, int const *farg4, double *farg5, double *farg6, void *farg7) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; int arg3 ; int arg4 ; sunrealtype *arg5 = (sunrealtype *) 0 ; - sunrealtype *arg6 = (sunrealtype *) 0 ; - N_Vector *arg7 = (N_Vector *) 0 ; + sunrealtype1d arg6 = (sunrealtype1d) 0 ; + N_Vector1d arg7 = (N_Vector1d) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype **)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype2d)(farg2); arg3 = (int)(*farg3); arg4 = (int)(*farg4); arg5 = (sunrealtype *)(farg5); - arg6 = (sunrealtype *)(farg6); - arg7 = (N_Vector *)(farg7); + arg6 = (sunrealtype1d)(farg6); + arg7 = (N_Vector1d)(farg7); result = (SUNErrCode)SUNClassicalGS(arg1,arg2,arg3,arg4,arg5,arg6,arg7); fresult = (SUNErrCode)(result); return fresult; @@ -1917,14 +1945,14 @@ SWIGEXPORT int _wrap_FSUNClassicalGS(void *farg1, void *farg2, int const *farg3, SWIGEXPORT int _wrap_FSUNQRfact(int const *farg1, void *farg2, double *farg3, int const *farg4) { int fresult ; int arg1 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; int arg4 ; int result; arg1 = (int)(*farg1); - arg2 = (sunrealtype **)(farg2); - arg3 = (sunrealtype *)(farg3); + arg2 = (sunrealtype2d)(farg2); + arg3 = (sunrealtype1d)(farg3); arg4 = (int)(*farg4); result = (int)SUNQRfact(arg1,arg2,arg3,arg4); fresult = (int)(result); @@ -1935,15 +1963,15 @@ SWIGEXPORT int _wrap_FSUNQRfact(int const *farg1, void *farg2, double *farg3, in SWIGEXPORT int _wrap_FSUNQRsol(int const *farg1, void *farg2, double *farg3, double *farg4) { int fresult ; int arg1 ; - sunrealtype **arg2 = (sunrealtype **) 0 ; - sunrealtype *arg3 = (sunrealtype *) 0 ; - sunrealtype *arg4 = (sunrealtype *) 0 ; + sunrealtype2d arg2 = (sunrealtype2d) 0 ; + sunrealtype1d arg3 = (sunrealtype1d) 0 ; + sunrealtype1d arg4 = (sunrealtype1d) 0 ; int result; arg1 = (int)(*farg1); - arg2 = (sunrealtype **)(farg2); - arg3 = (sunrealtype *)(farg3); - arg4 = (sunrealtype *)(farg4); + arg2 = (sunrealtype2d)(farg2); + arg3 = (sunrealtype1d)(farg3); + arg4 = (sunrealtype1d)(farg4); result = (int)SUNQRsol(arg1,arg2,arg3,arg4); fresult = (int)(result); return fresult; @@ -1952,16 +1980,16 @@ SWIGEXPORT int _wrap_FSUNQRsol(int const *farg1, void *farg2, double *farg3, dou SWIGEXPORT int _wrap_FSUNQRAdd_MGS(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -1974,16 +2002,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_MGS(void *farg1, double *farg2, N_Vector farg3, i SWIGEXPORT int _wrap_FSUNQRAdd_ICWY(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -1996,16 +2024,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_ICWY(void *farg1, double *farg2, N_Vector farg3, SWIGEXPORT int _wrap_FSUNQRAdd_ICWY_SB(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -2018,16 +2046,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_ICWY_SB(void *farg1, double *farg2, N_Vector farg SWIGEXPORT int _wrap_FSUNQRAdd_CGS2(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -2040,16 +2068,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_CGS2(void *farg1, double *farg2, N_Vector farg3, SWIGEXPORT int _wrap_FSUNQRAdd_DCGS2(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -2062,16 +2090,16 @@ SWIGEXPORT int _wrap_FSUNQRAdd_DCGS2(void *farg1, double *farg2, N_Vector farg3, SWIGEXPORT int _wrap_FSUNQRAdd_DCGS2_SB(void *farg1, double *farg2, N_Vector farg3, int const *farg4, int const *farg5, void *farg6) { int fresult ; - N_Vector *arg1 = (N_Vector *) 0 ; - sunrealtype *arg2 = (sunrealtype *) 0 ; + N_Vector1d arg1 = (N_Vector1d) 0 ; + sunrealtype1d arg2 = (sunrealtype1d) 0 ; N_Vector arg3 = (N_Vector) 0 ; int arg4 ; int arg5 ; void *arg6 = (void *) 0 ; SUNErrCode result; - arg1 = (N_Vector *)(farg1); - arg2 = (sunrealtype *)(farg2); + arg1 = (N_Vector1d)(farg1); + arg2 = (sunrealtype1d)(farg2); arg3 = (N_Vector)(farg3); arg4 = (int)(*farg4); arg5 = (int)(*farg5); @@ -2877,14 +2905,14 @@ SWIGEXPORT int _wrap_FSUNStepper_SetForcing(void *farg1, double const *farg2, do SUNStepper arg1 = (SUNStepper) 0 ; sunrealtype arg2 ; sunrealtype arg3 ; - N_Vector *arg4 = (N_Vector *) 0 ; + N_Vector1d arg4 = (N_Vector1d) 0 ; int arg5 ; SUNErrCode result; arg1 = (SUNStepper)(farg1); arg2 = (sunrealtype)(*farg2); arg3 = (sunrealtype)(*farg3); - arg4 = (N_Vector *)(farg4); + arg4 = (N_Vector1d)(farg4); arg5 = (int)(*farg5); result = (SUNErrCode)SUNStepper_SetForcing(arg1,arg2,arg3,arg4,arg5); fresult = (SUNErrCode)(result); diff --git a/src/sundials/fmod_int64/fsundials_core_mod.f90 b/src/sundials/fmod_int64/fsundials_core_mod.f90 index 9106345ac9..0792a7aeab 100644 --- a/src/sundials/fmod_int64/fsundials_core_mod.f90 +++ b/src/sundials/fmod_int64/fsundials_core_mod.f90 @@ -49,19 +49,20 @@ module fsundials_core_mod integer(C_INT), parameter, public :: SUNFALSE = 0_C_INT integer(C_INT), parameter, public :: SUNTRUE = 1_C_INT - ! typedef enum SUNOutputFormat + ! enum SUNOutputFormat enum, bind(c) enumerator :: SUN_OUTPUTFORMAT_TABLE enumerator :: SUN_OUTPUTFORMAT_CSV end enum integer, parameter, public :: SUNOutputFormat = kind(SUN_OUTPUTFORMAT_TABLE) public :: SUN_OUTPUTFORMAT_TABLE, SUN_OUTPUTFORMAT_CSV - ! typedef enum SUNDataIOMode + ! enum SUNDataIOMode enum, bind(c) enumerator :: SUNDATAIOMODE_INMEM end enum integer, parameter, public :: SUNDataIOMode = kind(SUNDATAIOMODE_INMEM) public :: SUNDATAIOMODE_INMEM + ! enum SUNErrCode_ enum, bind(c) enumerator :: SUN_ERR_MINIMUM = -10000 enumerator :: SUN_ERR_ARG_CORRUPT @@ -97,6 +98,7 @@ module fsundials_core_mod enumerator :: SUN_ERR_MAXIMUM = -1000 enumerator :: SUN_SUCCESS = 0 end enum + integer, parameter, public :: SUNErrCode_ = kind(SUN_ERR_MINIMUM) public :: SUN_ERR_MINIMUM, SUN_ERR_ARG_CORRUPT, SUN_ERR_ARG_INCOMPATIBLE, SUN_ERR_ARG_OUTOFRANGE, SUN_ERR_ARG_WRONGTYPE, & SUN_ERR_ARG_DIMSMISMATCH, SUN_ERR_GENERIC, SUN_ERR_CORRUPT, SUN_ERR_OUTOFRANGE, SUN_ERR_FILE_OPEN, SUN_ERR_OP_FAIL, & SUN_ERR_MEM_FAIL, SUN_ERR_MALLOC_FAIL, SUN_ERR_EXT_FAIL, SUN_ERR_DESTROY_FAIL, SUN_ERR_NOT_IMPLEMENTED, & @@ -130,7 +132,7 @@ module fsundials_core_mod public :: FSUNProfiler_GetElapsedTime public :: FSUNProfiler_Print public :: FSUNProfiler_Reset - ! typedef enum SUNLogLevel + ! enum SUNLogLevel enum, bind(c) enumerator :: SUN_LOGLEVEL_ALL = -1 enumerator :: SUN_LOGLEVEL_NONE = 0 @@ -152,9 +154,11 @@ module fsundials_core_mod public :: FSUNLogger_Flush public :: FSUNLogger_GetOutputRank public :: FSUNLogger_Destroy + public :: FSUNFileOpen public :: FSUNDIALSFileOpen + public :: FSUNFileClose public :: FSUNDIALSFileClose - ! typedef enum N_Vector_ID + ! enum N_Vector_ID enum, bind(c) enumerator :: SUNDIALS_NVEC_SERIAL enumerator :: SUNDIALS_NVEC_PARALLEL @@ -309,7 +313,7 @@ module fsundials_core_mod public :: FN_VGetArrayPointer public :: FN_VGetDeviceArrayPointer - ! typedef enum SUNMatrix_ID + ! enum SUNMatrix_ID enum, bind(c) enumerator :: SUNMATRIX_DENSE enumerator :: SUNMATRIX_MAGMADENSE @@ -359,17 +363,21 @@ module fsundials_core_mod public :: FSUNMatMatvec public :: FSUNMatHermitianTransposeVec public :: FSUNMatSpace + ! enum SUN_PREC_ID enum, bind(c) enumerator :: SUN_PREC_NONE enumerator :: SUN_PREC_LEFT enumerator :: SUN_PREC_RIGHT enumerator :: SUN_PREC_BOTH end enum + integer, parameter, public :: SUN_PREC_ID = kind(SUN_PREC_NONE) public :: SUN_PREC_NONE, SUN_PREC_LEFT, SUN_PREC_RIGHT, SUN_PREC_BOTH + ! enum SUN_GRAMSCHMIDT_ID enum, bind(c) enumerator :: SUN_MODIFIED_GS = 1 enumerator :: SUN_CLASSICAL_GS = 2 end enum + integer, parameter, public :: SUN_GRAMSCHMIDT_ID = kind(SUN_MODIFIED_GS) public :: SUN_MODIFIED_GS, SUN_CLASSICAL_GS public :: FSUNModifiedGS public :: FSUNClassicalGS @@ -381,7 +389,7 @@ module fsundials_core_mod public :: FSUNQRAdd_CGS2 public :: FSUNQRAdd_DCGS2 public :: FSUNQRAdd_DCGS2_SB - ! typedef enum SUNLinearSolver_Type + ! enum SUNLinearSolver_Type enum, bind(c) enumerator :: SUNLINEARSOLVER_DIRECT enumerator :: SUNLINEARSOLVER_ITERATIVE @@ -391,7 +399,7 @@ module fsundials_core_mod integer, parameter, public :: SUNLinearSolver_Type = kind(SUNLINEARSOLVER_DIRECT) public :: SUNLINEARSOLVER_DIRECT, SUNLINEARSOLVER_ITERATIVE, SUNLINEARSOLVER_MATRIX_ITERATIVE, & SUNLINEARSOLVER_MATRIX_EMBEDDED - ! typedef enum SUNLinearSolver_ID + ! enum SUNLinearSolver_ID enum, bind(c) enumerator :: SUNLINEARSOLVER_BAND enumerator :: SUNLINEARSOLVER_DENSE @@ -440,6 +448,7 @@ module fsundials_core_mod ! struct struct _generic_SUNLinearSolver type, bind(C), public :: SUNLinearSolver type(C_PTR), public :: content + type(C_PTR), public :: python type(C_PTR), public :: ops type(C_PTR), public :: sunctx end type SUNLinearSolver @@ -476,7 +485,7 @@ module fsundials_core_mod integer(C_INT), parameter, public :: SUNLS_PACKAGE_FAIL_REC = 806_C_INT integer(C_INT), parameter, public :: SUNLS_QRFACT_FAIL = 807_C_INT integer(C_INT), parameter, public :: SUNLS_LUFACT_FAIL = 808_C_INT - ! typedef enum SUNNonlinearSolver_Type + ! enum SUNNonlinearSolver_Type enum, bind(c) enumerator :: SUNNONLINEARSOLVER_ROOTFIND enumerator :: SUNNONLINEARSOLVER_FIXEDPOINT @@ -503,6 +512,7 @@ module fsundials_core_mod ! struct struct _generic_SUNNonlinearSolver type, bind(C), public :: SUNNonlinearSolver type(C_PTR), public :: content + type(C_PTR), public :: python type(C_PTR), public :: ops type(C_PTR), public :: sunctx end type SUNNonlinearSolver @@ -523,7 +533,7 @@ module fsundials_core_mod public :: FSUNNonlinSolGetNumConvFails integer(C_INT), parameter, public :: SUN_NLS_CONTINUE = +901_C_INT integer(C_INT), parameter, public :: SUN_NLS_CONV_RECVR = +902_C_INT - ! typedef enum SUNAdaptController_Type + ! enum SUNAdaptController_Type enum, bind(c) enumerator :: SUN_ADAPTCONTROLLER_NONE enumerator :: SUN_ADAPTCONTROLLER_H @@ -565,7 +575,7 @@ module fsundials_core_mod public :: FSUNAdaptController_UpdateH public :: FSUNAdaptController_UpdateMRIHTol public :: FSUNAdaptController_Space - ! typedef enum SUNFullRhsMode + ! enum SUNFullRhsMode enum, bind(c) enumerator :: SUN_FULLRHS_START enumerator :: SUN_FULLRHS_END @@ -600,7 +610,7 @@ module fsundials_core_mod public :: FSUNStepper_SetForcingFn public :: FSUNStepper_SetGetNumStepsFn public :: FSUNStepper_SetDestroyFn - ! typedef enum SUNMemoryType + ! enum SUNMemoryType enum, bind(c) enumerator :: SUNMEMTYPE_HOST enumerator :: SUNMEMTYPE_PINNED @@ -684,6 +694,7 @@ module fsundials_core_mod ! struct struct SUNDomEigEstimator_ type, bind(C), public :: SUNDomEigEstimator type(C_PTR), public :: content + type(C_PTR), public :: python type(C_PTR), public :: ops type(C_PTR), public :: sunctx end type SUNDomEigEstimator @@ -1013,6 +1024,17 @@ function swigc_FSUNLogger_Destroy(farg1) & integer(C_INT) :: fresult end function +function swigc_FSUNFileOpen(farg1, farg2, farg3) & +bind(C, name="_wrap_FSUNFileOpen") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +import :: swigarraywrapper +type(SwigArrayWrapper) :: farg1 +type(SwigArrayWrapper) :: farg2 +type(C_PTR), value :: farg3 +integer(C_INT) :: fresult +end function + function swigc_FSUNDIALSFileOpen(farg1, farg2, farg3) & bind(C, name="_wrap_FSUNDIALSFileOpen") & result(fresult) @@ -1024,6 +1046,14 @@ function swigc_FSUNDIALSFileOpen(farg1, farg2, farg3) & integer(C_INT) :: fresult end function +function swigc_FSUNFileClose(farg1) & +bind(C, name="_wrap_FSUNFileClose") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT) :: fresult +end function + function swigc_FSUNDIALSFileClose(farg1) & bind(C, name="_wrap_FSUNDIALSFileClose") & result(fresult) @@ -3578,6 +3608,27 @@ function FSUNLogger_Destroy(logger) & swig_result = fresult end function +function FSUNFileOpen(filename, modes, fp) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +character(kind=C_CHAR, len=*), target :: filename +character(kind=C_CHAR), dimension(:), allocatable, target :: farg1_chars +character(kind=C_CHAR, len=*), target :: modes +character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars +type(C_PTR), target, intent(inout) :: fp +integer(C_INT) :: fresult +type(SwigArrayWrapper) :: farg1 +type(SwigArrayWrapper) :: farg2 +type(C_PTR) :: farg3 + +call SWIG_string_to_chararray(filename, farg1_chars, farg1) +call SWIG_string_to_chararray(modes, farg2_chars, farg2) +farg3 = c_loc(fp) +fresult = swigc_FSUNFileOpen(farg1, farg2, farg3) +swig_result = fresult +end function + function FSUNDIALSFileOpen(filename, modes, fp) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -3599,6 +3650,19 @@ function FSUNDIALSFileOpen(filename, modes, fp) & swig_result = fresult end function +function FSUNFileClose(fp) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR), target, intent(inout) :: fp +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = c_loc(fp) +fresult = swigc_FSUNFileClose(farg1) +swig_result = fresult +end function + function FSUNDIALSFileClose(fp) & result(swig_result) use, intrinsic :: ISO_C_BINDING @@ -4053,13 +4117,13 @@ function FN_VMinQuotient(num, denom) & swig_result = fresult end function -function FN_VLinearCombination(nvec, c, x, z) & +function FN_VLinearCombination(nvec, c_arr, x_arr, z) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec -real(C_DOUBLE), dimension(*), target, intent(inout) :: c -type(C_PTR) :: x +real(C_DOUBLE), dimension(*), target, intent(inout) :: c_arr +type(C_PTR) :: x_arr type(N_Vector), target, intent(inout) :: z integer(C_INT) :: fresult integer(C_INT) :: farg1 @@ -4068,22 +4132,22 @@ function FN_VLinearCombination(nvec, c, x, z) & type(C_PTR) :: farg4 farg1 = nvec -farg2 = c_loc(c(1)) -farg3 = x +farg2 = c_loc(c_arr(1)) +farg3 = x_arr farg4 = c_loc(z) fresult = swigc_FN_VLinearCombination(farg1, farg2, farg3, farg4) swig_result = fresult end function -function FN_VScaleAddMulti(nvec, a, x, y, z) & +function FN_VScaleAddMulti(nvec, a, x, y_arr, z_arr) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec real(C_DOUBLE), dimension(*), target, intent(inout) :: a type(N_Vector), target, intent(inout) :: x -type(C_PTR) :: y -type(C_PTR) :: z +type(C_PTR) :: y_arr +type(C_PTR) :: z_arr integer(C_INT) :: fresult integer(C_INT) :: farg1 type(C_PTR) :: farg2 @@ -4094,19 +4158,19 @@ function FN_VScaleAddMulti(nvec, a, x, y, z) & farg1 = nvec farg2 = c_loc(a(1)) farg3 = c_loc(x) -farg4 = y -farg5 = z +farg4 = y_arr +farg5 = z_arr fresult = swigc_FN_VScaleAddMulti(farg1, farg2, farg3, farg4, farg5) swig_result = fresult end function -function FN_VDotProdMulti(nvec, x, y, dotprods) & +function FN_VDotProdMulti(nvec, x, y_arr, dotprods) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec type(N_Vector), target, intent(inout) :: x -type(C_PTR) :: y +type(C_PTR) :: y_arr real(C_DOUBLE), dimension(*), target, intent(inout) :: dotprods integer(C_INT) :: fresult integer(C_INT) :: farg1 @@ -4116,22 +4180,22 @@ function FN_VDotProdMulti(nvec, x, y, dotprods) & farg1 = nvec farg2 = c_loc(x) -farg3 = y +farg3 = y_arr farg4 = c_loc(dotprods(1)) fresult = swigc_FN_VDotProdMulti(farg1, farg2, farg3, farg4) swig_result = fresult end function -function FN_VLinearSumVectorArray(nvec, a, x, b, y, z) & +function FN_VLinearSumVectorArray(nvec, a, x_arr, b, y_arr, z_arr) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec real(C_DOUBLE), intent(in) :: a -type(C_PTR) :: x +type(C_PTR) :: x_arr real(C_DOUBLE), intent(in) :: b -type(C_PTR) :: y -type(C_PTR) :: z +type(C_PTR) :: y_arr +type(C_PTR) :: z_arr integer(C_INT) :: fresult integer(C_INT) :: farg1 real(C_DOUBLE) :: farg2 @@ -4142,22 +4206,22 @@ function FN_VLinearSumVectorArray(nvec, a, x, b, y, z) & farg1 = nvec farg2 = a -farg3 = x +farg3 = x_arr farg4 = b -farg5 = y -farg6 = z +farg5 = y_arr +farg6 = z_arr fresult = swigc_FN_VLinearSumVectorArray(farg1, farg2, farg3, farg4, farg5, farg6) swig_result = fresult end function -function FN_VScaleVectorArray(nvec, c, x, z) & +function FN_VScaleVectorArray(nvec, c, x_arr, z_arr) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec real(C_DOUBLE), dimension(*), target, intent(inout) :: c -type(C_PTR) :: x -type(C_PTR) :: z +type(C_PTR) :: x_arr +type(C_PTR) :: z_arr integer(C_INT) :: fresult integer(C_INT) :: farg1 type(C_PTR) :: farg2 @@ -4166,19 +4230,19 @@ function FN_VScaleVectorArray(nvec, c, x, z) & farg1 = nvec farg2 = c_loc(c(1)) -farg3 = x -farg4 = z +farg3 = x_arr +farg4 = z_arr fresult = swigc_FN_VScaleVectorArray(farg1, farg2, farg3, farg4) swig_result = fresult end function -function FN_VConstVectorArray(nvec, c, z) & +function FN_VConstVectorArray(nvec, c, z_arr) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec real(C_DOUBLE), intent(in) :: c -type(C_PTR) :: z +type(C_PTR) :: z_arr integer(C_INT) :: fresult integer(C_INT) :: farg1 real(C_DOUBLE) :: farg2 @@ -4186,18 +4250,18 @@ function FN_VConstVectorArray(nvec, c, z) & farg1 = nvec farg2 = c -farg3 = z +farg3 = z_arr fresult = swigc_FN_VConstVectorArray(farg1, farg2, farg3) swig_result = fresult end function -function FN_VWrmsNormVectorArray(nvec, x, w, nrm) & +function FN_VWrmsNormVectorArray(nvec, x_arr, w_arr, nrm) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec -type(C_PTR) :: x -type(C_PTR) :: w +type(C_PTR) :: x_arr +type(C_PTR) :: w_arr real(C_DOUBLE), dimension(*), target, intent(inout) :: nrm integer(C_INT) :: fresult integer(C_INT) :: farg1 @@ -4206,20 +4270,20 @@ function FN_VWrmsNormVectorArray(nvec, x, w, nrm) & type(C_PTR) :: farg4 farg1 = nvec -farg2 = x -farg3 = w +farg2 = x_arr +farg3 = w_arr farg4 = c_loc(nrm(1)) fresult = swigc_FN_VWrmsNormVectorArray(farg1, farg2, farg3, farg4) swig_result = fresult end function -function FN_VWrmsNormMaskVectorArray(nvec, x, w, id, nrm) & +function FN_VWrmsNormMaskVectorArray(nvec, x_arr, w_arr, id, nrm) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec -type(C_PTR) :: x -type(C_PTR) :: w +type(C_PTR) :: x_arr +type(C_PTR) :: w_arr type(N_Vector), target, intent(inout) :: id real(C_DOUBLE), dimension(*), target, intent(inout) :: nrm integer(C_INT) :: fresult @@ -4230,8 +4294,8 @@ function FN_VWrmsNormMaskVectorArray(nvec, x, w, id, nrm) & type(C_PTR) :: farg5 farg1 = nvec -farg2 = x -farg3 = w +farg2 = x_arr +farg3 = w_arr farg4 = c_loc(id) farg5 = c_loc(nrm(1)) fresult = swigc_FN_VWrmsNormMaskVectorArray(farg1, farg2, farg3, farg4, farg5) @@ -4379,13 +4443,13 @@ function FN_VMinQuotientLocal(num, denom) & swig_result = fresult end function -function FN_VDotProdMultiLocal(nvec, x, y, dotprods) & +function FN_VDotProdMultiLocal(nvec, x, y_arr, dotprods) & result(swig_result) use, intrinsic :: ISO_C_BINDING integer(C_INT) :: swig_result integer(C_INT), intent(in) :: nvec type(N_Vector), target, intent(inout) :: x -type(C_PTR) :: y +type(C_PTR) :: y_arr real(C_DOUBLE), dimension(*), target, intent(inout) :: dotprods integer(C_INT) :: fresult integer(C_INT) :: farg1 @@ -4395,7 +4459,7 @@ function FN_VDotProdMultiLocal(nvec, x, y, dotprods) & farg1 = nvec farg2 = c_loc(x) -farg3 = y +farg3 = y_arr farg4 = c_loc(dotprods(1)) fresult = swigc_FN_VDotProdMultiLocal(farg1, farg2, farg3, farg4) swig_result = fresult @@ -4516,44 +4580,44 @@ function FN_VCloneVectorArray(count, w) & swig_result = fresult end function -subroutine FN_VDestroyVectorArray(vs, count) +subroutine FN_VDestroyVectorArray(vs_arr, count) use, intrinsic :: ISO_C_BINDING -type(C_PTR) :: vs +type(C_PTR) :: vs_arr integer(C_INT), intent(in) :: count type(C_PTR) :: farg1 integer(C_INT) :: farg2 -farg1 = vs +farg1 = vs_arr farg2 = count call swigc_FN_VDestroyVectorArray(farg1, farg2) end subroutine -function FN_VGetVecAtIndexVectorArray(vs, index) & +function FN_VGetVecAtIndexVectorArray(vs_arr, index) & result(swig_result) use, intrinsic :: ISO_C_BINDING type(N_Vector), pointer :: swig_result -type(C_PTR) :: vs +type(C_PTR) :: vs_arr integer(C_INT), intent(in) :: index type(C_PTR) :: fresult type(C_PTR) :: farg1 integer(C_INT) :: farg2 -farg1 = vs +farg1 = vs_arr farg2 = index fresult = swigc_FN_VGetVecAtIndexVectorArray(farg1, farg2) call c_f_pointer(fresult, swig_result) end function -subroutine FN_VSetVecAtIndexVectorArray(vs, index, w) +subroutine FN_VSetVecAtIndexVectorArray(vs_arr, index, w) use, intrinsic :: ISO_C_BINDING -type(C_PTR) :: vs +type(C_PTR) :: vs_arr integer(C_INT), intent(in) :: index type(N_Vector), target, intent(inout) :: w type(C_PTR) :: farg1 integer(C_INT) :: farg2 type(C_PTR) :: farg3 -farg1 = vs +farg1 = vs_arr farg2 = index farg3 = c_loc(w) call swigc_FN_VSetVecAtIndexVectorArray(farg1, farg2, farg3) diff --git a/src/sundials/sundials_datanode.h b/src/sundials/sundials_datanode.h index f6dd6cd359..ff88c21435 100644 --- a/src/sundials/sundials_datanode.h +++ b/src/sundials/sundials_datanode.h @@ -30,12 +30,16 @@ extern "C" { typedef int64_t sundataindex; -typedef enum +enum SUNDataNodeType { SUNDATANODE_LEAF, SUNDATANODE_LIST, SUNDATANODE_OBJECT -} SUNDataNodeType; +}; + +#ifndef SWIG +typedef enum SUNDataNodeType SUNDataNodeType; +#endif typedef struct SUNDataNode_Ops_* SUNDataNode_Ops; typedef struct SUNDataNode_* SUNDataNode; diff --git a/src/sundials/sundials_domeigestimator.c b/src/sundials/sundials_domeigestimator.c index 43a4f405a9..9846429170 100644 --- a/src/sundials/sundials_domeigestimator.c +++ b/src/sundials/sundials_domeigestimator.c @@ -71,6 +71,7 @@ SUNDomEigEstimator SUNDomEigEstimator_NewEmpty(SUNContext sunctx) /* attach ops and initialize content and context to NULL */ DEE->ops = ops; DEE->content = NULL; + DEE->python = NULL; DEE->sunctx = sunctx; return (DEE); @@ -88,6 +89,9 @@ void SUNDomEigEstimator_FreeEmpty(SUNDomEigEstimator DEE) if (DEE->ops) { free(DEE->ops); } DEE->ops = NULL; + if (DEE->python) { free(DEE->python); } + DEE->python = NULL; + /* free overall SUNDomEigEstimator object and return */ free(DEE); return; diff --git a/src/sundials/sundials_futils.c b/src/sundials/sundials_futils.c index 38d2af7659..6f5f85bee6 100644 --- a/src/sundials/sundials_futils.c +++ b/src/sundials/sundials_futils.c @@ -11,7 +11,7 @@ * SPDX-License-Identifier: BSD-3-Clause * SUNDIALS Copyright End * ----------------------------------------------------------------- - * SUNDIALS Fortran 2003 interface utility implementations. + * SUNDIALS FILE interface utility implementations. * -----------------------------------------------------------------*/ #include @@ -20,7 +20,7 @@ #include /* Create a file pointer with the given file name and mode. */ -SUNErrCode SUNDIALSFileOpen(const char* filename, const char* mode, FILE** fp_out) +SUNErrCode SUNFileOpen(const char* filename, const char* mode, FILE** fp_out) { SUNErrCode err = SUN_SUCCESS; FILE* fp = *fp_out; @@ -38,11 +38,18 @@ SUNErrCode SUNDIALSFileOpen(const char* filename, const char* mode, FILE** fp_ou return err; } +SUNErrCode SUNDIALSFileOpen(const char* filename, const char* mode, FILE** fp_out) +{ + return SUNFileOpen(filename, mode, fp_out); +} + /* Close a file pointer with the given file name. */ -SUNErrCode SUNDIALSFileClose(FILE** fp_ptr) +SUNErrCode SUNFileClose(FILE** fp_ptr) { if (!fp_ptr) { return SUN_SUCCESS; } FILE* fp = *fp_ptr; if (fp && (fp != stdout) && (fp != stderr)) { fclose(fp); } return SUN_SUCCESS; } + +SUNErrCode SUNDIALSFileClose(FILE** fp_ptr) { return SUNFileClose(fp_ptr); } diff --git a/src/sundials/sundials_linearsolver.c b/src/sundials/sundials_linearsolver.c index 2f5ce68694..71fef2dbfc 100644 --- a/src/sundials/sundials_linearsolver.c +++ b/src/sundials/sundials_linearsolver.c @@ -81,6 +81,7 @@ SUNLinearSolver SUNLinSolNewEmpty(SUNContext sunctx) /* attach ops and initialize content and context to NULL */ LS->ops = ops; LS->content = NULL; + LS->python = NULL; LS->sunctx = sunctx; return (LS); @@ -94,11 +95,12 @@ void SUNLinSolFreeEmpty(SUNLinearSolver S) { if (S == NULL) { return; } - /* free non-NULL ops structure */ - if (S->ops) { free(S->ops); } + free(S->ops); S->ops = NULL; - /* free overall N_Vector object and return */ + free(S->python); + S->python = NULL; + free(S); return; } @@ -315,16 +317,15 @@ SUNErrCode SUNLinSolFree(SUNLinearSolver S) /* if we reach this point, either ops == NULL or free == NULL, try to cleanup by freeing the content, ops, and solver */ - if (S->content) - { - free(S->content); - S->content = NULL; - } - if (S->ops) - { - free(S->ops); - S->ops = NULL; - } + free(S->content); + S->content = NULL; + + free(S->ops); + S->ops = NULL; + + free(S->python); + S->python = NULL; + free(S); S = NULL; diff --git a/src/sundials/sundials_nonlinearsolver.c b/src/sundials/sundials_nonlinearsolver.c index 2f0484642c..99bd1322f7 100644 --- a/src/sundials/sundials_nonlinearsolver.c +++ b/src/sundials/sundials_nonlinearsolver.c @@ -77,6 +77,7 @@ SUNNonlinearSolver SUNNonlinSolNewEmpty(SUNContext sunctx) NLS->sunctx = sunctx; NLS->ops = ops; NLS->content = NULL; + NLS->python = NULL; return (NLS); } @@ -90,9 +91,12 @@ void SUNNonlinSolFreeEmpty(SUNNonlinearSolver NLS) if (NLS == NULL) { return; } /* free non-NULL ops structure */ - if (NLS->ops) { free(NLS->ops); } + free(NLS->ops); NLS->ops = NULL; + free(NLS->python); + NLS->python = NULL; + /* free overall N_Vector object and return */ free(NLS); return; @@ -149,16 +153,12 @@ SUNErrCode SUNNonlinSolFree(SUNNonlinearSolver NLS) /* if we reach this point, either ops == NULL or free == NULL, try to cleanup by freeing the content, ops, and solver */ - if (NLS->content) - { - free(NLS->content); - NLS->content = NULL; - } - if (NLS->ops) - { - free(NLS->ops); - NLS->ops = NULL; - } + free(NLS->content); + NLS->content = NULL; + free(NLS->ops); + NLS->ops = NULL; + free(NLS->python); + NLS->python = NULL; free(NLS); NLS = NULL; diff --git a/src/sundials/sundials_nvector.c b/src/sundials/sundials_nvector.c index f998510a4d..d7d90ff2c4 100644 --- a/src/sundials/sundials_nvector.c +++ b/src/sundials/sundials_nvector.c @@ -305,7 +305,7 @@ void N_VDestroy(N_Vector v) if (v == NULL) { return; } /* if the destroy operation exists use it */ - if (v->ops->nvdestroy) { v->ops->nvdestroy(v); } + if (v->ops && v->ops->nvdestroy) { v->ops->nvdestroy(v); } else { /* if we reach this point, either ops == NULL or nvdestroy == NULL, @@ -335,7 +335,7 @@ void N_VSpace(N_Vector v, sunindextype* lrw, sunindextype* liw) sunrealtype* N_VGetArrayPointer(N_Vector v) { - if (v->ops->nvgetarraypointer) + if (v->ops && v->ops->nvgetarraypointer) { return (sunrealtype*)v->ops->nvgetarraypointer(v); } diff --git a/src/sundials/sundials_profiler.c b/src/sundials/sundials_profiler.c index 37c03349c8..687e656100 100644 --- a/src/sundials/sundials_profiler.c +++ b/src/sundials/sundials_profiler.c @@ -24,60 +24,10 @@ #include #include -#if SUNDIALS_MPI_ENABLED -#include -#endif - -#if defined(SUNDIALS_HAVE_POSIX_TIMERS) -#include -#include -#include -#elif defined(WIN32) || defined(_WIN32) -#include -#else -#error SUNProfiler needs POSIX or Windows timers -#endif - #include "sundials_debug.h" #include "sundials_hashmap_impl.h" #include "sundials_macros.h" - -#define SUNDIALS_ROOT_TIMER ((const char*)"From profiler epoch") - -#if defined(SUNDIALS_HAVE_POSIX_TIMERS) -typedef struct timespec sunTimespec; -#else -typedef struct _sunTimespec -{ - long int tv_sec; - long int tv_nsec; -} sunTimespec; -#endif - -/* Private functions */ -#if SUNDIALS_MPI_ENABLED -static SUNErrCode sunCollectTimers(SUNProfiler p); -#endif -static void sunPrintTimer(SUNHashMapKeyValue kv, FILE* fp, void* pvoid); -static int sunCompareTimes(const void* l, const void* r); -static int sunclock_gettime_monotonic(sunTimespec* tp); - -/* - sunTimerStruct. - A private structure holding timing information. - */ - -struct _sunTimerStruct -{ - sunTimespec* tic; - sunTimespec* toc; - double average; - double maximum; - double elapsed; - long count; -}; - -typedef struct _sunTimerStruct sunTimerStruct; +#include "sundials_profiler_impl.h" static sunTimerStruct* sunTimerStructNew(void) { @@ -150,21 +100,6 @@ static void sunResetTiming(sunTimerStruct* entry) entry->count = 0; } -/* - SUNProfiler. - - This structure holds all of the timers in a map.s - */ - -struct SUNProfiler_ -{ - SUNComm comm; - char* title; - SUNHashMap map; - sunTimerStruct* overhead; - double sundials_time; -}; - SUNErrCode SUNProfiler_Create(SUNComm comm, const char* title, SUNProfiler* p) { SUNProfiler profiler; diff --git a/src/sundials/sundials_profiler_impl.h b/src/sundials/sundials_profiler_impl.h new file mode 100644 index 0000000000..b637e8d8ce --- /dev/null +++ b/src/sundials/sundials_profiler_impl.h @@ -0,0 +1,93 @@ +/* ----------------------------------------------------------------- + * Programmer: Cody J. Balos @ LLNL + * ----------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, 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 + * -----------------------------------------------------------------*/ + +#ifndef SUNDIALS_PROFILER_IMPL_H_ +#define SUNDIALS_PROFILER_IMPL_H_ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#if SUNDIALS_MPI_ENABLED +#include +#endif + +#if defined(SUNDIALS_HAVE_POSIX_TIMERS) +#include +#include +#include +#elif defined(WIN32) || defined(_WIN32) +#include +#else +#error SUNProfiler needs POSIX or Windows timers +#endif + +#include "sundials_debug.h" +#include "sundials_hashmap_impl.h" +#include "sundials_macros.h" + +#define SUNDIALS_ROOT_TIMER ((const char*)"From profiler epoch") + +#if defined(SUNDIALS_HAVE_POSIX_TIMERS) +typedef struct timespec sunTimespec; +#else +typedef struct _sunTimespec +{ + long int tv_sec; + long int tv_nsec; +} sunTimespec; +#endif + +/* Private functions */ +#if SUNDIALS_MPI_ENABLED +static SUNErrCode sunCollectTimers(SUNProfiler p); +#endif +static void sunPrintTimer(SUNHashMapKeyValue kv, FILE* fp, void* pvoid); +static int sunCompareTimes(const void* l, const void* r); +static int sunclock_gettime_monotonic(sunTimespec* tp); + +/* + sunTimerStruct. + A private structure holding timing information. + */ + +struct _sunTimerStruct +{ + sunTimespec* tic; + sunTimespec* toc; + double average; + double maximum; + double elapsed; + long count; +}; + +typedef struct _sunTimerStruct sunTimerStruct; + +struct SUNProfiler_ +{ + SUNComm comm; + char* title; + SUNHashMap map; + sunTimerStruct* overhead; + double sundials_time; +}; + +#endif diff --git a/src/sundials/sundials_stepper.c b/src/sundials/sundials_stepper.c index 10a6afbc95..1f8af4bb06 100644 --- a/src/sundials/sundials_stepper.c +++ b/src/sundials/sundials_stepper.c @@ -29,6 +29,7 @@ SUNErrCode SUNStepper_Create(SUNContext sunctx, SUNStepper* stepper_ptr) SUNAssert(stepper, SUN_ERR_MALLOC_FAIL); stepper->content = NULL; + stepper->python = NULL; stepper->sunctx = sunctx; stepper->last_flag = SUN_SUCCESS; @@ -56,6 +57,7 @@ SUNErrCode SUNStepper_Destroy(SUNStepper* stepper_ptr) const SUNStepper_Ops ops = (*stepper_ptr)->ops; if (ops && ops->destroy) { ops->destroy(*stepper_ptr); } free(ops); + free((*stepper_ptr)->python); free(*stepper_ptr); *stepper_ptr = NULL; } diff --git a/src/sundials/sundials_stepper_impl.h b/src/sundials/sundials_stepper_impl.h index ed20e3a9a8..fae173fc25 100644 --- a/src/sundials/sundials_stepper_impl.h +++ b/src/sundials/sundials_stepper_impl.h @@ -39,6 +39,9 @@ struct SUNStepper_Ops_ struct SUNStepper_ { + /* python interface specific content */ + void* python; + /* stepper specific content and operations */ void* content; SUNStepper_Ops ops; diff --git a/src/sunmatrix/band/fmod_int32/fsunmatrix_band_mod.c b/src/sunmatrix/band/fmod_int32/fsunmatrix_band_mod.c index 75462c2232..7533456409 100644 --- a/src/sunmatrix/band/fmod_int32/fsunmatrix_band_mod.c +++ b/src/sunmatrix/band/fmod_int32/fsunmatrix_band_mod.c @@ -343,10 +343,10 @@ SWIGEXPORT int32_t _wrap_FSUNBandMatrix_LData(SUNMatrix farg1) { SWIGEXPORT void * _wrap_FSUNBandMatrix_Cols(SUNMatrix farg1) { void * fresult ; SUNMatrix arg1 = (SUNMatrix) 0 ; - sunrealtype **result = 0 ; + sunrealtype2d result; arg1 = (SUNMatrix)(farg1); - result = (sunrealtype **)SUNBandMatrix_Cols(arg1); + result = (sunrealtype2d)SUNBandMatrix_Cols(arg1); fresult = result; return fresult; } diff --git a/src/sunmatrix/band/fmod_int64/fsunmatrix_band_mod.c b/src/sunmatrix/band/fmod_int64/fsunmatrix_band_mod.c index 2ba986188f..71ca49acc0 100644 --- a/src/sunmatrix/band/fmod_int64/fsunmatrix_band_mod.c +++ b/src/sunmatrix/band/fmod_int64/fsunmatrix_band_mod.c @@ -343,10 +343,10 @@ SWIGEXPORT int64_t _wrap_FSUNBandMatrix_LData(SUNMatrix farg1) { SWIGEXPORT void * _wrap_FSUNBandMatrix_Cols(SUNMatrix farg1) { void * fresult ; SUNMatrix arg1 = (SUNMatrix) 0 ; - sunrealtype **result = 0 ; + sunrealtype2d result; arg1 = (SUNMatrix)(farg1); - result = (sunrealtype **)SUNBandMatrix_Cols(arg1); + result = (sunrealtype2d)SUNBandMatrix_Cols(arg1); fresult = result; return fresult; } diff --git a/src/sunmatrix/dense/fmod_int32/fsunmatrix_dense_mod.c b/src/sunmatrix/dense/fmod_int32/fsunmatrix_dense_mod.c index e1f3bcf860..d5a745b0e2 100644 --- a/src/sunmatrix/dense/fmod_int32/fsunmatrix_dense_mod.c +++ b/src/sunmatrix/dense/fmod_int32/fsunmatrix_dense_mod.c @@ -273,10 +273,10 @@ SWIGEXPORT int32_t _wrap_FSUNDenseMatrix_LData(SUNMatrix farg1) { SWIGEXPORT void * _wrap_FSUNDenseMatrix_Cols(SUNMatrix farg1) { void * fresult ; SUNMatrix arg1 = (SUNMatrix) 0 ; - sunrealtype **result = 0 ; + sunrealtype2d result; arg1 = (SUNMatrix)(farg1); - result = (sunrealtype **)SUNDenseMatrix_Cols(arg1); + result = (sunrealtype2d)SUNDenseMatrix_Cols(arg1); fresult = result; return fresult; } diff --git a/src/sunmatrix/dense/fmod_int64/fsunmatrix_dense_mod.c b/src/sunmatrix/dense/fmod_int64/fsunmatrix_dense_mod.c index 7c24c28d1e..0e6810623d 100644 --- a/src/sunmatrix/dense/fmod_int64/fsunmatrix_dense_mod.c +++ b/src/sunmatrix/dense/fmod_int64/fsunmatrix_dense_mod.c @@ -273,10 +273,10 @@ SWIGEXPORT int64_t _wrap_FSUNDenseMatrix_LData(SUNMatrix farg1) { SWIGEXPORT void * _wrap_FSUNDenseMatrix_Cols(SUNMatrix farg1) { void * fresult ; SUNMatrix arg1 = (SUNMatrix) 0 ; - sunrealtype **result = 0 ; + sunrealtype2d result; arg1 = (SUNMatrix)(farg1); - result = (sunrealtype **)SUNDenseMatrix_Cols(arg1); + result = (sunrealtype2d)SUNDenseMatrix_Cols(arg1); fresult = result; return fresult; } diff --git a/swig/arkode/farkode_arkstep_mod.i b/swig/arkode/farkode_arkstep_mod.i index a60e41b7d4..b8c0535502 100644 --- a/swig/arkode/farkode_arkstep_mod.i +++ b/swig/arkode/farkode_arkstep_mod.i @@ -21,6 +21,7 @@ // include the header file(s) in the c wrapper that is generated %{ #include "arkode/arkode_arkstep.h" +#include "arkode/arkode_arkstep_deprecated.h" %} // Load the typedefs and generate a "use" statements in the module @@ -28,3 +29,4 @@ // Process definitions from these files %include "arkode/arkode_arkstep.h" +%include "arkode/arkode_arkstep_deprecated.h" diff --git a/swig/arkode/farkode_erkstep_mod.i b/swig/arkode/farkode_erkstep_mod.i index 3bc8b9bb4b..f78455595d 100644 --- a/swig/arkode/farkode_erkstep_mod.i +++ b/swig/arkode/farkode_erkstep_mod.i @@ -21,6 +21,7 @@ // include the header file(s) in the c wrapper that is generated %{ #include "arkode/arkode_erkstep.h" +#include "arkode/arkode_erkstep_deprecated.h" %} // Load the typedefs and generate a "use" statements in the module @@ -28,3 +29,5 @@ // Process definitions from these files %include "arkode/arkode_erkstep.h" +%include "arkode/arkode_erkstep_deprecated.h" + diff --git a/swig/arkode/farkode_mristep_mod.i b/swig/arkode/farkode_mristep_mod.i index 5a5b5b5ca7..34e9a737ac 100644 --- a/swig/arkode/farkode_mristep_mod.i +++ b/swig/arkode/farkode_mristep_mod.i @@ -21,6 +21,7 @@ // include the header file(s) in the c wrapper that is generated %{ #include "arkode/arkode_mristep.h" +#include "arkode/arkode_mristep_deprecated.h" %} // Load the typedefs and generate a "use" statements in the module @@ -32,4 +33,5 @@ // Process definitions from these files %include "arkode/arkode_mristep.h" +%include "arkode/arkode_mristep_deprecated.h" diff --git a/swig/arkode/farkode_sprkstep_mod.i b/swig/arkode/farkode_sprkstep_mod.i index d688a180ca..cae0335ea0 100644 --- a/swig/arkode/farkode_sprkstep_mod.i +++ b/swig/arkode/farkode_sprkstep_mod.i @@ -21,6 +21,7 @@ // include the header file(s) in the c wrapper that is generated %{ #include "arkode/arkode_sprkstep.h" +#include "arkode/arkode_sprkstep_deprecated.h" %} // Load the typedefs and generate a "use" statements in the module @@ -28,3 +29,4 @@ // Process definitions from these files %include "arkode/arkode_sprkstep.h" +%include "arkode/arkode_sprkstep_deprecated.h" diff --git a/swig/sundials/fsundials.i b/swig/sundials/fsundials.i index 3c10557466..3b6ef67665 100644 --- a/swig/sundials/fsundials.i +++ b/swig/sundials/fsundials.i @@ -52,6 +52,7 @@ // Assume sunrealtype* is an array of doubles %apply double[] { sunrealtype* }; +%apply double[] { sunrealtype1d }; #ifdef GENERATE_INT32 %apply int[] { sunindextype* }; diff --git a/test/unit_tests/sunlinsol/ginkgo/test_sunlinsol_ginkgo.cpp b/test/unit_tests/sunlinsol/ginkgo/test_sunlinsol_ginkgo.cpp index 50a26fbae3..567174e2b6 100644 --- a/test/unit_tests/sunlinsol/ginkgo/test_sunlinsol_ginkgo.cpp +++ b/test/unit_tests/sunlinsol/ginkgo/test_sunlinsol_ginkgo.cpp @@ -537,8 +537,8 @@ int main(int argc, char* argv[]) } /* Create right-hand side vector for linear solve */ - fails += SUNMatMatvecSetup(A->Convert()); - fails += SUNMatMatvec(A->Convert(), x, b); + fails += SUNMatMatvecSetup(A->get()); + fails += SUNMatMatvec(A->get(), x, b); if (fails) { std::cerr << "FAIL: SUNLinSol SUNMatMatvec failure\n"; @@ -733,12 +733,11 @@ int main(int argc, char* argv[]) } /* Run Tests */ - fails += Test_SUNLinSolGetID(LS->Convert(), SUNLINEARSOLVER_GINKGO, 0); - fails += Test_SUNLinSolGetType(LS->Convert(), - SUNLINEARSOLVER_MATRIX_ITERATIVE, 0); - fails += Test_SUNLinSolInitialize(LS->Convert(), 0); - fails += Test_SUNLinSolSetup(LS->Convert(), A->Convert(), 0); - fails += Test_SUNLinSolSolve(LS->Convert(), A->Convert(), x, b, + fails += Test_SUNLinSolGetID(LS->get(), SUNLINEARSOLVER_GINKGO, 0); + fails += Test_SUNLinSolGetType(LS->get(), SUNLINEARSOLVER_MATRIX_ITERATIVE, 0); + fails += Test_SUNLinSolInitialize(LS->get(), 0); + fails += Test_SUNLinSolSetup(LS->get(), A->get(), 0); + fails += Test_SUNLinSolSolve(LS->get(), A->get(), x, b, 1e4 * SUN_UNIT_ROUNDOFF, SUNTRUE, 0); /* Print result */ @@ -750,9 +749,8 @@ int main(int argc, char* argv[]) /* Print solve information */ std::cout << "Number of linear solver iterations: " - << static_cast(SUNLinSolNumIters(LS->Convert())) - << std::endl; - std::cout << "Final residual norm: " << SUNLinSolResNorm(LS->Convert()) + << static_cast(SUNLinSolNumIters(LS->get())) << std::endl; + std::cout << "Final residual norm: " << SUNLinSolResNorm(LS->get()) << std::endl; // clear global_exec