diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 0c5a24484..25bb1f4d2 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -29,7 +29,13 @@ extern int n_plots; //!< number of plots in openmc run class Plot; extern std::vector plots; //!< Plot instance container -typedef std::vector>> ImageData; +//=============================================================================== +// RGBColor holds color information for plotted objects +//=============================================================================== + +typedef std::array RGBColor; + +typedef std::vector> ImageData; enum class plot_type { slice = 1, @@ -46,12 +52,6 @@ enum class plot_color_by { cells = 1, mats = 2 }; - -//=============================================================================== -// RGBColor holds color information for plotted objects -//=============================================================================== - -typedef std::array RGBColor; //=============================================================================== // Plot class diff --git a/src/plot.cpp b/src/plot.cpp index 89bd936d6..4cd8d1613 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -95,9 +95,6 @@ void create_ppm(Plot* pl) data.resize(width); for (auto & i : data) { i.resize(height); - for (auto & j : i) { - j.resize(3); - } } int in_i, out_i; @@ -772,7 +769,7 @@ void output_ppm(Plot* pl, const ImageData &data) // Write color for each pixel for (int y = 0; y < pl->pixels[1]; y++) { for (int x = 0; x < pl->pixels[0]; x++) { - std::vector rgb = data[x][y]; + RGBColor rgb = data[x][y]; of.write((char*)&rgb[RED], 1); of.write((char*)&rgb[GREEN], 1); of.write((char*)&rgb[BLUE], 1); @@ -790,7 +787,7 @@ void output_ppm(Plot* pl, const ImageData &data) void draw_mesh_lines(Plot *pl, ImageData &data) { - std::vector rgb; rgb.resize(3); + RGBColor rgb; rgb[RED] = pl->meshlines_color[RED]; rgb[GREEN] = pl->meshlines_color[GREEN]; rgb[BLUE] = pl->meshlines_color[BLUE];