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

#include <RateTerm.h>

+ Inheritance diagram for StochNOrder:
+ Collaboration diagram for StochNOrder:

Public Member Functions

RateTermcopyWithVolScaling (double vol, double sub, double prd) const
 
double operator() (const double *S) const
 Computes the rate. The argument is the molecule array. More...
 
 StochNOrder (double k, vector< unsigned int > v)
 
- Public Member Functions inherited from NOrder
unsigned int getReactants (vector< unsigned int > &molIndex) const
 
 NOrder (double k, vector< unsigned int > v)
 
void rescaleVolume (short comptIndex, const vector< short > &compartmentLookup, double ratio)
 
- Public Member Functions inherited from ZeroOrder
double getR1 () const
 Used by Zombie to return rate terms. More...
 
double getR2 () const
 Used by Zombie to return rate terms. More...
 
void setK (double k)
 
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)
 
 ZeroOrder (double k)
 
- Public Member Functions inherited from RateTerm
 RateTerm ()
 
virtual ~RateTerm ()
 

Additional Inherited Members

- Static Public Attributes inherited from RateTerm
static const double EPSILON = 1.0e-6
 
- Protected Attributes inherited from NOrder
vector< unsigned int > v_
 
- Protected Attributes inherited from ZeroOrder
double k_
 

Detailed Description

This is an unpleasant case, like the StochSecondOrderSingleSubstrate. Here we deal with the possibility that one or more of the substrates may be of order greater than one. If so, we need to diminish the N of each substrate by one for each time the substrate is factored into the rate.

Definition at line 522 of file RateTerm.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file RateTerm.cpp.

References NOrder::v_.

Referenced by copyWithVolScaling().

22  : NOrder( k, v )
23 {
24  // Here we sort the y vector so that if there are repeated
25  // substrates, they are put consecutively. This lets us use
26  // the algorithm below to deal with repeats.
27  sort( v_.begin(), v_.end() );
28 }
NOrder(double k, vector< unsigned int > v)
Definition: RateTerm.h:475
vector< unsigned int > v_
Definition: RateTerm.h:512

+ Here is the caller graph for this function:

Member Function Documentation

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

Definition at line 529 of file RateTerm.h.

References ZeroOrder::k_, NA, StochNOrder(), and NOrder::v_.

531  {
532  assert( v_.size() > 0 );
533  double ratio = sub * pow( vol * NA, (int)( v_.size() ) -1);
534  return new StochNOrder( k_ / ratio, v_ );
535  }
double k_
Definition: RateTerm.h:311
const double NA
Definition: consts.cpp:15
StochNOrder(double k, vector< unsigned int > v)
Definition: RateTerm.cpp:21
vector< unsigned int > v_
Definition: RateTerm.h:512

+ Here is the call graph for this function:

double StochNOrder::operator() ( const double *  S) const
virtual

Computes the rate. The argument is the molecule array.

Reimplemented from NOrder.

Definition at line 30 of file RateTerm.cpp.

References ZeroOrder::k_, and NOrder::v_.

30  {
31  double ret = k_;
32  vector< unsigned int >::const_iterator i;
33  unsigned int lasty = 0;
34  double y = 0.0;
35  for ( i = v_.begin(); i != v_.end(); i++) {
36  assert( !std::isnan( S[ *i ] ) );
37  if ( lasty == *i )
38  y -= 1.0;
39  else
40  y = S[ *i ];
41  ret *= y;
42  lasty = *i;
43  }
44  return ret;
45 }
double k_
Definition: RateTerm.h:311
vector< unsigned int > v_
Definition: RateTerm.h:512

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