minimc 0.5.1
Loading...
Searching...
No Matches
Particle Class Reference

The primary entity performing random walks in a World. More...

#include <Particle.hpp>

Public Types

enum class  Type { neutron , photon }
 Affects which cross section data is used during transport, among other things.
 
enum class  Event {
  birth , scatter , capture , fission ,
  surface_cross , leak , virtual_collision
}
 Mutually exclusive events which can occur.
 

Public Member Functions

 Particle (const Point &position, const Direction &direction, const Energy &energy, const Type type, RNG::result_type seed, const Cell *cell=nullptr) noexcept
 Member constructor. Explicitly assigns phase-space members.
 
Bank Transport (EstimatorSetProxy &e, const World &w) noexcept
 Use Particle::transport_method to update Particle state until it dies. More...
 
void Stream (const Real distance) noexcept
 Moves the particle along its current direction a given distance.
 
void SampleReaction () noexcept
 
void Scatter (const Real &mu, const Energy &e) noexcept
 Scatters the Particle with an outgoing direction and energy. More...
 
Real GetIndirectEffect (const Perturbation *perturbation) const noexcept
 Returns a reference to the indirect effects of this Particle.
 
void SetPerturbations (const PerturbationSet &perturbations) noexcept
 Sets the indirect effects of the Particle.
 
const PointGetPosition () const noexcept
 Return the current position of the Particle.
 
const DirectionGetDirection () const noexcept
 Return the current direction of the Particle.
 
void SetDirectionIsotropic () noexcept
 Sets the direction to a random isotropic direction. More...
 
const EnergyGetEnergy () const noexcept
 Returns the current energy of the Particle.
 
void SetEnergy (const Energy &e) noexcept
 Updates the current energy of the Particle.
 
Type GetType () const noexcept
 Returns the Type of the Particle.
 
const CellGetCell () const
 Returns a reference to the current Cell the Particle is within.
 
void SetCell (const Cell &c) noexcept
 Sets the current Cell occupied by the Particle.
 
void BankSecondaries (const Direction &direction, const Energy &energy) noexcept
 Banks secondaries produced during transport using an outgoing Direction and outgoing Energy.
 
void MoveSecondariesTo (Bank &bank) noexcept
 Transfers secondaries produced by this Particle to the front of a given Bank. More...
 
Real Sample () noexcept
 Sample a random number uniformly in \( [0, 1) \). More...
 
const NuclideSampleNuclide () noexcept
 Sample a Nuclide given that the Particle has collided inside its Cell.
 
bool IsAlive () const noexcept
 Returns true if the Particle should continue to be transported.
 

Static Public Member Functions

static Type ToType (const std::string &name) noexcept
 Helper function to convert from std::string to Type.
 

Public Attributes

RNG rng
 Random number generator (C++ Core Guidelines C.131) More...
 
const Type type {Type::neutron}
 Type of the Particle (C++ Core Guidelines C.131)
 
Event event {Event::birth}
 Flag describing the event that occured at the current point in phase space.
 
std::shared_ptr< const CSGSurfacecurrent_surface
 Pointer to most recent surface crossed.
 

Static Public Attributes

static std::unique_ptr< const StreamDelegatestream_delegate
 The StreamDelegate used by all Particle objects. More...
 

Detailed Description

The primary entity performing random walks in a World.

Particles are characterized by their position, direction, energy, type, and an alive flag. The awkward declaration order of member variables is meant to improve alignment.

Note
Users of this class should assume that Direction is normalized to avoid extra computation.

Member Function Documentation

◆ MoveSecondariesTo()

void Particle::MoveSecondariesTo ( Bank bank)
noexcept

Transfers secondaries produced by this Particle to the front of a given Bank.

This is implemented using std::list::splice so this Particle's own list of secondaries becomes empty after the operation.

◆ Sample()

Real Particle::Sample ( )
noexcept

Sample a random number uniformly in \( [0, 1) \).

This is provided as a convenience function because more complicated sampling schemes require multiple uniformly distributed random numbers

◆ Scatter()

void Particle::Scatter ( const Real mu,
const Energy e 
)
noexcept

Scatters the Particle with an outgoing direction and energy.

Scattering is assumed to be azimuthally symmetric.

Parameters
muThe scattering cosine \( \mu \)
eThe outgoing energy

◆ SetDirectionIsotropic()

void Particle::SetDirectionIsotropic ( )
noexcept

Sets the direction to a random isotropic direction.

Note
This should be replaced by a method which accepts scattering cosine

◆ Transport()

Bank Particle::Transport ( EstimatorSetProxy e,
const World w 
)
noexcept

Use Particle::transport_method to update Particle state until it dies.

This is an instance of composition over inheritance

Member Data Documentation

◆ rng

RNG Particle::rng

Random number generator (C++ Core Guidelines C.131)

This Particle contains its own random number generator. Any Particle initialized with the same member variables and transported in the same World should undergo the same history and return the same Bank.

◆ stream_delegate

std::unique_ptr<const StreamDelegate> Particle::stream_delegate
static

The StreamDelegate used by all Particle objects.

Composition over inheritance delegate for StreamToNextCollision()


The documentation for this class was generated from the following file: