Address #1101 comments

This commit is contained in:
Sterling Harper 2018-10-22 21:55:06 -04:00
parent fa419332c9
commit 321b255aea
35 changed files with 200 additions and 98 deletions

View file

@ -7,7 +7,7 @@
#include "openmc/hdf5_interface.h"
#include "openmc/particle.h"
#include "openmc/xml_interface.h"
#include "pugixml.hpp"
namespace openmc {
@ -43,10 +43,10 @@ public:
class Filter
{
public:
virtual std::string type() const = 0;
virtual ~Filter() = 0;
virtual std::string type() const = 0;
//! Uses an XML input to fill the filter's data fields.
virtual void from_xml(pugi::xml_node node) = 0;
@ -55,7 +55,7 @@ public:
//! \param[out] match will contain the matching bins and corresponding
//! weights; note that there may be zero matching bins
virtual void
get_all_bins(Particle* p, int estimator, FilterMatch& match) const = 0;
get_all_bins(const Particle* p, int estimator, FilterMatch& match) const = 0;
//! Writes data describing this filter to an HDF5 statepoint group.
virtual void

View file

@ -21,7 +21,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -24,14 +24,17 @@ public:
void initialize() override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
std::string text_label(int bin) const override;
//! The indices of the cells binned by this filter.
std::vector<int32_t> cells_;
//! A map from cell indices to filter bin indices.
std::unordered_map<int32_t, int> map_;
};

View file

@ -16,7 +16,7 @@ class CellbornFilter : public CellFilter
public:
std::string type() const override {return "cellborn";}
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;

View file

@ -16,7 +16,7 @@ class CellFromFilter : public CellFilter
public:
std::string type() const override {return "cellfrom";}
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;

View file

@ -22,7 +22,7 @@ public:
void initialize() override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -27,14 +27,17 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
std::string text_label(int bin) const override;
//! Incident neutron energy interpolation grid.
std::vector<double> energy_;
//! Interpolant values.
std::vector<double> y_;
};

View file

@ -20,7 +20,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -24,14 +24,17 @@ public:
void initialize() override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
std::string text_label(int bin) const override;
//! The indices of the materials binned by this filter.
std::vector<int32_t> materials_;
//! A map from material indices to filter bin indices.
std::unordered_map<int32_t, int> map_;
};

View file

@ -22,7 +22,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -12,7 +12,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;

View file

@ -21,7 +21,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -21,7 +21,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -25,7 +25,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
@ -33,6 +33,8 @@ public:
std::string text_label(int bin) const override;
int order_;
//! The type of angle that this filter measures when binning events.
SphericalHarmonicsCosine cosine_ {SphericalHarmonicsCosine::particle};
};

View file

@ -25,7 +25,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
@ -33,8 +33,15 @@ public:
std::string text_label(int bin) const override;
int order_;
//! The Cartesian coordinate axis that the Legendre expansion is applied to.
LegendreAxis axis_;
double min_, max_;
//! The minimum coordinate along the reference axis that the expansion covers.
double min_;
//! The maximum coordinate along the reference axis that the expansion covers.
double max_;
};
} // namespace openmc

View file

@ -24,14 +24,17 @@ public:
void initialize() override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
std::string text_label(int bin) const override;
//! The indices of the surfaces binned by this filter.
std::vector<int32_t> surfaces_;
//! A map from surface indices to filter bin indices.
std::unordered_map<int32_t, int> map_;
};

View file

@ -24,14 +24,17 @@ public:
void initialize() override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
std::string text_label(int bin) const override;
//! The indices of the universes binned by this filter.
std::vector<int32_t> universes_;
//! A map from universe indices to filter bin indices.
std::unordered_map<int32_t, int> map_;
};

View file

@ -20,17 +20,28 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
std::string text_label(int bin) const override;
virtual void calc_n_bins() {n_bins_ = ((order_+1) * (order_+2)) / 2;}
int order() const {return order_;}
virtual void set_order(int order);
//! Cartesian x coordinate for the origin of this expansion.
double x_;
//! Cartesian y coordinate for the origin of this expansion.
double y_;
//! Maximum radius from the origin covered by this expansion.
double r_;
protected:
int order_;
double x_, y_, r_;
};
//==============================================================================
@ -42,12 +53,12 @@ class ZernikeRadialFilter : public ZernikeFilter
public:
std::string type() const override {return "zernikeradial";}
void get_all_bins(Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;
void calc_n_bins() override {n_bins_ = order_ / 2 + 1;}
void set_order(int order) override;
};
} // namespace openmc