From 061156e79a75ca515c7a9db56da41b718fdab7dc Mon Sep 17 00:00:00 2001 From: Gavin Ridley Date: Thu, 29 Apr 2021 16:23:54 -0400 Subject: [PATCH] address PR comments --- include/openmc/bank.h | 6 ++--- include/openmc/cell.h | 2 +- include/openmc/constants.h | 6 ++--- include/openmc/cross_sections.h | 4 +-- include/openmc/geometry_aux.h | 4 +-- include/openmc/material.h | 6 ++--- include/openmc/mesh.h | 16 ++++++------ include/openmc/mgxs.h | 9 +++---- include/openmc/mgxs_interface.h | 10 ++++---- include/openmc/particle.h | 2 +- include/openmc/particle_data.h | 14 +++++------ include/openmc/physics.h | 2 +- include/openmc/physics_mg.h | 1 - include/openmc/source.h | 12 ++++----- include/openmc/state_point.h | 2 +- include/openmc/vector.h | 2 +- include/openmc/xsdata.h | 2 +- src/bank.cpp | 10 ++++---- src/cross_sections.cpp | 4 +-- src/eigenvalue.cpp | 2 +- src/geometry_aux.cpp | 4 +-- src/initialize.cpp | 2 +- src/material.cpp | 6 ++--- src/math_functions.cpp | 2 +- src/mesh.cpp | 12 ++++----- src/mgxs.cpp | 8 +++--- src/mgxs_interface.cpp | 13 +++++----- src/particle.cpp | 4 +-- src/physics.cpp | 4 +-- src/physics_mg.cpp | 2 +- src/source.cpp | 10 ++++---- src/state_point.cpp | 25 +++++++++---------- src/volume_calc.cpp | 8 +++--- .../source_dlopen/source_sampling.cpp | 4 +-- .../parameterized_source_sampling.cpp | 4 +-- 35 files changed, 110 insertions(+), 114 deletions(-) diff --git a/include/openmc/bank.h b/include/openmc/bank.h index 3dc09608b..95386514d 100644 --- a/include/openmc/bank.h +++ b/include/openmc/bank.h @@ -16,11 +16,11 @@ namespace openmc { namespace simulation { -extern vector source_bank; +extern vector source_bank; -extern SharedArray surf_source_bank; +extern SharedArray surf_source_bank; -extern SharedArray fission_bank; +extern SharedArray fission_bank; extern vector progeny_per_particle; diff --git a/include/openmc/cell.h b/include/openmc/cell.h index 6ecece120..c7ba0ab13 100644 --- a/include/openmc/cell.h +++ b/include/openmc/cell.h @@ -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> partitions_; + vector> partitions_; }; diff --git a/include/openmc/constants.h b/include/openmc/constants.h index 7b98085d1..ef43cafd8 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -13,9 +13,9 @@ namespace openmc { -using double_2dvec = vector>; -using double_3dvec = vector>>; -using double_4dvec = vector>>>; +using double_2dvec = vector>; +using double_3dvec = vector>>; +using double_4dvec = vector>>>; // ============================================================================ // VERSIONING NUMBERS diff --git a/include/openmc/cross_sections.h b/include/openmc/cross_sections.h index a9a160f2f..8a78a4099 100644 --- a/include/openmc/cross_sections.h +++ b/include/openmc/cross_sections.h @@ -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>& nuc_temps, - const vector>& thermal_temps); +void read_ce_cross_sections(const vector>& nuc_temps, + const vector>& thermal_temps); //! Read cross_sections.xml and populate data libraries void read_ce_cross_sections_xml(); diff --git a/include/openmc/geometry_aux.h b/include/openmc/geometry_aux.h index ff01779a4..28b19e315 100644 --- a/include/openmc/geometry_aux.h +++ b/include/openmc/geometry_aux.h @@ -42,8 +42,8 @@ void assign_temperatures(); //! table //============================================================================== -void get_temperatures(vector>& nuc_temps, - vector>& thermal_temps); +void get_temperatures( + vector>& nuc_temps, vector>& thermal_temps); //============================================================================== //! \brief Perform final setup for geometry diff --git a/include/openmc/material.h b/include/openmc/material.h index 185efcd58..7e975a1bb 100644 --- a/include/openmc/material.h +++ b/include/openmc/material.h @@ -197,9 +197,9 @@ double sternheimer_adjustment(const vector& f, double log_I, double tol, int max_iter); //! Calculate density effect correction -double density_effect(const vector& f, - const std::vector& e_b_sq, double e_p_sq, double n_conduction, - double rho, double E, double tol, int max_iter); +double density_effect(const vector& f, const vector& 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(); diff --git a/include/openmc/mesh.h b/include/openmc/mesh.h index d1d49a6c1..2e16ed22a 100644 --- a/include/openmc/mesh.h +++ b/include/openmc/mesh.h @@ -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, std::vector> plot( + virtual std::pair, vector> 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 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, std::vector> plot( + std::pair, vector> 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 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, std::vector> plot( + std::pair, vector> plot( Position plot_ll, Position plot_ur) const override; void to_hdf5(hid_t group) const override; - vector> grid_; + vector> grid_; int set_grid(); }; @@ -382,7 +382,7 @@ public: int n_surface_bins() const override; - std::pair, std::vector> plot( + std::pair, vector> 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, std::vector> plot( + std::pair, vector> plot( Position plot_ll, Position plot_ur) const override; void add_score(const std::string& var_name) override; diff --git a/include/openmc/mgxs.h b/include/openmc/mgxs.h index 4447b47cb..bfa1200e8 100644 --- a/include/openmc/mgxs.h +++ b/include/openmc/mgxs.h @@ -64,7 +64,7 @@ class Mgxs { void init(const std::string& in_name, double in_awr, const vector& in_kTs, bool in_fissionable, AngleDistributionType in_scatter_format, bool in_is_isotropic, - const vector& in_polar, const std::vector& in_azimuthal); + const vector& in_polar, const vector& 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& micros, - const std::vector& scalars, const vector& micro_ts, - int this_t); + void combine(const vector& micros, const vector& scalars, + const vector& 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& mat_kTs, - const vector& micros, const std::vector& atom_densities, + const vector& micros, const vector& atom_densities, int num_group, int num_delay); //! \brief Provides a cross section value given certain parameters diff --git a/include/openmc/mgxs_interface.h b/include/openmc/mgxs_interface.h index 01b865b97..57b5d9bf3 100644 --- a/include/openmc/mgxs_interface.h +++ b/include/openmc/mgxs_interface.h @@ -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 xs_to_read, - const vector> xs_temps); + const vector> 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 xs_to_read, vector> xs_temps); + vector xs_to_read, vector> 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> get_mat_kTs(); + vector> get_mat_kTs(); int num_energy_groups_; int num_delayed_groups_; vector xs_names_; // available names in HDF5 file vector xs_to_read_; // XS which appear in materials - vector> xs_temps_to_read_; // temperatures used + vector> xs_temps_to_read_; // temperatures used std::string cross_sections_path_; // path to MGXS h5 file vector nuclides_; vector macro_xs_; vector energy_bins_; vector energy_bin_avg_; vector rev_energy_bins_; - vector> nuc_temps_; // all available temperatures + vector> nuc_temps_; // all available temperatures }; namespace data { diff --git a/include/openmc/particle.h b/include/openmc/particle.h index 50d6a9dc9..2d38bd273 100644 --- a/include/openmc/particle.h +++ b/include/openmc/particle.h @@ -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(); diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index d45d61363..f72dc8b80 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -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 secondary_bank_; + vector secondary_bank_; int64_t current_work_; // current work index @@ -255,7 +255,7 @@ private: vector filter_matches_; // tally filter matches - vector> tracks_; // tracks for outputting to file + vector> tracks_; // tracks for outputting to file vector 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 diff --git a/include/openmc/physics.h b/include/openmc/physics.h index 5c9218956..bf16083ef 100644 --- a/include/openmc/physics.h +++ b/include/openmc/physics.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. diff --git a/include/openmc/physics_mg.h b/include/openmc/physics_mg.h index 66dad7550..05184d959 100644 --- a/include/openmc/physics_mg.h +++ b/include/openmc/physics_mg.h @@ -7,7 +7,6 @@ #include "openmc/capi.h" #include "openmc/nuclide.h" #include "openmc/particle.h" -#include "openmc/vector.h" namespace openmc { diff --git a/include/openmc/source.h b/include/openmc/source.h index 773a5859c..5cbccf272 100644 --- a/include/openmc/source.h +++ b/include/openmc/source.h @@ -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 sites_; //!< Source sites from a file + vector 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(); diff --git a/include/openmc/state_point.h b/include/openmc/state_point.h index 0d2fa12c2..5ada2bf88 100644 --- a/include/openmc/state_point.h +++ b/include/openmc/state_point.h @@ -16,7 +16,7 @@ vector 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& sites, bool distribute); + hid_t group_id, vector& sites, bool distribute); void write_tally_results_nr(hid_t file_id); void restart_set_keff(); void write_unstructured_mesh_results(); diff --git a/include/openmc/vector.h b/include/openmc/vector.h index a67eccc46..82f7fffa1 100644 --- a/include/openmc/vector.h +++ b/include/openmc/vector.h @@ -17,7 +17,7 @@ #include namespace openmc { -using std::vector; +using vector; } #endif // OPENMC_VECTOR_H diff --git a/include/openmc/xsdata.h b/include/openmc/xsdata.h index d8610d5b6..cf6d8058b 100644 --- a/include/openmc/xsdata.h +++ b/include/openmc/xsdata.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& those_xs, const std::vector& scalars); + const vector& those_xs, const vector& scalars); //! \brief Checks to see if this and that are able to be combined //! diff --git a/src/bank.cpp b/src/bank.cpp index a14020784..d5d364756 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -16,15 +16,15 @@ namespace openmc { namespace simulation { -vector source_bank; +vector source_bank; -SharedArray surf_source_bank; +SharedArray 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 fission_bank; +SharedArray 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 sorted_bank_holder; + SourceSite* sorted_bank; + vector 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) { diff --git a/src/cross_sections.cpp b/src/cross_sections.cpp index 53cb0a0da..506f6af52 100644 --- a/src/cross_sections.cpp +++ b/src/cross_sections.cpp @@ -181,8 +181,8 @@ void read_cross_sections_xml() } } -void read_ce_cross_sections(const vector>& nuc_temps, - const vector>& thermal_temps) +void read_ce_cross_sections(const vector>& nuc_temps, + const vector>& thermal_temps) { std::unordered_set already_read; diff --git a/src/eigenvalue.cpp b/src/eigenvalue.cpp index fbd3eceb9..84d5fec0b 100644 --- a/src/eigenvalue.cpp +++ b/src/eigenvalue.cpp @@ -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 temp_sites(3 * simulation::work_per_rank); + vector 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]; diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index c3170922f..f7eaac99d 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -191,8 +191,8 @@ assign_temperatures() //============================================================================== -void get_temperatures(vector>& nuc_temps, - vector>& thermal_temps) +void get_temperatures( + vector>& nuc_temps, vector>& thermal_temps) { for (const auto& cell : model::cells) { // Skip non-material cells. diff --git a/src/initialize.cpp b/src/initialize.cpp index 239834c4e..e22367d81 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -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]); diff --git a/src/material.cpp b/src/material.cpp index 80c6de3c1..3ef0ce765 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -1144,9 +1144,9 @@ double sternheimer_adjustment(const vector& f, return rho; } -double density_effect(const vector& f, - const std::vector& e_b_sq, double e_p_sq, double n_conduction, - double rho, double E, double tol, int max_iter) +double density_effect(const vector& f, const vector& 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(); diff --git a/src/math_functions.cpp b/src/math_functions.cpp index bff3fd0f9..8c4cfd5df 100644 --- a/src/math_functions.cpp +++ b/src/math_functions.cpp @@ -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> zn_mat(n + 1, std::vector(n + 1)); + vector> zn_mat(n + 1, vector(n + 1)); // Fill the main diagonal first (Eq 3.9 in Chong) for (int p = 0; p <= n; p++) { diff --git a/src/mesh.cpp b/src/mesh.cpp index a179dfcea..94248027a 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -284,7 +284,7 @@ int StructuredMesh::n_surface_bins() const } xt::xtensor 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, std::vector> RegularMesh::plot( +std::pair, vector> 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 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, std::vector> RectilinearMesh::plot( +std::pair, vector> 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, std::vector> MOABMesh::plot( +std::pair, vector> 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, std::vector> LibMesh::plot( +std::pair, vector> LibMesh::plot( Position plot_ll, Position plot_ur) const { return {}; diff --git a/src/mgxs.cpp b/src/mgxs.cpp index 21c6b4b3c..00263b541 100644 --- a/src/mgxs.cpp +++ b/src/mgxs.cpp @@ -32,7 +32,7 @@ namespace openmc { void Mgxs::init(const std::string& in_name, double in_awr, const vector& in_kTs, bool in_fissionable, AngleDistributionType in_scatter_format, bool in_is_isotropic, - const vector& in_polar, const std::vector& in_azimuthal) + const vector& in_polar, const vector& in_azimuthal) { // Set the metadata name = in_name; @@ -307,7 +307,7 @@ Mgxs::Mgxs( //============================================================================== Mgxs::Mgxs(const std::string& in_name, const vector& mat_kTs, - const vector& micros, const std::vector& atom_densities, + const vector& micros, const vector& 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& mat_kTs, //============================================================================== -void Mgxs::combine(const vector& micros, - const std::vector& scalars, const vector& micro_ts, int this_t) +void Mgxs::combine(const vector& micros, const vector& scalars, + const vector& micro_ts, int this_t) { // Build the vector of pointers to the xs objects within micros vector those_xs(micros.size()); diff --git a/src/mgxs_interface.cpp b/src/mgxs_interface.cpp index c64ab4631..227896d80 100644 --- a/src/mgxs_interface.cpp +++ b/src/mgxs_interface.cpp @@ -29,8 +29,7 @@ namespace data { } MgxsInterface::MgxsInterface(const std::string& path_cross_sections, - const vector xs_to_read, - const vector> xs_temps) + const vector xs_to_read, const vector> 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 xs_to_read, vector> xs_temps) + vector xs_to_read, vector> xs_temps) { // Check to remove all duplicates xs_to_read_ = xs_to_read; @@ -148,9 +147,9 @@ void MgxsInterface::create_macro_xs() //============================================================================== -vector> MgxsInterface::get_mat_kTs() +vector> MgxsInterface::get_mat_kTs() { - vector> kTs(model::materials.size()); + vector> 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> nuc_temps(data::nuclide_map.size()); - vector> dummy; + vector> nuc_temps(data::nuclide_map.size()); + vector> dummy; get_temperatures(nuc_temps, dummy); // Build vector of nuclide names which are to be read diff --git a/src/particle.cpp b/src/particle.cpp index 3e91e55c4..4c4af71e9 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -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(); diff --git a/src/physics.cpp b/src/physics.cpp index c268c3dc5..2deb5ac34 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -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 diff --git a/src/physics_mg.cpp b/src/physics_mg.cpp index 286440838..06ed845de 100644 --- a/src/physics_mg.cpp +++ b/src/physics_mg.cpp @@ -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; diff --git a/src/source.cpp b/src/source.cpp index e0b45a183..909e87125 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -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) { diff --git a/src/state_point.cpp b/src/state_point.cpp index 6d30dc70b..61c2a5339 100644 --- a/src/state_point.cpp +++ b/src/state_point.cpp @@ -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* bank_index = &simulation::work_index; - vector* source_bank = &simulation::source_bank; + vector* source_bank = &simulation::source_bank; vector surf_source_index_vector; - vector surf_source_bank_vector; + vector 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 temp_source {source_bank->begin(), source_bank->end()}; + vector 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& sites, bool distribute) + hid_t group_id, vector& sites, bool distribute) { hid_t banktype = h5banktype(); diff --git a/src/volume_calc.cpp b/src/volume_calc.cpp index 17528ca58..0b37781c3 100644 --- a/src/volume_calc.cpp +++ b/src/volume_calc.cpp @@ -98,9 +98,9 @@ vector VolumeCalculation::execute() const { // Shared data that is collected from all threads int n = domain_ids_.size(); - vector> master_indices( + vector> master_indices( n); // List of material indices for each domain - vector> master_hits( + vector> master_hits( n); // Number of hits for each material in each domain int iterations = 0; @@ -121,8 +121,8 @@ vector VolumeCalculation::execute() const #pragma omp parallel { // Variables that are private to each thread - vector> indices(n); - vector> hits(n); + vector> indices(n); + vector> hits(n); Particle p; // Sample locations and count hits diff --git a/tests/regression_tests/source_dlopen/source_sampling.cpp b/tests/regression_tests/source_dlopen/source_sampling.cpp index d212f9675..2c6de6d85 100644 --- a/tests/regression_tests/source_dlopen/source_sampling.cpp +++ b/tests/regression_tests/source_dlopen/source_sampling.cpp @@ -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; diff --git a/tests/regression_tests/source_parameterized_dlopen/parameterized_source_sampling.cpp b/tests/regression_tests/source_parameterized_dlopen/parameterized_source_sampling.cpp index ba5958dd5..bf49af4c3 100644 --- a/tests/regression_tests/source_parameterized_dlopen/parameterized_source_sampling.cpp +++ b/tests/regression_tests/source_parameterized_dlopen/parameterized_source_sampling.cpp @@ -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;