From 12ec9bacff330c60ec37d54e9efa0ac141b865f9 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Fri, 22 Nov 2019 22:56:16 +0000 Subject: [PATCH] cleanup of comments and adding some parameter descriptions for altered function prototypes --- include/openmc/distribution.h | 16 ++++++++++++++++ include/openmc/distribution_angle.h | 2 ++ include/openmc/distribution_multi.h | 8 ++++++++ include/openmc/distribution_spatial.h | 8 ++++++++ include/openmc/math_functions.h | 4 ++-- include/openmc/physics.h | 4 ++-- include/openmc/plot.h | 7 ++++--- include/openmc/secondary_correlated.h | 2 ++ include/openmc/secondary_nbody.h | 2 ++ include/openmc/secondary_thermal.h | 10 ++++++++++ include/openmc/secondary_uncorrelated.h | 2 ++ include/openmc/source.h | 3 +++ include/openmc/thermal.h | 2 ++ openmc/lib/math.py | 6 +++--- 14 files changed, 66 insertions(+), 10 deletions(-) diff --git a/include/openmc/distribution.h b/include/openmc/distribution.h index e12a476ee..c53511a73 100644 --- a/include/openmc/distribution.h +++ b/include/openmc/distribution.h @@ -34,6 +34,8 @@ public: Discrete(const double* x, const double* p, int n); //! Sample a value from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled value double sample(uint64_t * prn_seeds, int stream) const; @@ -58,6 +60,8 @@ public: Uniform(double a, double b) : a_{a}, b_{b} {}; //! Sample a value from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled value double sample(uint64_t * prn_seeds, int stream) const; private: @@ -75,6 +79,8 @@ public: Maxwell(double theta) : theta_{theta} { }; //! Sample a value from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled value double sample(uint64_t * prn_seeds, int stream) const; private: @@ -91,6 +97,8 @@ public: Watt(double a, double b) : a_{a}, b_{b} { }; //! Sample a value from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled value double sample(uint64_t * prn_seeds, int stream) const; private: @@ -108,6 +116,8 @@ public: Normal(double mean_value, double std_dev) : mean_value_{mean_value}, std_dev_{std_dev} { }; //! Sample a value from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled value double sample(uint64_t * prn_seeds, int stream) const; private: @@ -126,6 +136,8 @@ public: Muir(double e0, double m_rat, double kt) : e0_{e0}, m_rat_{m_rat}, kt_{kt} { }; //! Sample a value from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled value double sample(uint64_t * prn_seeds, int stream) const; private: @@ -148,6 +160,8 @@ public: const double* c=nullptr); //! Sample a value from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled value double sample(uint64_t * prn_seeds, int stream) const; @@ -178,6 +192,8 @@ public: Equiprobable(const double* x, int n) : x_{x, x+n} { }; //! Sample a value from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled value double sample(uint64_t * prn_seeds, int stream) const; private: diff --git a/include/openmc/distribution_angle.h b/include/openmc/distribution_angle.h index 7d8af1fb1..c571aa61d 100644 --- a/include/openmc/distribution_angle.h +++ b/include/openmc/distribution_angle.h @@ -23,6 +23,8 @@ public: //! Sample an angle given an incident particle energy //! \param[in] E Particle energy in [eV] + //! \param[inout] prn_seeds Array of pseudorandom number seeds + //! \param[in] stream Pseudorandom stream index //! \return Cosine of the angle in the range [-1,1] double sample(double E, uint64_t * prn_seeds, int stream) const; diff --git a/include/openmc/distribution_multi.h b/include/openmc/distribution_multi.h index 65e7ae005..bc62386a0 100644 --- a/include/openmc/distribution_multi.h +++ b/include/openmc/distribution_multi.h @@ -23,6 +23,8 @@ public: virtual ~UnitSphereDistribution() = default; //! Sample a direction from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Direction sampled virtual Direction sample(uint64_t * prn_seeds, int stream) const = 0; @@ -39,6 +41,8 @@ public: explicit PolarAzimuthal(pugi::xml_node node); //! Sample a direction from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Direction sampled Direction sample(uint64_t * prn_seeds, int stream) const; private: @@ -55,6 +59,8 @@ public: Isotropic() { }; //! Sample a direction from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled direction Direction sample(uint64_t * prn_seeds, int stream) const; }; @@ -69,6 +75,8 @@ public: explicit Monodirectional(pugi::xml_node node) : UnitSphereDistribution{node} { }; //! Sample a direction from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled direction Direction sample(uint64_t * prn_seeds, int stream) const; }; diff --git a/include/openmc/distribution_spatial.h b/include/openmc/distribution_spatial.h index 8642fd453..8d4aee5d5 100644 --- a/include/openmc/distribution_spatial.h +++ b/include/openmc/distribution_spatial.h @@ -29,6 +29,8 @@ public: explicit CartesianIndependent(pugi::xml_node node); //! Sample a position from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled position Position sample(uint64_t * prn_seeds, int stream) const; private: @@ -46,6 +48,8 @@ public: explicit SphericalIndependent(pugi::xml_node node); //! Sample a position from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled position Position sample(uint64_t * prn_seeds, int stream) const; private: @@ -64,6 +68,8 @@ public: explicit SpatialBox(pugi::xml_node node, bool fission=false); //! Sample a position from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled position Position sample(uint64_t * prn_seeds, int stream) const; @@ -86,6 +92,8 @@ public: explicit SpatialPoint(pugi::xml_node node); //! Sample a position from the distribution + //! \param prn_seeds Array of pseudorandom number seeds + //! \param stream Pseudorandom stream index //! \return Sampled position Position sample(uint64_t * prn_seeds, int stream) const; private: diff --git a/include/openmc/math_functions.h b/include/openmc/math_functions.h index 4246e354d..e2642c1a3 100644 --- a/include/openmc/math_functions.h +++ b/include/openmc/math_functions.h @@ -206,8 +206,8 @@ extern "C" double normal_variate(double mean, double std_dev, uint64_t * prn_see //! @result The sampled outgoing energy //============================================================================== -extern "C" double muir_spectrum(double e0, double m_rat, double kt, uint64_t * prn_seeds, - int stream); +extern "C" double muir_spectrum(double e0, double m_rat, double kt, + uint64_t * prn_seeds, int stream); //============================================================================== //! Doppler broadens the windowed multipole curvefit. diff --git a/include/openmc/physics.h b/include/openmc/physics.h index 35063ca0e..6726e56dc 100644 --- a/include/openmc/physics.h +++ b/include/openmc/physics.h @@ -81,8 +81,8 @@ Direction sample_target_velocity(const Nuclide* nuc, double E, Direction u, Direction sample_cxs_target_velocity(double awr, double E, Direction u, double kT, uint64_t * prn_seeds, int stream); -void sample_fission_neutron(int i_nuclide, const Reaction* rx, double E_in, Particle::Bank* site, - uint64_t * prn_seeds, int stream); +void sample_fission_neutron(int i_nuclide, const Reaction* rx, double E_in, + Particle::Bank* site, uint64_t * prn_seeds, int stream); //! 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/plot.h b/include/openmc/plot.h index b1432b442..04db9710a 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -28,8 +28,9 @@ namespace model { extern std::vector plots; //!< Plot instance container extern std::unordered_map plot_map; //!< map of plot ids to index -extern uint64_t plotter_prn_seeds[N_STREAMS]; -extern int plotter_stream; + +extern uint64_t plotter_prn_seeds[N_STREAMS]; // Random number seeds used for plotter +extern int plotter_stream; // Stream index used by the plotter } // namespace model @@ -288,7 +289,7 @@ void create_voxel(Plot pl); //! Create a randomly generated RGB color //! \return RGBColor with random value -RGBColor random_color(void); +RGBColor random_color(); } // namespace openmc diff --git a/include/openmc/secondary_correlated.h b/include/openmc/secondary_correlated.h index b240034d8..595fc4391 100644 --- a/include/openmc/secondary_correlated.h +++ b/include/openmc/secondary_correlated.h @@ -38,6 +38,8 @@ public: //! \param[in] E_in Incoming energy in [eV] //! \param[out] E_out Outgoing energy in [eV] //! \param[out] mu Outgoing cosine with respect to current direction + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void sample(double E_in, double& E_out, double& mu, uint64_t * prn_seeds, int stream) const override; diff --git a/include/openmc/secondary_nbody.h b/include/openmc/secondary_nbody.h index 13a13cc19..d8a1dafdf 100644 --- a/include/openmc/secondary_nbody.h +++ b/include/openmc/secondary_nbody.h @@ -24,6 +24,8 @@ public: //! \param[in] E_in Incoming energy in [eV] //! \param[out] E_out Outgoing energy in [eV] //! \param[out] mu Outgoing cosine with respect to current direction + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void sample(double E_in, double& E_out, double& mu, uint64_t * prn_seeds, int stream) const override; private: diff --git a/include/openmc/secondary_thermal.h b/include/openmc/secondary_thermal.h index 17b5fe9f3..edd7356f6 100644 --- a/include/openmc/secondary_thermal.h +++ b/include/openmc/secondary_thermal.h @@ -31,6 +31,8 @@ public: //! \param[in] E_in Incoming energy in [eV] //! \param[out] E_out Outgoing energy in [eV] //! \param[out] mu Outgoing cosine with respect to current direction + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void sample(double E_in, double& E_out, double& mu, uint64_t * prn_seeds, int stream) const override; private: @@ -52,6 +54,8 @@ public: //! \param[in] E_in Incoming energy in [eV] //! \param[out] E_out Outgoing energy in [eV] //! \param[out] mu Outgoing cosine with respect to current direction + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void sample(double E_in, double& E_out, double& mu, uint64_t * prn_seeds, int stream) const override; private: @@ -74,6 +78,8 @@ public: //! \param[in] E_in Incoming energy in [eV] //! \param[out] E_out Outgoing energy in [eV] //! \param[out] mu Outgoing cosine with respect to current direction + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void sample(double E_in, double& E_out, double& mu, uint64_t * prn_seeds, int stream) const override; private: @@ -97,6 +103,8 @@ public: //! \param[in] E_in Incoming energy in [eV] //! \param[out] E_out Outgoing energy in [eV] //! \param[out] mu Outgoing cosine with respect to current direction + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void sample(double E_in, double& E_out, double& mu, uint64_t * prn_seeds, int stream) const override; private: @@ -121,6 +129,8 @@ public: //! \param[in] E_in Incoming energy in [eV] //! \param[out] E_out Outgoing energy in [eV] //! \param[out] mu Outgoing cosine with respect to current direction + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void sample(double E_in, double& E_out, double& mu, uint64_t * prn_seeds, int stream) const override; private: diff --git a/include/openmc/secondary_uncorrelated.h b/include/openmc/secondary_uncorrelated.h index 69d097af6..5cde70b4a 100644 --- a/include/openmc/secondary_uncorrelated.h +++ b/include/openmc/secondary_uncorrelated.h @@ -29,6 +29,8 @@ public: //! \param[in] E_in Incoming energy in [eV] //! \param[out] E_out Outgoing energy in [eV] //! \param[out] mu Outgoing cosine with respect to current direction + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void sample(double E_in, double& E_out, double& mu, uint64_t * prn_seeds, int stream) const override; diff --git a/include/openmc/source.h b/include/openmc/source.h index 639f6ecab..5826fe93e 100644 --- a/include/openmc/source.h +++ b/include/openmc/source.h @@ -38,6 +38,8 @@ public: explicit SourceDistribution(pugi::xml_node node); //! Sample from the external source distribution + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index //! \return Sampled site Particle::Bank sample(uint64_t * prn_seed, int stream) const; @@ -60,6 +62,7 @@ extern "C" void initialize_source(); //! Sample a site from all external source distributions in proportion to their //! source strength +//! \param[inout] prn_seeds Array of pseudorandom seeds //! \return Sampled source site Particle::Bank sample_external_source(uint64_t * prn_seeds); diff --git a/include/openmc/thermal.h b/include/openmc/thermal.h index b17cbca56..b0a50de65 100644 --- a/include/openmc/thermal.h +++ b/include/openmc/thermal.h @@ -102,6 +102,8 @@ public: //! \param[out] i_temp corresponding temperature index //! \param[out] elastic Thermal elastic scattering cross section //! \param[out] inelastic Thermal inelastic scattering cross section + //! \param[inout] prn_seeds Array of pseudorandom seeds + //! \param[in] stream Pseudorandom stream index void calculate_xs(double E, double sqrtkT, int* i_temp, double* elastic, double* inelastic, uint64_t * prn_seeds, int stream) const; diff --git a/openmc/lib/math.py b/openmc/lib/math.py index d836ce491..1d0265e03 100644 --- a/openmc/lib/math.py +++ b/openmc/lib/math.py @@ -144,7 +144,7 @@ def calc_zn(n, rho, phi): rho : float Radial location in the unit disk phi : float - Theta (radians) location in the unit disk + Theta (radians) location in the unit disk Returns ------- @@ -195,8 +195,8 @@ def rotate_angle(uvw0, mu, phi, prn_seeds, stream ): Original direction cosine mu : float Polar angle cosine to rotate - phi : iterable of float - Azimuthal angle; if NULL, one will be sampled uniformly + phi : float + Azimuthal angle; if None, one will be sampled uniformly prn_seeds : iterable of int PRNG seed array stream : int