NFcore::ReactantList Class Reference

#include <reactantList.hh>

Inheritance diagram for NFcore::ReactantList:

NFcore::ReactantContainer

List of all members.


Detailed Description

Maintains a list of MappingSets needed by ReactionClass.

This is essentially a specialized vector implementation that allows a ReactionClass to easily keep track of all the MappingSet objects that can be involved in the reaction. All MappingSet objects stored in this class are created once and reused throughout the course of the simulation. This prevents new MappingSet objects to be created and destroyed. This class has the ability to automatically expand its capacity when extra mappings are needed, so there is no need for the user to manage these details. This class allows for constant time removal, insertion, and random selection of MappingSets, while std::vector requires linear time removal. We gain this speedup because the ordering of the list is unimportant. To use this class, call the pushNextAvailableMappingSet to get a pointer to the available MappingSet. Pass this MappingSet to a TemplateMolecule to actually map it onto molecules. If you don't end up using this MappingSet, call popLastMappingSet immediately. To remove MappingSets, call removeMappingSet with the ID of the MappingSet you want to remove. You can get this Id from the MappingSet object and Molecule objects also keep a vector of the MappingSet objects that point to it.

Author:
Michael Sneddon

Public Member Functions

 ReactantList (unsigned int reactantIndex, TransformationSet *ts, unsigned int init_capacity)
virtual ~ReactantList ()
virtual int size () const
virtual MappingSetpushNextAvailableMappingSet ()
virtual void popLastMappingSet ()
virtual void removeMappingSet (unsigned int mappingSetId)
void pickRandom (MappingSet *&ms)
virtual MappingSetgetMappingSet (unsigned int mappingSetId) const
virtual void printDetails () const

Protected Attributes

int n_mappingSets
int capacity
TransformationSetts
unsigned int reactantIndex
unsigned int * msPositionMap
MappingSet ** mappingSets

Constructor & Destructor Documentation

ReactantList::ReactantList ( unsigned int  reactantIndex,
TransformationSet ts,
unsigned int  init_capacity = 50 
)

Creates a new empty ReactantList with the given initial capacity (default is 50). This capacity should roughly be set to the number of mappings you expect this list to have. A reactantList must also be told what its reactionIndex is in the reaction and the TransformationSet of the reaction so that it can populate itself with MappingSets.

ReactantList::~ReactantList (  )  [virtual]

Deconstructor that deletes all mappingSets associated with this list.


Member Function Documentation

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

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

Implements NFcore::ReactantContainer.

MappingSet * ReactantList::pushNextAvailableMappingSet (  )  [virtual]

Adds a new MappingSet to this list 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! (see popLastMappingSet()).

Implements NFcore::ReactantContainer.

void ReactantList::popLastMappingSet (  )  [virtual]

Removes the very last mappingSet that was added to the list.

Implements NFcore::ReactantContainer.

void ReactantList::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 ReactantList::pickRandom ( MappingSet *&  ms  ) 

Randomly selects a MappingSet from the list of available MappingSets.

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

Implements NFcore::ReactantContainer.

void ReactantList::printDetails (  )  const [virtual]

Outputs basic details about this list - used only for debugging.

Implements NFcore::ReactantContainer.


Member Data Documentation

int NFcore::ReactantList::n_mappingSets [protected]

Maintains the number of mappingSets on this list

int NFcore::ReactantList::capacity [protected]

The total capacity that this list can hold

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

The transformation set of the ReactionClass that owns this list

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

The index of the reactant that this list maintains

unsigned int* NFcore::ReactantList::msPositionMap [protected]

The array that maps MappingSet Ids onto the location in the list that the MappingSet is sitting in.

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

The actual array that stores a list of pointers to MappingSet objects


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