11 #include "../shell/Shell.h"
23 Id base = rk.
read(
"foo.g",
"dend",
Id() );
24 assert( base !=
Id() );
35 bool isClose(
double x,
double y,
double tol )
37 return ( fabs( x - y ) < tol * 1e-8 );
43 Id comptId = shell->
doCreate(
"CylMesh",
Id(),
"cyl", 1 );
44 Id meshId( comptId.
value() + 1 );
45 Id poolId = shell->
doCreate(
"Pool", comptId,
"pool", 1 );
48 ObjId( poolId, 0 ),
"requestVolume",
49 ObjId( meshId, 0 ),
"get_volume" );
51 assert( mid !=
ObjId() );
53 vector< double > coords( 9, 0.0 );
66 assert(
doubleEq( volume,
PI * x1 * (r0+r1) * (r0+r1) / 4.0 ) );
69 double volscale = 1 / (
NA * volume );
71 assert(
doubleEq( conc, 400 * volscale ) );
78 assert(
doubleEq( concInit, 650 * volscale ) );
90 Id comptId = shell->
doCreate(
"CubeMesh",
Id(),
"cube", 1 );
91 Id meshId( comptId.
value() + 1 );
92 Id subId = shell->
doCreate(
"Pool", comptId,
"sub", 1 );
93 Id prdId = shell->
doCreate(
"Pool", comptId,
"prd", 1 );
94 Id reacId = shell->
doCreate(
"Reac", comptId,
"reac", 1 );
99 subId,
"requestVolume", meshId,
"get_volume" );
100 assert( mid !=
ObjId() );
102 prdId,
"requestVolume", meshId,
"get_volume" );
103 assert( mid !=
ObjId() );
105 vector< double > coords( 9, 10.0e-6 );
106 coords[0] = coords[1] = coords[2] = 0;
113 ObjId ret = shell->
doAddMsg(
"Single", reacId,
"sub", subId,
"reac" );
114 assert( ret !=
ObjId() );
115 ret = shell->
doAddMsg(
"Single", reacId,
"prd", prdId,
"reac" );
116 assert( ret !=
ObjId() );
125 ret = shell->
doAddMsg(
"Single", reacId,
"sub", subId,
"reac" );
126 assert( ret !=
ObjId() );
127 double conv = 1.0 / (
NA * vol1 );
133 ret = shell->
doAddMsg(
"Single", reacId,
"sub", subId,
"reac" );
134 assert( ret !=
ObjId() );
135 ret = shell->
doAddMsg(
"Single", reacId,
"prd", prdId,
"reac" );
136 assert( ret !=
ObjId() );
138 assert(
doubleEq( x, 2 * conv * conv ) );
143 cout <<
"." << flush;
150 Id comptId = shell->
doCreate(
"CubeMesh",
Id(),
"cube", 1 );
151 Id meshId( comptId.
value() + 1 );
152 Id subId = shell->
doCreate(
"Pool", comptId,
"sub", 1 );
153 Id prdId = shell->
doCreate(
"Pool", comptId,
"prd", 1 );
154 Id reacId = shell->
doCreate(
"Reac", comptId,
"reac", 1 );
157 subId,
"requestVolume", meshId,
"get_volume" );
158 assert( mid !=
ObjId() );
160 prdId,
"requestVolume", meshId,
"get_volume" );
161 assert( mid !=
ObjId() );
163 ObjId ret = shell->
doAddMsg(
"Single", reacId,
"sub", subId,
"reac" );
164 assert( ret !=
ObjId() );
165 ret = shell->
doAddMsg(
"Single", reacId,
"sub", subId,
"reac" );
166 assert( ret !=
ObjId() );
168 ret = shell->
doAddMsg(
"Single", reacId,
"prd", prdId,
"reac" );
169 assert( ret !=
ObjId() );
175 assert( pools[0] == subId );
176 assert( pools[1] == subId );
182 assert( pools[0] == subId );
183 assert( pools[1] == subId );
186 cout <<
"." << flush;
195 cout <<
"." << flush;
215 cout <<
"." << flush;
229 double c = -Km *
log( s0 ) -
s0;
230 double t = (-1.0 /( E * kcat ) ) * ( ( Km *
log( s ) + s ) + c );
244 Id pid = shell->
doCreate(
"Pool", nid,
"p", 1 );
245 Id qid = shell->
doCreate(
"Pool", nid,
"q", 1 );
246 Id rid = shell->
doCreate(
"Pool", nid,
"r", 1 );
247 Id mmid = shell->
doCreate(
"MMenz", nid,
"mm", 1 );
249 Id tabid2 = shell->
doCreate(
"Table", nid,
"tab2", 1 );
263 shell->
doUseClock(
"/n/mm,/n/tab2",
"process", 0 );
264 shell->
doUseClock(
"/n/#[ISA=Pool]",
"process", 1 );
274 assert( vec.size() == 1001 );
275 for (
unsigned int i = 0; i < vec.size(); ++i ) {
277 double et =
estT( vec[i] );
282 cout <<
"." << flush;
287 extern void writeKkit(
Id model,
const string& s );
289 cout <<
"." << flush;
294 vector< unsigned int >
findVolOrder(
const vector< double >& vols );
295 vector< double > vols( 8 );
306 assert( order[0] == 1 );
307 assert( order[1] == 0 );
308 assert( order[2] == 2 );
309 assert( order[3] == 3 );
310 assert( order[4] == 7 );
311 assert( order[5] == 6 );
312 assert( order[6] == 5 );
313 assert( order[7] == 4 );
324 assert( order[0] == 4 );
325 assert( order[1] == 1 );
326 assert( order[2] == 3 );
327 assert( order[3] == 0 );
328 assert( order[4] == 2 );
double vGetKm(const Eref &e) const
void doStart(double runtime, bool notify=false)
void vSetKm(const Eref &e, double v)
Element * element() const
Synonym for Id::operator()()
void doSetClock(unsigned int tickNum, double dt)
unsigned int value() const
void testReacVolumeScaling()
void dumpPlots(const string &filename)
void testTwoReacGetNeighbors()
static bool set(const ObjId &dest, const string &field, A arg)
void testPoolVolumeScaling()
void vProcess(const Eref &e, ProcPtr p)
Id doCreate(string type, ObjId parent, string name, unsigned int numData, NodePolicy nodePolicy=MooseBlockBalance, unsigned int preferredNode=1)
void log(string msg, serverity_level_ type=debug, bool redirectToConsole=true, bool removeTicks=true)
Log to console (and to a log-file)
bool doubleApprox(double x, double y)
bool doubleEq(double x, double y)
static SrcFinfo0 s0("s0","")
void writeKkit(Id model, const string &fname)
vector< unsigned int > findVolOrder(const vector< double > &vols)
bool isClose(double x, double y, double tol)
void testKineticsProcess()
static const Cinfo * initCinfo()
Id read(const string &filename, const string &cellname, Id parent, const string &solverClass="Stoich")
void testWriteKkit(Id id)
double vGetKcat(const Eref &e) const
ObjId doAddMsg(const string &msgType, ObjId src, const string &srcField, ObjId dest, const string &destField)
void vSetKcat(const Eref &e, double v)
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
void doUseClock(string path, string field, unsigned int tick)
static A get(const ObjId &dest, const string &field)
void vReinit(const Eref &e, ProcPtr p)