SOFA API  82c4ea2a
Open source framework for multi-physics simuation
sofa::simulation::Simulation Class Referenceabstract

#include <Simulation.h>

Inheritance diagram for sofa::simulation::Simulation:

Detailed Description

Main controller of the scene. Defines how the scene is inited at the beginning, and updated at each time step. Derives from Base in order to use smart pointers and model the parameters as Datas, which makes their edition easy in the GUI.

Static Public Attributes

static Simulation::SPtr theSimulation { nullptr }
 

Public Member Functions

 Simulation ()
 
virtual ~Simulation ()
 
 Simulation (const Simulation &n)=delete
 
Simulationoperator= (const Simulation &n)=delete
 
virtual void print (Node *root)=delete
 Print all object in the graph. More...
 
virtual void init (Node *root)=delete
 Initialize the objects. More...
 
virtual void initNode (Node *node)=delete
 Init a node without changing the context of the simulation. More...
 
virtual void animate (Node *root, SReal dt=0.0)=delete
 Execute one timestep. If dt is 0, the dt parameter in the graph will be used. More...
 
virtual void updateVisual (Node *root)=delete
 Update the Visual Models: triggers the Mappings. More...
 
virtual void reset (Node *root)=delete
 Reset to initial state. More...
 
virtual void initTextures (Node *root)=delete
 Initialize the textures. More...
 
virtual void updateContext (Node *root)=delete
 Update contexts. Required before drawing the scene if root flags are modified. More...
 
virtual void updateVisualContext (Node *root)=delete
 Update contexts. Required before drawing the scene if root flags are modified. More...
 
virtual void computeBBox (Node *root, SReal *minBBox, SReal *maxBBox, bool init=true)=delete
 
virtual void computeTotalBBox (Node *root, SReal *minBBox, SReal *maxBBox)=delete
 
virtual void draw (sofa::core::visual::VisualParams *vparams, Node *root)=delete
 Render the scene. More...
 
virtual void exportOBJ (Node *root, const char *filename, bool exportMTL=true)=delete
 Export a scene to an OBJ 3D Scene. More...
 
virtual void exportXML (Node *root, const char *fileName=nullptr)=delete
 Print all object in the graph in XML format. More...
 
virtual void exportGraph (Node *root, const char *filename=nullptr)=delete
 Print all objects in the graph in the given file (format is given by the filename extension) More...
 
virtual void dumpState (Node *root, std::ofstream &out)=delete
 Dump the current state in the given stream. More...
 
virtual NodeSPtr load (const std::string &, bool reload=false, const std::vector< std::string > &sceneArgs=std::vector< std::string >(0))=delete
 Load a scene from a file. More...
 
virtual void unload (NodeSPtr root)=delete
 Unload a scene from a Node. More...
 
virtual NodeSPtr createNewGraph (const std::string &name)=0
 create a new graph(or tree) and return its root node. More...
 
virtual NodeSPtr createNewNode (const std::string &name)=0
 creates and returns a new node. More...
 
virtual bool isDirectedAcyclicGraph ()=0
 Can the simulation handle a directed acyclic graph? More...
 

Attribute details

◆ theSimulation

Simulation::SPtr sofa::simulation::Simulation::theSimulation { nullptr }
inlinestatic

Constructor details

◆ Simulation() [1/2]

sofa::simulation::Simulation::Simulation ( )

◆ ~Simulation()

sofa::simulation::Simulation::~Simulation ( )
virtual

◆ Simulation() [2/2]

sofa::simulation::Simulation::Simulation ( const Simulation n)
delete

Function details

◆ animate()

virtual void sofa::simulation::Simulation::animate ( Node root,
SReal  dt = 0.0 
)
virtualdelete

Execute one timestep. If dt is 0, the dt parameter in the graph will be used.

◆ computeBBox()

virtual void sofa::simulation::Simulation::computeBBox ( Node root,
SReal minBBox,
SReal maxBBox,
bool  init = true 
)
virtualdelete

Compute the bounding box of the scene. If init is set to "true", then minBBox and maxBBox will be initialised to a default value

Warning
MechanicalObjects with showObject member set to false are ignored
See also
computeTotalBBox(Node* root, SReal* minBBox, SReal* maxBBox)

◆ computeTotalBBox()

virtual void sofa::simulation::Simulation::computeTotalBBox ( Node root,
SReal minBBox,
SReal maxBBox 
)
virtualdelete

Compute the bounding box of the scene. Includes all objects, may they be displayed or not.

See also
computeBBox(Node* root, SReal* minBBox, SReal* maxBBox, bool init=true)

◆ createNewGraph()

virtual NodeSPtr sofa::simulation::Simulation::createNewGraph ( const std::string &  name)
pure virtual

create a new graph(or tree) and return its root node.

Implemented in sofa::simulation::graph::DAGSimulation.

◆ createNewNode()

virtual NodeSPtr sofa::simulation::Simulation::createNewNode ( const std::string &  name)
pure virtual

creates and returns a new node.

Implemented in sofa::simulation::graph::DAGSimulation.

◆ draw()

virtual void sofa::simulation::Simulation::draw ( sofa::core::visual::VisualParams vparams,
Node root 
)
virtualdelete

Render the scene.

◆ dumpState()

virtual void sofa::simulation::Simulation::dumpState ( Node root,
std::ofstream &  out 
)
virtualdelete

Dump the current state in the given stream.

◆ exportGraph()

virtual void sofa::simulation::Simulation::exportGraph ( Node root,
const char filename = nullptr 
)
virtualdelete

Print all objects in the graph in the given file (format is given by the filename extension)

◆ exportOBJ()

virtual void sofa::simulation::Simulation::exportOBJ ( Node root,
const char filename,
bool  exportMTL = true 
)
virtualdelete

Export a scene to an OBJ 3D Scene.

◆ exportXML()

virtual void sofa::simulation::Simulation::exportXML ( Node root,
const char fileName = nullptr 
)
virtualdelete

Print all object in the graph in XML format.

◆ init()

virtual void sofa::simulation::Simulation::init ( Node root)
virtualdelete

Initialize the objects.

◆ initNode()

virtual void sofa::simulation::Simulation::initNode ( Node node)
virtualdelete

Init a node without changing the context of the simulation.

◆ initTextures()

virtual void sofa::simulation::Simulation::initTextures ( Node root)
virtualdelete

Initialize the textures.

◆ isDirectedAcyclicGraph()

virtual bool sofa::simulation::Simulation::isDirectedAcyclicGraph ( )
pure virtual

Can the simulation handle a directed acyclic graph?

Implemented in sofa::simulation::graph::DAGSimulation.

◆ load()

virtual NodeSPtr sofa::simulation::Simulation::load ( const std::string &  ,
bool  reload = false,
const std::vector< std::string > &  sceneArgs = std::vector< std::string >(0) 
)
virtualdelete

Load a scene from a file.

◆ operator=()

Simulation& sofa::simulation::Simulation::operator= ( const Simulation n)
delete

◆ print()

virtual void sofa::simulation::Simulation::print ( Node root)
virtualdelete

Print all object in the graph.

◆ reset()

virtual void sofa::simulation::Simulation::reset ( Node root)
virtualdelete

Reset to initial state.

◆ unload()

virtual void sofa::simulation::Simulation::unload ( NodeSPtr  root)
virtualdelete

Unload a scene from a Node.

◆ updateContext()

virtual void sofa::simulation::Simulation::updateContext ( Node root)
virtualdelete

Update contexts. Required before drawing the scene if root flags are modified.

◆ updateVisual()

virtual void sofa::simulation::Simulation::updateVisual ( Node root)
virtualdelete

Update the Visual Models: triggers the Mappings.

◆ updateVisualContext()

virtual void sofa::simulation::Simulation::updateVisualContext ( Node root)
virtualdelete

Update contexts. Required before drawing the scene if root flags are modified.