-
Notifications
You must be signed in to change notification settings - Fork 3
/
libMCell.h
124 lines (103 loc) · 2.53 KB
/
libMCell.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
123
/* File : libMCell.h */
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cstdint>
using namespace std;
class MCellMoleculeInstance; // Forward declaration needed
class MCellMoleculeSpecies {
public:
string name;
// char * new_name;
string type;
char type_code;
double diffusion_constant;
//vector<MCellMoleculeInstance *> instance_list;
MCellMoleculeInstance *instance_list;
int num_instances;
MCellMoleculeSpecies() {
name = "X";
type = 'v';
type_code = 0;
diffusion_constant = 0.0;
instance_list = NULL;
num_instances = 0;
}
};
class MCellMoleculeInstance {
public:
MCellMoleculeSpecies *molecule_species;
double x, y, z;
MCellMoleculeInstance *next;
};
class MCellReleaseSite {
public:
MCellMoleculeSpecies *molecule_species;
double x, y, z;
double quantity;
MCellReleaseSite *next;
};
class MCellReaction {
public:
string reactants;
string products;
double forward_rate;
double backward_rate;
MCellReaction *next;
};
class MCellEvent {
public:
double time;
MCellEvent() {
time = 0.0;
}
};
class MCellTimerEvent : public MCellEvent {
public:
MCellTimerEvent() {
time = 0.0;
}
virtual void execute() {
cout << "Default timer" << endl;
}
};
class MCellMolCreationEvent : public MCellEvent {
public:
MCellMoleculeInstance *mol;
MCellMolCreationEvent() {
time = 0.0;
}
virtual void execute(MCellMoleculeInstance *mol) {
cout << "Default molecule creation" << endl;
}
};
class MCellSimulation {
private:
char *join_path ( char *p1, char sep, char *p2 );
//void pick_displacement( MCellMoleculeInstance *mol, double scale /*, struct rng_state *rng */ );
public:
static int num_simulations; // Tracks number of simulations that have been created.
uint32_t seed;
int num_iterations;
double time_step;
vector<MCellTimerEvent *>timer_event_handlers;
vector<MCellMolCreationEvent *>mol_creation_event_handlers;
map<string, MCellMoleculeSpecies *>molecule_species;
vector<MCellReleaseSite *>molecule_release_sites;
vector<MCellReaction *>reactions;
MCellSimulation() {
num_simulations++;
seed = 1;
num_iterations = 0;
time_step = 0.0;
}
virtual ~MCellSimulation() {
num_simulations--;
}
void add_molecule_species ( MCellMoleculeSpecies *species );
void add_molecule_release_site ( MCellReleaseSite *site );
void add_reaction ( MCellReaction *rxn );
MCellMoleculeSpecies *get_molecule_species_by_name ( char *mol_name );
void run_simulation ( char *proj_path );
};