MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MarkovRateTable Class Reference

#include <MarkovRateTable.h>

+ Collaboration diagram for MarkovRateTable:

Public Member Functions

bool areAllRates1d ()
 
bool areAllRates2d ()
 
bool areAllRatesConstant ()
 
bool areAllRatesLigandDep ()
 
bool areAllRatesVoltageDep ()
 
bool areAnyRates1d ()
 
bool areAnyRates2d ()
 
bool areAnyRatesLigandDep ()
 
bool areAnyRatesVoltageDep ()
 
bool areIndicesOutOfBounds (unsigned int, unsigned int) const
 
Interpol2DgetInt2dChildTable (unsigned int, unsigned int) const
 
double getLigandConc () const
 
vector< unsigned int > getListOf1dRates ()
 
vector< unsigned int > getListOf2dRates ()
 
vector< unsigned int > getListOfConstantRates ()
 
vector< unsigned int > getListOfLigandRates ()
 
vector< unsigned int > getListOfVoltageRates ()
 
vector< vector< double > > getQ () const
 
unsigned int getSize () const
 
double getVm () const
 
VectorTablegetVtChildTable (unsigned int, unsigned int) const
 
void handleLigandConc (double)
 
void handleVm (double)
 
void init (unsigned int)
 
void initConstantRates ()
 
void innerSetInt2dChildTable (unsigned int, unsigned int, Interpol2D)
 
void innerSetVtChildTable (unsigned int, unsigned int, VectorTable, unsigned int)
 
bool isRate1d (unsigned int, unsigned int) const
 
bool isRate2d (unsigned int, unsigned int) const
 
bool isRateConstant (unsigned int, unsigned int) const
 
bool isRateLigandDep (unsigned int, unsigned int) const
 
bool isRateZero (unsigned int, unsigned int) const
 
double lookup1dIndex (unsigned int, unsigned int, unsigned int)
 
double lookup1dValue (unsigned int, unsigned int, double)
 
double lookup2dIndex (unsigned int, unsigned int, unsigned int, unsigned int)
 
double lookup2dValue (unsigned int, unsigned int, double, double)
 
 MarkovRateTable ()
 
void process (const Eref &, ProcPtr)
 
void reinit (const Eref &, ProcPtr)
 
void setConstantRate (unsigned int, unsigned int, double)
 
void setInt2dChildTable (unsigned int, unsigned int, Id)
 
void setLigandConc (double)
 
void setVm (double)
 
void setVtChildTable (unsigned int, unsigned int, Id, unsigned int)
 
void updateRates ()
 
 ~MarkovRateTable ()
 

Static Public Member Functions

static const CinfoinitCinfo ()
 

Private Member Functions

bool isInitialized () const
 

Private Attributes

vector< vector< Interpol2D * > > int2dTables_
 
double ligandConc_
 
vector< unsigned int > listOf1dRates_
 
vector< unsigned int > listOf2dRates_
 
vector< unsigned int > listOfConstantRates_
 
vector< unsigned int > listOfLigandRates_
 
vector< unsigned int > listOfVoltageRates_
 
vector< vector< double > > Q_
 
unsigned int size_
 
vector< vector< unsigned int > > useLigandConc_
 
double Vm_
 
vector< vector< VectorTable * > > vtTables_
 

Friends

istream & operator>> (istream &, MarkovRateTable &)
 

Detailed Description

Definition at line 48 of file MarkovRateTable.h.

Constructor & Destructor Documentation

MarkovRateTable::MarkovRateTable ( )

Definition at line 170 of file MarkovRateTable.cpp.

170  :
171  Vm_(0),
172  ligandConc_(0),
173  size_(0)
174 { ; }
unsigned int size_
MarkovRateTable::~MarkovRateTable ( )

Definition at line 176 of file MarkovRateTable.cpp.

References int2dTables_, isRate1d(), isRate2d(), isRateConstant(), size_, and vtTables_.

177 {
178  for ( unsigned int i = 0; i < size_; ++i )
179  {
180  for ( unsigned int j = 0; j < size_; ++j )
181  {
182  if ( isRate1d( i, j ) || isRateConstant( i, j ) )
183  delete vtTables_[i][j];
184  if ( isRate2d( i, j ) )
185  delete int2dTables_[i][j];
186  }
187  }
188 }
vector< vector< Interpol2D * > > int2dTables_
bool isRateConstant(unsigned int, unsigned int) const
unsigned int size_
bool isRate1d(unsigned int, unsigned int) const
vector< vector< VectorTable * > > vtTables_
bool isRate2d(unsigned int, unsigned int) const

+ Here is the call graph for this function:

Member Function Documentation

bool MarkovRateTable::areAllRates1d ( )

Definition at line 444 of file MarkovRateTable.cpp.

References areAnyRates1d(), and areAnyRates2d().

Referenced by areAllRatesLigandDep(), areAllRatesVoltageDep(), MarkovSolverBase::computeState(), MarkovSolverBase::fillupTable(), MarkovSolverBase::init(), and MarkovSolverBase::setLookupParams().

445 {
446  return areAnyRates1d() && !areAnyRates2d();
447 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool MarkovRateTable::areAllRates2d ( )

Definition at line 455 of file MarkovRateTable.cpp.

References areAnyRates1d(), and areAnyRates2d().

456 {
457  return areAnyRates2d() && !areAnyRates1d();
458 }

+ Here is the call graph for this function:

bool MarkovRateTable::areAllRatesConstant ( )

Definition at line 432 of file MarkovRateTable.cpp.

References listOf1dRates_, listOf2dRates_, and listOfConstantRates_.

Referenced by MarkovSolverBase::fillupTable(), and process().

433 {
434  return listOf1dRates_.empty() && listOf2dRates_.empty() &&
435  !listOfConstantRates_.empty();
436 }
vector< unsigned int > listOfConstantRates_
vector< unsigned int > listOf2dRates_
vector< unsigned int > listOf1dRates_

+ Here is the caller graph for this function:

bool MarkovRateTable::areAllRatesLigandDep ( )

Definition at line 466 of file MarkovRateTable.cpp.

References areAllRates1d(), areAnyRatesLigandDep(), and areAnyRatesVoltageDep().

Referenced by MarkovSolverBase::fillupTable(), MarkovSolverBase::init(), and MarkovSolverBase::setLookupParams().

467 {
468  return areAllRates1d() && !areAnyRatesVoltageDep() &&
470 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool MarkovRateTable::areAllRatesVoltageDep ( )

Definition at line 478 of file MarkovRateTable.cpp.

References areAllRates1d(), areAnyRatesLigandDep(), and areAnyRatesVoltageDep().

Referenced by MarkovSolverBase::fillupTable(), MarkovSolverBase::init(), and MarkovSolverBase::linearInterpolate().

479 {
480  return areAllRates1d() && areAnyRatesVoltageDep() &&
482 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool MarkovRateTable::areAnyRates1d ( )

Definition at line 439 of file MarkovRateTable.cpp.

References listOf1dRates_.

Referenced by areAllRates1d(), areAllRates2d(), and MarkovSolverBase::setLookupParams().

440 {
441  return !listOf1dRates_.empty();
442 }
vector< unsigned int > listOf1dRates_

+ Here is the caller graph for this function:

bool MarkovRateTable::areAnyRates2d ( )

Definition at line 450 of file MarkovRateTable.cpp.

References listOf2dRates_.

Referenced by areAllRates1d(), areAllRates2d(), MarkovSolverBase::computeState(), MarkovSolverBase::fillupTable(), MarkovSolverBase::init(), and MarkovSolverBase::setLookupParams().

451 {
452  return !listOf2dRates_.empty();
453 }
vector< unsigned int > listOf2dRates_

+ Here is the caller graph for this function:

bool MarkovRateTable::areAnyRatesLigandDep ( )

Definition at line 461 of file MarkovRateTable.cpp.

References listOfLigandRates_.

Referenced by areAllRatesLigandDep(), areAllRatesVoltageDep(), MarkovSolverBase::computeState(), MarkovSolverBase::fillupTable(), and MarkovSolverBase::init().

462 {
463  return !listOfLigandRates_.empty();
464 }
vector< unsigned int > listOfLigandRates_

+ Here is the caller graph for this function:

bool MarkovRateTable::areAnyRatesVoltageDep ( )

Definition at line 473 of file MarkovRateTable.cpp.

References listOfVoltageRates_.

Referenced by areAllRatesLigandDep(), areAllRatesVoltageDep(), MarkovSolverBase::computeState(), MarkovSolverBase::fillupTable(), and MarkovSolverBase::init().

474 {
475  return !listOfVoltageRates_.empty();
476 }
vector< unsigned int > listOfVoltageRates_

+ Here is the caller graph for this function:

bool MarkovRateTable::areIndicesOutOfBounds ( unsigned int  i,
unsigned int  j 
) const

Definition at line 427 of file MarkovRateTable.cpp.

References size_.

Referenced by innerSetInt2dChildTable(), innerSetVtChildTable(), lookup1dIndex(), lookup1dValue(), lookup2dIndex(), and lookup2dValue().

428 {
429  return ( i > size_ || j > size_ );
430 }
unsigned int size_

+ Here is the caller graph for this function:

Interpol2D * MarkovRateTable::getInt2dChildTable ( unsigned int  i,
unsigned int  j 
) const

Definition at line 236 of file MarkovRateTable.cpp.

References int2dTables_, and isRate2d().

Referenced by MarkovSolverBase::setLookupParams().

237 {
238  if ( isRate2d( i, j ) )
239  return int2dTables_[i][j];
240  else
241  {
242  cerr << "MarkovRateTable::getInt2dChildTable : Error : No two parameter"
243  " rate table set for (" << i+1 << "," << j+1 << "). Returning NULL.\n";
244  return 0;
245  }
246 }
vector< vector< Interpol2D * > > int2dTables_
bool isRate2d(unsigned int, unsigned int) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double MarkovRateTable::getLigandConc ( ) const

Definition at line 383 of file MarkovRateTable.cpp.

References ligandConc_.

Referenced by initCinfo().

384 {
385  return ligandConc_;
386 }

+ Here is the caller graph for this function:

vector< unsigned int > MarkovRateTable::getListOf1dRates ( )

Definition at line 543 of file MarkovRateTable.cpp.

References listOf1dRates_.

Referenced by MarkovSolverBase::fillupTable().

544 {
545  return listOf1dRates_;
546 }
vector< unsigned int > listOf1dRates_

+ Here is the caller graph for this function:

vector< unsigned int > MarkovRateTable::getListOf2dRates ( )

Definition at line 548 of file MarkovRateTable.cpp.

References listOf2dRates_.

Referenced by MarkovSolverBase::fillupTable(), and MarkovSolverBase::setLookupParams().

549 {
550  return listOf2dRates_;
551 }
vector< unsigned int > listOf2dRates_

+ Here is the caller graph for this function:

vector< unsigned int > MarkovRateTable::getListOfConstantRates ( )

Definition at line 563 of file MarkovRateTable.cpp.

References listOfConstantRates_.

Referenced by MarkovSolverBase::fillupTable().

564 {
565  return listOfConstantRates_;
566 }
vector< unsigned int > listOfConstantRates_

+ Here is the caller graph for this function:

vector< unsigned int > MarkovRateTable::getListOfLigandRates ( )

Definition at line 558 of file MarkovRateTable.cpp.

References listOfLigandRates_.

Referenced by MarkovSolverBase::fillupTable(), and MarkovSolverBase::setLookupParams().

559 {
560  return listOfLigandRates_;
561 }
vector< unsigned int > listOfLigandRates_

+ Here is the caller graph for this function:

vector< unsigned int > MarkovRateTable::getListOfVoltageRates ( )

Definition at line 553 of file MarkovRateTable.cpp.

References listOfVoltageRates_.

Referenced by MarkovSolverBase::fillupTable(), and MarkovSolverBase::setLookupParams().

554 {
555  return listOfVoltageRates_;
556 }
vector< unsigned int > listOfVoltageRates_

+ Here is the caller graph for this function:

vector< vector< double > > MarkovRateTable::getQ ( ) const

Definition at line 363 of file MarkovRateTable.cpp.

References Q_.

Referenced by initCinfo().

364 {
365  return Q_;
366 }
vector< vector< double > > Q_

+ Here is the caller graph for this function:

unsigned int MarkovRateTable::getSize ( ) const

Definition at line 368 of file MarkovRateTable.cpp.

References size_.

Referenced by MarkovSolverBase::init(), and initCinfo().

369 {
370  return size_;
371 }
unsigned int size_

+ Here is the caller graph for this function:

double MarkovRateTable::getVm ( ) const

Definition at line 373 of file MarkovRateTable.cpp.

References Vm_.

Referenced by initCinfo().

374 {
375  return Vm_;
376 }

+ Here is the caller graph for this function:

VectorTable * MarkovRateTable::getVtChildTable ( unsigned int  i,
unsigned int  j 
) const

Definition at line 190 of file MarkovRateTable.cpp.

References isRate1d(), isRateConstant(), and vtTables_.

Referenced by MarkovSolverBase::setLookupParams().

191 {
192  if ( isRate1d( i, j ) || isRateConstant( i, j ) )
193  return vtTables_[i][j];
194  else
195  {
196  cerr << "MarkovRateTable::getVtChildTable : Error : No one parameter rate "
197  "table set for (" << i+1 << "," << j+1 << "). Returing NULL.\n";
198  return 0;
199  }
200 }
bool isRateConstant(unsigned int, unsigned int) const
bool isRate1d(unsigned int, unsigned int) const
vector< vector< VectorTable * > > vtTables_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::handleLigandConc ( double  ligandConc)

Definition at line 649 of file MarkovRateTable.cpp.

References ligandConc_.

Referenced by initCinfo().

650 {
651  ligandConc_ = ligandConc;
652 }

+ Here is the caller graph for this function:

void MarkovRateTable::handleVm ( double  Vm)

Definition at line 644 of file MarkovRateTable.cpp.

References Vm_.

Referenced by initCinfo().

645 {
646  Vm_ = Vm;
647 }

+ Here is the caller graph for this function:

void MarkovRateTable::init ( unsigned int  size)

Definition at line 630 of file MarkovRateTable.cpp.

References int2dTables_, Q_, size_, useLigandConc_, and vtTables_.

Referenced by initCinfo().

631 {
632  size_ = size;
633 
634  if ( vtTables_.empty() )
635  vtTables_ = resize< VectorTable* >( vtTables_, size, 0 );
636  if ( int2dTables_.empty() )
637  int2dTables_ = resize< Interpol2D* >( int2dTables_, size, 0 );
638  if ( useLigandConc_.empty() )
639  useLigandConc_ = resize< unsigned int >( useLigandConc_, size, 0 );
640  if ( Q_.empty() )
641  Q_ = resize< double >( Q_, size, 0 );
642 }
vector< vector< Interpol2D * > > int2dTables_
unsigned int size_
vector< vector< VectorTable * > > vtTables_
vector< vector< unsigned int > > useLigandConc_
vector< vector< double > > Q_

+ Here is the caller graph for this function:

const Cinfo * MarkovRateTable::initCinfo ( )
static

Definition at line 27 of file MarkovRateTable.cpp.

References getLigandConc(), getQ(), getSize(), getVm(), handleLigandConc(), handleVm(), init(), Neutral::initCinfo(), instRatesOut(), MarkovRateTableCinfo, process(), reinit(), setConstantRate(), setInt2dChildTable(), setLigandConc(), setVm(), and setVtChildTable().

28 {
30  //SharedFinfos
32  static DestFinfo handleVm("handleVm",
33  "Handles incoming message containing voltage information.",
35  );
36 
37  static Finfo* channelShared[] =
38  {
39  &handleVm
40  };
41 
42  static SharedFinfo channel("channel",
43  "This message couples the rate table to the compartment. The rate table"
44  " needs updates on voltage in order to compute the rate table.",
45  channelShared, sizeof( channelShared ) / sizeof( Finfo* )
46  );
47 
49  //DestFinfos
51  static DestFinfo process( "process",
52  "Handles process call",
54 
55  static DestFinfo reinit( "reinit",
56  "Handles reinit call",
58 
59  static Finfo* processShared[] =
60  {
61  &process, &reinit
62  };
63 
64  static SharedFinfo proc( "proc",
65  "This is a shared message to receive Process message from the"
66  "scheduler. The first entry is a MsgDest for the Process "
67  "operation. It has a single argument, ProcInfo, which "
68  "holds lots of information about current time, thread, dt and"
69  "so on. The second entry is a MsgDest for the Reinit "
70  "operation. It also uses ProcInfo.",
71  processShared, sizeof( processShared ) / sizeof( Finfo* )
72  );
73 
74  static DestFinfo init("init",
75  "Initialization of the class. Allocates memory for all the tables.",
77 
78  static DestFinfo handleLigandConc("handleLigandConc",
79  "Handles incoming message containing ligand concentration.",
81 
82  static DestFinfo set1d("set1d",
83  "Setting up of 1D lookup table for the (i,j)'th rate.",
84  new OpFunc4< MarkovRateTable, unsigned int, unsigned int, Id,
85  unsigned int >
87  );
88 
89  static DestFinfo set2d("set2d",
90  "Setting up of 2D lookup table for the (i,j)'th rate.",
93  );
94 
95  static DestFinfo setconst("setconst",
96  "Setting a constant value for the (i,j)'th rate. Internally, this is"
97  " stored as a 1-D rate with a lookup table containing 1 entry.",
100  );
101 
103  //Field information.
105  static ValueFinfo< MarkovRateTable, double > ligandconc( "ligandConc",
106  "Ligand concentration.",
109  );
110 
112  "Membrane voltage.",
115  );
116 
118  Q( "Q",
119  "Instantaneous rate matrix.",
121  );
122 
123  //Really no point in allowing access to Vm_ and ligandConc_ when it is
124  //available from the MarkovChannel class.
125 
127  size( "size",
128  "Dimension of the families of lookup tables. Is always equal to the number of states in the model.",
130  );
131 
132  static Finfo* markovRateTableFinfos[] =
133  {
134  &channel, //SharedFinfo
135  instRatesOut(), //SrcFinfo
136  &proc, //DestFinfo
137  &init, //DestFinfo
138  &handleLigandConc, //DestFinfo
139  &set1d, //DestFinfo
140  &set2d, //DestFinfo
141  &setconst, //DestFinfo
142  &vm, //ValueFinfo
143  &ligandconc, //ValueFinfo
144  &Q, //ReadOnlyValueFinfo
145  &size, //ReadOnlyValueFinfo
146  };
147 
148  static string doc[] =
149  {
150  "Name", "MarkovRateTable",
151  "Author", "Vishaka Datta S, 2011, NCBS",
152  "Description", "Rate Table for Markov channel calculations. "
153  };
154  static Dinfo< MarkovRateTable > dinfo;
156  "MarkovRateTable",
158  markovRateTableFinfos,
159  sizeof(markovRateTableFinfos)/sizeof(Finfo *),
160  &dinfo,
161  doc,
162  sizeof( doc ) / sizeof( string )
163  );
164 
165  return &MarkovRateTableCinfo;
166 }
static SrcFinfo1< vector< vector< double > > > * instRatesOut()
void process(const Eref &, ProcPtr)
Definition: Dinfo.h:60
Definition: OpFunc.h:56
void reinit(const Eref &, ProcPtr)
vector< vector< double > > getQ() const
void setVtChildTable(unsigned int, unsigned int, Id, unsigned int)
void handleVm(double)
void setVm(double)
void init(unsigned int)
Definition: OpFunc.h:27
static const Cinfo * MarkovRateTableCinfo
void setConstantRate(unsigned int, unsigned int, double)
unsigned int getSize() const
Definition: Id.h:17
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
void setLigandConc(double)
void handleLigandConc(double)
void setInt2dChildTable(unsigned int, unsigned int, Id)
double getLigandConc() const
Definition: Cinfo.h:18
Definition: OpFunc.h:70
double getVm() const
Definition: Finfo.h:12

+ Here is the call graph for this function:

void MarkovRateTable::initConstantRates ( )

Definition at line 525 of file MarkovRateTable.cpp.

References listOfConstantRates_, lookup1dValue(), and Q_.

Referenced by reinit().

526 {
527  unsigned int n = listOfConstantRates_.size(), i, j;
528  for ( unsigned int k = 0; k < n; ++k )
529  {
530  i = ( ( listOfConstantRates_[k] / 10 ) % 10 ) - 1;
531  j = ( listOfConstantRates_[k] % 10 ) - 1;
532 
533  Q_[i][i] += Q_[i][j];
534 
535  //Doesn't really matter which value is looked up as there is only one
536  //entry in the table.
537  Q_[i][j] = lookup1dValue( i, j, 0.0 );
538 
539  Q_[i][i] -= Q_[i][j];
540  }
541 }
vector< unsigned int > listOfConstantRates_
double lookup1dValue(unsigned int, unsigned int, double)
vector< vector< double > > Q_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::innerSetInt2dChildTable ( unsigned int  i,
unsigned int  j,
Interpol2D  int2dTable 
)

Definition at line 248 of file MarkovRateTable.cpp.

References areIndicesOutOfBounds(), int2dTables_, isRate1d(), isRate2d(), and isRateConstant().

Referenced by setInt2dChildTable().

249 {
250  if ( areIndicesOutOfBounds( i, j ) )
251  {
252  cerr << "MarkovRateTable::innerSetInt2dChildTable : Error : Table requested"
253  " is out of bounds\n";
254  return;
255  }
256 
257  if ( isRate1d( i, j ) || isRate2d( i, j ) || isRateConstant( i, j ) )
258  {
259  cerr << "MarkovRateTable::innerSetInt2dChildTable : Error : Rate (" <<
260  i+1 << "," << j+1 << ") has already been set!\n";
261  return;
262  }
263 
264  if ( i == j )
265  {
266  cerr << "MarkovRateTable::innerSetInt2dChildTable : Error : Cannot "
267  "set diagonal rate (" << i+1 << "," << i+1 << endl;
268  return;
269  }
270 
271  //If table isn't already initialized, do so.
272  if ( int2dTables_[i][j] == 0 )
273  int2dTables_[i][j] = new Interpol2D();
274 
275  //Checking to see if this rate has already been set with a one parameter rate
276  //table.
277  *int2dTables_[i][j] = int2dTable;
278 }
vector< vector< Interpol2D * > > int2dTables_
bool areIndicesOutOfBounds(unsigned int, unsigned int) const
bool isRateConstant(unsigned int, unsigned int) const
bool isRate1d(unsigned int, unsigned int) const
bool isRate2d(unsigned int, unsigned int) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::innerSetVtChildTable ( unsigned int  i,
unsigned int  j,
VectorTable  vecTable,
unsigned int  ligandFlag 
)

Definition at line 202 of file MarkovRateTable.cpp.

References areIndicesOutOfBounds(), isRate1d(), isRate2d(), isRateConstant(), useLigandConc_, and vtTables_.

Referenced by setConstantRate(), and setVtChildTable().

205 {
206  if ( areIndicesOutOfBounds( i, j ) )
207  {
208  cerr << "MarkovRateTable::innerSetVtChildTable : Error : Table requested"
209  "is out of bounds!.\n";
210  return;
211  }
212 
213  //Checking to see if this rate has already been set with a 2-parameter rate.
214  if ( isRate2d( i, j ) || isRateConstant( i, j ) || isRate1d( i, j ) )
215  {
216  cerr << "MarkovRateTable::innerSetVtChildTable : Error : "
217  "Rate (" << i+1 << "," << j+1 << ")has already been set.\n";
218  return;
219  }
220 
221  if ( i == j )
222  {
223  cerr << "MarkovRateTable::innerSetVtChildTable : Error : Cannot "
224  "set diagonal rate (" << i+1 << "," << i+1 << endl;
225  return;
226  }
227 
228  //If table hasnt been allocated any memory, do so.
229  if ( vtTables_[i][j] == 0 )
230  vtTables_[i][j] = new VectorTable();
231 
232  *vtTables_[i][j] = vecTable;
233  useLigandConc_[i][j] = ligandFlag;
234 }
bool areIndicesOutOfBounds(unsigned int, unsigned int) const
bool isRateConstant(unsigned int, unsigned int) const
bool isRate1d(unsigned int, unsigned int) const
vector< vector< VectorTable * > > vtTables_
bool isRate2d(unsigned int, unsigned int) const
vector< vector< unsigned int > > useLigandConc_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool MarkovRateTable::isInitialized ( ) const
private

Definition at line 600 of file MarkovRateTable.cpp.

References size_.

Referenced by reinit().

601 {
602  return ( size_ > 0 );
603 }
unsigned int size_

+ Here is the caller graph for this function:

bool MarkovRateTable::isRate1d ( unsigned int  i,
unsigned int  j 
) const

Definition at line 406 of file MarkovRateTable.cpp.

References vtTables_.

Referenced by getVtChildTable(), innerSetInt2dChildTable(), innerSetVtChildTable(), isRateLigandDep(), lookup1dIndex(), lookup1dValue(), operator>>(), and ~MarkovRateTable().

407 {
408  //Second condition is necessary because for a constant rate, the 1D lookup
409  //table class is set, but has only one entry. So a constant rate would pass
410  //off as a one-parameter rate transition if not for this check.
411  if ( vtTables_[i][j] == 0 )
412  return false;
413  else
414  return ( vtTables_[i][j]->getDiv() > 0 );
415 }
vector< vector< VectorTable * > > vtTables_

+ Here is the caller graph for this function:

bool MarkovRateTable::isRate2d ( unsigned int  i,
unsigned int  j 
) const

Definition at line 422 of file MarkovRateTable.cpp.

References int2dTables_.

Referenced by getInt2dChildTable(), innerSetInt2dChildTable(), innerSetVtChildTable(), isRateConstant(), lookup2dIndex(), lookup2dValue(), operator>>(), and ~MarkovRateTable().

423 {
424  return ( int2dTables_[i][j] != 0 );
425 }
vector< vector< Interpol2D * > > int2dTables_

+ Here is the caller graph for this function:

bool MarkovRateTable::isRateConstant ( unsigned int  i,
unsigned int  j 
) const

Definition at line 398 of file MarkovRateTable.cpp.

References isRate2d(), isRateZero(), and vtTables_.

Referenced by getVtChildTable(), innerSetInt2dChildTable(), innerSetVtChildTable(), lookup1dIndex(), lookup1dValue(), and ~MarkovRateTable().

399 {
400  if ( isRate2d( i, j ) || isRateZero( i, j ) )
401  return false;
402 
403  return ( vtTables_[i][j]->getDiv() == 0 );
404 }
vector< vector< VectorTable * > > vtTables_
bool isRate2d(unsigned int, unsigned int) const
bool isRateZero(unsigned int, unsigned int) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool MarkovRateTable::isRateLigandDep ( unsigned int  i,
unsigned int  j 
) const

Definition at line 417 of file MarkovRateTable.cpp.

References isRate1d(), and useLigandConc_.

Referenced by updateRates().

418 {
419  return ( isRate1d( i, j ) && useLigandConc_[i][j] > 0 );
420 }
bool isRate1d(unsigned int, unsigned int) const
vector< vector< unsigned int > > useLigandConc_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool MarkovRateTable::isRateZero ( unsigned int  i,
unsigned int  j 
) const

Definition at line 393 of file MarkovRateTable.cpp.

References int2dTables_, and vtTables_.

Referenced by isRateConstant().

394 {
395  return ( vtTables_[i][j] == 0 && int2dTables_[i][j] == 0 );
396 }
vector< vector< Interpol2D * > > int2dTables_
vector< vector< VectorTable * > > vtTables_

+ Here is the caller graph for this function:

double MarkovRateTable::lookup1dIndex ( unsigned int  i,
unsigned int  j,
unsigned int  xIndex 
)

Definition at line 299 of file MarkovRateTable.cpp.

References areIndicesOutOfBounds(), isRate1d(), isRateConstant(), and vtTables_.

Referenced by MarkovSolverBase::innerFillupTable().

301 {
302  if ( areIndicesOutOfBounds( i, j ) )
303  {
304  cerr << "MarkovRateTable::lookup1dIndex : Lookup requested on non-"
305  "existent table at (" << i << "," << j << "). Returning 0.\n";
306  return 0;
307  }
308 
309  if ( !isRate1d( i, j ) && !isRateConstant( i, j ) )
310  {
311  cerr << "MarkovRateTable::lookup1dIndex : No 1D or constant rate set at ("
312  << i << "," << j << "). Returning 0.\n";
313  return 0;
314  }
315 
316  return vtTables_[i][j]->lookupByIndex( xIndex );
317 }
bool areIndicesOutOfBounds(unsigned int, unsigned int) const
bool isRateConstant(unsigned int, unsigned int) const
bool isRate1d(unsigned int, unsigned int) const
vector< vector< VectorTable * > > vtTables_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double MarkovRateTable::lookup1dValue ( unsigned int  i,
unsigned int  j,
double  x 
)

Definition at line 280 of file MarkovRateTable.cpp.

References areIndicesOutOfBounds(), isRate1d(), isRateConstant(), and vtTables_.

Referenced by initConstantRates(), MarkovSolverBase::innerFillupTable(), and updateRates().

281 {
282  if ( areIndicesOutOfBounds( i, j ) )
283  {
284  cerr << "MarkovRateTable::lookup1dValue : Lookup requested on non-existent"
285  "table at (" << i + 1 << "," << j + 1 << "). Returning 0.\n";
286  return 0;
287  }
288 
289  if ( !isRate1d( i, j ) && !isRateConstant( i, j ) )
290  {
291  cerr << "MarkovRateTable::lookup1dValue : No 1D or constant rate set at "
292  "(" << i + 1 << "," << j + 1 << "). Returning 0.\n";
293  return 0;
294  }
295 
296  return vtTables_[i][j]->lookupByValue( x );
297 }
bool areIndicesOutOfBounds(unsigned int, unsigned int) const
bool isRateConstant(unsigned int, unsigned int) const
bool isRate1d(unsigned int, unsigned int) const
vector< vector< VectorTable * > > vtTables_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double MarkovRateTable::lookup2dIndex ( unsigned int  i,
unsigned int  j,
unsigned int  xIndex,
unsigned int  yIndex 
)

Definition at line 339 of file MarkovRateTable.cpp.

References areIndicesOutOfBounds(), int2dTables_, and isRate2d().

Referenced by MarkovSolverBase::innerFillupTable().

341 {
342  if ( areIndicesOutOfBounds( i, j ) )
343  {
344  cerr << "MarkovRateTable::lookup2dIndex : Lookup requested on non-existent"
345  " table at (" << i+1 << "," << j+1 << "). Returning 0.\n";
346  return 0;
347  }
348 
349  if ( !isRate2d( i, j ) )
350  {
351  cerr << "MarkovRateTable::lookup2dIndex : No 2D rate set at (" << i+1 << ","
352  << j+1 << "). Returning 0.\n";
353  return 0;
354  }
355 
356  vector< unsigned int > indices;
357  indices.push_back( xIndex );
358  indices.push_back( yIndex );
359 
360  return int2dTables_[i][j]->getTableValue( indices );
361 }
vector< vector< Interpol2D * > > int2dTables_
bool areIndicesOutOfBounds(unsigned int, unsigned int) const
bool isRate2d(unsigned int, unsigned int) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double MarkovRateTable::lookup2dValue ( unsigned int  i,
unsigned int  j,
double  x,
double  y 
)

Definition at line 319 of file MarkovRateTable.cpp.

References areIndicesOutOfBounds(), int2dTables_, and isRate2d().

Referenced by updateRates().

321 {
322  if ( areIndicesOutOfBounds( i, j ) )
323  {
324  cerr << "MarkovRateTable::lookup2dValue : Lookup requested on non-existent"
325  " table at (" << i + 1<< "," << j+1 << "). Returning 0.\n";
326  return 0;
327  }
328 
329  if ( !isRate2d( i, j ) )
330  {
331  cerr << "MarkovRateTable::lookup2dValue : No 2D rate set at (" << i+1 << ","
332  << j+1 << "). Returning 0.\n";
333  return 0;
334  }
335 
336  return int2dTables_[i][j]->innerLookup( x, y );
337 }
vector< vector< Interpol2D * > > int2dTables_
bool areIndicesOutOfBounds(unsigned int, unsigned int) const
bool isRate2d(unsigned int, unsigned int) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::process ( const Eref e,
ProcPtr  info 
)

Definition at line 608 of file MarkovRateTable.cpp.

References areAllRatesConstant(), instRatesOut(), Q_, and updateRates().

Referenced by initCinfo().

609 {
610  if ( !areAllRatesConstant() )
611  updateRates();
612 
613  instRatesOut()->send( e, Q_ );
614 }
static SrcFinfo1< vector< vector< double > > > * instRatesOut()
vector< vector< double > > Q_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::reinit ( const Eref e,
ProcPtr  info 
)

Definition at line 616 of file MarkovRateTable.cpp.

References initConstantRates(), instRatesOut(), isInitialized(), and Q_.

Referenced by initCinfo().

617 {
618  if ( isInitialized() )
620  else
621  cerr << "MarkovRateTable::reinit : MarkovRateTable class has not been"
622  " initialized!.";
623 
624  instRatesOut()->send( e, Q_ );
625 }
static SrcFinfo1< vector< vector< double > > > * instRatesOut()
bool isInitialized() const
vector< vector< double > > Q_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::setConstantRate ( unsigned int  i,
unsigned int  j,
double  rate 
)

Definition at line 685 of file MarkovRateTable.cpp.

References innerSetVtChildTable(), listOfConstantRates_, VectorTable::setDiv(), VectorTable::setMax(), VectorTable::setMin(), and VectorTable::setTable().

Referenced by initCinfo().

686 {
687  VectorTable vecTable;
688 
689  vecTable.setMin( rate );
690  vecTable.setMax( rate );
691  vecTable.setDiv( 1 );
692 
693  vector< double > rateWrap;
694  rateWrap.push_back( rate );
695 
696  vecTable.setTable( rateWrap );
697 
698  innerSetVtChildTable( i - 1, j - 1, vecTable, 0 );
699 
700  listOfConstantRates_.push_back( i * 10 + j );
701 }
vector< unsigned int > listOfConstantRates_
void setMin(double)
void setTable(vector< double >)
void setMax(double)
void innerSetVtChildTable(unsigned int, unsigned int, VectorTable, unsigned int)
void setDiv(unsigned int)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::setInt2dChildTable ( unsigned int  i,
unsigned int  j,
Id  int2dTabId 
)

Definition at line 670 of file MarkovRateTable.cpp.

References Eref::data(), Id::eref(), innerSetInt2dChildTable(), and listOf2dRates_.

Referenced by initCinfo().

672 {
673  Interpol2D* int2dTable = reinterpret_cast< Interpol2D* >
674  ( int2dTabId.eref().data() );
675 
676  innerSetInt2dChildTable( i - 1, j - 1, *int2dTable );
677 
678  listOf2dRates_.push_back( i * 10 + j );
679 }
char * data() const
Definition: Eref.cpp:41
vector< unsigned int > listOf2dRates_
Eref eref() const
Definition: Id.cpp:125
void innerSetInt2dChildTable(unsigned int, unsigned int, Interpol2D)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::setLigandConc ( double  ligandConc)

Definition at line 388 of file MarkovRateTable.cpp.

References ligandConc_.

Referenced by initCinfo().

389 {
390  ligandConc_ = ligandConc;
391 }

+ Here is the caller graph for this function:

void MarkovRateTable::setVm ( double  Vm)

Definition at line 378 of file MarkovRateTable.cpp.

References Vm_.

Referenced by initCinfo().

379 {
380  Vm_ = Vm;
381 }

+ Here is the caller graph for this function:

void MarkovRateTable::setVtChildTable ( unsigned int  i,
unsigned int  j,
Id  vecTabId,
unsigned int  ligandFlag 
)

Definition at line 654 of file MarkovRateTable.cpp.

References Eref::data(), Id::eref(), innerSetVtChildTable(), listOf1dRates_, listOfLigandRates_, and listOfVoltageRates_.

Referenced by initCinfo().

656 {
657  VectorTable* vecTable = reinterpret_cast< VectorTable* >
658  ( vecTabId.eref().data() );
659 
660  innerSetVtChildTable( i - 1, j - 1, *vecTable, ligandFlag );
661 
662  listOf1dRates_.push_back( i * 10 + j );
663 
664  if ( ligandFlag > 0 )
665  listOfLigandRates_.push_back( i * 10 + j );
666  else
667  listOfVoltageRates_.push_back( i * 10 + j );
668 }
char * data() const
Definition: Eref.cpp:41
Eref eref() const
Definition: Id.cpp:125
vector< unsigned int > listOfLigandRates_
void innerSetVtChildTable(unsigned int, unsigned int, VectorTable, unsigned int)
vector< unsigned int > listOfVoltageRates_
vector< unsigned int > listOf1dRates_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MarkovRateTable::updateRates ( )

Definition at line 484 of file MarkovRateTable.cpp.

References doubleEq(), isRateLigandDep(), ligandConc_, listOf1dRates_, listOf2dRates_, lookup1dValue(), lookup2dValue(), Q_, and Vm_.

Referenced by process().

485 {
486  double temp;
487  unsigned int i,j;
488 
489  //Update 1D rates, if any.
490  for( unsigned int k = 0; k < listOf1dRates_.size(); ++k )
491  {
492  j = ( listOf1dRates_[k] % 10 ) - 1;
493  i = ( ( listOf1dRates_[k] / 10 ) % 10 ) - 1;
494 
495  temp = Q_[i][j];
496 
497  if ( isRateLigandDep( i, j ) )
498  Q_[i][j] = lookup1dValue( i, j, ligandConc_ );
499  else
500  {
501  Q_[i][j] = lookup1dValue( i, j, Vm_ );
502  }
503 
504  //Ensures that the row sums to zero.
505  if ( !doubleEq( temp, Q_[i][j] ) )
506  Q_[i][i] = Q_[i][i] - Q_[i][j] + temp;
507  }
508 
509  //Update 2D rates, if any.
510  for( unsigned int k = 0; k < listOf2dRates_.size(); ++k )
511  {
512  j = ( listOf2dRates_[k] % 10 ) - 1;
513  i = ( ( listOf2dRates_[k] / 10 ) % 10 ) - 1;
514 
515  temp = Q_[i][j];
516 
517  Q_[i][j] = lookup2dValue( i, j, Vm_, ligandConc_ );
518 
519  //Ensures that the row sums to zero.
520  if ( !doubleEq( temp, Q_[i][j] ) )
521  Q_[i][i] = Q_[i][i] - Q_[i][j] + temp;
522  }
523 }
vector< unsigned int > listOf2dRates_
bool doubleEq(double x, double y)
Definition: doubleEq.cpp:16
bool isRateLigandDep(unsigned int, unsigned int) const
double lookup2dValue(unsigned int, unsigned int, double, double)
vector< unsigned int > listOf1dRates_
double lookup1dValue(unsigned int, unsigned int, double)
vector< vector< double > > Q_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

istream& operator>> ( istream &  ,
MarkovRateTable  
)
friend

Member Data Documentation

vector< vector< Interpol2D* > > MarkovRateTable::int2dTables_
private
double MarkovRateTable::ligandConc_
private
vector< unsigned int > MarkovRateTable::listOf1dRates_
private
vector< unsigned int > MarkovRateTable::listOf2dRates_
private
vector< unsigned int > MarkovRateTable::listOfConstantRates_
private
vector< unsigned int > MarkovRateTable::listOfLigandRates_
private

Definition at line 190 of file MarkovRateTable.h.

Referenced by areAnyRatesLigandDep(), getListOfLigandRates(), and setVtChildTable().

vector< unsigned int > MarkovRateTable::listOfVoltageRates_
private
vector< vector< double > > MarkovRateTable::Q_
private

Definition at line 194 of file MarkovRateTable.h.

Referenced by getQ(), init(), initConstantRates(), process(), reinit(), and updateRates().

unsigned int MarkovRateTable::size_
private
vector< vector< unsigned int > > MarkovRateTable::useLigandConc_
private

Definition at line 181 of file MarkovRateTable.h.

Referenced by init(), innerSetVtChildTable(), isRateLigandDep(), and operator>>().

double MarkovRateTable::Vm_
private

Definition at line 199 of file MarkovRateTable.h.

Referenced by getVm(), handleVm(), operator>>(), setVm(), and updateRates().

vector< vector< VectorTable* > > MarkovRateTable::vtTables_
private

The documentation for this class was generated from the following files: