More updates based on PR comments.

This commit is contained in:
Patrick Shriwise 2018-10-29 15:06:27 -05:00
parent 29e493bcfb
commit 2aa3437cc0
5 changed files with 16 additions and 14 deletions

View file

@ -24,7 +24,7 @@ extern int PLOT_LEVEL_LOWEST; //!< lower bound on plot universe level
extern std::map<int, int> plot_map; //!< map of plot ids to index
extern int n_plots; //!< number of plots in openmc run
extern "C" int32_t n_plots; //!< number of plots in openmc run
class Plot;
extern std::vector<Plot> plots; //!< Plot instance container
@ -153,11 +153,11 @@ extern "C" void read_plots(pugi::xml_node* plot_node);
//! Create a ppm image for a plot object
//! \param[in] plot object
extern "C" void create_ppm(Plot pl);
void create_ppm(Plot pl);
//! Create an hdf5 voxel file for a plot object
//! \param[in] plot object
extern "C" void create_voxel(Plot pl);
void create_voxel(Plot pl);
} // namespace openmc

View file

@ -9,7 +9,6 @@
#include "pugixml.hpp"
#include "xtensor/xarray.hpp"
#include "xtensor/xadapt.hpp"
#include "openmc/string_functions.h"
namespace openmc {

View file

@ -204,16 +204,17 @@ Plot::set_output_path(pugi::xml_node plot_node)
if (check_for_node(plot_node, "filename")) {
filename << get_node_value(plot_node, "filename");
} else {
switch(type) {
case plot_type::slice:
filename << ".ppm";
break;
case plot_type::voxel:
filename << ".h5";
break;
}
}
// add appropriate file extension to name
switch(type) {
case plot_type::slice:
filename << ".ppm";
break;
case plot_type::voxel:
filename << ".h5";
break;
}
path_plot = filename.str();
// Copy plot pixel size
@ -972,6 +973,7 @@ void create_voxel(Plot pl)
// Write to HDF5 dataset
voxel_write_slice(x, dspace, dset, memspace, &(data[0]));
}
delete p;
voxel_finalize(dspace, dset, memspace);
file_close(file_id);

View file

@ -8,7 +8,7 @@
#include "openmc/error.h"
#include "openmc/hdf5_interface.h"
#include "openmc/xml_interface.h"
#include "openmc/string_functions.h"
namespace openmc {

View file

@ -3,6 +3,7 @@
#include <algorithm> // for transform
#include <sstream>
#include "openmc/string_functions.h"
#include "openmc/error.h"