(1) Made OpenMC load plots.xml upon initialization even if not in the plot runmode; (2) Made the finalize method clear plotting data; (3) allowed the openmc.lib and openmc.model package to call plot_geometry now that plots.xml would have been loaded

This commit is contained in:
agnelson 2021-09-30 15:15:58 -05:00
parent b335f82792
commit 20c8043c1c
5 changed files with 26 additions and 18 deletions

View file

@ -119,9 +119,11 @@ extern "C" int openmc_plot_geometry()
void read_plots_xml()
{
// Check if plots.xml exists
// Check if plots.xml exists; this is only necessary when the plot runmode is
// initiated. Otherwise, we want to read plots.xml because it may be called
// later via the API. In that case, its ok for a plots.xml to not exist
std::string filename = settings::path_input + "plots.xml";
if (!file_exists(filename)) {
if (!file_exists(filename) && settings::run_mode == RunMode::PLOTTING) {
fatal_error(fmt::format("Plots XML file '{}' does not exist!", filename));
}
@ -138,6 +140,12 @@ void read_plots_xml()
}
}
void free_memory_plot()
{
model::plots.clear();
model::plot_map.clear();
}
//==============================================================================
// CREATE_PPM creates an image based on user input from a plots.xml <plot>
// specification in the portable pixmap format (PPM)