From c80b614d78d70e75da09b2e78b6433066a072748 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Mon, 13 Mar 2017 11:37:44 +0100
Subject: [PATCH] [A/U/MP] Do not write smth if there aren't props.

---
 .../PartitionMesh/NodeWiseMeshPartitioner.cpp               | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
index 61fe528ddc2..9f2797a9108 100644
--- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
+++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
@@ -336,6 +336,10 @@ NodeWiseMeshPartitioner::getNumberOfIntegerVariablesOfElements(
 void NodeWiseMeshPartitioner::writePropertiesBinary(
     const std::string& file_name_base) const
 {
+    auto const& properties(_partitioned_properties);
+    auto const& property_names(properties.getPropertyVectorNames());
+    if (property_names.empty())
+        return;
     const std::string fname_cfg = file_name_base +
                                   "_partitioned_properties_cfg" +
                                   std::to_string(_npartitions) + ".bin";
@@ -346,8 +350,6 @@ void NodeWiseMeshPartitioner::writePropertiesBinary(
                                   std::to_string(_npartitions) + ".bin";
     std::ofstream out_val(fname_val.c_str(), std::ios::binary | std::ios::out);
 
-    auto const& properties(_partitioned_properties);
-    auto const& property_names(properties.getPropertyVectorNames());
     std::size_t number_of_properties(property_names.size());
     out.write(reinterpret_cast<char*>(&number_of_properties),
               sizeof(number_of_properties));
-- 
GitLab