From a8ed9bde8f68a7218066ff828db9da43c0917b41 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 9 Jun 2022 19:33:22 -0500 Subject: [PATCH] Hacks to get project plots working w/ DAGMC --- src/dagmc.cpp | 3 ++- src/plot.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 243c62e7f..f6ed134e7 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -739,7 +739,8 @@ int32_t next_cell(int32_t surf, int32_t curr_cell, int32_t univ) { cellp->dagmc_ptr()->entity_by_index(3, cellp->dag_index()); moab::EntityHandle new_vol; - cellp->dagmc_ptr()->next_vol(surf_handle, curr_vol, new_vol); + moab::ErrorCode rval = cellp->dagmc_ptr()->next_vol(surf_handle, curr_vol, new_vol); + if (rval != moab::MB_SUCCESS) return -1; return cellp->dagmc_ptr()->index_by_handle(new_vol) + univp->cell_idx_offset_; diff --git a/src/plot.cpp b/src/plot.cpp index e2102b710..a8047c13a 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -14,6 +14,7 @@ #endif #include "openmc/constants.h" +#include "openmc/dagmc.h" #include "openmc/error.h" #include "openmc/file_utils.h" #include "openmc/geometry.h" @@ -1300,7 +1301,16 @@ void ProjectionPlot::create_output() const -1; // surface first passed when entering the model bool first_inside_model = true; // false after entering the model while (intersection_found) { - bool inside_cell = exhaustive_find_cell(p); + bool inside_cell = false; + + int32_t i_surface = std::abs(p.surface()) - 1; + if (i_surface > 0 && model::surfaces[i_surface]->geom_type_ == GeometryType::DAG) { + int32_t i_cell = next_cell(i_surface, p.cell_last(p.n_coord() - 1), p.lowest_coord().universe); + inside_cell = i_cell >= 0; + } else { + inside_cell = exhaustive_find_cell(p); + } + if (inside_cell) { // This allows drawing wireframes with surface intersection