mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Merge pull request #2291 from pshriwise/model-xml
Support for a single `model.xml` file
This commit is contained in:
commit
3f8f8f6701
32 changed files with 1284 additions and 372 deletions
|
|
@ -62,6 +62,11 @@ extern vector<Library> libraries;
|
|||
//! libraries
|
||||
void read_cross_sections_xml();
|
||||
|
||||
//! Read cross sections file (either XML or multigroup H5) and populate data
|
||||
//! libraries
|
||||
//! \param[in] root node of the cross_sections.xml
|
||||
void read_cross_sections_xml(pugi::xml_node root);
|
||||
|
||||
//! Load nuclide and thermal scattering data from HDF5 files
|
||||
//
|
||||
//! \param[in] nuc_temps Temperatures for each nuclide in [K]
|
||||
|
|
|
|||
|
|
@ -3,14 +3,31 @@
|
|||
|
||||
#include <fstream> // for ifstream
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace openmc {
|
||||
|
||||
// TODO: replace with std::filesystem when switch to C++17 is made
|
||||
//! Determine if a path is a directory
|
||||
//! \param[in] path Path to check
|
||||
//! \return Whether the path is a directory
|
||||
inline bool dir_exists(const std::string& path)
|
||||
{
|
||||
struct stat s;
|
||||
if (stat(path.c_str(), &s) != 0) return false;
|
||||
|
||||
return s.st_mode & S_IFDIR;
|
||||
}
|
||||
|
||||
//! Determine if a file exists
|
||||
//! \param[in] filename Path to file
|
||||
//! \return Whether file exists
|
||||
inline bool file_exists(const std::string& filename)
|
||||
{
|
||||
// rule out file being a path to a directory
|
||||
if (dir_exists(filename))
|
||||
return false;
|
||||
|
||||
std::ifstream s {filename};
|
||||
return s.good();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "openmc/vector.h"
|
||||
#include "openmc/xml_interface.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
|
|
@ -19,8 +20,13 @@ extern std::unordered_map<int32_t, std::unordered_map<int32_t, int32_t>>
|
|||
extern std::unordered_map<int32_t, int32_t> universe_level_counts;
|
||||
} // namespace model
|
||||
|
||||
//! Read geometry from XML file
|
||||
void read_geometry_xml();
|
||||
|
||||
//! Read geometry from XML node
|
||||
//! \param[in] root node of geometry XML element
|
||||
void read_geometry_xml(pugi::xml_node root);
|
||||
|
||||
//==============================================================================
|
||||
//! Replace Universe, Lattice, and Material IDs with indices.
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef OPENMC_INITIALIZE_H
|
||||
#define OPENMC_INITIALIZE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef OPENMC_MPI
|
||||
#include "mpi.h"
|
||||
#endif
|
||||
|
|
@ -11,7 +13,13 @@ int parse_command_line(int argc, char* argv[]);
|
|||
#ifdef OPENMC_MPI
|
||||
void initialize_mpi(MPI_Comm intracomm);
|
||||
#endif
|
||||
void read_input_xml();
|
||||
|
||||
//! Read material, geometry, settings, and tallies from a single XML file
|
||||
bool read_model_xml();
|
||||
//! Read inputs from separate XML files
|
||||
void read_separate_xml_files();
|
||||
//! Write some output that occurs right after initialization
|
||||
void initial_output();
|
||||
|
||||
} // namespace openmc
|
||||
|
||||
|
|
|
|||
|
|
@ -221,6 +221,10 @@ double density_effect(const vector<double>& f, const vector<double>& e_b_sq,
|
|||
//! Read material data from materials.xml
|
||||
void read_materials_xml();
|
||||
|
||||
//! Read material data XML node
|
||||
//! \param[in] root node of materials XML element
|
||||
void read_materials_xml(pugi::xml_node root);
|
||||
|
||||
void free_memory_material();
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -279,6 +279,10 @@ void voxel_finalize(hid_t dspace, hid_t dset, hid_t memspace);
|
|||
//! Read plot specifications from a plots.xml file
|
||||
void read_plots_xml();
|
||||
|
||||
//! Read plot specifications from an XML Node
|
||||
//! \param[in] XML node containing plot info
|
||||
void read_plots_xml(pugi::xml_node root);
|
||||
|
||||
//! Clear memory
|
||||
void free_memory_plot();
|
||||
|
||||
|
|
|
|||
|
|
@ -129,9 +129,12 @@ extern double weight_survive; //!< Survival weight after Russian roulette
|
|||
//==============================================================================
|
||||
|
||||
//! Read settings from XML file
|
||||
//! \param[in] root XML node for <settings>
|
||||
void read_settings_xml();
|
||||
|
||||
//! Read settings from XML node
|
||||
//! \param[in] root XML node for <settings>
|
||||
void read_settings_xml(pugi::xml_node root);
|
||||
|
||||
void free_memory_settings();
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ public:
|
|||
void set_nuclides(const vector<std::string>& nuclides);
|
||||
|
||||
//! returns vector of indices corresponding to the tally this is called on
|
||||
const vector<int32_t>& filters() const { return filters_; }
|
||||
const vector<int32_t>& filters() const { return filters_; }
|
||||
|
||||
//! \brief Returns the tally filter at index i
|
||||
int32_t filters(int i) const { return filters_[i]; }
|
||||
int32_t filters(int i) const { return filters_[i]; }
|
||||
|
||||
void set_filters(gsl::span<Filter*> filters);
|
||||
|
||||
|
|
@ -178,6 +178,10 @@ extern double global_tally_leakage;
|
|||
//! Read tally specification from tallies.xml
|
||||
void read_tallies_xml();
|
||||
|
||||
//! Read tally specification from an XML node
|
||||
//! \param[in] root node of tallies XML element
|
||||
void read_tallies_xml(pugi::xml_node root);
|
||||
|
||||
//! \brief Accumulate the sum of the contributions from each history within the
|
||||
//! batch to a new random variable
|
||||
void accumulate_tallies();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue