From 5c78cd62594c96181dc149d2c99b1ec75098d737 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 10 Jun 2019 19:46:11 -0500 Subject: [PATCH] Correcting a couple of issues in setting the OVERLAP value and color. --- include/openmc/plot.h | 4 ++-- src/geometry.cpp | 5 ++++- src/plot.cpp | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 1d8ac0ea1..d762cad70 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -108,7 +108,7 @@ public: Position width_; //!< Plot width in geometry PlotBasis basis_; //!< Plot basis (XY/XZ/YZ) std::array pixels_; //!< Plot size in pixels - bool check_overlaps_ = false; + bool color_overlaps_ = true; int level_; //!< Plot universe level }; @@ -176,7 +176,7 @@ T PlotBase::get_map() const { if (found_cell) { data.set_value(y, x, p, j); } - if (check_overlaps_ && check_cell_overlap(&p, false)) { + if (color_overlaps_ && check_cell_overlap(&p, false)) { data.set_overlap(y, x); } } // inner for diff --git a/src/geometry.cpp b/src/geometry.cpp index 4169a5420..ce118c0e0 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -44,12 +44,15 @@ bool check_cell_overlap(Particle* p, bool error) for (auto index_cell : univ.cells_) { Cell& c = *model::cells[index_cell]; if (c.contains(p->coord_[j].r, p->coord_[j].u, p->surface_)) { - if (error && index_cell != p->coord_[j].cell) { + if (index_cell != p->coord_[j].cell) { + if (error) { std::stringstream err_msg; err_msg << "Overlapping cells detected: " << c.id_ << ", " << model::cells[p->coord_[j].cell]->id_ << " on universe " << univ.id_; fatal_error(err_msg); + } + return true; } ++model::overlap_check_count[index_cell]; } diff --git a/src/plot.cpp b/src/plot.cpp index 0ec26473e..d53a12805 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -53,7 +53,7 @@ IdData::set_value(size_t y, size_t x, const Particle& p, int level) { } void IdData::set_overlap(size_t y, size_t x) { - data_(y, x) = OVERLAP; + xt::view(data_, y, x, xt::all()) = OVERLAP; } PropertyData::PropertyData(size_t h_res, size_t v_res) @@ -154,7 +154,10 @@ void create_ppm(Plot pl) auto id = ids.data_(y, x, pl.color_by_); // no setting needed if not found if (id == NOT_FOUND) { continue; } - if (id == OVERLAP) data(x,y) = RED; + if (id == OVERLAP) { + data(x,y) = RED; + continue; + } if (PlotColorBy::cells == pl.color_by_) { data(x,y) = pl.colors_[model::cell_map[id]]; } else if (PlotColorBy::mats == pl.color_by_) {