The Gaudi Framework  v28r3 (cc1cf868)
concurrency::RankerByCummulativeOutDegree Class Reference

#include <src/PRGraphVisitors.h>

Inheritance diagram for concurrency::RankerByCummulativeOutDegree:
Collaboration diagram for concurrency::RankerByCummulativeOutDegree:

Public Member Functions

 RankerByCummulativeOutDegree ()
 Constructor. More...
 
bool visit (AlgorithmNode &node) override
 
void runThroughAdjacents (boost::graph_traits< boost::ExecPlan >::vertex_descriptor vertex, boost::ExecPlan graph)
 
- Public Member Functions inherited from concurrency::IGraphVisitor
virtual ~IGraphVisitor ()=default
 
virtual bool visitEnter (DecisionNode &) const
 
virtual bool visit (DecisionNode &)
 
virtual bool visitEnter (AlgorithmNode &) const
 
virtual bool visitEnter (DataNode &) const
 
virtual bool visit (DataNode &)
 
virtual void reset ()
 

Additional Inherited Members

- Public Attributes inherited from concurrency::IGraphVisitor
int m_nodesSucceeded
 
EventSlotm_slot
 

Detailed Description

Definition at line 73 of file PRGraphVisitors.h.

Constructor & Destructor Documentation

concurrency::RankerByCummulativeOutDegree::RankerByCummulativeOutDegree ( )
inline

Constructor.

Definition at line 76 of file PRGraphVisitors.h.

76  {
77  m_nodesSucceeded = 0;
78  m_slot = nullptr;
79  };

Member Function Documentation

void concurrency::RankerByCummulativeOutDegree::runThroughAdjacents ( boost::graph_traits< boost::ExecPlan >::vertex_descriptor  vertex,
boost::ExecPlan  graph 
)

Definition at line 232 of file PRGraphVisitors.cpp.

233  {
234  typename boost::graph_traits<boost::ExecPlan>::adjacency_iterator itVB;
235  typename boost::graph_traits<boost::ExecPlan>::adjacency_iterator itVE;
236 
237  for (boost::tie(itVB, itVE) = adjacent_vertices(vertex, graph); itVB != itVE; ++itVB) {
238  m_nodesSucceeded += 1;
239  runThroughAdjacents(*itVB, graph);
240  }
241 
242  }
void runThroughAdjacents(boost::graph_traits< boost::ExecPlan >::vertex_descriptor vertex, boost::ExecPlan graph)
bool concurrency::RankerByCummulativeOutDegree::visit ( AlgorithmNode node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 197 of file PRGraphVisitors.cpp.

197  {
198 
199  std::ifstream myfile;
200  myfile.open("InputExecutionPlan.graphml", std::ios::in);
201 
202  boost::ExecPlan execPlan;
203 
204  boost::dynamic_properties dp;
205  dp.property("name", boost::get(&boost::AlgoNodeStruct::m_name, execPlan));
206  dp.property("index", boost::get(&boost::AlgoNodeStruct::m_index, execPlan));
207  dp.property("dataRank", boost::get(&boost::AlgoNodeStruct::m_rank, execPlan));
208  dp.property("runtime", boost::get(&boost::AlgoNodeStruct::m_runtime, execPlan));
209 
210  boost::read_graphml(myfile, execPlan, dp);
211 
212  typedef boost::graph_traits<boost::ExecPlan>::vertex_iterator itV;
214  typedef boost::graph_traits<boost::ExecPlan>::vertex_descriptor AlgoVertex;
215 
216  for (vp = boost::vertices(execPlan); vp.first != vp.second; ++vp.first) {
217  AlgoVertex v = *vp.first;
218  auto index = boost::get(&boost::AlgoNodeStruct::m_name, execPlan);
219  if (index[v] == node.getNodeName()) {
220  runThroughAdjacents(v,execPlan);
221  float rank = m_nodesSucceeded;
222  node.setRank(rank);
223  reset();
224  //std::cout << "Rank of " << index[v] << " is " << rank << std::endl;
225  }
226  }
227 
228  return true;
229  }
T open(T...args)
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AlgoNodeStruct > ExecPlan
graph_traits< ExecPlan >::vertex_descriptor AlgoVertex
void runThroughAdjacents(boost::graph_traits< boost::ExecPlan >::vertex_descriptor vertex, boost::ExecPlan graph)
STL class.

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