From 6afafc98e9f5d308361df17a3c496855d452ffb5 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Fri, 14 Jan 2022 16:27:18 +0100
Subject: [PATCH] [A/CLI] Mv ProjectData decl. out of large block.

Later on, the aim is to split the large block in
several smaller blocks.
---
 Applications/CLI/ogs.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp
index e54c128d127..62bdac39dc3 100644
--- a/Applications/CLI/ogs.cpp
+++ b/Applications/CLI/ogs.cpp
@@ -212,6 +212,7 @@ int main(int argc, char* argv[])
 #if defined(USE_PETSC)
     vtkSmartPointer<vtkMPIController> controller;
 #endif
+    std::unique_ptr<ProjectData> project;
     try
     {
         bool solver_succeeded = false;
@@ -243,10 +244,6 @@ int main(int argc, char* argv[])
 
             BaseLib::setProjectDirectory(BaseLib::extractPath(cli_arg.project));
 
-            ProjectData project(project_config,
-                                BaseLib::getProjectDirectory(),
-                                cli_arg.outdir);
-
             if (!cli_arg.reference_path_is_set)
             {  // Ignore the test_definition section.
                 project_config.ignoreConfigParameter("test_definition");
@@ -283,8 +280,13 @@ int main(int argc, char* argv[])
             project_config.ignoreConfigParameter("insitu");
 #endif
 
+            project =
+                std::make_unique<ProjectData>(project_config,
+                                              BaseLib::getProjectDirectory(),
+                                              cli_arg.outdir);
+
             INFO("Initialize processes.");
-            for (auto& p : project.getProcesses())
+            for (auto& p : project->getProcesses())
             {
                 p->initialize();
             }
@@ -295,7 +297,7 @@ int main(int argc, char* argv[])
 
             INFO("Solve processes.");
 
-            auto& time_loop = project.getTimeLoop();
+            auto& time_loop = project->getTimeLoop();
             time_loop.initialize();
             solver_succeeded = time_loop.loop();
 
-- 
GitLab