YAC 3.18.0
Yet Another Coupler
Loading...
Searching...
No Matches
test_def_mask.F90
Go to the documentation of this file.
1! Copyright (c) 2024 The YAC Authors
2!
3! SPDX-License-Identifier: BSD-3-Clause
4
8
9#include "test_macros.inc"
10
12
13 use utest
14 use yac
15
16 implicit none
17
18 integer :: comp_id
19 integer :: grid_id
20 integer :: mask_id
21 integer :: location
22
23 integer, parameter :: nbr_points = 2
24
25 integer, parameter :: nbr_vertices = 6
26 integer, parameter :: nbr_cells = 2
27 integer, parameter :: nbr_vertices_per_cell = 4
28 integer :: cell_to_vertex(nbr_vertices_per_cell,nbr_cells)
29
30#ifdef __use_REAL
31 real :: x_vertices(nbr_vertices)
32 real :: y_vertices(nbr_vertices)
33#else
34 double precision :: x_vertices(nbr_vertices)
35 double precision :: y_vertices(nbr_vertices)
36#endif
37
38 integer :: is_valid(nbr_points)
39
40 call yac_finit ( )
41
42 ! set up dummy component
43 call yac_fdef_comp ( "ICON-ocean", comp_id )
44
45 print *, ' def_comp returned comp_id ', comp_id
46 call test ( comp_id /= -99 )
47
48 ! uniform unstructured grid
49
50 ! 1-------2
51 ! | |
52 ! | 1 |
53 ! | |
54 ! 3-------4
55 ! | |
56 ! | 2 |
57 ! | |
58 ! 5-------6
59
60 x_vertices(1) = -0.5; y_vertices(1) = 1.0
61 x_vertices(2) = 0.5; y_vertices(2) = 1.0
62 x_vertices(3) = -0.5; y_vertices(3) = 0.0
63 x_vertices(4) = 0.5; y_vertices(4) = 0.0
64 x_vertices(5) = -0.5; y_vertices(5) = -1.0
65 x_vertices(6) = 0.5; y_vertices(6) = -1.0
66
67 cell_to_vertex(1,1) = 1
68 cell_to_vertex(2,1) = 3
69 cell_to_vertex(3,1) = 4
70 cell_to_vertex(4,1) = 2
71 cell_to_vertex(1,2) = 3
72 cell_to_vertex(2,2) = 5
73 cell_to_vertex(3,2) = 6
74 cell_to_vertex(4,2) = 4
75
76 grid_id = -99
77
78 call yac_fdef_grid ( 'grid1', &
79 nbr_vertices, &
80 nbr_cells, &
81 nbr_vertices_per_cell, &
82 x_vertices, &
83 y_vertices, &
84 cell_to_vertex, &
85 grid_id )
86
87 print *, ' def_grid returned grid_id ', grid_id
88 call test ( grid_id /= -99 )
89
90 call start_test("def_points")
91
92 location = yac_location_cell ! one point per cell
93
94 is_valid(1) = 0
95 is_valid(2) = 1
96
97 mask_id = -99
98
99 call yac_fdef_mask ( grid_id, &
100 nbr_points, &
101 location, &
102 is_valid, &
103 mask_id )
104
105 print *, ' def_mask_id returned mask_id ', mask_id
106 call test ( mask_id /= -99 )
107
108 call yac_ffinalize ( )
109
110 call stop_test
111
112 call exit_tests
113
114end program test_def_points
Fortran interface for the definition of grids.
Fortran interface for the definition of masks.
Fortran interface for the coupler termination.
Definition utest.F90:5
subroutine, public start_test(name)
Definition utest.F90:20
subroutine, public stop_test()
Definition utest.F90:27
subroutine, public exit_tests()
Definition utest.F90:81
@ yac_location_cell
program test_def_points