COPASI API  4.16.103
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CDependencyGraph Class Reference

#include <CDependencyGraph.h>

Collaboration diagram for CDependencyGraph:
Collaboration graph
[legend]

Public Member Functions

void addDependent (const size_t &node, const size_t &dependent)
 
 CDependencyGraph ()
 
void clear ()
 
const std::set< size_t > & getDependents (const size_t &node) const
 
void resize (const size_t &n)
 
 ~CDependencyGraph ()
 

Private Member Functions

void addNode (const size_t &node)
 

Private Attributes

std::vector< CDependencyGraphNodemNodes
 

Friends

std::ostream & operator<< (std::ostream &os, const CDependencyGraph &d)
 

Detailed Description

CDependencyGraph describes a dependency graph.

Definition at line 74 of file CDependencyGraph.h.

Constructor & Destructor Documentation

CDependencyGraph::CDependencyGraph ( )

Constructor

Definition at line 52 of file CDependencyGraph.cpp.

52 {}
CDependencyGraph::~CDependencyGraph ( )

Desctructor

Definition at line 53 of file CDependencyGraph.cpp.

53 {}

Member Function Documentation

void CDependencyGraph::addDependent ( const size_t &  node,
const size_t &  dependent 
)

Add a dependent for a particular node.

Parameters
nodeThe number of the node.
dependentThe number of the dependent node.

Definition at line 68 of file CDependencyGraph.cpp.

References addNode(), and mNodes.

Referenced by CHybridMethodODE45::setupDependencyGraph(), CHybridMethod::setupDependencyGraph(), CHybridMethodLSODA::setupDependencyGraph(), and CStochMethod::setupDependencyGraphAndBalances().

69 {
70  addNode(node);
71  mNodes[node].addDependent(dependent);
72 }
void addNode(const size_t &node)
std::vector< CDependencyGraphNode > mNodes
void CDependencyGraph::addNode ( const size_t &  node)
private

Add a node with a given number.

Parameters
nodeThe number of the node to add.

Definition at line 55 of file CDependencyGraph.cpp.

References mNodes.

Referenced by addDependent().

56 {
57  if (node >= mNodes.size())
58  mNodes.resize(node + 1);
59 
60  // mNodes.push_back(node);
61 }
std::vector< CDependencyGraphNode > mNodes
void CDependencyGraph::clear ( )
const std::set< size_t > & CDependencyGraph::getDependents ( const size_t &  node) const

Retrieve a vector of dependents for a given node.

Parameters
nodeThe number of the node to access.
Returns
A vector of node numbers.

Definition at line 74 of file CDependencyGraph.cpp.

References mNodes.

Referenced by CHybridMethod::fireReaction(), CHybridMethodLSODA::fireReaction(), CHybridMethod::integrateDeterministicPart(), CHybridMethodLSODA::integrateDeterministicPart(), CHybridMethod::integrateDeterministicPartEuler(), CStochNextReactionMethod::updatePriorityQueue(), and CStochMethod::updateSystemState().

75 {
76  static std::set< size_t > NoDependents;
77 
78  if (mNodes.size() <= node)
79  {
80  return NoDependents;
81  }
82 
83  return mNodes[node].getDependents();
84 }
std::vector< CDependencyGraphNode > mNodes
void CDependencyGraph::resize ( const size_t &  n)

Definition at line 63 of file CDependencyGraph.cpp.

References mNodes.

Referenced by CStochMethod::setupDependencyGraphAndBalances().

64 {
65  mNodes.resize(n);
66 }
std::vector< CDependencyGraphNode > mNodes

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CDependencyGraph d 
)
friend

insert operator

Definition at line 102 of file CDependencyGraph.cpp.

104 {
105  unsigned int i;
106 
107  for (i = 0; i < d.mNodes.size(); i++)
108  os << d.mNodes[i];
109 
110  os << std::endl;
111 
112  return os;
113 }
std::vector< CDependencyGraphNode > mNodes

Member Data Documentation

std::vector<CDependencyGraphNode> CDependencyGraph::mNodes
private

A vector containing the nodes in the graph

Definition at line 116 of file CDependencyGraph.h.

Referenced by addDependent(), addNode(), clear(), getDependents(), operator<<(), and resize().


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