MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZombieMMenz.cpp
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-2010 Upinder S. Bhalla. 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 #include "header.h"
10 
11 #include "lookupVolumeFromMesh.h"
12 #include "RateTerm.h"
13 #include "FuncTerm.h"
14 #include "SparseMatrix.h"
15 #include "KinSparseMatrix.h"
16 #include "VoxelPoolsBase.h"
17 #include "../mesh/VoxelJunction.h"
18 #include "XferInfo.h"
19 #include "ZombiePoolInterface.h"
20 #include "Stoich.h"
21 
22 #include "EnzBase.h"
23 #include "ZombieMMenz.h"
24 
25 #define EPSILON 1e-15
26 
28 {
30  // Field Definitions
33  // MsgDest Definitions
36  // Shared Msg Definitions
38 
39  static string doc[] = {
40  "Name", "ZombieMMenz",
41  "Author", "Upi Bhalla",
42  "Description", "Zombie class for MM (Michaelis-Menten) enzyme."
43  };
44  static Dinfo< ZombieMMenz > dinfo;
45  static Cinfo zombieMMenzCinfo (
46  "ZombieMMenz",
48  0,
49  0,
50  &dinfo,
51  doc,
52  sizeof(doc)/sizeof(string)
53  );
54 
55  return &zombieMMenzCinfo;
56 }
57 
59 
61 
63  dynamic_cast< const SrcFinfo2< double, double >* >(
64  zombieMMenzCinfo->findFinfo( "subOut" ) );
65 
67  dynamic_cast< const SrcFinfo2< double, double >* >(
68  zombieMMenzCinfo->findFinfo( "prdOut" ) );
69 
71 // ZombieMMenz internal functions
73 
74 
76  : Km_( 0.005 )
77 {;}
78 
80 // MsgDest Definitions
82 
83 /*
84 void ZombieMMenz::vRemesh( const Eref& e )
85 {
86  // cout << "ZombieMMenz::remesh for " << e << endl;
87  stoich_->setMMenzKm( e, Km_ );
88 }
89 */
90 
92 // Field Definitions
94 
95 // Note that the units in the Stoich are where 1 uM = 1 molecule/voxel.
96 // So we set the conc terms directly.
97 void ZombieMMenz::vSetKm( const Eref& e, double v )
98 {
99  Km_ = v;
100  stoich_->setMMenzKm( e, v );
101  //double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 );
102  //stoich_->setMMenzKm( e, v * volScale );
103 }
104 
105 double ZombieMMenz::vGetKm( const Eref& e ) const
106 {
107  return Km_;
108 }
109 
110 void ZombieMMenz::vSetNumKm( const Eref& e, double v )
111 {
112  double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 );
113  Km_ = v / volScale;
114  stoich_->setMMenzKm( e, Km_ );
115 }
116 
117 double ZombieMMenz::vGetNumKm( const Eref& e ) const
118 {
119  double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 );
120  return Km_ * volScale;
121  // return stoich_->getMMenzNumKm( e );
122 }
123 
124 void ZombieMMenz::vSetKcat( const Eref& e, double v )
125 {
126  if ( v < EPSILON )
127  v = EPSILON;
128  stoich_->setMMenzKcat( e, v );
129 }
130 
131 double ZombieMMenz::vGetKcat( const Eref& e ) const
132 {
133  return stoich_->getMMenzKcat( e );
134 }
135 
137 // Utility function
139 
140 void ZombieMMenz::setSolver( Id solver, Id enzId )
141 {
142  static const DestFinfo* enzFinfo = dynamic_cast< const DestFinfo* >(
143  EnzBase::initCinfo()->findFinfo( "enzDest" ) );
144  static const SrcFinfo* subFinfo = dynamic_cast< const SrcFinfo* >(
145  EnzBase::initCinfo()->findFinfo( "subOut" ) );
146  static const SrcFinfo* prdFinfo = dynamic_cast< const SrcFinfo* >(
147  EnzBase::initCinfo()->findFinfo( "prdOut" ) );
148  assert( enzFinfo );
149  assert( subFinfo );
150  assert( prdFinfo );
151 
152  assert( solver.element()->cinfo()->isA( "Stoich" ) );
153  stoich_ = reinterpret_cast< Stoich* >( solver.eref().data() );
154 
156  vector< Id > enzvec;
157  vector< Id > subvec;
158  vector< Id > prdvec;
159  unsigned int num = enzId.element()->getNeighbors( enzvec, enzFinfo );
160  num = enzId.element()->getNeighbors( subvec, subFinfo );
161  num = enzId.element()->getNeighbors( prdvec, prdFinfo );
162  stoich_->installMMenz( enzId, enzvec, subvec, prdvec );
163 }
void setMMenzKm(const Eref &e, double v) const
Definition: Stoich.cpp:1895
char * data() const
Definition: Eref.cpp:41
void vSetKm(const Eref &e, double v)
Definition: ZombieMMenz.cpp:97
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
Definition: Dinfo.h:60
static const SrcFinfo2< double, double > * subOut
Definition: ZombieMMenz.cpp:62
#define EPSILON
Definition: ZombieMMenz.cpp:25
void setMMenzKcat(const Eref &e, double v) const
Definition: Stoich.cpp:1926
double vGetNumKm(const Eref &e) const
static const Cinfo * zombieMMenzCinfo
Definition: ZombieMMenz.cpp:60
Eref eref() const
Definition: Id.cpp:125
void setSolver(Id solver, Id orig)
void vSetKcat(const Eref &e, double v)
Definition: Stoich.h:49
static const Cinfo * initCinfo()
Definition: ZombieMMenz.cpp:27
double vGetKm(const Eref &e) const
double Km_
Definition: ZombieMMenz.h:51
Definition: Eref.h:26
bool isA(const string &ancestor) const
Definition: Cinfo.cpp:280
const Cinfo * cinfo() const
Definition: Element.cpp:66
double convertConcToNumRateUsingMesh(const Eref &e, const SrcFinfo *pools, bool doPartialConversion)
Stoich * stoich_
Definition: ZombieMMenz.h:50
double vGetKcat(const Eref &e) const
double getMMenzKcat(const Eref &e) const
Definition: Stoich.cpp:1937
static const SrcFinfo2< double, double > * prdOut
Definition: ZombieMMenz.cpp:66
Definition: Id.h:17
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
Definition: Element.cpp:949
void vSetNumKm(const Eref &e, double v)
Definition: Cinfo.h:18
static const Cinfo * initCinfo()
Definition: EnzBase.cpp:33
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224