From 2e2ec4a4121b1fa12754b9f3393b804710161597 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 18 Mar 2019 14:47:44 -0500 Subject: [PATCH] Addressing narrowing warning. --- include/openmc/plot.h | 6 +++--- src/plot.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 91ac9ec20..12f5cfab9 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -57,7 +57,7 @@ typedef xt::xtensor ImageData; struct IdData { // Constructor - IdData(int h_res, int v_res); + IdData(size_t h_res, size_t v_res); // Methods void set_value(int y, int x, const Particle& p, int level); @@ -68,7 +68,7 @@ struct IdData { struct PropertyData { // Constructor - PropertyData(int h_res, int v_res); + PropertyData(size_t h_res, size_t v_res); // Methods void set_value(int y, int x, const Particle& p, int level); @@ -105,7 +105,7 @@ public: Position origin_; //!< Plot origin in geometry Position width_; //!< Plot width in geometry PlotBasis basis_; //!< Plot basis (XY/XZ/YZ) - std::array pixels_; //!< Plot size in pixels + std::array pixels_; //!< Plot size in pixels int level_; //!< Plot universe level }; diff --git a/src/plot.cpp b/src/plot.cpp index 0d43d1b8d..ba769d611 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -31,7 +31,7 @@ const RGBColor WHITE {255, 255, 255}; constexpr int PLOT_LEVEL_LOWEST {-1}; //!< lower bound on plot universe level constexpr int32_t NOT_FOUND {-2}; -IdData::IdData(int h_res, int v_res) +IdData::IdData(size_t h_res, size_t v_res) : data_({v_res, h_res, 2}, NOT_FOUND) { } @@ -48,7 +48,7 @@ IdData::set_value(int y, int x, const Particle& p, int level) { } } -PropertyData::PropertyData(int h_res, int v_res) +PropertyData::PropertyData(size_t h_res, size_t v_res) : data_({v_res, h_res, 2}, NOT_FOUND) { } @@ -807,7 +807,9 @@ void create_voxel(Plot pl) // Write current date and time write_attribute(file_id, "date_and_time", time_stamp().c_str()); hsize_t three = 3; - write_attribute(file_id, "num_voxels", pl.pixels_); + std::array pixels; + std::copy(pl.pixels_.begin(), pl.pixels_.end(), pixels.begin()); + write_attribute(file_id, "num_voxels", pixels); write_attribute(file_id, "voxel_width", vox); write_attribute(file_id, "lower_left", ll);