copasi API
0.1
|
#include <CIndexedPriorityQueue.h>
Public Member Functions | |
CIndexedPriorityQueue () | |
~CIndexedPriorityQueue () | |
C_INT32 | topIndex () const |
C_FLOAT64 | topKey () const |
C_INT32 | removeStochReaction (const C_INT32 index) |
C_INT32 | insertStochReaction (const C_INT32 index, const C_FLOAT64 key) |
void | initializeIndexPointer (const C_INT32 numberOfReactions) |
C_INT32 | size () const |
C_INT32 | pushPair (const C_INT32 index, const C_FLOAT64 key) |
void | buildHeap () |
void | updateNode (const C_INT32 index, const C_FLOAT64 key) |
C_FLOAT64 | operator[] (const C_INT32 pos) const |
void | clear () |
C_FLOAT64 | getKey (const C_INT32 index) const |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CIndexedPriorityQueue &d) |
The CIndexedPriorityQueue class provides an indexed priority queue. Each element consistes of a pair of values, a key and an index.
The elements in the queue are ordered according to the value of their key. Since for stochastic simulations the minimum time is required, the queue is ordered so that the element with the minimum key value is at the top. This is the opposite of the normal ordering of priority queues.
The index can be used to access elements from positions other than at the front of the queue.
The indexed priority queue as applied to stochastic simulations is described in "Efficient Exact Stochastic Simulation of Chemical Systems with Many Species and Many Channels", Gibson and Bruck, J. Phys. Chem. A 104 (2000) 1876-1889
CIndexedPriorityQueue::CIndexedPriorityQueue | ( | ) |
Constructor
CIndexedPriorityQueue::~CIndexedPriorityQueue | ( | ) |
Destructor
void CIndexedPriorityQueue::buildHeap | ( | ) |
Build moves entries until the correct ordering is achieved.
void CIndexedPriorityQueue::clear | ( | ) |
C_FLOAT64 CIndexedPriorityQueue::getKey | ( | const C_INT32 | index | ) | const [inline] |
gets the key from a given index
void CIndexedPriorityQueue::initializeIndexPointer | ( | const C_INT32 | numberOfReactions | ) |
Initializes the vector mIndexPointer. The vector will be <numberOfReactions> long and every pointer will be -1, because none of the nodes can be found in the tree so far. Insert the stochastic reactions into the tree with insertStochReaction()
added by juergen 26 July, 2002
C_INT32 CIndexedPriorityQueue::insertStochReaction | ( | const C_INT32 | index, |
const C_FLOAT64 | key | ||
) |
Inserts the node with the given index and key into the tree. The index has to exist in the index array of course.
added by juergen 26 July, 2002
C_FLOAT64 CIndexedPriorityQueue::operator[] | ( | const C_INT32 | pos | ) | const [inline] |
Overloads the [] operator. Gives the index´th element on the heap
C_INT32 CIndexedPriorityQueue::pushPair | ( | const C_INT32 | index, |
const C_FLOAT64 | key | ||
) |
Push an index/key pair onto the queue
index | The index used to access the node |
key | The key value used to determine the priority |
C_INT32 CIndexedPriorityQueue::removeStochReaction | ( | const C_INT32 | index | ) |
Deletes the node in the tree with the given index. The pointer in the index array is removed.
added by juergen 26 July, 2002
C_INT32 CIndexedPriorityQueue::size | ( | ) | const [inline] |
Return the size of the heap
C_INT32 CIndexedPriorityQueue::topIndex | ( | ) | const |
Get the index associated with the highest priority node
C_FLOAT64 CIndexedPriorityQueue::topKey | ( | ) | const |
Get the key value associated with the highest priority node
void CIndexedPriorityQueue::updateNode | ( | const C_INT32 | index, |
const C_FLOAT64 | key | ||
) |
Update the key value of a node at a given index. This also moves the node to the correct position if neccessary.
index | The index used to access the node |
key | The key value used to determine the priority |
std::ostream& operator<< | ( | std::ostream & | os, |
const CIndexedPriorityQueue & | d | ||
) | [friend] |
insert operator