-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpp.h
More file actions
99 lines (83 loc) · 2.38 KB
/
Copy pathpp.h
File metadata and controls
99 lines (83 loc) · 2.38 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include <ross.h>
#define TW_MAX_NAME_LEN 31
/* 2D grid */
#define NUM_CELLS_X 1024 //256
#define NUM_CELLS_Y 1024 //256
/* overlapping grid that divides 2D grid above into sections
each processor gets a section
ex. splitting x and y in half creates four quadrants,
one quadrant for each processor */
#define NUM_VP_X 256
#define NUM_VP_Y 256
typedef int Channel_t;
typedef int Min_t;
typedef int MethodName_t;
/* METHOD CASE [NAME] [NUMBER]*/
#define UPDATE_METHOD 0
#define PREDATOR_MSG 1
#define PREY_MSG 2
#define CELL_TICK 1.0
/********* User Entity Classes ******************************************/
/* define state of cell*/
struct State
{
int CellLocationX;
int CellLocationY;
int Predator;
int Prey;
int Grass;
//counter variables for number of predator/prey in/out of cell
int Predator_in;
int Predator_out;
int Prey_in;
int Prey_out;
};
/* reverse computing */
struct RC
{
int Predator;
int Prey;
int Grass;
int Predator_in;
int Predator_out;
int Prey_in;
int Prey_out;
};
/* ex. when prey or predator leaves space - send message
arrival prey / arrival predator and associated health factor */
struct Msg_Data
{
MethodName_t MethodName;
};
/* Cell Statistics */
struct CellStatistics
{
int Grass;
int Predator;
int Prey;
int Predator_in;
int Predator_out;
int Prey_in;
int Prey_out;
double Avg_Pred_amount;
double Avg_Prey_amount;
double Avg_Pred_in;
double Avg_Pred_out;
double Avg_Prey_in;
double Avg_Prey_out;
};
/* Function Declaration */
tw_lpid Cell_ComputeMove( tw_lpid lpid, int direction );
tw_peid CellMapping_lp_to_pe(tw_lpid lpid);
tw_lp *CellMapping_to_lp(tw_lpid lpid);
tw_lpid CellMapping_to_local_index(tw_lpid lpid);
void Cell_Init(struct State *SV, tw_lp * lp);
void Cell_EventHandler(struct State *SV, tw_bf * CV, struct Msg_Data *M, tw_lp * lp);
void RC_Cell_EventHandler(struct State *SV, tw_bf * CV, struct Msg_Data *M, tw_lp * lp);
void CellStatistics_CollectStats(struct State *, tw_lp *lp);
void CellStatistics_Compute();
void CellStatistics_Print();
void CellStatistics_Reduce();
/* Declare CellStats - make it global to the model */
struct CellStatistics TWAppStats;
tw_lpid nlp_per_pe = 0; //global variable - determines how many LPs are there per MPI rank