Computer Assited Medical Intervention Tool Kit  version 5.0
SofaSimulator Class Reference

TODO Comment class here. More...

#include <SofaSimulator.h>

+ Inheritance diagram for SofaSimulator:
+ Collaboration diagram for SofaSimulator:

Public Member Functions

std::string getScnFile ()
 
 SofaSimulator (MonitoringManager *monitoringManager)
 
 SofaSimulator (MonitoringManager *monitoringManager, const char *file)
 
virtual ~SofaSimulator ()
 
Simulator inherited
void doMove (double dt)
 ask the simulator do to one step of the simulation More...
 
void init ()
 initialize the simulator More...
 
void getPosition (int index, double position[3])
 get current position for one atom More...
 
void getForce (int index, double force[3])
 get current force for one atom More...
 
void end ()
 end simultor More...
 
void createPml (const char *inputFile, const char *pmlFile)
 Create a pml file from an imput file. More...
 
- Public Member Functions inherited from InteractiveSimulator
 InteractiveSimulator (MonitoringManager *monitoringManager)
 constructor More...
 
 InteractiveSimulator (MonitoringManager *monitoringManager, const char *file)
 constructor More...
 
 ~InteractiveSimulator () override=default
 destructor More...
 
- Public Member Functions inherited from Simulator
 Simulator (MonitoringManager *monitoringManager)
 default constructor build a simulation from context provided by monitoringManager More...
 
 Simulator (MonitoringManager *monitoringManager, const char *file)
 constructor with simulator file build a simulation from context provided by monitoringManager and physical model provided by a simulator specific input file More...
 
void updatePositions ()
 update all current positions and store last positions More...
 
virtual ~Simulator ()=default
 destructor More...
 

Private Member Functions

void build ()
 build structure More...
 
void buildConstraints ()
 translate loads into constraints More...
 
unsigned int getAtomIndex (unsigned int mechObjectIndex, unsigned int dofIndex)
 get the atom id corresponding to DOF of index dofIndex in the MechanicalObject of index mechObjectIndex More...
 
sofa::defaulttype::Vec3Types::Deriv getDOFForce (unsigned int atomIndex)
 Return the force std::vector corresponding to the Atom number i. More...
 
sofa::defaulttype::Vec3Types::Deriv getDOFForce (unsigned int mechObjectIndex, unsigned int dofIndex)
 get the force of the DOF of index dofIndex in the MechanicalObject of index mechObjectIndex More...
 
sofa::defaulttype::Vec3Types::Coord getDOFPosition (unsigned int atomIndex)
 Return the Coord std::vector corresponding to the Atom number i. More...
 
sofa::defaulttype::Vec3Types::Coord getDOFPosition (unsigned int mechObjectIndex, unsigned int dofIndex)
 get the position of the DOF of index dofIndex in the MechanicalObject of index mechObjectIndex More...
 
sofa::simulation::Node * getGNode ()
 get the sofa graph node root More...
 
sofa::component::container::MechanicalObject< sofa::defaulttype::Vec3Types > * getMechanicalObject (unsigned int mechObjectIndex)
 get a mechanical object by its index More...
 
std::MechanicalObjectAtomDOFMapgetMechanicalObjectAtomDOFMap (unsigned int mechObjectIndex)
 get the MechanicalObjectAtomDOFMap for a given mechancial object More...
 
std::MechanicalObjectDOFAtomMapgetMechanicalObjectDOFAtomMap (unsigned int mechObjectIndex)
 get the MechanicalObjectAtomDOFMap for a given mechancial object More...
 
sofa::defaulttype::Vec3Types::VecDeriv getMechanicalObjectDOFForce (unsigned int mechObjectIndex)
 get the forces of all DOF for mechanical object mechObjectIndex More...
 
sofa::defaulttype::Vec3Types::VecCoord getMechanicalObjectDOFPosition (unsigned int mechObjectIndex)
 get the positions of all DOF for mechanical object mechObjectIndex More...
 
unsigned int getNumberOfMechanicalObjects ()
 get the number of mechanical objects More...
 

Private Attributes

std::AtomDOFMap atomsToDOF
 create a correspondance between the atoms and the DOFs (indexAtom<->indexMechObject[indexDOF]) More...
 
std::vector< std::MechanicalObjectAtomDOFMap * > mechanicalObjectAtomDOFMap
 list of all MechanicalObjectAtomDOFMap More...
 
std::vector< std::MechanicalObjectDOFAtomMap * > mechanicalObjectDOFAtomMap
 list of all MechanicalObjectDOFAtomMap More...
 
SofaVector< BaseMechanicalState * > mechanicalObjects
 the sofa graph node root More...
 
std::string scnFile
 path to .scn file More...
 
std::vector< TranslationConstraint< sofa::defaulttype::Vec3Types > * > translations
 the load constraints (i.e. Translation) for each mechanical Objects More...
 

Additional Inherited Members

- Protected Attributes inherited from Simulator
MonitoringManagermonitoringManager
 monitoring manager More...
 

Detailed Description

TODO Comment class here.

Constructor & Destructor Documentation

◆ SofaSimulator() [1/2]

◆ SofaSimulator() [2/2]

SofaSimulator::SofaSimulator ( MonitoringManager monitoringManager,
const char *  file 
)

References build().

+ Here is the call graph for this function:

◆ ~SofaSimulator()

SofaSimulator::~SofaSimulator ( )
virtual

References getGNode().

+ Here is the call graph for this function:

Member Function Documentation

◆ build()

void SofaSimulator::build ( )
private

build structure

References getGNode(), mechanicalObjects, Simulator::monitoringManager, scnFile, and MonitoringManager::setDt().

Referenced by SofaSimulator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildConstraints()

void SofaSimulator::buildConstraints ( )
private

translate loads into constraints

References getGNode(), MonitoringManager::getLml(), getMechanicalObject(), getMechanicalObjectAtomDOFMap(), getNumberOfMechanicalObjects(), TranslationConstraint< DataTypes >::getTargets(), Simulator::monitoringManager, TranslationConstraint< DataTypes >::setInitTime(), and translations.

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPml()

◆ doMove()

void SofaSimulator::doMove ( double  dt)
virtual

ask the simulator do to one step of the simulation

Parameters
dtintegration step

Implements InteractiveSimulator.

References getGNode().

+ Here is the call graph for this function:

◆ end()

void SofaSimulator::end ( )
inlinevirtual

end simultor

Implements InteractiveSimulator.

◆ getAtomIndex()

unsigned int SofaSimulator::getAtomIndex ( unsigned int  mechObjectIndex,
unsigned int  dofIndex 
)
private

get the atom id corresponding to DOF of index dofIndex in the MechanicalObject of index mechObjectIndex

References getMechanicalObjectDOFAtomMap().

Referenced by createPml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDOFForce() [1/2]

Vec3Types::Deriv SofaSimulator::getDOFForce ( unsigned int  atomIndex)
private

Return the force std::vector corresponding to the Atom number i.

References atomsToDOF.

◆ getDOFForce() [2/2]

Vec3Types::Deriv SofaSimulator::getDOFForce ( unsigned int  mechObjectIndex,
unsigned int  dofIndex 
)
private

get the force of the DOF of index dofIndex in the MechanicalObject of index mechObjectIndex

References getMechanicalObjectDOFForce().

+ Here is the call graph for this function:

◆ getDOFPosition() [1/2]

Vec3Types::Coord SofaSimulator::getDOFPosition ( unsigned int  atomIndex)
private

Return the Coord std::vector corresponding to the Atom number i.

References atomsToDOF.

◆ getDOFPosition() [2/2]

Vec3Types::Coord SofaSimulator::getDOFPosition ( unsigned int  mechObjectIndex,
unsigned int  dofIndex 
)
private

get the position of the DOF of index dofIndex in the MechanicalObject of index mechObjectIndex

References getMechanicalObjectDOFPosition().

+ Here is the call graph for this function:

◆ getForce()

void SofaSimulator::getForce ( int  index,
double  force[3] 
)
virtual

get current force for one atom

Implements Simulator.

References atomsToDOF, and getMechanicalObjectDOFForce().

+ Here is the call graph for this function:

◆ getGNode()

sofa::simulation::Node * SofaSimulator::getGNode ( )
inlineprivate

get the sofa graph node root

Referenced by build(), buildConstraints(), createPml(), doMove(), init(), and ~SofaSimulator().

+ Here is the caller graph for this function:

◆ getMechanicalObject()

MechanicalObject< Vec3Types > * SofaSimulator::getMechanicalObject ( unsigned int  mechObjectIndex)
private

get a mechanical object by its index

References mechanicalObjects.

Referenced by buildConstraints(), createPml(), getMechanicalObjectDOFForce(), and getMechanicalObjectDOFPosition().

+ Here is the caller graph for this function:

◆ getMechanicalObjectAtomDOFMap()

std::MechanicalObjectAtomDOFMap & SofaSimulator::getMechanicalObjectAtomDOFMap ( unsigned int  mechObjectIndex)
inlineprivate

get the MechanicalObjectAtomDOFMap for a given mechancial object

References mechanicalObjectAtomDOFMap.

Referenced by buildConstraints().

+ Here is the caller graph for this function:

◆ getMechanicalObjectDOFAtomMap()

std::MechanicalObjectDOFAtomMap & SofaSimulator::getMechanicalObjectDOFAtomMap ( unsigned int  mechObjectIndex)
inlineprivate

get the MechanicalObjectAtomDOFMap for a given mechancial object

References mechanicalObjectDOFAtomMap.

Referenced by getAtomIndex().

+ Here is the caller graph for this function:

◆ getMechanicalObjectDOFForce()

sofa::defaulttype::Vec3Types::VecDeriv SofaSimulator::getMechanicalObjectDOFForce ( unsigned int  mechObjectIndex)
inlineprivate

get the forces of all DOF for mechanical object mechObjectIndex

References getMechanicalObject().

Referenced by getDOFForce(), and getForce().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMechanicalObjectDOFPosition()

sofa::defaulttype::Vec3Types::VecCoord SofaSimulator::getMechanicalObjectDOFPosition ( unsigned int  mechObjectIndex)
inlineprivate

get the positions of all DOF for mechanical object mechObjectIndex

References getMechanicalObject().

Referenced by createPml(), getDOFPosition(), and getPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumberOfMechanicalObjects()

unsigned int SofaSimulator::getNumberOfMechanicalObjects ( )
inlineprivate

get the number of mechanical objects

References mechanicalObjects.

Referenced by buildConstraints().

+ Here is the caller graph for this function:

◆ getPosition()

void SofaSimulator::getPosition ( int  index,
double  position[3] 
)
virtual

get current position for one atom

Implements InteractiveSimulator.

References atomsToDOF, and getMechanicalObjectDOFPosition().

+ Here is the call graph for this function:

◆ getScnFile()

std::string SofaSimulator::getScnFile ( )
inline

References scnFile.

Referenced by SofaWidget::SofaWidget().

+ Here is the caller graph for this function:

◆ init()

void SofaSimulator::init ( )
virtual

initialize the simulator

Implements InteractiveSimulator.

References buildConstraints(), getGNode(), MonitoringManager::isLmlPresent(), and Simulator::monitoringManager.

+ Here is the call graph for this function:

Member Data Documentation

◆ atomsToDOF

std::AtomDOFMap SofaSimulator::atomsToDOF
private

create a correspondance between the atoms and the DOFs (indexAtom<->indexMechObject[indexDOF])

Referenced by createPml(), getDOFForce(), getDOFPosition(), getForce(), and getPosition().

◆ mechanicalObjectAtomDOFMap

std::vector<std::MechanicalObjectAtomDOFMap*> SofaSimulator::mechanicalObjectAtomDOFMap
private

list of all MechanicalObjectAtomDOFMap

Referenced by createPml(), and getMechanicalObjectAtomDOFMap().

◆ mechanicalObjectDOFAtomMap

std::vector<std::MechanicalObjectDOFAtomMap*> SofaSimulator::mechanicalObjectDOFAtomMap
private

list of all MechanicalObjectDOFAtomMap

Referenced by createPml(), and getMechanicalObjectDOFAtomMap().

◆ mechanicalObjects

SofaVector<BaseMechanicalState*> SofaSimulator::mechanicalObjects
private

the sofa graph node root

all the mechanical objects

Referenced by build(), createPml(), getMechanicalObject(), and getNumberOfMechanicalObjects().

◆ scnFile

std::string SofaSimulator::scnFile
private

path to .scn file

Referenced by build(), and getScnFile().

◆ translations

std::vector<TranslationConstraint<sofa::defaulttype::Vec3Types> *> SofaSimulator::translations
private

the load constraints (i.e. Translation) for each mechanical Objects

Referenced by buildConstraints().


The documentation for this class was generated from the following files: