address PR comments

This commit is contained in:
Gavin Ridley 2021-04-29 16:23:54 -04:00
parent f0e1110e01
commit 061156e79a
35 changed files with 110 additions and 114 deletions

View file

@ -16,11 +16,11 @@ namespace openmc {
namespace simulation {
extern vector<ParticleBank> source_bank;
extern vector<SourceSite> source_bank;
extern SharedArray<ParticleBank> surf_source_bank;
extern SharedArray<SourceSite> surf_source_bank;
extern SharedArray<ParticleBank> fission_bank;
extern SharedArray<SourceSite> fission_bank;
extern vector<int64_t> progeny_per_particle;

View file

@ -303,7 +303,7 @@ private:
//! `partitions_.back()` gives the cells that lie on the positive side of
//! `surfs_.back()`. Otherwise, `partitions_[i]` gives cells sandwiched
//! between `surfs_[i-1]` and `surfs_[i]`.
vector<std::vector<int32_t>> partitions_;
vector<vector<int32_t>> partitions_;
};

View file

@ -13,9 +13,9 @@
namespace openmc {
using double_2dvec = vector<std::vector<double>>;
using double_3dvec = vector<std::vector<std::vector<double>>>;
using double_4dvec = vector<std::vector<std::vector<std::vector<double>>>>;
using double_2dvec = vector<vector<double>>;
using double_3dvec = vector<vector<vector<double>>>;
using double_4dvec = vector<vector<vector<vector<double>>>>;
// ============================================================================
// VERSIONING NUMBERS

View file

@ -65,8 +65,8 @@ void read_cross_sections_xml();
//
//! \param[in] nuc_temps Temperatures for each nuclide in [K]
//! \param[in] thermal_temps Temperatures for each thermal scattering table in [K]
void read_ce_cross_sections(const vector<std::vector<double>>& nuc_temps,
const vector<std::vector<double>>& thermal_temps);
void read_ce_cross_sections(const vector<vector<double>>& nuc_temps,
const vector<vector<double>>& thermal_temps);
//! Read cross_sections.xml and populate data libraries
void read_ce_cross_sections_xml();

View file

@ -42,8 +42,8 @@ void assign_temperatures();
//! table
//==============================================================================
void get_temperatures(vector<std::vector<double>>& nuc_temps,
vector<std::vector<double>>& thermal_temps);
void get_temperatures(
vector<vector<double>>& nuc_temps, vector<vector<double>>& thermal_temps);
//==============================================================================
//! \brief Perform final setup for geometry

View file

@ -197,9 +197,9 @@ double sternheimer_adjustment(const vector<double>& f,
double log_I, double tol, int max_iter);
//! Calculate density effect correction
double density_effect(const vector<double>& f,
const std::vector<double>& e_b_sq, double e_p_sq, double n_conduction,
double rho, double E, double tol, int max_iter);
double density_effect(const vector<double>& f, const vector<double>& e_b_sq,
double e_p_sq, double n_conduction, double rho, double E, double tol,
int max_iter);
//! Read material data from materials.xml
void read_materials_xml();

View file

@ -122,7 +122,7 @@ public:
//! of the plot's axes. For example an xy-slice plot will get back a vector
//! of x-coordinates and another of y-coordinates. These vectors may be
//! empty for low-dimensional meshes.
virtual std::pair<vector<double>, std::vector<double>> plot(
virtual std::pair<vector<double>, vector<double>> plot(
Position plot_ll, Position plot_ur) const = 0;
//! Return a string representation of the mesh bin
@ -159,7 +159,7 @@ public:
//! \param[in] Number of bank sites
//! \param[out] Whether any bank sites are outside the mesh
xt::xtensor<double, 1> count_sites(
const ParticleBank* bank, int64_t length, bool* outside) const;
const SourceSite* bank, int64_t length, bool* outside) const;
//! Get bin given mesh indices
//
@ -244,7 +244,7 @@ public:
double negative_grid_boundary(int* ijk, int i) const override;
std::pair<vector<double>, std::vector<double>> plot(
std::pair<vector<double>, vector<double>> plot(
Position plot_ll, Position plot_ur) const override;
void to_hdf5(hid_t group) const override;
@ -257,7 +257,7 @@ public:
//! \param[out] Whether any bank sites are outside the mesh
//! \return Array indicating number of sites in each mesh/energy bin
xt::xtensor<double, 1> count_sites(
const ParticleBank* bank, int64_t length, bool* outside) const;
const SourceSite* bank, int64_t length, bool* outside) const;
// Data members
double volume_frac_; //!< Volume fraction of each mesh element
@ -285,12 +285,12 @@ public:
double negative_grid_boundary(int* ijk, int i) const override;
std::pair<vector<double>, std::vector<double>> plot(
std::pair<vector<double>, vector<double>> plot(
Position plot_ll, Position plot_ur) const override;
void to_hdf5(hid_t group) const override;
vector<std::vector<double>> grid_;
vector<vector<double>> grid_;
int set_grid();
};
@ -382,7 +382,7 @@ public:
int n_surface_bins() const override;
std::pair<vector<double>, std::vector<double>> plot(
std::pair<vector<double>, vector<double>> plot(
Position plot_ll, Position plot_ur) const override;
std::string library() const override;
@ -534,7 +534,7 @@ public:
int n_surface_bins() const override;
std::pair<vector<double>, std::vector<double>> plot(
std::pair<vector<double>, vector<double>> plot(
Position plot_ll, Position plot_ur) const override;
void add_score(const std::string& var_name) override;

View file

@ -64,7 +64,7 @@ class Mgxs {
void init(const std::string& in_name, double in_awr,
const vector<double>& in_kTs, bool in_fissionable,
AngleDistributionType in_scatter_format, bool in_is_isotropic,
const vector<double>& in_polar, const std::vector<double>& in_azimuthal);
const vector<double>& in_polar, const vector<double>& in_azimuthal);
//! \brief Initializes the Mgxs object metadata from the HDF5 file
//!
@ -84,9 +84,8 @@ class Mgxs {
//! @param micro_ts The temperature index of the microscopic objects that
//! corresponds to the temperature of interest.
//! @param this_t The temperature index of the macroscopic object.
void combine(const vector<Mgxs*>& micros,
const std::vector<double>& scalars, const vector<int>& micro_ts,
int this_t);
void combine(const vector<Mgxs*>& micros, const vector<double>& scalars,
const vector<int>& micro_ts, int this_t);
//! \brief Checks to see if this and that are able to be combined
//!
@ -124,7 +123,7 @@ class Mgxs {
//! @param num_group number of energy groups
//! @param num_delay number of delayed groups
Mgxs(const std::string& in_name, const vector<double>& mat_kTs,
const vector<Mgxs*>& micros, const std::vector<double>& atom_densities,
const vector<Mgxs*>& micros, const vector<double>& atom_densities,
int num_group, int num_delay);
//! \brief Provides a cross section value given certain parameters

View file

@ -23,7 +23,7 @@ public:
// of XS to read and the corresponding temperatures for each XS
MgxsInterface(const std::string& path_cross_sections,
const vector<std::string> xs_to_read,
const vector<std::vector<double>> xs_temps);
const vector<vector<double>> xs_temps);
// Does things to construct after the nuclides and temperatures to
// read have been specified.
@ -31,7 +31,7 @@ public:
// Set which nuclides and temperatures are to be read
void set_nuclides_and_temperatures(
vector<std::string> xs_to_read, vector<std::vector<double>> xs_temps);
vector<std::string> xs_to_read, vector<vector<double>> xs_temps);
// Add an Mgxs object to be managed
void add_mgxs(
@ -45,20 +45,20 @@ public:
void create_macro_xs();
// Get the kT values which are used in the OpenMC model
vector<std::vector<double>> get_mat_kTs();
vector<vector<double>> get_mat_kTs();
int num_energy_groups_;
int num_delayed_groups_;
vector<std::string> xs_names_; // available names in HDF5 file
vector<std::string> xs_to_read_; // XS which appear in materials
vector<std::vector<double>> xs_temps_to_read_; // temperatures used
vector<vector<double>> xs_temps_to_read_; // temperatures used
std::string cross_sections_path_; // path to MGXS h5 file
vector<Mgxs> nuclides_;
vector<Mgxs> macro_xs_;
vector<double> energy_bins_;
vector<double> energy_bin_avg_;
vector<double> rev_energy_bins_;
vector<std::vector<double>> nuc_temps_; // all available temperatures
vector<vector<double>> nuc_temps_; // all available temperatures
};
namespace data {

View file

@ -51,7 +51,7 @@ public:
//! site may have been produced from an external source, from fission, or
//! simply as a secondary particle.
//! \param src Source site data
void from_source(const ParticleBank* src);
void from_source(const SourceSite* src);
// Coarse-grained particle events
void event_calculate_xs();

View file

@ -1,5 +1,5 @@
#ifndef OPENMC_PARTICLE_REPRESENTATION_H
#define OPENMC_PARTICLE_REPRESENTATION_H
#ifndef OPENMC_PARTICLE_DATA_H
#define OPENMC_PARTICLE_DATA_H
#include "openmc/array.h"
#include "openmc/constants.h"
@ -40,7 +40,7 @@ enum class ParticleType { neutron, photon, electron, positron };
//! NOTE: This structure is also used on the python side, and is defined
//! in lib/core.py. Changes made to the type here must also be made to the
//! python defintion.
struct ParticleBank {
struct SourceSite {
Position r;
Direction u;
double E;
@ -247,7 +247,7 @@ private:
int stream_; // current RNG stream
// Secondary particle bank
vector<ParticleBank> secondary_bank_;
vector<SourceSite> secondary_bank_;
int64_t current_work_; // current work index
@ -255,7 +255,7 @@ private:
vector<FilterMatch> filter_matches_; // tally filter matches
vector<std::vector<Position>> tracks_; // tracks for outputting to file
vector<vector<Position>> tracks_; // tracks for outputting to file
vector<NuBank> nu_bank_; // bank of most recently fissioned particles
@ -370,7 +370,7 @@ public:
uint64_t* seeds() { return seeds_; }
int& stream() { return stream_; }
ParticleBank& secondary_bank(const int& i) { return secondary_bank_[i]; }
SourceSite& secondary_bank(const int& i) { return secondary_bank_[i]; }
decltype(secondary_bank_)& secondary_bank() { return secondary_bank_; }
int64_t& current_work() { return current_work_; }
const int64_t& current_work() const { return current_work_; }
@ -450,4 +450,4 @@ public:
} // namespace openmc
#endif // OPENMC_PARTICLE_REPRESENTATION_H
#endif // OPENMC_PARTICLE_DATA_H

View file

@ -80,7 +80,7 @@ Direction sample_cxs_target_velocity(double awr, double E, Direction u, double k
uint64_t* seed);
void sample_fission_neutron(int i_nuclide, const Reaction& rx, double E_in,
ParticleBank* site, uint64_t* seed);
SourceSite* site, uint64_t* seed);
//! handles all reactions with a single secondary neutron (other than fission),
//! i.e. level scattering, (n,np), (n,na), etc.

View file

@ -7,7 +7,6 @@
#include "openmc/capi.h"
#include "openmc/nuclide.h"
#include "openmc/particle.h"
#include "openmc/vector.h"
namespace openmc {

View file

@ -35,7 +35,7 @@ public:
virtual ~Source() = default;
// Methods that must be implemented
virtual ParticleBank sample(uint64_t* seed) const = 0;
virtual SourceSite sample(uint64_t* seed) const = 0;
// Methods that can be overridden
virtual double strength() const { return 1.0; }
@ -54,7 +54,7 @@ public:
//! Sample from the external source distribution
//! \param[inout] seed Pseudorandom seed pointer
//! \return Sampled site
ParticleBank sample(uint64_t* seed) const override;
SourceSite sample(uint64_t* seed) const override;
// Properties
ParticleType particle_type() const { return particle_; }
@ -83,10 +83,10 @@ public:
explicit FileSource(std::string path);
// Methods
ParticleBank sample(uint64_t* seed) const override;
SourceSite sample(uint64_t* seed) const override;
private:
vector<ParticleBank> sites_; //!< Source sites from a file
vector<SourceSite> sites_; //!< Source sites from a file
};
//==============================================================================
@ -100,7 +100,7 @@ public:
~CustomSourceWrapper();
// Defer implementation to custom source library
ParticleBank sample(uint64_t* seed) const override
SourceSite sample(uint64_t* seed) const override
{
return custom_source_->sample(seed);
}
@ -124,7 +124,7 @@ extern "C" void initialize_source();
//! source strength
//! \param[inout] seed Pseudorandom seed pointer
//! \return Sampled source site
ParticleBank sample_external_source(uint64_t* seed);
SourceSite sample_external_source(uint64_t* seed);
void free_memory_source();

View file

@ -16,7 +16,7 @@ vector<int64_t> calculate_surf_source_size();
void write_source_point(const char* filename, bool surf_source_bank = false);
void write_source_bank(hid_t group_id, bool surf_source_bank);
void read_source_bank(
hid_t group_id, vector<ParticleBank>& sites, bool distribute);
hid_t group_id, vector<SourceSite>& sites, bool distribute);
void write_tally_results_nr(hid_t file_id);
void restart_set_keff();
void write_unstructured_mesh_results();

View file

@ -17,7 +17,7 @@
#include <vector>
namespace openmc {
using std::vector;
using vector;
}
#endif // OPENMC_VECTOR_H

View file

@ -137,7 +137,7 @@ class XsData {
//! @param micros Microscopic objects to combine.
//! @param scalars Scalars to multiply the microscopic data by.
void combine(
const vector<XsData*>& those_xs, const std::vector<double>& scalars);
const vector<XsData*>& those_xs, const vector<double>& scalars);
//! \brief Checks to see if this and that are able to be combined
//!