-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix.h
executable file
·65 lines (55 loc) · 1.38 KB
/
matrix.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef MATRIX_H
#define MATRIX_H
#define PERCENTAGE_FISH 50
#define PERCENTAGE_SHARKS 25
#define PERCENTAGE_EMPTY 25
#define EMPTY 0 //IDENTIFY THE EMPTY
#define FISH 1 //IDENTIFY THE FISH
#define SHARK 2 //IDENTIFY THE SHARK
#define BA_EMPTY 0 //BREEDING AGE EMPTY CELL
#define BA_FISH 2 //BREEDING AGE FISH CELL
#define BA_SHARK 3 //BREEDING AGE SHARK CELL
//DEFINE IF THE INITIAL MATRIX IS CREATED WITH SINGLE OR MULTI THREAD
#define SINGLE_TH_GENERATOR 1 //0: MULTI-THREAD GENERATOR 1: SINGLE THREAD GENERATOR
//DEFINE IF ENABLE OR NOT OPENMP
#define SEQUENTIAL_EXECUTION 0 //0: OPENMP ENABLE 1: OPENMP DISABLE
/**
* Indentify the single element
* - 2 bits for type of element:
* 1 => FISH
* 2 => SHARKS
* - 6 bits for the age: 2^6 = 64 << 20
* i use more bits than i need to reach 1 Byte per cell
* and simplify the allignament problem.
*/
struct cell{
uint8_t type:2;
uint8_t age:6;
};
class MyRandGen{
private:
int A;
public:
MyRandGen(int);
int gen(int);
};
class Matrix{
private:
int N;
long int NN;
int NT;
int M;
unsigned int* SEED;
cell** M1;
cell** M2;
void initialize();
public:
Matrix( int, int, int, int, int );
void _export(FILE*, cell**);
void _print(cell**);
void _free(cell**);
cell** _getM1();
cell** _getM2();
unsigned int* _getSEED();
};
#endif