00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _READ_KKIT_H
00011 #define _READ_KKIT_H
00012
00028 class ReadKkit
00029 {
00030 public:
00031 enum ParseMode {
00032 DATA,
00033 INIT,
00034 COMMENT,
00035 LINE_CONTINUE
00036 };
00037
00038 ReadKkit();
00039
00041
00043 double getMaxTime() const;
00044 double getPlotDt() const;
00045 double getDefaultVol() const;
00046 string getBasePath() const;
00047 unsigned int getVersion() const;
00048 bool getMoveOntoCompartment() const;
00049 void setMoveOntoCompartment( bool v );
00050
00052
00054
00055 void innerRead( ifstream& fin );
00056 ParseMode readInit( const string& line );
00057 Id read( const string& filename, const string& cellname,
00058 Id parent, const string& solverClass = "Stoich" );
00059 void readData( const string& line );
00060 void undump( const vector< string >& args );
00061
00068
00069
00070 void run();
00071 void dumpPlots( const string& filename );
00072
00074
00076 Id buildCompartment( const vector< string >& args );
00077 Id buildPool( const vector< string >& args );
00078 Id buildReac( const vector< string >& args );
00079 Id buildEnz( const vector< string >& args );
00080 Id buildPlot( const vector< string >& args );
00081 Id buildTable( const vector< string >& args );
00082 unsigned int loadTab( const vector< string >& args );
00083 Id buildGroup( const vector< string >& args );
00084 Id buildText( const vector< string >& args );
00085 Id buildGraph( const vector< string >& args );
00086 Id buildGeometry( const vector< string >& args );
00087 Id buildStim( const vector< string >& args );
00088 Id buildChan( const vector< string >& args );
00089 Id buildInfo( Id parent, map< string, int >& m,
00090 const vector< string >& args );
00091 void buildSumTotal( const string& src, const string& dest );
00096 Id findSumTotSrc( const string& src );
00097
00099
00101 void addmsg( const vector< string >& args );
00102 void setupSlaveMsg( const string& src, const string& dest );
00103 void innerAddMsg(
00104 const string& src, const map< string, Id >& m1,
00105 const string& srcMsg,
00106 const string& dest, const map< string, Id >& m2,
00107 const string& destMsg,
00108 bool isBackward = 0 );
00109 void call( const vector< string >& args );
00110 void objdump( const vector< string >& args );
00111 void textload( const vector< string >& args );
00112 void separateVols( Id pool, double vol );
00113 void assignPoolCompartments();
00114
00121 void assignReacCompartments();
00122 void assignEnzCompartments();
00123 void assignMMenzCompartments();
00124
00135 void convertParametersToConcUnits();
00136
00138 void convertPoolAmountToConcUnits();
00139
00141 void convertReacRatesToConcUnits();
00142
00148 void convertMMenzRatesToConcUnits();
00149
00154 void convertEnzRatesToConcUnits();
00155
00157
00159
00165 string pathTail( const string& path, string& head ) const;
00166
00177 string cleanPath( const string& path ) const;
00178
00179 private:
00180 string basePath_;
00181 Id baseId_;
00182
00183 double fastdt_;
00184 double simdt_;
00185 double controldt_;
00186 double plotdt_;
00187 double maxtime_;
00188 double transientTime_;
00189 bool useVariableDt_;
00190 double defaultVol_;
00191 unsigned int version_;
00192 unsigned int initdumpVersion_;
00193
00201 bool moveOntoCompartment_;
00202
00203 unsigned int numCompartments_;
00204 unsigned int numPools_;
00205 unsigned int numReacs_;
00206 unsigned int numEnz_;
00207 unsigned int numMMenz_;
00208 unsigned int numPlot_;
00209 unsigned int numStim_;
00210 unsigned int numOthers_;
00211
00212 unsigned int lineNum_;
00213
00214 map< string, int > poolMap_;
00215 map< string, int > reacMap_;
00216 map< string, int > enzMap_;
00217 map< string, int > groupMap_;
00218 map< string, int > tableMap_;
00219 map< string, int > stimMap_;
00220 map< string, Id > poolIds_;
00221 map< string, Id > reacIds_;
00222 map< string, Id > enzIds_;
00223 map< string, Id > mmEnzIds_;
00224 map< string, Id > plotIds_;
00225 map< string, Id > tabIds_;
00226 map< string, Id > stimIds_;
00227 map< string, Id > chanIds_;
00228
00229
00230
00232
00233
00234
00236 vector< double > vols_;
00237
00239 Id lastTab_;
00241 vector< double > tabEntries_;
00242
00244 vector< vector< Id > > volCategories_;
00245 vector< Id > compartments_;
00246 vector< pair< Id, Id > > enzCplxMols_;
00247
00248 map< Id, int > poolFlags_;
00249
00250 map< Id, double > poolVols_;
00251
00252 Shell* shell_;
00253
00254 static const double EPSILON;
00255 };
00256
00257 #endif // READ_KKIT_H