Skip to content

Commit

Permalink
fortran bindings: handle MaterialDataManager integration with options…
Browse files Browse the repository at this point in the history
… object
  • Loading branch information
pbouda95 committed Aug 11, 2023
1 parent 934c9f2 commit 438abcd
Showing 1 changed file with 125 additions and 1 deletion.
126 changes: 125 additions & 1 deletion bindings/fortran/src/mgis_behaviour.f95
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ module mgis_behaviour
enumerator :: INTEGRATION_TANGENT_OPERATOR = 3
enumerator :: INTEGRATION_CONSISTENT_TANGENT_OPERATOR = 4
end enum
enum, bind(C)
enumerator :: INTEGRATION_WITHOUT_SPEED_OF_SOUND = 0
enumerator :: INTEGRATION_WITH_SPEED_OF_SOUND = 1
end enum
enum, bind(C)
enumerator :: CAUCHY = 0
enumerator :: PK2 = 1
Expand Down Expand Up @@ -82,6 +86,10 @@ module mgis_behaviour
private
type(c_ptr) :: ptr = c_null_ptr
end type MaterialStateManager
type :: BehaviourIntegrationOptions
private
type(c_ptr) :: ptr = c_null_ptr
end type BehaviourIntegrationOptions
type :: MaterialDataManagerInitializer
private
type(c_ptr) :: ptr = c_null_ptr
Expand Down Expand Up @@ -2620,6 +2628,93 @@ end function free_material_data_manager_initializer_wrapper
end if
end function free_material_data_manager_initializer
!
function create_behaviour_integration_options(o) result(s)
use mgis_fortran_utilities
use mgis, only: mgis_status, report_failure
implicit none
interface
function create_behaviour_integration_options_wrapper(ptr) &
bind(c,name = 'mgis_bv_create_behaviour_integration_options') &
result(r)
use, intrinsic :: iso_c_binding, only: c_ptr
use mgis, only: mgis_status
implicit none
type(c_ptr), intent(out) :: ptr
type(mgis_status) :: r
end function create_behaviour_integration_options_wrapper
end interface
type(BehaviourIntegrationOptions), intent(out) :: o
type(mgis_status) :: s
s = create_behaviour_integration_options_wrapper(o%ptr)
end function create_behaviour_integration_options
!
function behaviour_integration_options_set_speed_of_sound_flag(o, ss) result(s)
use, intrinsic :: iso_c_binding, only: c_int
use mgis_fortran_utilities
use mgis, only: mgis_status, report_failure
implicit none
interface
function bin_opts_set_speed_of_sound_flag_wrapper(o, ss) &
bind(c,name = 'mgis_bv_behaviour_integration_options_set_speed_of_sound_flag') &
result(r)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
use mgis, only: mgis_status
implicit none
type(c_ptr), intent(in), value :: o
integer(kind=c_int), intent(in),value :: ss
type(mgis_status) :: r
end function bin_opts_set_speed_of_sound_flag_wrapper
end interface
type(BehaviourIntegrationOptions), intent(in) :: o
integer(kind=c_int), intent(in) :: ss
type(mgis_status) :: s
s = bin_opts_set_speed_of_sound_flag_wrapper(o%ptr,ss)
end function behaviour_integration_options_set_speed_of_sound_flag
!
function behaviour_integration_options_set_integration_type(o, ss) result(s)
use, intrinsic :: iso_c_binding, only: c_int
use mgis_fortran_utilities
use mgis, only: mgis_status, report_failure
implicit none
interface
function bin_opts_set_integration_type_wrapper(o, ss) &
bind(c,name = 'mgis_bv_behaviour_integration_options_set_integration_type') &
result(r)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
use mgis, only: mgis_status
implicit none
type(c_ptr), intent(in), value :: o
integer(kind=c_int), intent(in),value :: ss
type(mgis_status) :: r
end function bin_opts_set_integration_type_wrapper
end interface
type(BehaviourIntegrationOptions), intent(in) :: o
integer(kind=c_int), intent(in) :: ss
type(mgis_status) :: s
s = bin_opts_set_integration_type_wrapper(o%ptr,ss)
end function behaviour_integration_options_set_integration_type
!
function free_behaviour_integration_options(ptr) result(r)
use, intrinsic :: iso_c_binding, only: c_associated
use mgis
implicit none
interface
function free_behaviour_integration_options_wrapper(ptr) &
bind(c, name='mgis_bv_free_behaviour_integration_options') result(r)
use, intrinsic :: iso_c_binding, only: c_ptr
use mgis
implicit none
type(c_ptr), intent(inout) :: ptr
type(mgis_status) :: r
end function free_behaviour_integration_options_wrapper
end interface
type(BehaviourIntegrationOptions), intent(inout) :: ptr
type(mgis_status) :: r
if (c_associated(ptr%ptr)) then
r = free_behaviour_integration_options_wrapper(ptr%ptr)
end if
end function free_behaviour_integration_options
!
function create_material_data_manager(d, b, n) result(s)
use, intrinsic :: iso_c_binding, only: c_size_t
use mgis_fortran_utilities
Expand Down Expand Up @@ -2806,7 +2901,7 @@ function mdm_use_array_of_speed_of_sounds_wrapper(d, p, n) &
end function mdm_use_array_of_speed_of_sounds_wrapper
end interface
type(MaterialDataManager), intent(in) :: d
real(kind=8), dimension(:,:), target, intent(out) :: p
real(kind=8), dimension(*), target, intent(out) :: p
integer, intent(in) :: n
type(mgis_status) :: r
type(c_ptr) p_ptr
Expand Down Expand Up @@ -3445,6 +3540,35 @@ end function integrate_material_data_manager_wrapper
type(mgis_status) :: s
s = integrate_material_data_manager_wrapper(r, p%ptr, m%ptr, i, dt)
end function integrate_material_data_manager
!
function integrate_material_data_manager_with_options(r, p, m, i, dt) result(s)
use, intrinsic :: iso_c_binding, only: c_size_t
use mgis_fortran_utilities, only: convert_to_c_index
use mgis, only: ThreadPool, mgis_status, report_failure
implicit none
interface
function integrate_material_data_manager_with_options_wrapper(r, p, m, i, dt) &
bind(c,name = 'mgis_bv_integrate_material_data_manager_with_options') &
result(s)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int, c_double
use mgis, only: mgis_status
implicit none
integer(kind=c_int), intent(out) :: r
type(c_ptr), intent(in),value :: p
type(c_ptr), intent(in),value :: m
type(c_ptr), intent(in),value :: i
real(kind = c_double), intent(in),value :: dt
type(mgis_status) :: s
end function integrate_material_data_manager_with_options_wrapper
end interface
integer, intent(out) :: r
type(ThreadPool), intent(in) :: p
type(MaterialDataManager), intent(in) :: m
type(BehaviourIntegrationOptions), intent(in) :: i
real(kind = 8), intent(in) :: dt
type(mgis_status) :: s
s = integrate_material_data_manager_with_options_wrapper(r, p%ptr, m%ptr, i%ptr, dt)
end function integrate_material_data_manager_with_options
!
function integrate_material_data_manager_part(r, m, i, dt, ni, ne) result(s)
use, intrinsic :: iso_c_binding, only: c_size_t
Expand Down

0 comments on commit 438abcd

Please sign in to comment.