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/tree/GNode.h>
38 #define SofaVector sofa::helper::vector
46 typedef pair<unsigned int, unsigned int> MechanicalObjectDOFIndex;
50 typedef map <unsigned int, MechanicalObjectDOFIndex> AtomDOFMap;
54 typedef map<unsigned int, unsigned int> MechanicalObjectAtomDOFMap;
58 typedef map<unsigned int, unsigned int> MechanicalObjectDOFAtomMap;
82 void getForce(
int index,
double force[3]);
104 sofa::defaulttype::Vec3Types::Coord
getDOFPosition(
unsigned int mechObjectIndex,
unsigned int dofIndex);
110 sofa::defaulttype::Vec3Types::Deriv
getDOFForce(
unsigned int mechObjectIndex,
unsigned int dofIndex);
113 unsigned int getAtomIndex(
unsigned int mechObjectIndex,
unsigned int dofIndex);
116 sofa::component::container::MechanicalObject<sofa::defaulttype::Vec3Types> *
getMechanicalObject(
unsigned int mechObjectIndex);
134 #if defined(SOFA_1_0_RC1) || defined(SOFA_SVN)
135 sofa::simulation::Node::SPtr groot;
138 #ifdef MML_SOFA_1_0_BETA4
139 sofa::simulation::Node* groot;
155 std::vector<TranslationConstraint<sofa::defaulttype::Vec3Types> *>
translations;
167 #if defined(SOFA_1_0_RC1) || defined(SOFA_SVN)
171 #ifdef MML_SOFA_1_0_BETA4
206 #endif // SIMULATOR_SIMULATORS_SOFA_SOFASIMULATOR_H
MonitoringManager * monitoringManager
monitoring manager
Definition: Simulator.h:84
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:391
std::vector< std::MechanicalObjectDOFAtomMap * > mechanicalObjectDOFAtomMap
list of all MechanicalObjectDOFAtomMap
Definition: SofaSimulator.h:152
std::vector< std::MechanicalObjectAtomDOFMap * > mechanicalObjectAtomDOFMap
list of all MechanicalObjectAtomDOFMap
Definition: SofaSimulator.h:149
std::vector< TranslationConstraint< sofa::defaulttype::Vec3Types > * > translations
the load constraints (i.e. Translation) for each mechanical Objects
Definition: SofaSimulator.h:155
sofa::defaulttype::Vec3Types::VecDeriv getMechanicalObjectDOFForce(unsigned int mechObjectIndex)
get the forces of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:197
void createPml(const char *inputFile, const char *pmlFile)
Create a pml file from an imput file.
Definition: SofaSimulator.cpp:489
std::string getScnFile()
Definition: SofaSimulator.h:202
SofaSimulator(MonitoringManager *monitoringManager)
Definition: SofaSimulator.cpp:75
void end()
end simultor
Definition: SofaSimulator.h:83
TODO Comment class here.
Definition: SofaSimulator.h:68
void buildConstraints()
translate loads into constraints
Definition: SofaSimulator.cpp:452
unsigned int getNumberOfMechanicalObjects()
get the number of mechanical objects
Definition: SofaSimulator.h:177
sofa::simulation::Node * getGNode()
get the sofa graph node root
Definition: SofaSimulator.h:162
SofaVector< BaseMechanicalState * > mechanicalObjects
the sofa graph node root
Definition: SofaSimulator.h:143
virtual ~SofaSimulator()
Definition: SofaSimulator.cpp:290
std::MechanicalObjectDOFAtomMap & getMechanicalObjectDOFAtomMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:187
std::MechanicalObjectAtomDOFMap & getMechanicalObjectAtomDOFMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:182
void getPosition(int index, double position[3])
get current position for one atom
Definition: SofaSimulator.cpp:417
sofa::defaulttype::Vec3Types::VecCoord getMechanicalObjectDOFPosition(unsigned int mechObjectIndex)
get the positions of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:192
Manager of the benchmark tests.
Definition: MonitoringManager.h:50
void init()
initialize the simulator
Definition: SofaSimulator.cpp:444
sofa::component::container::MechanicalObject< sofa::defaulttype::Vec3Types > * getMechanicalObject(unsigned int mechObjectIndex)
get a mechanical object by its index
Definition: SofaSimulator.cpp:398
void doMove(double dt)
ask the simulator do to one step of the simulation
Definition: SofaSimulator.cpp:403
sofa::defaulttype::Vec3Types::Deriv getDOFForce(unsigned int atomIndex)
Return the force std::vector corresponding to the Atom number i.
Definition: SofaSimulator.cpp:381
unsigned int atomIndex
Definition: gensphere.cpp:41
sofa::defaulttype::Vec3Types::Coord getDOFPosition(unsigned int atomIndex)
Return the Coord std::vector corresponding to the Atom number i.
Definition: SofaSimulator.cpp:371
void build()
build structure
Definition: SofaSimulator.cpp:299
An interactive simulator is a simulator that we can control step by step (ex: Sofa) ...
Definition: InteractiveSimulator.h:38
string pmlFile
Definition: pml2ansys.cpp:36
std::string scnFile
path to .scn file
Definition: SofaSimulator.h:158
std::AtomDOFMap atomsToDOF
create a correspondance between the atoms and the DOFs (indexAtom<->indexMechObject[indexDOF]) ...
Definition: SofaSimulator.h:146
void getForce(int index, double force[3])
get current force for one atom
Definition: SofaSimulator.cpp:430