18 #include <sofa/simulation/graph/DAGSimulation.h>
23 const std::string key =
"MultiMappingObject";
25 if (sofa::simulation::xml::BaseElement::NodeFactory::HasKey(key))
26 sofa::simulation::xml::BaseElement::NodeFactory::ResetEntry(key);
28 return sofa::core::objectmodel::New<sofa::simulation::graph::DAGSimulation>();
31 mitk::Simulation::Simulation()
36 mitk::Simulation::~Simulation()
41 m_SOFASimulation->unload(m_RootNode);
47 if (!m_RootNode || !m_SOFASimulation)
50 boost::chrono::high_resolution_clock::time_point t0 = boost::chrono::high_resolution_clock::now();
51 m_SOFASimulation->animate(m_RootNode.get(), m_RootNode->getDt());
52 this->SetElapsedTime(boost::chrono::high_resolution_clock::now() - t0);
54 this->UpdateOutputInformation();
69 return m_SOFASimulation;
74 if (!m_RootNode || !m_SOFASimulation)
77 m_SOFASimulation->reset(m_RootNode.get());
78 m_RootNode->setTime(0.0);
79 m_SOFASimulation->updateContext(m_RootNode.get());
85 ? m_RootNode->getContext()->getAnimate()
92 m_RootNode->getContext()->setAnimate(animate);
98 m_RootNode->setDt(dt);
103 m_RootNode = rootNode;
122 using sofa::defaulttype::Vector3;
124 if (this->GetSource().IsNotNull())
125 this->GetSource()->UpdateOutputInformation();
129 const BoundingBox& boundingBox = m_RootNode->f_bbox.getValue();
132 if (boundingBox.isValid())
134 const Vector3&
min = boundingBox.minBBox();
135 const Vector3&
max = boundingBox.maxBBox();
151 if (geometry.IsNull())
154 geometry->SetBounds(bounds);
155 this->SetGeometry(geometry);
159 geometry->SetBounds(bounds);
163 this->GetTimeGeometry()->Update();
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
BoundingBoxType::BoundsArrayType BoundsArrayType
void SetRequestedRegionToLargestPossibleRegion() override
Set the RequestedRegion to the LargestPossibleRegion.
bool GetAnimationFlag() const
void UpdateOutputInformation() override
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Determine whether the RequestedRegion is outside of the BufferedRegion.
bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.
void SetRootNode(sofa::simulation::Node::SPtr rootNode)
ValueType
Type of the value held by a Value object.
sofa::simulation::Node::SPtr GetRootNode() const
sofa::simulation::Simulation::SPtr GetSOFASimulation() const
itk::BoundingBox< unsigned long, 3, mitk::ScalarType > BoundingBox
void SetAnimationFlag(bool animate)
static sofa::simulation::Simulation::SPtr CreateSimulation()
void SetRequestedRegion(const itk::DataObject *) override
Set the requested region from this data object to match the requested region of the data object passe...
sofa::core::visual::DrawTool * GetDrawTool()