SOFA API  59c939c2
Open source framework for multi-physics simuation
sofa::simulation::Node Class Referenceabstract

#include <Node.h>

Inheritance diagram for sofa::simulation::Node:

Detailed Description

Implements the object (component) management of the core::Context. Contains objects in lists and provides accessors. The other nodes are not visible (unknown scene graph).

Author
The SOFA team </www.sofa-framework.org>

Classes

class  Sequence
 
class  Single
 

Public Attributes

Data< sofa::helper::vector< std::string > > depend
 Pairs representing component dependencies. First must be initialized before second. More...
 
- 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< ComponentStated_componentstate
 the object state More...
 
Data< ComponentState > & m_componentstate {d_componentstate}
 TODO bruno: uncomment once c++17 is enabled in SOFA. 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
 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...
 

Protected Attributes

bool debug_
 
bool initialized
 
std::stack< Visitor * > actionStack
 
BaseContext_context
 
helper::vector< MutationListener * > listener
 
- Protected Attributes inherited from sofa::core::objectmodel::Base
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_ABSTRACT_CLASS2 (Node, BaseNode, Context)
 
virtual Node::SPtr createChild (const std::string &nodeName)=0
 Create, add, then return the new child of this Node. More...
 
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...
 
virtual void updateContext ()
 Update the whole context values, based on parent and local ContextObjects. More...
 
virtual void updateSimulationContext ()
 Update the simulation context values(gravity, time...), based on parent and local ContextObjects. More...
 
virtual void initVisualContext ()
 Called during initialization to corectly propagate the visual context to the children. 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 NodefindCommonParent (simulation::Node *node2)=0
 return the smallest common parent between this and node2 (returns nullptr if separated sub-graphes) More...
 
virtual void addListener (MutationListener *obj)
 
virtual void removeListener (MutationListener *obj)
 
High-level interface
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...
 
Visitor handling
Parameters
precomputedOrderis not used by default but could allow optimization on certain Node specializations
Warning
when calling with precomputedOrder=true, the fonction "precomputeTraversalOrder" must be called before executing the visitor and the user must ensure by himself that the simulation graph has done been modified since the last call to "precomputeTraversalOrder"
virtual void doExecuteVisitor (Visitor *action, bool precomputedOrder=false)=0
 Execute a recursive action starting from this node. 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 precomputeTraversalOrder (const sofa::core::ExecParams *)
 Possible optimization with traversal precomputation, not mandatory and does nothing by default. More...
 
Set/get objects
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 void moveChild (BaseNode::SPtr node) override=0
 Move a node in this from another node. More...
 
virtual void doAddChild (BaseNode::SPtr node)=0
 
virtual void doRemoveChild (BaseNode::SPtr node)=0
 Remove a child node. More...
 
virtual void doMoveChild (BaseNode::SPtr node, BaseNode::SPtr prev_parent)=0
 Move a node 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, const sofa::core::objectmodel::TagSet &tags, SearchDirection dir=SearchUp) const override=0
 
void * getObject (const sofa::core::objectmodel::ClassInfo &class_info, SearchDirection dir=SearchUp) const override
 
void * getObject (const sofa::core::objectmodel::ClassInfo &class_info, const std::string &path) const override=0
 
void getObjects (const sofa::core::objectmodel::ClassInfo &class_info, GetObjectsCallBack &container, const sofa::core::objectmodel::TagSet &tags, SearchDirection dir=SearchUp) const override=0
 
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::topology::BaseMeshTopologygetMeshTopologyLink (SearchDirection dir=SearchUp) const override
 Mesh Topology (unified interface for both static and dynamic topologies) 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
 
Solvers and main algorithms
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 Parents getParents () const =0
 
virtual size_t getNbParents () const =0
 returns number of parents More...
 
virtual BaseNodegetFirstParent () const =0
 return the first parent (returns nullptr if no parent) More...
 
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 bool hasParent (const BaseNode *node) const =0
 Test if the given node is a parent of this node. More...
 
virtual bool hasAncestor (const BaseNode *node) const =0
 
virtual void detachFromGraph ()=0
 
virtual std::string getPathName () const
 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 addOutputToCallback (const std::string &name, BaseData *output)
 
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 bool hasAncestor (const BaseContext *) const
 
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

template<class RealObject >
static Node::SPtr create (RealObject *, core::objectmodel::BaseObjectDescription *arg)
 
- 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

 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
 

Friends

class VisitorScheduler
 

Dependency graph

This graph reflects the dependencies between the components. It is used internally to ensure that the initialization order is comform to the dependencies.

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...
 
static Node::SPtr create (const std::string &name)
 

Component containers

typedef Sequence< Node, true >::iterator ChildIterator
 
typedef Sequence< sofa::core::objectmodel::BaseObject, true >::iterator ObjectIterator
 
typedef Sequence< sofa::core::objectmodel::BaseObject, true >::reverse_iterator ObjectReverseIterator
 
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
 

Attribute details

BaseContext* sofa::simulation::Node::_context
protected
std::stack<Visitor*> sofa::simulation::Node::actionStack
protected
Single<sofa::core::behavior::BaseAnimationLoop> sofa::simulation::Node::animationManager
Sequence<sofa::core::BehaviorModel> sofa::simulation::Node::behaviorModel
Sequence<Node,true> sofa::simulation::Node::child
Sequence<sofa::core::CollisionModel> sofa::simulation::Node::collisionModel
Single<sofa::core::collision::Pipeline> sofa::simulation::Node::collisionPipeline
Sequence<sofa::core::objectmodel::ConfigurationSetting> sofa::simulation::Node::configurationSetting
Sequence<sofa::core::behavior::BaseConstraintSet> sofa::simulation::Node::constraintSet
Sequence<sofa::core::behavior::ConstraintSolver> sofa::simulation::Node::constraintSolver
Sequence<sofa::core::objectmodel::ContextObject> sofa::simulation::Node::contextObject
bool sofa::simulation::Node::debug_
protected
Data< sofa::helper::vector < std::string > > sofa::simulation::Node::depend

Pairs representing component dependencies. First must be initialized before second.

Sequence<sofa::core::behavior::BaseForceField> sofa::simulation::Node::forceField
bool sofa::simulation::Node::initialized
protected
Sequence<sofa::core::behavior::BaseInteractionForceField> sofa::simulation::Node::interactionForceField
Sequence<sofa::core::behavior::BaseLinearSolver> sofa::simulation::Node::linearSolver
helper::vector<MutationListener*> sofa::simulation::Node::listener
protected
Sequence<sofa::core::BaseMapping> sofa::simulation::Node::mapping
Single<sofa::core::behavior::BaseMass> sofa::simulation::Node::mass
Single<sofa::core::BaseMapping> sofa::simulation::Node::mechanicalMapping
Single<sofa::core::behavior::BaseMechanicalState> sofa::simulation::Node::mechanicalState
Single<sofa::core::topology::BaseMeshTopology> sofa::simulation::Node::meshTopology
Sequence<sofa::core::objectmodel::BaseObject,true> sofa::simulation::Node::object
Sequence<sofa::core::behavior::BaseProjectiveConstraintSet> sofa::simulation::Node::projectiveConstraintSet
Sequence<sofa::core::visual::Shader> sofa::simulation::Node::shaders
Sequence<sofa::core::behavior::OdeSolver> sofa::simulation::Node::solver
Single<sofa::core::BaseState> sofa::simulation::Node::state
Single<sofa::core::topology::Topology> sofa::simulation::Node::topology
Sequence<sofa::core::topology::BaseTopologyObject> sofa::simulation::Node::topologyObject
Sequence<sofa::core::objectmodel::BaseObject> sofa::simulation::Node::unsorted
Single<sofa::core::visual::VisualLoop> sofa::simulation::Node::visualLoop
Sequence<sofa::core::visual::VisualManager> sofa::simulation::Node::visualManager
Sequence<sofa::core::visual::VisualModel> sofa::simulation::Node::visualModel

Constructor details

sofa::simulation::Node::Node ( const std::string &  name = "")
protected
sofa::simulation::Node::~Node ( )
overrideprotectedvirtual

Function details

void sofa::simulation::Node::addChild ( BaseNode::SPtr  node)
finalvirtual

Pure Virtual method from BaseNode Add a child node

void sofa::simulation::Node::addListener ( MutationListener obj)
virtual
bool sofa::simulation::Node::addObject ( sofa::core::objectmodel::BaseObject::SPtr  obj)
finalvirtual

Add an object and return this. Detect the implemented interfaces and add the object to the corresponding lists.

Add an object. Detect the implemented interfaces and add the object to the corresponding lists.

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

void sofa::simulation::Node::bwdInit ( )
virtual
template<class RealObject >
Node::SPtr sofa::simulation::Node::create ( RealObject *  ,
core::objectmodel::BaseObjectDescription arg 
)
static
Node::SPtr sofa::simulation::Node::create ( const std::string &  name)
static
virtual Node::SPtr sofa::simulation::Node::createChild ( const std::string &  nodeName)
pure virtual

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

Implemented in sofa::simulation::graph::DAGNode, and sofa::simulation::tree::GNode.

virtual void sofa::simulation::Node::doAddChild ( BaseNode::SPtr  node)
pure virtual

Delegate methods overridden in child classes Add a child node

Implemented in sofa::simulation::graph::DAGNode, and sofa::simulation::tree::GNode.

bool sofa::simulation::Node::doAddObject ( sofa::core::objectmodel::BaseObject::SPtr  obj)
protectedvirtual

Add an object. Detect the implemented interfaces and add the object to the corresponding lists.

virtual void sofa::simulation::Node::doExecuteVisitor ( Visitor action,
bool  precomputedOrder = false 
)
pure virtual

Execute a recursive action starting from this node.

Implemented in sofa::simulation::graph::DAGNode, and sofa::simulation::tree::GNode.

virtual void sofa::simulation::Node::doMoveChild ( BaseNode::SPtr  node,
BaseNode::SPtr  prev_parent 
)
pure virtual

Move a node from another node.

Implemented in sofa::simulation::graph::DAGNode, and sofa::simulation::tree::GNode.

void sofa::simulation::Node::doMoveObject ( sofa::core::objectmodel::BaseObject::SPtr  sobj,
Node prev_parent 
)
protectedvirtual

Remove an object.

virtual void sofa::simulation::Node::doRemoveChild ( BaseNode::SPtr  node)
pure virtual

Remove a child node.

Implemented in sofa::simulation::graph::DAGNode, and sofa::simulation::tree::GNode.

bool sofa::simulation::Node::doRemoveObject ( sofa::core::objectmodel::BaseObject::SPtr  obj)
protectedvirtual

Remove an object.

void sofa::simulation::Node::draw ( sofa::core::visual::VisualParams params)

Do one step forward in time.

Draw the objects (using visual visitors)

void sofa::simulation::Node::execute ( simulation::Visitor action,
bool  precomputedOrder = false 
)
inline

Execute a recursive action starting from this node.

void sofa::simulation::Node::execute ( simulation::Visitor p,
bool  precomputedOrder = false 
)
inline

Execute a recursive action starting from this node.

template<class Act , class Params >
void sofa::simulation::Node::execute ( const Params *  params,
bool  precomputedOrder = false 
)
inline

Execute a recursive action starting from this node.

template<class Act >
void sofa::simulation::Node::execute ( core::visual::VisualParams vparams,
bool  precomputedOrder = false 
)
inline

Execute a recursive action starting from this node.

void sofa::simulation::Node::executeVisitor ( simulation::Visitor action,
bool  precomputedOrder = false 
)
overridevirtual

Execute a recursive action starting from this node.

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

virtual Node* sofa::simulation::Node::findCommonParent ( simulation::Node node2)
pure virtual

return the smallest common parent between this and node2 (returns nullptr if separated sub-graphes)

Implemented in sofa::simulation::tree::GNode, and sofa::simulation::graph::DAGNode.

void * sofa::simulation::Node::findLinkDestClass ( const sofa::core::objectmodel::BaseClass destType,
const std::string &  path,
const sofa::core::objectmodel::BaseLink link 
)
overridevirtual
core::behavior::BaseAnimationLoop * sofa::simulation::Node::getAnimationLoop ( ) const
overridevirtual

Reimplemented from sofa::core::objectmodel::BaseNode.

Node * sofa::simulation::Node::getChild ( const std::string &  name) const

Find a child node given its name.

sofa::core::objectmodel::BaseNode::Children sofa::simulation::Node::getChildren ( ) const
overridevirtual

Get children nodes.

Get parent node (or nullptr if no hierarchy or for root node)

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

core::collision::Pipeline * sofa::simulation::Node::getCollisionPipeline ( ) const
overridevirtual

Reimplemented from sofa::core::objectmodel::BaseNode.

const core::objectmodel::BaseContext * sofa::simulation::Node::getContext ( ) const
overridevirtual

Get this node context.

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

core::objectmodel::BaseContext * sofa::simulation::Node::getContext ( )
overridevirtual

Get this node context.

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

bool sofa::simulation::Node::getDebug ( ) const
core::behavior::BaseMechanicalState * sofa::simulation::Node::getMechanicalState ( ) const
overridevirtual

Mechanical Degrees-of-Freedom.

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

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

Mesh Topology (unified interface for both static and dynamic topologies)

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

Reimplemented in sofa::simulation::tree::GNode, and sofa::simulation::graph::DAGNode.

Node * sofa::simulation::Node::getNodeInGraph ( const std::string &  absolutePath) const

Get a node in the scene graph matching the given absolute path.

template<class Object >
void sofa::simulation::Node::getNodeObject ( Object *&  result)
inline

Return an object of this node deriving from a given class, or nullptr if not found. Note that only the first object is returned.

template<class Object >
Object* sofa::simulation::Node::getNodeObject ( )
inline
template<class Object , class Container >
void sofa::simulation::Node::getNodeObjects ( Container *  list)
inline

List all objects of this node deriving from a given class.

template<class Container >
Container* sofa::simulation::Node::getNodeObjects ( Container *  result)
inline

Returns a list of object of type passed as a parameter.

template<class Container >
Container& sofa::simulation::Node::getNodeObjects ( Container &  result)
inline

Returns a list of object of type passed as a parameter.

template<class Object = sofa::core::objectmodel::BaseObject>
std::vector<Object*> sofa::simulation::Node::getNodeObjects ( )
inline

Returns a list of object of type passed as a parameter. This function is return object by copy but should be compatible with Return Value Optimization so the copy should be removed by the compiler. Eg: for( BaseObject* o : node->getNodeObjects() ) { ... } for( VisualModel* v : node->getNodeObjects<VisualModel>() ) { ... }

core::objectmodel::BaseObject * sofa::simulation::Node::getObject ( const std::string &  name) const

Find an object given its name.

void* sofa::simulation::Node::getObject ( const sofa::core::objectmodel::ClassInfo class_info,
const sofa::core::objectmodel::TagSet tags,
SearchDirection  dir = SearchUp 
) const
overridepure virtual

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,

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

Implemented in sofa::simulation::tree::GNode, and sofa::simulation::graph::DAGNode.

void* sofa::simulation::Node::getObject ( const sofa::core::objectmodel::ClassInfo class_info,
SearchDirection  dir = SearchUp 
) const
inlineoverridevirtual

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,

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

void* sofa::simulation::Node::getObject ( const sofa::core::objectmodel::ClassInfo class_info,
const std::string &  path 
) const
overridepure virtual

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,

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

Implemented in sofa::simulation::tree::GNode, and sofa::simulation::graph::DAGNode.

void sofa::simulation::Node::getObjects ( const sofa::core::objectmodel::ClassInfo class_info,
GetObjectsCallBack container,
const sofa::core::objectmodel::TagSet tags,
SearchDirection  dir = SearchUp 
) const
overridepure virtual

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,

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

Implemented in sofa::simulation::tree::GNode, and sofa::simulation::graph::DAGNode.

void sofa::simulation::Node::getObjects ( const sofa::core::objectmodel::ClassInfo class_info,
GetObjectsCallBack container,
SearchDirection  dir = SearchUp 
) const
inlineoverridevirtual

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,

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

core::behavior::OdeSolver * sofa::simulation::Node::getOdeSolver ( ) const
overridevirtual

Reimplemented from sofa::core::objectmodel::BaseNode.

BaseContext* sofa::simulation::Node::getRootContext ( ) const
inlineoverridevirtual

Get the root context of the graph.

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

core::visual::Shader * sofa::simulation::Node::getShader ( ) const
overridevirtual

Shader.

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

core::visual::Shader * sofa::simulation::Node::getShader ( const sofa::core::objectmodel::TagSet t) const
virtual
core::BaseState * sofa::simulation::Node::getState ( ) const
overridevirtual

Degrees-of-Freedom.

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

core::topology::Topology * sofa::simulation::Node::getTopology ( ) const
overridevirtual

Topology.

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

Node * sofa::simulation::Node::getTreeNode ( const std::string &  name) const

Get a descendant node given its name.

template<class Object >
void sofa::simulation::Node::getTreeObject ( Object *&  result)
inline

Return an object of this node and sub-nodes deriving from a given class, or nullptr if not found. Note that only the first object is returned.

template<class Object >
Object* sofa::simulation::Node::getTreeObject ( )
inline
template<class Object , class Container >
void sofa::simulation::Node::getTreeObjects ( Container *  list)
inline

List all objects of this node and sub-nodes deriving from a given class.

template<class Container >
Container* sofa::simulation::Node::getTreeObjects ( Container *  result)
inline

List all objects of this node and sub-nodes deriving from a given class.

template<class Container >
Container& sofa::simulation::Node::getTreeObjects ( Container &  result)
inline

List all objects of this node and sub-nodes deriving from a given class.

template<class Object = sofa::core::objectmodel::BaseObject>
std::vector<Object*> sofa::simulation::Node::getTreeObjects ( )
inline

List all objects of this node and sub-nodes deriving from a given class This function is return a std::vector by copy but should be compatible with Return Value Optimization so the copy should be removed by the compiler. Eg: for( BaseObject* o : node->getTreeObjects() ) { ... } for( VisualModel* v : node->getTreeObjects<VisualModel>() ) { ... }

core::visual::VisualLoop * sofa::simulation::Node::getVisualLoop ( ) const
overridevirtual

Reimplemented from sofa::core::objectmodel::BaseNode.

void sofa::simulation::Node::init ( const sofa::core::ExecParams params)

Initialize the components.

Initialize the components of this node and all the nodes which depend on it.

void sofa::simulation::Node::initialize ( )
virtual

Must be called after each graph modification. Do not call it directly, apply an InitVisitor instead.

virtual void sofa::simulation::Node::initVisualContext ( )
inlinevirtual

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

Reimplemented in sofa::simulation::tree::GNode, and sofa::simulation::graph::DAGNode.

bool sofa::simulation::Node::isInitialized ( )
inline
void sofa::simulation::Node::moveChild ( BaseNode::SPtr  node,
BaseNode::SPtr  prev_parent 
)
finalvirtual

Move a node in this from another node.

Move a node from another node.

virtual void sofa::simulation::Node::moveChild ( BaseNode::SPtr  node)
overridepure virtual

Move a node in this from another node.

Implemented in sofa::simulation::graph::DAGNode, and sofa::simulation::tree::GNode.

void sofa::simulation::Node::moveObject ( sofa::core::objectmodel::BaseObject::SPtr  obj)
finalvirtual

Move an object from another node.

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

void sofa::simulation::Node::parse ( sofa::core::objectmodel::BaseObjectDescription arg)
overridevirtual

Parse the given description to assign values to this object's fields and potentially other parameters.

Reimplemented from sofa::core::objectmodel::Base.

virtual void sofa::simulation::Node::precomputeTraversalOrder ( const sofa::core::ExecParams )
inlinevirtual

Possible optimization with traversal precomputation, not mandatory and does nothing by default.

Reimplemented in sofa::simulation::graph::DAGNode.

void sofa::simulation::Node::printComponents ( )
void sofa::simulation::Node::propagateEvent ( const sofa::core::ExecParams params,
sofa::core::objectmodel::Event event 
)
overridevirtual

Propagate an event.

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

void sofa::simulation::Node::reinit ( const sofa::core::ExecParams params)

Apply modifications to the components.

ReInitialize the components of this node and all the nodes which depend on it.

void sofa::simulation::Node::removeChild ( BaseNode::SPtr  node)
finalvirtual

Remove a child node.

Remove a child.

void sofa::simulation::Node::removeControllers ( )
virtual

Remove odesolvers and mastercontroler.

void sofa::simulation::Node::removeListener ( MutationListener obj)
virtual
bool sofa::simulation::Node::removeObject ( sofa::core::objectmodel::BaseObject::SPtr  obj)
finalvirtual

Remove an object.

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

Node * sofa::simulation::Node::setDebug ( bool  b)
void sofa::simulation::Node::setDefaultVisualContextValue ( )
virtual

Called after initialization to set the default value of the visual context.

void sofa::simulation::Node::setSleeping ( bool  val)
overridevirtual

override context setSleeping to add notification.

Reimplemented from sofa::core::objectmodel::Context.

sofa::simulation::Node::SOFA_ABSTRACT_CLASS2 ( Node  ,
BaseNode  ,
Context   
)
void sofa::simulation::Node::sortComponents ( )

Sort the components according to the dependencies expressed in Data depend.

void sofa::simulation::Node::updateContext ( )
virtual

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

Reimplemented in sofa::simulation::tree::GNode, and sofa::simulation::graph::DAGNode.

void sofa::simulation::Node::updateSimulationContext ( )
virtual

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

Reimplemented in sofa::simulation::tree::GNode, and sofa::simulation::graph::DAGNode.

void sofa::simulation::Node::updateVisualContext ( )
virtual

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

Related details

friend class VisitorScheduler
friend