Switch to use of FilterType enum for comparisons

This commit is contained in:
Patrick Shriwise 2022-11-05 21:14:59 -05:00
parent 20718f5121
commit 06fbf3fe01
29 changed files with 75 additions and 44 deletions

View file

@ -24,24 +24,25 @@ enum class FilterType {
CELL,
CELL_INSTANCE,
COLLISION,
DELAYEDGROUP,
DELAYED_GROUP,
DISTRIBCELL,
ENERGYFUNC,
ENERGY_FUNCTION,
ENERGY,
ENERGY_OUT,
LEGENDRE,
MATCH,
MATERIAL,
MESH,
MESHSURFACE,
MESH_SURFACE,
MU,
PARTICLE,
POLAR,
SPH_HARM,
SPTL_LEGENDRE,
SPHERICAL_HARMONICS,
SPATIAL_LEGENDRE,
SURFACE,
TIME,
UNIVERSE,
ZERNIKE,
ZERNIKE_RADIAL
};
//==============================================================================
@ -85,7 +86,8 @@ public:
//----------------------------------------------------------------------------
// Methods
virtual std::string type() const = 0;
virtual std::string type_str() const = 0;
virtual FilterType type() const = 0;
//! Matches a tally event to a set of filter bins and weights.
//!
@ -99,7 +101,7 @@ public:
//! Writes data describing this filter to an HDF5 statepoint group.
virtual void to_statepoint(hid_t filter_group) const
{
write_dataset(filter_group, "type", type());
write_dataset(filter_group, "type", type_str());
write_dataset(filter_group, "n_bins", n_bins_);
}

View file

@ -24,7 +24,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "azimuthal"; }
std::string type_str() const override { return "azimuthal"; }
FilterType type() const override { return FilterType::AZIMUTHAL; }
void from_xml(pugi::xml_node node) override;

View file

@ -25,7 +25,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "cell"; }
std::string type_str() const override { return "cell"; }
FilterType type() const override { return FilterType::CELL; }
void from_xml(pugi::xml_node node) override;

View file

@ -28,7 +28,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "cellinstance"; }
std::string type_str() const override { return "cellinstance"; }
FilterType type() const override { return FilterType::CELL_INSTANCE; }
void from_xml(pugi::xml_node node) override;

View file

@ -16,7 +16,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "cellborn"; }
std::string type_str() const override { return "cellborn"; }
FilterType type() const override { return FilterType::CELLBORN; }
void get_all_bins(const Particle& p, TallyEstimator estimator,
FilterMatch& match) const override;

View file

@ -16,7 +16,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "cellfrom"; }
std::string type_str() const override { return "cellfrom"; }
FilterType type() const override { return FilterType::CELLFROM; }
void get_all_bins(const Particle& p, TallyEstimator estimator,
FilterMatch& match) const override;

View file

@ -23,7 +23,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "collision"; }
std::string type_str() const override { return "collision"; }
FilterType type() const override { return FilterType::COLLISION; }
void from_xml(pugi::xml_node node) override;

View file

@ -25,7 +25,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "delayedgroup"; }
std::string type_str() const override { return "delayedgroup"; }
FilterType type() const override { return FilterType::DELAYED_GROUP; }
void from_xml(pugi::xml_node node) override;

View file

@ -21,7 +21,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "distribcell"; }
std::string type_str() const override { return "distribcell"; }
FilterType type() const override { return FilterType::DISTRIBCELL; }
void from_xml(pugi::xml_node node) override;

View file

@ -22,7 +22,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "energy"; }
std::string type_str() const override { return "energy"; }
FilterType type() const override { return FilterType::ENERGY; }
void from_xml(pugi::xml_node node) override;
@ -63,7 +64,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "energyout"; }
std::string type_str() const override { return "energyout"; }
FilterType type() const override { return FilterType::ENERGY_OUT; }
void get_all_bins(const Particle& p, TallyEstimator estimator,
FilterMatch& match) const override;

View file

@ -24,7 +24,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "energyfunction"; }
std::string type_str() const override { return "energyfunction"; }
FilterType type() const override { return FilterType::ENERGY_FUNCTION; }
void from_xml(pugi::xml_node node) override;

View file

@ -21,7 +21,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "legendre"; }
std::string type_str() const override { return "legendre"; }
FilterType type() const override { return FilterType::LEGENDRE; }
void from_xml(pugi::xml_node node) override;

View file

@ -25,7 +25,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "material"; }
std::string type_str() const override { return "material"; }
FilterType type() const override { return FilterType::MATERIAL; }
void from_xml(pugi::xml_node node) override;

View file

@ -24,7 +24,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "mesh"; }
std::string type_str() const override { return "mesh"; }
FilterType type() const override { return FilterType::MESH; }
void from_xml(pugi::xml_node node) override;

View file

@ -10,7 +10,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "meshsurface"; }
std::string type_str() const override { return "meshsurface"; }
FilterType type() const override { return FilterType::MESH_SURFACE; }
void get_all_bins(const Particle& p, TallyEstimator estimator,
FilterMatch& match) const override;

View file

@ -23,7 +23,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "mu"; }
std::string type_str() const override { return "mu"; }
FilterType type() const override { return FilterType::MU; }
void from_xml(pugi::xml_node node) override;

View file

@ -21,7 +21,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "particle"; }
std::string type_str() const override { return "particle"; }
FilterType type() const override { return FilterType::PARTICLE; }
void from_xml(pugi::xml_node node) override;

View file

@ -24,7 +24,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "polar"; }
std::string type_str() const override { return "polar"; }
FilterType type() const override { return FilterType::POLAR; }
void from_xml(pugi::xml_node node) override;

View file

@ -25,7 +25,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "sphericalharmonics"; }
std::string type_str() const override { return "sphericalharmonics"; }
FilterType type() const override { return FilterType::SPHERICAL_HARMONICS; }
void from_xml(pugi::xml_node node) override;

View file

@ -23,7 +23,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "spatiallegendre"; }
std::string type_str() const override { return "spatiallegendre"; }
FilterType type() const override { return FilterType::SPATIAL_LEGENDRE; }
void from_xml(pugi::xml_node node) override;

View file

@ -25,7 +25,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "surface"; }
std::string type_str() const override { return "surface"; }
FilterType type() const override { return FilterType::SURFACE; }
void from_xml(pugi::xml_node node) override;

View file

@ -22,7 +22,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "time"; }
std::string type_str() const override { return "time"; }
FilterType type() const override { return FilterType::TIME; }
void from_xml(pugi::xml_node node) override;

View file

@ -25,7 +25,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "universe"; }
std::string type_str() const override { return "universe"; }
FilterType type() const override { return FilterType::UNIVERSE; }
void from_xml(pugi::xml_node node) override;

View file

@ -21,7 +21,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "zernike"; }
std::string type_str() const override { return "zernike"; }
FilterType type() const override { return FilterType::ZERNIKE; }
void from_xml(pugi::xml_node node) override;
@ -72,7 +73,8 @@ public:
//----------------------------------------------------------------------------
// Methods
std::string type() const override { return "zernikeradial"; }
std::string type_str() const override { return "zernikeradial"; }
FilterType type() const override { return FilterType::ZERNIKE_RADIAL; }
void get_all_bins(const Particle& p, TallyEstimator estimator,
FilterMatch& match) const override;