From 803f17500c4e148b1b72b27f901bafc2676957db Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 24 Jun 2021 17:05:10 +0700 Subject: [PATCH] Fix use of get_map within plot.cpp and failing properties test --- src/plot.cpp | 5 +++-- tests/unit_tests/test_model.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plot.cpp b/src/plot.cpp index 3e55d1d5f..999cf3d29 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -157,7 +157,8 @@ void create_ppm(Plot const& pl) // assign colors for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x++) { - auto id = ids.data_(y, x, pl.color_by_); + int idx = pl.color_by_ == PlotColorBy::cells ? 0 : 2; + auto id = ids.data_(y, x, idx); // no setting needed if not found if (id == NOT_FOUND) { continue; } if (id == OVERLAP) { @@ -840,7 +841,7 @@ void create_voxel(Plot const& pl) IdData ids = pltbase.get_map(); // select only cell/material ID data and flip the y-axis - int idx = pl.color_by_ == PlotColorBy::cells ? 0 : 1; + int idx = pl.color_by_ == PlotColorBy::cells ? 0 : 2; xt::xtensor data_slice = xt::view(ids.data_, xt::all(), xt::all(), idx); xt::xtensor data_flipped = xt::flip(data_slice, 0); diff --git a/tests/unit_tests/test_model.py b/tests/unit_tests/test_model.py index 5ff3430ea..4b658d5ab 100644 --- a/tests/unit_tests/test_model.py +++ b/tests/unit_tests/test_model.py @@ -7,6 +7,7 @@ def test_import_properties(run_in_tmpdir, mpi_intracomm): """Test importing properties on the Model class """ # Create PWR pin cell model and write XML files + openmc.reset_auto_ids() model = openmc.examples.pwr_pin_cell() model.export_to_xml()