From 02b07a52b697b59354d4b37c90a384321d9f1769 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 10 Jun 2019 18:16:11 -0500 Subject: [PATCH 01/24] Adding overlap coloring. --- include/openmc/geometry.h | 2 +- include/openmc/plot.h | 7 +++++ openmc/capi/plot.py | 65 +++++++++++++++++++++++---------------- src/geometry.cpp | 4 +-- src/plot.cpp | 12 ++++++++ 5 files changed, 60 insertions(+), 30 deletions(-) diff --git a/include/openmc/geometry.h b/include/openmc/geometry.h index 8e6e8a82e..0ceaab104 100644 --- a/include/openmc/geometry.h +++ b/include/openmc/geometry.h @@ -47,7 +47,7 @@ inline bool coincident(double d1, double d2) { //! Check for overlapping cells at a particle's position. //============================================================================== -bool check_cell_overlap(Particle* p); + bool check_cell_overlap(Particle* p, bool error=true); //============================================================================== //! Locate a particle in the geometry tree and set its geometry data fields. diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 8e5aa02a6..1d8ac0ea1 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -61,6 +61,7 @@ struct IdData { // Methods void set_value(size_t y, size_t x, const Particle& p, int level); + void set_overlap(size_t y, size_t x); // Members xt::xtensor data_; //!< 2D array of cell & material ids @@ -72,6 +73,7 @@ struct PropertyData { // Methods void set_value(size_t y, size_t x, const Particle& p, int level); + void set_overlap(size_t y, size_t x); // Members xt::xtensor data_; //!< 2D array of temperature & density data @@ -106,6 +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; int level_; //!< Plot universe level }; @@ -173,6 +176,9 @@ T PlotBase::get_map() const { if (found_cell) { data.set_value(y, x, p, j); } + if (check_overlaps_ && check_cell_overlap(&p, false)) { + data.set_overlap(y, x); + } } // inner for } // outer for } // omp parallel @@ -210,6 +216,7 @@ public: int index_meshlines_mesh_; //!< Index of the mesh to draw on the plot RGBColor meshlines_color_; //!< Color of meshlines on the plot RGBColor not_found_; //!< Plot background color + RGBColor overlap_color_; //!< Plot overlap color std::vector colors_; //!< Plot colors std::string path_plot_; //!< Plot output filename }; diff --git a/openmc/capi/plot.py b/openmc/capi/plot.py index 9ff398f5c..375660b38 100644 --- a/openmc/capi/plot.py +++ b/openmc/capi/plot.py @@ -1,4 +1,5 @@ -from ctypes import c_int, c_size_t, c_int32, c_double, Structure, POINTER +from ctypes import (c_bool, c_int, c_size_t, c_int32, + c_double, Structure, POINTER) from . import _dll from .error import _error_handler @@ -84,6 +85,7 @@ class _PlotBase(Structure): ('width_', _Position), ('basis_', c_int), ('pixels_', 3*c_size_t), + ('color_overlaps_', c_bool), ('level_', c_int)] def __init__(self): @@ -112,32 +114,6 @@ class _PlotBase(Structure): raise ValueError("Plot basis {} is invalid".format(self.basis_)) - @property - def h_res(self): - return self.pixels_[0] - - @property - def v_res(self): - return self.pixels_[1] - - @property - def level(self): - return int(self.level_) - - @origin.setter - def origin(self, origin): - self.origin_.x = origin[0] - self.origin_.y = origin[1] - self.origin_.z = origin[2] - - @width.setter - def width(self, width): - self.width_.x = width - - @height.setter - def height(self, height): - self.width_.y = height - @basis.setter def basis(self, basis): if isinstance(basis, str): @@ -164,6 +140,32 @@ class _PlotBase(Structure): raise ValueError("{} of type {} is an" " invalid plot basis".format(basis, type(basis))) + @property + def h_res(self): + return self.pixels_[0] + + @property + def v_res(self): + return self.pixels_[1] + + @property + def level(self): + return int(self.level_) + + @origin.setter + def origin(self, origin): + self.origin_.x = origin[0] + self.origin_.y = origin[1] + self.origin_.z = origin[2] + + @width.setter + def width(self, width): + self.width_.x = width + + @height.setter + def height(self, height): + self.width_.y = height + @h_res.setter def h_res(self, h_res): self.pixels_[0] = h_res @@ -176,6 +178,14 @@ class _PlotBase(Structure): def level(self, level): self.level_ = level + @property + def color_overlaps(self): + return self.color_overlaps_ + + @color_overlaps.setter + def color_overlaps(self, val): + self.color_overlaps_ = val + def __repr__(self): out_str = ["-----", "Plot:", @@ -186,6 +196,7 @@ class _PlotBase(Structure): "Basis: {}".format(self.basis), "HRes: {}".format(self.h_res), "VRes: {}".format(self.v_res), + "Color Ovrelaps: {}".format(self.color_overlaps), "Level: {}".format(self.level)] return '\n'.join(out_str) diff --git a/src/geometry.cpp b/src/geometry.cpp index aec272ae1..4169a5420 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -32,7 +32,7 @@ std::vector overlap_check_count; // Non-member functions //============================================================================== -bool check_cell_overlap(Particle* p) +bool check_cell_overlap(Particle* p, bool error) { int n_coord = p->n_coord_; @@ -44,7 +44,7 @@ bool check_cell_overlap(Particle* p) 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 (index_cell != p->coord_[j].cell) { + if (error && index_cell != p->coord_[j].cell) { std::stringstream err_msg; err_msg << "Overlapping cells detected: " << c.id_ << ", " << model::cells[p->coord_[j].cell]->id_ << " on universe " diff --git a/src/plot.cpp b/src/plot.cpp index 6bc82e164..0ec26473e 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -29,8 +29,11 @@ namespace openmc { //============================================================================== const RGBColor WHITE {255, 255, 255}; +const RGBColor RED {255, 0, 0}; + constexpr int PLOT_LEVEL_LOWEST {-1}; //!< lower bound on plot universe level constexpr int32_t NOT_FOUND {-2}; +constexpr int32_t OVERLAP{-3}; IdData::IdData(size_t h_res, size_t v_res) : data_({v_res, h_res, 2}, NOT_FOUND) @@ -49,6 +52,10 @@ 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; +} + PropertyData::PropertyData(size_t h_res, size_t v_res) : data_({v_res, h_res, 2}, NOT_FOUND) { } @@ -63,6 +70,10 @@ PropertyData::set_value(size_t y, size_t x, const Particle& p, int level) { } } +void PropertyData::set_overlap(size_t y, size_t x) { + data_(y, x) = OVERLAP; +} + //============================================================================== // Global variables //============================================================================== @@ -143,6 +154,7 @@ 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 (PlotColorBy::cells == pl.color_by_) { data(x,y) = pl.colors_[model::cell_map[id]]; } else if (PlotColorBy::mats == pl.color_by_) { From 5c78cd62594c96181dc149d2c99b1ec75098d737 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 10 Jun 2019 19:46:11 -0500 Subject: [PATCH 02/24] 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_) { From 552ab71a5007b2098b1a05a052c8bd3f831b2951 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 10 Jun 2019 19:55:56 -0500 Subject: [PATCH 03/24] Making sure default colors aren't being used. --- include/openmc/plot.h | 4 ++++ src/plot.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index d762cad70..48920afad 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -49,6 +49,10 @@ struct RGBColor { blue = v[2]; } + bool operator ==(const RGBColor& other) { + return red == other.red && green == other.green && blue == other.blue; + } + // Members uint8_t red, green, blue; }; diff --git a/src/plot.cpp b/src/plot.cpp index d53a12805..78b1c6a71 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -403,6 +403,10 @@ Plot::set_default_colors(pugi::xml_node plot_node) for (auto& c : colors_) { c = random_color(); + // make sure we don't interfere with some default colors + while (c == RED || c == WHITE) { + c = random_color(); + } } } From e837f2eb1999e8560a4ed2f3486e4524b92c5fc8 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 10 Jun 2019 20:19:57 -0500 Subject: [PATCH 04/24] Adding an xml setting for the showing the overlaps. --- include/openmc/plot.h | 3 ++- src/plot.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 48920afad..1621def93 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -112,7 +112,7 @@ public: Position width_; //!< Plot width in geometry PlotBasis basis_; //!< Plot basis (XY/XZ/YZ) std::array pixels_; //!< Plot size in pixels - bool color_overlaps_ = true; + bool color_overlaps_; int level_; //!< Plot universe level }; @@ -210,6 +210,7 @@ private: void set_user_colors(pugi::xml_node plot_node); void set_meshlines(pugi::xml_node plot_node); void set_mask(pugi::xml_node plot_node); + void set_color_overlaps(pugi::xml_node plot_node); // Members public: diff --git a/src/plot.cpp b/src/plot.cpp index 78b1c6a71..91effefb3 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -657,6 +657,19 @@ Plot::set_mask(pugi::xml_node plot_node) } } +void Plot::set_color_overlaps(pugi::xml_node plot_node) { + color_overlaps_ = false; + if (check_for_node(plot_node, "show_overlaps")) { + color_overlaps_ = get_node_value_bool(plot_node, "show_overlaps"); + } + + // make sure we allocate the vector for counting overlap checks if + // they're going to be plotted + if (color_overlaps_ && settings::run_mode == RUN_MODE_PLOTTING) { + settings::check_overlaps = true; + } +} + Plot::Plot(pugi::xml_node plot_node) : index_meshlines_mesh_{-1} { @@ -672,6 +685,7 @@ Plot::Plot(pugi::xml_node plot_node) set_user_colors(plot_node); set_meshlines(plot_node); set_mask(plot_node); + set_color_overlaps(plot_node); } // End Plot constructor //============================================================================== @@ -868,6 +882,7 @@ void create_voxel(Plot pl) pltbase.basis_ = PlotBasis::xy; pltbase.pixels_ = pl.pixels_; pltbase.level_ = -1; // all universes for voxel files + pltbase.color_overlaps_ = pl.color_overlaps_; ProgressBar pb; for (int z = 0; z < pl.pixels_[2]; z++) { From 2b7057667c69eeb438c2ba8373cfb6cdef4fe454 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 11 Jun 2019 09:56:49 -0500 Subject: [PATCH 05/24] Making sure overlap check counter is initialized if a plot requests that overlaps be drawn. --- src/plot.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plot.cpp b/src/plot.cpp index 91effefb3..da880a5b1 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -667,6 +667,7 @@ void Plot::set_color_overlaps(pugi::xml_node plot_node) { // they're going to be plotted if (color_overlaps_ && settings::run_mode == RUN_MODE_PLOTTING) { settings::check_overlaps = true; + model::overlap_check_count.resize(model::cells.size(), 0); } } From 42ff5a4c85b5ac2aeadb80a03ffb990fb3d2e80b Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 11 Jun 2019 15:51:25 -0500 Subject: [PATCH 06/24] Adding show_overlaps and overlap_color to Python API. --- openmc/plots.py | 48 ++++++++++++++++++++++++++++++++++ tests/unit_tests/test_plots.py | 4 +++ 2 files changed, 52 insertions(+) diff --git a/openmc/plots.py b/openmc/plots.py index 5a5282298..3c810fcf6 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -208,6 +208,10 @@ class Plot(IDManagerMixin): The cells or materials to plot mask_background : Iterable of int or str Color to apply to all cells/materials not listed in mask_components + show_overlaps : bool + Inidicate whether or not overlapping regions are shown + overlap_color : Iterable of int or str + Color to apply to overlapping regions colors : dict Dictionary indicating that certain cells/materials (keys) should be displayed with a particular color. @@ -236,6 +240,8 @@ class Plot(IDManagerMixin): self._background = None self._mask_components = None self._mask_background = None + self._show_overlaps = False + self._overlap_color = None self._colors = {} self._level = None self._meshlines = None @@ -284,6 +290,14 @@ class Plot(IDManagerMixin): def mask_background(self): return self._mask_background + @property + def show_overlaps(self): + return self._show_overlaps + + @property + def overlap_color(self): + return self._overlap_color + @property def colors(self): return self._colors @@ -391,6 +405,25 @@ class Plot(IDManagerMixin): cv.check_less_than('plot mask background', rgb, 256) self._mask_background = mask_background + @show_overlaps.setter + def show_overlaps(self, show_overlaps): + cv.check_type('Show overlaps flag for Plot ID="{}"'.format(self.id), + show_overlaps, bool) + self._show_overlaps = show_overlaps + + @overlap_color.setter + def overlap_color(self, overlap_color): + cv.check_type('plot overlap color', overlap_color, Iterable) + if isinstance(overlap_color, str): + if overlap_color.lower() not in _SVG_COLORS: + raise ValueError("'{}' is not a valid color.".format(overlap_color)) + else: + cv.check_length('plot overlap color', overlap_color, 3) + for rgb in overlap_color: + cv.check_greater_than('plot overlap color', rgb, 0, True) + cv.check_less_than('plot overlap color', rgb, 256) + self._overlap_color = overlap_color + @level.setter def level(self, plot_level): cv.check_type('plot level', plot_level, Integral) @@ -446,6 +479,8 @@ class Plot(IDManagerMixin): self._mask_components) string += '{: <16}=\t{}\n'.format('\tMask background', self._mask_background) + string += '{: <16}=\t{}\n'.format('\Overlap Color', + self._overlap_color) string += '{: <16}=\t{}\n'.format('\tColors', self._colors) string += '{: <16}=\t{}\n'.format('\tLevel', self._level) string += '{: <16}=\t{}\n'.format('\tMeshlines', self._meshlines) @@ -635,6 +670,19 @@ class Plot(IDManagerMixin): subelement.set("background", ' '.join( str(x) for x in color)) + if self._show_overlaps: + subelement = ET.SubElement(element, "show_overlaps") + subelement.text = "true" + + if self._overlap_color is not None: + color = self._overlap_color + if isinstance(color, str): + color = _SVG_COLORS[color.lower()] + + subelement = ET.SubElement(element, "overlap_color") + subelement.text = ' '.join(str(x) for x in color) + + if self._level is not None: subelement = ET.SubElement(element, "level") subelement.text = str(self._level) diff --git a/tests/unit_tests/test_plots.py b/tests/unit_tests/test_plots.py index 840e7e635..f2d3e1014 100644 --- a/tests/unit_tests/test_plots.py +++ b/tests/unit_tests/test_plots.py @@ -24,6 +24,10 @@ def myplot(): plot.mask_background = (255, 255, 255) plot.mask_background = 'white' + plot.overlap_color = (255, 211, 0) + plot.overlap_color = 'yellow' + plot.show_overlaps = True + plot.level = 1 plot.meshlines = { 'type': 'tally', From 43959714eecb191316638f99365181ada4dbb61d Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 11 Jun 2019 16:13:50 -0500 Subject: [PATCH 07/24] Allowing overlap color setting via plots.xml --- include/openmc/plot.h | 2 +- src/plot.cpp | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 1621def93..e08e62d5f 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -210,7 +210,7 @@ private: void set_user_colors(pugi::xml_node plot_node); void set_meshlines(pugi::xml_node plot_node); void set_mask(pugi::xml_node plot_node); - void set_color_overlaps(pugi::xml_node plot_node); + void set_overlap_color(pugi::xml_node plot_node); // Members public: diff --git a/src/plot.cpp b/src/plot.cpp index da880a5b1..60c39389f 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -155,7 +155,7 @@ void create_ppm(Plot pl) // no setting needed if not found if (id == NOT_FOUND) { continue; } if (id == OVERLAP) { - data(x,y) = RED; + data(x,y) = pl.overlap_color_; continue; } if (PlotColorBy::cells == pl.color_by_) { @@ -657,10 +657,28 @@ Plot::set_mask(pugi::xml_node plot_node) } } -void Plot::set_color_overlaps(pugi::xml_node plot_node) { +void Plot::set_overlap_color(pugi::xml_node plot_node) { color_overlaps_ = false; if (check_for_node(plot_node, "show_overlaps")) { color_overlaps_ = get_node_value_bool(plot_node, "show_overlaps"); + overlap_color_ = RED; + // check for custom overlap color + if (check_for_node(plot_node, "overlap_color")) { + if (!color_overlaps_) { + std::stringstream wrn_msg; + wrn_msg << "Overlap color specified in plot " << id_ + << " but overlaps won't be shown."; + warning(wrn_msg); + } + std::vector olap_clr = get_node_array(plot_node, "overlap_color"); + if (olap_clr.size() == 3) { + overlap_color_ = olap_clr; + } else { + std::stringstream err_msg; + err_msg << "Bad overlap RGB in plot " << id_; + fatal_error(err_msg); + } + } } // make sure we allocate the vector for counting overlap checks if @@ -686,7 +704,7 @@ Plot::Plot(pugi::xml_node plot_node) set_user_colors(plot_node); set_meshlines(plot_node); set_mask(plot_node); - set_color_overlaps(plot_node); + set_overlap_color(plot_node); } // End Plot constructor //============================================================================== From 8946bbd238500a3b044839c73fc5d47eb38204b1 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 11 Jun 2019 16:14:08 -0500 Subject: [PATCH 08/24] Adding a test plotting overlap regions. --- .../plot_overlaps/__init__.py | 0 .../plot_overlaps/geometry.xml | 14 +++++ .../plot_overlaps/materials.xml | 19 ++++++ .../regression_tests/plot_overlaps/plots.xml | 35 +++++++++++ .../plot_overlaps/results_true.dat | 1 + .../plot_overlaps/settings.xml | 13 ++++ tests/regression_tests/plot_overlaps/test.py | 63 +++++++++++++++++++ 7 files changed, 145 insertions(+) create mode 100644 tests/regression_tests/plot_overlaps/__init__.py create mode 100644 tests/regression_tests/plot_overlaps/geometry.xml create mode 100644 tests/regression_tests/plot_overlaps/materials.xml create mode 100644 tests/regression_tests/plot_overlaps/plots.xml create mode 100644 tests/regression_tests/plot_overlaps/results_true.dat create mode 100644 tests/regression_tests/plot_overlaps/settings.xml create mode 100644 tests/regression_tests/plot_overlaps/test.py diff --git a/tests/regression_tests/plot_overlaps/__init__.py b/tests/regression_tests/plot_overlaps/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/plot_overlaps/geometry.xml b/tests/regression_tests/plot_overlaps/geometry.xml new file mode 100644 index 000000000..7a9f1fb41 --- /dev/null +++ b/tests/regression_tests/plot_overlaps/geometry.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/regression_tests/plot_overlaps/materials.xml b/tests/regression_tests/plot_overlaps/materials.xml new file mode 100644 index 000000000..90b354267 --- /dev/null +++ b/tests/regression_tests/plot_overlaps/materials.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/regression_tests/plot_overlaps/plots.xml b/tests/regression_tests/plot_overlaps/plots.xml new file mode 100644 index 000000000..28064f58f --- /dev/null +++ b/tests/regression_tests/plot_overlaps/plots.xml @@ -0,0 +1,35 @@ + + + + + 0. 0. 0. + 25 25 + 200 200 + + + true + + + + 0. 0. 0. + 25 25 + 200 200 + + true + 255 211 0 + + + + 0. 0. 0. + 25 25 + 200 200 + 0 0 0 + + + + 100 100 10 + 0. 0. 0. + 20 20 10 + + + diff --git a/tests/regression_tests/plot_overlaps/results_true.dat b/tests/regression_tests/plot_overlaps/results_true.dat new file mode 100644 index 000000000..1e34f0ecb --- /dev/null +++ b/tests/regression_tests/plot_overlaps/results_true.dat @@ -0,0 +1 @@ +1f962e0dfd63fc540c39faaf16eeb4a725b16c1a82e89972524716ff763d2d9e12f5ae9f50fafd86caeeb0bab54f8501e104ced085378e98cb9d014a357c7544 \ No newline at end of file diff --git a/tests/regression_tests/plot_overlaps/settings.xml b/tests/regression_tests/plot_overlaps/settings.xml new file mode 100644 index 000000000..adf256d2d --- /dev/null +++ b/tests/regression_tests/plot_overlaps/settings.xml @@ -0,0 +1,13 @@ + + + + plot + + + 5 4 3 + -10 -10 -10 + 10 10 10 + + 1 + + diff --git a/tests/regression_tests/plot_overlaps/test.py b/tests/regression_tests/plot_overlaps/test.py new file mode 100644 index 000000000..4e5b6caa4 --- /dev/null +++ b/tests/regression_tests/plot_overlaps/test.py @@ -0,0 +1,63 @@ +import glob +import hashlib +import os + +import h5py +import openmc + +from tests.testing_harness import TestHarness +from tests.regression_tests import config + + +class PlotTestHarness(TestHarness): + """Specialized TestHarness for running OpenMC plotting tests.""" + def __init__(self, plot_names): + super().__init__(None) + self._plot_names = plot_names + + def _run_openmc(self): + openmc.plot_geometry(openmc_exec=config['exe']) + + + + def _test_output_created(self): + """Make sure *.ppm has been created.""" + for fname in self._plot_names: + assert os.path.exists(fname), 'Plot output file does not exist.' + + def _cleanup(self): + super()._cleanup() + for fname in self._plot_names: + if os.path.exists(fname): + os.remove(fname) + + def _get_results(self): + """Return a string hash of the plot files.""" + outstr = bytes() + + for fname in self._plot_names: + if fname.endswith('.ppm'): + # Add PPM output to results + with open(fname, 'rb') as fh: + outstr += fh.read() + elif fname.endswith('.h5'): + # Add voxel data to results + with h5py.File(fname, 'r') as fh: + outstr += fh.attrs['filetype'] + outstr += fh.attrs['num_voxels'].tostring() + outstr += fh.attrs['lower_left'].tostring() + outstr += fh.attrs['voxel_width'].tostring() + outstr += fh['data'].value.tostring() + + # Hash the information and return. + sha512 = hashlib.sha512() + sha512.update(outstr) + outstr = sha512.hexdigest() + + return outstr + + +def test_plot(): + harness = PlotTestHarness(('plot_1.ppm', 'plot_2.ppm', 'plot_3.ppm', + 'plot_4.h5')) + harness.main() From 2d4c9934b7c1f43b5430f4f9b361f2fb94060b4f Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 12 Jun 2019 16:50:44 -0500 Subject: [PATCH 09/24] Small change in spacing. --- openmc/plots.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openmc/plots.py b/openmc/plots.py index 3c810fcf6..f88d35153 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -678,7 +678,6 @@ class Plot(IDManagerMixin): color = self._overlap_color if isinstance(color, str): color = _SVG_COLORS[color.lower()] - subelement = ET.SubElement(element, "overlap_color") subelement.text = ' '.join(str(x) for x in color) From 489b35c90a07c495c3fcbfa6b98b66dafb8216fa Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 22:35:41 -0500 Subject: [PATCH 10/24] Update src/plot.cpp Co-Authored-By: Paul Romano --- src/plot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plot.cpp b/src/plot.cpp index 60c39389f..e9069a0d0 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -33,7 +33,7 @@ const RGBColor RED {255, 0, 0}; constexpr int PLOT_LEVEL_LOWEST {-1}; //!< lower bound on plot universe level constexpr int32_t NOT_FOUND {-2}; -constexpr int32_t OVERLAP{-3}; +constexpr int32_t OVERLAP {-3}; IdData::IdData(size_t h_res, size_t v_res) : data_({v_res, h_res, 2}, NOT_FOUND) From 317781949508175ca78da62a09d9df1f04a4435b Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 22:35:52 -0500 Subject: [PATCH 11/24] Update openmc/capi/plot.py Co-Authored-By: Paul Romano --- openmc/capi/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/capi/plot.py b/openmc/capi/plot.py index 375660b38..4e62a181d 100644 --- a/openmc/capi/plot.py +++ b/openmc/capi/plot.py @@ -196,7 +196,7 @@ class _PlotBase(Structure): "Basis: {}".format(self.basis), "HRes: {}".format(self.h_res), "VRes: {}".format(self.v_res), - "Color Ovrelaps: {}".format(self.color_overlaps), + "Color Overlaps: {}".format(self.color_overlaps), "Level: {}".format(self.level)] return '\n'.join(out_str) From 5e323539ff8e95c48384230325e296e5642e68a5 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 22:36:00 -0500 Subject: [PATCH 12/24] Update include/openmc/plot.h Co-Authored-By: Paul Romano --- include/openmc/plot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index e08e62d5f..061c366f7 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -112,7 +112,7 @@ public: Position width_; //!< Plot width in geometry PlotBasis basis_; //!< Plot basis (XY/XZ/YZ) std::array pixels_; //!< Plot size in pixels - bool color_overlaps_; + bool color_overlaps_; //!< Show overlapping cells? int level_; //!< Plot universe level }; From 235b662775e4ff5483160d33e4a9cee6443da2ae Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 22:36:14 -0500 Subject: [PATCH 13/24] Update include/openmc/geometry.h Co-Authored-By: Paul Romano --- include/openmc/geometry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/openmc/geometry.h b/include/openmc/geometry.h index 0ceaab104..e386348c4 100644 --- a/include/openmc/geometry.h +++ b/include/openmc/geometry.h @@ -47,7 +47,7 @@ inline bool coincident(double d1, double d2) { //! Check for overlapping cells at a particle's position. //============================================================================== - bool check_cell_overlap(Particle* p, bool error=true); +bool check_cell_overlap(Particle* p, bool error=true); //============================================================================== //! Locate a particle in the geometry tree and set its geometry data fields. From 2c6aa62977eda0cc80848514901908d21db3e50d Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 22:38:45 -0500 Subject: [PATCH 14/24] Correcting indentation. --- src/geometry.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/geometry.cpp b/src/geometry.cpp index ce118c0e0..a92a4d34e 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -46,11 +46,11 @@ bool check_cell_overlap(Particle* p, bool error) if (c.contains(p->coord_[j].r, p->coord_[j].u, p->surface_)) { 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); + 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; } From 8d1098400cfd966f3dfd26faa3e59b76d8262904 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 22:39:58 -0500 Subject: [PATCH 15/24] PEP8 corrections to plot overlap test. --- tests/regression_tests/plot_overlaps/test.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/regression_tests/plot_overlaps/test.py b/tests/regression_tests/plot_overlaps/test.py index 4e5b6caa4..bfaef019c 100644 --- a/tests/regression_tests/plot_overlaps/test.py +++ b/tests/regression_tests/plot_overlaps/test.py @@ -18,8 +18,6 @@ class PlotTestHarness(TestHarness): def _run_openmc(self): openmc.plot_geometry(openmc_exec=config['exe']) - - def _test_output_created(self): """Make sure *.ppm has been created.""" for fname in self._plot_names: From daf129f1ec4affea4c1ee38da3e85fa41561d188 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 22:44:58 -0500 Subject: [PATCH 16/24] Initializing overlap color in the class constructor. --- src/plot.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plot.cpp b/src/plot.cpp index e9069a0d0..93d0abaf2 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -661,7 +661,6 @@ void Plot::set_overlap_color(pugi::xml_node plot_node) { color_overlaps_ = false; if (check_for_node(plot_node, "show_overlaps")) { color_overlaps_ = get_node_value_bool(plot_node, "show_overlaps"); - overlap_color_ = RED; // check for custom overlap color if (check_for_node(plot_node, "overlap_color")) { if (!color_overlaps_) { @@ -690,7 +689,7 @@ void Plot::set_overlap_color(pugi::xml_node plot_node) { } Plot::Plot(pugi::xml_node plot_node) - : index_meshlines_mesh_{-1} + : index_meshlines_mesh_{-1}, overlap_color_{RED} { set_id(plot_node); set_type(plot_node); From 89c0d06b3059217c0c30e2f903aea6827132c355 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 23:09:26 -0500 Subject: [PATCH 17/24] Moving a few defaults into the class def. --- include/openmc/plot.h | 11 ++++++++--- src/plot.cpp | 5 ----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 061c366f7..da83f42aa 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -57,6 +57,11 @@ struct RGBColor { uint8_t red, green, blue; }; +// some default colors +const RGBColor WHITE {255, 255, 255}; +const RGBColor RED {255, 0, 0}; + + typedef xt::xtensor ImageData; struct IdData { @@ -218,10 +223,10 @@ public: PlotType type_; //!< Plot type (Slice/Voxel) PlotColorBy color_by_; //!< Plot coloring (cell/material) int meshlines_width_; //!< Width of lines added to the plot - int index_meshlines_mesh_; //!< Index of the mesh to draw on the plot + int index_meshlines_mesh_ {-1}; //!< Index of the mesh to draw on the plot RGBColor meshlines_color_; //!< Color of meshlines on the plot - RGBColor not_found_; //!< Plot background color - RGBColor overlap_color_; //!< Plot overlap color + RGBColor not_found_ {WHITE}; //!< Plot background color + RGBColor overlap_color_ {RED}; //!< Plot overlap color std::vector colors_; //!< Plot colors std::string path_plot_; //!< Plot output filename }; diff --git a/src/plot.cpp b/src/plot.cpp index 93d0abaf2..4dd62fbed 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -28,8 +28,6 @@ namespace openmc { // Constants //============================================================================== -const RGBColor WHITE {255, 255, 255}; -const RGBColor RED {255, 0, 0}; constexpr int PLOT_LEVEL_LOWEST {-1}; //!< lower bound on plot universe level constexpr int32_t NOT_FOUND {-2}; @@ -291,9 +289,6 @@ Plot::set_bg_color(pugi::xml_node plot_node) << id_; fatal_error(err_msg); } - } else { - // default to a white background - not_found_ = WHITE; } } From 36b4fbad1262f538fb8d30b18b8f4b0db3b67d54 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 13 Jun 2019 23:25:33 -0500 Subject: [PATCH 18/24] Adding check color function to replace duplicate code. --- openmc/plots.py | 55 +++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/openmc/plots.py b/openmc/plots.py index f88d35153..70afb7fd7 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -357,15 +357,7 @@ class Plot(IDManagerMixin): @background.setter def background(self, background): - cv.check_type('plot background', background, Iterable) - if isinstance(background, str): - if background.lower() not in _SVG_COLORS: - raise ValueError("'{}' is not a valid color.".format(background)) - else: - cv.check_length('plot background', background, 3) - for rgb in background: - cv.check_greater_than('plot background', rgb, 0, True) - cv.check_less_than('plot background', rgb, 256) + self.check_color('plot background', background) self._background = background @colors.setter @@ -373,17 +365,7 @@ class Plot(IDManagerMixin): cv.check_type('plot colors', colors, Mapping) for key, value in colors.items(): cv.check_type('plot color key', key, (openmc.Cell, openmc.Material)) - cv.check_type('plot color value', value, Iterable) - if isinstance(value, str): - if value.lower() not in _SVG_COLORS: - raise ValueError("'{}' is not a valid color.".format(value)) - else: - cv.check_length('plot color (RGB)', value, 3) - for component in value: - cv.check_type('RGB component', component, Real) - cv.check_greater_than('RGB component', component, 0, True) - cv.check_less_than('RGB component', component, 255, True) - + self.check_color('plot color value', value) self._colors = colors @mask_components.setter @@ -394,15 +376,7 @@ class Plot(IDManagerMixin): @mask_background.setter def mask_background(self, mask_background): - cv.check_type('plot mask background', mask_background, Iterable) - if isinstance(mask_background, str): - if mask_background.lower() not in _SVG_COLORS: - raise ValueError("'{}' is not a valid color.".format(mask_background)) - else: - cv.check_length('plot mask_background', mask_background, 3) - for rgb in mask_background: - cv.check_greater_than('plot mask background', rgb, 0, True) - cv.check_less_than('plot mask background', rgb, 256) + self.check_color('plot mask background', mask_background) self._mask_background = mask_background @show_overlaps.setter @@ -413,15 +387,7 @@ class Plot(IDManagerMixin): @overlap_color.setter def overlap_color(self, overlap_color): - cv.check_type('plot overlap color', overlap_color, Iterable) - if isinstance(overlap_color, str): - if overlap_color.lower() not in _SVG_COLORS: - raise ValueError("'{}' is not a valid color.".format(overlap_color)) - else: - cv.check_length('plot overlap color', overlap_color, 3) - for rgb in overlap_color: - cv.check_greater_than('plot overlap color', rgb, 0, True) - cv.check_less_than('plot overlap color', rgb, 256) + self.check_color('plot overlap color', overlap_color) self._overlap_color = overlap_color @level.setter @@ -463,6 +429,19 @@ class Plot(IDManagerMixin): self._meshlines = meshlines + @staticmethod + def check_color(err_string, color): + cv.check_type(err_string, color, Iterable) + if isinstance(color, str): + if color.lower() not in _SVG_COLORS: + raise ValueError("'{}' is not a valid color.".format(color)) + else: + cv.check_length(err_string, color, 3) + for rgb in color: + cv.check_type(err_string, rgb, Real) + cv.check_greater_than('RGB component', rgb, 0, True) + cv.check_less_than('RGB component', rgb, 256) + def __repr__(self): string = 'Plot\n' string += '{: <16}=\t{}\n'.format('\tID', self._id) From 48959ab84c502eeb63173d1ca6ffdc3ed2a1eccd Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 14 Jun 2019 09:48:21 -0500 Subject: [PATCH 19/24] Updating test name --- tests/regression_tests/plot_overlaps/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/regression_tests/plot_overlaps/test.py b/tests/regression_tests/plot_overlaps/test.py index bfaef019c..d8c0943cf 100644 --- a/tests/regression_tests/plot_overlaps/test.py +++ b/tests/regression_tests/plot_overlaps/test.py @@ -55,7 +55,7 @@ class PlotTestHarness(TestHarness): return outstr -def test_plot(): +def test_plot_overlap(): harness = PlotTestHarness(('plot_1.ppm', 'plot_2.ppm', 'plot_3.ppm', 'plot_4.h5')) harness.main() From 4256e031c3912d46cf7540ca1ef822b3b130866a Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 14 Jun 2019 09:57:08 -0500 Subject: [PATCH 20/24] Applying internal color check to meshlines. --- openmc/plots.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/openmc/plots.py b/openmc/plots.py index 70afb7fd7..b4712c902 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -357,7 +357,7 @@ class Plot(IDManagerMixin): @background.setter def background(self, background): - self.check_color('plot background', background) + self._check_color('plot background', background) self._background = background @colors.setter @@ -365,7 +365,7 @@ class Plot(IDManagerMixin): cv.check_type('plot colors', colors, Mapping) for key, value in colors.items(): cv.check_type('plot color key', key, (openmc.Cell, openmc.Material)) - self.check_color('plot color value', value) + self._check_color('plot color value', value) self._colors = colors @mask_components.setter @@ -376,7 +376,7 @@ class Plot(IDManagerMixin): @mask_background.setter def mask_background(self, mask_background): - self.check_color('plot mask background', mask_background) + self._check_color('plot mask background', mask_background) self._mask_background = mask_background @show_overlaps.setter @@ -387,7 +387,7 @@ class Plot(IDManagerMixin): @overlap_color.setter def overlap_color(self, overlap_color): - self.check_color('plot overlap color', overlap_color) + self._check_color('plot overlap color', overlap_color) self._overlap_color = overlap_color @level.setter @@ -420,17 +420,12 @@ class Plot(IDManagerMixin): 0, equality=True) if 'color' in meshlines: - cv.check_type('plot meshlines color', meshlines['color'], Iterable, - Integral) - cv.check_length('plot meshlines color', meshlines['color'], 3) - for rgb in meshlines['color']: - cv.check_greater_than('plot meshlines color', rgb, 0, True) - cv.check_less_than('plot meshlines color', rgb, 256) + self._check_color('plot meshlines color', meshlines['color']) self._meshlines = meshlines @staticmethod - def check_color(err_string, color): + def _check_color(err_string, color): cv.check_type(err_string, color, Iterable) if isinstance(color, str): if color.lower() not in _SVG_COLORS: From 7096b4463367684a54438f2cefad87b83d615572 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 14 Jun 2019 12:36:45 -0500 Subject: [PATCH 21/24] Updating test results after rebase to account for changes in develop. --- tests/regression_tests/plot_overlaps/results_true.dat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/regression_tests/plot_overlaps/results_true.dat b/tests/regression_tests/plot_overlaps/results_true.dat index 1e34f0ecb..a2afd4c35 100644 --- a/tests/regression_tests/plot_overlaps/results_true.dat +++ b/tests/regression_tests/plot_overlaps/results_true.dat @@ -1 +1 @@ -1f962e0dfd63fc540c39faaf16eeb4a725b16c1a82e89972524716ff763d2d9e12f5ae9f50fafd86caeeb0bab54f8501e104ced085378e98cb9d014a357c7544 \ No newline at end of file +e67f7737b49af347a617bfdeebebc3288bd85050f33c9208403f3dfb4625a42f63f3396ecb2517ed9214c3e4e68c9038a8f9a7b3e27a414565c5580827dbb6e6 \ No newline at end of file From c7950cba00915ec13b0f929cf523a429a3761fb9 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 15 Jun 2019 12:14:49 -0500 Subject: [PATCH 22/24] Adding overlaps property to capi PlotBase. --- openmc/capi/plot.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openmc/capi/plot.py b/openmc/capi/plot.py index 4e62a181d..c4bff4cb3 100644 --- a/openmc/capi/plot.py +++ b/openmc/capi/plot.py @@ -90,6 +90,7 @@ class _PlotBase(Structure): def __init__(self): self.level_ = -1 + self.color_overlaps_ = False @property def origin(self): @@ -152,6 +153,14 @@ class _PlotBase(Structure): def level(self): return int(self.level_) + @property + def color_overlaps(self): + return self.color_overlaps_ + + @color_overlaps.setter + def color_overlaps(self, color_overlaps): + self.color_overlaps_ = color_overlaps + @origin.setter def origin(self, origin): self.origin_.x = origin[0] From 42627cfce4ca98f63bde06287636de23db1ab085 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sun, 16 Jun 2019 16:10:29 -0500 Subject: [PATCH 23/24] Resizing overlap plot counters if plot is asking for overlap plotting. --- src/plot.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plot.cpp b/src/plot.cpp index 4dd62fbed..106f17867 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -969,11 +969,17 @@ extern "C" int openmc_id_map(const void* plot, int32_t* data_out) return OPENMC_E_INVALID_ARGUMENT; } + if (plt->color_overlaps_ && model::overlap_check_count.size() == 0) { + model::overlap_check_count.resize(model::cells.size()); + } + + std::cout << "About to get ids" << std::endl; auto ids = plt->get_map(); + std::cout << "About to copy data" << std::endl; // write id data to array std::copy(ids.data_.begin(), ids.data_.end(), data_out); - + std::cout << "About to return" << std::endl; return 0; } @@ -985,6 +991,10 @@ extern "C" int openmc_property_map(const void* plot, double* data_out) { return OPENMC_E_INVALID_ARGUMENT; } + if (plt->color_overlaps_ && model::overlap_check_count.size() == 0) { + model::overlap_check_count.resize(model::cells.size()); + } + auto props = plt->get_map(); // write id data to array From 71957b24b8aa71a9d70d858f6e763ef4b163df75 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sun, 16 Jun 2019 20:59:37 -0500 Subject: [PATCH 24/24] Removing some hasty comments. --- src/plot.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plot.cpp b/src/plot.cpp index 106f17867..98a3645c7 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -973,13 +973,11 @@ extern "C" int openmc_id_map(const void* plot, int32_t* data_out) model::overlap_check_count.resize(model::cells.size()); } - std::cout << "About to get ids" << std::endl; auto ids = plt->get_map(); - std::cout << "About to copy data" << std::endl; // write id data to array std::copy(ids.data_.begin(), ids.data_.end(), data_out); - std::cout << "About to return" << std::endl; + return 0; }