From 033b76baa40478667d25858bb3a55a09971aa662 Mon Sep 17 00:00:00 2001
From: Sreekanth Arikatla <sreekanth.arikatla@kitware.com>
Date: Tue, 1 Aug 2017 17:58:56 -0400
Subject: [PATCH] ENH: Add scene object initialization at the start of the
 simulation

---
 Base/Scene/imstkScene.cpp                         | 1 -
 Base/SimulationManager/imstkSimulationManager.cpp | 3 ++-
 Examples/Sandbox/main.cpp                         | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Base/Scene/imstkScene.cpp b/Base/Scene/imstkScene.cpp
index 2a3377ef7..fb798927d 100644
--- a/Base/Scene/imstkScene.cpp
+++ b/Base/Scene/imstkScene.cpp
@@ -27,7 +27,6 @@
 
 namespace imstk
 {
-
 bool
 Scene::initialize()
 {
diff --git a/Base/SimulationManager/imstkSimulationManager.cpp b/Base/SimulationManager/imstkSimulationManager.cpp
index bd8715192..1eb11613c 100644
--- a/Base/SimulationManager/imstkSimulationManager.cpp
+++ b/Base/SimulationManager/imstkSimulationManager.cpp
@@ -194,7 +194,7 @@ SimulationManager::setCurrentScene(std::string newSceneName, bool unloadCurrentS
         return;
     }
 
-    std::shared_ptr<Scene> newScene = this->getScene(newSceneName);
+    auto newScene = this->getScene(newSceneName);
     if (!newScene)
     {
         LOG(WARNING) << "Can not find scene";
@@ -253,6 +253,7 @@ SimulationManager::setCurrentScene(std::string newSceneName, bool unloadCurrentS
 void
 SimulationManager::startSimulation(bool debug)
 {
+    this->getCurrentScene()->initialize();
     if (m_status != SimulationStatus::INACTIVE)
     {
         LOG(WARNING) << "Simulation already active";
diff --git a/Examples/Sandbox/main.cpp b/Examples/Sandbox/main.cpp
index 945d2eb36..ce15e5f99 100644
--- a/Examples/Sandbox/main.cpp
+++ b/Examples/Sandbox/main.cpp
@@ -1862,7 +1862,7 @@ void testPbdFluidBenchmarking()
     cube->setPhysicsGeometry(cubeMesh);
 
     auto pbdModel = std::make_shared<PbdModel>();
-    pbdModel->setModelGeometry(cubeMeshPhysics);
+    pbdModel->setModelGeometry(cubeMesh);
     pbdModel->configure(/*Number of Constraints*/ 1,
         /*Constraint configuration*/ "ConstantDensity 1.0 0.3",
         /*Mass*/ 1.0,
@@ -2028,7 +2028,7 @@ void testPbdFluid()
     deformableObj->setPhysicsGeometry(fluidMesh);
 
     auto pbdModel = std::make_shared<PbdModel>();
-    pbdModel->setModelGeometry(volTetMesh);
+    pbdModel->setModelGeometry(fluidMesh);
     pbdModel->configure(/*Number of Constraints*/ 1,
         /*Constraint configuration*/ "ConstantDensity 1.0 0.3",
         /*Mass*/ 1.0,
-- 
GitLab