27 #ifndef SIMULATOR_SIMULATORS_SOFA_SOFASIMULATOR_H
28 #define SIMULATOR_SIMULATORS_SOFA_SOFASIMULATOR_H
32 #include <sofa/simulation/tree/TreeSimulation.h>
33 #include <sofa/component/container/MechanicalObject.h>
34 #include <sofa/defaulttype/VecTypes.h>
35 #include <sofa/simulation/common/Node.h>
36 #include <sofa/simulation/tree/GNode.h>
39 #define SofaVector sofa::helper::vector
51 typedef map <unsigned int, MechanicalObjectDOFIndex>
AtomDOFMap;
83 void getForce(
int index,
double force[3]);
86 void createPml(
const char* inputFile,
const char* pmlFile);
102 sofa::defaulttype::Vec3Types::Coord
getDOFPosition(
unsigned int atomIndex);
105 sofa::defaulttype::Vec3Types::Coord
getDOFPosition(
unsigned int mechObjectIndex,
unsigned int dofIndex);
108 sofa::defaulttype::Vec3Types::Deriv
getDOFForce(
unsigned int atomIndex);
111 sofa::defaulttype::Vec3Types::Deriv
getDOFForce(
unsigned int mechObjectIndex,
unsigned int dofIndex);
114 unsigned int getAtomIndex(
unsigned int mechObjectIndex,
unsigned int dofIndex);
117 sofa::component::container::MechanicalObject<sofa::defaulttype::Vec3Types>*
getMechanicalObject(
unsigned int mechObjectIndex);
135 #if defined(SOFA_1_0_RC1) || defined(SOFA_SVN) || defined(SOFA_STABLE)
136 sofa::simulation::Node::SPtr groot;
139 #ifdef MML_SOFA_1_0_BETA4
140 sofa::simulation::Node* groot;
156 std::vector<TranslationConstraint<sofa::defaulttype::Vec3Types> *>
translations;
164 if (groot ==
nullptr) {
168 #if defined(SOFA_1_0_RC1) || defined(SOFA_SVN) || defined(SOFA_STABLE)
172 #ifdef MML_SOFA_1_0_BETA4
pair< unsigned int, unsigned int > MechanicalObjectDOFIndex
definition of a couple (=STL pair) [unsigned int mecObjectIndex, unsigned int dofIndex]
Definition: SofaSimulator.h:47
map< unsigned int, unsigned int > MechanicalObjectAtomDOFMap
there is one MechanicalObjectAtomDOFMap per Mechanical Object: this is a map where first is the atom ...
Definition: SofaSimulator.h:55
map< unsigned int, unsigned int > MechanicalObjectDOFAtomMap
there is one MechanicalObjectDOFAtomMap per Mechanical Object: this is a map where first is the DOF i...
Definition: SofaSimulator.h:59
map< unsigned int, MechanicalObjectDOFIndex > AtomDOFMap
definition of the association set (=map in STL) AtomDOFMap AtomDOFMap associates an atom index with t...
Definition: SofaSimulator.h:51
An interactive simulator is a simulator that we can control step by step (ex: Sofa)
Definition: InteractiveSimulator.h:38
Manager of the benchmark tests.
Definition: MonitoringManager.h:50
MonitoringManager * monitoringManager
monitoring manager
Definition: Simulator.h:84
TODO Comment class here.
Definition: SofaSimulator.h:69
std::vector< std::MechanicalObjectDOFAtomMap * > mechanicalObjectDOFAtomMap
list of all MechanicalObjectDOFAtomMap
Definition: SofaSimulator.h:153
std::vector< std::MechanicalObjectAtomDOFMap * > mechanicalObjectAtomDOFMap
list of all MechanicalObjectAtomDOFMap
Definition: SofaSimulator.h:150
SofaSimulator(MonitoringManager *monitoringManager)
Definition: SofaSimulator.cpp:76
std::MechanicalObjectAtomDOFMap & getMechanicalObjectAtomDOFMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:183
std::AtomDOFMap atomsToDOF
create a correspondance between the atoms and the DOFs (indexAtom<->indexMechObject[indexDOF])
Definition: SofaSimulator.h:147
void buildConstraints()
translate loads into constraints
Definition: SofaSimulator.cpp:495
sofa::defaulttype::Vec3Types::Deriv getDOFForce(unsigned int atomIndex)
Return the force std::vector corresponding to the Atom number i.
Definition: SofaSimulator.cpp:418
void createPml(const char *inputFile, const char *pmlFile)
Create a pml file from an imput file.
Definition: SofaSimulator.cpp:534
std::string getScnFile()
Definition: SofaSimulator.h:203
void build()
build structure
Definition: SofaSimulator.cpp:292
sofa::defaulttype::Vec3Types::VecDeriv getMechanicalObjectDOFForce(unsigned int mechObjectIndex)
get the forces of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:198
unsigned int getAtomIndex(unsigned int mechObjectIndex, unsigned int dofIndex)
get the atom id corresponding to DOF of index dofIndex in the MechanicalObject of index mechObjectInd...
Definition: SofaSimulator.cpp:428
void getForce(int index, double force[3])
get current force for one atom
Definition: SofaSimulator.cpp:472
void end()
end simultor
Definition: SofaSimulator.h:84
virtual ~SofaSimulator()
Definition: SofaSimulator.cpp:282
SofaVector< BaseMechanicalState * > mechanicalObjects
the sofa graph node root
Definition: SofaSimulator.h:144
std::string scnFile
path to .scn file
Definition: SofaSimulator.h:159
void doMove(double dt)
ask the simulator do to one step of the simulation
Definition: SofaSimulator.cpp:440
void getPosition(int index, double position[3])
get current position for one atom
Definition: SofaSimulator.cpp:459
std::vector< TranslationConstraint< sofa::defaulttype::Vec3Types > * > translations
the load constraints (i.e. Translation) for each mechanical Objects
Definition: SofaSimulator.h:156
sofa::component::container::MechanicalObject< sofa::defaulttype::Vec3Types > * getMechanicalObject(unsigned int mechObjectIndex)
get a mechanical object by its index
Definition: SofaSimulator.cpp:435
sofa::simulation::Node * getGNode()
get the sofa graph node root
Definition: SofaSimulator.h:163
sofa::defaulttype::Vec3Types::Coord getDOFPosition(unsigned int atomIndex)
Return the Coord std::vector corresponding to the Atom number i.
Definition: SofaSimulator.cpp:408
sofa::defaulttype::Vec3Types::VecCoord getMechanicalObjectDOFPosition(unsigned int mechObjectIndex)
get the positions of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:193
std::MechanicalObjectDOFAtomMap & getMechanicalObjectDOFAtomMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:188
void init()
initialize the simulator
Definition: SofaSimulator.cpp:486
unsigned int getNumberOfMechanicalObjects()
get the number of mechanical objects
Definition: SofaSimulator.h:178