00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _STOICH_H
00011 #define _STOICH_H
00012
00049 class Stoich
00050 {
00051 public:
00052 Stoich();
00053 ~Stoich();
00054
00056
00058
00059 void setOneWay( bool v );
00060 bool getOneWay() const;
00061
00063 unsigned int getNumVarPools() const;
00064
00066 unsigned int getNumBufPools() const;
00067
00073 unsigned int getNumAllPools() const;
00074
00079 unsigned int getNumProxyPools() const;
00080
00088 vector< unsigned int > getPoolIdMap() const;
00089
00094 void setPath( const Eref& e, string path );
00095 string getPath( const Eref& e ) const;
00096
00098 void setKsolve( Id v );
00099 Id getKsolve() const;
00100
00102 void setDsolve( Id v );
00103 Id getDsolve() const;
00104
00106 void setCompartment( Id v );
00107 Id getCompartment() const;
00108
00113 unsigned int getNumRates() const;
00114
00119 unsigned int getNumCoreRates() const;
00120
00122 const RateTerm* rates( unsigned int i ) const;
00123
00125 const vector< RateTerm* >& getRateTerms() const;
00126
00127 unsigned int getNumFuncs() const;
00128 const FuncTerm* funcs( unsigned int i ) const;
00129
00130 vector< int > getMatrixEntry() const;
00131 vector< unsigned int > getColIndex() const;
00132 vector< unsigned int > getRowStart() const;
00133
00134 vector< Id > getProxyPools( Id i ) const;
00135
00146 int getStatus() const;
00148
00150
00154 void setElist( const Eref& e, const vector< ObjId >& elist );
00155
00162 void locateOffSolverReacs( Id myCompt, vector< Id >& elist );
00163
00170 void allocateObjMap( const vector< Id >& elist );
00171
00173 void resizeArrays();
00175 void allocateModelObject( Id id, vector< Id >& bufPools );
00177 void allocateModel( const vector< Id >& elist );
00178
00188 void convertRatesToStochasticForm();
00189
00197 void buildXreacs( const Eref& e, Id otherStoich );
00198
00199 void filterXreacs();
00200
00202 void scaleBufsAndRates( unsigned int index, double volScale );
00203
00208 void comptsOnCrossReacTerms( vector< pair< Id, Id > >& xr ) const;
00209
00215 void setupCrossSolverReacVols() const;
00217
00219
00225 void zombifyModel( const Eref& e, const vector< Id >& elist );
00226
00230 void unZombifyModel();
00231
00233 void unZombifyPools();
00234
00235 void zombifyChemCompt( Id compt );
00236
00237 unsigned int convertIdToReacIndex( Id id ) const;
00238 unsigned int convertIdToPoolIndex( Id id ) const;
00239 unsigned int convertIdToFuncIndex( Id id ) const;
00240
00242 ZeroOrder* makeHalfReaction(
00243 double rate, const vector< Id >& reactants );
00244
00245
00246
00247
00248
00249
00250
00251
00252 void installReaction( Id reacId,
00253 const vector< Id >& subs, const vector< Id >& prds );
00254
00255
00256
00257
00258
00259 unsigned int innerInstallReaction( Id reacId,
00260 const vector< Id >& subs, const vector< Id >& prds );
00261
00266 void installMMenz( Id enzId, const vector< Id >& enzMolId,
00267 const vector< Id >& subs, const vector< Id >& prds );
00271 void installMMenz( MMEnzymeBase* meb, unsigned int rateIndex,
00272 const vector< Id >& subs, const vector< Id >& prds );
00273
00274
00275
00276
00277
00278
00279 void installEnzyme( Id enzId, Id enzMolId, Id cplxId,
00280 const vector< Id >& subs, const vector< Id >& prds );
00286 void installEnzyme( ZeroOrder* r1, ZeroOrder* r2, ZeroOrder* r3,
00287 Id enzId, Id enzMolId, const vector< Id >& prds );
00288
00290 void installDummyEnzyme( Id enzId, Id enzMolId);
00291
00296 void installAndUnschedFunc( Id func, Id pool );
00297
00303 void installAndUnschedFuncRate( Id func, Id pool );
00304
00309 void installAndUnschedFuncReac( Id func, Id reac );
00310
00312
00316 unsigned int getSpecies( unsigned int poolIndex ) const;
00317
00321 void setSpecies( unsigned int poolIndex, unsigned int s );
00322
00330 void setReacKf( const Eref& e, double v ) const;
00331
00339 void setReacKb( const Eref& e, double v ) const;
00340
00347 void setMMenzKm( const Eref& e, double v ) const;
00348 double getMMenzNumKm( const Eref& e ) const;
00349
00353 void setMMenzKcat( const Eref& e, double v ) const;
00354 double getMMenzKcat( const Eref& e ) const;
00355
00364 void setEnzK1( const Eref& e, double v ) const;
00365 double getEnzNumK1( const Eref& e ) const;
00366
00368 void setEnzK2( const Eref& e, double v ) const;
00370 double getEnzK2( const Eref& e ) const;
00371
00373 void setEnzK3( const Eref& e, double v ) const;
00375 double getEnzK3( const Eref& e ) const;
00376
00381 double getR1( const Eref& e ) const;
00388 double getR1offset1( const Eref& e ) const;
00395 double getR1offset2( const Eref& e ) const;
00396
00402 double getR2( const Eref& e ) const;
00403
00407 void setFunctionExpr( const Eref& e, string expr );
00408
00414 void updateRatesAfterRemesh();
00415
00417 void print() const;
00418
00420 void printRates() const;
00422
00424
00439 void updateReacVelocities( const double* s, vector< double >& vel,
00440 unsigned int volIndex ) const;
00441
00443 void updateFuncs( double* s, double t ) const;
00444
00446
00447
00448
00449
00450
00458
00459 const KinSparseMatrix& getStoichiometryMatrix() const;
00461
00463 const vector< Id >& getOffSolverPools() const;
00464
00469 vector< Id > getOffSolverCompts() const;
00470
00475 const vector< Id >& offSolverPoolMap( Id compt ) const;
00476
00483
00484 static const unsigned int PoolIsNotOnSolver;
00485 static const Cinfo* initCinfo();
00486 protected:
00491 bool useOneWay_;
00492 string path_;
00493
00495 Id ksolve_;
00496
00498 Id dsolve_;
00499
00501 Id compartment_;
00502
00504 ZombiePoolInterface* kinterface_;
00506 ZombiePoolInterface* dinterface_;
00507
00512 vector< unsigned int > species_;
00513
00525 vector< RateTerm* > rates_;
00526
00533
00534 unsigned int numVoxels_;
00535
00537 vector< FuncTerm* > funcs_;
00538
00540 KinSparseMatrix N_;
00541
00551 vector< unsigned int > objMap_;
00557 unsigned int objMapStart_;
00558
00562 vector< Id > idMap_;
00563
00567 vector< Id > reacMap_;
00568
00572 vector< Id > enzMap_;
00573
00577 vector< Id > mmEnzMap_;
00578
00582 vector< Id > funcMap_;
00583
00589 unsigned int numVarPools_;
00590
00601 unsigned int numBufPools_;
00606 unsigned int numFunctions_;
00607
00615 unsigned int numReac_;
00616
00626 int status_;
00627
00629
00631
00636 vector< Id > offSolverPools_;
00637
00645 map< Id, vector< Id > > offSolverPoolMap_;
00646
00650 vector< Id > offSolverReacs_;
00651
00656 vector< pair< Id, Id > > offSolverReacCompts_;
00657
00663 vector< vector< Id > > subComptVec_;
00664
00670 vector< vector< Id > > prdComptVec_;
00671 };
00672
00673 #endif // _STOICH_H