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

#include <FuncRateTerm.h>

+ Inheritance diagram for FuncReac:
+ Collaboration diagram for FuncReac:

Public Member Functions

RateTermcopyWithVolScaling (double vol, double sub, double prd) const
 
 FuncReac (double k, vector< unsigned int > v)
 
unsigned int getReactants (vector< unsigned int > &molIndex) const
 
double operator() (const double *S) const
 Computes the rate. The argument is the molecule array. More...
 
void rescaleVolume (short comptIndex, const vector< short > &compartmentLookup, double ratio)
 
void setReactants (const vector< unsigned int > &molIndex)
 
- Public Member Functions inherited from FuncRate
 FuncRate (double k, unsigned int targetPoolIndex)
 
const string & getExpr () const
 
const vector< unsigned int > & getFuncArgIndex ()
 
void setExpr (const string &s)
 
void setFuncArgIndex (const vector< unsigned int > &mol)
 
void setReactants (const vector< unsigned int > &molIndex)
 
- Public Member Functions inherited from ExternReac
RateTermcopyWithVolScaling (double vol, double sub, double prd) const
 
double getR1 () const
 Used by Zombie to return rate terms. More...
 
double getR2 () const
 Used by Zombie to return rate terms. More...
 
unsigned int getReactants (vector< unsigned int > &molIndex) const
 
double operator() (const double *S) const
 Computes the rate. The argument is the molecule array. More...
 
void rescaleVolume (short comptIndex, const vector< short > &compartmentLookup, double ratio)
 
void setR1 (double k1)
 Used by Zombie to assign rate terms. More...
 
void setR2 (double k2)
 Used by Zombie to assign rate terms. More...
 
void setRates (double k1, double k2)
 
- Public Member Functions inherited from RateTerm
 RateTerm ()
 
virtual ~RateTerm ()
 

Private Attributes

unsigned int numSubstrates_
 
vector< unsigned int > v_
 

Additional Inherited Members

- Static Public Attributes inherited from RateTerm
static const double EPSILON = 1.0e-6
 
- Protected Attributes inherited from FuncRate
FuncTerm func_
 
double funcVolPower_
 
double k_
 

Detailed Description

This FuncReac manages a one-way NOrder reaction whose rate is determined by a Function, but which also has regular substrates and products.

dproduct/dt = func( x0, x1, x2..., t ) * [sub0] * [sub1] * ....

The values x0, x1, x2 are expected to be concentrations so that they do not depend on volume. The substrates sub0, sub1, ... are # of molecules. The term k_ is scaled so that it is unity at vol = 1/NA m^3. k_ = (NA * vol)^(numSub-1) The copyWithVolScaling operation scales it up and down from there.

Definition at line 99 of file FuncRateTerm.h.

Constructor & Destructor Documentation

FuncReac::FuncReac ( double  k,
vector< unsigned int >  v 
)
inline

Definition at line 102 of file FuncRateTerm.h.

Referenced by copyWithVolScaling().

103  : FuncRate( k, 0 ),
104  v_( v )
105  {;}
FuncRate(double k, unsigned int targetPoolIndex)
Definition: FuncRateTerm.h:25
vector< unsigned int > v_
Definition: FuncRateTerm.h:151

+ Here is the caller graph for this function:

Member Function Documentation

RateTerm* FuncReac::copyWithVolScaling ( double  vol,
double  sub,
double  prd 
) const
inlinevirtual

Duplicates rate term and then applies volume scaling. Arguments are volume of reference voxel, product of vol/refVol for all substrates: applied to R1 product of vol/refVol for all products: applied to R2

Note that unless the reaction is cross-compartment, the vol/refVol will be one.

Reimplemented from FuncRate.

Definition at line 137 of file FuncRateTerm.h.

References FuncRate::func_, FuncReac(), FuncRate::funcVolPower_, FuncRate::k_, NA, and v_.

139  {
140  assert( v_.size() > 0 );
141  double ratio = sub * pow( NA * vol,
142  funcVolPower_ + (int)( v_.size() ) - 1 );
143  FuncReac* ret = new FuncReac( k_ / ratio, v_ );
144  ret->func_ = func_;
146  return ret;
147  // return new FuncReac( k_ / ratio, v_ );
148  }
const double NA
Definition: consts.cpp:15
FuncTerm func_
Definition: FuncRateTerm.h:78
double funcVolPower_
Definition: FuncRateTerm.h:80
double k_
Definition: FuncRateTerm.h:79
FuncReac(double k, vector< unsigned int > v)
Definition: FuncRateTerm.h:102
vector< unsigned int > v_
Definition: FuncRateTerm.h:151

+ Here is the call graph for this function:

unsigned int FuncReac::getReactants ( vector< unsigned int > &  molIndex) const
inlinevirtual

This function finds the reactant indices in the vector S. It returns the number of substrates found, which are the first entries in molIndex. The products are the remaining ones. Note that it does NOT find products for unidirectional reactions, which is a bit of a problem.

Reimplemented from FuncRate.

Definition at line 118 of file FuncRateTerm.h.

References numSubstrates_, and v_.

118  {
119  molIndex = v_;
120  return numSubstrates_;
121  }
vector< unsigned int > v_
Definition: FuncRateTerm.h:151
unsigned int numSubstrates_
Definition: FuncRateTerm.h:152
double FuncReac::operator() ( const double *  S) const
inlinevirtual

Computes the rate. The argument is the molecule array.

Reimplemented from FuncRate.

Definition at line 107 of file FuncRateTerm.h.

References FuncRate::func_, and v_.

107  {
108  // double ret = k_ * func_( S, 0.0 ); // get rate from func calculation.
109  double ret = func_( S, 0.0 ); // get rate from func calculation.
110  vector< unsigned int >::const_iterator i;
111  for ( i = v_.begin(); i != v_.end(); i++) {
112  assert( !std::isnan( S[ *i ] ) );
113  ret *= S[ *i ];
114  }
115  return ret;
116  }
FuncTerm func_
Definition: FuncRateTerm.h:78
vector< unsigned int > v_
Definition: FuncRateTerm.h:151
void FuncReac::rescaleVolume ( short  comptIndex,
const vector< short > &  compartmentLookup,
double  ratio 
)
inlinevirtual

This is used to rescale the RateTerm kinetics when the compartment volume changes. This is needed because the kinetics are in extensive units, that is, mol numbers, rather than in intensive units like concentration. So when the volume changes the rate terms change. Each Rate term checks if any of its reactant molecules are affected, and if so, rescales. Ratio is newVol / oldVol

Implements RateTerm.

Definition at line 127 of file FuncRateTerm.h.

References FuncRate::k_, and v_.

129  {
130  for ( unsigned int i = 1; i < v_.size(); ++i ) {
131  if ( comptIndex == compartmentLookup[ v_[i] ] )
132  k_ /= ratio;
133  }
134  }
double k_
Definition: FuncRateTerm.h:79
vector< unsigned int > v_
Definition: FuncRateTerm.h:151
void FuncReac::setReactants ( const vector< unsigned int > &  molIndex)
inline

Definition at line 123 of file FuncRateTerm.h.

References v_.

123  {
124  v_ = molIndex;
125  }
vector< unsigned int > v_
Definition: FuncRateTerm.h:151

Member Data Documentation

unsigned int FuncReac::numSubstrates_
private

Definition at line 152 of file FuncRateTerm.h.

Referenced by getReactants().

vector< unsigned int > FuncReac::v_
private

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