mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
address PR comments
This commit is contained in:
parent
f0e1110e01
commit
061156e79a
35 changed files with 110 additions and 114 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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_;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include "openmc/capi.h"
|
||||
#include "openmc/nuclide.h"
|
||||
#include "openmc/particle.h"
|
||||
#include "openmc/vector.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include <vector>
|
||||
|
||||
namespace openmc {
|
||||
using std::vector;
|
||||
using vector;
|
||||
}
|
||||
|
||||
#endif // OPENMC_VECTOR_H
|
||||
|
|
|
|||
|
|
@ -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
|
||||
//!
|
||||
|
|
|
|||
10
src/bank.cpp
10
src/bank.cpp
|
|
@ -16,15 +16,15 @@ namespace openmc {
|
|||
|
||||
namespace simulation {
|
||||
|
||||
vector<ParticleBank> source_bank;
|
||||
vector<SourceSite> source_bank;
|
||||
|
||||
SharedArray<ParticleBank> surf_source_bank;
|
||||
SharedArray<SourceSite> surf_source_bank;
|
||||
|
||||
// The fission bank is allocated as a SharedArray, rather than a vector, as it will
|
||||
// be shared by all threads in the simulation. It will be allocated to a fixed
|
||||
// maximum capacity in the init_fission_bank() function. Then, Elements will be
|
||||
// added to it by using SharedArray's special thread_safe_append() function.
|
||||
SharedArray<ParticleBank> fission_bank;
|
||||
SharedArray<SourceSite> fission_bank;
|
||||
|
||||
// Each entry in this vector corresponds to the number of progeny produced
|
||||
// this generation for the particle located at that index. This vector is
|
||||
|
|
@ -80,8 +80,8 @@ void sort_fission_bank()
|
|||
// We need a scratch vector to make permutation of the fission bank into
|
||||
// sorted order easy. Under normal usage conditions, the fission bank is
|
||||
// over provisioned, so we can use that as scratch space.
|
||||
ParticleBank* sorted_bank;
|
||||
vector<ParticleBank> sorted_bank_holder;
|
||||
SourceSite* sorted_bank;
|
||||
vector<SourceSite> sorted_bank_holder;
|
||||
|
||||
// If there is not enough space, allocate a temporary vector and point to it
|
||||
if (simulation::fission_bank.size() > simulation::fission_bank.capacity() / 2) {
|
||||
|
|
|
|||
|
|
@ -181,8 +181,8 @@ void read_cross_sections_xml()
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
std::unordered_set<std::string> already_read;
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void synchronize_bank()
|
|||
// Allocate temporary source bank -- we don't really know how many fission
|
||||
// sites were created, so overallocate by a factor of 3
|
||||
int64_t index_temp = 0;
|
||||
vector<ParticleBank> temp_sites(3 * simulation::work_per_rank);
|
||||
vector<SourceSite> temp_sites(3 * simulation::work_per_rank);
|
||||
|
||||
for (int64_t i = 0; i < simulation::fission_bank.size(); i++ ) {
|
||||
const auto& site = simulation::fission_bank[i];
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@ assign_temperatures()
|
|||
|
||||
//==============================================================================
|
||||
|
||||
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)
|
||||
{
|
||||
for (const auto& cell : model::cells) {
|
||||
// Skip non-material cells.
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ void initialize_mpi(MPI_Comm intracomm)
|
|||
mpi::master = (mpi::rank == 0);
|
||||
|
||||
// Create bank datatype
|
||||
ParticleBank b;
|
||||
SourceSite b;
|
||||
MPI_Aint disp[9];
|
||||
MPI_Get_address(&b.r, &disp[0]);
|
||||
MPI_Get_address(&b.u, &disp[1]);
|
||||
|
|
|
|||
|
|
@ -1144,9 +1144,9 @@ double sternheimer_adjustment(const vector<double>& f,
|
|||
return rho;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
// Get the total number of oscillators
|
||||
int n = f.size();
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ void calc_zn(int n, double rho, double phi, double zn[]) {
|
|||
// ===========================================================================
|
||||
// Calculate R_pq(rho)
|
||||
// Matrix forms of the coefficients which are easier to work with
|
||||
vector<std::vector<double>> zn_mat(n + 1, std::vector<double>(n + 1));
|
||||
vector<vector<double>> zn_mat(n + 1, vector<double>(n + 1));
|
||||
|
||||
// Fill the main diagonal first (Eq 3.9 in Chong)
|
||||
for (int p = 0; p <= n; p++) {
|
||||
|
|
|
|||
12
src/mesh.cpp
12
src/mesh.cpp
|
|
@ -284,7 +284,7 @@ int StructuredMesh::n_surface_bins() const
|
|||
}
|
||||
|
||||
xt::xtensor<double, 1> StructuredMesh::count_sites(
|
||||
const ParticleBank* bank, int64_t length, bool* outside) const
|
||||
const SourceSite* bank, int64_t length, bool* outside) const
|
||||
{
|
||||
// Determine shape of array for counts
|
||||
std::size_t m = this->n_bins();
|
||||
|
|
@ -938,7 +938,7 @@ RegularMesh::surface_bins_crossed(Position r0,
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<vector<double>, std::vector<double>> RegularMesh::plot(
|
||||
std::pair<vector<double>, vector<double>> RegularMesh::plot(
|
||||
Position plot_ll, Position plot_ur) const
|
||||
{
|
||||
// Figure out which axes lie in the plane of the plot.
|
||||
|
|
@ -988,7 +988,7 @@ void RegularMesh::to_hdf5(hid_t group) const
|
|||
}
|
||||
|
||||
xt::xtensor<double, 1> RegularMesh::count_sites(
|
||||
const ParticleBank* bank, int64_t length, bool* outside) const
|
||||
const SourceSite* bank, int64_t length, bool* outside) const
|
||||
{
|
||||
// Determine shape of array for counts
|
||||
std::size_t m = this->n_bins();
|
||||
|
|
@ -1264,7 +1264,7 @@ int RectilinearMesh::get_index_in_direction(double r, int i) const
|
|||
return lower_bound_index(grid_[i].begin(), grid_[i].end(), r) + 1;
|
||||
}
|
||||
|
||||
std::pair<vector<double>, std::vector<double>> RectilinearMesh::plot(
|
||||
std::pair<vector<double>, vector<double>> RectilinearMesh::plot(
|
||||
Position plot_ll, Position plot_ur) const
|
||||
{
|
||||
// Figure out which axes lie in the plane of the plot.
|
||||
|
|
@ -1923,7 +1923,7 @@ int MOABMesh::get_index_from_bin(int bin) const
|
|||
return bin;
|
||||
}
|
||||
|
||||
std::pair<vector<double>, std::vector<double>> MOABMesh::plot(
|
||||
std::pair<vector<double>, vector<double>> MOABMesh::plot(
|
||||
Position plot_ll, Position plot_ur) const
|
||||
{
|
||||
// TODO: Implement mesh lines
|
||||
|
|
@ -2337,7 +2337,7 @@ LibMesh::get_bin_from_element(const libMesh::Elem* elem) const
|
|||
return bin;
|
||||
}
|
||||
|
||||
std::pair<vector<double>, std::vector<double>> LibMesh::plot(
|
||||
std::pair<vector<double>, vector<double>> LibMesh::plot(
|
||||
Position plot_ll, Position plot_ur) const
|
||||
{
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace openmc {
|
|||
void Mgxs::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)
|
||||
{
|
||||
// Set the metadata
|
||||
name = in_name;
|
||||
|
|
@ -307,7 +307,7 @@ Mgxs::Mgxs(
|
|||
//==============================================================================
|
||||
|
||||
Mgxs::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)
|
||||
: num_groups(num_group), num_delayed_groups(num_delay)
|
||||
{
|
||||
|
|
@ -415,8 +415,8 @@ Mgxs::Mgxs(const std::string& in_name, const vector<double>& mat_kTs,
|
|||
|
||||
//==============================================================================
|
||||
|
||||
void Mgxs::combine(const vector<Mgxs*>& micros,
|
||||
const std::vector<double>& scalars, const vector<int>& micro_ts, int this_t)
|
||||
void Mgxs::combine(const vector<Mgxs*>& micros, const vector<double>& scalars,
|
||||
const vector<int>& micro_ts, int this_t)
|
||||
{
|
||||
// Build the vector of pointers to the xs objects within micros
|
||||
vector<XsData*> those_xs(micros.size());
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@ namespace data {
|
|||
}
|
||||
|
||||
MgxsInterface::MgxsInterface(const std::string& path_cross_sections,
|
||||
const vector<std::string> xs_to_read,
|
||||
const vector<std::vector<double>> xs_temps)
|
||||
const vector<std::string> xs_to_read, const vector<vector<double>> xs_temps)
|
||||
{
|
||||
read_header(path_cross_sections);
|
||||
set_nuclides_and_temperatures(xs_to_read, xs_temps);
|
||||
|
|
@ -38,7 +37,7 @@ MgxsInterface::MgxsInterface(const std::string& path_cross_sections,
|
|||
}
|
||||
|
||||
void MgxsInterface::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)
|
||||
{
|
||||
// Check to remove all duplicates
|
||||
xs_to_read_ = xs_to_read;
|
||||
|
|
@ -148,9 +147,9 @@ void MgxsInterface::create_macro_xs()
|
|||
|
||||
//==============================================================================
|
||||
|
||||
vector<std::vector<double>> MgxsInterface::get_mat_kTs()
|
||||
vector<vector<double>> MgxsInterface::get_mat_kTs()
|
||||
{
|
||||
vector<std::vector<double>> kTs(model::materials.size());
|
||||
vector<vector<double>> kTs(model::materials.size());
|
||||
|
||||
for (const auto& cell : model::cells) {
|
||||
// Skip non-material cells
|
||||
|
|
@ -246,8 +245,8 @@ void put_mgxs_header_data_to_globals()
|
|||
void set_mg_interface_nuclides_and_temps()
|
||||
{
|
||||
// Get temperatures from global data
|
||||
vector<std::vector<double>> nuc_temps(data::nuclide_map.size());
|
||||
vector<std::vector<double>> dummy;
|
||||
vector<vector<double>> nuc_temps(data::nuclide_map.size());
|
||||
vector<vector<double>> dummy;
|
||||
get_temperatures(nuc_temps, dummy);
|
||||
|
||||
// Build vector of nuclide names which are to be read
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void Particle::create_secondary(
|
|||
n_bank_second() += 1;
|
||||
}
|
||||
|
||||
void Particle::from_source(const ParticleBank* src)
|
||||
void Particle::from_source(const SourceSite* src)
|
||||
{
|
||||
// Reset some attributes
|
||||
clear();
|
||||
|
|
@ -368,7 +368,7 @@ Particle::cross_surface()
|
|||
}
|
||||
|
||||
if (surf->surf_source_ && simulation::current_batch == settings::n_batches) {
|
||||
ParticleBank site;
|
||||
SourceSite site;
|
||||
site.r = r();
|
||||
site.u = u();
|
||||
site.E = E();
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ create_fission_sites(Particle& p, int i_nuclide, const Reaction& rx)
|
|||
|
||||
for (int i = 0; i < nu; ++i) {
|
||||
// Initialize fission site object with particle data
|
||||
ParticleBank site;
|
||||
SourceSite site;
|
||||
site.r = p.r();
|
||||
site.particle = ParticleType::neutron;
|
||||
site.wgt = 1. / weight;
|
||||
|
|
@ -1015,7 +1015,7 @@ sample_cxs_target_velocity(double awr, double E, Direction u, double kT, uint64_
|
|||
}
|
||||
|
||||
void sample_fission_neutron(int i_nuclide, const Reaction& rx, double E_in,
|
||||
ParticleBank* site, uint64_t* seed)
|
||||
SourceSite* site, uint64_t* seed)
|
||||
{
|
||||
// Sample cosine of angle -- fission neutrons are always emitted
|
||||
// isotropically. Sometimes in ACE data, fission reactions actually have
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ create_fission_sites(Particle& p)
|
|||
|
||||
for (int i = 0; i < nu; ++i) {
|
||||
// Initialize fission site object with particle data
|
||||
ParticleBank site;
|
||||
SourceSite site;
|
||||
site.r = p.r();
|
||||
site.particle = ParticleType::neutron;
|
||||
site.wgt = 1. / weight;
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ IndependentSource::IndependentSource(pugi::xml_node node)
|
|||
}
|
||||
}
|
||||
|
||||
ParticleBank IndependentSource::sample(uint64_t* seed) const
|
||||
SourceSite IndependentSource::sample(uint64_t* seed) const
|
||||
{
|
||||
ParticleBank site;
|
||||
SourceSite site;
|
||||
|
||||
// Set weight to one by default
|
||||
site.wgt = 1.0;
|
||||
|
|
@ -262,7 +262,7 @@ FileSource::FileSource(std::string path)
|
|||
file_close(file_id);
|
||||
}
|
||||
|
||||
ParticleBank FileSource::sample(uint64_t* seed) const
|
||||
SourceSite FileSource::sample(uint64_t* seed) const
|
||||
{
|
||||
size_t i_site = sites_.size()*prn(seed);
|
||||
return sites_[i_site];
|
||||
|
|
@ -348,7 +348,7 @@ void initialize_source()
|
|||
}
|
||||
}
|
||||
|
||||
ParticleBank sample_external_source(uint64_t* seed)
|
||||
SourceSite sample_external_source(uint64_t* seed)
|
||||
{
|
||||
// Determine total source strength
|
||||
double total_strength = 0.0;
|
||||
|
|
@ -367,7 +367,7 @@ ParticleBank sample_external_source(uint64_t* seed)
|
|||
}
|
||||
|
||||
// Sample source site from i-th source distribution
|
||||
ParticleBank site {model::external_sources[i]->sample(seed)};
|
||||
SourceSite site {model::external_sources[i]->sample(seed)};
|
||||
|
||||
// If running in MG, convert site.E to group
|
||||
if (!settings::run_CE) {
|
||||
|
|
|
|||
|
|
@ -512,17 +512,16 @@ hid_t h5banktype() {
|
|||
// - openmc/statepoint.py
|
||||
// - docs/source/io_formats/statepoint.rst
|
||||
// - docs/source/io_formats/source.rst
|
||||
hid_t banktype = H5Tcreate(H5T_COMPOUND, sizeof(struct ParticleBank));
|
||||
H5Tinsert(banktype, "r", HOFFSET(ParticleBank, r), postype);
|
||||
H5Tinsert(banktype, "u", HOFFSET(ParticleBank, u), postype);
|
||||
H5Tinsert(banktype, "E", HOFFSET(ParticleBank, E), H5T_NATIVE_DOUBLE);
|
||||
H5Tinsert(banktype, "wgt", HOFFSET(ParticleBank, wgt), H5T_NATIVE_DOUBLE);
|
||||
H5Tinsert(banktype, "delayed_group", HOFFSET(ParticleBank, delayed_group),
|
||||
hid_t banktype = H5Tcreate(H5T_COMPOUND, sizeof(struct SourceSite));
|
||||
H5Tinsert(banktype, "r", HOFFSET(SourceSite, r), postype);
|
||||
H5Tinsert(banktype, "u", HOFFSET(SourceSite, u), postype);
|
||||
H5Tinsert(banktype, "E", HOFFSET(SourceSite, E), H5T_NATIVE_DOUBLE);
|
||||
H5Tinsert(banktype, "wgt", HOFFSET(SourceSite, wgt), H5T_NATIVE_DOUBLE);
|
||||
H5Tinsert(banktype, "delayed_group", HOFFSET(SourceSite, delayed_group),
|
||||
H5T_NATIVE_INT);
|
||||
H5Tinsert(banktype, "surf_id", HOFFSET(SourceSite, surf_id), H5T_NATIVE_INT);
|
||||
H5Tinsert(
|
||||
banktype, "surf_id", HOFFSET(ParticleBank, surf_id), H5T_NATIVE_INT);
|
||||
H5Tinsert(
|
||||
banktype, "particle", HOFFSET(ParticleBank, particle), H5T_NATIVE_INT);
|
||||
banktype, "particle", HOFFSET(SourceSite, particle), H5T_NATIVE_INT);
|
||||
|
||||
H5Tclose(postype);
|
||||
return banktype;
|
||||
|
|
@ -598,9 +597,9 @@ write_source_bank(hid_t group_id, bool surf_source_bank)
|
|||
|
||||
// Set vectors for source bank and starting bank index of each process
|
||||
vector<int64_t>* bank_index = &simulation::work_index;
|
||||
vector<ParticleBank>* source_bank = &simulation::source_bank;
|
||||
vector<SourceSite>* source_bank = &simulation::source_bank;
|
||||
vector<int64_t> surf_source_index_vector;
|
||||
vector<ParticleBank> surf_source_bank_vector;
|
||||
vector<SourceSite> surf_source_bank_vector;
|
||||
|
||||
// Reset dataspace sizes and vectors for surface source bank
|
||||
if (surf_source_bank) {
|
||||
|
|
@ -656,7 +655,7 @@ write_source_bank(hid_t group_id, bool surf_source_bank)
|
|||
|
||||
// Save source bank sites since the array is overwritten below
|
||||
#ifdef OPENMC_MPI
|
||||
vector<ParticleBank> temp_source {source_bank->begin(), source_bank->end()};
|
||||
vector<SourceSite> temp_source {source_bank->begin(), source_bank->end()};
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < mpi::n_procs; ++i) {
|
||||
|
|
@ -714,7 +713,7 @@ std::string dtype_member_names(hid_t dtype_id)
|
|||
}
|
||||
|
||||
void read_source_bank(
|
||||
hid_t group_id, vector<ParticleBank>& sites, bool distribute)
|
||||
hid_t group_id, vector<SourceSite>& sites, bool distribute)
|
||||
{
|
||||
hid_t banktype = h5banktype();
|
||||
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ vector<VolumeCalculation::Result> VolumeCalculation::execute() const
|
|||
{
|
||||
// Shared data that is collected from all threads
|
||||
int n = domain_ids_.size();
|
||||
vector<std::vector<int>> master_indices(
|
||||
vector<vector<int>> master_indices(
|
||||
n); // List of material indices for each domain
|
||||
vector<std::vector<int>> master_hits(
|
||||
vector<vector<int>> master_hits(
|
||||
n); // Number of hits for each material in each domain
|
||||
int iterations = 0;
|
||||
|
||||
|
|
@ -121,8 +121,8 @@ vector<VolumeCalculation::Result> VolumeCalculation::execute() const
|
|||
#pragma omp parallel
|
||||
{
|
||||
// Variables that are private to each thread
|
||||
vector<std::vector<int>> indices(n);
|
||||
vector<std::vector<int>> hits(n);
|
||||
vector<vector<int>> indices(n);
|
||||
vector<vector<int>> hits(n);
|
||||
Particle p;
|
||||
|
||||
// Sample locations and count hits
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
class CustomSource : public openmc::Source
|
||||
{
|
||||
openmc::ParticleBank sample(uint64_t* seed) const
|
||||
openmc::SourceSite sample(uint64_t* seed) const
|
||||
{
|
||||
openmc::ParticleBank particle;
|
||||
openmc::SourceSite particle;
|
||||
// wgt
|
||||
particle.particle = openmc::ParticleType::neutron;
|
||||
particle.wgt = 1.0;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ class CustomSource : public openmc::Source {
|
|||
CustomSource(double energy) : energy_(energy) { }
|
||||
|
||||
// Samples from an instance of this class.
|
||||
openmc::ParticleBank sample(uint64_t* seed) const
|
||||
openmc::SourceSite sample(uint64_t* seed) const
|
||||
{
|
||||
openmc::ParticleBank particle;
|
||||
openmc::SourceSite particle;
|
||||
// wgt
|
||||
particle.particle = openmc::ParticleType::neutron;
|
||||
particle.wgt = 1.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue