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

#include <FuncRateTerm.h>

+ Inheritance diagram for FuncRate:
+ Collaboration diagram for FuncRate:

Public Member Functions

RateTermcopyWithVolScaling (double vol, double sub, double prd) const
 
 FuncRate (double k, unsigned int targetPoolIndex)
 
const string & getExpr () const
 
const vector< unsigned int > & getFuncArgIndex ()
 
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 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 ()
 

Protected Attributes

FuncTerm func_
 
double funcVolPower_
 
double k_
 

Additional Inherited Members

- Static Public Attributes inherited from RateTerm
static const double EPSILON = 1.0e-6
 

Detailed Description

This FuncRate manages a one-way reaction whose rate is determined by a Function. It has no substrates, just controls the rate of change of a target molecule.

dtarget/dt = func( x0, x1, x2..., t )

The values x0, x1, x2.. are numbers at this point. So is the rate output of this function. There may be a problem if there is a volume change.

Definition at line 22 of file FuncRateTerm.h.

Constructor & Destructor Documentation

FuncRate::FuncRate ( double  k,
unsigned int  targetPoolIndex 
)
inline

Definition at line 25 of file FuncRateTerm.h.

References func_, and FuncTerm::setTarget().

Referenced by copyWithVolScaling().

26  : k_( k ), funcVolPower_( 0.0 )
27  {
28  func_.setTarget( targetPoolIndex );
29  }
FuncTerm func_
Definition: FuncRateTerm.h:78
double funcVolPower_
Definition: FuncRateTerm.h:80
void setTarget(unsigned int tgt)
Definition: FuncTerm.cpp:100
double k_
Definition: FuncRateTerm.h:79

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Function Documentation

RateTerm* FuncRate::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.

Implements RateTerm.

Reimplemented in FuncReac.

Definition at line 66 of file FuncRateTerm.h.

References func_, FuncRate(), funcVolPower_, FuncTerm::getTarget(), k_, and NA.

68  {
69  double ratio = sub * pow( NA * vol, funcVolPower_ );
70  FuncRate* ret = new FuncRate( k_ / ratio, func_.getTarget() );
72  ret->func_ = func_;
73  // return new FuncRate( k_ / ratio );
74  return ret;
75  }
const double NA
Definition: consts.cpp:15
const unsigned int getTarget() const
Definition: FuncTerm.cpp:105
FuncTerm func_
Definition: FuncRateTerm.h:78
double funcVolPower_
Definition: FuncRateTerm.h:80
double k_
Definition: FuncRateTerm.h:79
FuncRate(double k, unsigned int targetPoolIndex)
Definition: FuncRateTerm.h:25

+ Here is the call graph for this function:

const string& FuncRate::getExpr ( ) const
inline

Definition at line 62 of file FuncRateTerm.h.

References func_, and FuncTerm::getExpr().

62  {
63  return func_.getExpr();
64  }
FuncTerm func_
Definition: FuncRateTerm.h:78
const string & getExpr() const
Definition: FuncTerm.cpp:95

+ Here is the call graph for this function:

const vector< unsigned int >& FuncRate::getFuncArgIndex ( )
inline

Definition at line 50 of file FuncRateTerm.h.

References func_, and FuncTerm::getReactantIndex().

51  {
52  return func_.getReactantIndex();
53  }
FuncTerm func_
Definition: FuncRateTerm.h:78
const vector< unsigned int > & getReactantIndex() const
Definition: FuncTerm.cpp:67

+ Here is the call graph for this function:

unsigned int FuncRate::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.

Implements RateTerm.

Reimplemented in FuncReac.

Definition at line 36 of file FuncRateTerm.h.

References func_, and FuncTerm::getTarget().

36  {
37  molIndex.resize( 1 );
38  molIndex[0] = func_.getTarget();
39 
40  // This is the number of substrates to the reac. It is zero.
41  return 0;
42  // The target molecule is handled as a product.
43  }
const unsigned int getTarget() const
Definition: FuncTerm.cpp:105
FuncTerm func_
Definition: FuncRateTerm.h:78

+ Here is the call graph for this function:

double FuncRate::operator() ( const double *  S) const
inlinevirtual

Computes the rate. The argument is the molecule array.

Implements RateTerm.

Reimplemented in FuncReac.

Definition at line 31 of file FuncRateTerm.h.

References func_, and Field< A >::get().

31  {
32  double t = Field< double >::get( Id(1), "currentTime" );
33  return func_( S, t ); // get rate from func calculation.
34  }
FuncTerm func_
Definition: FuncRateTerm.h:78
Definition: Id.h:17
static A get(const ObjId &dest, const string &field)
Definition: SetGet.h:284

+ Here is the call graph for this function:

void FuncRate::setExpr ( const string &  s)
inline

Definition at line 59 of file FuncRateTerm.h.

References func_, and FuncTerm::setExpr().

Referenced by Stoich::installAndUnschedFuncRate(), Stoich::installAndUnschedFuncReac(), and Stoich::setFunctionExpr().

59  {
60  func_.setExpr( s );
61  }
void setExpr(const string &e)
Definition: FuncTerm.cpp:83
FuncTerm func_
Definition: FuncRateTerm.h:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void FuncRate::setFuncArgIndex ( const vector< unsigned int > &  mol)
inline

Definition at line 55 of file FuncRateTerm.h.

References func_, and FuncTerm::setReactantIndex().

Referenced by Stoich::installAndUnschedFuncRate(), and Stoich::installAndUnschedFuncReac().

55  {
56  func_.setReactantIndex( mol );
57  }
FuncTerm func_
Definition: FuncRateTerm.h:78
void setReactantIndex(const vector< unsigned int > &mol)
Definition: FuncTerm.cpp:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void FuncRate::setReactants ( const vector< unsigned int > &  molIndex)
inline

Definition at line 45 of file FuncRateTerm.h.

References func_, and FuncTerm::setTarget().

45  {
46  assert( molIndex.size() > 0 );
47  func_.setTarget( molIndex[0] );
48  }
FuncTerm func_
Definition: FuncRateTerm.h:78
void setTarget(unsigned int tgt)
Definition: FuncTerm.cpp:100

+ Here is the call graph for this function:

Member Data Documentation

double FuncRate::funcVolPower_
protected

Definition at line 80 of file FuncRateTerm.h.

Referenced by copyWithVolScaling(), and FuncReac::copyWithVolScaling().

double FuncRate::k_
protected

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