Skip to content

Commit

Permalink
Expose node_set_external*_detailed to Fortran API (#1157)
Browse files Browse the repository at this point in the history
* Fortran: add wrappers for *_ptr_detailed calls

* Fortran: add tests for node_set_external_int{32,64}_*_ptr_detailed calls

* Fortran: add tests for node_set_external_float{32,64}_*_ptr_detailed calls
  • Loading branch information
ChristosT committed Aug 4, 2023
1 parent 3b86092 commit 3ca27b8
Show file tree
Hide file tree
Showing 3 changed files with 665 additions and 9 deletions.
215 changes: 206 additions & 9 deletions src/libs/conduit/fortran/conduit_fortran.F90
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,22 @@ subroutine conduit_node_set_external_int32_ptr(cnode, data, num_elements) &
integer(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
end subroutine conduit_node_set_external_int32_ptr


!--------------------------------------------------------------------------
subroutine conduit_node_set_external_int32_ptr_detailed(cnode, data, num_elements, &
offset, stride, element_bytes,endianness) &
bind(C, name="conduit_node_set_external_int32_ptr_detailed")
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
integer(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
end subroutine conduit_node_set_external_int32_ptr_detailed

!--------------------------------------------------------------------------
! int32 set_path
!--------------------------------------------------------------------------
Expand Down Expand Up @@ -633,7 +648,23 @@ subroutine c_conduit_node_set_path_external_int32_ptr(cnode, path, data, num_ele
integer(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
end subroutine c_conduit_node_set_path_external_int32_ptr


!--------------------------------------------------------------------------
subroutine c_conduit_node_set_path_external_int32_ptr_detailed(cnode, path, data, num_elements, &
offset, stride, element_bytes,endianness) &
bind(C, name="conduit_node_set_path_external_int32_ptr_detailed")
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
character(kind=C_CHAR), intent(IN) :: path(*)
integer(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
end subroutine c_conduit_node_set_path_external_int32_ptr_detailed


!--------------------------------------------------------------------------
! int32 as
Expand Down Expand Up @@ -725,7 +756,22 @@ subroutine conduit_node_set_external_int64_ptr(cnode, data, num_elements) &
integer(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
end subroutine conduit_node_set_external_int64_ptr


!--------------------------------------------------------------------------
subroutine conduit_node_set_external_int64_ptr_detailed(cnode, data, num_elements, &
offset, stride, element_bytes,endianness) &
bind(C, name="conduit_node_set_external_int64_ptr_detailed")
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
integer(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
end subroutine conduit_node_set_external_int64_ptr_detailed

!--------------------------------------------------------------------------
! int64 set_path
!--------------------------------------------------------------------------
Expand Down Expand Up @@ -764,6 +810,21 @@ subroutine c_conduit_node_set_path_external_int64_ptr(cnode, path, data, num_ele
end subroutine c_conduit_node_set_path_external_int64_ptr


!--------------------------------------------------------------------------
subroutine c_conduit_node_set_path_external_int64_ptr_detailed(cnode, path, data, num_elements, &
offset, stride, element_bytes,endianness) &
bind(C, name="conduit_node_set_path_external_int64_ptr_detailed")
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
character(kind=C_CHAR), intent(IN) :: path(*)
integer(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
end subroutine c_conduit_node_set_path_external_int64_ptr_detailed
!--------------------------------------------------------------------------
! int64 as
!--------------------------------------------------------------------------
Expand Down Expand Up @@ -855,7 +916,22 @@ subroutine conduit_node_set_external_float32_ptr(cnode, data, num_elements) &
real(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
end subroutine conduit_node_set_external_float32_ptr


!--------------------------------------------------------------------------
subroutine conduit_node_set_external_float32_ptr_detailed(cnode, data, num_elements, &
offset, stride, element_bytes,endianness) &
bind(C, name="conduit_node_set_external_float32_ptr_detailed")
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
real(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
end subroutine conduit_node_set_external_float32_ptr_detailed

!--------------------------------------------------------------------------
! float32 set_path
!--------------------------------------------------------------------------
Expand Down Expand Up @@ -894,6 +970,21 @@ subroutine c_conduit_node_set_path_external_float32_ptr(cnode, path, data, num_e
end subroutine c_conduit_node_set_path_external_float32_ptr


!--------------------------------------------------------------------------
subroutine c_conduit_node_set_path_external_float32_ptr_detailed(cnode, path, data, num_elements, &
offset, stride, element_bytes,endianness) &
bind(C, name="conduit_node_set_path_external_float32_ptr_detailed")
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
character(kind=C_CHAR), intent(IN) :: path(*)
real(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
end subroutine c_conduit_node_set_path_external_float32_ptr_detailed
!--------------------------------------------------------------------------
! float32 as
!--------------------------------------------------------------------------
Expand Down Expand Up @@ -985,7 +1076,22 @@ subroutine conduit_node_set_external_float64_ptr(cnode, data, num_elements) &
real(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
end subroutine conduit_node_set_external_float64_ptr


!--------------------------------------------------------------------------
subroutine conduit_node_set_external_float64_ptr_detailed(cnode, data, num_elements,&
offset, stride, element_bytes,endianness) &
bind(C, name="conduit_node_set_external_float64_ptr_detailed")
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
real(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
end subroutine conduit_node_set_external_float64_ptr_detailed

!--------------------------------------------------------------------------
! float64 set_path
!--------------------------------------------------------------------------
Expand Down Expand Up @@ -1022,7 +1128,24 @@ subroutine c_conduit_node_set_path_external_float64_ptr(cnode, path, data, num_e
real(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
end subroutine c_conduit_node_set_path_external_float64_ptr



!--------------------------------------------------------------------------
subroutine c_conduit_node_set_path_external_float64_ptr_detailed(cnode, path, data, num_elements, &
offset, stride, element_bytes,endianness) &
bind(C, name="conduit_node_set_path_external_float64_ptr_detailed")
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
character(kind=C_CHAR), intent(IN) :: path(*)
real(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
end subroutine c_conduit_node_set_path_external_float64_ptr_detailed


!--------------------------------------------------------------------------
! float64 as
Expand Down Expand Up @@ -1944,6 +2067,24 @@ subroutine conduit_node_set_path_external_int32_ptr(cnode, path, data, num_eleme
call c_conduit_node_set_path_external_int32_ptr(cnode, trim(path) // C_NULL_CHAR, data, num_elements)
end subroutine conduit_node_set_path_external_int32_ptr

!--------------------------------------------------------------------------
subroutine conduit_node_set_path_external_int32_ptr_detailed(cnode, path, data, num_elements, &
offset, stride, element_bytes,endianness)
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
character(*), intent(IN) :: path
integer(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
!---
call c_conduit_node_set_path_external_int32_ptr_detailed(cnode, trim(path) // C_NULL_CHAR, data, &
num_elements, offset, stride, element_bytes, endianness)
end subroutine conduit_node_set_path_external_int32_ptr_detailed

!--------------------------------------------------------------------------
function conduit_node_fetch_path_as_int32(cnode, path) result(res)
use iso_c_binding
Expand Down Expand Up @@ -2018,7 +2159,26 @@ subroutine conduit_node_set_path_external_int64_ptr(cnode, path, data, num_eleme
!---
call c_conduit_node_set_path_external_int64_ptr(cnode, trim(path) // C_NULL_CHAR, data, num_elements)
end subroutine conduit_node_set_path_external_int64_ptr



!--------------------------------------------------------------------------
subroutine conduit_node_set_path_external_int64_ptr_detailed(cnode, path, data, num_elements,&
offset, stride, element_bytes,endianness)
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
character(*), intent(IN) :: path
integer(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
!---
call c_conduit_node_set_path_external_int64_ptr_detailed(cnode, trim(path) // C_NULL_CHAR, data,&
num_elements, offset, stride, element_bytes,endianness)
end subroutine conduit_node_set_path_external_int64_ptr_detailed


!--------------------------------------------------------------------------
function conduit_node_fetch_path_as_int64(cnode, path) result(res)
Expand Down Expand Up @@ -2095,7 +2255,25 @@ subroutine conduit_node_set_path_external_float32_ptr(cnode, path, data, num_ele
!---
call c_conduit_node_set_path_external_float32_ptr(cnode, trim(path) // C_NULL_CHAR, data, num_elements)
end subroutine conduit_node_set_path_external_float32_ptr


!--------------------------------------------------------------------------
subroutine conduit_node_set_path_external_float32_ptr_detailed(cnode, path, data, num_elements,&
offset, stride, element_bytes,endianness)
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
character(*), intent(IN) :: path
real(4), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
!---
call c_conduit_node_set_path_external_float32_ptr_detailed(cnode, trim(path) // C_NULL_CHAR, data, &
num_elements, offset, stride, element_bytes,endianness)
end subroutine conduit_node_set_path_external_float32_ptr_detailed


!--------------------------------------------------------------------------
function conduit_node_fetch_path_as_float32(cnode, path) result(res)
Expand Down Expand Up @@ -2173,7 +2351,26 @@ subroutine conduit_node_set_path_external_float64_ptr(cnode, path, data, num_ele
!---
call c_conduit_node_set_path_external_float64_ptr(cnode, trim(path) // C_NULL_CHAR, data, num_elements)
end subroutine conduit_node_set_path_external_float64_ptr



!--------------------------------------------------------------------------
subroutine conduit_node_set_path_external_float64_ptr_detailed(cnode, path, data, num_elements,&
offset, stride, element_bytes,endianness)
use iso_c_binding
implicit none
type(C_PTR), value, intent(IN) :: cnode
character(*), intent(IN) :: path
real(8), intent (IN), dimension (*) :: data
integer(C_SIZE_T), value, intent(in) :: num_elements
integer(C_SIZE_T), value, intent(in) :: offset
integer(C_SIZE_T), value, intent(in) :: stride
integer(C_SIZE_T), value, intent(in) :: element_bytes
integer(C_SIZE_T), value, intent(in) :: endianness
!---
call c_conduit_node_set_path_external_float64_ptr_detailed(cnode, trim(path) // C_NULL_CHAR, data, &
num_elements, offset, stride, element_bytes,endianness)
end subroutine conduit_node_set_path_external_float64_ptr_detailed


!--------------------------------------------------------------------------
function conduit_node_fetch_path_as_float64(cnode, path) result(res)
Expand Down

0 comments on commit 3ca27b8

Please sign in to comment.