From de826d6bf37e98190b77db6929fdaea30c18a935 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Fri, 26 May 2023 13:03:56 +0200
Subject: [PATCH] [MeL] Move getOrCreateMeshProperty() to MeL/Utils

---
 .../FileIO/GocadIO/GocadSGridReader.cpp       |  1 +
 Applications/FileIO/SWMM/SWMMInterface.cpp    |  1 +
 .../Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp      |  1 +
 .../PhreeqcIOData/CreateAqueousSolution.cpp   |  1 +
 .../CreateEquilibriumReactants.cpp            |  1 +
 ChemistryLib/PhreeqcIOData/CreateExchange.cpp |  1 +
 .../PhreeqcIOData/CreateKineticReactant.cpp   |  1 +
 ChemistryLib/PhreeqcIOData/CreateSurface.cpp  |  1 +
 .../PhreeqcIOData/CreateUserPunch.cpp         |  1 +
 .../CreateEquilibriumReactants.cpp            |  1 +
 .../CreateKineticReactant.cpp                 |  1 +
 .../MeshEditing/ResetMeshElementProperty.h    |  1 +
 MeshLib/Mesh.h                                | 56 --------------
 MeshLib/Utils/IntegrationPointWriter.cpp      |  1 +
 MeshLib/Utils/getOrCreateMeshProperty.h       | 76 +++++++++++++++++++
 MeshToolsLib/MeshSurfaceExtraction.cpp        |  1 +
 ProcessLib/AssemblyMixin.cpp                  |  1 +
 ...ionDependentDirichletBoundaryCondition.cpp |  1 +
 .../ComponentTransportProcess.cpp             |  1 +
 .../HeatConduction/HeatConductionProcess.cpp  |  1 +
 .../HydroMechanics/HydroMechanicsProcess.cpp  |  1 +
 ProcessLib/LIE/Common/PostUtils.cpp           |  1 +
 .../HydroMechanics/HydroMechanicsProcess.cpp  |  1 +
 .../SmallDeformationProcess.cpp               |  1 +
 ProcessLib/LiquidFlow/LiquidFlowProcess.cpp   |  1 +
 ProcessLib/Output/AddProcessDataToMesh.cpp    |  1 +
 ProcessLib/Output/Output.cpp                  |  1 +
 ProcessLib/PhaseField/PhaseFieldProcess.cpp   |  1 +
 ProcessLib/ProcessVariable.cpp                |  1 +
 .../RichardsMechanicsProcess.cpp              |  1 +
 .../SmallDeformationProcess.cpp               |  1 +
 .../SmallDeformationNonlocalProcess.cpp       |  1 +
 ProcessLib/StokesFlow/StokesFlowProcess.cpp   |  1 +
 ProcessLib/SurfaceFlux/SurfaceFluxData.cpp    |  1 +
 ProcessLib/TH2M/TH2MProcess.cpp               |  1 +
 .../ThermoHydroMechanicsProcess.cpp           |  1 +
 .../ThermoMechanicsProcess.cpp                |  1 +
 .../ThermoRichardsFlowProcess.cpp             |  1 +
 .../ThermoRichardsMechanicsProcess.cpp        |  1 +
 .../TestCreateMaterialIDsBasedSubMesh.cpp     |  3 +-
 .../TestGetMeshElementsForMaterialIDs.cpp     |  3 +-
 41 files changed, 117 insertions(+), 58 deletions(-)
 create mode 100644 MeshLib/Utils/getOrCreateMeshProperty.h

diff --git a/Applications/FileIO/GocadIO/GocadSGridReader.cpp b/Applications/FileIO/GocadIO/GocadSGridReader.cpp
index e3de81a29ee..931855b6ff6 100644
--- a/Applications/FileIO/GocadIO/GocadSGridReader.cpp
+++ b/Applications/FileIO/GocadIO/GocadSGridReader.cpp
@@ -20,6 +20,7 @@
 #include "MeshLib/Elements/Hex.h"
 #include "MeshLib/Elements/Quad.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace FileIO
 {
diff --git a/Applications/FileIO/SWMM/SWMMInterface.cpp b/Applications/FileIO/SWMM/SWMMInterface.cpp
index c376b868d2d..663eb836562 100644
--- a/Applications/FileIO/SWMM/SWMMInterface.cpp
+++ b/Applications/FileIO/SWMM/SWMMInterface.cpp
@@ -27,6 +27,7 @@
 #include "MeshLib/Mesh.h"
 #include "MeshLib/Node.h"
 #include "MeshLib/Properties.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace FileIO
 {
diff --git a/Applications/Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp b/Applications/Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp
index 6d6c70fbd80..90b937dc500 100644
--- a/Applications/Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp
+++ b/Applications/Utils/MeshEdit/PVTU2VTU/PVTU2VTU.cpp
@@ -31,6 +31,7 @@
 #include "MeshLib/Node.h"
 #include "MeshLib/Properties.h"
 #include "MeshLib/Utils/IntegrationPointWriter.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 struct MeshEntityMapInfo
 {
diff --git a/ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp b/ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp
index 8af4a7feca6..0863d739e7d 100644
--- a/ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp
+++ b/ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp
@@ -15,6 +15,7 @@
 #include "ChemistryLib/Common/CreateChargeBalance.h"
 #include "CreateSolutionComponent.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace ChemistryLib
 {
diff --git a/ChemistryLib/PhreeqcIOData/CreateEquilibriumReactants.cpp b/ChemistryLib/PhreeqcIOData/CreateEquilibriumReactants.cpp
index 9e5ad34d4b6..ae9b9f6ad66 100644
--- a/ChemistryLib/PhreeqcIOData/CreateEquilibriumReactants.cpp
+++ b/ChemistryLib/PhreeqcIOData/CreateEquilibriumReactants.cpp
@@ -15,6 +15,7 @@
 #include "BaseLib/ConfigTree.h"
 #include "EquilibriumReactant.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace ChemistryLib
 {
diff --git a/ChemistryLib/PhreeqcIOData/CreateExchange.cpp b/ChemistryLib/PhreeqcIOData/CreateExchange.cpp
index 17e07f3e7f4..2c8ce5a360a 100644
--- a/ChemistryLib/PhreeqcIOData/CreateExchange.cpp
+++ b/ChemistryLib/PhreeqcIOData/CreateExchange.cpp
@@ -13,6 +13,7 @@
 #include "BaseLib/ConfigTree.h"
 #include "Exchange.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace ChemistryLib
 {
diff --git a/ChemistryLib/PhreeqcIOData/CreateKineticReactant.cpp b/ChemistryLib/PhreeqcIOData/CreateKineticReactant.cpp
index 9dc6230d03f..665275baf11 100644
--- a/ChemistryLib/PhreeqcIOData/CreateKineticReactant.cpp
+++ b/ChemistryLib/PhreeqcIOData/CreateKineticReactant.cpp
@@ -15,6 +15,7 @@
 #include "BaseLib/ConfigTree.h"
 #include "KineticReactant.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace ChemistryLib
 {
diff --git a/ChemistryLib/PhreeqcIOData/CreateSurface.cpp b/ChemistryLib/PhreeqcIOData/CreateSurface.cpp
index 7ab6e64f9ca..698807dfb48 100644
--- a/ChemistryLib/PhreeqcIOData/CreateSurface.cpp
+++ b/ChemistryLib/PhreeqcIOData/CreateSurface.cpp
@@ -12,6 +12,7 @@
 
 #include "BaseLib/ConfigTree.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "Surface.h"
 
 namespace ChemistryLib
diff --git a/ChemistryLib/PhreeqcIOData/CreateUserPunch.cpp b/ChemistryLib/PhreeqcIOData/CreateUserPunch.cpp
index eae92d951e2..4d2c7c1a58d 100644
--- a/ChemistryLib/PhreeqcIOData/CreateUserPunch.cpp
+++ b/ChemistryLib/PhreeqcIOData/CreateUserPunch.cpp
@@ -12,6 +12,7 @@
 
 #include "BaseLib/ConfigTree.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "UserPunch.h"
 
 namespace ChemistryLib
diff --git a/ChemistryLib/PhreeqcKernelData/CreateEquilibriumReactants.cpp b/ChemistryLib/PhreeqcKernelData/CreateEquilibriumReactants.cpp
index 287beeb3c2d..c1ec1fc6364 100644
--- a/ChemistryLib/PhreeqcKernelData/CreateEquilibriumReactants.cpp
+++ b/ChemistryLib/PhreeqcKernelData/CreateEquilibriumReactants.cpp
@@ -16,6 +16,7 @@
 #include "BaseLib/ConfigTree.h"
 #include "EquilibriumReactants.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace ChemistryLib
 {
diff --git a/ChemistryLib/PhreeqcKernelData/CreateKineticReactant.cpp b/ChemistryLib/PhreeqcKernelData/CreateKineticReactant.cpp
index f3dfdb62578..543d1599484 100644
--- a/ChemistryLib/PhreeqcKernelData/CreateKineticReactant.cpp
+++ b/ChemistryLib/PhreeqcKernelData/CreateKineticReactant.cpp
@@ -16,6 +16,7 @@
 #include "BaseLib/ConfigTree.h"
 #include "KineticReactant.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace ChemistryLib
 {
diff --git a/MeshGeoToolsLib/MeshEditing/ResetMeshElementProperty.h b/MeshGeoToolsLib/MeshEditing/ResetMeshElementProperty.h
index 9a889f1673c..7a95be46d9e 100644
--- a/MeshGeoToolsLib/MeshEditing/ResetMeshElementProperty.h
+++ b/MeshGeoToolsLib/MeshEditing/ResetMeshElementProperty.h
@@ -22,6 +22,7 @@
 #include "MeshLib/IO/writeMeshToFile.h"
 #include "MeshLib/Mesh.h"
 #include "MeshLib/Node.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace MeshGeoToolsLib
 {
diff --git a/MeshLib/Mesh.h b/MeshLib/Mesh.h
index f3eb9ffeca0..d7bf4f61065 100644
--- a/MeshLib/Mesh.h
+++ b/MeshLib/Mesh.h
@@ -175,62 +175,6 @@ inline bool operator!=(Mesh const& a, Mesh const& b)
     return !(a == b);
 }
 
-/// \returns a PropertyVector of the corresponding type, name on nodes, or
-/// cells, or integration points if such exists, or creates a new one.
-/// \attention For the integration points the result's size is zero.
-/// \see MeshLib::addPropertyToMesh()
-template <typename T>
-PropertyVector<T>* getOrCreateMeshProperty(Mesh& mesh,
-                                           std::string const& property_name,
-                                           MeshItemType const item_type,
-                                           int const number_of_components)
-{
-    if (property_name.empty())
-    {
-        OGS_FATAL(
-            "Trying to get or to create a mesh property with empty name.");
-    }
-
-    auto numberOfMeshItems = [&mesh, &item_type]() -> std::size_t {
-        switch (item_type)
-        {
-            case MeshItemType::Cell:
-                return mesh.getNumberOfElements();
-            case MeshItemType::Node:
-                return mesh.getNumberOfNodes();
-            case MeshItemType::IntegrationPoint:
-                return 0;  // For the integration point data the size is
-                           // variable
-            default:
-                OGS_FATAL(
-                    "getOrCreateMeshProperty cannot handle other "
-                    "types than Node, Cell, or IntegrationPoint.");
-        }
-        return 0;
-    };
-
-    if (mesh.getProperties().existsPropertyVector<T>(property_name))
-    {
-        auto result =
-            mesh.getProperties().template getPropertyVector<T>(property_name);
-        assert(result);
-        if (item_type != MeshItemType::IntegrationPoint)
-        {
-            // Test the size if number of mesh items is known, which is not the
-            // case for the integration point data.
-            assert(result->size() ==
-                   numberOfMeshItems() * number_of_components);
-        }
-        return result;
-    }
-
-    auto result = mesh.getProperties().template createNewPropertyVector<T>(
-        property_name, item_type, number_of_components);
-    assert(result);
-    result->resize(numberOfMeshItems() * number_of_components);
-    return result;
-}
-
 /// Returns the material ids property vector defined on the mesh.
 ///
 /// The material ids are always an \c int property named "MaterialIDs".
diff --git a/MeshLib/Utils/IntegrationPointWriter.cpp b/MeshLib/Utils/IntegrationPointWriter.cpp
index db45a4b313b..ebf0a60bb56 100644
--- a/MeshLib/Utils/IntegrationPointWriter.cpp
+++ b/MeshLib/Utils/IntegrationPointWriter.cpp
@@ -13,6 +13,7 @@
 #include <nlohmann/json.hpp>
 
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 using nlohmann::json;
 
diff --git a/MeshLib/Utils/getOrCreateMeshProperty.h b/MeshLib/Utils/getOrCreateMeshProperty.h
new file mode 100644
index 00000000000..aac71f21f77
--- /dev/null
+++ b/MeshLib/Utils/getOrCreateMeshProperty.h
@@ -0,0 +1,76 @@
+/**
+ * \file
+ * \copyright
+ * Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ */
+
+#pragma once
+#include <string>
+
+#include "MeshLib/Location.h"
+#include "MeshLib/Mesh.h"
+#include "MeshLib/PropertyVector.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
+
+namespace MeshLib
+{
+/// \returns a PropertyVector of the corresponding type, name on nodes, or
+/// cells, or integration points if such exists, or creates a new one.
+/// \attention For the integration points the result's size is zero.
+/// \see MeshLib::addPropertyToMesh()
+template <typename T>
+PropertyVector<T>* getOrCreateMeshProperty(Mesh& mesh,
+                                           std::string const& property_name,
+                                           MeshItemType const item_type,
+                                           int const number_of_components)
+{
+    if (property_name.empty())
+    {
+        OGS_FATAL(
+            "Trying to get or to create a mesh property with empty name.");
+    }
+
+    auto numberOfMeshItems = [&mesh, &item_type]() -> std::size_t
+    {
+        switch (item_type)
+        {
+            case MeshItemType::Cell:
+                return mesh.getNumberOfElements();
+            case MeshItemType::Node:
+                return mesh.getNumberOfNodes();
+            case MeshItemType::IntegrationPoint:
+                return 0;  // For the integration point data the size is
+                           // variable
+            default:
+                OGS_FATAL(
+                    "getOrCreateMeshProperty cannot handle other "
+                    "types than Node, Cell, or IntegrationPoint.");
+        }
+        return 0;
+    };
+
+    if (mesh.getProperties().existsPropertyVector<T>(property_name))
+    {
+        auto result =
+            mesh.getProperties().template getPropertyVector<T>(property_name);
+        assert(result);
+        if (item_type != MeshItemType::IntegrationPoint)
+        {
+            // Test the size if number of mesh items is known, which is not the
+            // case for the integration point data.
+            assert(result->size() ==
+                   numberOfMeshItems() * number_of_components);
+        }
+        return result;
+    }
+
+    auto result = mesh.getProperties().template createNewPropertyVector<T>(
+        property_name, item_type, number_of_components);
+    assert(result);
+    result->resize(numberOfMeshItems() * number_of_components);
+    return result;
+}
+}  // namespace MeshLib
diff --git a/MeshToolsLib/MeshSurfaceExtraction.cpp b/MeshToolsLib/MeshSurfaceExtraction.cpp
index 9032b22bfaa..97621bf58a2 100644
--- a/MeshToolsLib/MeshSurfaceExtraction.cpp
+++ b/MeshToolsLib/MeshSurfaceExtraction.cpp
@@ -26,6 +26,7 @@
 #include "MeshLib/MeshSearch/NodeSearch.h"
 #include "MeshLib/Utils/DuplicateMeshComponents.h"
 #include "MeshLib/Utils/addPropertyToMesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "MeshToolsLib/MeshEditing/RemoveMeshComponents.h"
 
 namespace MeshToolsLib
diff --git a/ProcessLib/AssemblyMixin.cpp b/ProcessLib/AssemblyMixin.cpp
index e814b8ab691..d206fcb587b 100644
--- a/ProcessLib/AssemblyMixin.cpp
+++ b/ProcessLib/AssemblyMixin.cpp
@@ -12,6 +12,7 @@
 
 #include <unordered_set>
 
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/DOFTableUtil.h"
 
 namespace
diff --git a/ProcessLib/BoundaryConditionAndSourceTerm/SolutionDependentDirichletBoundaryCondition.cpp b/ProcessLib/BoundaryConditionAndSourceTerm/SolutionDependentDirichletBoundaryCondition.cpp
index 386d3b7d19a..a2034c76416 100644
--- a/ProcessLib/BoundaryConditionAndSourceTerm/SolutionDependentDirichletBoundaryCondition.cpp
+++ b/ProcessLib/BoundaryConditionAndSourceTerm/SolutionDependentDirichletBoundaryCondition.cpp
@@ -17,6 +17,7 @@
 #include "BaseLib/Logging.h"
 #include "DirichletBoundaryConditionAuxiliaryFunctions.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/LocalToGlobalIndexMap.h"
 #include "ParameterLib/Utils.h"
 
diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
index 278c37b3305..f96c617a11e 100644
--- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
+++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
@@ -19,6 +19,7 @@
 #include "MathLib/LinAlg/FinalizeMatrixAssembly.h"
 #include "MathLib/LinAlg/FinalizeVectorAssembly.h"
 #include "MathLib/LinAlg/LinAlg.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/ComputeSparsityPattern.h"
 #include "ProcessLib/SurfaceFlux/SurfaceFlux.h"
 #include "ProcessLib/SurfaceFlux/SurfaceFluxData.h"
diff --git a/ProcessLib/HeatConduction/HeatConductionProcess.cpp b/ProcessLib/HeatConduction/HeatConductionProcess.cpp
index f77e7708775..f7bde46a760 100644
--- a/ProcessLib/HeatConduction/HeatConductionProcess.cpp
+++ b/ProcessLib/HeatConduction/HeatConductionProcess.cpp
@@ -14,6 +14,7 @@
 
 #include "MathLib/LinAlg/FinalizeMatrixAssembly.h"
 #include "MathLib/LinAlg/FinalizeVectorAssembly.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/DOFTableUtil.h"
 #include "ProcessLib/Utils/ComputeResiduum.h"
 #include "ProcessLib/Utils/CreateLocalAssemblers.h"
diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp
index e7add25eb26..c04fccacfba 100644
--- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp
+++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp
@@ -15,6 +15,7 @@
 #include "HydroMechanicsFEM.h"
 #include "HydroMechanicsProcessData.h"
 #include "MeshLib/Elements/Utils.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/ComputeSparsityPattern.h"
 #include "ProcessLib/Deformation/SolidMaterialInternalToSecondaryVariables.h"
 #include "ProcessLib/Process.h"
diff --git a/ProcessLib/LIE/Common/PostUtils.cpp b/ProcessLib/LIE/Common/PostUtils.cpp
index 48f268dfce4..8519eaecc88 100644
--- a/ProcessLib/LIE/Common/PostUtils.cpp
+++ b/ProcessLib/LIE/Common/PostUtils.cpp
@@ -12,6 +12,7 @@
 #include "MeshLib/Elements/Element.h"
 #include "MeshLib/Node.h"
 #include "MeshLib/Utils/DuplicateMeshComponents.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 namespace ProcessLib
 {
diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
index 13221eec57c..1384f331e74 100644
--- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
+++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
@@ -19,6 +19,7 @@
 #include "MeshLib/Elements/Utils.h"
 #include "MeshLib/Mesh.h"
 #include "MeshLib/Properties.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "MeshToolsLib/MeshInformation.h"
 #include "NumLib/DOF/DOFTableUtil.h"
 #include "NumLib/DOF/LocalToGlobalIndexMap.h"
diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
index 2dc874be571..8f5ff3e2a63 100644
--- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
+++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
@@ -13,6 +13,7 @@
 #include "MeshLib/ElementCoordinatesMappingLocal.h"
 #include "MeshLib/Mesh.h"
 #include "MeshLib/Properties.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/LocalToGlobalIndexMap.h"
 #include "ProcessLib/LIE/Common/BranchProperty.h"
 #include "ProcessLib/LIE/Common/MeshUtils.h"
diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
index 569ad13dd3d..17308689cec 100644
--- a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
+++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
@@ -18,6 +18,7 @@
 #include "MathLib/LinAlg/FinalizeMatrixAssembly.h"
 #include "MathLib/LinAlg/FinalizeVectorAssembly.h"
 #include "MeshLib/PropertyVector.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "ProcessLib/Utils/ComputeResiduum.h"
 #include "ProcessLib/Utils/CreateLocalAssemblers.h"
 
diff --git a/ProcessLib/Output/AddProcessDataToMesh.cpp b/ProcessLib/Output/AddProcessDataToMesh.cpp
index b08f300c285..13a57345f44 100644
--- a/ProcessLib/Output/AddProcessDataToMesh.cpp
+++ b/ProcessLib/Output/AddProcessDataToMesh.cpp
@@ -12,6 +12,7 @@
 
 #include "InfoLib/GitInfo.h"
 #include "MeshLib/Utils/IntegrationPointWriter.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "ProcessLib/Output/SecondaryVariable.h"
 #include "ProcessLib/ProcessVariable.h"
 #ifdef USE_PETSC
diff --git a/ProcessLib/Output/Output.cpp b/ProcessLib/Output/Output.cpp
index d6e057a4068..efbfa78c607 100644
--- a/ProcessLib/Output/Output.cpp
+++ b/ProcessLib/Output/Output.cpp
@@ -20,6 +20,7 @@
 #include "BaseLib/FileTools.h"
 #include "BaseLib/Logging.h"
 #include "BaseLib/RunTime.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "ProcessLib/Process.h"
 
 namespace ProcessLib
diff --git a/ProcessLib/PhaseField/PhaseFieldProcess.cpp b/ProcessLib/PhaseField/PhaseFieldProcess.cpp
index 74bf60895dc..d34971c4ec2 100644
--- a/ProcessLib/PhaseField/PhaseFieldProcess.cpp
+++ b/ProcessLib/PhaseField/PhaseFieldProcess.cpp
@@ -12,6 +12,7 @@
 
 #include <cassert>
 
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/ComputeSparsityPattern.h"
 #include "PhaseFieldFEM.h"
 #include "ProcessLib/Process.h"
diff --git a/ProcessLib/ProcessVariable.cpp b/ProcessLib/ProcessVariable.cpp
index 0b825b7c488..5e9cde1fb80 100644
--- a/ProcessLib/ProcessVariable.cpp
+++ b/ProcessLib/ProcessVariable.cpp
@@ -18,6 +18,7 @@
 #include "MeshGeoToolsLib/ConstructMeshesFromGeometries.h"
 #include "MeshLib/Mesh.h"
 #include "MeshLib/Node.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "ParameterLib/Utils.h"
 #include "ProcessLib/BoundaryConditionAndSourceTerm/BoundaryCondition.h"
 #include "ProcessLib/BoundaryConditionAndSourceTerm/BoundaryConditionConfig.h"
diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp
index 783912828cb..10c0f89debe 100644
--- a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp
+++ b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp
@@ -13,6 +13,7 @@
 #include <cassert>
 
 #include "MeshLib/Elements/Utils.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/ComputeSparsityPattern.h"
 #include "ProcessLib/Deformation/SolidMaterialInternalToSecondaryVariables.h"
 #include "ProcessLib/Utils/CreateLocalAssemblersTaylorHood.h"
diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
index ea587887a63..1b7fdf3e04e 100644
--- a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
+++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
@@ -13,6 +13,7 @@
 #include <cassert>
 
 #include "MeshLib/Utils/IntegrationPointWriter.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "ProcessLib/Deformation/SolidMaterialInternalToSecondaryVariables.h"
 #include "ProcessLib/Process.h"
 #include "ProcessLib/SmallDeformation/CreateLocalAssemblers.h"
diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp
index ad0a58b2f0b..093424c03bd 100644
--- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp
+++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp
@@ -13,6 +13,7 @@
 #include <iostream>
 
 #include "MeshLib/Utils/IntegrationPointWriter.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 
 // Reusing local assembler creation code.
 #include "ProcessLib/SmallDeformation/CreateLocalAssemblers.h"
diff --git a/ProcessLib/StokesFlow/StokesFlowProcess.cpp b/ProcessLib/StokesFlow/StokesFlowProcess.cpp
index c0c78aeb6ed..61bdc07230b 100644
--- a/ProcessLib/StokesFlow/StokesFlowProcess.cpp
+++ b/ProcessLib/StokesFlow/StokesFlowProcess.cpp
@@ -13,6 +13,7 @@
 #include <cassert>
 
 #include "MeshLib/Elements/Utils.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "ProcessLib/Utils/CreateLocalAssemblersTaylorHood.h"
 
 namespace ProcessLib
diff --git a/ProcessLib/SurfaceFlux/SurfaceFluxData.cpp b/ProcessLib/SurfaceFlux/SurfaceFluxData.cpp
index a61816d4a94..316c748e6be 100644
--- a/ProcessLib/SurfaceFlux/SurfaceFluxData.cpp
+++ b/ProcessLib/SurfaceFlux/SurfaceFluxData.cpp
@@ -12,6 +12,7 @@
 
 #include "BaseLib/ConfigTree.h"
 #include "BaseLib/Logging.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "ProcessLib/Process.h"
 #include "ProcessLib/SurfaceFlux/SurfaceFlux.h"
 
diff --git a/ProcessLib/TH2M/TH2MProcess.cpp b/ProcessLib/TH2M/TH2MProcess.cpp
index 5bf527af4e3..57c2071bc87 100644
--- a/ProcessLib/TH2M/TH2MProcess.cpp
+++ b/ProcessLib/TH2M/TH2MProcess.cpp
@@ -16,6 +16,7 @@
 #include "MaterialLib/SolidModels/MechanicsBase.h"  // for the instantiation of process data
 #include "MathLib/KelvinVector.h"
 #include "MeshLib/Elements/Utils.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/DOFTableUtil.h"
 #include "ProcessLib/Deformation/SolidMaterialInternalToSecondaryVariables.h"
 #include "ProcessLib/Process.h"
diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp
index 821e81e0d57..4e6f7214bba 100644
--- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp
+++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp
@@ -13,6 +13,7 @@
 #include <cassert>
 
 #include "MeshLib/Elements/Utils.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/ComputeSparsityPattern.h"
 #include "ProcessLib/Process.h"
 #include "ProcessLib/Utils/CreateLocalAssemblersTaylorHood.h"
diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp
index de19357e8d1..3a6208beb36 100644
--- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp
+++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp
@@ -13,6 +13,7 @@
 #include <cassert>
 
 #include "MeshLib/Utils/IntegrationPointWriter.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/ComputeSparsityPattern.h"
 #include "NumLib/DOF/DOFTableUtil.h"
 #include "ProcessLib/Deformation/SolidMaterialInternalToSecondaryVariables.h"
diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp
index e251502e914..5d74dbeefc0 100644
--- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp
+++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp
@@ -14,6 +14,7 @@
 
 #include "BaseLib/Error.h"
 #include "MeshLib/Elements/Utils.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "NumLib/DOF/ComputeSparsityPattern.h"
 #include "ProcessLib/Process.h"
 #include "ProcessLib/Utils/CreateLocalAssemblers.h"
diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp
index feebf63accb..c6ff2e99dd2 100644
--- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp
+++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp
@@ -15,6 +15,7 @@
 #include "BaseLib/Error.h"
 #include "CreateThermoRichardsMechanicsLocalAssemblers.h"
 #include "MeshLib/Elements/Utils.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
 #include "ProcessLib/Deformation/SolidMaterialInternalToSecondaryVariables.h"
 #include "ProcessLib/Process.h"
 #include "ProcessLib/Reflection/ReflectionForExtrapolation.h"
diff --git a/Tests/MeshLib/TestCreateMaterialIDsBasedSubMesh.cpp b/Tests/MeshLib/TestCreateMaterialIDsBasedSubMesh.cpp
index fb9ff0d9750..a84bb4f6514 100644
--- a/Tests/MeshLib/TestCreateMaterialIDsBasedSubMesh.cpp
+++ b/Tests/MeshLib/TestCreateMaterialIDsBasedSubMesh.cpp
@@ -14,8 +14,9 @@
 
 #include "MeshLib/Mesh.h"
 #include "MeshLib/Node.h"
-#include "MeshToolsLib/MeshGenerators/MeshGenerator.h"
 #include "MeshLib/Utils/createMaterialIDsBasedSubMesh.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
+#include "MeshToolsLib/MeshGenerators/MeshGenerator.h"
 
 using namespace MeshLib;
 
diff --git a/Tests/MeshLib/TestGetMeshElementsForMaterialIDs.cpp b/Tests/MeshLib/TestGetMeshElementsForMaterialIDs.cpp
index fe533912f25..14749d0e882 100644
--- a/Tests/MeshLib/TestGetMeshElementsForMaterialIDs.cpp
+++ b/Tests/MeshLib/TestGetMeshElementsForMaterialIDs.cpp
@@ -15,8 +15,9 @@
 #include "MeshLib/Elements/Element.h"
 #include "MeshLib/Mesh.h"
 #include "MeshLib/Node.h"
-#include "MeshToolsLib/MeshGenerators/MeshGenerator.h"
 #include "MeshLib/Utils/getMeshElementsForMaterialIDs.h"
+#include "MeshLib/Utils/getOrCreateMeshProperty.h"
+#include "MeshToolsLib/MeshGenerators/MeshGenerator.h"
 
 using namespace MeshLib;
 
-- 
GitLab