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_6(double *g, int jbeg, int jfin1) {
14
15      int k;
16      size_t chunk;
17      double bufin[COMM_SIZE], bufout[COMM_SIZE];
18
19      rcce_curphase = 1;
20
21//c---------------------------------------------------------------------
22//c   communicate in the east and west directions
23//c---------------------------------------------------------------------
24
25//c---------------------------------------------------------------------
26//c   receive from east
27//c---------------------------------------------------------------------
28      if (jfin1 == ny) {
29        RCCE_recv((char*)bufin, nz*sizeof(double), east);
30
31        for (k=1; k<=nz; k++) {
32          g(ny+1,k) = bufin[k-1];
33        }
34
35      }
36
37//c---------------------------------------------------------------------
38//c   send west
39//c---------------------------------------------------------------------
40      if (jbeg == 1) {
41        for (k=1; k<=nz; k++) bufout[k-1] = g(1,k);
42
43        RCCE_send((char*)bufout, nz*sizeof(double), west);
44      }
45
46      return;
47}
48