From 928c606458a0546e789aa17eeb77dff658a380f9 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 11 Jan 2024 15:33:11 -0600 Subject: [PATCH] Adjust logic for setting implicit complement in entHandles --- src/dagmc/DagMC.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index 49944dad8..8803f0bf3 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -924,19 +924,18 @@ ErrorCode DagMC::build_indices(Range& surfs, Range& vols) { // be checked before the implicit complement EntityHandle implicit_complement {0}; rval = geom_tool()->get_implicit_complement(implicit_complement); - if (rval != MB_SUCCESS || implicit_complement == 0) { - logger.message("Could not get the implicit complement"); - return rval; - } - auto it = std::find(vol_handles().begin(), vol_handles().end(), implicit_complement); - if (it != vol_handles().end()) { - vol_handles().erase(it); - } - else { - logger.message("Could not find the implicit complement in the volume handles vector"); - return MB_FAILURE; + if (rval == MB_SUCCESS && implicit_complement != 0) { + auto it = std::find(vol_handles().begin(), vol_handles().end(), implicit_complement); + if (it != vol_handles().end()) { + vol_handles().erase(it); + } + else { + logger.message("Could not find the implicit complement in the volume handles vector"); + return MB_FAILURE; + } + // insert the implicit complement at the end of the vector + vol_handles().push_back(implicit_complement); } - vol_handles().push_back(implicit_complement); idx = 1; for (auto vol_handle : vol_handles()) {