From 9b83db59698c73fa072a33838f14204b03d6cf4f Mon Sep 17 00:00:00 2001
From: "Dmitry Yu. Naumov" <github@naumov.de>
Date: Tue, 10 Jul 2018 13:07:25 +0200
Subject: [PATCH] [MGTL] Extract meshNameFromGeometry(geo_set, geo).

Used in construction of mesh names in two places.
This unifies the name.
---
 MeshGeoToolsLib/ConstructMeshesFromGeometries.cpp | 8 +++++++-
 MeshGeoToolsLib/ConstructMeshesFromGeometries.h   | 3 +++
 ProcessLib/ProcessVariable.cpp                    | 4 +++-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/MeshGeoToolsLib/ConstructMeshesFromGeometries.cpp b/MeshGeoToolsLib/ConstructMeshesFromGeometries.cpp
index 96b2a4e609a..d4fbaa3b04c 100644
--- a/MeshGeoToolsLib/ConstructMeshesFromGeometries.cpp
+++ b/MeshGeoToolsLib/ConstructMeshesFromGeometries.cpp
@@ -20,6 +20,12 @@
 
 namespace MeshGeoToolsLib
 {
+std::string meshNameFromGeometry(std::string const& geometrical_set_name,
+                                 std::string const& geometry_name)
+{
+    return geometrical_set_name + "_" + geometry_name;
+}
+
 template <typename GeometryVec>
 std::vector<std::unique_ptr<MeshLib::Mesh>>
 constructAdditionalMeshesFromGeometries(
@@ -55,7 +61,7 @@ constructAdditionalMeshesFromGeometries(
                  geometry_name.c_str());
 
             additional_meshes.emplace_back(createMeshFromElementSelection(
-                vec_name + "_" + geometry_name,
+                meshNameFromGeometry(vec_name, geometry_name),
                 MeshLib::cloneElements(
                     boundary_element_searcher.getBoundaryElements(geometry))));
         }
diff --git a/MeshGeoToolsLib/ConstructMeshesFromGeometries.h b/MeshGeoToolsLib/ConstructMeshesFromGeometries.h
index c7aeb711354..3efbf3d7ed9 100644
--- a/MeshGeoToolsLib/ConstructMeshesFromGeometries.h
+++ b/MeshGeoToolsLib/ConstructMeshesFromGeometries.h
@@ -31,4 +31,7 @@ constructAdditionalMeshesFromGeoObjects(GeoLib::GEOObjects const& geo_objects,
                                         MeshLib::Mesh const& mesh,
                                         std::unique_ptr<SearchLength>
                                             search_length_algorithm);
+
+std::string meshNameFromGeometry(std::string const& geometrical_set_name,
+                                 std::string const& geometry_name);
 }  // namespace MeshGeoToolsLib
diff --git a/ProcessLib/ProcessVariable.cpp b/ProcessLib/ProcessVariable.cpp
index 7525dfe08b9..a135853d4c5 100644
--- a/ProcessLib/ProcessVariable.cpp
+++ b/ProcessLib/ProcessVariable.cpp
@@ -12,6 +12,7 @@
 #include <utility>
 #include <logog/include/logog.hpp>
 
+#include "MeshGeoToolsLib/ConstructMeshesFromGeometries.h"
 #include "MeshLib/Mesh.h"
 #include "ProcessLib/BoundaryCondition/BoundaryCondition.h"
 #include "ProcessLib/BoundaryCondition/CreateBoundaryCondition.h"
@@ -61,7 +62,8 @@ MeshLib::Mesh const& findMeshInConfig(
             //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__geometry}
             config.getConfigParameter<std::string>("geometry");
 
-        mesh_name = geometrical_set_name + "_" + geometry_name;
+        mesh_name = MeshGeoToolsLib::meshNameFromGeometry(geometrical_set_name,
+                                                          geometry_name);
     }
 
     //
-- 
GitLab