mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Got it all working, next would like to take advantage of the xtensor features to reduce lines of code
This commit is contained in:
parent
4e92988433
commit
35def7aac2
9 changed files with 200 additions and 332 deletions
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
// TODO: Replace with xtensor/other library?
|
||||
typedef std::vector<double> double_1dvec;
|
||||
typedef std::vector<std::vector<double> > double_2dvec;
|
||||
typedef std::vector<std::vector<std::vector<double> > > double_3dvec;
|
||||
typedef std::vector<std::vector<std::vector<std::vector<double> > > > double_4dvec;
|
||||
|
|
|
|||
|
|
@ -50,10 +50,6 @@ void
|
|||
read_nd_vector(hid_t obj_id, const char* name, xt::xtensor<double, 1>& result,
|
||||
bool must_have = false);
|
||||
|
||||
void
|
||||
read_nd_vector(hid_t obj_id, const char* name, std::vector<double>& result,
|
||||
bool must_have = false);
|
||||
|
||||
void
|
||||
read_nd_vector(hid_t obj_id, const char* name, xt::xtensor<double, 2>& result,
|
||||
bool must_have = false);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class ScattData {
|
|||
|
||||
//! \brief Combines microscopic ScattDatas into a macroscopic one.
|
||||
void
|
||||
base_combine(int max_order, const std::vector<ScattData*>& those_scatts,
|
||||
const double_1dvec& scalars, xt::xtensor<int, 1>& in_gmin,
|
||||
base_combine(size_t max_order, const std::vector<ScattData*>& those_scatts,
|
||||
const std::vector<double>& scalars, xt::xtensor<int, 1>& in_gmin,
|
||||
xt::xtensor<int, 1>& in_gmax, double_2dvec& sparse_mult,
|
||||
double_3dvec& sparse_scatter);
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ class ScattData {
|
|||
//! @param scalars Scalars to multiply the microscopic data by.
|
||||
virtual void
|
||||
combine(const std::vector<ScattData*>& those_scatts,
|
||||
const double_1dvec& scalars) = 0;
|
||||
const std::vector<double>& scalars) = 0;
|
||||
|
||||
//! \brief Getter for the dimensionality of the scattering order.
|
||||
//!
|
||||
|
|
@ -93,7 +93,7 @@ class ScattData {
|
|||
//! of points, and for Histogram this is the number of bins.
|
||||
//!
|
||||
//! @return The order.
|
||||
virtual int
|
||||
virtual size_t
|
||||
get_order() = 0;
|
||||
|
||||
//! \brief Builds a dense scattering matrix from the constituent parts
|
||||
|
|
@ -102,7 +102,7 @@ class ScattData {
|
|||
//! requested; ignored otherwise.
|
||||
//! @return The dense scattering matrix.
|
||||
virtual xt::xtensor<double, 3>
|
||||
get_matrix(int max_order) = 0;
|
||||
get_matrix(size_t max_order) = 0;
|
||||
|
||||
//! \brief Samples the outgoing energy from the ScattData info.
|
||||
//!
|
||||
|
|
@ -151,7 +151,7 @@ class ScattDataLegendre: public ScattData {
|
|||
|
||||
void
|
||||
combine(const std::vector<ScattData*>& those_scatts,
|
||||
const double_1dvec& scalars);
|
||||
const std::vector<double>& scalars);
|
||||
|
||||
//! \brief Find the maximal value of the angular distribution to use as a
|
||||
// bounding box with rejection sampling.
|
||||
|
|
@ -164,11 +164,11 @@ class ScattDataLegendre: public ScattData {
|
|||
void
|
||||
sample(int gin, int& gout, double& mu, double& wgt);
|
||||
|
||||
int
|
||||
size_t
|
||||
get_order() {return dist[0][0].size() - 1;};
|
||||
|
||||
xt::xtensor<double, 3>
|
||||
get_matrix(int max_order);
|
||||
get_matrix(size_t max_order);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -192,7 +192,7 @@ class ScattDataHistogram: public ScattData {
|
|||
|
||||
void
|
||||
combine(const std::vector<ScattData*>& those_scatts,
|
||||
const double_1dvec& scalars);
|
||||
const std::vector<double>& scalars);
|
||||
|
||||
double
|
||||
calc_f(int gin, int gout, double mu);
|
||||
|
|
@ -200,11 +200,11 @@ class ScattDataHistogram: public ScattData {
|
|||
void
|
||||
sample(int gin, int& gout, double& mu, double& wgt);
|
||||
|
||||
int
|
||||
size_t
|
||||
get_order() {return dist[0][0].size();};
|
||||
|
||||
xt::xtensor<double, 3>
|
||||
get_matrix(int max_order);
|
||||
get_matrix(size_t max_order);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -234,7 +234,7 @@ class ScattDataTabular: public ScattData {
|
|||
|
||||
void
|
||||
combine(const std::vector<ScattData*>& those_scatts,
|
||||
const double_1dvec& scalars);
|
||||
const std::vector<double>& scalars);
|
||||
|
||||
double
|
||||
calc_f(int gin, int gout, double mu);
|
||||
|
|
@ -242,10 +242,11 @@ class ScattDataTabular: public ScattData {
|
|||
void
|
||||
sample(int gin, int& gout, double& mu, double& wgt);
|
||||
|
||||
int
|
||||
size_t
|
||||
get_order() {return dist[0][0].size();};
|
||||
|
||||
xt::xtensor<double, 3> get_matrix(int max_order);
|
||||
xt::xtensor<double, 3>
|
||||
get_matrix(size_t max_order);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ class XsData {
|
|||
private:
|
||||
//! \brief Reads scattering data from the HDF5 file
|
||||
void
|
||||
scatter_from_hdf5(hid_t xsdata_grp, int n_pol, int n_azi, int energy_groups,
|
||||
scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang, size_t energy_groups,
|
||||
int scatter_format, int final_scatter_format, int order_data,
|
||||
int max_order, int legendre_to_tabular_points);
|
||||
|
||||
//! \brief Reads fission data from the HDF5 file
|
||||
void
|
||||
fission_from_hdf5(hid_t xsdata_grp, int n_pol, int n_azi, int energy_groups,
|
||||
int delayed_groups, bool is_isotropic);
|
||||
fission_from_hdf5(hid_t xsdata_grp, size_t n_ang, size_t energy_groups,
|
||||
size_t delayed_groups, bool is_isotropic);
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ class XsData {
|
|||
//! @param scatter_format The scattering representation of the file.
|
||||
//! @param n_pol Number of polar angles.
|
||||
//! @param n_azi Number of azimuthal angles.
|
||||
XsData(int num_groups, int num_delayed_groups, bool fissionable,
|
||||
XsData(size_t num_groups, size_t num_delayed_groups, bool fissionable,
|
||||
int scatter_format, int n_pol, int n_azi);
|
||||
|
||||
//! \brief Loads the XsData object from the HDF5 file
|
||||
|
|
@ -103,7 +103,7 @@ class XsData {
|
|||
//! @param micros Microscopic objects to combine.
|
||||
//! @param scalars Scalars to multiply the microscopic data by.
|
||||
void
|
||||
combine(const std::vector<XsData*>& those_xs, const double_1dvec& scalars);
|
||||
combine(const std::vector<XsData*>& those_xs, const std::vector<double>& scalars);
|
||||
|
||||
//! \brief Checks to see if this and that are able to be combined
|
||||
//!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue