MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SteadyStateGsl.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment,
4 ** also known as GENESIS 3 base code.
5 ** copyright (C) 2003-2009 Upinder S. Bhalla. and NCBS
6 ** It is made available under the terms of the
7 ** GNU Lesser General Public License version 2.1
8 ** See the file COPYING.LIB for the full notice.
9 **********************************************************************/
10 
11 #ifndef _STEADYSTATE_H
12 #define _STEADYSTATE_H
13 class SteadyState
14 {
15 #ifdef DO_UNIT_TESTS
16  friend void testSteadyState();
17 #endif
18  public:
19  SteadyState();
20  ~SteadyState();
21 
23  // Field function definitions
25  Id getStoich() const ;
26  void setStoich( Id s );
27  bool badStoichiometry() const;
28  bool isInitialized() const;
29  unsigned int getRank() const;
30  unsigned int getNumVarPools() const;
31  unsigned int getNiter() const;
32  unsigned int getMaxIter() const;
33  void setMaxIter( unsigned int value );
34  string getStatus() const;
35  double getConvergenceCriterion() const;
36  void setConvergenceCriterion( double value );
37  double getTotal( const unsigned int i ) const;
38  void setTotal( const unsigned int i, double val );
39  double getEigenvalue( const unsigned int i ) const;
40  void setEigenvalue( double val, const unsigned int i );
41  unsigned int getStateType() const;
42  unsigned int getNnegEigenvalues() const;
43  unsigned int getNposEigenvalues() const;
44  unsigned int getSolutionStatus() const;
45 
47  // Msg Dest function definitions
49  void setupMatrix();
50  void settleFunc();
51  void resettleFunc();
52  void settle( bool forceSetup );
53  void showMatricesFunc();
54  void showMatrices();
55  void randomizeInitialCondition( const Eref& e);
56  static void assignY( double* S );
57  // static void randomInitFunc();
58  // void randomInit();
60  // Utility functions for randomInit
62  /*
63  int isLastConsvMol( int i );
64  void recalcRemainingTotal(
65  vector< double >& y, vector< double >& tot );
66  */
67 #ifdef USE_GSL
69  gsl_matrix* U,
70  const vector< double >& eliminatedTotal,
71  vector< double >&yi
72  );
73 #endif
74 
76  // funcs to handle externally imposed changes in mol N
78  static void setMolN( double y, unsigned int i );
79  // static void assignStoichFunc( void* stoich );
80  // void assignStoichFuncLocal( void* stoich );
81  void classifyState( const double* T );
82  static const double EPSILON;
83  static const double DELTA;
85 
86  static const Cinfo* initCinfo();
87 
88  private:
89  void setupSSmatrix();
90 
92  // Internal fields.
94  unsigned int nIter_;
95  unsigned int maxIter_;
96  bool badStoichiometry_;
97  string status_;
98  bool isInitialized_;
99  bool isSetup_;
100  double convergenceCriterion_;
101 
102 #ifdef USE_GSL
103  gsl_matrix* LU_;
104  gsl_matrix* Nr_;
105  gsl_matrix* gamma_;
106 #endif
107  Id stoich_;
108  unsigned int numVarPools_;
109  unsigned int nReacs_;
110  unsigned int rank_;
111 
112  vector< double > total_;
113  bool reassignTotal_;
114  unsigned int nNegEigenvalues_;
115  unsigned int nPosEigenvalues_;
116  vector< double > eigenvalues_;
117  unsigned int stateType_;
118  unsigned int solutionStatus_;
119  unsigned int numFailed_;
121 };
122 
123 extern const Cinfo* initSteadyStateCinfo();
124 #endif // _STEADYSTATE_H
void randomizeInitialCondition(const Eref &e)
uint32_t value
Definition: moosemodule.h:42
unsigned int getMaxIter() const
unsigned int getNposEigenvalues() const
const Cinfo * initSteadyStateCinfo()
boost::numeric::ublas::matrix< value_type_ > gamma_
unsigned int numFailed_
unsigned int getNiter() const
unsigned int numVarPools_
unsigned int getNumVarPools() const
double getConvergenceCriterion() const
unsigned int getRank() const
vector< double > eigenvalues_
double convergenceCriterion_
bool badStoichiometry() const
unsigned int rank_
bool isInitialized() const
static void setMolN(double y, unsigned int i)
double getEigenvalue(const unsigned int i) const
string getStatus() const
unsigned int nPosEigenvalues_
void setEigenvalue(double val, const unsigned int i)
static const double DELTA
vector< double > total_
unsigned int stateType_
double getTotal(const unsigned int i) const
VoxelPools pool_
void setMaxIter(unsigned int value)
void showMatricesFunc()
unsigned int nIter_
unsigned int nNegEigenvalues_
unsigned int getSolutionStatus() const
static const double EPSILON
Definition: Eref.h:26
Id getStoich() const
unsigned int getStateType() const
void fitConservationRules(boost::numeric::ublas::matrix< value_type_ > &U, const vector< value_type_ > &eliminatedTotal, vector< value_type_ > &yi)
unsigned int getNnegEigenvalues() const
unsigned int maxIter_
void setConvergenceCriterion(double value)
Definition: Id.h:17
static const Cinfo * initCinfo()
boost::numeric::ublas::matrix< value_type_ > LU_
void setStoich(Id s)
void classifyState(const double *T)
unsigned int nReacs_
boost::numeric::ublas::matrix< value_type_ > Nr_
static void assignY(double *S)
unsigned int solutionStatus_
Definition: Cinfo.h:18
void settle(bool forceSetup)
void setTotal(const unsigned int i, double val)