MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HinesMatrix.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** copyright (C) 2003-2007 Upinder S. Bhalla, Niraj Dudani and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #ifndef _HINES_MATRIX_H
11 #define _HINES_MATRIX_H
12 
13 #ifdef DO_UNIT_TESTS
14 # define ASSERT( isOK, message ) \
15  if ( !(isOK) ) { \
16  cerr << "\nERROR: Assert '" << #isOK << "' failed on line " << __LINE__ << "\nin file " << __FILE__ << ": " << message << endl; \
17  exit( 1 ); \
18  } else { \
19  cout << ""; \
20  }
21 #else
22 # define ASSERT( unused, message ) do {} while ( false )
23 #endif
24 
26 {
27  JunctionStruct( unsigned int i, unsigned int r ) :
28  index( i ),
29  rank( r )
30  {
31  ;
32  }
33 
34  bool operator< ( const JunctionStruct& other ) const
35  {
36  return ( index < other.index );
37  }
38 
39  unsigned int index;
40  unsigned int rank;
41 };
44 
46 {
47  vector< unsigned int > children;
48  double Ra;
49  double Rm;
50  double Cm;
51  double Em;
52  double initVm;
53 };
54 
56 {
57 public:
58  HinesMatrix();
59 
60  void setup( const vector< TreeNodeStruct >& tree, double dt );
61 
62  unsigned int getSize() const;
63  double getA( unsigned int row, unsigned int col ) const;
64  double getB( unsigned int row ) const;
65  double getVMid( unsigned int row ) const;
66 
67 protected:
68  typedef vector< double >::iterator vdIterator;
69 
70  unsigned int nCompt_;
71  double dt_;
72 
73  vector< JunctionStruct > junction_;
74  vector< double > HS_;
79  vector< double > HJ_;
82  vector< double > HJCopy_;
83  vector< double > VMid_;
84  vector< vdIterator > operand_;
86  vector< vdIterator > backOperand_;
87  int stage_;
88 
90 private:
91  void clear();
92  void makeJunctions();
106  void makeMatrix();
109  void makeOperands();
110 
112  const vector< TreeNodeStruct > *tree_;
113  vector< double > Ga_;
115  vector< vector< unsigned int > > coupled_;
121  map< unsigned int, vdIterator > operandBase_;
124  map< unsigned int, unsigned int > groupNumber_;
127 };
128 
129 #endif // _HINES_MATRIX_H
double getVMid(unsigned int row) const
map< unsigned int, unsigned int > groupNumber_
Definition: HinesMatrix.h:124
vector< double > VMid_
middle of a time step.
Definition: HinesMatrix.h:83
void makeMatrix()
vector< unsigned int > children
Hines indices of child compts.
Definition: HinesMatrix.h:47
void setup(const vector< TreeNodeStruct > &tree, double dt)
Definition: HinesMatrix.cpp:25
double getB(unsigned int row) const
unsigned int nCompt_
Definition: HinesMatrix.h:70
vector< vdIterator > backOperand_
Definition: HinesMatrix.h:86
int stage_
reached. Used in getA.
Definition: HinesMatrix.h:87
JunctionStruct(unsigned int i, unsigned int r)
Definition: HinesMatrix.h:27
vector< vdIterator > operand_
Definition: HinesMatrix.h:85
unsigned int index
Hines index of the compartment.
Definition: HinesMatrix.h:39
void clear()
Definition: HinesMatrix.cpp:53
unsigned int rank
Definition: HinesMatrix.h:40
vector< double > HJCopy_
Definition: HinesMatrix.h:82
const vector< TreeNodeStruct > * tree_
setup.
Definition: HinesMatrix.h:112
vector< double > Ga_
Definition: HinesMatrix.h:114
vector< double > HS_
Definition: HinesMatrix.h:74
vector< vector< unsigned int > > coupled_
Definition: HinesMatrix.h:115
map< unsigned int, vdIterator > operandBase_
Definition: HinesMatrix.h:121
bool operator<(const JunctionStruct &other) const
Definition: HinesMatrix.h:34
void makeJunctions()
Definition: HinesMatrix.cpp:84
void makeOperands()
elimination easier.
unsigned int getSize() const
vector< JunctionStruct > junction_
Definition: HinesMatrix.h:73
vector< double > HJ_
Definition: HinesMatrix.h:79
vector< double >::iterator vdIterator
Definition: HinesMatrix.h:68
double getA(unsigned int row, unsigned int col) const
double dt_
Definition: HinesMatrix.h:71