SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::simulation::Visitor Class Reference

#include <Visitor.h>

Base class for visitors propagated recursively through the scenegraph. More...

Inheritance diagram for sofa::simulation::Visitor:

Detailed Description

Base class for visitors propagated recursively through the scenegraph.

Classes

class  VisitorContext
 

Public Attributes

TagSet subsetsToManage
 list of the subsets More...
 
bool canAccessSleepingNode
 Can the visitor access sleeping nodes? More...
 

Protected Attributes

const core::ExecParamsparams
 

Public Member Functions

 Visitor (const core::ExecParams *params)
 
virtual ~Visitor ()
 
const core::ExecParamsexecParams () const
 
virtual Result processNodeTopDown (simulation::Node *)
 Callback method called when decending to a new node. Recursion will stop if this method returns RESULT_PRUNE. More...
 
virtual void processNodeBottomUp (simulation::Node *)
 Callback method called after child node have been processed and before going back to the parent node. More...
 
virtual bool childOrderReversed (simulation::Node *)
 Return true to reverse the order of traversal of child nodes. More...
 
virtual bool treeTraversal (TreeTraversalRepetition &repeat)
 
virtual const char * getCategoryName () const
 
virtual const char * getClassName () const
 
virtual std::string getInfos () const
 
void debug_write_state_before (core::objectmodel::BaseObject *)
 
void debug_write_state_after (core::objectmodel::BaseObject *)
 
template<class Visit , class VContext , class Container , class Object >
void for_each (Visit *visitor, VContext *ctx, const Container &list, void(Visit::*fn)(VContext *, Object *))
 Helper method to enumerate objects in the given list. The callback gets the pointer to node. More...
 
template<class Visit , class VContext , class Container , class Object >
Visitor::Result for_each_r (Visit *visitor, VContext *ctx, const Container &list, Visitor::Result(Visit::*fn)(VContext *, Object *))
 Helper method to enumerate objects in the given list. The callback gets the pointer to node. More...
 
bool testTags (core::objectmodel::BaseObject *obj)
 
virtual void execute (core::objectmodel::BaseContext *node, bool precomputedOrder=false)
 Alias for context->executeVisitor(this) More...
 
virtual ctime_t begin (simulation::Node *node, core::objectmodel::BaseObject *obj, const std::string &typeInfo=std::string("type"))
 
virtual void end (simulation::Node *node, core::objectmodel::BaseObject *obj, ctime_t t0)
 
ctime_t begin (simulation::Visitor::VisitorContext *node, core::objectmodel::BaseObject *obj, const std::string &typeInfo=std::string("type"))
 
void end (simulation::Visitor::VisitorContext *node, core::objectmodel::BaseObject *obj, ctime_t t0)
 
virtual bool isThreadSafe () const
 Specify whether this visitor can be parallelized. More...
 
virtual Result processNodeTopDown (simulation::Node *node, LocalStorage *)
 
virtual void processNodeBottomUp (simulation::Node *node, LocalStorage *)
 
VisitorsetTags (const TagSet &t)
 
VisitoraddTag (Tag t)
 
VisitorremoveTag (Tag t)
 

Attribute details

bool sofa::simulation::Visitor::canAccessSleepingNode

Can the visitor access sleeping nodes?

const core::ExecParams* sofa::simulation::Visitor::params
protected
TagSet sofa::simulation::Visitor::subsetsToManage

list of the subsets

Constructor details

sofa::simulation::Visitor::Visitor ( const core::ExecParams params)
sofa::simulation::Visitor::~Visitor ( )
virtual

Function details

Visitor& sofa::simulation::Visitor::addTag ( Tag  t)
inline
simulation::Visitor::ctime_t sofa::simulation::Visitor::begin ( simulation::Node node,
core::objectmodel::BaseObject obj,
const std::string &  typeInfo = std::string("type") 
)
virtual

Optional helper method to call before handling an object if not using the for_each method. It currently takes care of time logging, but could be extended (step-by-step execution for instance)

simulation::Visitor::ctime_t sofa::simulation::Visitor::begin ( simulation::Visitor::VisitorContext vc,
core::objectmodel::BaseObject obj,
const std::string &  info = std::string("type") 
)

Optional helper method to call before handling an object if not using the for_each method. It currently takes care of time logging, but could be extended (step-by-step execution for instance)

virtual bool sofa::simulation::Visitor::childOrderReversed ( simulation::Node )
inlinevirtual

Return true to reverse the order of traversal of child nodes.

Reimplemented in sofa::simulation::MechanicalAccumulateMatrixDeriv.

void sofa::simulation::Visitor::debug_write_state_after ( core::objectmodel::BaseObject )
inline
void sofa::simulation::Visitor::debug_write_state_before ( core::objectmodel::BaseObject )
inline
void sofa::simulation::Visitor::end ( simulation::Node node,
core::objectmodel::BaseObject obj,
ctime_t  t0 
)
virtual

Optional helper method to call after handling an object if not using the for_each method. It currently takes care of time logging, but could be extended (step-by-step execution for instance)

void sofa::simulation::Visitor::end ( simulation::Visitor::VisitorContext vc,
core::objectmodel::BaseObject obj,
ctime_t  t0 
)

Optional helper method to call after handling an object if not using the for_each method. It currently takes care of time logging, but could be extended (step-by-step execution for instance)

const core::ExecParams* sofa::simulation::Visitor::execParams ( ) const
inline
void sofa::simulation::Visitor::execute ( core::objectmodel::BaseContext node,
bool  precomputedOrder = false 
)
virtual

Alias for context->executeVisitor(this)

Reimplemented in sofa::simulation::MechanicalComputeEnergyVisitor, and sofa::simulation::MechanicalGetMomentumVisitor.

template<class Visit , class VContext , class Container , class Object >
void sofa::simulation::Visitor::for_each ( Visit *  visitor,
VContext *  ctx,
const Container &  list,
void(Visit::*)(VContext *, Object *)  fn 
)
inline

Helper method to enumerate objects in the given list. The callback gets the pointer to node.

template<class Visit , class VContext , class Container , class Object >
Visitor::Result sofa::simulation::Visitor::for_each_r ( Visit *  visitor,
VContext *  ctx,
const Container &  list,
Visitor::Result(Visit::*)(VContext *, Object *)  fn 
)
inline

Helper method to enumerate objects in the given list. The callback gets the pointer to node.

virtual const char* sofa::simulation::Visitor::getClassName ( ) const
inlinevirtual

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

Reimplemented in sofa::simulation::MechanicalVSizeVisitor, sofa::simulation::MechanicalPickParticlesWithTagsVisitor, sofa::simulation::MechanicalPickParticlesVisitor, sofa::simulation::MechanicalAddSeparateGravityVisitor, sofa::simulation::MechanicalComputeContactForceVisitor, sofa::simulation::MechanicalIntegrationVisitor, sofa::simulation::MechanicalEndIntegrationVisitor, sofa::simulation::MechanicalBeginIntegrationVisitor, sofa::simulation::MechanicalApplyConstraintsVisitor, sofa::simulation::MechanicalAccumulateMatrixDeriv, sofa::simulation::MechanicalBuildConstraintMatrix, sofa::simulation::MechanicalAccumulateConstraint, sofa::simulation::MechanicalWriteLMConstraint, sofa::simulation::MechanicalResetConstraintVisitor, sofa::simulation::MechanicalAddMBKdxVisitor, sofa::simulation::MechanicalComputeGeometricStiffness, sofa::simulation::MechanicalComputeDfVisitor, sofa::simulation::MechanicalComputeForceVisitor, sofa::simulation::MechanicalResetForceVisitor, sofa::simulation::MechanicalSetPositionAndVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyPositionAndVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyPositionVisitor, sofa::simulation::MechanicalProjectPositionAndVelocityVisitor, sofa::simulation::MechanicalProjectPositionVisitor, sofa::simulation::MechanicalProjectVelocityVisitor, sofa::simulation::MechanicalProjectJacobianMatrixVisitor, sofa::simulation::MechanicalAccFromFVisitor, sofa::simulation::MechanicalAddMDxVisitor, sofa::simulation::MechanicalPropagateOnlyPositionAndResetForceVisitor, sofa::simulation::MechanicalPropagateDxAndResetForceVisitor, sofa::simulation::MechanicalPropagateDxVisitor, sofa::simulation::MechanicalVNormVisitor, sofa::simulation::MechanicalVDotVisitor, sofa::simulation::MechanicalVMultiOpVisitor, sofa::simulation::MechanicalVOpVisitor, sofa::simulation::MechanicalVFreeVisitor< vtype >, sofa::simulation::MechanicalVReallocVisitor< vtype >, sofa::simulation::MechanicalVAllocVisitor< vtype >, sofa::simulation::MechanicalVInitVisitor< vtype >, sofa::simulation::MechanicalVAvailVisitor< vtype >, sofa::simulation::MechanicalGetDimensionVisitor, sofa::simulation::MechanicalMultiVectorFromBaseVectorVisitor, sofa::simulation::MechanicalMultiVectorPeqBaseVectorVisitor, sofa::simulation::MechanicalMultiVectorToBaseVectorVisitor, sofa::simulation::MechanicalApplyProjectiveConstraint_ToMatrixVisitor, sofa::simulation::MechanicalAddSubMBK_ToMatrixVisitor, sofa::simulation::ParallelMechanicalVDotVisitor, sofa::simulation::MechanicalAddMBK_ToMatrixVisitor, sofa::simulation::MechanicalIntegrateConstraintsVisitor, sofa::component::constraintset::MechanicalGetConstraintResolutionVisitor, sofa::component::misc::ReadTopologyModifier, sofa::component::misc::WriteStateActivator, sofa::simulation::VisualClearVisitor, sofa::component::misc::ReadTopologyActivator, sofa::component::misc::ReadStateModifier, sofa::component::misc::WriteTopologyActivator, sofa::simulation::ParallelMechanicalVOpVisitor, sofa::simulation::VisualComputeBBoxVisitor, sofa::component::misc::WriteStateCreator, sofa::component::misc::ReadStateActivator, sofa::component::animationloop::MechanicalAccumulateConstraint2, sofa::component::misc::ReadTopologyCreator, sofa::component::misc::WriteTopologyCreator, sofa::simulation::MechanicalGetConstraintJacobianVisitor, sofa::simulation::BaseMechanicalVisitor, sofa::simulation::VisualInitVisitor, sofa::component::misc::CompareStateResult, sofa::component::constraintset::MechanicalGetConstraintViolationVisitor, sofa::component::misc::CompareTopologyResult, sofa::component::misc::ReadStateCreator, sofa::simulation::VisualUpdateVisitor, sofa::simulation::graph::GetUpObjectsVisitor, sofa::component::constraintset::MechanicalGetConstraintInfoVisitor, sofa::component::animationloop::MechanicalSetConstraint, sofa::simulation::tree::GNodeVisitor, sofa::component::misc::CompareStateCreator, sofa::simulation::VisualDrawVisitor, sofa::component::misc::CompareTopologyCreator, sofa::simulation::MechanicalGetMatrixDimensionVisitor, sofa::gui::ColourPickingVisitor, sofa::simulation::CollisionResponseVisitor, sofa::simulation::DofPrintVisitor, sofa::simulation::UpdateVisualContextVisitor, sofa::simulation::CollisionDetectionVisitor, sofa::simulation::tree::ExportDotVisitor, sofa::component::interactionforcefield::MechanicalAccumulateJacobian, sofa::simulation::AnimateVisitor, sofa::simulation::UpdateSimulationContextVisitor, sofa::simulation::VisualVisitor, sofa::simulation::ParallelMechanicalVOpMecVisitor, sofa::simulation::MechanicalVPrintWithElapsedTimeVisitor, sofa::simulation::PrintVisitor, sofa::simulation::SolveVisitor, sofa::simulation::ExportGnuplotVisitor, sofa::simulation::CollisionResetVisitor, sofa::simulation::StoreResetStateVisitor, sofa::simulation::MechanicalComputeEnergyVisitor, sofa::simulation::TransformationVisitor, sofa::simulation::MechanicalGetMomentumVisitor, sofa::simulation::FindByTypeVisitor< T >, sofa::simulation::InitVisitor, sofa::simulation::XMLPrintVisitor, sofa::simulation::graph::GetDownObjectsVisitor, sofa::simulation::TopologyChangeVisitor, sofa::simulation::UpdateContextVisitor, sofa::simulation::BehaviorUpdatePositionVisitor, sofa::simulation::UpdateInternalDataVisitor, sofa::simulation::CollisionVisitor, sofa::simulation::ExportOBJVisitor, sofa::simulation::InitGnuplotVisitor, sofa::simulation::PropagateEventVisitor, sofa::simulation::DeactivationVisitor, sofa::simulation::StateChangeVisitor, sofa::simulation::MechanicalVPrintVisitor, sofa::simulation::VelocityThresholdVisitor, sofa::simulation::ResetVisitor, sofa::simulation::UpdateLinksVisitor, sofa::simulation::UpdateMappingVisitor, sofa::simulation::WriteStateVisitor, sofa::simulation::CleanupVisitor, and sofa::simulation::DeleteVisitor.

virtual std::string sofa::simulation::Visitor::getInfos ( ) const
inlinevirtual

Return eventual information on the behavior of the visitor Only used for debugging / profiling purposes

Reimplemented in sofa::simulation::MechanicalVSizeVisitor, sofa::simulation::MechanicalAddSeparateGravityVisitor, sofa::simulation::MechanicalApplyConstraintsVisitor, sofa::simulation::MechanicalWriteLMConstraint, sofa::simulation::MechanicalAddMBKdxVisitor, sofa::simulation::MechanicalComputeGeometricStiffness, sofa::simulation::MechanicalComputeDfVisitor, sofa::simulation::MechanicalComputeForceVisitor, sofa::simulation::MechanicalResetForceVisitor, sofa::simulation::MechanicalSetPositionAndVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyPositionAndVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyPositionVisitor, sofa::simulation::MechanicalProjectPositionAndVelocityVisitor, sofa::simulation::MechanicalProjectPositionVisitor, sofa::simulation::MechanicalProjectVelocityVisitor, sofa::simulation::MechanicalAccFromFVisitor, sofa::simulation::MechanicalAddMDxVisitor, sofa::simulation::MechanicalPropagateDxAndResetForceVisitor, sofa::simulation::MechanicalPropagateDxVisitor, sofa::simulation::MechanicalVNormVisitor, sofa::simulation::MechanicalVDotVisitor, sofa::simulation::MechanicalVMultiOpVisitor, sofa::simulation::MechanicalVOpVisitor, sofa::simulation::MechanicalVFreeVisitor< vtype >, sofa::simulation::MechanicalVReallocVisitor< vtype >, sofa::simulation::MechanicalVAllocVisitor< vtype >, sofa::simulation::MechanicalVInitVisitor< vtype >, sofa::simulation::MechanicalVAvailVisitor< vtype >, sofa::simulation::ParallelMechanicalVDotVisitor, sofa::simulation::ParallelMechanicalVOpVisitor, sofa::simulation::ParallelMechanicalVOpMecVisitor, sofa::simulation::FindByTypeVisitor< T >, sofa::simulation::TopologyChangeVisitor, and sofa::simulation::PropagateEventVisitor.

virtual bool sofa::simulation::Visitor::isThreadSafe ( ) const
inlinevirtual

Specify whether this visitor can be parallelized.

Reimplemented in sofa::simulation::MechanicalVSizeVisitor, sofa::simulation::MechanicalComputeContactForceVisitor, sofa::simulation::MechanicalIntegrationVisitor, sofa::simulation::MechanicalEndIntegrationVisitor, sofa::simulation::MechanicalBeginIntegrationVisitor, sofa::simulation::MechanicalApplyConstraintsVisitor, sofa::simulation::MechanicalAccumulateMatrixDeriv, sofa::simulation::MechanicalBuildConstraintMatrix, sofa::simulation::MechanicalAccumulateConstraint, sofa::simulation::MechanicalWriteLMConstraint, sofa::simulation::MechanicalResetConstraintVisitor, sofa::simulation::MechanicalAddMBKdxVisitor, sofa::simulation::MechanicalComputeGeometricStiffness, sofa::simulation::MechanicalComputeDfVisitor, sofa::simulation::MechanicalComputeForceVisitor, sofa::simulation::MechanicalResetForceVisitor, sofa::simulation::MechanicalSetPositionAndVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyPositionAndVelocityVisitor, sofa::simulation::MechanicalPropagateOnlyPositionVisitor, sofa::simulation::MechanicalProjectPositionAndVelocityVisitor, sofa::simulation::MechanicalProjectPositionVisitor, sofa::simulation::MechanicalProjectVelocityVisitor, sofa::simulation::MechanicalProjectJacobianMatrixVisitor, sofa::simulation::MechanicalAccFromFVisitor, sofa::simulation::MechanicalAddMDxVisitor, sofa::simulation::MechanicalPropagateOnlyPositionAndResetForceVisitor, sofa::simulation::MechanicalPropagateDxAndResetForceVisitor, sofa::simulation::MechanicalPropagateDxVisitor, sofa::simulation::MechanicalVNormVisitor, sofa::simulation::MechanicalVDotVisitor, sofa::simulation::MechanicalVMultiOpVisitor, sofa::simulation::MechanicalVOpVisitor, sofa::simulation::MechanicalVFreeVisitor< vtype >, sofa::simulation::MechanicalVReallocVisitor< vtype >, sofa::simulation::MechanicalVAllocVisitor< vtype >, sofa::simulation::MechanicalVInitVisitor< vtype >, sofa::simulation::MechanicalVAvailVisitor< vtype >, sofa::simulation::ParallelMechanicalVDotVisitor, sofa::simulation::ParallelMechanicalVOpVisitor, sofa::component::constraintset::MechanicalGetConstraintResolutionVisitor, sofa::component::animationloop::MechanicalAccumulateConstraint2, sofa::simulation::ParallelMechanicalVOpMecVisitor, sofa::simulation::graph::GetUpObjectsVisitor, sofa::component::animationloop::MechanicalSetConstraint, sofa::component::interactionforcefield::MechanicalAccumulateJacobian, sofa::simulation::AnimateVisitor, sofa::simulation::SolveVisitor, sofa::simulation::StoreResetStateVisitor, sofa::simulation::UpdateContextVisitor, sofa::simulation::TransformationVisitor, sofa::simulation::InitVisitor, sofa::simulation::UpdateMappingVisitor, sofa::simulation::graph::GetDownObjectsVisitor, sofa::simulation::TopologyChangeVisitor, sofa::simulation::BehaviorUpdatePositionVisitor, sofa::simulation::UpdateInternalDataVisitor, sofa::simulation::ResetVisitor, sofa::simulation::UpdateLinksVisitor, sofa::simulation::DeactivationVisitor, and sofa::simulation::StateChangeVisitor.

virtual void sofa::simulation::Visitor::processNodeBottomUp ( simulation::Node node,
LocalStorage  
)
inlinevirtual

Callback method called after child node have been processed and before going back to the parent node. This version is offered a LocalStorage to store temporary data

Reimplemented in sofa::simulation::BaseMechanicalVisitor.

virtual Result sofa::simulation::Visitor::processNodeTopDown ( simulation::Node )
inlinevirtual

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

Reimplemented in sofa::component::misc::ReadTopologyModifier, sofa::component::misc::WriteStateActivator, sofa::component::controller::UpdateAllSleepStates, sofa::component::misc::ReadTopologyActivator, sofa::component::misc::ReadStateModifier, sofa::component::misc::WriteTopologyActivator, sofa::simulation::VisualComputeBBoxVisitor, sofa::simulation::BaseMechanicalVisitor, sofa::component::misc::ReadStateActivator, sofa::component::misc::WriteStateCreator, sofa::component::misc::ReadTopologyCreator, sofa::simulation::VisualInitVisitor, sofa::component::misc::WriteTopologyCreator, sofa::component::misc::CompareStateResult, sofa::component::misc::CompareTopologyResult, sofa::component::misc::ReadStateCreator, sofa::simulation::VisualUpdateVisitor, sofa::component::misc::CompareStateCreator, sofa::component::misc::CompareTopologyCreator, sofa::simulation::VisualDrawVisitor, sofa::simulation::graph::GetUpObjectsVisitor, sofa::gui::ColourPickingVisitor, sofa::simulation::UpdateVisualContextVisitor, sofa::simulation::DofPrintVisitor, sofa::simulation::UpdateSimulationContextVisitor, sofa::simulation::MechanicalVPrintWithElapsedTimeVisitor, sofa::simulation::tree::GNodeVisitor, sofa::simulation::PrintVisitor, sofa::simulation::AnimateVisitor, sofa::simulation::VisualVisitor, sofa::simulation::SolveVisitor, sofa::simulation::ExportGnuplotVisitor, sofa::simulation::StoreResetStateVisitor, sofa::simulation::XMLPrintVisitor, sofa::simulation::TransformationVisitor, sofa::simulation::FindByTypeVisitor< T >, sofa::simulation::ExportOBJVisitor, sofa::simulation::InitVisitor, sofa::simulation::UpdateContextVisitor, sofa::simulation::PropagateEventVisitor, sofa::simulation::CollisionVisitor, sofa::simulation::MechanicalVPrintVisitor, sofa::simulation::BehaviorUpdatePositionVisitor, sofa::simulation::TopologyChangeVisitor, sofa::simulation::UpdateInternalDataVisitor, sofa::simulation::InitGnuplotVisitor, sofa::simulation::ResetVisitor, sofa::simulation::UpdateLinksVisitor, sofa::simulation::UpdateMappingVisitor, sofa::simulation::graph::GetDownObjectsVisitor, sofa::simulation::StateChangeVisitor, sofa::simulation::WriteStateVisitor, sofa::simulation::DeactivationVisitor, sofa::simulation::CleanupVisitor, sofa::simulation::UpdateBoundingBoxVisitor, and sofa::simulation::VelocityThresholdVisitor.

virtual Result sofa::simulation::Visitor::processNodeTopDown ( simulation::Node node,
LocalStorage  
)
inlinevirtual

Callback method called when decending to a new node. Recursion will stop if this method returns RESULT_PRUNE This version is offered a LocalStorage to store temporary data

Reimplemented in sofa::simulation::BaseMechanicalVisitor.

Visitor& sofa::simulation::Visitor::removeTag ( Tag  t)
inline
Visitor& sofa::simulation::Visitor::setTags ( const TagSet t)
inline
bool sofa::simulation::Visitor::testTags ( core::objectmodel::BaseObject obj)
inline
virtual bool sofa::simulation::Visitor::treeTraversal ( TreeTraversalRepetition repeat)
inlinevirtual
Returns
treeTraversal returns true if and only if a tree traversal must be enforced (even for a DAG)
Parameters
repeatTell if a node callback can be executed several times (at each traversal in diamond configurations)

Reimplemented in sofa::simulation::VisualVisitor, sofa::simulation::XMLPrintVisitor, and sofa::simulation::PrintVisitor.

Enum details

Enumerator
RESULT_CONTINUE 
RESULT_PRUNE 
Enumerator
NO_REPETITION 
REPEAT_ALL 
REPEAT_ONCE