NFcore::ReactantTree Class Reference

#include <reactantTree.hh>

Inheritance diagram for NFcore::ReactantTree:

NFcore::ReactantContainer

List of all members.


Detailed Description

Maintains a tree of MappingSets needed by Distribution of Rates Reactions.

This is one of the more complex classes in NFsim. It is written in order to handle distribution of rates reactions. These types of reactions have many reactants, but each reactant can participate with a different rate. The rate is determined by the set of molecules that the reactant is connected to. Therefore, we need a tree (or we could have also used logarithmic classes) to efficiently select the next reactant weighted by each of its propensities.

A key example of this is in the chemotaxis system. Clusters of receptors influence the rate of CheA autophosphorylation.

Public Member Functions

 ReactantTree (unsigned int reactantIndex, TransformationSet *ts, unsigned int init_capacity)
virtual ~ReactantTree ()
virtual int size () const
virtual MappingSetpushNextAvailableMappingSet ()
void confirmPush (int mappingSetId, double rateFactor)
virtual void popLastMappingSet ()
virtual void removeMappingSet (unsigned int mappingSetId)
void pickReactantFromValue (MappingSet *&ms, double value, double baseRate)
void updateValue (unsigned int mappingSetId, double newRateFactor)
virtual MappingSetgetMappingSet (unsigned int mappingSetId) const
virtual void printDetails () const
double getRateFactorSum () const
int getDepthOfTree () const

Protected Member Functions

void removeFromTreeOnly (int msTreeArrayPosition, unsigned int mappingSetId)
void expandTree (int newCapacity)

Protected Attributes

TransformationSetts
unsigned int reactantIndex
int maxElementCount
int treeDepth
int numOfNodes
double * leftRateFactorSum
int * leftElementCount
int * rightElementCount
MappingSet ** mappingSets
int * msPositionMap
int * msTreePositionMap
int * reverseMsTreePositionMap
int n_mappingSets
unsigned int firstMappingTreeIndex


Constructor & Destructor Documentation

ReactantTree::ReactantTree ( unsigned int  reactantIndex,
TransformationSet ts,
unsigned int  init_capacity 
)

Create a reactant tree, based on the given transformation set (so we can create mappings at the given reactant index. The tree will be initialized such that it can immediately hold the number of objects specified by the init_capacity.

ReactantTree::~ReactantTree (  )  [virtual]

Standard deconstructor for the tree


Member Function Documentation

virtual int NFcore::ReactantTree::size (  )  const [inline, virtual]

Returns the number of mappingSets that have been added to this tree

Implements NFcore::ReactantContainer.

MappingSet * ReactantTree::pushNextAvailableMappingSet (  )  [virtual]

Adds a new MappingSet to this tree and returns a pointer to the new mapping set for you to map (usually by comparing to some template molecule). Warning: even if you don't use this mapping set, it will be counted until you pop it or remove it! (see removeMappingSet()). This has a special behavior in the ReactantTree. This method merely gets you a pointer to the next available mappingset: if you decide to keep the mapping, you have to confirm it. Confirming the mapping actually places it in the tree. If you don't do this, it won't ever be selected by the tree.

Implements NFcore::ReactantContainer.

void ReactantTree::confirmPush ( int  mappingSetId,
double  rateFactor 
)

Once you have pushed on the next available mappingSet, you have to confirm that push. In the event that mappingsets are cloned, this will confirm all mappingsets that have been cloned off of the given mapping set.

void ReactantTree::popLastMappingSet (  )  [virtual]

Removes the very last mappingSet that was added to the list. You should actually now use the removeMappingSet function instead, just to be careful.

Implements NFcore::ReactantContainer.

void ReactantTree::removeMappingSet ( unsigned int  mappingSetId  )  [virtual]

Removes the mapping set with the specified mappingSetId. Be careful here: make sure the mapping set is actually on the list before trying to remove or else this will give you an error!

Implements NFcore::ReactantContainer.

void ReactantTree::pickReactantFromValue ( MappingSet *&  ms,
double  value,
double  baseRate 
)

This is the key utility of a reactant tree: given a random value, we can select the next reactant to fire with this function that weights the selection of any particular reactant by

void ReactantTree::updateValue ( unsigned int  mappingSetId,
double  newRateFactor 
)

When a local function value changes, it must update the value in the reactant tree. This method allows you to update values without changing the mappingSet membership of this tree.

MappingSet * ReactantTree::getMappingSet ( unsigned int  mappingSetId  )  const [virtual]

Returns a MappingSet so that a DOR can evaluate a local function on it.

Implements NFcore::ReactantContainer.

void ReactantTree::printDetails (  )  const [virtual]

Outputs basic details about this tree - used only for debugging, because it really does print out everything

Implements NFcore::ReactantContainer.

double NFcore::ReactantTree::getRateFactorSum (  )  const [inline]

Returns the combined rate factor sum of this tree, which is needed by the DOR reactionclass in order to properly update its propensity

int NFcore::ReactantTree::getDepthOfTree (  )  const [inline]

Returns the depth of the tree (which you shouldn't ever really need...)

void ReactantTree::removeFromTreeOnly ( int  msTreeArrayPosition,
unsigned int  mappingSetId 
) [protected]

Removes a mapping set from the tree only. This method should only be used by the tree!

void ReactantTree::expandTree ( int  newCapacity  )  [protected]

If we try to add more than this tree can handle, we have to expand it. Because the tree is a complete binary tree, this will necessarily double its capacity, or enlarge it more depending on the given new capacity.

Take special precaution here!! we don't want to actually reallocate the mappingSets! because then we would have to recompare each molecule to this template again! Instead, we will initialze only the end of this array, and fill in the rest of the array with the original elements, putting them in the proper position based on their id


Member Data Documentation

TransformationSet* NFcore::ReactantTree::ts [protected]

unsigned int NFcore::ReactantTree::reactantIndex [protected]

int NFcore::ReactantTree::maxElementCount [protected]

int NFcore::ReactantTree::treeDepth [protected]

int NFcore::ReactantTree::numOfNodes [protected]

double* NFcore::ReactantTree::leftRateFactorSum [protected]

int* NFcore::ReactantTree::leftElementCount [protected]

int* NFcore::ReactantTree::rightElementCount [protected]

MappingSet** NFcore::ReactantTree::mappingSets [protected]

int* NFcore::ReactantTree::msPositionMap [protected]

int* NFcore::ReactantTree::msTreePositionMap [protected]

int* NFcore::ReactantTree::reverseMsTreePositionMap [protected]

int NFcore::ReactantTree::n_mappingSets [protected]

unsigned int NFcore::ReactantTree::firstMappingTreeIndex [protected]


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 11:02:48 2010 for NFsim by  doxygen 1.5.4