Skip to content

Commit

Permalink
saving progress
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Jun 3, 2024
1 parent 1eb28d5 commit b7e001b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fortran/test/fetch_content_integration/test_tuvx_api.F90
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ subroutine test_tuvx_solve()
! radiators = tuvx%create_radiators( )

! update conditions for each time step
! grid => grids%get( "height", "m" )
grid => grids%get( "height", "m", error )
ASSERT( error%is_success() )
! grid%edges_(:) = some_input_array(:)
! grid%mid_points_(:) = more_input_data(:)

Expand Down
24 changes: 23 additions & 1 deletion fortran/tuvx.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ function get_grid_map_c(tuvx, error) bind(C, name="get_grid_map")
type(error_t_c), intent(inout) :: error
type(c_ptr) :: get_grid_map_c
end function get_grid_map_c

function get_grid_c(grid_map, grid_name, grid_units, error) bind(C, name="get_grid")
use musica_util, only: error_t_c
import c_ptr
type(c_ptr), value, intent(in) :: grid_map
type(error_t_c), intent(inout) :: error
type(c_ptr) :: get_grid_c
end function get_grid_c
end interface

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand All @@ -55,6 +63,8 @@ end function get_grid_map_c
type :: grid_map_t
type(c_ptr), private :: ptr
contains
! get a reference to a grid
procedure :: get_grid => get
! Deallocate the tuvx instance
final :: finalize_grid_map_t
end type grid_map_t
Expand All @@ -80,6 +90,18 @@ function grid_map_t_constructor() result(this)
this%ptr = c_null_ptr
end function grid_map_t_constructor

subroutine get(this, grid, error)
use musica_util, only: error_t, error_t_c
type(grid_map_t), intent(inout) :: this
type(grid_t), pointer :: grid
type(error_t), intent(inout) :: error
type(error_t_c) :: error_c

grid = grid_t()
grid%ptr = get_grid_c(this%ptr, error_c)
error = error_t(error_c)
end subroutine get

subroutine finalize_grid_map_t(this)
type(grid_map_t), intent(inout) :: this

Expand Down Expand Up @@ -130,7 +152,7 @@ function get_grids(this, error) result(grid_map)

grid_map = grid_map_t()
grid_map%ptr = get_grid_map_c(this%ptr, error_c)

error = error_t(error_c)

end function get_grids
Expand Down

0 comments on commit b7e001b

Please sign in to comment.