SOFA API  6dc60b15
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
 
helper::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...
 

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
 
core::topology::BaseMeshTopologygetMeshTopologyLink (SearchDirection dir=SearchUp) const override
 
void initVisualContext () override
 Called during initialization to corectly 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 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 bwdInit ()
 
virtual void setDefaultVisualContextValue ()
 Called after initialization to set the default value of the visual context. 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 ()
 
void reinit (const sofa::core::ExecParams *params)
 Apply modifications to the components. More...
 
void draw (sofa::core::visual::VisualParams *params)
 Do one step forward in time. More...
 
void executeVisitor (simulation::Visitor *action, bool precomputedOrder=false) override
 Execute a recursive action starting from this node. More...
 
void execute (simulation::Visitor &action, bool precomputedOrder=false)
 Execute a recursive action starting from this node. More...
 
void execute (simulation::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 (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) 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...
 
void * findLinkDestClass (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
 
void setSleeping (bool) override
 override context setSleeping to add notification. More...
 
void sortComponents ()
 Sort the components according to the dependencies expressed in Data depend. More...
 
- 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 void addChild (BaseNode::SPtr node)=0
 Add a child node. More...
 
virtual void removeChild (BaseNode::SPtr node)=0
 Remove a child node. More...
 
virtual void moveChild (BaseNode::SPtr node, BaseNode::SPtr prev_parent)=0
 Move a node from another node. More...
 
virtual void moveChild (BaseNode::SPtr node)=0
 Move a node in this & remove it from its parents. 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 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...
 
virtual 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
 Get the template type names (if any) used to instantiate this object. More...
 
virtual 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
 
const std::string getWarnings () const
 
const std::string getOutputs () const
 use getLoggedMessageAsString() or getLoggedMessage instead. More...
 
void clearWarnings ()
 use getLoggedMessageAsString() or getLoggedMessage instead. More...
 
void clearOutputs ()
 use clearLoggedMessages() instead More...
 
void processStream (std::ostream &out)
 use clearLoggedMessages() instead More...
 
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
 
bool IsInheritingFromBase ()
 
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 (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)
 
virtual void setGravity (const Vec3 &)
 Gravity in local coordinates. 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 >)
 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 DAGNode::SPtr create (DAGNode *, core::objectmodel::BaseObjectDescription *arg)
 
- Static Public Member Functions inherited from sofa::simulation::Node
template<class RealObject >
static Node::SPtr create (RealObject *, 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 void dynamicCast (T *&ptr, Base *b)
 
template<class T >
static std::string typeName (const T *ptr=nullptr)
 
template<class T >
static std::string className (const T *ptr=nullptr)
 
template<class T >
static std::string namespaceName (const T *ptr=nullptr)
 
template<class T >
static std::string templateName (const T *ptr=nullptr)
 
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)
 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
Data< sofa::helper::vector< std::string > > depend
 Pairs representing component dependencies. First must be initialized before second. More...
 
Sequence< Node, true > child
 
Sequence< sofa::core::objectmodel::BaseObject, true > object
 
Single< sofa::core::behavior::BaseAnimationLoopanimationManager
 
Single< sofa::core::visual::VisualLoopvisualLoop
 
Sequence< sofa::core::BehaviorModelbehaviorModel
 
Sequence< sofa::core::BaseMappingmapping
 
Sequence< sofa::core::behavior::OdeSolversolver
 
Sequence< sofa::core::behavior::ConstraintSolverconstraintSolver
 
Sequence< sofa::core::behavior::BaseLinearSolverlinearSolver
 
Single< sofa::core::topology::Topologytopology
 
Single< sofa::core::topology::BaseMeshTopologymeshTopology
 
Sequence< sofa::core::topology::BaseTopologyObjecttopologyObject
 
Single< sofa::core::BaseStatestate
 
Single< sofa::core::behavior::BaseMechanicalStatemechanicalState
 
Single< sofa::core::BaseMappingmechanicalMapping
 
Single< sofa::core::behavior::BaseMassmass
 
Sequence< sofa::core::behavior::BaseForceFieldforceField
 
Sequence< sofa::core::behavior::BaseInteractionForceFieldinteractionForceField
 
Sequence< sofa::core::behavior::BaseProjectiveConstraintSetprojectiveConstraintSet
 
Sequence< sofa::core::behavior::BaseConstraintSetconstraintSet
 
Sequence< sofa::core::objectmodel::ContextObjectcontextObject
 
Sequence< sofa::core::objectmodel::ConfigurationSettingconfigurationSetting
 
Sequence< sofa::core::visual::Shadershaders
 
Sequence< sofa::core::visual::VisualModelvisualModel
 
Sequence< sofa::core::visual::VisualManagervisualManager
 
Sequence< sofa::core::CollisionModelcollisionModel
 
Single< sofa::core::collision::PipelinecollisionPipeline
 
Sequence< sofa::core::objectmodel::BaseObjectunsorted
 
- Public Attributes inherited from sofa::core::objectmodel::Base
helper::system::SofaOStream< helper::logging::Message::Warningserr
 
helper::system::SofaOStream< helper::logging::Message::Infosout
 
helper::system::SofaEndl< Basesendl
 runs the stream processing More...
 
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::defaulttype::BoundingBoxf_bbox
 this object bounding box More...
 
Data< sofa::core::objectmodel::ComponentStated_componentState
 the object state More...
 
DeprecatedAndRemoved m_componentstate
 
DeprecatedAndRemoved d_componentstate
 
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
 Tells if the context is sleeping, and thus ignored by visitors. More...
 
Data< boold_canChangeSleepingState
 Tells if the context can change its sleeping state. More...
 

Attribute details

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

all child nodes (unordered)

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

the ordered list of Node to traverse from this Node

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

Constructor details

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

Function details

static DAGNode::SPtr sofa::simulation::graph::DAGNode::create ( DAGNode ,
core::objectmodel::BaseObjectDescription arg 
)
inlinestatic
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.

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.

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

Add a child node.

Implements sofa::simulation::Node.

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.

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

Move a node from another node.

Implements sofa::simulation::Node.

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

Remove a child.

Implements sofa::simulation::Node.

void sofa::simulation::graph::DAGNode::executeVisitorBottomUp ( simulation::Visitor action,
NodeList executedNodes 
)
protected
void sofa::simulation::graph::DAGNode::executeVisitorTopDown ( simulation::Visitor action,
NodeList executedNodes,
StatusMap statusMap,
DAGNode visitorRoot 
)
protected
void sofa::simulation::graph::DAGNode::executeVisitorTreeTraversal ( simulation::Visitor action,
StatusMap statusMap,
Visitor::TreeTraversalRepetition  repeat,
bool  alreadyRepeated = false 
)
protected
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.

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

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

return the first parent (returns nullptr if no parent)

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

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

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.

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

returns number of parents

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

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.

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.

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.

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

Get a list of parent node.

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

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.

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.

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.

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

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

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

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

Reimplemented from sofa::simulation::Node.

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

Move a node in this from another node.

Implements sofa::simulation::Node.

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

compute the traversal order from this Node

Reimplemented from sofa::simulation::Node.

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

bottom-up traversal removing descendancy

sofa::simulation::graph::DAGNode::SOFA_CLASS ( DAGNode  ,
simulation::Node   
)
void sofa::simulation::graph::DAGNode::updateContext ( )
overridevirtual

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

Reimplemented from sofa::simulation::Node.

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

traversal updating the descendancy

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

traversal flags

Enumerator
NOT_VISITED 
VISITED 
PRUNED 

Related details

friend class GetDownObjectsVisitor
friend
friend class GetUpObjectsVisitor
friend