MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZombieReac.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 
10 #include "header.h"
11 #include "ReacBase.h"
12 #include "lookupVolumeFromMesh.h"
13 #include "RateTerm.h"
14 #include "FuncTerm.h"
15 #include "SparseMatrix.h"
16 #include "KinSparseMatrix.h"
17 #include "VoxelPoolsBase.h"
18 #include "../mesh/VoxelJunction.h"
19 #include "XferInfo.h"
20 #include "ZombiePoolInterface.h"
21 #include "Stoich.h"
22 #include "ZombieReac.h"
23 
24 // #include "Reac.h"
25 // #include "ElementValueFinfo.h"
26 // #include "DataHandlerWrapper.h"
27 
29 {
31  // Field Definitions: All inherited.
34  // MsgDest Definitions: All inherited.
37  // SharedMsg Definitions: All inherited
39 
40  static Dinfo< ZombieReac > dinfo( true );
41  static Cinfo zombieReacCinfo (
42  "ZombieReac",
44  0,
45  0,
46  &dinfo
47  );
48 
49  return &zombieReacCinfo;
50 }
51 
53 // Class definitions
56 
58  dynamic_cast< const SrcFinfo2< double, double >* >(
59  zombieReacCinfo->findFinfo( "subOut" ) );
60 
62  dynamic_cast< const SrcFinfo2< double, double >* >(
63  zombieReacCinfo->findFinfo( "prdOut" ) );
64 
66  : stoich_( 0 )
67 {;}
68 
70 {;}
71 
72 
74 // MsgDest Definitions
76 
77 /*
78 void ZombieReac::vRemesh( const Eref& e )
79 {
80  stoich_->setReacKf( e, concKf_ );
81  stoich_->setReacKb( e, concKb_ );
82 }
83 */
84 
86 // Field Definitions
88 
89 // This conversion is deprecated, used mostly for kkit conversions.
90 void ZombieReac::vSetNumKf( const Eref& e, double v )
91 {
92  double volScale = convertConcToNumRateUsingMesh( e, subOut, 0 );
93  concKf_ = v * volScale;
94  stoich_->setReacKf( e, concKf_ );
95 }
96 
97 double ZombieReac::vGetNumKf( const Eref& e ) const
98 {
99  // Return value for voxel 0. Conceivably I might want to use the
100  // DataId part to specify which voxel to use, but that isn't in the
101  // current definition for Reacs as being a single entity for the entire
102  // compartment.
103  double volScale = convertConcToNumRateUsingMesh( e, subOut, 0 );
104  return concKf_ / volScale;
105 }
106 
107 // Deprecated, used for kkit conversion backward compatibility
108 void ZombieReac::vSetNumKb( const Eref& e, double v )
109 {
110  double volScale = convertConcToNumRateUsingMesh( e, prdOut, 0 );
111  concKb_ = v * volScale;
112  stoich_->setReacKb( e, concKb_ );
113 }
114 
115 double ZombieReac::vGetNumKb( const Eref& e ) const
116 {
117  double volScale = convertConcToNumRateUsingMesh( e, prdOut, 0 );
118  return concKb_ / volScale;
119 }
120 
121 void ZombieReac::vSetConcKf( const Eref& e, double v )
122 {
123  concKf_ = v;
124  stoich_->setReacKf( e, v );
125 }
126 
127 double ZombieReac::vGetConcKf( const Eref& e ) const
128 {
129  return concKf_;
130 }
131 
132 void ZombieReac::vSetConcKb( const Eref& e, double v )
133 {
134  concKb_ = v;
135  stoich_->setReacKb( e, v );
136 }
137 
138 double ZombieReac::vGetConcKb( const Eref& e ) const
139 {
140  // double volScale = convertConcToNumRateUsingMesh( e, prdOut, 0 );
141  // double kb = stoich_->getReacNumKb( e );
142  // return kb / volScale;
143  return concKb_;
144 }
145 
147 // Utility function
149 
150 // Virtual func called in zombify before fields are assigned.
151 void ZombieReac::setSolver( Id stoich, Id orig )
152 {
153  assert( stoich != Id() );
154 
155  vector< Id > sub;
156  vector< Id > prd;
157  orig.element()->getNeighbors( sub, subOut );
158  orig.element()->getNeighbors( prd, prdOut );
159 
160  assert( stoich.element()->cinfo()->isA( "Stoich" ) );
161  stoich_ = reinterpret_cast< Stoich* >( stoich.eref().data( ) );
162  stoich_->installReaction( orig, sub, prd );
163 }
double concKf_
Definition: ReacBase.h:86
void sub(double v)
Definition: ReacBase.cpp:177
char * data() const
Definition: Eref.cpp:41
void setReacKf(const Eref &e, double v) const
Definition: Stoich.cpp:1860
double vGetConcKf(const Eref &e) const
Definition: ZombieReac.cpp:127
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
double vGetConcKb(const Eref &e) const
Definition: ZombieReac.cpp:138
Definition: Dinfo.h:60
void prd(double v)
Definition: ReacBase.cpp:182
void vSetConcKb(const Eref &e, double v)
Definition: ZombieReac.cpp:132
double concKb_
Definition: ReacBase.h:87
Eref eref() const
Definition: Id.cpp:125
void vSetNumKf(const Eref &e, double v)
Definition: ZombieReac.cpp:90
void vSetConcKf(const Eref &e, double v)
Definition: ZombieReac.cpp:121
static const Cinfo * initCinfo()
Definition: ZombieReac.cpp:28
void installReaction(Id reacId, const vector< Id > &subs, const vector< Id > &prds)
Definition: Stoich.cpp:1525
Definition: Stoich.h:49
void setReacKb(const Eref &e, double v) const
Definition: Stoich.cpp:1874
Stoich * stoich_
Definition: ZombieReac.h:49
void setSolver(Id solver, Id orig)
Assign solver info.
Definition: ZombieReac.cpp:151
static const Cinfo * zombieReacCinfo
Definition: ZombieReac.cpp:55
static const Cinfo * initCinfo()
Definition: ReacBase.cpp:33
Definition: Eref.h:26
bool isA(const string &ancestor) const
Definition: Cinfo.cpp:280
static const SrcFinfo2< double, double > * prdOut
Definition: ZombieReac.cpp:61
const Cinfo * cinfo() const
Definition: Element.cpp:66
double convertConcToNumRateUsingMesh(const Eref &e, const SrcFinfo *pools, bool doPartialConversion)
double vGetNumKb(const Eref &e) const
Definition: ZombieReac.cpp:115
Definition: Id.h:17
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
Definition: Element.cpp:949
static const SrcFinfo2< double, double > * subOut
Definition: ZombieReac.cpp:57
void vSetNumKb(const Eref &e, double v)
Definition: ZombieReac.cpp:108
Definition: Cinfo.h:18
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
double vGetNumKf(const Eref &e) const
Definition: ZombieReac.cpp:97