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