diff --git a/src/initialize.cpp b/src/initialize.cpp index e04ac2922..2250a6ac8 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -210,7 +210,7 @@ parse_command_line(int argc, char* argv[]) } omp_set_num_threads(simulation::n_threads); #else - if (openmc_master) + if (mpi::master) warning("Ignoring number of threads specified on command line."); #endif diff --git a/src/main.cpp b/src/main.cpp index f4e2d3f8e..b757c67ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,13 +1,15 @@ #ifdef OPENMC_MPI -#include "mpi.h" +#include #endif #include "openmc/capi.h" #include "openmc/constants.h" #include "openmc/error.h" +#include "openmc/message_passing.h" #include "openmc/settings.h" int main(int argc, char* argv[]) { + using namespace openmc; int err; // Initialize run -- when run with MPI, pass communicator @@ -21,30 +23,30 @@ int main(int argc, char* argv[]) { // This happens for the -h and -v flags return 0; } else if (err) { - openmc::fatal_error(openmc_err_msg); + fatal_error(openmc_err_msg); } // start problem based on mode - switch (openmc::settings::run_mode) { - case openmc::RUN_MODE_FIXEDSOURCE: - case openmc::RUN_MODE_EIGENVALUE: + switch (settings::run_mode) { + case RUN_MODE_FIXEDSOURCE: + case RUN_MODE_EIGENVALUE: err = openmc_run(); break; - case openmc::RUN_MODE_PLOTTING: + case RUN_MODE_PLOTTING: err = openmc_plot_geometry(); break; - case openmc::RUN_MODE_PARTICLE: - if (openmc_master) err = openmc_particle_restart(); + case RUN_MODE_PARTICLE: + if (mpi::master) err = openmc_particle_restart(); break; - case openmc::RUN_MODE_VOLUME: + case RUN_MODE_VOLUME: err = openmc_calculate_volumes(); break; } - if (err) openmc::fatal_error(openmc_err_msg); + if (err) fatal_error(openmc_err_msg); // Finalize and free up memory err = openmc_finalize(); - if (err) openmc::fatal_error(openmc_err_msg); + if (err) fatal_error(openmc_err_msg); // If MPI is in use and enabled, terminate it #ifdef OPENMC_MPI diff --git a/src/output.cpp b/src/output.cpp index 79800e21a..13db31144 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -51,7 +51,7 @@ std::string time_stamp() << ":" << now->tm_min << ":" << now->tm_sec; return ts.str(); } - + //============================================================================== //=============================================================================== @@ -74,7 +74,7 @@ void print_plot() { if (PlotType::slice == pl.type_) { std::cout << "Plot Type: Slice" << "\n"; } else if (PlotType::voxel == pl.type_) { - std::cout << "Plot Type: Voxel" << "\n"; + std::cout << "Plot Type: Voxel" << "\n"; } // Plot parameters @@ -98,9 +98,9 @@ void print_plot() { if (PlotColorBy::cells == pl.color_by_) { std::cout << "Coloring: Cells" << "\n"; } else if (PlotColorBy::mats == pl.color_by_) { - std::cout << "Coloring: Materials" << "\n"; + std::cout << "Coloring: Materials" << "\n"; } - + if (PlotType::slice == pl.type_) { switch(pl.basis_) { case PlotBasis::xy: @@ -122,10 +122,10 @@ void print_plot() { } std::cout << "\n"; - + } } - + void print_overlap_check() { #ifdef OPENMC_MPI @@ -135,7 +135,7 @@ print_overlap_check() { mpi::intracomm); #endif - if (openmc_master) { + if (mpi::master) { header("cell overlap check summary", 1); std::cout << " Cell ID No. Overlap Checks\n"; diff --git a/src/plot.cpp b/src/plot.cpp index 9a8aba139..45529ba97 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -9,6 +9,7 @@ #include "openmc/geometry.h" #include "openmc/cell.h" #include "openmc/material.h" +#include "openmc/message_passing.h" #include "openmc/string_utils.h" #include "openmc/mesh.h" #include "openmc/output.h" @@ -243,7 +244,7 @@ Plot::set_bg_color(pugi::xml_node plot_node) if (check_for_node(plot_node, "background")) { std::vector bg_rgb = get_node_array(plot_node, "background"); if (PlotType::voxel == type_) { - if (openmc_master) { + if (mpi::master) { std::stringstream err_msg; err_msg << "Background color ignored in voxel plot " << id_; @@ -384,7 +385,7 @@ void Plot::set_user_colors(pugi::xml_node plot_node) { if (!plot_node.select_nodes("color").empty() && PlotType::voxel == type_) { - if (openmc_master) { + if (mpi::master) { std::stringstream err_msg; err_msg << "Color specifications ignored in voxel plot " << id_; @@ -552,7 +553,7 @@ Plot::set_mask(pugi::xml_node plot_node) if (!mask_nodes.empty()) { if (PlotType::voxel == type_) { - if (openmc_master) { + if (mpi::master) { std::stringstream wrn_msg; wrn_msg << "Mask ignored in voxel plot " << id_; warning(wrn_msg); diff --git a/src/settings.cpp b/src/settings.cpp index bf9ef82de..227ebca5c 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -17,6 +17,7 @@ #include "openmc/error.h" #include "openmc/file_utils.h" #include "openmc/mesh.h" +#include "openmc/message_passing.h" #include "openmc/output.h" #include "openmc/random_lcg.h" #include "openmc/simulation.h" @@ -231,7 +232,7 @@ void read_settings_xml() // To this point, we haven't displayed any output since we didn't know what // the verbosity is. Now that we checked for it, show the title if necessary - if (openmc_master) { + if (mpi::master) { if (verbosity >= 2) title(); } write_message("Reading settings XML file...", 5); @@ -398,7 +399,7 @@ void read_settings_xml() omp_set_num_threads(simulation::n_threads); } #else - if (openmc_master) warning("OpenMC was not compiled with OpenMP support; " + if (mpi::master) warning("OpenMC was not compiled with OpenMP support; " "ignoring number of threads."); #endif } diff --git a/src/state_point.cpp b/src/state_point.cpp index 5b4384f91..fdf700c44 100644 --- a/src/state_point.cpp +++ b/src/state_point.cpp @@ -113,7 +113,7 @@ write_source_bank(hid_t group_id, Bank* source_bank) #else - if (openmc_master) { + if (mpi::master) { // Create dataset big enough to hold all source sites hsize_t dims[] {static_cast(settings::n_particles)}; hid_t dspace = H5Screate_simple(1, dims, nullptr);