|
Computer Assited Medical Intervention Tool Kit
version 5.0
|
|
Go to the documentation of this file.
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
207 #endif // SIMULATOR_SIMULATORS_SOFA_SOFASIMULATOR_H
pair< unsigned int, unsigned int > MechanicalObjectDOFIndex
definition of a couple (=STL pair) [unsigned int mecObjectIndex, unsigned int dofIndex]
Definition: SofaSimulator.h:47
A factory to create Simulator.
Definition: SimulatorFactory.h:40
void createPml(const char *inputFile, const char *pmlFile)
Create a pml file from an imput file.
Definition: SofaSimulator.cpp:534
bool sofaRegistered
Definition: SofaSimulator.cpp:74
void setExclusiveComponents(MultiComponent *)
set the exclusive multi component. Becareful: the physical model takes control of this MultiComponent
Definition: PhysicalModel.cpp:676
@ TETRAHEDRON
the structure is a tetrahedron, it must be a cell and have sub-structures that are atoms
Definition: StructureProperties.h:159
@ WIREFRAME_AND_SURFACE
Definition: RenderingMode.h:91
unsigned int getNumberOfStructures() const
get the number of structures
Definition: StructuralComponent.h:252
std::MechanicalObjectAtomDOFMap & getMechanicalObjectAtomDOFMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:183
StructureProperties::GeometricType getType() const
get the type of index
Definition: Structure.cpp:40
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:49
std::MechanicalObjectDOFAtomMap & getMechanicalObjectDOFAtomMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:188
unsigned int getNumberOfMechanicalObjects()
get the number of mechanical objects
Definition: SofaSimulator.h:178
sofa::defaulttype::Vec3Types::Deriv getDOFForce(unsigned int atomIndex)
Return the force std::vector corresponding to the Atom number i.
Definition: SofaSimulator.cpp:418
std::vector< TranslationConstraint< sofa::defaulttype::Vec3Types > * > translations
the load constraints (i.e. Translation) for each mechanical Objects
Definition: SofaSimulator.h:156
std::string scnFile
path to .scn file
Definition: SofaSimulator.h:159
void setDt(double dt)
change dt and save modification into mmlIn
Definition: MonitoringManager.cpp:393
sofa::defaulttype::Vec3Types::VecDeriv getMechanicalObjectDOFForce(unsigned int mechObjectIndex)
get the forces of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:198
unsigned int getNumberOfAtoms() const
get the number of atoms
Definition: PhysicalModel.cpp:716
sofa::component::container::MechanicalObject< sofa::defaulttype::Vec3Types > * getMechanicalObject(unsigned int mechObjectIndex)
get a mechanical object by its index
Definition: SofaSimulator.cpp:435
void setName(const std::string)
set the name of the physical model
Definition: PhysicalModel.h:362
Atom * getAtom(const unsigned int id)
Get the atom that has the global index given in parameters.
Definition: PhysicalModel.h:385
unsigned int getIndex() const
get the structure unique index (stored in its property)
Definition: Structure.cpp:30
#define MML_DECL_CLASS(name)
needed in files to register into factories (because of static lib and windows linking problems)
Definition: Macros.h:31
void setExclusive(const bool)
set the exclusive flag
Definition: modeling/libraries/pml/Component.h:141
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:52
void addStructure(Structure *s, bool check=true)
Add a Structure in the list (and tells the structure to add this structural component in its list).
Definition: StructuralComponent.h:212
bool isLmlPresent()
check if a lml is present
Definition: MonitoringManager.cpp:486
void getPosition(int index, double position[3])
get current position for one atom
Definition: SofaSimulator.cpp:459
void init()
initialize the simulator
Definition: SofaSimulator.cpp:486
This is the main class of this project. Following a nice concept, a physical model is able to represe...
Definition: PhysicalModel.h:86
StructuralComponent * getAtoms()
Return a StructuralComponent with all the atoms of this structural component.
Definition: StructuralComponent.cpp:261
void getForce(int index, double force[3])
get current force for one atom
Definition: SofaSimulator.cpp:472
virtual unsigned int getNumberOfCells() const =0
get the total nr of cell of the component
sofa::simulation::Node * getGNode()
get the sofa graph node root
Definition: SofaSimulator.h:163
std::AtomDOFMap atomsToDOF
create a correspondance between the atoms and the DOFs (indexAtom<->indexMechObject[indexDOF])
Definition: SofaSimulator.h:147
Loads * getLml()
Definition: MonitoringManager.cpp:274
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:46
void doMove(double dt)
ask the simulator do to one step of the simulation
Definition: SofaSimulator.cpp:440
virtual Cell * getCell(unsigned int) const =0
conveniant method to get cell by order number (not cell index)
void xmlPrint(std::ostream &o, bool opt=false)
print the physical model to an output stream in a XML format (see physicalmodel.xsd for detail about ...
Definition: PhysicalModel.cpp:258
MonitoringManager * monitoringManager
monitoring manager
Definition: Simulator.h:107
void end()
end simultor
Definition: SofaSimulator.h:84
std::vector< std::MechanicalObjectAtomDOFMap * > mechanicalObjectAtomDOFMap
list of all MechanicalObjectAtomDOFMap
Definition: SofaSimulator.h:150
std::vector< std::MechanicalObjectDOFAtomMap * > mechanicalObjectDOFAtomMap
list of all MechanicalObjectDOFAtomMap
Definition: SofaSimulator.h:153
Component * getComponentByName(const std::string n)
get a structural or multi component by its name.
Definition: PhysicalModel.cpp:553
void setMode(const RenderingMode::Mode)
set the rendering mode
Definition: StructuralComponent.cpp:134
void build()
build structure
Definition: SofaSimulator.cpp:292
SofaVector< BaseMechanicalState * > mechanicalObjects
the sofa graph node root
Definition: SofaSimulator.h:144
SofaSimulator(MonitoringManager *monitoringManager)
Definition: SofaSimulator.cpp:76
virtual ~SofaSimulator()
Definition: SofaSimulator.cpp:282
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 addSubComponent(Component *)
add a component in the list of subcomponents (and set the isExclusive flag accordingly to the state o...
Definition: MultiComponent.h:122
An interactive simulator is a simulator that we can control step by step (ex: Sofa)
Definition: InteractiveSimulator.h:38
@ HEXAHEDRON
the structure is a hexahedron, it must be a cell and have sub-structures that are atoms
Definition: StructureProperties.h:162
Manager of the benchmark tests. Do simulation loop and tests.
Definition: MonitoringManager.h:50
@ TRIANGLE
the structure is a triangle, i.e it must be a cell composed of 3 atoms
Definition: StructureProperties.h:157
sofa::defaulttype::Vec3Types::VecCoord getMechanicalObjectDOFPosition(unsigned int mechObjectIndex)
get the positions of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:193
Structure * getStructure(const unsigned int) const
get a structure by its index (fisrt structure is at index 0)
Definition: StructuralComponent.h:220
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
void buildConstraints()
translate loads into constraints
Definition: SofaSimulator.cpp:495
TODO Comment class here.
Definition: TranslationConstraint.h:48
StructuralComponent * getAtoms() const
get all the atoms
Definition: PhysicalModel.h:380
void setInitTime(double time)
set initial time (context->getTime() remind the same when simulation is rewind)
void setInformativeComponents(MultiComponent *)
set the exclusive multi component. Becareful: the physical model takes control of this MultiComponent
Definition: PhysicalModel.cpp:686
@ QUAD
the structure is a quad, i.e it must be a cell composed of 4 atoms
Definition: StructureProperties.h:158
unsigned int getNumberOfCells() const override
get the total nr of cell of the component
Definition: StructuralComponent.cpp:183
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
std::vector< unsigned int > getTargets()
return the targets list
Definition: TranslationConstraint.h:89
std::string getScnFile()
Definition: SofaSimulator.h:203
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
A multi-component stores other components, hence providing a way to have an tree representation of co...
Definition: MultiComponent.h:44
sofa::defaulttype::Vec3Types::Coord getDOFPosition(unsigned int atomIndex)
Return the Coord std::vector corresponding to the Atom number i.
Definition: SofaSimulator.cpp:408
TODO Comment class here.
Definition: SofaSimulator.h:69
void setAtoms(StructuralComponent *, bool deleteOld=true)
set the atom structural component.
Definition: PhysicalModel.cpp:572