use base class to handle layout of particle data

This commit is contained in:
Gavin Ridley 2021-04-16 15:35:33 -04:00
parent 5cf8482d9a
commit 2af4c9cd92
39 changed files with 834 additions and 795 deletions

View file

@ -36,7 +36,7 @@ public:
virtual ~Source() = default;
// Methods that must be implemented
virtual Particle::Bank sample(uint64_t* seed) const = 0;
virtual ParticleBank sample(uint64_t* seed) const = 0;
// Methods that can be overridden
virtual double strength() const { return 1.0; }
@ -55,10 +55,10 @@ public:
//! Sample from the external source distribution
//! \param[inout] seed Pseudorandom seed pointer
//! \return Sampled site
Particle::Bank sample(uint64_t* seed) const override;
ParticleBank sample(uint64_t* seed) const override;
// Properties
Particle::Type particle_type() const { return particle_; }
ParticleType particle_type() const { return particle_; }
double strength() const override { return strength_; }
// Make observing pointers available
@ -67,7 +67,7 @@ public:
Distribution* energy() const { return energy_.get(); }
private:
Particle::Type particle_ {Particle::Type::neutron}; //!< Type of particle emitted
ParticleType particle_ {ParticleType::neutron}; //!< Type of particle emitted
double strength_ {1.0}; //!< Source strength
UPtrSpace space_; //!< Spatial distribution
UPtrAngle angle_; //!< Angular distribution
@ -84,10 +84,10 @@ public:
explicit FileSource(std::string path);
// Methods
Particle::Bank sample(uint64_t* seed) const override;
ParticleBank sample(uint64_t* seed) const override;
private:
std::vector<Particle::Bank> sites_; //!< Source sites from a file
std::vector<ParticleBank> sites_; //!< Source sites from a file
};
//==============================================================================
@ -101,7 +101,7 @@ public:
~CustomSourceWrapper();
// Defer implementation to custom source library
Particle::Bank sample(uint64_t* seed) const override
ParticleBank sample(uint64_t* seed) const override
{
return custom_source_->sample(seed);
}
@ -125,7 +125,7 @@ extern "C" void initialize_source();
//! source strength
//! \param[inout] seed Pseudorandom seed pointer
//! \return Sampled source site
Particle::Bank sample_external_source(uint64_t* seed);
ParticleBank sample_external_source(uint64_t* seed);
void free_memory_source();