MODULE Composite_Datatypes USE Precision USE ISO_C_BINDING USE Array_Descriptors IMPLICIT NONE PRIVATE PUBLIC :: ExtractComponent TYPE, PUBLIC :: Component_Pointer_i_sp INTEGER (KIND=i_sp), DIMENSION (:), POINTER :: component END TYPE TYPE, PUBLIC :: Component_Pointer_i_dp INTEGER (KIND=i_dp), DIMENSION (:), POINTER :: component END TYPE TYPE, PUBLIC :: Component_Pointer_r_sp REAL (KIND=r_sp), DIMENSION (:), POINTER :: component END TYPE TYPE, PUBLIC :: Component_Pointer_r_dp REAL (KIND=r_dp), DIMENSION (:), POINTER :: component END TYPE TYPE, PUBLIC :: Component_Pointer_l_word LOGICAL (KIND=l_word), DIMENSION (:), POINTER :: component END TYPE INTERFACE ExtractComponent MODULE PROCEDURE ExtractComponent_i_sp1 MODULE PROCEDURE ExtractComponent_i_dp1 MODULE PROCEDURE ExtractComponent_r_sp1 MODULE PROCEDURE ExtractComponent_r_dp1 MODULE PROCEDURE ExtractComponent_l_word1 MODULE PROCEDURE ExtractComponent_i_sp2 MODULE PROCEDURE ExtractComponent_i_dp2 MODULE PROCEDURE ExtractComponent_r_sp2 MODULE PROCEDURE ExtractComponent_r_dp2 MODULE PROCEDURE ExtractComponent_l_word2 MODULE PROCEDURE ExtractComponent_i_sp3 MODULE PROCEDURE ExtractComponent_i_dp3 MODULE PROCEDURE ExtractComponent_r_sp3 MODULE PROCEDURE ExtractComponent_r_dp3 MODULE PROCEDURE ExtractComponent_l_word3 MODULE PROCEDURE ExtractComponent_i_sp4 MODULE PROCEDURE ExtractComponent_i_dp4 MODULE PROCEDURE ExtractComponent_r_sp4 MODULE PROCEDURE ExtractComponent_r_dp4 MODULE PROCEDURE ExtractComponent_l_word4 MODULE PROCEDURE ExtractComponent_i_sp5 MODULE PROCEDURE ExtractComponent_i_dp5 MODULE PROCEDURE ExtractComponent_r_sp5 MODULE PROCEDURE ExtractComponent_r_dp5 MODULE PROCEDURE ExtractComponent_l_word5 END INTERFACE CONTAINS SUBROUTINE ExtractComponent_i_sp1 (components, component_pointer) TYPE (Component_Pointer_i_sp), DIMENSION (1), INTENT (IN) :: components INTEGER (KIND=i_sp), DIMENSION (:), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (1), upper_bounds (1), strides (1) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 1 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 1 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_dp1 (components, component_pointer) TYPE (Component_Pointer_i_dp), DIMENSION (1), INTENT (IN) :: components INTEGER (KIND=i_dp), DIMENSION (:), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (1), upper_bounds (1), strides (1) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 1 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 1 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_sp1 (components, component_pointer) TYPE (Component_Pointer_r_sp), DIMENSION (1), INTENT (IN) :: components REAL (KIND=r_sp), DIMENSION (:), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (1), upper_bounds (1), strides (1) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 1 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 1 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_dp1 (components, component_pointer) TYPE (Component_Pointer_r_dp), DIMENSION (1), INTENT (IN) :: components REAL (KIND=r_dp), DIMENSION (:), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (1), upper_bounds (1), strides (1) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 1 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 1 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_l_word1 (components, component_pointer) TYPE (Component_Pointer_l_word), DIMENSION (1), INTENT (IN) :: components LOGICAL (KIND=l_word), DIMENSION (:), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (1), upper_bounds (1), strides (1) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 1 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 1 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_sp2 (components, component_pointer) TYPE (Component_Pointer_i_sp), DIMENSION (2), INTENT (IN) :: components INTEGER (KIND=i_sp), DIMENSION (:, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (2), upper_bounds (2), strides (2) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 2 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 2 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_dp2 (components, component_pointer) TYPE (Component_Pointer_i_dp), DIMENSION (2), INTENT (IN) :: components INTEGER (KIND=i_dp), DIMENSION (:, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (2), upper_bounds (2), strides (2) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 2 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 2 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_sp2 (components, component_pointer) TYPE (Component_Pointer_r_sp), DIMENSION (2), INTENT (IN) :: components REAL (KIND=r_sp), DIMENSION (:, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (2), upper_bounds (2), strides (2) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 2 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 2 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_dp2 (components, component_pointer) TYPE (Component_Pointer_r_dp), DIMENSION (2), INTENT (IN) :: components REAL (KIND=r_dp), DIMENSION (:, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (2), upper_bounds (2), strides (2) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 2 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 2 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_l_word2 (components, component_pointer) TYPE (Component_Pointer_l_word), DIMENSION (2), INTENT (IN) :: components LOGICAL (KIND=l_word), DIMENSION (:, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (2), upper_bounds (2), strides (2) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 2 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 2 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_sp3 (components, component_pointer) TYPE (Component_Pointer_i_sp), DIMENSION (3), INTENT (IN) :: components INTEGER (KIND=i_sp), DIMENSION (:, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (3), upper_bounds (3), strides (3) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 3 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 3 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_dp3 (components, component_pointer) TYPE (Component_Pointer_i_dp), DIMENSION (3), INTENT (IN) :: components INTEGER (KIND=i_dp), DIMENSION (:, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (3), upper_bounds (3), strides (3) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 3 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 3 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_sp3 (components, component_pointer) TYPE (Component_Pointer_r_sp), DIMENSION (3), INTENT (IN) :: components REAL (KIND=r_sp), DIMENSION (:, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (3), upper_bounds (3), strides (3) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 3 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 3 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_dp3 (components, component_pointer) TYPE (Component_Pointer_r_dp), DIMENSION (3), INTENT (IN) :: components REAL (KIND=r_dp), DIMENSION (:, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (3), upper_bounds (3), strides (3) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 3 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 3 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_l_word3 (components, component_pointer) TYPE (Component_Pointer_l_word), DIMENSION (3), INTENT (IN) :: components LOGICAL (KIND=l_word), DIMENSION (:, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (3), upper_bounds (3), strides (3) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 3 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 3 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_sp4 (components, component_pointer) TYPE (Component_Pointer_i_sp), DIMENSION (4), INTENT (IN) :: components INTEGER (KIND=i_sp), DIMENSION (:, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (4), upper_bounds (4), strides (4) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 4 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 4 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_dp4 (components, component_pointer) TYPE (Component_Pointer_i_dp), DIMENSION (4), INTENT (IN) :: components INTEGER (KIND=i_dp), DIMENSION (:, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (4), upper_bounds (4), strides (4) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 4 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 4 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_sp4 (components, component_pointer) TYPE (Component_Pointer_r_sp), DIMENSION (4), INTENT (IN) :: components REAL (KIND=r_sp), DIMENSION (:, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (4), upper_bounds (4), strides (4) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 4 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 4 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_dp4 (components, component_pointer) TYPE (Component_Pointer_r_dp), DIMENSION (4), INTENT (IN) :: components REAL (KIND=r_dp), DIMENSION (:, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (4), upper_bounds (4), strides (4) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 4 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 4 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_l_word4 (components, component_pointer) TYPE (Component_Pointer_l_word), DIMENSION (4), INTENT (IN) :: components LOGICAL (KIND=l_word), DIMENSION (:, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (4), upper_bounds (4), strides (4) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 4 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 4 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_sp5 (components, component_pointer) TYPE (Component_Pointer_i_sp), DIMENSION (5), INTENT (IN) :: components INTEGER (KIND=i_sp), DIMENSION (:, :, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (5), upper_bounds (5), strides (5) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 5 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 5 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_i_dp5 (components, component_pointer) TYPE (Component_Pointer_i_dp), DIMENSION (5), INTENT (IN) :: components INTEGER (KIND=i_dp), DIMENSION (:, :, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (5), upper_bounds (5), strides (5) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 5 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 5 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_sp5 (components, component_pointer) TYPE (Component_Pointer_r_sp), DIMENSION (5), INTENT (IN) :: components REAL (KIND=r_sp), DIMENSION (:, :, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (5), upper_bounds (5), strides (5) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 5 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 5 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_r_dp5 (components, component_pointer) TYPE (Component_Pointer_r_dp), DIMENSION (5), INTENT (IN) :: components REAL (KIND=r_dp), DIMENSION (:, :, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (5), upper_bounds (5), strides (5) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 5 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 5 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE SUBROUTINE ExtractComponent_l_word5 (components, component_pointer) TYPE (Component_Pointer_l_word), DIMENSION (5), INTENT (IN) :: components LOGICAL (KIND=l_word), DIMENSION (:, :, :, :, :), POINTER :: component_pointer INTEGER (KIND=C_INT) :: lower_bounds (5), upper_bounds (5), strides (5) INTEGER :: dim INTEGER (KIND=C_ADDRESS) :: base_address base_address = C_LOC (components(1)%component) DO dim = 1, 5 IF (Int(SIZE(components(dim)%component), KIND=i_wp) > 1) THEN strides (dim) = C_STRIDE (var1=components(dim)%component(1), var2=components(dim)%component(2)) ELSE strides (dim) = 1 END IF WRITE (*,*) "dim=", dim, " stride=", strides (dim) END DO DO dim = 1, 5 lower_bounds (dim) = Int (LBOUND(components(dim)%component, dim=1), KIND=i_wp) upper_bounds (dim) = Int (UBOUND(components(dim)%component, dim=1), KIND=i_wp) END DO CALL MakeArrayDescriptor (component_pointer, base_address, lower_bounds, upper_bounds, strides) END SUBROUTINE END MODULE Composite_Datatypes