SOFA API  8ac0ab06
Open source framework for multi-physics simuation
sofa::simulation::graph::DAGNode Class Reference

#include <DAGNode.h>

Inheritance diagram for sofa::simulation::graph::DAGNode:

Detailed Description

Define the structure of the scene as a Directed Acyclic Graph. Contains component objects (as pointer lists) and parents/childs (as DAGNode objects).

The visitor traversal is performed in two passes:

  • a complete top-down traversal
  • then a complete bottom-up traversal in the exact invert order than the top-down traversal NB: contrary to the "tree" traversal, there are no interlinked forward/backward callbacks. There are only forward then only backward callbacks.

Note that nodes created during a traversal are not traversed if they are created upper than the current node during the top-down traversal or if they are created during the bottom-up traversal.

Classes

struct  StatusStruct
 wrapper to use VisitedStatus in a std::map (to ensure the default map insertion will give NOT_VISITED) More...
 

Protected Attributes

LinkParents l_parents
 
- Protected Attributes inherited from sofa::simulation::Node
bool debug_
 
bool initialized
 
std::stack< Visitor * > actionStack
 
BaseContext_context
 
type::vector< MutationListener * > listener
 
- Protected Attributes inherited from sofa::core::objectmodel::Base
std::map< std::string, sofa::core::DataTrackerCallbackm_internalEngine
 
VecData m_vecData
 List of fields (Data instances) More...
 
MapData m_aliasData
 name -> Data multi-map (includes names and aliases) More...
 
VecLink m_vecLink
 List of links. More...
 
MapLink m_aliasLink
 name -> Link multi-map (includes names and aliases) More...
 
- Protected Attributes inherited from sofa::core::objectmodel::BaseContext
ComponentNameHelper m_nameHelper
 

Public Member Functions

 SOFA_CLASS (DAGNode, simulation::Node)
 
virtual Node::SPtr createChild (const std::string &nodeName) override
 Pure Virtual method from Node. More...
 
void detachFromGraph () override
 Remove the current node from the graph: consists in removing the link to its parent. More...
 
Parents getParents () const override
 Get a list of parent node. More...
 
size_t getNbParents () const override
 returns number of parents More...
 
BaseNodegetFirstParent () const override
 return the first parent (returns nullptr if no parent) More...
 
bool hasParent (const BaseNode *node) const override
 Test if the given node is a parent of this node. More...
 
bool hasParent (const BaseContext *context) const
 Test if the given context is a parent of this context. More...
 
bool hasAncestor (const BaseNode *node) const override
 
bool hasAncestor (const BaseContext *context) const override
 
void * getObject (const sofa::core::objectmodel::ClassInfo &class_info, const sofa::core::objectmodel::TagSet &tags, SearchDirection dir=SearchUp) const override
 
void * getObject (const sofa::core::objectmodel::ClassInfo &class_info, const std::string &path) const override
 
void getObjects (const sofa::core::objectmodel::ClassInfo &class_info, GetObjectsCallBack &container, const sofa::core::objectmodel::TagSet &tags, SearchDirection dir=SearchUp) const override
 
sofa::core::topology::BaseMeshTopologygetMeshTopologyLink (SearchDirection dir=SearchUp) const override
 
void initVisualContext () override
 Called during initialization to correctly propagate the visual context to the children. More...
 
void updateContext () override
 Update the whole context values, based on parent and local ContextObjects. More...
 
void updateSimulationContext () override
 Update the simulation context values(gravity, time...), based on parent and local ContextObjects. More...
 
NodefindCommonParent (Node *node2) override
 
void precomputeTraversalOrder (const sofa::core::ExecParams *params) override
 compute the traversal order from this Node More...
 
virtual void moveChild (BaseNode::SPtr node) override
 Move a node in this from another node. More...
 
- Public Member Functions inherited from sofa::simulation::Node
 SOFA_ABSTRACT_CLASS2 (Node, BaseNode, Context)
 
virtual void removeControllers ()
 Remove odesolvers and mastercontroler. More...
 
NodegetChild (const std::string &name) const
 Find a child node given its name. More...
 
NodegetTreeNode (const std::string &name) const
 Get a descendant node given its name. More...
 
NodegetNodeInGraph (const std::string &absolutePath) const
 Get a node in the scene graph matching the given absolute path. More...
 
Children getChildren () const override
 Get children nodes. More...
 
BaseContextgetRootContext () const override
 Get the root context of the graph. More...
 
NodesetDebug (bool)
 
bool getDebug () const
 
void printComponents ()
 
const BaseContextgetContext () const override
 Get this node context. More...
 
BaseContextgetContext () override
 Get this node context. More...
 
void propagateEvent (const sofa::core::ExecParams *params, sofa::core::objectmodel::Event *event) override
 Propagate an event. More...
 
virtual void updateVisualContext ()
 Update the visual context values, based on parent and local ContextObjects. More...
 
virtual void initialize ()
 Must be called after each graph modification. Do not call it directly, apply an InitVisitor instead. More...
 
virtual void setDefaultVisualContextValue ()
 Called after initialization to set the default value of the visual context. More...
 
void setSleeping (bool val) override
 override context setSleeping to add notification. More...
 
virtual void addListener (MutationListener *obj)
 
virtual void removeListener (MutationListener *obj)
 
void parse (sofa::core::objectmodel::BaseObjectDescription *arg) override
 Parse the given description to assign values to this object's fields and potentially other parameters. More...
 
void init (const sofa::core::ExecParams *params)
 Initialize the components. More...
 
bool isInitialized () const
 
void reinit (const sofa::core::ExecParams *params)
 Apply modifications to the components. More...
 
void draw (sofa::core::visual::VisualParams *params)
 Draw the objects (using visual visitors) More...
 
void executeVisitor (Visitor *action, bool precomputedOrder=false) override
 Execute a recursive action starting from this node. More...
 
void execute (Visitor &action, bool precomputedOrder=false)
 Execute a recursive action starting from this node. More...
 
void execute (Visitor *p, bool precomputedOrder=false)
 Execute a recursive action starting from this node. More...
 
template<class Act , class Params >
void execute (const Params *params, bool precomputedOrder=false)
 Execute a recursive action starting from this node. More...
 
template<class Act >
void execute (sofa::core::visual::VisualParams *vparams, bool precomputedOrder=false)
 Execute a recursive action starting from this node. More...
 
virtual void addChild (BaseNode::SPtr node) final
 
virtual void removeChild (BaseNode::SPtr node) final
 Remove a child node. More...
 
virtual void moveChild (BaseNode::SPtr node, BaseNode::SPtr prev_parent) final
 Move a node in this from another node. More...
 
virtual bool addObject (sofa::core::objectmodel::BaseObject::SPtr obj, sofa::core::objectmodel::TypeOfInsertion insertionLocation=sofa::core::objectmodel::TypeOfInsertion::AtEnd) final
 Add an object and return this. Detect the implemented interfaces and add the object to the corresponding lists. More...
 
virtual bool removeObject (sofa::core::objectmodel::BaseObject::SPtr obj) final
 Remove an object. More...
 
virtual void moveObject (sofa::core::objectmodel::BaseObject::SPtr obj) final
 Move an object from another node. More...
 
sofa::core::objectmodel::BaseObjectgetObject (const std::string &name) const
 Find an object given its name. More...
 
BasefindLinkDestClass (const sofa::core::objectmodel::BaseClass *destType, const std::string &path, const sofa::core::objectmodel::BaseLink *link) override
 
void * getObject (const sofa::core::objectmodel::ClassInfo &class_info, SearchDirection dir=SearchUp) const override
 
void getObjects (const sofa::core::objectmodel::ClassInfo &class_info, GetObjectsCallBack &container, SearchDirection dir=SearchUp) const override
 
template<class Object , class Container >
void getNodeObjects (Container *list)
 List all objects of this node deriving from a given class. More...
 
template<class Container >
Container * getNodeObjects (Container *result)
 Returns a list of object of type passed as a parameter. More...
 
template<class Container >
Container & getNodeObjects (Container &result)
 Returns a list of object of type passed as a parameter. More...
 
template<class Object = sofa::core::objectmodel::BaseObject>
std::vector< Object * > getNodeObjects ()
 
template<class Object >
void getNodeObject (Object *&result)
 
template<class Object >
Object * getNodeObject ()
 
template<class Object , class Container >
void getTreeObjects (Container *list)
 List all objects of this node and sub-nodes deriving from a given class. More...
 
template<class Container >
Container * getTreeObjects (Container *result)
 List all objects of this node and sub-nodes deriving from a given class. More...
 
template<class Container >
Container & getTreeObjects (Container &result)
 List all objects of this node and sub-nodes deriving from a given class. More...
 
template<class Object = sofa::core::objectmodel::BaseObject>
std::vector< Object * > getTreeObjects ()
 
template<class Object >
void getTreeObject (Object *&result)
 
template<class Object >
Object * getTreeObject ()
 
sofa::core::topology::TopologygetTopology () const override
 Topology. More...
 
sofa::core::BaseStategetState () const override
 Degrees-of-Freedom. More...
 
sofa::core::behavior::BaseMechanicalStategetMechanicalState () const override
 Mechanical Degrees-of-Freedom. More...
 
sofa::core::visual::ShadergetShader () const override
 Shader. More...
 
virtual sofa::core::visual::ShadergetShader (const sofa::core::objectmodel::TagSet &t) const
 
sofa::core::behavior::BaseAnimationLoopgetAnimationLoop () const override
 
sofa::core::behavior::OdeSolvergetOdeSolver () const override
 
sofa::core::collision::PipelinegetCollisionPipeline () const override
 
sofa::core::visual::VisualLoopgetVisualLoop () const override
 
- Public Member Functions inherited from sofa::core::objectmodel::BaseNode
 SOFA_ABSTRACT_CLASS (BaseNode, Base)
 
virtual BaseNodegetRoot () const
 returns the root by following up the first parent for multinodes More...
 
virtual std::string getPathName () const override
 Return the full path name of this node. More...
 
virtual std::string getRootPath () const
 Return the path from this node to the root node. More...
 
- Public Member Functions inherited from sofa::core::objectmodel::Base
virtual const BaseClassgetClass () const
 
void addDeprecatedAttribute (lifecycle::DeprecatedData *attribute)
 
void addUpdateCallback (const std::string &name, std::initializer_list< BaseData * > inputs, std::function< sofa::core::objectmodel::ComponentState(const DataTracker &)> function, std::initializer_list< BaseData * > outputs)
 
void addOutputsToCallback (const std::string &name, std::initializer_list< BaseData * > outputs)
 
const std::string & getName () const
 Accessor to the object name. More...
 
void setName (const std::string &n)
 Set the name of this object. More...
 
void setName (const std::string &n, int counter)
 Set the name of this object, adding an integer counter. More...
 
std::string getTypeName () const
 Get the type name of this object (i.e. class and template types) More...
 
virtual std::string getClassName () const
 Get the class name of this object. More...
 
virtual std::string getTemplateName () const final
 Get the template type names (if any) used to instantiate this object. More...
 
std::string getNameSpaceName () const
 Get the template type names (if any) used to instantiate this object. More...
 
void setDefinitionSourceFileName (const std::string &sourceFileName)
 Set the source filename (where the component is implemented) More...
 
const std::string & getDefinitionSourceFileName () const
 Get the source filename (where the component is implemented) More...
 
void setDefinitionSourceFilePos (const int)
 Set the source location (where the component is implemented) More...
 
int getDefinitionSourceFilePos () const
 Get the source location (where the component is implemented) More...
 
void setInstanciationSourceFileName (const std::string &sourceFileName)
 
const std::string & getInstanciationSourceFileName () const
 
void setInstanciationSourceFilePos (const int)
 
int getInstanciationSourceFilePos () const
 
void addMessage (const sofa::helper::logging::Message &m) const
 
size_t countLoggedMessages (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
const std::deque< sofa::helper::logging::Message > & getLoggedMessages () const
 
const std::string getLoggedMessagesAsString (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
void clearLoggedMessages () const
 
bool notMuted () const
 
const sofa::core::objectmodel::TagSetgetTags () const
 Represents the subsets the object belongs to. More...
 
bool hasTag (Tag t) const
 Return true if the object belong to the given subset. More...
 
void addTag (Tag t)
 Add a subset qualification to the object. More...
 
void removeTag (Tag t)
 Remove a subset qualification to the object. More...
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
virtual bool parseField (const std::string &attribute, const std::string &value)
 Assign one field value (Data or Link) More...
 
virtual bool hasField (const std::string &attribute) const
 Check if a given Data field or Link exists. More...
 
void parseFields (const std::list< std::string > &str)
 Assign the field values stored in the given list of name + value pairs of strings. More...
 
virtual void parseFields (const std::map< std::string, std::string * > &str)
 Assign the field values stored in the given map of name -> value pairs. More...
 
void writeDatas (std::map< std::string, std::string * > &str)
 Write the current field values to the given map of name -> value pairs. More...
 
void writeDatas (std::ostream &out, const std::string &separator=" ")
 
BaseDatafindData (const std::string &name) const
 
std::vector< BaseData * > findGlobalField (const std::string &name) const
 Find data fields given a name: several can be found as we look into the alias map. More...
 
BaseLinkfindLink (const std::string &name) const
 
std::vector< BaseLink * > findLinks (const std::string &name) const
 Find link fields given a name: several can be found as we look into the alias map. More...
 
virtual void updateLinks (bool logErrors=true)
 Update pointers in case the pointed-to objects have appeared. More...
 
template<class T >
BaseData::BaseInitData initData (::sofa::core::objectmodel::Data< T > *field, const char *name, const char *help, ::sofa::core::objectmodel::BaseData::DataFlags dataflags)
 Helper method used to initialize a data field containing a value of type T. More...
 
template<class T >
BaseData::BaseInitData initData (Data< T > *field, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used to initialize a data field containing a value of type T. More...
 
template<class T >
Data< T >::InitData initData (Data< T > *field, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used to initialize a data field containing a value of type T. More...
 
void addData (BaseData *f, const std::string &name)
 
void addData (BaseData *f)
 
void removeData (BaseData *f)
 Remove a data field. More...
 
void addAlias (BaseData *field, const char *alias)
 Add an alias to a Data. More...
 
void addLink (BaseLink *l)
 Add a link. More...
 
void addAlias (BaseLink *link, const char *alias)
 Add an alias to a Link. More...
 
const VecDatagetDataFields () const
 Accessor to the vector containing all the fields of this object. More...
 
const MapDatagetDataAliases () const
 Accessor to the map containing all the aliases of this object. More...
 
const VecLinkgetLinks () const
 Accessor to the vector containing all the fields of this object. More...
 
const MapLinkgetLinkAliases () const
 Accessor to the map containing all the aliases of this object. More...
 
virtual bool findDataLinkDest (BaseData *&ptr, const std::string &path, const BaseLink *link)
 
template<class T >
bool findLinkDest (T *&ptr, const std::string &path, const BaseLink *link)
 
- Public Member Functions inherited from sofa::core::objectmodel::Context
 SOFA_CLASS (Context, BaseContext)
 
void copyContext (const Context &c)
 Copy the context variables from the given instance. More...
 
void copySimulationContext (const Context &c)
 Copy the context variables of visualization from the given instance. More...
 
bool isActive () const override
 The Context is active. More...
 
void setActive (bool val) override
 State of the context. More...
 
bool isSleeping () const override
 The Context is sleeping. More...
 
bool canChangeSleepingState () const override
 The Context can change its sleeping state. More...
 
const Vec3getGravity () const override
 Gravity in local coordinates. More...
 
void setGravity (const Vec3 &) override
 Gravity in local coordinates. More...
 
SReal getDt () const override
 Simulation timestep. More...
 
SReal getTime () const override
 Simulation time. More...
 
bool getAnimate () const override
 Animation flag. More...
 
void setDt (SReal dt) override
 Simulation timestep. More...
 
virtual void setTime (SReal t)
 Simulation time. More...
 
void setAnimate (bool val) override
 Animation flag. More...
 
void setChangeSleepingState (bool val) override
 Sleeping state change of the context. More...
 
virtual void setDisplayWorldGravity (bool val)
 Display flags: Gravity. More...
 
- Public Member Functions inherited from sofa::core::objectmodel::BaseContext
 SOFA_CLASS (BaseContext, Base)
 
ComponentNameHelpergetNameHelper ()
 Returns utilitary object to uniquely name objects in the context. More...
 
virtual core::topology::BaseMeshTopologygetMeshTopology (SearchDirection dir=SearchUp) const
 Mesh Topology (unified interface for both static and dynamic topologies) More...
 
virtual core::behavior::BaseMassgetMass () const
 Mass. More...
 
template<class Object , class Container >
void getObjects (Container *list, SearchDirection dir=SearchUp)
 List all objects of this node deriving from a given class. More...
 
template<class Container >
Container * getObjects (Container *result, SearchDirection dir=SearchUp)
 Returns a list of object of type passed as a parameter. More...
 
template<class Container >
Container & getObjects (Container &result, SearchDirection dir=SearchUp)
 
template<class Object = sofa::core::objectmodel::BaseObject>
std::vector< Object * > getObjects (SearchDirection dir=SearchUp)
 
template<class T >
T * get (SearchDirection dir=SearchUp) const
 Generic object access template wrapper, possibly searching up or down from the current context. More...
 
template<class T >
void get (T *&ptr, SearchDirection dir=SearchUp) const
 Generic object access template wrapper, possibly searching up or down from the current context. More...
 
template<class T >
void get (sptr< T > &ptr, SearchDirection dir=SearchUp) const
 Generic object access template wrapper, possibly searching up or down from the current context. More...
 
template<class T >
T * get (const Tag &tag, SearchDirection dir=SearchUp) const
 Generic object access template wrapper, given a required tag, possibly searching up or down from the current context. More...
 
template<class T >
void get (T *&ptr, const Tag &tag, SearchDirection dir=SearchUp) const
 Generic object access template wrapper, given a required tag, possibly searching up or down from the current context. More...
 
template<class T >
void get (sptr< T > &ptr, const Tag &tag, SearchDirection dir=SearchUp) const
 Generic object access template wrapper, given a required tag, possibly searching up or down from the current context. More...
 
template<class T >
T * get (const TagSet &tags, SearchDirection dir=SearchUp) const
 Generic object access template wrapper, given a set of required tags, possibly searching up or down from the current context. More...
 
template<class T >
void get (T *&ptr, const TagSet &tags, SearchDirection dir=SearchUp) const
 Generic object access template wrapper, given a set of required tags, possibly searching up or down from the current context. More...
 
template<class T >
void get (sptr< T > &ptr, const TagSet &tags, SearchDirection dir=SearchUp) const
 Generic object access template wrapper, given a set of required tags, possibly searching up or down from the current context. More...
 
template<class T >
T * get (const std::string &path) const
 Generic object access template wrapper, given a path from the current context. More...
 
template<class T >
void get (T *&ptr, const std::string &path) const
 Generic object access template wrapper, given a path from the current context. More...
 
template<class T >
void get (sptr< T > &ptr, const std::string &path) const
 Generic object access template wrapper, given a path from the current context. More...
 
template<class T , class Container >
void get (Container *list, SearchDirection dir=SearchUp) const
 Generic list of objects access template wrapper, possibly searching up or down from the current context. More...
 
template<class T , class Container >
void get (Container *list, const Tag &tag, SearchDirection dir=SearchUp) const
 Generic list of objects access template wrapper, given a required tag, possibly searching up or down from the current context. More...
 
template<class T , class Container >
void get (Container *list, const TagSet &tags, SearchDirection dir=SearchUp) const
 Generic list of objects access template wrapper, given a set of required tags, possibly searching up or down from the current context. More...
 
virtual void setMechanicalState (BaseObject *)
 Mechanical Degrees-of-Freedom. More...
 
virtual void setTopology (BaseObject *)
 Topology. More...
 
virtual bool addObject (sptr< BaseObject >, TypeOfInsertion=TypeOfInsertion::AtEnd)
 Add an object, or return false if not supported. More...
 
virtual bool removeObject (sptr< BaseObject >)
 Remove an object, or return false if not supported. More...
 
virtual void notifyAddSlave (core::objectmodel::BaseObject *master, core::objectmodel::BaseObject *slave)
 
virtual void notifyRemoveSlave (core::objectmodel::BaseObject *master, core::objectmodel::BaseObject *slave)
 
virtual void notifyMoveSlave (core::objectmodel::BaseObject *previousMaster, core::objectmodel::BaseObject *master, core::objectmodel::BaseObject *slave)
 

Static Public Member Functions

static const std::string GetCustomClassName ()
 
static DAGNode::SPtr create (DAGNode *, sofa::core::objectmodel::BaseObjectDescription *arg)
 
- Static Public Member Functions inherited from sofa::simulation::Node
template<class RealObject >
static Node::SPtr create (RealObject *, sofa::core::objectmodel::BaseObjectDescription *arg)
 
static Node::SPtr create (const std::string &name)
 
- Static Public Member Functions inherited from sofa::core::objectmodel::Base
static const BaseClassGetClass ()
 
template<class T >
static std::string shortName (const T *ptr=nullptr, BaseObjectDescription *=nullptr)
 
- Static Public Member Functions inherited from sofa::core::objectmodel::BaseContext
static BaseContextgetDefault ()
 

Protected Member Functions

 DAGNode (const std::string &name="", DAGNode *parent=nullptr)
 
virtual ~DAGNode () override
 
DAGNodefindCommonParent (DAGNode *node1, DAGNode *node2)
 bottom-up traversal, returning the first node which have a descendancy containing both node1 & node2 More...
 
virtual void doAddChild (BaseNode::SPtr node) override
 Add a child node. More...
 
virtual void doRemoveChild (BaseNode::SPtr node) override
 Remove a child. More...
 
virtual void doMoveChild (BaseNode::SPtr node, BaseNode::SPtr previous_parent) override
 Move a node from another node. More...
 
void doExecuteVisitor (simulation::Visitor *action, bool precomputedOrder=false) override
 Execute a recursive action starting from this node. More...
 
void executeVisitorTreeTraversal (Visitor *action, StatusMap &statusMap, Visitor::TreeTraversalRepetition repeat, bool alreadyRepeated=false)
 
- Protected Member Functions inherited from sofa::simulation::Node
 Node (const std::string &name="")
 
virtual ~Node () override
 
virtual bool doAddObject (sofa::core::objectmodel::BaseObject::SPtr obj, sofa::core::objectmodel::TypeOfInsertion insertionLocation=sofa::core::objectmodel::TypeOfInsertion::AtEnd)
 Add an object. Detect the implemented interfaces and add the object to the corresponding lists. More...
 
virtual bool doRemoveObject (sofa::core::objectmodel::BaseObject::SPtr obj)
 Remove an object. More...
 
virtual void doMoveObject (sofa::core::objectmodel::BaseObject::SPtr sobj, Node *prev_parent)
 Remove an object. More...
 
- Protected Member Functions inherited from sofa::core::objectmodel::BaseNode
 BaseNode ()
 
 ~BaseNode () override
 
void setObjectContext (BaseObject::SPtr obj)
 Set the context of an object to this. More...
 
void clearObjectContext (BaseObject::SPtr obj)
 Reset the context of an object. More...
 
- Protected Member Functions inherited from sofa::core::objectmodel::Base
 Base ()
 
virtual ~Base ()
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used by initData() More...
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, BaseData::DataFlags dataFlags)
 Helper method used by initData() More...
 
template<class T >
void initData0 (Data< T > *field, typename Data< T >::InitData &res, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used by initData() More...
 
- Protected Member Functions inherited from sofa::core::objectmodel::Context
 Context ()
 
virtual ~Context () override
 
- Protected Member Functions inherited from sofa::core::objectmodel::BaseContext
 BaseContext ()
 
 ~BaseContext () override
 

@internal stuff related to the DAG traversal

enum  VisitedStatus { NOT_VISITED =0 , VISITED , PRUNED }
 traversal flags More...
 
typedef std::map< DAGNode *, StatusStructStatusMap
 map structure to store a traversal flag for each DAGNode More...
 
typedef std::list< DAGNode * > NodeList
 list of DAGNode* More...
 
std::set< DAGNode * > _descendancy
 all child nodes (unordered) More...
 
NodeList _precomputedTraversalOrder
 the ordered list of Node to traverse from this Node More...
 
void setDirtyDescendancy ()
 bottom-up traversal removing descendancy More...
 
void updateDescendancy ()
 traversal updating the descendancy More...
 
void executeVisitorTopDown (simulation::Visitor *action, NodeList &executedNodes, StatusMap &statusMap, DAGNode *visitorRoot)
 
void executeVisitorBottomUp (simulation::Visitor *action, NodeList &executedNodes)
 

@internal stuff related to getObjects

class GetDownObjectsVisitor
 
class GetUpObjectsVisitor
 
void getLocalObjects (const sofa::core::objectmodel::ClassInfo &class_info, DAGNode::GetObjectsCallBack &container, const sofa::core::objectmodel::TagSet &tags) const
 get node's local objects respecting specified class_info and tags More...
 

Additional Inherited Members

- Public Attributes inherited from sofa::simulation::Node
NodeSequence< Node, true > child
 
NodeSequence< sofa::core::objectmodel::BaseObject, true > object
 
NodeSequence< sofa::core::BehaviorModelbehaviorModel
 
NodeSequence< sofa::core::BaseMappingmapping
 
NodeSequence< sofa::core::behavior::OdeSolversolver
 
NodeSequence< sofa::core::behavior::ConstraintSolverconstraintSolver
 
NodeSequence< sofa::core::behavior::BaseLinearSolverlinearSolver
 
NodeSequence< sofa::core::topology::BaseTopologyObjecttopologyObject
 
NodeSequence< sofa::core::behavior::BaseForceFieldforceField
 
NodeSequence< sofa::core::behavior::BaseInteractionForceFieldinteractionForceField
 
NodeSequence< sofa::core::behavior::BaseProjectiveConstraintSetprojectiveConstraintSet
 
NodeSequence< sofa::core::behavior::BaseConstraintSetconstraintSet
 
NodeSequence< sofa::core::objectmodel::ContextObjectcontextObject
 
NodeSequence< sofa::core::objectmodel::ConfigurationSettingconfigurationSetting
 
NodeSequence< sofa::core::visual::Shadershaders
 
NodeSequence< sofa::core::visual::VisualModelvisualModel
 
NodeSequence< sofa::core::visual::VisualManagervisualManager
 
NodeSequence< sofa::core::CollisionModelcollisionModel
 
NodeSequence< sofa::core::objectmodel::BaseObjectunsorted
 
NodeSingle< sofa::core::behavior::BaseAnimationLoopanimationManager
 
NodeSingle< sofa::core::visual::VisualLoopvisualLoop
 
NodeSingle< sofa::core::topology::Topologytopology
 
NodeSingle< sofa::core::topology::BaseMeshTopologymeshTopology
 
NodeSingle< sofa::core::BaseStatestate
 
NodeSingle< sofa::core::behavior::BaseMechanicalStatemechanicalState
 
NodeSingle< sofa::core::BaseMappingmechanicalMapping
 
NodeSingle< sofa::core::behavior::BaseMassmass
 
NodeSingle< sofa::core::collision::PipelinecollisionPipeline
 
- Public Attributes inherited from sofa::core::objectmodel::Base
std::vector< lifecycle::DeprecatedData * > m_oldAttributes
 
Data< int > d_messageLogCount
 
Data< std::string > name
 Name of the object. More...
 
Data< boolf_printLog
 if true, emits extra messages at runtime. More...
 
Data< sofa::core::objectmodel::TagSetf_tags
 list of the subsets the objet belongs to More...
 
Data< sofa::type::BoundingBoxf_bbox
 this object bounding box More...
 
Data< sofa::core::objectmodel::ComponentStated_componentState
 The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). More...
 
std::string m_definitionSourceFileName {""}
 
int m_definitionSourceFilePos {-1}
 
std::string m_instanciationSourceFileName {""}
 
int m_instanciationSourceFilePos {-1}
 
- Public Attributes inherited from sofa::core::objectmodel::Context
Data< boolis_activated
 To Activate a node. More...
 
Data< Vec3worldGravity_
 Gravity in the world coordinate system. More...
 
Data< SReal > dt_
 Time step. More...
 
Data< SReal > time_
 Current time. More...
 
Data< boolanimate_
 Animate the Simulation(applied at initialization only) More...
 
Data< boold_isSleeping
 The node is sleeping, and thus ignored by visitors. More...
 
Data< boold_canChangeSleepingState
 The node can change its sleeping state. More...
 

Attribute details

◆ _descendancy

std::set<DAGNode*> sofa::simulation::graph::DAGNode::_descendancy
protected

all child nodes (unordered)

◆ _precomputedTraversalOrder

NodeList sofa::simulation::graph::DAGNode::_precomputedTraversalOrder
protected

the ordered list of Node to traverse from this Node

◆ l_parents

LinkParents sofa::simulation::graph::DAGNode::l_parents
protected

Constructor details

◆ DAGNode()

sofa::simulation::graph::DAGNode::DAGNode ( const std::string &  name = "",
DAGNode parent = nullptr 
)
protected

◆ ~DAGNode()

sofa::simulation::graph::DAGNode::~DAGNode ( )
overrideprotectedvirtual

Function details

◆ create()

static DAGNode::SPtr sofa::simulation::graph::DAGNode::create ( DAGNode ,
sofa::core::objectmodel::BaseObjectDescription arg 
)
inlinestatic

◆ createChild()

Node::SPtr sofa::simulation::graph::DAGNode::createChild ( const std::string &  nodeName)
overridevirtual

Pure Virtual method from Node.

Create, add, then return the new child of this Node.

Implements sofa::simulation::Node.

◆ detachFromGraph()

void sofa::simulation::graph::DAGNode::detachFromGraph ( )
overridevirtual

Remove the current node from the graph: consists in removing the link to its parent.

Remove a child.

Implements sofa::core::objectmodel::BaseNode.

◆ doAddChild()

void sofa::simulation::graph::DAGNode::doAddChild ( BaseNode::SPtr  node)
overrideprotectedvirtual

Add a child node.

Implements sofa::simulation::Node.

◆ doExecuteVisitor()

void sofa::simulation::graph::DAGNode::doExecuteVisitor ( simulation::Visitor action,
bool  precomputedOrder = false 
)
overrideprotectedvirtual

Execute a recursive action starting from this node.

Implements sofa::simulation::Node.

◆ doMoveChild()

void sofa::simulation::graph::DAGNode::doMoveChild ( BaseNode::SPtr  node,
BaseNode::SPtr  previous_parent 
)
overrideprotectedvirtual

Move a node from another node.

Implements sofa::simulation::Node.

◆ doRemoveChild()

void sofa::simulation::graph::DAGNode::doRemoveChild ( BaseNode::SPtr  node)
overrideprotectedvirtual

Remove a child.

Implements sofa::simulation::Node.

◆ executeVisitorBottomUp()

void sofa::simulation::graph::DAGNode::executeVisitorBottomUp ( simulation::Visitor action,
NodeList executedNodes 
)
protected

◆ executeVisitorTopDown()

void sofa::simulation::graph::DAGNode::executeVisitorTopDown ( simulation::Visitor action,
NodeList executedNodes,
StatusMap statusMap,
DAGNode visitorRoot 
)
protected

◆ executeVisitorTreeTraversal()

void sofa::simulation::graph::DAGNode::executeVisitorTreeTraversal ( simulation::Visitor action,
StatusMap statusMap,
Visitor::TreeTraversalRepetition  repeat,
bool  alreadyRepeated = false 
)
protected

◆ findCommonParent() [1/2]

DAGNode * sofa::simulation::graph::DAGNode::findCommonParent ( DAGNode node1,
DAGNode node2 
)
protected

bottom-up traversal, returning the first node which have a descendancy containing both node1 & node2

◆ findCommonParent() [2/2]

Node * sofa::simulation::graph::DAGNode::findCommonParent ( simulation::Node node2)
overridevirtual

return the smallest common parent between this and node2 (returns nullptr if separated sub-graphes) it assumes that the DAG node is a tree node. In case of multiple parents it returns any of the parents. it uses the node descendancy informations.

Implements sofa::simulation::Node.

◆ GetCustomClassName()

static const std::string sofa::simulation::graph::DAGNode::GetCustomClassName ( )
inlinestatic

◆ getFirstParent()

sofa::core::objectmodel::BaseNode * sofa::simulation::graph::DAGNode::getFirstParent ( ) const
overridevirtual

return the first parent (returns nullptr if no parent)

Implements sofa::core::objectmodel::BaseNode.

◆ getLocalObjects()

void sofa::simulation::graph::DAGNode::getLocalObjects ( const sofa::core::objectmodel::ClassInfo class_info,
DAGNode::GetObjectsCallBack container,
const sofa::core::objectmodel::TagSet tags 
) const
protected

get node's local objects respecting specified class_info and tags

◆ getMeshTopologyLink()

sofa::core::topology::BaseMeshTopology * sofa::simulation::graph::DAGNode::getMeshTopologyLink ( SearchDirection  dir = SearchUp) const
overridevirtual

Mesh Topology that is relevant for this context (within it or its parents until a mapping is reached that does not preserve topologies).

Reimplemented from sofa::simulation::Node.

◆ getNbParents()

size_t sofa::simulation::graph::DAGNode::getNbParents ( ) const
overridevirtual

returns number of parents

Implements sofa::core::objectmodel::BaseNode.

◆ getObject() [1/2]

void * sofa::simulation::graph::DAGNode::getObject ( const sofa::core::objectmodel::ClassInfo class_info,
const sofa::core::objectmodel::TagSet tags,
SearchDirection  dir = SearchUp 
) const
overridevirtual

Generic object access, given a set of required tags, possibly searching up or down from the current context

Note that the template wrapper method should generally be used to have the correct return type,

Generic object access, possibly searching up or down from the current context

Note that the template wrapper method should generally be used to have the correct return type,

Implements sofa::simulation::Node.

◆ getObject() [2/2]

void * sofa::simulation::graph::DAGNode::getObject ( const sofa::core::objectmodel::ClassInfo class_info,
const std::string &  path 
) const
overridevirtual

Generic object access, given a path from the current context

Note that the template wrapper method should generally be used to have the correct return type,

Implements sofa::simulation::Node.

◆ getObjects()

void sofa::simulation::graph::DAGNode::getObjects ( const sofa::core::objectmodel::ClassInfo class_info,
GetObjectsCallBack container,
const sofa::core::objectmodel::TagSet tags,
SearchDirection  dir = SearchUp 
) const
overridevirtual

Generic list of objects access, given a set of required tags, possibly searching up or down from the current context

Note that the template wrapper method should generally be used to have the correct return type,

Generic list of objects access, possibly searching up or down from the current context

Note that the template wrapper method should generally be used to have the correct return type,

Implements sofa::simulation::Node.

◆ getParents()

sofa::core::objectmodel::BaseNode::Parents sofa::simulation::graph::DAGNode::getParents ( ) const
overridevirtual

Get a list of parent node.

Implements sofa::core::objectmodel::BaseNode.

◆ hasAncestor() [1/2]

bool sofa::simulation::graph::DAGNode::hasAncestor ( const BaseContext context) const
overridevirtual

Test if the given context is an ancestor of this context. An ancestor is a parent or (recursively) the parent of an ancestor.

Reimplemented from sofa::core::objectmodel::BaseContext.

◆ hasAncestor() [2/2]

bool sofa::simulation::graph::DAGNode::hasAncestor ( const BaseNode node) const
inlineoverridevirtual

Test if the given context is an ancestor of this context. An ancestor is a parent or (recursively) the parent of an ancestor.

Implements sofa::core::objectmodel::BaseNode.

◆ hasParent() [1/2]

bool sofa::simulation::graph::DAGNode::hasParent ( const BaseContext context) const

Test if the given context is a parent of this context.

◆ hasParent() [2/2]

bool sofa::simulation::graph::DAGNode::hasParent ( const BaseNode node) const
overridevirtual

Test if the given node is a parent of this node.

Implements sofa::core::objectmodel::BaseNode.

◆ initVisualContext()

void sofa::simulation::graph::DAGNode::initVisualContext ( )
overridevirtual

Called during initialization to correctly propagate the visual context to the children.

Reimplemented from sofa::simulation::Node.

◆ moveChild()

void sofa::simulation::graph::DAGNode::moveChild ( BaseNode::SPtr  node)
overridevirtual

Move a node in this from another node.

Implements sofa::simulation::Node.

◆ precomputeTraversalOrder()

void sofa::simulation::graph::DAGNode::precomputeTraversalOrder ( const sofa::core::ExecParams params)
overridevirtual

compute the traversal order from this Node

Reimplemented from sofa::simulation::Node.

◆ setDirtyDescendancy()

void sofa::simulation::graph::DAGNode::setDirtyDescendancy ( )
protected

bottom-up traversal removing descendancy

◆ SOFA_CLASS()

sofa::simulation::graph::DAGNode::SOFA_CLASS ( DAGNode  ,
simulation::Node   
)

◆ updateContext()

void sofa::simulation::graph::DAGNode::updateContext ( )
overridevirtual

Update the whole context values, based on parent and local ContextObjects.

Reimplemented from sofa::simulation::Node.

◆ updateDescendancy()

void sofa::simulation::graph::DAGNode::updateDescendancy ( )
protected

traversal updating the descendancy

◆ updateSimulationContext()

void sofa::simulation::graph::DAGNode::updateSimulationContext ( )
overridevirtual

Update the simulation context values(gravity, time...), based on parent and local ContextObjects.

Reimplemented from sofa::simulation::Node.

Enum details

◆ VisitedStatus

traversal flags

Enumerator
NOT_VISITED 
VISITED 
PRUNED 

Related details

◆ GetDownObjectsVisitor

friend class GetDownObjectsVisitor
friend

◆ GetUpObjectsVisitor

friend class GetUpObjectsVisitor
friend