/home/msneddon/eclipse/galileoSR1_cpp/workspace/NFsim/src/NFreactions/reactantLists/reactantTree.hh

Go to the documentation of this file.
00001 
00002 
00003 #ifndef REACTANTTREE_HH_
00004 #define REACTANTTREE_HH_
00005 
00006 
00007 #include "../NFreactions.hh"
00008 
00009 namespace NFcore
00010 {
00011         //Forward Declarations
00012         class TransformationSet;
00013         class MappingSet;
00014         class ReactantContainer;
00015 
00016 
00018 
00031         class ReactantTree : public ReactantContainer {
00032 
00033 
00034                 public:
00035 
00041                         ReactantTree(unsigned int reactantIndex, TransformationSet *ts, unsigned int init_capacity);
00042 
00043 
00047                         virtual ~ReactantTree();
00048 
00052                         virtual int size() const { return n_mappingSets; };
00053 
00063                         virtual MappingSet * pushNextAvailableMappingSet();
00064 
00065 
00071                         void confirmPush(int mappingSetId, double rateFactor);
00072 
00073 
00074 
00079                         virtual void popLastMappingSet();
00080 
00085                         virtual void removeMappingSet(unsigned int mappingSetId);
00086 
00087 
00092                         void pickReactantFromValue(MappingSet *&ms, double value, double baseRate);
00093 
00098                         void updateValue(unsigned int mappingSetId, double newRateFactor);
00099 
00103                         virtual MappingSet * getMappingSet(unsigned int mappingSetId) const;
00104 
00105 
00106 
00111                         virtual void printDetails() const;
00112 
00113 
00114 
00115 
00120                         double getRateFactorSum() const { return leftRateFactorSum[0]; };
00121 
00122 
00126                         int getDepthOfTree() const { return treeDepth; };
00127 
00128 
00129                 protected:
00130 
00135                         void removeFromTreeOnly(int msTreeArrayPosition, unsigned int mappingSetId);
00136 
00142                         void expandTree(int newCapacity);
00143 
00144 
00145                         TransformationSet *ts;       //Keeps track of the set of transformations
00146                         unsigned int reactantIndex;  //the index of the tree
00147 
00148                         //Basic tree parameters and constants
00149                         int maxElementCount;
00150                         int treeDepth;
00151                         int numOfNodes;
00152 
00153                         //The tree stored as 3 arrays indexed as:
00154                         // Children are at 2i and 2i+1
00155                         // Parent is at i/2 (using integer division)
00156                         // root is at index 1
00157                         // index 0 is empty and always zero
00158                         double * leftRateFactorSum;
00159                         int * leftElementCount;
00160                         int * rightElementCount;
00161 
00162                         //The actual list of mappingSets, stored as a list
00163                         MappingSet ** mappingSets;
00164 
00165 
00166 
00169 
00170                         //Given a mappingSet Id, this tells us what position it is in
00171                         //in the mappingSets array
00172                         int * msPositionMap;
00173 
00174                         //Given a mappingSet Id, this tells us what position it is in
00175                         //in the actual tree
00176                         int * msTreePositionMap;
00177 
00178                         //Given a tree position index, this tells us the mappingSet Id
00179                         //which we can use to get our mappingSet out of the mappingSets array
00180                         int * reverseMsTreePositionMap;
00181 
00182 
00183                         //The number of mappingSets currently set
00184                         int n_mappingSets;
00185 
00186                         //The index of the first molecule in the tree
00187                         unsigned int firstMappingTreeIndex;
00188         };
00189 }
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 #endif /* REACTANTTREE_HH_ */

Generated on Thu Dec 9 11:02:48 2010 for NFsim by  doxygen 1.5.4