MONC
Functions/Subroutines
test_halo_communication_mod Module Reference

Functions/Subroutines

subroutine test_get_number_communication_requests
 
subroutine test_determine_halo_corner
 
subroutine test_determine_halo_corner_elements
 
subroutine test_get_pid_neighbour_location
 
subroutine test_pid_been_seen
 
subroutine test_retrieve_same_neighbour_information
 
subroutine test_perform_local_data_copy_for_dimension
 

Function/Subroutine Documentation

◆ test_determine_halo_corner()

subroutine test_halo_communication_mod::test_determine_halo_corner

Definition at line 37 of file test_halocommunication.F90.

38  type(local_grid_type) :: local_grid
39  integer :: halo_corner_size
40 
41  local_grid%halo_size(x_index)=2
42  local_grid%halo_size(y_index)=2
43  local_grid%size(z_index) = 10
44 
45  halo_corner_size = determine_halo_corner_size(local_grid)
46 
47  call assert_equals(10*2*2, halo_corner_size, "Test halo_size")
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_determine_halo_corner_elements()

subroutine test_halo_communication_mod::test_determine_halo_corner_elements

Definition at line 51 of file test_halocommunication.F90.

52  type(local_grid_type) :: local_grid
53  integer :: elemNumber
54  allocate( local_grid%corner_neighbours(4,2) )
55  local_grid%corner_neighbours(1,1) = 5
56  local_grid%corner_neighbours(2,2) = 5
57  local_grid%size(z_index) = 10
58  elemnumber = determine_halo_corner_element_sizes(local_grid, 5)
59 
60  !4 elements per corner*10 in Z direction
61  call assert_equals(10*4, elemnumber, "Test number elements halo_size")
62  ! if not PID elemNumber should be 0
63  elemnumber = determine_halo_corner_element_sizes(local_grid, 15)
64  call assert_equals(0, elemnumber, "Test number elements halo_size")
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_get_number_communication_requests()

subroutine test_halo_communication_mod::test_get_number_communication_requests

Definition at line 22 of file test_halocommunication.F90.

23  type(neighbour_description_type), dimension(:), allocatable :: halo_swap_neigh
24  integer :: i, requests
25  allocate(halo_swap_neigh(6))
26 
27  do i=1,5
28  halo_swap_neigh(i)%recv_size = i
29  halo_swap_neigh(i)%recv_corner_size = i
30  enddo
31 
32  requests = get_number_communication_requests(halo_swap_neigh, 5)
33  call assert_equals(10, requests, "Test number of requests")
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_get_pid_neighbour_location()

subroutine test_halo_communication_mod::test_get_pid_neighbour_location

Definition at line 68 of file test_halocommunication.F90.

69  type(local_grid_type) :: local_grid
70  type(neighbour_description_type), dimension(:), allocatable :: halo_swap_neigh
71  integer :: i, pids
72 
73  allocate(halo_swap_neigh(6))
74  do i=1,5
75  halo_swap_neigh(i)%pid = i
76  enddo
77  halo_swap_neigh(2)%pid=1
78  pids = get_pid_neighbour_location(halo_swap_neigh, 1, 5)
79 
80  call assert_equals(1, pids, "Test unique pid location")
81  pids = get_pid_neighbour_location(halo_swap_neigh, 10, 5)
82  call assert_equals(-1, pids, "Test pid location")
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_perform_local_data_copy_for_dimension()

subroutine test_halo_communication_mod::test_perform_local_data_copy_for_dimension

Definition at line 141 of file test_halocommunication.F90.

142  type(local_grid_type) :: local_grid
143  real(kind=default_precision), dimension(10,20,30) :: field_data
144  integer :: i,j,k
145 
146  allocate( local_grid%neighbours(3,4) )
147  ! start
148  local_grid%local_domain_start_index(z_index) = 1
149  local_grid%local_domain_start_index(y_index) = 11
150  local_grid%local_domain_start_index(x_index) = 21
151  ! end
152  local_grid%local_domain_end_index(z_index) = 10
153  local_grid%local_domain_end_index(y_index) = 20
154  local_grid%local_domain_end_index(x_index) = 30
155 
156  do j=1,3
157  do i =1,4
158  local_grid%neighbours(j,i) = i*j
159  enddo
160  enddo
161  do i=1,10
162  do j=1,20
163  do k=1,30
164  field_data(i,j,k) = i*j*k
165  enddo
166  enddo
167  enddo
168 
169  call assert_not_equals(field_data(1,2,21), field_data(1,10,21)&
170  , "Test fields are not equal before calling")
171  call perform_local_data_copy_for_dimension(x_index, 1, 1, local_grid, &
172  field_data)
173 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_pid_been_seen()

subroutine test_halo_communication_mod::test_pid_been_seen

Definition at line 86 of file test_halocommunication.F90.

87  integer :: neigh_pids(8)
88  logical :: seen
89  neigh_pids(1) = -1
90  neigh_pids(2) = 2
91  neigh_pids(3) = 0
92 
93  seen = has_pid_already_been_seen(neigh_pids, 1)
94  call assert_false( seen, "Test not seen if pid=-1" )
95  neigh_pids(1) = 0
96  seen = has_pid_already_been_seen(neigh_pids, 2)
97  call assert_true( seen, "Test seen when there is not -1 if pid=2" )
98  seen = has_pid_already_been_seen(neigh_pids, 0)
99  call assert_true( seen, "Test seen when there is not - 1 if pid=0" )
100 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_retrieve_same_neighbour_information()

subroutine test_halo_communication_mod::test_retrieve_same_neighbour_information

Definition at line 104 of file test_halocommunication.F90.

105  type(local_grid_type) :: local_grid
106  logical, dimension(3) :: retrieve_same_neigh_info
107  integer :: i
108  allocate( local_grid%neighbours(3,4) )
109  local_grid%halo_size(y_index) = 2
110  local_grid%halo_size(x_index) = 2
111 
112  local_grid%neighbours(y_index,1) = 2
113  local_grid%neighbours(y_index,2) = 2
114  local_grid%neighbours(y_index,3) = 8
115  local_grid%neighbours(y_index,4) = 8
116 
117  local_grid%neighbours(x_index,1) = 4
118  local_grid%neighbours(x_index,2) = 4
119  local_grid%neighbours(x_index,3) = 6
120  local_grid%neighbours(x_index,4) = 6
121 
122  retrieve_same_neigh_info = retrieve_same_neighbour_information(local_grid)
123 
124  call assert_true(retrieve_same_neigh_info(1),"Test Z")
125  call assert_false(retrieve_same_neigh_info(2),"Test Y")
126  call assert_false(retrieve_same_neigh_info(3),"Test Z")
127 
128 
129  local_grid%neighbours(y_index,3) = 2
130  local_grid%neighbours(y_index,4) = 2
131 
132  retrieve_same_neigh_info = retrieve_same_neighbour_information(local_grid)
133 
134  call assert_true(retrieve_same_neigh_info(1),"Test Z")
135  call assert_true(retrieve_same_neigh_info(2),"Test Y")
136  call assert_false(retrieve_same_neigh_info(3),"Test Z")
137 
Here is the call graph for this function:
Here is the caller graph for this function:
grids_mod::x_index
integer, parameter, public x_index
Definition: grids.F90:14
grids_mod::y_index
integer, parameter, public y_index
Definition: grids.F90:14
grids_mod::z_index
integer, parameter, public z_index
Grid index parameters.
Definition: grids.F90:14
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17