SOFA API  9fda8923
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>

Public Attributes

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...
 

Protected Attributes

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_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 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...
 
void setSleeping (bool val) override
 override context setSleeping to add notification. 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 () 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...
 
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 (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 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, 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, 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 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 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)
 
virtual bool hasAncestor (const BaseContext *) const
 
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

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

 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
 

Friends

class VisitorScheduler
 

Attribute details

◆ _context

BaseContext* sofa::simulation::Node::_context
protected

◆ actionStack

std::stack<Visitor*> sofa::simulation::Node::actionStack
protected

◆ animationManager

NodeSingle<sofa::core::behavior::BaseAnimationLoop> sofa::simulation::Node::animationManager

◆ behaviorModel

NodeSequence<sofa::core::BehaviorModel> sofa::simulation::Node::behaviorModel

◆ child

NodeSequence<Node,true> sofa::simulation::Node::child

◆ collisionModel

NodeSequence<sofa::core::CollisionModel> sofa::simulation::Node::collisionModel

◆ collisionPipeline

NodeSingle<sofa::core::collision::Pipeline> sofa::simulation::Node::collisionPipeline

◆ configurationSetting

NodeSequence<sofa::core::objectmodel::ConfigurationSetting> sofa::simulation::Node::configurationSetting

◆ constraintSet

NodeSequence<sofa::core::behavior::BaseConstraintSet> sofa::simulation::Node::constraintSet

◆ constraintSolver

NodeSequence<sofa::core::behavior::ConstraintSolver> sofa::simulation::Node::constraintSolver

◆ contextObject

NodeSequence<sofa::core::objectmodel::ContextObject> sofa::simulation::Node::contextObject

◆ debug_

bool sofa::simulation::Node::debug_
protected

◆ forceField

NodeSequence<sofa::core::behavior::BaseForceField> sofa::simulation::Node::forceField

◆ initialized

bool sofa::simulation::Node::initialized
protected

◆ interactionForceField

NodeSequence<sofa::core::behavior::BaseInteractionForceField> sofa::simulation::Node::interactionForceField

◆ linearSolver

NodeSequence<sofa::core::behavior::BaseLinearSolver> sofa::simulation::Node::linearSolver

◆ listener

type::vector<MutationListener*> sofa::simulation::Node::listener
protected

◆ mapping

NodeSequence<sofa::core::BaseMapping> sofa::simulation::Node::mapping

◆ mass

NodeSingle<sofa::core::behavior::BaseMass> sofa::simulation::Node::mass

◆ mechanicalMapping

NodeSingle<sofa::core::BaseMapping> sofa::simulation::Node::mechanicalMapping

◆ mechanicalState

NodeSingle<sofa::core::behavior::BaseMechanicalState> sofa::simulation::Node::mechanicalState

◆ meshTopology

NodeSingle<sofa::core::topology::BaseMeshTopology> sofa::simulation::Node::meshTopology

◆ object

NodeSequence<sofa::core::objectmodel::BaseObject,true> sofa::simulation::Node::object

◆ projectiveConstraintSet

NodeSequence<sofa::core::behavior::BaseProjectiveConstraintSet> sofa::simulation::Node::projectiveConstraintSet

◆ shaders

NodeSequence<sofa::core::visual::Shader> sofa::simulation::Node::shaders

◆ solver

NodeSequence<sofa::core::behavior::OdeSolver> sofa::simulation::Node::solver

◆ state

NodeSingle<sofa::core::BaseState> sofa::simulation::Node::state

◆ topology

NodeSingle<sofa::core::topology::Topology> sofa::simulation::Node::topology

◆ topologyObject

NodeSequence<sofa::core::topology::BaseTopologyObject> sofa::simulation::Node::topologyObject

◆ unsorted

NodeSequence<sofa::core::objectmodel::BaseObject> sofa::simulation::Node::unsorted

◆ visualLoop

NodeSingle<sofa::core::visual::VisualLoop> sofa::simulation::Node::visualLoop

◆ visualManager

NodeSequence<sofa::core::visual::VisualManager> sofa::simulation::Node::visualManager

◆ visualModel

NodeSequence<sofa::core::visual::VisualModel> sofa::simulation::Node::visualModel

Constructor details

◆ Node()

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

◆ ~Node()

sofa::simulation::Node::~Node ( )
overrideprotectedvirtual

Function details

◆ addChild()

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

Pure Virtual method from BaseNode Add a child node

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

◆ addListener()

void sofa::simulation::Node::addListener ( MutationListener obj)
virtual

◆ addObject()

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.

◆ create() [1/2]

Node::SPtr sofa::simulation::Node::create ( const std::string &  name)
static

◆ create() [2/2]

template<class RealObject >
Node::SPtr sofa::simulation::Node::create ( RealObject *  ,
sofa::core::objectmodel::BaseObjectDescription arg 
)
static

◆ createChild()

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.

◆ doAddChild()

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.

◆ doAddObject()

bool sofa::simulation::Node::doAddObject ( sofa::core::objectmodel::BaseObject::SPtr  obj,
sofa::core::objectmodel::TypeOfInsertion  insertionLocation = sofa::core::objectmodel::TypeOfInsertion::AtEnd 
)
protectedvirtual

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

◆ doExecuteVisitor()

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.

◆ doMoveChild()

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.

◆ doMoveObject()

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

Remove an object.

◆ doRemoveChild()

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

Remove a child node.

Implemented in sofa::simulation::graph::DAGNode.

◆ doRemoveObject()

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

Remove an object.

◆ draw()

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

Draw the objects (using visual visitors)

◆ execute() [1/4]

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.

◆ execute() [2/4]

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

Execute a recursive action starting from this node.

◆ execute() [3/4]

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

Execute a recursive action starting from this node.

◆ execute() [4/4]

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

Execute a recursive action starting from this node.

◆ executeVisitor()

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

Execute a recursive action starting from this node.

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

◆ findCommonParent()

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::graph::DAGNode.

◆ findLinkDestClass()

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

◆ getAnimationLoop()

core::behavior::BaseAnimationLoop * sofa::simulation::Node::getAnimationLoop ( ) const
overridevirtual

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

◆ getChild()

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

Find a child node given its name.

◆ getChildren()

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.

◆ getCollisionPipeline()

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

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

◆ getContext() [1/2]

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

Get this node context.

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

◆ getContext() [2/2]

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

Get this node context.

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

◆ getDebug()

bool sofa::simulation::Node::getDebug ( ) const

◆ getMechanicalState()

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

Mechanical Degrees-of-Freedom.

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

◆ getMeshTopologyLink()

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::graph::DAGNode.

◆ getNodeInGraph()

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

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

◆ getNodeObject() [1/2]

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

◆ getNodeObject() [2/2]

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.

◆ getNodeObjects() [1/4]

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>() ) { ... }

◆ getNodeObjects() [2/4]

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

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

◆ getNodeObjects() [3/4]

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

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

◆ getNodeObjects() [4/4]

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

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

◆ getObject() [1/4]

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::graph::DAGNode.

◆ getObject() [2/4]

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::graph::DAGNode.

◆ getObject() [3/4]

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.

◆ getObject() [4/4]

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

Find an object given its name.

◆ getObjects() [1/2]

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::graph::DAGNode.

◆ getObjects() [2/2]

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.

◆ getOdeSolver()

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

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

◆ getRootContext()

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

Get the root context of the graph.

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

◆ getShader() [1/2]

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

Shader.

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

◆ getShader() [2/2]

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

◆ getState()

core::BaseState * sofa::simulation::Node::getState ( ) const
overridevirtual

Degrees-of-Freedom.

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

◆ getTopology()

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

Topology.

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

◆ getTreeNode()

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

Get a descendant node given its name.

◆ getTreeObject() [1/2]

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

◆ getTreeObject() [2/2]

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.

◆ getTreeObjects() [1/4]

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>() ) { ... }

◆ getTreeObjects() [2/4]

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.

◆ getTreeObjects() [3/4]

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.

◆ getTreeObjects() [4/4]

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.

◆ getVisualLoop()

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

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

◆ init()

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.

◆ initialize()

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

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

◆ initVisualContext()

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

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

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

◆ isInitialized()

bool sofa::simulation::Node::isInitialized ( ) const
inline

◆ moveChild() [1/2]

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

Move a node in this from another node.

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

Implemented in sofa::simulation::graph::DAGNode.

◆ moveChild() [2/2]

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.

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

◆ moveObject()

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

Move an object from another node.

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

◆ parse()

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.

◆ precomputeTraversalOrder()

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.

◆ printComponents()

void sofa::simulation::Node::printComponents ( )

◆ propagateEvent()

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.

◆ reinit()

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.

◆ removeChild()

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

Remove a child node.

Remove a child.

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

◆ removeControllers()

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

Remove odesolvers and mastercontroler.

◆ removeListener()

void sofa::simulation::Node::removeListener ( MutationListener obj)
virtual

◆ removeObject()

bool sofa::simulation::Node::removeObject ( sofa::core::objectmodel::BaseObject::SPtr  obj)
finalvirtual

Remove an object.

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

◆ setDebug()

Node * sofa::simulation::Node::setDebug ( bool  b)

◆ setDefaultVisualContextValue()

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

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

◆ setSleeping()

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

override context setSleeping to add notification.

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

◆ SOFA_ABSTRACT_CLASS2()

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

◆ updateContext()

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

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

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

◆ updateSimulationContext()

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

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

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

◆ updateVisualContext()

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

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

Related details

◆ VisitorScheduler

friend class VisitorScheduler
friend