From 8200717d453c7a8f558ab4d922aa70ed0e344587 Mon Sep 17 00:00:00 2001 From: Tobias Reiter Date: Fri, 22 Nov 2024 09:44:55 +0100 Subject: [PATCH] Delete visibility scalar data if it already exists --- include/viennals/lsCalculateVisibilities.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/viennals/lsCalculateVisibilities.hpp b/include/viennals/lsCalculateVisibilities.hpp index 8d6bfe09..a1d685b3 100644 --- a/include/viennals/lsCalculateVisibilities.hpp +++ b/include/viennals/lsCalculateVisibilities.hpp @@ -88,8 +88,12 @@ template class CalculateVisibilities { } } - levelSet->getPointData().insertNextScalarData(visibilities, - visibilitiesLabel); + auto &pointData = levelSet->getPointData(); + // delete if already exists + if (int i = pointData.getScalarDataIndex(visibilitiesLabel); i != -1) { + pointData.eraseScalarData(i); + } + pointData.insertNextScalarData(visibilities, visibilitiesLabel); assert(id == numDefinedPoints); }