Skip to content

Commit

Permalink
swig and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
maggul committed Oct 28, 2024
1 parent 2a76c02 commit cda3b22
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 36 deletions.
8 changes: 4 additions & 4 deletions include/arkode/arkode_lsrkstep.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ SUNDIALS_EXPORT int LSRKStepReInitSSP(void* arkode_mem, ARKRhsFn rhs,
/* Optional input functions -- must be called AFTER a creation routine above */

SUNDIALS_EXPORT int LSRKStepSetSTSMethod(void* arkode_mem,
ARKODE_LSRKMethodType method);
ARKODE_LSRKMethodType method);

SUNDIALS_EXPORT int LSRKStepSetSSPMethod(void* arkode_mem,
ARKODE_LSRKMethodType method);
ARKODE_LSRKMethodType method);

SUNDIALS_EXPORT int LSRKStepSetSTSMethodByName(void* arkode_mem,
const char* emethod);
const char* emethod);

SUNDIALS_EXPORT int LSRKStepSetSSPMethodByName(void* arkode_mem,
const char* emethod);
const char* emethod);

SUNDIALS_EXPORT int LSRKStepSetDomEigFn(void* arkode_mem, ARKDomEigFn dom_eig);

Expand Down
23 changes: 13 additions & 10 deletions src/arkode/arkode_lsrkstep_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ int LSRKStepSetSTSMethod(void* arkode_mem, ARKODE_LSRKMethodType method)
case ARKODE_LSRK_SSP_S_2:
case ARKODE_LSRK_SSP_S_3:
case ARKODE_LSRK_SSP_10_4:
arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__,
"Invalid method option: Call LSRKStepCreateSSP to create an SSP method first.");
arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__,
__FILE__, "Invalid method option: Call LSRKStepCreateSSP to create an SSP method first.");
break;

default:
Expand Down Expand Up @@ -101,8 +101,8 @@ int LSRKStepSetSSPMethod(void* arkode_mem, ARKODE_LSRKMethodType method)
{
case ARKODE_LSRK_RKC_2:
case ARKODE_LSRK_RKL_2:
arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__,
"Invalid method option: Call LSRKStepCreateSTS to create an STS method first.");
arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__,
__FILE__, "Invalid method option: Call LSRKStepCreateSTS to create an STS method first.");
break;
case ARKODE_LSRK_SSP_S_2:
ark_mem->step = lsrkStep_TakeStepSSPs2;
Expand Down Expand Up @@ -150,10 +150,12 @@ int LSRKStepSetSTSMethodByName(void* arkode_mem, const char* emethod)
{
return LSRKStepSetSTSMethod(arkode_mem, ARKODE_LSRK_RKL_2);
}
if ((strcmp(emethod, "ARKODE_LSRK_SSP_S_2") == 0) || (strcmp(emethod, "ARKODE_LSRK_SSP_S_3") == 0) || (strcmp(emethod, "ARKODE_LSRK_SSP_10_4") == 0))
if ((strcmp(emethod, "ARKODE_LSRK_SSP_S_2") == 0) ||
(strcmp(emethod, "ARKODE_LSRK_SSP_S_3") == 0) ||
(strcmp(emethod, "ARKODE_LSRK_SSP_10_4") == 0))
{
arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__,
"Invalid method option: Call LSRKStepCreateSTS to create an STS method first.");
arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__,
__FILE__, "Invalid method option: Call LSRKStepCreateSTS to create an STS method first.");
}

arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__,
Expand All @@ -164,10 +166,11 @@ int LSRKStepSetSTSMethodByName(void* arkode_mem, const char* emethod)

int LSRKStepSetSSPMethodByName(void* arkode_mem, const char* emethod)
{
if ((strcmp(emethod, "ARKODE_LSRK_RKC_2") == 0) || (strcmp(emethod, "ARKODE_LSRK_RKL_2") == 0))
if ((strcmp(emethod, "ARKODE_LSRK_RKC_2") == 0) ||
(strcmp(emethod, "ARKODE_LSRK_RKL_2") == 0))
{
arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__, __FILE__,
"Invalid method option: Call LSRKStepCreateSSP to create an SSP method first.");
arkProcessError(NULL, ARK_ILL_INPUT, __LINE__, __func__,
__FILE__, "Invalid method option: Call LSRKStepCreateSSP to create an SSP method first.");
}
if (strcmp(emethod, "ARKODE_LSRK_SSP_S_2") == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/arkode/fmod_int32/farkode_lsrkstep_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ SWIGEXPORT int _wrap_FLSRKStepSetSSPMethodByName(void *farg1, SwigArrayWrapper *

arg1 = (void *)(farg1);
arg2 = (char *)(farg2->data);
result = (int)LSRKStepSetMethodSSPByName(arg1,(char const *)arg2);
result = (int)LSRKStepSetSSPMethodByName(arg1,(char const *)arg2);
fresult = (int)(result);
return fresult;
}
Expand Down
74 changes: 64 additions & 10 deletions src/arkode/fmod_int32/farkode_lsrkstep_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ module farkode_lsrkstep_mod
public :: FLSRKStepCreateSSP
public :: FLSRKStepReInitSTS
public :: FLSRKStepReInitSSP
public :: FLSRKStepSetMethod
public :: FLSRKStepSetSTSMethod
public :: FLSRKStepSetSSPMethod
type, bind(C) :: SwigArrayWrapper
type(C_PTR), public :: data = C_NULL_PTR
integer(C_SIZE_T), public :: size = 0
end type
public :: FLSRKStepSetMethodByName
public :: FLSRKStepSetSTSMethodByName
public :: FLSRKStepSetSSPMethodByName
public :: FLSRKStepSetDomEigFn
public :: FLSRKStepSetDomEigFrequency
public :: FLSRKStepSetMaxNumStages
Expand Down Expand Up @@ -100,17 +102,36 @@ function swigc_FLSRKStepReInitSSP(farg1, farg2, farg3, farg4) &
integer(C_INT) :: fresult
end function

function swigc_FLSRKStepSetMethod(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetMethod") &
function swigc_FLSRKStepSetSTSMethod(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetSTSMethod") &
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_FLSRKStepSetMethodByName(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetMethodByName") &
function swigc_FLSRKStepSetSSPMethod(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetSSPMethod") &
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_FLSRKStepSetSTSMethodByName(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetSTSMethodByName") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
import :: swigarraywrapper
type(C_PTR), value :: farg1
type(SwigArrayWrapper) :: farg2
integer(C_INT) :: fresult
end function

function swigc_FLSRKStepSetSSPMethodByName(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetSSPMethodByName") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
import :: swigarraywrapper
Expand Down Expand Up @@ -275,7 +296,23 @@ function FLSRKStepReInitSSP(arkode_mem, rhs, t0, y0) &
swig_result = fresult
end function

function FLSRKStepSetMethod(arkode_mem, method) &
function FLSRKStepSetSTSMethod(arkode_mem, method) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR) :: arkode_mem
integer(ARKODE_LSRKMethodType), intent(in) :: method
integer(C_INT) :: fresult
type(C_PTR) :: farg1
integer(C_INT) :: farg2

farg1 = arkode_mem
farg2 = method
fresult = swigc_FLSRKStepSetSTSMethod(farg1, farg2)
swig_result = fresult
end function

function FLSRKStepSetSSPMethod(arkode_mem, method) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
Expand All @@ -287,7 +324,7 @@ function FLSRKStepSetMethod(arkode_mem, method) &

farg1 = arkode_mem
farg2 = method
fresult = swigc_FLSRKStepSetMethod(farg1, farg2)
fresult = swigc_FLSRKStepSetSSPMethod(farg1, farg2)
swig_result = fresult
end function

Expand All @@ -309,7 +346,24 @@ subroutine SWIG_string_to_chararray(string, chars, wrap)
wrap%size = len(string)
end subroutine

function FLSRKStepSetMethodByName(arkode_mem, emethod) &
function FLSRKStepSetSTSMethodByName(arkode_mem, emethod) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR) :: arkode_mem
character(kind=C_CHAR, len=*), target :: emethod
character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars
integer(C_INT) :: fresult
type(C_PTR) :: farg1
type(SwigArrayWrapper) :: farg2

farg1 = arkode_mem
call SWIG_string_to_chararray(emethod, farg2_chars, farg2)
fresult = swigc_FLSRKStepSetSTSMethodByName(farg1, farg2)
swig_result = fresult
end function

function FLSRKStepSetSSPMethodByName(arkode_mem, emethod) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
Expand All @@ -322,7 +376,7 @@ function FLSRKStepSetMethodByName(arkode_mem, emethod) &

farg1 = arkode_mem
call SWIG_string_to_chararray(emethod, farg2_chars, farg2)
fresult = swigc_FLSRKStepSetMethodByName(farg1, farg2)
fresult = swigc_FLSRKStepSetSSPMethodByName(farg1, farg2)
swig_result = fresult
end function

Expand Down
18 changes: 16 additions & 2 deletions src/arkode/fmod_int64/farkode_lsrkstep_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,29 @@ SWIGEXPORT int _wrap_FLSRKStepSetSSPMethod(void *farg1, int const *farg2) {
}


SWIGEXPORT int _wrap_FLSRKStepSetMethodByName(void *farg1, SwigArrayWrapper *farg2) {
SWIGEXPORT int _wrap_FLSRKStepSetSTSMethodByName(void *farg1, SwigArrayWrapper *farg2) {
int fresult ;
void *arg1 = (void *) 0 ;
char *arg2 = (char *) 0 ;
int result;

arg1 = (void *)(farg1);
arg2 = (char *)(farg2->data);
result = (int)LSRKStepSetMethodByName(arg1,(char const *)arg2);
result = (int)LSRKStepSetSTSMethodByName(arg1,(char const *)arg2);
fresult = (int)(result);
return fresult;
}


SWIGEXPORT int _wrap_FLSRKStepSetSSPMethodByName(void *farg1, SwigArrayWrapper *farg2) {
int fresult ;
void *arg1 = (void *) 0 ;
char *arg2 = (char *) 0 ;
int result;

arg1 = (void *)(farg1);
arg2 = (char *)(farg2->data);
result = (int)LSRKStepSetSSPMethodByName(arg1,(char const *)arg2);
fresult = (int)(result);
return fresult;
}
Expand Down
71 changes: 62 additions & 9 deletions src/arkode/fmod_int64/farkode_lsrkstep_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ module farkode_lsrkstep_mod
public :: FLSRKStepCreateSSP
public :: FLSRKStepReInitSTS
public :: FLSRKStepReInitSSP
public :: FLSRKStepSetMethod
public :: FLSRKStepSetSTSMethod
public :: FLSRKStepSetSSPMethod
type, bind(C) :: SwigArrayWrapper
type(C_PTR), public :: data = C_NULL_PTR
integer(C_SIZE_T), public :: size = 0
Expand Down Expand Up @@ -101,17 +102,36 @@ function swigc_FLSRKStepReInitSSP(farg1, farg2, farg3, farg4) &
integer(C_INT) :: fresult
end function

function swigc_FLSRKStepSetMethod(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetMethod") &
function swigc_FLSRKStepSetSTSMethod(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetSTSMethod") &
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_FLSRKStepSetMethodByName(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetMethodByName") &
function swigc_FLSRKStepSetSSPMethod(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetSSPMethod") &
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_FLSRKStepSetSTSMethodByName(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetSTSMethodByName") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
import :: swigarraywrapper
type(C_PTR), value :: farg1
type(SwigArrayWrapper) :: farg2
integer(C_INT) :: fresult
end function

function swigc_FLSRKStepSetSSPMethodByName(farg1, farg2) &
bind(C, name="_wrap_FLSRKStepSetSSPMethodByName") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
import :: swigarraywrapper
Expand Down Expand Up @@ -276,7 +296,23 @@ function FLSRKStepReInitSSP(arkode_mem, rhs, t0, y0) &
swig_result = fresult
end function

function FLSRKStepSetMethod(arkode_mem, method) &
function FLSRKStepSetSTSMethod(arkode_mem, method) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR) :: arkode_mem
integer(ARKODE_LSRKMethodType), intent(in) :: method
integer(C_INT) :: fresult
type(C_PTR) :: farg1
integer(C_INT) :: farg2

farg1 = arkode_mem
farg2 = method
fresult = swigc_FLSRKStepSetSTSMethod(farg1, farg2)
swig_result = fresult
end function

function FLSRKStepSetSSPMethod(arkode_mem, method) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
Expand All @@ -288,7 +324,7 @@ function FLSRKStepSetMethod(arkode_mem, method) &

farg1 = arkode_mem
farg2 = method
fresult = swigc_FLSRKStepSetMethod(farg1, farg2)
fresult = swigc_FLSRKStepSetSSPMethod(farg1, farg2)
swig_result = fresult
end function

Expand All @@ -310,7 +346,24 @@ subroutine SWIG_string_to_chararray(string, chars, wrap)
wrap%size = len(string)
end subroutine

function FLSRKStepSetMethodByName(arkode_mem, emethod) &
function FLSRKStepSetSTSMethodByName(arkode_mem, emethod) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR) :: arkode_mem
character(kind=C_CHAR, len=*), target :: emethod
character(kind=C_CHAR), dimension(:), allocatable, target :: farg2_chars
integer(C_INT) :: fresult
type(C_PTR) :: farg1
type(SwigArrayWrapper) :: farg2

farg1 = arkode_mem
call SWIG_string_to_chararray(emethod, farg2_chars, farg2)
fresult = swigc_FLSRKStepSetSTSMethodByName(farg1, farg2)
swig_result = fresult
end function

function FLSRKStepSetSSPMethodByName(arkode_mem, emethod) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
Expand All @@ -323,7 +376,7 @@ function FLSRKStepSetMethodByName(arkode_mem, emethod) &

farg1 = arkode_mem
call SWIG_string_to_chararray(emethod, farg2_chars, farg2)
fresult = swigc_FLSRKStepSetMethodByName(farg1, farg2)
fresult = swigc_FLSRKStepSetSSPMethodByName(farg1, farg2)
swig_result = fresult
end function

Expand Down

0 comments on commit cda3b22

Please sign in to comment.