SOFA API  b3f2f2a4
Open source framework for multi-physics simuation
sofa::simulation::graph::ExportDotVisitor Class Reference

#include <ExportDotVisitor.h>

Inheritance diagram for sofa::simulation::graph::ExportDotVisitor:

Detailed Description

Write the graph, starting from a root Node, into a std::ostream. The format is the DOT language from Graphviz (https://graphviz.org/)

Public Attributes

std::ostream * out
 
bool showNode
 
bool showObject
 
bool showBehaviorModel
 
bool showCollisionModel
 
bool showVisualModel
 
bool showMapping
 
bool showContext
 
bool showCollisionPipeline
 
bool showSolver
 
bool showMechanicalState
 
bool showForceField
 
bool showInteractionForceField
 
bool showConstraint
 
bool showMass
 
bool showTopology
 
bool showMechanicalMapping
 
bool labelNodeName
 
bool labelNodeClass
 
bool labelObjectName
 
bool labelObjectClass
 
- Public Attributes inherited from sofa::simulation::Visitor
TagSet subsetsToManage
 list of the subsets More...
 
bool canAccessSleepingNode
 Can the visitor access sleeping nodes? More...
 

Protected Attributes

std::map< core::objectmodel::Base *, std::string > names
 None names in output. More...
 
std::map< std::string, int > nextIndex
 Next indice available for duplicated names. More...
 
- Protected Attributes inherited from sofa::simulation::Visitor
const sofa::core::ExecParamsparams
 

Public Member Functions

 ExportDotVisitor (const sofa::core::ExecParams *params, std::ostream *out)
 
 ~ExportDotVisitor () override
 
void processObject (Node *node, core::objectmodel::BaseObject *obj)
 
Result processNodeTopDown (Node *node) override
 Callback method called when decending to a new node. Recursion will stop if this method returns RESULT_PRUNE. More...
 
void processNodeBottomUp (Node *node) override
 Callback method called after child node have been processed and before going back to the parent node. More...
 
const chargetClassName () const override
 
- Public Member Functions inherited from sofa::simulation::Visitor
 Visitor (const sofa::core::ExecParams *params)
 
virtual ~Visitor ()
 
const sofa::core::ExecParamsexecParams () const
 
virtual bool childOrderReversed (simulation::Node *)
 Return true to reverse the order of traversal of child nodes. More...
 
virtual bool treeTraversal (TreeTraversalRepetition &repeat)
 
virtual const chargetCategoryName () const
 
virtual std::string getInfos () const
 
bool testTags (sofa::core::objectmodel::BaseObject *obj)
 
virtual void execute (sofa::core::objectmodel::BaseContext *node, bool precomputedOrder=false)
 Alias for context->executeVisitor(this) More...
 
virtual ctime_t begin (simulation::Node *node, sofa::core::objectmodel::BaseObject *obj, const std::string &typeInfo=std::string("type"))
 
virtual void end (simulation::Node *node, sofa::core::objectmodel::BaseObject *obj, ctime_t t0)
 
virtual ctime_t begin (simulation::Visitor::VisitorContext *node, sofa::core::objectmodel::BaseObject *obj, const std::string &typeInfo=std::string("type"))
 
virtual void end (simulation::Visitor::VisitorContext *node, sofa::core::objectmodel::BaseObject *obj, ctime_t t0)
 
virtual bool isThreadSafe () const
 Specify whether this visitor can be parallelized. More...
 
virtual Result processNodeTopDown (simulation::Node *node, LocalStorage *)=delete
 
virtual void processNodeBottomUp (simulation::Node *node, LocalStorage *)=delete
 
VisitorsetTags (const TagSet &t)
 
VisitoraddTag (Tag t)
 
VisitorremoveTag (Tag t)
 
template<class VisitorType , class VContext , class Container , typename PointedType >
void for_each (VisitorType *visitor, VContext *ctx, const Container &list, void(VisitorType::*task)(VContext *, PointedType *), const std::string &typeInfo)
 
template<class VisitorType , class VContext , class Container , typename PointedType >
Visitor::Result for_each (VisitorType *visitor, VContext *ctx, const Container &list, Visitor::Result(VisitorType::*task)(VContext *, PointedType *), const std::string &typeInfo)
 

Protected Member Functions

bool display (Node *node, const char **color=nullptr)
 Test if a node should be displayed. More...
 
bool display (core::objectmodel::BaseObject *obj, const char **color=nullptr)
 Test if an object should be displayed. More...
 
std::string getParentName (core::objectmodel::BaseObject *obj)
 
std::string getName (core::objectmodel::Base *o, std::string prefix)
 Compute the name of a given node or object. More...
 
std::string getName (core::objectmodel::BaseNode *node)
 Compute the name of a given node. More...
 
std::string getName (core::objectmodel::BaseObject *obj)
 Compute the name of a given object. More...
 
- Protected Member Functions inherited from sofa::simulation::Visitor
void debug_write_state_before (sofa::core::objectmodel::BaseObject *obj)
 
void debug_write_state_after (sofa::core::objectmodel::BaseObject *obj)
 
template<class VisitorType , class VContext , class ObjectType >
void runVisitorTask (VisitorType *visitor, VContext *ctx, void(VisitorType::*task)(VContext *, ObjectType *), ObjectType *ptr, const std::string &typeInfo=std::string("type"))
 
template<class VisitorType , class VContext , class ObjectType >
Result runVisitorTask (VisitorType *visitor, VContext *ctx, Result(VisitorType::*task)(VContext *, ObjectType *), ObjectType *ptr, const std::string &typeInfo=std::string("type"))
 
template<class Visit , class VContext , class Container , typename PointedType = typename Container::pointed_type>
void for_each (Visit *visitor, VContext *ctx, const Container &list, void(Visit::*task)(VContext *, PointedType *), const std::string &typeInfo=std::string("type"))
 
template<class Visit , class VContext , class Container , typename PointedType = typename Container::pointed_type>
Visitor::Result for_each (Visit *visitor, VContext *ctx, const Container &list, Visitor::Result(Visit::*task)(VContext *, PointedType *), const std::string &typeInfo=std::string("type"))
 

Attribute details

◆ labelNodeClass

bool sofa::simulation::graph::ExportDotVisitor::labelNodeClass

◆ labelNodeName

bool sofa::simulation::graph::ExportDotVisitor::labelNodeName

◆ labelObjectClass

bool sofa::simulation::graph::ExportDotVisitor::labelObjectClass

◆ labelObjectName

bool sofa::simulation::graph::ExportDotVisitor::labelObjectName

◆ names

std::map<core::objectmodel::Base*, std::string> sofa::simulation::graph::ExportDotVisitor::names
protected

None names in output.

◆ nextIndex

std::map<std::string, int> sofa::simulation::graph::ExportDotVisitor::nextIndex
protected

Next indice available for duplicated names.

◆ out

std::ostream* sofa::simulation::graph::ExportDotVisitor::out

◆ showBehaviorModel

bool sofa::simulation::graph::ExportDotVisitor::showBehaviorModel

◆ showCollisionModel

bool sofa::simulation::graph::ExportDotVisitor::showCollisionModel

◆ showCollisionPipeline

bool sofa::simulation::graph::ExportDotVisitor::showCollisionPipeline

◆ showConstraint

bool sofa::simulation::graph::ExportDotVisitor::showConstraint

◆ showContext

bool sofa::simulation::graph::ExportDotVisitor::showContext

◆ showForceField

bool sofa::simulation::graph::ExportDotVisitor::showForceField

◆ showInteractionForceField

bool sofa::simulation::graph::ExportDotVisitor::showInteractionForceField

◆ showMapping

bool sofa::simulation::graph::ExportDotVisitor::showMapping

◆ showMass

bool sofa::simulation::graph::ExportDotVisitor::showMass

◆ showMechanicalMapping

bool sofa::simulation::graph::ExportDotVisitor::showMechanicalMapping

◆ showMechanicalState

bool sofa::simulation::graph::ExportDotVisitor::showMechanicalState

◆ showNode

bool sofa::simulation::graph::ExportDotVisitor::showNode

◆ showObject

bool sofa::simulation::graph::ExportDotVisitor::showObject

◆ showSolver

bool sofa::simulation::graph::ExportDotVisitor::showSolver

◆ showTopology

bool sofa::simulation::graph::ExportDotVisitor::showTopology

◆ showVisualModel

bool sofa::simulation::graph::ExportDotVisitor::showVisualModel

Constructor details

◆ ExportDotVisitor()

sofa::simulation::graph::ExportDotVisitor::ExportDotVisitor ( const sofa::core::ExecParams params,
std::ostream *  out 
)

◆ ~ExportDotVisitor()

sofa::simulation::graph::ExportDotVisitor::~ExportDotVisitor ( )
override

Function details

◆ display() [1/2]

bool sofa::simulation::graph::ExportDotVisitor::display ( core::objectmodel::BaseObject obj,
const char **  color = nullptr 
)
protected

Test if an object should be displayed.

◆ display() [2/2]

bool sofa::simulation::graph::ExportDotVisitor::display ( Node node,
const char **  color = nullptr 
)
protected

Test if a node should be displayed.

◆ getClassName()

const char* sofa::simulation::graph::ExportDotVisitor::getClassName ( ) const
inlineoverridevirtual

Return a class name for this visitor Only used for debugging / profiling purposes

Reimplemented from sofa::simulation::Visitor.

◆ getName() [1/3]

std::string sofa::simulation::graph::ExportDotVisitor::getName ( core::objectmodel::Base o,
std::string  prefix 
)
protected

Compute the name of a given node or object.

◆ getName() [2/3]

std::string sofa::simulation::graph::ExportDotVisitor::getName ( core::objectmodel::BaseNode node)
protected

Compute the name of a given node.

◆ getName() [3/3]

std::string sofa::simulation::graph::ExportDotVisitor::getName ( core::objectmodel::BaseObject obj)
protected

Compute the name of a given object.

◆ getParentName()

std::string sofa::simulation::graph::ExportDotVisitor::getParentName ( core::objectmodel::BaseObject obj)
protected

Find the node or object a given object should be attached to. This is the parent node if it is displayed, otherwise it is the attached MechanicalState or Solver. Returns an empty string if not found.

◆ processNodeBottomUp()

void sofa::simulation::graph::ExportDotVisitor::processNodeBottomUp ( Node )
overridevirtual

Callback method called after child node have been processed and before going back to the parent node.

Reimplemented from sofa::simulation::Visitor.

◆ processNodeTopDown()

simulation::Visitor::Result sofa::simulation::graph::ExportDotVisitor::processNodeTopDown ( Node )
overridevirtual

Callback method called when decending to a new node. Recursion will stop if this method returns RESULT_PRUNE.

Reimplemented from sofa::simulation::Visitor.

◆ processObject()

void sofa::simulation::graph::ExportDotVisitor::processObject ( Node node,
core::objectmodel::BaseObject obj 
)