1#include "RCCE.h"
2#include <stdlib.h>
3#include <stdio.h>
4#include "directions.h"
5#include "applu_share.h"
6#include "applu_macros.h"
7
8#define g(i,j) g[i+(isiz2+2)*(j)]
9#define COMM_SIZE 1024
10
11extern int rcce_curphase;
12
13void exchange_5(double *g, int ibeg, int ifin1) {
14
15
16      int k;
17      size_t chunk;
18      double bufin[COMM_SIZE], bufout[COMM_SIZE];
19
20      rcce_curphase = 0;
21
22//c---------------------------------------------------------------------
23//c   communicate in the south and north directions
24//c---------------------------------------------------------------------
25
26//c---------------------------------------------------------------------
27//c   receive from south
28//c---------------------------------------------------------------------
29      if (ifin1 == nx) {
30        RCCE_recv((char*)bufin, nz*sizeof(double), south);
31
32        for (k=1; k<=nz; k++) g(nx+1,k) = bufin[k-1];
33      }
34
35//c---------------------------------------------------------------------
36//c   send north
37//c---------------------------------------------------------------------
38      if (ibeg == 1) {
39        for (k=1; k<=nz; k++) bufout[k-1] = g(1,k);
40
41        RCCE_send((char*)bufout, nz*sizeof(double), north);
42      }
43
44      return;
45}
46
47