Move ParticleType into Particle and use for type_ member

This commit is contained in:
Paul Romano 2019-02-27 09:00:59 -06:00
parent b4ed267d4b
commit b28ee8087c
21 changed files with 104 additions and 97 deletions

View file

@ -33,11 +33,6 @@ constexpr int MAX_LOST_PARTICLES {10};
// Maximum number of lost particles, relative to the total number of particles
constexpr double REL_MAX_LOST_PARTICLES {1.0e-6};
//! Particle types
enum class ParticleType {
neutron, photon, electron, positron
};
struct LocalCoord {
int cell {-1};
int universe {-1};
@ -59,8 +54,13 @@ struct LocalCoord {
class Particle {
public:
//! Particle types
enum class Type {
neutron, photon, electron, positron
};
int64_t id_; //!< Unique ID
int type_; //!< Particle type (n, p, e, etc.)
Type type_; //!< Particle type (n, p, e, etc.)
int n_coord_; //!< number of current coordinate levels
int cell_instance_; //!< offset for distributed properties
@ -134,7 +134,7 @@ public:
//! \param E Energy of the secondary particle in [eV]
//! \param type Particle type
//! \param run_CE Whether continuous-energy data is being used
void create_secondary(const double* uvw, double E, int type, bool run_CE);
void create_secondary(const double* uvw, double E, Type type, bool run_CE);
//! sets default attributes for a particle
void initialize();

View file

@ -44,7 +44,7 @@ public:
//! \param[out] mu Outgoing cosine with respect to current direction
void sample(double E_in, double& E_out, double& mu) const;
ParticleType particle_; //!< Particle type
Particle::Type particle_; //!< Particle type
EmissionMode emission_mode_; //!< Emission mode
double decay_rate_; //!< Decay rate (for delayed neutron precursors) in [1/s]
std::unique_ptr<Function1D> yield_; //!< Yield as a function of energy

View file

@ -45,7 +45,7 @@ public:
// Properties
double strength() const { return strength_; }
private:
ParticleType particle_ {ParticleType::neutron}; //!< Type of particle emitted
Particle::Type particle_ {Particle::Type::neutron}; //!< Type of particle emitted
double strength_ {1.0}; //!< Source strength
UPtrSpace space_; //!< Spatial distribution
UPtrAngle angle_; //!< Angular distribution

View file

@ -3,6 +3,7 @@
#include <vector>
#include "openmc/particle.h"
#include "openmc/tallies/filter.h"
namespace openmc {
@ -27,7 +28,7 @@ public:
std::string text_label(int bin) const override;
std::vector<int> particles_;
std::vector<Particle::Type> particles_;
};
} // namespace openmc