Belle II Software  release-08-01-10
DataFlowVisualization Class Reference

class to visualize data flow between modules. More...

#include <DataFlowVisualization.h>

Collaboration diagram for DataFlowVisualization:

Public Member Functions

 DataFlowVisualization (const DependencyMap *dependencyMap)
 Constructor.
 
void visualizePath (const std::string &filename, const Path &path)
 Create graphs with datastore inputs/outputs of each module in path. More...
 

Static Public Member Functions

static void executeModuleAndCreateIOPlot (const std::string &module)
 Create independent I/O graph for a single module (without requiring a steering file). More...
 

Private Member Functions

void generateModulePlot (std::ofstream &file, const Module &mod, bool steeringFileFlow=false)
 Create I/O graph for a single module (written to file).
 
bool checkArrayUnknown (const std::string &name, const DependencyMap::ModuleInfo &info)
 If the given array name isn't found in any of info's fields, it is added to m_unknownArrays (and true returned).
 

Static Private Member Functions

static void plotPath (std::ofstream &file, const Path &path, const std::string &pathName="")
 Create a subgraph for the given Path (including conditional paths).
 

Private Attributes

const DependencyMapm_map
 Stores information on inputs/outputs of each module, as obtained by require()/createEntry();.
 
std::set< std::string > m_allInputs
 set of all inputs (including optionals), for steering file visualisation.
 
std::set< std::string > m_allOutputs
 set of all outputs, for steering file visualisation.
 
std::set< std::string > m_unknownArrays
 set of array only being used in relations, for steering file visualisation.
 
std::string m_fillcolor [DependencyMap::c_NEntryTypes]
 fill colors.
 
std::string m_arrowcolor [DependencyMap::c_NEntryTypes]
 arrow colors.
 

Detailed Description

class to visualize data flow between modules.

Definition at line 24 of file DataFlowVisualization.h.

Member Function Documentation

◆ executeModuleAndCreateIOPlot()

void executeModuleAndCreateIOPlot ( const std::string &  module)
static

Create independent I/O graph for a single module (without requiring a steering file).

Output will be saved to ModuleName.dot.

Definition at line 165 of file DataFlowVisualization.cc.

166 {
167  // construct given module and gearbox
168  std::shared_ptr<Module> modulePtr = ModuleManager::Instance().registerModule(module);
169  std::shared_ptr<Module> gearboxPtr = ModuleManager::Instance().registerModule("Gearbox");
170 
171  // call initialize() method
172  //may throw some ERRORs, but that's OK.
173  // TODO:(ignore missing inputs)
174  gearboxPtr->initialize();
176  modulePtr->initialize();
177 
178  // create plot
179  const std::string filename = module + ".dot";
180  DataFlowVisualization v(&DataStore::Instance().getDependencyMap());
181  std::ofstream file(filename.c_str());
182  v.generateModulePlot(file, *modulePtr, false);
183 
184  //clean up to avoid problems with ~TROOT
185  modulePtr->terminate();
186  gearboxPtr->terminate();
187 }
class to visualize data flow between modules.
DependencyMap & getDependencyMap()
Return map of depedencies between modules.
Definition: DataStore.h:524
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
void setModule(const Module &mod)
Set the current module (for getCurrentModuleInfo())
Definition: DependencyMap.h:60
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.

◆ visualizePath()

void visualizePath ( const std::string &  filename,
const Path path 
)

Create graphs with datastore inputs/outputs of each module in path.

Parameters
filenamefile saved to (in DOT format).
pathPath to visualize.

Definition at line 38 of file DataFlowVisualization.cc.


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