 |
Computer Assited Medical Intervention Tool Kit
version 4.1
|
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
47 typedef pair<unsigned int, unsigned int> MechanicalObjectDOFIndex;
51 typedef map <unsigned int, MechanicalObjectDOFIndex> AtomDOFMap;
55 typedef map<unsigned int, unsigned int> MechanicalObjectAtomDOFMap;
59 typedef map<unsigned int, unsigned int> MechanicalObjectDOFAtomMap;
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;
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:46
A factory to create Simulator.
Definition: SimulatorFactory.h:39
void createPml(const char *inputFile, const char *pmlFile)
Create a pml file from an imput file.
Definition: SofaSimulator.cpp:536
bool sofaRegistered
Definition: SofaSimulator.cpp:74
the structure is a tetrahedron, it must be a cell and have sub-structures that are atoms
Definition: StructureProperties.h:156
Definition: RenderingMode.h:88
unsigned int getNumberOfStructures() const
get the number of structures
Definition: StructuralComponent.h:251
std::MechanicalObjectAtomDOFMap & getMechanicalObjectAtomDOFMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:182
StructureProperties::GeometricType getType() const
get the type of index
Definition: Structure.cpp:39
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:48
std::MechanicalObjectDOFAtomMap & getMechanicalObjectDOFAtomMap(unsigned int mechObjectIndex)
get the MechanicalObjectAtomDOFMap for a given mechancial object
Definition: SofaSimulator.h:187
unsigned int getNumberOfMechanicalObjects()
get the number of mechanical objects
Definition: SofaSimulator.h:177
sofa::defaulttype::Vec3Types::Deriv getDOFForce(unsigned int atomIndex)
Return the force std::vector corresponding to the Atom number i.
Definition: SofaSimulator.cpp:420
std::vector< TranslationConstraint< sofa::defaulttype::Vec3Types > * > translations
the load constraints (i.e. Translation) for each mechanical Objects
Definition: SofaSimulator.h:155
std::string scnFile
path to .scn file
Definition: SofaSimulator.h:158
void setDt(double dt)
change dt and save modification into mmlIn
Definition: MonitoringManager.cpp:392
sofa::defaulttype::Vec3Types::VecDeriv getMechanicalObjectDOFForce(unsigned int mechObjectIndex)
get the forces of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:197
unsigned int getNumberOfAtoms() const
get the number of atoms
Definition: PhysicalModel.cpp:715
sofa::component::container::MechanicalObject< sofa::defaulttype::Vec3Types > * getMechanicalObject(unsigned int mechObjectIndex)
get a mechanical object by its index
Definition: SofaSimulator.cpp:437
unsigned int getIndex() const
get the structure unique index (stored in its property)
Definition: Structure.cpp:29
#define MML_DECL_CLASS(name)
needed in files to register into factories (because of static lib and windows linking problems)
Definition: Macros.h:30
void setExclusive(const bool)
set the exclusive flag
Definition: modeling/libraries/pml/Component.h:140
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:51
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:211
bool isLmlPresent()
check if a lml is present
Definition: MonitoringManager.cpp:485
void getPosition(int index, double position[3])
get current position for one atom
Definition: SofaSimulator.cpp:461
void init()
initialize the simulator
Definition: SofaSimulator.cpp:488
This is the main class of this project. Following a nice concept, a physical model is able to represe...
Definition: PhysicalModel.h:85
StructuralComponent * getAtoms()
Return a StructuralComponent with all the atoms of this structural component.
Definition: StructuralComponent.cpp:260
void getForce(int index, double force[3])
get current force for one atom
Definition: SofaSimulator.cpp:474
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:162
std::AtomDOFMap atomsToDOF
create a correspondance between the atoms and the DOFs (indexAtom<->indexMechObject[indexDOF])
Definition: SofaSimulator.h:146
Loads * getLml()
Definition: MonitoringManager.cpp:273
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:45
void doMove(double dt)
ask the simulator do to one step of the simulation
Definition: SofaSimulator.cpp:442
virtual Cell * getCell(unsigned int) const =0
conveniant method to get cell by order number (not cell index)
MonitoringManager * monitoringManager
monitoring manager
Definition: Simulator.h:105
void end()
end simultor
Definition: SofaSimulator.h:83
std::vector< std::MechanicalObjectAtomDOFMap * > mechanicalObjectAtomDOFMap
list of all MechanicalObjectAtomDOFMap
Definition: SofaSimulator.h:149
std::vector< std::MechanicalObjectDOFAtomMap * > mechanicalObjectDOFAtomMap
list of all MechanicalObjectDOFAtomMap
Definition: SofaSimulator.h:152
Component * getComponentByName(const std::string n)
get a structural or multi component by its name.
Definition: PhysicalModel.cpp:552
void setMode(const RenderingMode::Mode)
set the rendering mode
Definition: StructuralComponent.cpp:133
void build()
build structure
Definition: SofaSimulator.cpp:294
SofaVector< BaseMechanicalState * > mechanicalObjects
the sofa graph node root
Definition: SofaSimulator.h:143
SofaSimulator(MonitoringManager *monitoringManager)
Definition: SofaSimulator.cpp:76
virtual ~SofaSimulator()
Definition: SofaSimulator.cpp:284
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:430
void addSubComponent(Component *)
add a component in the list of subcomponents (and set the isExclusive flag accordingly to the state o...
Definition: MultiComponent.h:121
An interactive simulator is a simulator that we can control step by step (ex: Sofa)
Definition: InteractiveSimulator.h:37
the structure is a hexahedron, it must be a cell and have sub-structures that are atoms
Definition: StructureProperties.h:159
Manager of the benchmark tests. Do simulation loop and tests.
Definition: MonitoringManager.h:49
the structure is a triangle, i.e it must be a cell composed of 3 atoms
Definition: StructureProperties.h:154
sofa::defaulttype::Vec3Types::VecCoord getMechanicalObjectDOFPosition(unsigned int mechObjectIndex)
get the positions of all DOF for mechanical object mechObjectIndex
Definition: SofaSimulator.h:192
Structure * getStructure(const unsigned int) const
get a structure by its index (fisrt structure is at index 0)
Definition: StructuralComponent.h:219
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:47
void buildConstraints()
translate loads into constraints
Definition: SofaSimulator.cpp:497
TODO Comment class here.
Definition: TranslationConstraint.h:47
StructuralComponent * getAtoms() const
get all the atoms
Definition: PhysicalModel.h:379
void setInitTime(double time)
set initial time (context->getTime() remind the same when simulation is rewind)
the structure is a quad, i.e it must be a cell composed of 4 atoms
Definition: StructureProperties.h:155
unsigned int getNumberOfCells() const override
get the total nr of cell of the component
Definition: StructuralComponent.cpp:182
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:58
map< unsigned int, MechanicalObjectDOFIndex > AtomDOFMap
definition of the association set (=map in STL) AtomDOFMap AtomDOFMap associates an atom index with t...
Definition: SofaSimulator.h:50
std::vector< unsigned int > getTargets()
return the targets list
Definition: TranslationConstraint.h:87
std::string getScnFile()
Definition: SofaSimulator.h:202
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:54
A multi-component stores other components, hence providing a way to have an tree representation of co...
Definition: MultiComponent.h:43
sofa::defaulttype::Vec3Types::Coord getDOFPosition(unsigned int atomIndex)
Return the Coord std::vector corresponding to the Atom number i.
Definition: SofaSimulator.cpp:410
TODO Comment class here.
Definition: SofaSimulator.h:68