#include <Simulation.h>


Public Member Functions | |
| Simulation () | |
| virtual | ~Simulation () |
| virtual void | print (Node *root) |
| Print all object in the graph. | |
| virtual void | printXML (Node *root, const char *fileName=0) |
| Print all object in the graph in XML format. | |
| virtual void | init (Node *root) |
| Initialize the objects. | |
| void | getInstruments (Node *node) |
| Find the list of nodes called "Instrument" and keep it in the vector instuments. | |
| virtual void | animate (Node *root, double dt=0.0) |
| Execute one timestep. If dt is 0, the dt parameter in the graph will be used. | |
| virtual void | reset (Node *root) |
| Reset to initial state. | |
| virtual void | initTextures (Node *root) |
| Initialize the textures. | |
| virtual void | updateContext (Node *root) |
| Update contexts. Required before drawing the scene if root flags are modified. | |
| virtual void | updateVisualContext (Node *root, int FILTER=10) |
| Update contexts. Required before drawing the scene if root flags are modified. | |
| virtual void | computeBBox (Node *root, SReal *minBBox, SReal *maxBBox) |
| Compute the bounding box of the scene. | |
| virtual void | draw (Node *root) |
| Render the scene. | |
| virtual void | drawShadows (Node *root) |
| Render the scene - Shadows pass. | |
| virtual void | unload (GNode *root) |
| Delete a scene from memory. After this call the pointer is invalid. | |
| virtual void | exportOBJ (Node *root, const char *filename, bool exportMTL=true) |
| Export a scene to an OBJ 3D Scene. | |
| virtual void | exportXML (Node *root, const char *filename) |
| Export a scene to XML. | |
| virtual void | dumpState (Node *root, std::ofstream &out) |
| Dump the current state in the given stream. | |
| virtual void | initGnuplot (Node *root) |
| Initialize gnuplot export (open files). | |
| virtual void | exportGnuplot (Node *root, double time) |
| Dump the current state in gnuplot files. | |
Static Public Member Functions | |
| static GNode * | load (const char *filename) |
| Load a scene from a file. | |
Data Fields | |
| Data< unsigned > | numMechSteps |
| Number of mechanical steps within an animation step. | |
| Data< std::string > | gnuplotDirectory |
| helper::vector< Node * > | instruments |
| Data< int > | instrumentInUse |
Static Private Member Functions | |
| static GNode * | loadFromMemory (const char *filename, const char *data, unsigned int size) |
| load a scene from memory (typically : an xml into a string) | |
| static GNode * | loadFromFile (const char *filename) |
| load a scene from a file | |
| static GNode * | processXML (xml::BaseElement *xml, const char *filename) |
| generic function to process xml tree (after loading the xml structure from the 2 previous functions) | |
Defines how the scene is inited at the beginning, and updated at each time step. Derives from BaseObject in order to model the parameters as Datas, which makes their edition easy in the GUI.
Definition at line 47 of file Simulation.h.
| sofa::simulation::tree::Simulation::Simulation | ( | ) |
Definition at line 215 of file Simulation.cpp.
| sofa::simulation::tree::Simulation::~Simulation | ( | ) | [virtual] |
| void sofa::simulation::tree::Simulation::animate | ( | Node * | root, | |
| double | dt = 0.0 | |||
| ) | [virtual] |
Execute one timestep. If dt is 0, the dt parameter in the graph will be used.
Definition at line 274 of file Simulation.cpp.
References sofa::simulation::Node::execute(), sofa::simulation::AnimateVisitor::getDt(), sofa::core::objectmodel::Context::getDt(), sofa::core::objectmodel::Context::getMultiThreadSimulation(), sofa::core::objectmodel::Context::getTime(), sofa::core::objectmodel::Data< T >::getValue(), numMechSteps, sofa::simulation::AnimateVisitor::setDt(), and sofa::core::objectmodel::Context::setTime().
Referenced by main(), sofa::gui::qt::RealGUI::step(), and sofa::gui::glut::SimpleGUI::step().
| void sofa::simulation::tree::Simulation::computeBBox | ( | Node * | root, | |
| SReal * | minBBox, | |||
| SReal * | maxBBox | |||
| ) | [virtual] |
Compute the bounding box of the scene.
Definition at line 343 of file Simulation.cpp.
References sofa::simulation::Node::execute(), sofa::simulation::VisualComputeBBoxVisitor::maxBBox, and sofa::simulation::VisualComputeBBoxVisitor::minBBox.
Referenced by sofa::gui::qt::viewer::qt::QtViewer::calcProjection(), sofa::gui::glut::SimpleGUI::calcProjection(), sofa::gui::qt::viewer::qt::QtViewer::setScene(), sofa::gui::qt::viewer::qtogre::QtOgreViewer::showEntireScene(), and sofa::gui::qt::viewer::qgl::QtGLViewer::viewAll().
| void sofa::simulation::tree::Simulation::draw | ( | Node * | root | ) | [virtual] |
Render the scene.
Definition at line 371 of file Simulation.cpp.
References sofa::simulation::Node::execute(), sofa::core::VisualModel::Std, and sofa::core::VisualModel::Transparent.
Referenced by sofa::gui::qt::viewer::qt::QtViewer::DisplayOBJs(), sofa::gui::qt::viewer::qgl::QtGLViewer::DisplayOBJs(), and sofa::gui::glut::SimpleGUI::DisplayOBJs().
| void sofa::simulation::tree::Simulation::drawShadows | ( | Node * | root | ) | [virtual] |
Render the scene - Shadows pass.
Render the scene - shadow pass.
Definition at line 382 of file Simulation.cpp.
References sofa::simulation::Node::execute(), and sofa::core::VisualModel::Shadow.
Referenced by sofa::gui::qt::viewer::qt::QtViewer::DisplayOBJs(), sofa::gui::qt::viewer::qgl::QtGLViewer::DisplayOBJs(), and sofa::gui::glut::SimpleGUI::DisplayOBJs().
| void sofa::simulation::tree::Simulation::dumpState | ( | Node * | root, | |
| std::ofstream & | out | |||
| ) | [virtual] |
Dump the current state in the given stream.
Definition at line 447 of file Simulation.cpp.
References sofa::core::objectmodel::Context::getTime().
Referenced by sofa::gui::qt::RealGUI::loadSimulation(), sofa::gui::qt::RealGUI::step(), and sofa::gui::glut::SimpleGUI::step().
| void sofa::simulation::tree::Simulation::exportGnuplot | ( | Node * | root, | |
| double | time | |||
| ) | [virtual] |
Dump the current state in gnuplot files.
Update gnuplot file output.
Definition at line 463 of file Simulation.cpp.
References sofa::simulation::Node::execute().
Referenced by sofa::gui::qt::RealGUI::loadSimulation(), sofa::gui::qt::RealGUI::setExportGnuplot(), sofa::gui::glut::SimpleGUI::setExportGnuplot(), sofa::gui::qt::RealGUI::step(), and sofa::gui::glut::SimpleGUI::step().
| void sofa::simulation::tree::Simulation::exportOBJ | ( | Node * | root, | |
| const char * | filename, | |||
| bool | exportMTL = true | |||
| ) | [virtual] |
Export a scene to an OBJ 3D Scene.
Definition at line 404 of file Simulation.cpp.
References sofa::simulation::Node::execute().
Referenced by sofa::gui::qt::RealGUI::exportOBJ(), sofa::gui::glut::SimpleGUI::exportOBJ(), and main().
| void sofa::simulation::tree::Simulation::exportXML | ( | Node * | root, | |
| const char * | filename | |||
| ) | [virtual] |
Export a scene to XML.
Definition at line 439 of file Simulation.cpp.
References sofa::simulation::Node::execute().
Referenced by main().
| void sofa::simulation::tree::Simulation::getInstruments | ( | Node * | node | ) |
Find the list of nodes called "Instrument" and keep it in the vector instuments.
Definition at line 265 of file Simulation.cpp.
References sofa::simulation::Visitor::execute(), sofa::simulation::Node::execute(), sofa::simulation::InstrumentVisitor::getInstruments(), and instruments.
Referenced by init().
| void sofa::simulation::tree::Simulation::init | ( | Node * | root | ) | [virtual] |
Initialize the objects.
Initialize the scene.
Definition at line 250 of file Simulation.cpp.
References sofa::simulation::Node::execute(), sofa::simulation::Node::getContext(), getInstruments(), and sofa::core::objectmodel::BaseObject::setContext().
Referenced by sofa::filemanager::pml::PMLReader::BuildStructure(), main(), and processXML().
| void sofa::simulation::tree::Simulation::initGnuplot | ( | Node * | root | ) | [virtual] |
Initialize gnuplot export (open files).
Initialize gnuplot file output.
Definition at line 455 of file Simulation.cpp.
References sofa::simulation::Node::execute(), sofa::core::objectmodel::Data< T >::getValue(), and gnuplotDirectory.
Referenced by sofa::gui::qt::RealGUI::setExportGnuplot(), and sofa::gui::glut::SimpleGUI::setExportGnuplot().
| void sofa::simulation::tree::Simulation::initTextures | ( | Node * | root | ) | [virtual] |
Initialize the textures.
Definition at line 332 of file Simulation.cpp.
References sofa::simulation::Node::execute().
Referenced by sofa::gui::qt::viewer::qt::QtViewer::DisplayOBJs(), sofa::gui::qt::viewer::qgl::QtGLViewer::DisplayOBJs(), and sofa::gui::glut::SimpleGUI::DisplayOBJs().
| GNode * sofa::simulation::tree::Simulation::load | ( | const char * | filename | ) | [static] |
Load a scene from a file.
Load a scene.
Static method because at this point, the Simulation component is not yet created. If a Simulation component is found in the graph, then it is used. Otherwise, a default Simulation will be created at the first call to method getSimulation() This file can be a xml file or a script file which will generate a xml tree.
Definition at line 165 of file Simulation.cpp.
References error, sofa::helper::system::PipeProcess::executeProcess(), sofa::helper::system::FileRepository::findFile(), sofa::helper::system::SetDirectory::GetExtension(), loadFromFile(), and loadFromMemory().
Referenced by sofa::gui::qt::RealGUI::fileOpen(), sofa::gui::glut::SimpleGUI::keyPressEvent(), and main().
| GNode * sofa::simulation::tree::Simulation::loadFromFile | ( | const char * | filename | ) | [static, private] |
load a scene from a file
Load a scene from a file.
Definition at line 150 of file Simulation.cpp.
References processXML().
Referenced by load().
| GNode * sofa::simulation::tree::Simulation::loadFromMemory | ( | const char * | filename, | |
| const char * | data, | |||
| unsigned int | size | |||
| ) | [static, private] |
load a scene from memory (typically : an xml into a string)
Load from a string in memory.
Definition at line 134 of file Simulation.cpp.
References processXML().
Referenced by load().
| void sofa::simulation::tree::Simulation::print | ( | Node * | root | ) | [virtual] |
Print all object in the graph.
Definition at line 226 of file Simulation.cpp.
References sofa::simulation::Node::execute().
Referenced by printXML().
| void sofa::simulation::tree::Simulation::printXML | ( | Node * | root, | |
| const char * | fileName = 0 | |||
| ) | [virtual] |
Print all object in the graph in XML format.
Print all object in the graph.
Definition at line 233 of file Simulation.cpp.
References sofa::simulation::Node::execute(), and print().
Referenced by sofa::gui::qt::SofaModeler::fileSave(), sofa::gui::qt::RealGUI::fileSaveAs(), sofa::gui::qt::SofaModeler::runInSofa(), sofa::gui::qt::GraphModeler::saveNode(), and sofa::gui::qt::RealGUI::saveXML().
| GNode * sofa::simulation::tree::Simulation::processXML | ( | xml::BaseElement * | xml, | |
| const char * | filename | |||
| ) | [static, private] |
generic function to process xml tree (after loading the xml structure from the 2 previous functions)
Load a scene from a file.
Definition at line 85 of file Simulation.cpp.
References sofa::simulation::Visitor::execute(), sofa::simulation::FindByTypeVisitor< T >::found, sofa::core::objectmodel::BaseObjectDescription::getObject(), sofa::simulation::tree::getSimulation(), init(), sofa::simulation::tree::xml::BaseElement::init(), and sofa::simulation::tree::setSimulation().
Referenced by loadFromFile(), and loadFromMemory().
| void sofa::simulation::tree::Simulation::reset | ( | Node * | root | ) | [virtual] |
Reset to initial state.
Definition at line 321 of file Simulation.cpp.
References sofa::simulation::Node::execute().
Referenced by sofa::gui::qt::RealGUI::resetScene(), and sofa::gui::glut::SimpleGUI::resetScene().
| void sofa::simulation::tree::Simulation::unload | ( | GNode * | root | ) | [virtual] |
Delete a scene from memory. After this call the pointer is invalid.
Definition at line 391 of file Simulation.cpp.
References sofa::simulation::Node::execute(), sofa::simulation::tree::GNode::getParent(), instrumentInUse, instruments, sofa::core::objectmodel::BaseNode::removeChild(), and sofa::core::objectmodel::Data< T >::setValue().
Referenced by sofa::component::collision::SubsetContactMapper< TCollisionModel, DataTypes >::cleanup(), sofa::component::collision::RigidContactMapper< TCollisionModel, DataTypes >::cleanup(), sofa::gui::qt::GraphModeler::deleteComponent(), sofa::gui::qt::RealGUI::fileOpen(), main(), sofa::gui::qt::RealGUI::setViewer(), and sofa::gui::qt::GraphModeler::~GraphModeler().
| void sofa::simulation::tree::Simulation::updateContext | ( | Node * | root | ) | [virtual] |
Update contexts. Required before drawing the scene if root flags are modified.
Definition at line 357 of file Simulation.cpp.
References sofa::simulation::Node::execute().
| void sofa::simulation::tree::Simulation::updateVisualContext | ( | Node * | root, | |
| int | FILTER = 10 | |||
| ) | [virtual] |
Update contexts. Required before drawing the scene if root flags are modified.
Update only Visual contexts. Required before drawing the scene if root flags are modified.( can filter by specifying a specific element).
Definition at line 364 of file Simulation.cpp.
References sofa::simulation::Visitor::execute().
Referenced by sofa::gui::glut::SimpleGUI::showBehavior(), sofa::gui::glut::SimpleGUI::showBoundingCollision(), sofa::gui::glut::SimpleGUI::showCollision(), sofa::gui::glut::SimpleGUI::showForceField(), sofa::gui::qt::RealGUI::showhideElements(), sofa::gui::glut::SimpleGUI::showInteractionForceField(), sofa::gui::glut::SimpleGUI::showMapping(), sofa::gui::glut::SimpleGUI::showMechanicalMapping(), sofa::gui::glut::SimpleGUI::showNormals(), sofa::gui::glut::SimpleGUI::showVisual(), and sofa::gui::glut::SimpleGUI::showWireFrame().
| Data<std::string> sofa::simulation::tree::Simulation::gnuplotDirectory |
Definition at line 123 of file Simulation.h.
Referenced by sofa::gui::qt::RealGUI::editGnuplotDirectory(), sofa::gui::qt::RealGUI::fileOpen(), and initGnuplot().
Definition at line 126 of file Simulation.h.
Referenced by sofa::gui::qt::RealGUI::changeInstrument(), sofa::gui::qt::viewer::SofaViewer::moveLaparoscopic(), and unload().
Definition at line 125 of file Simulation.h.
Referenced by sofa::gui::qt::RealGUI::changeInstrument(), sofa::gui::qt::RealGUI::clearGraph(), getInstruments(), sofa::gui::qt::viewer::SofaViewer::moveLaparoscopic(), and unload().
Number of mechanical steps within an animation step.
Definition at line 122 of file Simulation.h.
Referenced by animate().
1.5.7.1