From e7ff427b64b71011f2a1415e62ca4be0cf73edcf Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 30 Oct 2018 22:02:53 -0500 Subject: [PATCH] Updating types so write_attributes can be used uniformly. --- include/openmc/plot.h | 2 +- src/plot.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index da9b33097..f0ed3016b 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -89,7 +89,7 @@ public: Position origin_; //!< Plot origin in geometry Position width_; //!< Plot width in geometry PlotBasis basis_; //!< Plot basis (XY/XZ/YZ) - int pixels_[3]; //!< Plot size in pixels + std::array pixels_; //!< Plot size in pixels int meshlines_width_; //!< Width of lines added to the plot int level_; //!< Plot universe level int index_meshlines_mesh_; //!< Index of the mesh to draw on the plot diff --git a/src/plot.cpp b/src/plot.cpp index ca9dd979f..e1cbdb2d1 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -866,13 +866,13 @@ void create_voxel(Plot pl) { // compute voxel widths in each direction - double vox[3]; + std::array vox; vox[0] = pl.width_[0]/(double)pl.pixels_[0]; vox[1] = pl.width_[1]/(double)pl.pixels_[1]; vox[2] = pl.width_[2]/(double)pl.pixels_[2]; // initial particle position - double ll[3]; + std::array ll; ll[0] = pl.origin_[0] - pl.width_[0] / 2.; ll[1] = pl.origin_[1] - pl.width_[1] / 2.; ll[2] = pl.origin_[2] - pl.width_[2] / 2.; @@ -881,8 +881,8 @@ void create_voxel(Plot pl) double dir[3] = {0.5, 0.5, 0.5}; Particle p; p.initialize(); - std::copy(ll, ll + 3, p.coord[0].xyz); - std::copy(dir, dir + 3, p.coord[0].uvw); + std::copy(ll.begin(), ll.begin()+ll.size(), p.coord[0].xyz); + std::copy(dir, dir+3, p.coord[0].uvw); p.coord[0].universe = openmc_root_universe; // Open binary plot file for writing @@ -903,9 +903,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_attr_int(file_id, 1, &three, "num_voxels", pl.pixels_); - write_attr_double(file_id, 1, &three, "voxel_width", vox); - write_attr_double(file_id, 1, &three, "lower_left", ll); + write_attribute(file_id, "num_voxels", pl.pixels_); + write_attribute(file_id, "voxel_width", vox); + write_attribute(file_id, "lower_left", ll); // Create dataset for voxel data -- note that the dimensions are reversed // since we want the order in the file to be z, y, x