5#include "test_macros.inc"
13 use,
INTRINSIC :: iso_c_binding
21 CHARACTER(KIND=c_char,LEN=*),
PARAMETER :: grid_filename = &
22 "test_read_icon_parallel_grid.nc" // c_null_char
25 SUBROUTINE write_test_grid_file_c ( grid_filename, coord_unit ) &
26 bind( c, name=
'write_test_grid_file_f2c' )
27 use,
INTRINSIC :: iso_c_binding, only : c_char, c_int
28 CHARACTER(KIND=c_char),
DIMENSION(*) :: grid_filename
29 INTEGER(KIND=c_int),
value :: coord_unit
30 END SUBROUTINE write_test_grid_file_c
34 SUBROUTINE c_unlink ( path ) bind ( c, name='unlink' )
35 use,
INTRINSIC :: iso_c_binding, only : c_char
36 CHARACTER(KIND=c_char),
DIMENSION(*) :: path
37 END SUBROUTINE c_unlink
40 INTEGER :: comm_size, comm_rank
50 CALL mpi_comm_size(mpi_comm_world, comm_size, ierror)
51 CALL mpi_comm_rank(mpi_comm_world, comm_rank, ierror)
53 CALL test(comm_size == 4)
55 CALL write_test_grid_file_c(grid_filename, 0_c_int)
62 INTEGER(KIND=c_int),
PARAMETER :: ref_num_cells(4) = (/11,9,14,9/)
63 INTEGER(KIND=c_int),
PARAMETER :: ref_num_vertices(4) = (/11,10,13,10/)
65 INTEGER(KIND=C_INT) :: num_vertices
66 INTEGER(KIND=C_INT) :: num_cells
67 TYPE(C_PTR) :: num_vertices_per_cell
68 TYPE(C_PTR) :: cell_to_vertex
69 TYPE(C_PTR) :: global_cell_id
70 TYPE(C_PTR) :: cell_owner
71 TYPE(C_PTR) :: global_vertex_ids
72 TYPE(C_PTR) :: vertex_owner
73 TYPE(C_PTR) :: x_vertices
74 TYPE(C_PTR) :: y_vertices
75 TYPE(C_PTR) :: x_cells
76 TYPE(C_PTR) :: y_cells
77 TYPE(C_PTR) :: cell_mask
80 grid_filename, mpi_comm_world, num_vertices, num_cells, &
81 num_vertices_per_cell, cell_to_vertex, global_cell_id, &
82 cell_owner, global_vertex_ids, vertex_owner, &
83 x_vertices, y_vertices, x_cells, y_cells, cell_mask)
85 CALL test(num_vertices == ref_num_vertices(comm_rank + 1))
86 CALL test(num_cells == ref_num_cells(comm_rank + 1))
106 TYPE(C_PTR) :: icon_grid
109 grid_filename, trim(
"icon_grid")//c_null_char, mpi_comm_world)
116 CALL mpi_barrier(mpi_comm_world, ierror)
117 IF (comm_rank == 0)
THEN
118 CALL c_unlink(grid_filename)
121 CALL mpi_finalize(ierror)
subroutine, public start_test(name)