mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Trailing whitespace removal.
This commit is contained in:
parent
8485b39d7e
commit
dc3a7e726f
3 changed files with 16 additions and 21 deletions
|
|
@ -36,7 +36,7 @@ struct RGBColor {
|
|||
RGBColor() : red(0), green(0), blue(0) { };
|
||||
RGBColor(const int v[3]) : red(v[0]), green(v[1]), blue(v[2]) { };
|
||||
RGBColor(int r, int g, int b) : red(r), green(g), blue(b) { };
|
||||
|
||||
|
||||
RGBColor(const std::vector<int> &v) {
|
||||
if (v.size() != 3) {
|
||||
throw std::out_of_range("Incorrect vector size for RGBColor.");
|
||||
|
|
@ -49,7 +49,7 @@ struct RGBColor {
|
|||
// Members
|
||||
uint8_t red, green, blue;
|
||||
};
|
||||
|
||||
|
||||
typedef xt::xtensor<RGBColor, 2> ImageData;
|
||||
|
||||
enum class PlotType {
|
||||
|
|
@ -67,7 +67,7 @@ enum class PlotColorBy {
|
|||
cells = 1,
|
||||
mats = 2
|
||||
};
|
||||
|
||||
|
||||
//===============================================================================
|
||||
// Plot class
|
||||
//===============================================================================
|
||||
|
|
@ -176,6 +176,6 @@ void create_voxel(Plot pl);
|
|||
//! \return RGBColor with random value
|
||||
RGBColor random_color();
|
||||
|
||||
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_PLOT_H
|
||||
|
|
|
|||
19
src/plot.cpp
19
src/plot.cpp
|
|
@ -22,7 +22,7 @@ namespace openmc {
|
|||
//==============================================================================
|
||||
// Global variables
|
||||
//==============================================================================
|
||||
|
||||
|
||||
int PLOT_LEVEL_LOWEST = -1;
|
||||
|
||||
std::unordered_map<int, int> plot_map;
|
||||
|
|
@ -241,7 +241,7 @@ Plot::set_bg_color(pugi::xml_node plot_node)
|
|||
{
|
||||
// Copy plot background color
|
||||
if (check_for_node(plot_node, "background")) {
|
||||
std::vector<int> bg_rgb = get_node_array<int>(plot_node, "background");
|
||||
std::vector<int> bg_rgb = get_node_array<int>(plot_node, "background");
|
||||
if (PlotType::voxel == type_) {
|
||||
if (openmc_master) {
|
||||
std::stringstream err_msg;
|
||||
|
|
@ -391,7 +391,7 @@ Plot::set_user_colors(pugi::xml_node plot_node)
|
|||
warning(err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (auto cn : plot_node.children("color")) {
|
||||
// Make sure 3 values are specified for RGB
|
||||
std::vector<int> user_rgb = get_node_array<int>(cn, "rgb");
|
||||
|
|
@ -549,7 +549,7 @@ Plot::set_mask(pugi::xml_node plot_node)
|
|||
{
|
||||
// Deal with masks
|
||||
pugi::xpath_node_set mask_nodes = plot_node.select_nodes("mask");
|
||||
|
||||
|
||||
if (!mask_nodes.empty()) {
|
||||
if (PlotType::voxel == type_) {
|
||||
if (openmc_master) {
|
||||
|
|
@ -564,7 +564,7 @@ Plot::set_mask(pugi::xml_node plot_node)
|
|||
pugi::xml_node mask_node = mask_nodes[0].node();
|
||||
|
||||
// Determine how many components there are and allocate
|
||||
std::vector<int> iarray = get_node_array<int>(mask_node, "components");
|
||||
std::vector<int> iarray = get_node_array<int>(mask_node, "components");
|
||||
if (iarray.size() == 0) {
|
||||
std::stringstream err_msg;
|
||||
err_msg << "Missing <components> in mask of plot " << id_;
|
||||
|
|
@ -748,7 +748,7 @@ void draw_mesh_lines(Plot pl, ImageData& data)
|
|||
xyz_ur_plot[0] = pl.origin_[0];
|
||||
xyz_ur_plot[1] = pl.origin_[1];
|
||||
xyz_ur_plot[2] = pl.origin_[2];
|
||||
|
||||
|
||||
xyz_ll_plot[outer] = pl.origin_[outer] - pl.width_[0] / 2.;
|
||||
xyz_ll_plot[inner] = pl.origin_[inner] - pl.width_[1] / 2.;
|
||||
xyz_ur_plot[outer] = pl.origin_[outer] + pl.width_[0] / 2.;
|
||||
|
|
@ -961,12 +961,7 @@ voxel_finalize(hid_t dspace, hid_t dset, hid_t memspace)
|
|||
}
|
||||
|
||||
RGBColor random_color() {
|
||||
RGBColor rgb;
|
||||
rgb.red = int(prn()*255);
|
||||
rgb.green = int(prn()*255);
|
||||
rgb.blue = int(prn()*255);
|
||||
return rgb;
|
||||
// return {int(prn()*255), int(prn()*255), int(prn()*255)};
|
||||
return {int(prn()*255), int(prn()*255), int(prn()*255)};
|
||||
}
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ void
|
|||
ProgressBar::set_value(double val) {
|
||||
|
||||
if (!is_terminal()) return;
|
||||
|
||||
|
||||
// set the bar percentage
|
||||
if (val >= 100.0) {
|
||||
bar.append("100");
|
||||
|
|
@ -43,12 +43,12 @@ ProgressBar::set_value(double val) {
|
|||
bar.append("% |");
|
||||
// remaining width of the bar
|
||||
int remaining_width = BAR_WIDTH - bar.size() - 2;
|
||||
|
||||
|
||||
// set the bar width
|
||||
if (val >= 100.0) {
|
||||
bar.append(remaining_width, '=');
|
||||
} else if (val < 0.0) {
|
||||
bar.append(remaining_width, ' ');
|
||||
bar.append(remaining_width, ' ');
|
||||
} else {
|
||||
int width = (int)((double)remaining_width*val/100);
|
||||
bar.append(width, '=');
|
||||
|
|
@ -57,11 +57,11 @@ ProgressBar::set_value(double val) {
|
|||
}
|
||||
|
||||
bar.append("|+");
|
||||
|
||||
|
||||
// write the bar
|
||||
std::cout << '\r' << bar << std::flush;
|
||||
if (val >= 100.0) { std::cout << "\n"; }
|
||||
|
||||
|
||||
// reset the bar value
|
||||
bar = "";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue