-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDefines.h
122 lines (102 loc) · 4.26 KB
/
Defines.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/////////////////////////////////////////////////////////////////////////////////////////
//
// gro is protected by the UW OPEN SOURCE LICENSE, which is summarized here.
// Please see the file LICENSE.txt for the complete license.
//
// THE SOFTWARE (AS DEFINED BELOW) AND HARDWARE DESIGNS (AS DEFINED BELOW) IS PROVIDED
// UNDER THE TERMS OF THIS OPEN SOURCE LICENSE (“LICENSE”). THE SOFTWARE IS PROTECTED
// BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THIS SOFTWARE OTHER THAN AS
// AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
//
// BY EXERCISING ANY RIGHTS TO THE SOFTWARE AND/OR HARDWARE PROVIDED HERE, YOU ACCEPT AND
// AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE
// CONSIDERED A CONTRACT, THE UNIVERSITY OF WASHINGTON (“UW”) GRANTS YOU THE RIGHTS
// CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
//
// TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
//
//
#ifndef _DEFINES_H_
#define _DEFINES_H_
#define MAX_STATE_NUM 10
#define DAMPING 0.001f
#define ITERATIONS 100
#define SLEEP_TICKS 16
#define ELASTIC 0.1f
#define FRICTION 0.0f
#define WIDTH 10.0f
#define THRESHOLD 40.0f
#define MASS 1.0f
// set in world
#define DEFAULT_CHIP_DT 0.005 // chipmunk time units
#define DEFAULT_SIM_DT 0.02 // minutes
// set in ecoli
#define DEFAULT_ECOLI_GROWTH_RATE 0.0346574 // reactions / min
#define DEFAULT_ECOLI_INIT_SIZE 1.57 // fl
#define DEFAULT_ECOLI_DIV_SIZE_MEAN 3.14 // fl
#define DEFAULT_ECOLI_DIV_SIZE_VAR 0.005 // um
#define DEFAULT_ECOLI_DIAMETER 1.0 // um
#define DEFAULT_ECOLI_SCALE 10.0 // pixels / um
#define MAKE_VERTS cpVect verts[] = { \
cpv ( -size/2+WIDTH/3, -WIDTH/2 ), \
cpv ( -size/2, -WIDTH/6 ), \
cpv ( -size/2, WIDTH/6 ), \
cpv ( -size/2+WIDTH/3, WIDTH/2), \
cpv ( size/2-WIDTH/3, WIDTH/2 ), \
cpv ( size/2, WIDTH/6 ), \
cpv ( size/2, -WIDTH/6 ), \
cpv ( size/2-WIDTH/3, -WIDTH/2 ) \
};
static inline cpFloat frand(void) { return (cpFloat)rand()/(cpFloat)RAND_MAX; }
#define DBG { \
printf ( "Debug statement: reached %s, line %d\n", \
__FILE__, __LINE__); \
fflush ( stdout ); \
}
#define ASSERT(_cond_) { \
if ( ! ( _cond_ ) ) { \
fprintf (stderr, "Internal error: assertion '%s' failed at %s, line %d\n", \
#_cond_ , __FILE__, __LINE__); \
exit ( -1 ); \
} \
}
#define ASSERT_MSG(_cond_,_msg_...) { \
if ( ! ( _cond_ ) ) { \
fprintf ( stderr, "Internal error: assertion '%s' failed at %s, line %d\n", \
#_cond_ , __FILE__, __LINE__); \
fprintf ( stderr, _msg_ ); \
exit ( -1 ); \
} \
}
#define PRODUCE(_target_,_rate_) if ( frand() < _rate_ ) _target_++;
#define CONSUME(_target_,_rate_) if ( frand() < _rate_ ) _target_--;
#define BILLION 1000000000L
#define MILLION 1000000L
#define THOUSAND 1000L
////////////////////////////////////////////////////////////////////////////////////////////////
//
// COLORS
//
#define MAX_REP_NUM 4
#define GFP 0
#define RFP 1
#define YFP 2
#define CFP 3
#define BACKGROUND_COLOR 0.0f, 0.0f, 0.0f, 0.0f
#define SATURATION_MAX 50
#define SATURATION_MIN 0
////////////////////////////////////////////////////////////////////////////////////////////////
//
// CHEMOSTAT SHAPE
//
#define CSXL -150.0f
#define CSXR 150.0f
#define CSYB -150.0f
#define CSYT 150.0f
#define CS1 -400.0f, CSYB
#define CS2 CSXL, CSYB
#define CS3 CSXL, CSYT
#define CS4 CSXR, CSYT
#define CS5 CSXR, CSYB
#define CS6 400.0f, CSYB
#endif