Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Improve error message
[simgrid.git] / examples / smpi / NAS / BT / define.f
1 c---------------------------------------------------------------------
2 c---------------------------------------------------------------------
3
4       subroutine compute_buffer_size(dim)
5
6 c---------------------------------------------------------------------
7 c---------------------------------------------------------------------
8
9       include 'header.h'
10
11       integer  c, dim, face_size
12
13       if (ncells .eq. 1) return
14
15 c---------------------------------------------------------------------
16 c     compute the actual sizes of the buffers; note that there is 
17 c     always one cell face that doesn't need buffer space, because it 
18 c     is at the boundary of the grid
19 c---------------------------------------------------------------------
20       west_size = 0
21       east_size = 0
22
23       do   c = 1, ncells
24          face_size = cell_size(2,c) * cell_size(3,c) * dim * 2
25          if (cell_coord(1,c).ne.1) west_size = west_size + face_size
26          if (cell_coord(1,c).ne.ncells) east_size = east_size + 
27      >        face_size 
28       end do
29
30       north_size = 0
31       south_size = 0
32       do   c = 1, ncells
33          face_size = cell_size(1,c)*cell_size(3,c) * dim * 2
34          if (cell_coord(2,c).ne.1) south_size = south_size + face_size
35          if (cell_coord(2,c).ne.ncells) north_size = north_size + 
36      >        face_size 
37       end do
38
39       top_size = 0
40       bottom_size = 0
41       do   c = 1, ncells
42          face_size = cell_size(1,c) * cell_size(2,c) * dim * 2
43          if (cell_coord(3,c).ne.1) bottom_size = bottom_size + 
44      >        face_size
45          if (cell_coord(3,c).ne.ncells) top_size = top_size +
46      >        face_size     
47       end do
48
49       start_send_west   = 1
50       start_send_east   = start_send_west   + west_size
51       start_send_south  = start_send_east   + east_size
52       start_send_north  = start_send_south  + south_size
53       start_send_bottom = start_send_north  + north_size
54       start_send_top    = start_send_bottom + bottom_size
55       start_recv_west   = 1
56       start_recv_east   = start_recv_west   + west_size
57       start_recv_south  = start_recv_east   + east_size
58       start_recv_north  = start_recv_south  + south_size
59       start_recv_bottom = start_recv_north  + north_size
60       start_recv_top    = start_recv_bottom + bottom_size
61
62       return
63       end
64