diff --git a/include/openmc/plot.h b/include/openmc/plot.h index c71950fca..a02db40d3 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -70,20 +70,21 @@ namespace openmc { ObjectColor not_found; std::vector colors; std::string path_plot; + pugi::xml_node plot_node; private: - void set_id(pugi::xml_node plot_node); - void set_type(pugi::xml_node plot_node); - void set_output_path(pugi::xml_node plot_node); - void set_bg_color(pugi::xml_node plot_node); - void set_basis(pugi::xml_node plot_node); - void set_origin(pugi::xml_node plot_node); - void set_width(pugi::xml_node plot_node); - void set_universe(pugi::xml_node plot_node); - void set_default_colors(pugi::xml_node plot_node); - void set_user_colors(pugi::xml_node plot_node); - void set_meshlines(pugi::xml_node plot_node); - void set_mask(pugi::xml_node plot_node); + void set_id(); + void set_type(); + void set_output_path(); + void set_bg_color(); + void set_basis(); + void set_origin(); + void set_width(); + void set_universe(); + void set_default_colors(); + void set_user_colors(); + void set_meshlines(); + void set_mask(); }; //extern "C" int openmc_plot_geometry(); diff --git a/src/plot.cpp b/src/plot.cpp index 4e9d49597..4bab60f24 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -153,7 +153,7 @@ void create_ppm(ObjectPlot* pl) { } void -ObjectPlot::set_id(pugi::xml_node plot_node) { +ObjectPlot::set_id() { // Copy data into plots if (check_for_node(plot_node, "id")) { id = std::stoi(get_node_value(plot_node, "id")); @@ -172,7 +172,7 @@ ObjectPlot::set_id(pugi::xml_node plot_node) { } void -ObjectPlot::set_type(pugi::xml_node plot_node) { +ObjectPlot::set_type() { // Copy plot type // Default is slice std::string type_str = "slice"; @@ -195,7 +195,7 @@ ObjectPlot::set_type(pugi::xml_node plot_node) { } void -ObjectPlot::set_output_path(pugi::xml_node plot_node) { +ObjectPlot::set_output_path() { // Set output file path std::stringstream filename; filename << "plot_" << id; @@ -243,7 +243,7 @@ ObjectPlot::set_output_path(pugi::xml_node plot_node) { } void -ObjectPlot::set_bg_color(pugi::xml_node plot_node){ +ObjectPlot::set_bg_color(){ // Copy plot background color std::vector bg_rgb; if (check_for_node(plot_node, "background")) { @@ -275,7 +275,7 @@ ObjectPlot::set_bg_color(pugi::xml_node plot_node){ } void -ObjectPlot::set_basis(pugi::xml_node plot_node) { +ObjectPlot::set_basis() { // Copy plot basis if (PLOT_TYPE::SLICE == type) { std::string pl_basis = "xy"; @@ -299,7 +299,7 @@ ObjectPlot::set_basis(pugi::xml_node plot_node) { } void -ObjectPlot::set_origin(pugi::xml_node plot_node) { +ObjectPlot::set_origin() { // Copy plotting origin std::vector pl_origin; if (node_word_count(plot_node, "origin") == 3) { @@ -316,7 +316,7 @@ ObjectPlot::set_origin(pugi::xml_node plot_node) { } void -ObjectPlot::set_width(pugi::xml_node plot_node) { +ObjectPlot::set_width() { // Copy plotting width std::vector pl_width; if (PLOT_TYPE::SLICE == type) { @@ -346,7 +346,7 @@ ObjectPlot::set_width(pugi::xml_node plot_node) { } void -ObjectPlot::set_universe(pugi::xml_node plot_node) { +ObjectPlot::set_universe() { // Copy plot universe level if (check_for_node(plot_node, "level")) { level = std::stoi(get_node_value(plot_node, "level")); @@ -361,7 +361,7 @@ ObjectPlot::set_universe(pugi::xml_node plot_node) { } void -ObjectPlot::set_default_colors(pugi::xml_node plot_node) { +ObjectPlot::set_default_colors() { // Copy plot color type and initialize all colors randomly std::string pl_color_by = "cell"; if (check_for_node(plot_node, "color_by")) { @@ -397,7 +397,7 @@ ObjectPlot::set_default_colors(pugi::xml_node plot_node) { } void -ObjectPlot::set_user_colors(pugi::xml_node plot_node) { +ObjectPlot::set_user_colors() { // Get the number of nodes and get a list of them std::vector color_nodes; color_nodes = get_child_nodes(plot_node, "color"); @@ -469,7 +469,7 @@ ObjectPlot::set_user_colors(pugi::xml_node plot_node) { } void -ObjectPlot::set_meshlines(pugi::xml_node plot_node) { +ObjectPlot::set_meshlines() { // Deal with meshlines std::vector mesh_line_nodes; mesh_line_nodes = get_child_nodes(plot_node, "meshlines"); @@ -598,7 +598,7 @@ ObjectPlot::set_meshlines(pugi::xml_node plot_node) { } void -ObjectPlot::set_mask(pugi::xml_node plot_node) { +ObjectPlot::set_mask() { // Deal with masks std::vector mask_nodes; mask_nodes = get_child_nodes(plot_node, "mask"); @@ -683,32 +683,34 @@ ObjectPlot::set_mask(pugi::xml_node plot_node) { } ObjectPlot::ObjectPlot(pugi::xml_node plot_node) - : index_meshlines_mesh(-1) { + : index_meshlines_mesh(-1), plot_node(plot_node) { - set_id(plot_node); + set_id(); - set_type(plot_node); + set_type(); - set_output_path(plot_node); + set_output_path(); - set_bg_color(plot_node); + set_bg_color(); - set_basis(plot_node); + set_basis(); - set_origin(plot_node); + set_origin(); - set_width(plot_node); + set_width(); - set_universe(plot_node); + set_universe(); - set_default_colors(plot_node); + set_default_colors(); - set_user_colors(plot_node); + set_user_colors(); - set_meshlines(plot_node); + set_meshlines(); - set_mask(plot_node); + set_mask(); + plot_node = pugi::xml_node(); // set to null node after construction + } // End ObjectPlot constructor //===============================================================================