-
Notifications
You must be signed in to change notification settings - Fork 0
/
subgrid.h
44 lines (39 loc) · 1002 Bytes
/
subgrid.h
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
#ifndef SUBGRID
#define SUBGRID
#include <mpi.h>
typedef int PRANK;
struct subgrid {
const int w;
const int h;
double j;
double field;
int* grid;
int* ghost_top;
int* ghost_bottom;
int& point(int x, int y);
void tick();
void conclude();
subgrid(int w, int h, double j, double field);
~subgrid();
MPI_Request* bottom_send;
MPI_Request* bottom_receive;
MPI_Request* top_send;
MPI_Request* top_receive;
struct {
MPI_Request list[4];
inline int n() {return 4;}
inline MPI_Request* top_send() {return list+0;}
inline MPI_Request* bot_send() {return list+1;}
inline MPI_Request* top_recv() {return list+2;}
inline MPI_Request* bot_recv() {return list+3;}
} requests;
int psize;
PRANK prank;
PRANK prev;
PRANK next;
int& left_neigh(int x, int y);
int& right_neigh(int x, int y);
int& top_neigh(int x, int y);
int& bottom_neigh(int x, int y);
};
#endif