added collision filter

This commit is contained in:
Amelia Trainer 2021-03-02 22:49:25 -05:00
parent 342101e88e
commit 7569139d51
5 changed files with 183 additions and 0 deletions

View file

@ -0,0 +1,54 @@
#ifndef OPENMC_TALLIES_FILTER_COLLISIONS_H
#define OPENMC_TALLIES_FILTER_COLLISIONS_H
#include <vector>
#include <gsl/gsl>
#include "openmc/tallies/filter.h"
namespace openmc {
//==============================================================================
//! Bins the incident neutron energy.
//==============================================================================
class CollisionFilter : public Filter
{
public:
//----------------------------------------------------------------------------
// Constructors, destructors
~CollisionFilter() = default;
//----------------------------------------------------------------------------
// Methods
std::string type() const override {return "numCollisions";}
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
std::string text_label(int bin) const override;
//----------------------------------------------------------------------------
// Accessors
const std::vector<int>& bins() const { return bins_; }
void set_bins(gsl::span<const int> bins);
protected:
//----------------------------------------------------------------------------
// Data members
std::vector<int> bins_;
};
} // namespace openmc
#endif // OPENMC_TALLIES_FILTER_COLLISIONS_H