Skip to content

Commit

Permalink
Merge pull request #280 from sethrj/swig-update
Browse files Browse the repository at this point in the history
Update ForTrilinos for SWIG 4.0.2+fortran release
  • Loading branch information
sethrj authored Sep 18, 2020
2 parents 54a5eda + 9a8a8f4 commit 3f5ff6d
Show file tree
Hide file tree
Showing 20 changed files with 5,514 additions and 6,748 deletions.
5 changes: 5 additions & 0 deletions src/forbelos/forbelos.i
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@
%rename("Belos%s", %$isenumitem) "";
%rename("Belos%s", %$isenum) "";

// Use link-time wrappers for enums with C-only values
%nofortranconst Belos::MsgType;
%nofortranconst Belos::StatusType;
%nofortranconst Belos::ResetType;

%include "Belos_Types.i"
83 changes: 41 additions & 42 deletions src/forbelos/generated/forbelos.F90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! This file was automatically generated by SWIG (http://www.swig.org).
! Version 4.0.0
! Version 4.0.2+fortran
!
! Do not make changes to this file unless you know what you are doing--modify
! the SWIG interface file instead.
Expand Down Expand Up @@ -116,7 +116,6 @@ module forbelos

integer, parameter :: swig_cmem_own_bit = 0
integer, parameter :: swig_cmem_rvalue_bit = 1
integer, parameter :: swig_cmem_const_bit = 2
type, bind(C) :: SwigClassWrapper
type(C_PTR), public :: cptr = C_NULL_PTR
integer(C_INT), public :: cmemflags = 0
Expand All @@ -130,12 +129,12 @@ module forbelos
procedure, nopass :: get_orthoKappa => swigf_DefaultSolverParameters_orthoKappa_get
procedure, nopass :: get_resScaleFactor => swigf_DefaultSolverParameters_resScaleFactor_get
procedure, nopass :: get_impTolScale => swigf_DefaultSolverParameters_impTolScale_get
procedure :: release => swigf_release_DefaultSolverParameters
procedure :: release => swigf_DefaultSolverParameters_release
procedure, private :: swigf_DefaultSolverParameters_op_assign__
generic :: assignment(=) => swigf_DefaultSolverParameters_op_assign__
end type DefaultSolverParameters
interface DefaultSolverParameters
module procedure swigf_create_DefaultSolverParameters
module procedure swigf_new_DefaultSolverParameters
end interface

! WRAPPER DECLARATIONS
Expand Down Expand Up @@ -263,7 +262,7 @@ subroutine swigc_DefaultSolverParameters_op_assign__(farg1, farg2) &
use, intrinsic :: ISO_C_BINDING
import :: swigclasswrapper
type(SwigClassWrapper), intent(inout) :: farg1
type(SwigClassWrapper) :: farg2
type(SwigClassWrapper), intent(in) :: farg2
end subroutine

end interface
Expand All @@ -272,75 +271,75 @@ subroutine swigc_DefaultSolverParameters_op_assign__(farg1, farg2) &
contains
! MODULE SUBPROGRAMS

subroutine SWIG_chararray_to_string(wrap, string)
subroutine SWIGTM_fout_char_Sm_(imout, fout)
use, intrinsic :: ISO_C_BINDING
type(SwigArrayWrapper), intent(IN) :: wrap
character(kind=C_CHAR, len=:), allocatable, intent(OUT) :: string
type(SwigArrayWrapper), intent(in) :: imout
character(len=:), allocatable, intent(out) :: fout
character(kind=C_CHAR), dimension(:), pointer :: chars
integer(kind=C_SIZE_T) :: i
call c_f_pointer(wrap%data, chars, [wrap%size])
allocate(character(kind=C_CHAR, len=wrap%size) :: string)
do i=1, wrap%size
string(i:i) = chars(i)
call c_f_pointer(imout%data, chars, [imout%size])
allocate(character(len=imout%size) :: fout)
do i=1, imout%size
fout(i:i) = char(ichar(chars(i)))
end do
end subroutine

function convertReturnTypeToString(result) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
character(kind=C_CHAR, len=:), allocatable :: swig_result
character(len=:), allocatable :: swig_result
integer(BelosReturnType), intent(in) :: result
type(SwigArrayWrapper) :: fresult
integer(C_INT) :: farg1

farg1 = result
fresult = swigc_convertReturnTypeToString(farg1)
call SWIG_chararray_to_string(fresult, swig_result)
call SWIGTM_fout_char_Sm_(fresult, swig_result)
call SWIG_free(fresult%data)
end function

function convertStatusTypeToString(status) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
character(kind=C_CHAR, len=:), allocatable :: swig_result
character(len=:), allocatable :: swig_result
integer(BelosStatusType), intent(in) :: status
type(SwigArrayWrapper) :: fresult
integer(C_INT) :: farg1

farg1 = status
fresult = swigc_convertStatusTypeToString(farg1)
call SWIG_chararray_to_string(fresult, swig_result)
call SWIGTM_fout_char_Sm_(fresult, swig_result)
call SWIG_free(fresult%data)
end function


subroutine SWIG_string_to_chararray(string, chars, wrap)
subroutine SWIGTM_fin_char_Sm_(finp, iminp, temp)
use, intrinsic :: ISO_C_BINDING
character(kind=C_CHAR, len=*), intent(IN) :: string
character(kind=C_CHAR), dimension(:), target, allocatable, intent(OUT) :: chars
type(SwigArrayWrapper), intent(OUT) :: wrap
character(len=*), intent(in) :: finp
type(SwigArrayWrapper), intent(out) :: iminp
character(kind=C_CHAR), dimension(:), target, allocatable, intent(out) :: temp
integer :: i

allocate(character(kind=C_CHAR) :: chars(len(string) + 1))
do i=1,len(string)
chars(i) = string(i:i)
allocate(character(kind=C_CHAR) :: temp(len(finp) + 1))
do i=1,len(finp)
temp(i) = char(ichar(finp(i:i)), kind=C_CHAR)
end do
i = len(string) + 1
chars(i) = C_NULL_CHAR ! C string compatibility
wrap%data = c_loc(chars)
wrap%size = len(string)
i = len(finp) + 1
temp(i) = C_NULL_CHAR ! C finp compatibility
iminp%data = c_loc(temp)
iminp%size = len(finp, kind=C_SIZE_T)
end subroutine

function convertStringToStatusType(status) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(BelosStatusType) :: swig_result
character(kind=C_CHAR, len=*), target :: status
character(kind=C_CHAR), dimension(:), allocatable, target :: farg1_chars
character(len=*), target :: status
integer(C_INT) :: fresult
character(kind=C_CHAR), dimension(:), allocatable, target :: farg1_temp
type(SwigArrayWrapper) :: farg1

call SWIG_string_to_chararray(status, farg1_chars, farg1)
call SWIGTM_fin_char_Sm_(status, farg1, farg1_temp)
fresult = swigc_convertStringToStatusType(farg1)
swig_result = fresult
end function
Expand All @@ -349,12 +348,12 @@ function convertStringToNormType(normtype) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(BelosNormType) :: swig_result
character(kind=C_CHAR, len=*), target :: normtype
character(kind=C_CHAR), dimension(:), allocatable, target :: farg1_chars
character(len=*), target :: normtype
integer(C_INT) :: fresult
character(kind=C_CHAR), dimension(:), allocatable, target :: farg1_temp
type(SwigArrayWrapper) :: farg1

call SWIG_string_to_chararray(normtype, farg1_chars, farg1)
call SWIGTM_fin_char_Sm_(normtype, farg1, farg1_temp)
fresult = swigc_convertStringToNormType(farg1)
swig_result = fresult
end function
Expand All @@ -363,41 +362,41 @@ function convertStringToScaleType(scaletype) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(BelosScaleType) :: swig_result
character(kind=C_CHAR, len=*), target :: scaletype
character(kind=C_CHAR), dimension(:), allocatable, target :: farg1_chars
character(len=*), target :: scaletype
integer(C_INT) :: fresult
character(kind=C_CHAR), dimension(:), allocatable, target :: farg1_temp
type(SwigArrayWrapper) :: farg1

call SWIG_string_to_chararray(scaletype, farg1_chars, farg1)
call SWIGTM_fin_char_Sm_(scaletype, farg1, farg1_temp)
fresult = swigc_convertStringToScaleType(farg1)
swig_result = fresult
end function

function convertScaleTypeToString(scaletype) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
character(kind=C_CHAR, len=:), allocatable :: swig_result
character(len=:), allocatable :: swig_result
integer(BelosScaleType), intent(in) :: scaletype
type(SwigArrayWrapper) :: fresult
integer(C_INT) :: farg1

farg1 = scaletype
fresult = swigc_convertScaleTypeToString(farg1)
call SWIG_chararray_to_string(fresult, swig_result)
call SWIGTM_fout_char_Sm_(fresult, swig_result)
call SWIG_free(fresult%data)
end function

function convertMsgTypeToString(msgtype) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
character(kind=C_CHAR, len=:), allocatable :: swig_result
character(len=:), allocatable :: swig_result
integer(BelosMsgType), intent(in) :: msgtype
type(SwigArrayWrapper) :: fresult
integer(C_INT) :: farg1

farg1 = msgtype
fresult = swigc_convertMsgTypeToString(farg1)
call SWIG_chararray_to_string(fresult, swig_result)
call SWIGTM_fout_char_Sm_(fresult, swig_result)
call SWIG_free(fresult%data)
end function

Expand Down Expand Up @@ -451,7 +450,7 @@ function swigf_DefaultSolverParameters_impTolScale_get() &
swig_result = fresult
end function

function swigf_create_DefaultSolverParameters() &
function swigf_new_DefaultSolverParameters() &
result(self)
use, intrinsic :: ISO_C_BINDING
type(DefaultSolverParameters) :: self
Expand All @@ -461,7 +460,7 @@ function swigf_create_DefaultSolverParameters() &
self%swigdata = fresult
end function

subroutine swigf_release_DefaultSolverParameters(self)
subroutine swigf_DefaultSolverParameters_release(self)
use, intrinsic :: ISO_C_BINDING
class(DefaultSolverParameters), intent(inout) :: self
type(SwigClassWrapper) :: farg1
Expand Down
Loading

0 comments on commit 3f5ff6d

Please sign in to comment.