diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 346dd0912..da9b33097 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -106,21 +106,20 @@ public: //! Add mesh lines to image data of a plot object //! \param[in] plot object //! \param[out] image data associated with the plot object -void draw_mesh_lines(Plot pl, - ImageData &data); +void draw_mesh_lines(Plot pl, ImageData &data); //! Write a ppm image to file using a plot object's image data //! \param[in] plot object //! \param[out] image data associated with the plot object void output_ppm(Plot pl, - const ImageData &data); + const ImageData& data); //! Get the rgb color for a given particle position in a plot //! \param[in] particle with position for current pixel //! \param[in] plot object //! \param[out] rgb color //! \param[out] cell or material id for particle position -void position_rgb(Particle p, Plot pl, RGBColor &rgb, int &id); +void position_rgb(Particle p, Plot pl, RGBColor& rgb, int& id); //! Initialize a voxel file //! \param[in] id of an open hdf5 file diff --git a/src/output.cpp b/src/output.cpp index 0277ec701..79800e21a 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -36,7 +36,7 @@ header(const char* msg, int level) { // Print header based on verbosity level. if (settings::verbosity >= level) { - std::cout << out.str() << std::endl << std::endl; + std::cout << out.str() << "\n\n"; } } @@ -64,64 +64,64 @@ void print_plot() { for (auto pl : plots) { // Plot id - std::cout << "Plot ID: " << pl.id_ << std::endl; + std::cout << "Plot ID: " << pl.id_ << "\n"; // Plot filename - std::cout << "Plot file: " << pl.path_plot_ << std::endl; + std::cout << "Plot file: " << pl.path_plot_ << "\n"; // Plot level - std::cout << "Universe depth: " << pl.level_ << std::endl; + std::cout << "Universe depth: " << pl.level_ << "\n"; // Plot type if (PlotType::slice == pl.type_) { - std::cout << "Plot Type: Slice" << std::endl; + std::cout << "Plot Type: Slice" << "\n"; } else if (PlotType::voxel == pl.type_) { - std::cout << "Plot Type: Voxel" << std::endl; + std::cout << "Plot Type: Voxel" << "\n"; } // Plot parameters std::cout << "Origin: " << pl.origin_[0] << " " << pl.origin_[1] << " " - << pl.origin_[2] << std::endl; + << pl.origin_[2] << "\n"; if (PlotType::slice == pl.type_) { std::cout << std::setprecision(4) << "Width: " << pl.width_[0] << " " - << pl.width_[1] << std::endl; + << pl.width_[1] << "\n"; } else if (PlotType::voxel == pl.type_) { std::cout << std::setprecision(4) << "Width: " << pl.width_[0] << " " << pl.width_[1] << " " - << pl.width_[2] << std::endl; + << pl.width_[2] << "\n"; } if (PlotColorBy::cells == pl.color_by_) { - std::cout << "Coloring: Cells" << std::endl; + std::cout << "Coloring: Cells" << "\n"; } else if (PlotColorBy::mats == pl.color_by_) { - std::cout << "Coloring: Materials" << std::endl; + std::cout << "Coloring: Materials" << "\n"; } if (PlotType::slice == pl.type_) { switch(pl.basis_) { case PlotBasis::xy: - std::cout << "Basis: XY" << std::endl; + std::cout << "Basis: XY" << "\n"; break; case PlotBasis::xz: - std::cout << "Basis: XZ" << std::endl; + std::cout << "Basis: XZ" << "\n"; break; case PlotBasis::yz: - std::cout << "Basis: YZ" << std::endl; + std::cout << "Basis: YZ" << "\n"; break; } std::cout << "Pixels: " << pl.pixels_[0] << " " - << pl.pixels_[1] << " " << std::endl; + << pl.pixels_[1] << " " << "\n"; } else if (PlotType::voxel == pl.type_) { std::cout << "Voxels: " << pl.pixels_[0] << " " << pl.pixels_[1] << " " - << pl.pixels_[2] << std::endl; + << pl.pixels_[2] << "\n"; } - std::cout << std::endl; + std::cout << "\n"; } } diff --git a/src/plot.cpp b/src/plot.cpp index 69e7d9e32..f27832486 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -756,9 +756,9 @@ void output_ppm(Plot pl, const ImageData &data) of.open(fname); // Write header - of << "P6" << std::endl; - of << pl.pixels_[0] << " " << pl.pixels_[1] << std::endl; - of << "255" << std::endl; + of << "P6" << "\n"; + of << pl.pixels_[0] << " " << pl.pixels_[1] << "\n"; + of << "255" << "\n"; of.close(); of.open(fname, std::ios::binary | std::ios::app); @@ -773,7 +773,7 @@ void output_ppm(Plot pl, const ImageData &data) } // Close file // THIS IS HERE TO MATCH FORTRAN VERSION, NOT TECHNICALLY NECESSARY - of << std::endl; + of << "\n"; of.close(); } diff --git a/src/progress_bar.cpp b/src/progress_bar.cpp index f412793c9..44a7e2496 100644 --- a/src/progress_bar.cpp +++ b/src/progress_bar.cpp @@ -11,22 +11,15 @@ #define BAR_WIDTH 72 -#ifdef UNIX -int check_isatty(int fd) { - return isatty(fd); -} -#endif - bool is_terminal() { #ifdef UNIX - return check_isatty(STDOUT_FILENO) != 0; + return isatty(STDOUT_FILENO) != 0; #else return false; #endif } ProgressBar::ProgressBar() { - bar = ""; // initialize bar set_value(0.0); }