-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcellchain.h
60 lines (52 loc) · 1.46 KB
/
cellchain.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
#ifndef CELLCHAIN_H
#define CELLCHAIN_H
#include <Cell.h>
#include <DESolver.h>
#include <luo_rudy_I_model_1991.h>
#include <vector>
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>
#include <tbb/task_scheduler_init.h>
class CellChain
{
private:
int size;
int sanLen;
int atriaLen;
int avLen;
int purkLen;
int ventLen;
double *D;
tbb::task_scheduler_init *tbb_init;
void SolveDt(double dt, double time);
void initD();
public:
Cell **cells;
DESolver *Solver;
void Coupling(int i);
CellChain(int size, int sanLen, int atriaLen, int avLen, int purkLen, int ventLen);
Cell *getCell(int i);
void Solve(double MaxTime, double skipTime);
void setStimAmplitudeColl(double A, std::vector<int> ids = std::vector<int>());
void setStimStartColl(double time);
};
class ParallelSolver{
CellChain *chain;
double dt;
double time;
int flag;//0 - IntegrateDT; 1 -Coupling
public:
void operator()( const tbb::blocked_range<size_t>& r ) const {
if (!flag)
for( size_t i=r.begin(); i!=r.end(); ++i ){
chain->Solver->IntegrateOverDt(chain->cells[i],chain->cells[i]->dt,time);
}
else
for( size_t i=r.begin(); i!=r.end(); ++i ){
chain->Coupling(i);
}
}
ParallelSolver(CellChain *chain, double dt, double time, int flag):
chain(chain),dt(dt),time(time),flag(flag){}
};
#endif // CELLCHAIN_H