Created
March 20, 2017 09:45
-
-
Save bilke/6b08d31d8dd8f37f87b7763b9c191dd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp | |
index 7fe7214fc..7468e2355 100644 | |
--- a/Applications/CLI/ogs.cpp | |
+++ b/Applications/CLI/ogs.cpp | |
@@ -119,11 +119,9 @@ int main(int argc, char *argv[]) | |
outdir_arg.getValue()); | |
#ifdef USE_INSITU | |
- auto isInsituConfigured = false; | |
if (auto t = project_config->getConfigSubtreeOptional("insitu")) | |
{ | |
InSituLib::Initialize(t->getConfigSubtree("scripts"), BaseLib::extractPath(project_arg.getValue())); | |
- isInsituConfigured = true; | |
} | |
#else | |
project_config->ignoreConfigParameter("insitu"); | |
@@ -147,11 +145,6 @@ int main(int argc, char *argv[]) | |
auto& time_loop = project.getTimeLoop(); | |
solver_succeeded = time_loop.loop(); | |
- | |
-#ifdef USE_INSITU | |
- if (isInsituConfigured) | |
- InSituLib::Finalize(); | |
- #endif | |
} // This nested scope ensures that everything that could possibly | |
// possess a ConfigTree is destructed before the final check below is | |
// done. | |
diff --git a/Applications/InSituLib/Adaptor.cpp b/Applications/InSituLib/Adaptor.cpp | |
index 79508f42e..97023229a 100644 | |
--- a/Applications/InSituLib/Adaptor.cpp | |
+++ b/Applications/InSituLib/Adaptor.cpp | |
@@ -15,19 +15,20 @@ | |
#include <vtkCPPythonScriptPipeline.h> | |
#include <vtkNew.h> | |
#include <vtkUnstructuredGrid.h> | |
+#include <vtkSmartPointer.h> | |
#include "MeshLib/Mesh.h" | |
#include "MeshLib/Vtk/VtkMappedMeshSource.h" | |
namespace InSituLib | |
{ | |
-vtkCPProcessor* Processor = nullptr; | |
+vtkSmartPointer<vtkCPProcessor> Processor; | |
void Initialize(BaseLib::ConfigTree const & scripts_config, std::string const & path) | |
{ | |
if (Processor == nullptr) | |
{ | |
- Processor = vtkCPProcessor::New(); | |
+ Processor = vtkSmartPointer<vtkCPProcessor>::New(); | |
Processor->Initialize(); | |
} | |
else | |
@@ -45,14 +46,7 @@ void Initialize(BaseLib::ConfigTree const & scripts_config, std::string const & | |
Processor->AddPipeline(pipeline.GetPointer()); | |
} | |
} | |
-void Finalize() | |
-{ | |
- if (Processor) | |
- { | |
- Processor->Delete(); | |
- Processor = nullptr; | |
- } | |
-} | |
+ | |
void CoProcess(MeshLib::Mesh const& mesh, double const time, | |
unsigned int const timeStep, bool const lastTimeStep) | |
{ | |
diff --git a/Applications/InSituLib/Adaptor.h b/Applications/InSituLib/Adaptor.h | |
index 5d3ec0b4e..6997e79de 100644 | |
--- a/Applications/InSituLib/Adaptor.h | |
+++ b/Applications/InSituLib/Adaptor.h | |
@@ -18,7 +18,6 @@ namespace MeshLib { | |
namespace InSituLib { | |
void Initialize(BaseLib::ConfigTree const & scripts_config, std::string const & path); | |
-void Finalize(); | |
void CoProcess( MeshLib::Mesh const & mesh, double const time, unsigned int const timeStep, bool const lastTimeStep); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment