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;
80 void doMove(
double dt);
82 void getPosition(
int index,
double position[3]);
83 void getForce(
int index,
double force[3]);
86 void createPml(
const char* inputFile,
const char* pmlFile);
89 std::string getScnFile();
93 sofa::simulation::Node* getGNode();
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);
120 unsigned int getNumberOfMechanicalObjects();
123 sofa::defaulttype::Vec3Types::VecCoord getMechanicalObjectDOFPosition(
unsigned int mechObjectIndex);
126 sofa::defaulttype::Vec3Types::VecDeriv getMechanicalObjectDOFForce(
unsigned int mechObjectIndex);
132 void buildConstraints();
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;
168 #if defined(SOFA_1_0_RC1) || defined(SOFA_SVN) || defined(SOFA_STABLE) 172 #ifdef MML_SOFA_1_0_BETA4 179 return mechanicalObjects.size();
184 return (*mechanicalObjectAtomDOFMap[mechObjectIndex]);
189 return (*mechanicalObjectDOFAtomMap[mechObjectIndex]);
194 return (*getMechanicalObject(mechObjectIndex)->getX());
199 return (*getMechanicalObject(mechObjectIndex)->getF());
207 #endif // SIMULATOR_SIMULATORS_SOFA_SOFASIMULATOR_H 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
std::vector< TranslationConstraint< sofa::defaulttype::Vec3Types > * > translations
the load constraints (i.e. Translation) for each mechanical Objects
Definition: SofaSimulator.h:156
sofa::defaulttype::Vec3Types::VecDeriv getMechanicalObjectDOFForce(unsigned int mechObjectIndex)
get the forces of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:198
std::string getScnFile()
Definition: SofaSimulator.h:203
void end()
end simultor
Definition: SofaSimulator.h:84
TODO Comment class here.
Definition: SofaSimulator.h:69
unsigned int getNumberOfMechanicalObjects()
get the number of mechanical objects
Definition: SofaSimulator.h:178
sofa::simulation::Node * getGNode()
get the sofa graph node root
Definition: SofaSimulator.h:163
SofaVector< BaseMechanicalState * > mechanicalObjects
the sofa graph node root
Definition: SofaSimulator.h:144
std::MechanicalObjectDOFAtomMap & getMechanicalObjectDOFAtomMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:188
std::MechanicalObjectAtomDOFMap & getMechanicalObjectAtomDOFMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:183
sofa::defaulttype::Vec3Types::VecCoord getMechanicalObjectDOFPosition(unsigned int mechObjectIndex)
get the positions of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:193
Manager of the benchmark tests.
Definition: MonitoringManager.h:50
An interactive simulator is a simulator that we can control step by step (ex: Sofa) ...
Definition: InteractiveSimulator.h:38
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
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
pair< unsigned int, unsigned int > MechanicalObjectDOFIndex
definition of a couple (=STL pair) [unsigned int mecObjectIndex, unsigned int dofIndex] ...
Definition: SofaSimulator.h:47
std::string scnFile
path to .scn file
Definition: SofaSimulator.h:159
std::AtomDOFMap atomsToDOF
create a correspondance between the atoms and the DOFs (indexAtom<->indexMechObject[indexDOF]) ...
Definition: SofaSimulator.h:147