00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _STEADYSTATE_H
00012 #define _STEADYSTATE_H
00013 class SteadyState
00014 {
00015 #ifdef DO_UNIT_TESTS
00016 friend void testSteadyState();
00017 #endif
00018 public:
00019 SteadyState();
00020 ~SteadyState();
00021
00023
00025 Id getStoich() const ;
00026 void setStoich( Id s );
00027 bool badStoichiometry() const;
00028 bool isInitialized() const;
00029 unsigned int getRank() const;
00030 unsigned int getNumVarPools() const;
00031 unsigned int getNiter() const;
00032 unsigned int getMaxIter() const;
00033 void setMaxIter( unsigned int value );
00034 string getStatus() const;
00035 double getConvergenceCriterion() const;
00036 void setConvergenceCriterion( double value );
00037 double getTotal( const unsigned int i ) const;
00038 void setTotal( const unsigned int i, double val );
00039 double getEigenvalue( const unsigned int i ) const;
00040 void setEigenvalue( double val, const unsigned int i );
00041 unsigned int getStateType() const;
00042 unsigned int getNnegEigenvalues() const;
00043 unsigned int getNposEigenvalues() const;
00044 unsigned int getSolutionStatus() const;
00045
00047
00049 void setupMatrix();
00050 void settleFunc();
00051 void resettleFunc();
00052 void settle( bool forceSetup );
00053 void showMatricesFunc();
00054 void showMatrices();
00055 void randomizeInitialCondition( const Eref& e);
00056 static void assignY( double* S );
00057
00058
00060
00062
00063
00064
00065
00066
00067 #ifdef USE_GSL
00068 void fitConservationRules(
00069 gsl_matrix* U,
00070 const vector< double >& eliminatedTotal,
00071 vector< double >&yi
00072 );
00073 #endif
00074
00076
00078 static void setMolN( double y, unsigned int i );
00079
00080
00081 void classifyState( const double* T );
00082 static const double EPSILON;
00083 static const double DELTA;
00085
00086 static const Cinfo* initCinfo();
00087
00088 private:
00089 void setupSSmatrix();
00090
00092
00094 unsigned int nIter_;
00095 unsigned int maxIter_;
00096 bool badStoichiometry_;
00097 string status_;
00098 bool isInitialized_;
00099 bool isSetup_;
00100 double convergenceCriterion_;
00101
00102 #ifdef USE_GSL
00103 gsl_matrix* LU_;
00104 gsl_matrix* Nr_;
00105 gsl_matrix* gamma_;
00106 #endif
00107 Id stoich_;
00108 unsigned int numVarPools_;
00109 unsigned int nReacs_;
00110 unsigned int rank_;
00111
00112 vector< double > total_;
00113 bool reassignTotal_;
00114 unsigned int nNegEigenvalues_;
00115 unsigned int nPosEigenvalues_;
00116 vector< double > eigenvalues_;
00117 unsigned int stateType_;
00118 unsigned int solutionStatus_;
00119 unsigned int numFailed_;
00120 VoxelPools pool_;
00121 };
00122
00123 extern const Cinfo* initSteadyStateCinfo();
00124 #endif // _STEADYSTATE_H