Many, many more comments
This commit is contained in:
@@ -7,51 +7,91 @@
|
||||
|
||||
#include "simulation/parameter.h"
|
||||
|
||||
// defined in "simulation/mover.h"
|
||||
class Mover;
|
||||
// defined in "simulation/terminator.h"
|
||||
class Terminator;
|
||||
// defined in "simulation/reflector.h"
|
||||
class Reflector;
|
||||
// defined in "simulation/injector.h"
|
||||
class Injector;
|
||||
// defined in "simulation/density_field.h"
|
||||
class DensityField;
|
||||
class DynamicDensityField;
|
||||
class ConstantDensityField;
|
||||
// defined in "simulation/logger.h"
|
||||
class DeletionLogger;
|
||||
// defined in "simulation/current_collector.h"
|
||||
class CurrentCollector;
|
||||
// defined in "simulation/velocity_distribution.h"
|
||||
class VelocityDistribution;
|
||||
// defined in "simulation/drift_velocity.h"
|
||||
class DriftVelocity;
|
||||
|
||||
// defined in "simulation/interaction.h"
|
||||
namespace interaction {
|
||||
class Interaction;
|
||||
};
|
||||
|
||||
namespace species {
|
||||
|
||||
// enum that lists all implemented specie types (Tritium molecule T2, electron,
|
||||
// Tritium ion T+, Tritium molecule ion T2+ and Trtitium cluster ion T3+)
|
||||
enum class ImplementedSpecies { T2, electron, Tplus, T2plus, T3plus };
|
||||
|
||||
// general specie, defining the minimum requirements for all other specie classes
|
||||
class Specie {
|
||||
public:
|
||||
// Constructor, taking one of the implemented speices in the ImplementedSpecies enum,
|
||||
// an arbitrary string defining the name of the species (e.g. if multiple electron species
|
||||
// are required), the mass of the particle type in kg and it's charge in Coulomb
|
||||
Specie(ImplementedSpecies type,
|
||||
std::string name,
|
||||
double mass_kg,
|
||||
double charge_C);
|
||||
|
||||
// getter for the mass of the species (in kg)
|
||||
double mass_kg() const;
|
||||
// getter for the charge of the species (in Coulomb)
|
||||
double charge_C() const;
|
||||
// getter for the type of the species (ImplementedSpecies enum)
|
||||
ImplementedSpecies type() const;
|
||||
// getter for the name of the species
|
||||
std::string name() const;
|
||||
|
||||
// getter for the DensityField pointer
|
||||
virtual DensityField* densityField() = 0;
|
||||
// getter for the VelocityDistribution pointer
|
||||
virtual VelocityDistribution* velocityDistibution() = 0;
|
||||
// getter for the DriftVelocity pointer
|
||||
virtual DriftVelocity* driftVelocity() = 0;
|
||||
|
||||
protected:
|
||||
// mass of species in kg
|
||||
const double mass_kg_;
|
||||
// charge of species in C
|
||||
const double charge_C_;
|
||||
// type of species defined by ImplementedSpecies enum
|
||||
const ImplementedSpecies type_;
|
||||
// arbitrary name of the species
|
||||
const std::string name_;
|
||||
};
|
||||
|
||||
// class for particle species that are simulated
|
||||
class TrackedSpecie : public Specie {
|
||||
public:
|
||||
// Constructor; takes an ImplemetedSpecies enum to define the type of the species,
|
||||
// an arbitrary string to name the species,
|
||||
// the mass of the particles of the species in kg,
|
||||
// the charge of the particles of the species in C,
|
||||
// a shared_ptr of a Mover object (defines the propagation algorithm),
|
||||
// a shared_ptr of a Terminator object (defines when a particle is deleted),
|
||||
// a shared_ptr of a Reflector object (defines if, where and how a particle of the specie is reflected),
|
||||
// a shared_ptr of a DynamicDensityField object (collects the density of the species),
|
||||
// a shared_ptr of a DriftVelocity object (can be a nullptr but only if no interactions between simulated species are present),
|
||||
// a shared_ptr of a second DynamicDensityField object (essentially a copy of the first DynamicDensityField; necessary for cpu-synchronization)
|
||||
// the deletion logger and the current collector (as well as their synchronization equivalents) are initialized
|
||||
// with a null pointer
|
||||
TrackedSpecie(ImplementedSpecies type,
|
||||
std::string name,
|
||||
double mass_kg,
|
||||
@@ -64,30 +104,50 @@ class TrackedSpecie : public Specie {
|
||||
std::shared_ptr<DriftVelocity> drift_velocity,
|
||||
std::shared_ptr<DynamicDensityField> last_sync_density_field);
|
||||
|
||||
// getter for a raw pointer to the DynamicDensityField member as its parent class DensityField
|
||||
DensityField* densityField();
|
||||
// getter for a raw pointer to the VelocityDistribution member
|
||||
VelocityDistribution* velocityDistibution();
|
||||
// getter for a raw pointer to the driftVelocity member
|
||||
DriftVelocity* driftVelocity();
|
||||
|
||||
// getter for a raw pointer to the DynamicDensityField member
|
||||
DynamicDensityField* dynamicDensityField();
|
||||
// getter for a raw pointer to the DynamicDensityField member used for the synchronization between processes
|
||||
DynamicDensityField* lastSyncDensityField();
|
||||
// getter for a raw pointer to the Mover member
|
||||
Mover* mover();
|
||||
// getter for a raw pointer to the Terminator member
|
||||
Terminator* terminator();
|
||||
// getter for a raw pointer to the Reflector member
|
||||
Reflector* reflector();
|
||||
|
||||
// getter for a raw pointer to the DeletionLogger member
|
||||
DeletionLogger* deletionLogger();
|
||||
|
||||
// setter for the DeletionLogger member
|
||||
void deletionLogger(std::shared_ptr<DeletionLogger> new_logger);
|
||||
|
||||
// getter for a raw pointer to the DeletionLogger member used for cpu-synchronization
|
||||
DeletionLogger* lastSyncDeletionLogger();
|
||||
// setter for the DeletionLogger member used for cpu-synchronization
|
||||
void lastSyncDeletionLogger(std::shared_ptr<DeletionLogger> new_logger);
|
||||
|
||||
// getter for a raw pointer to the CurrentCollector member
|
||||
CurrentCollector* currentCollector();
|
||||
// setter for the CurrentCollector member
|
||||
void currentCollector(std::shared_ptr<CurrentCollector> new_collector);
|
||||
|
||||
// getter for a raw pointer to the CurrentCollector member used for cpu-synchronization
|
||||
CurrentCollector* lastSyncCurrentCollector();
|
||||
// setter for the CurrentCollector member used for cpu-synchronization
|
||||
void lastSyncCurrentCollector(
|
||||
std::shared_ptr<CurrentCollector> new_collector);
|
||||
|
||||
// vector of shared_ptr to Interaction objects, defines the different types
|
||||
// of interactions that the specie can take part in
|
||||
std::vector<std::shared_ptr<interaction::Interaction>> interactions();
|
||||
// adds the shared_ptr of the Interaction object "interaction" to the vector
|
||||
// of possible interactions
|
||||
void addInteraction(std::shared_ptr<interaction::Interaction> interaction);
|
||||
|
||||
private:
|
||||
@@ -99,20 +159,29 @@ class TrackedSpecie : public Specie {
|
||||
std::shared_ptr<Terminator> terminator_;
|
||||
std::shared_ptr<Reflector> reflector_;
|
||||
|
||||
// object to keep track of how particles of the specie are removed from the simulation
|
||||
std::shared_ptr<DeletionLogger> deletion_logger_;
|
||||
std::shared_ptr<CurrentCollector> current_collector_;
|
||||
std::vector<std::shared_ptr<interaction::Interaction>> interactions_;
|
||||
|
||||
// fields to store the date of the last synchronization
|
||||
// (after a synchronization the last_sync field and the non-last_sync field
|
||||
// fields to store the data of the last synchronization
|
||||
// (immediately after a synchronization the last_sync field and the non-last_sync field
|
||||
// contain the same data)
|
||||
std::shared_ptr<DynamicDensityField> last_sync_density_field_;
|
||||
std::shared_ptr<DeletionLogger> last_sync_deletion_logger_;
|
||||
std::shared_ptr<CurrentCollector> last_sync_current_collector_;
|
||||
};
|
||||
|
||||
// class for particle types that are not simulated
|
||||
class BackgroundSpecie : public Specie {
|
||||
public:
|
||||
// Constructor: takes the type of the species as one of the implemented species defined in the ImplementedSpecies enum,
|
||||
// an arbirtary name for the species,
|
||||
// the mass of the particles of the species in kg,
|
||||
// the charge of the particles of the species in C,
|
||||
// a shared_ptr to a ConstantDensityField object,
|
||||
// a shared_ptr to a VelocityDistribution object (defines the velocity distribution of the particles realtive to their drift veloctiy)
|
||||
// a shared_ptr to a DriftVelocity object (defines the drift velocity of the particles)
|
||||
BackgroundSpecie(ImplementedSpecies type,
|
||||
std::string name,
|
||||
double mass_kg,
|
||||
@@ -121,8 +190,11 @@ class BackgroundSpecie : public Specie {
|
||||
std::shared_ptr<VelocityDistribution> velocity_distribution,
|
||||
std::shared_ptr<DriftVelocity> drift_velocity);
|
||||
|
||||
// getter for a raw pointer to the ConstantDensityField member as its parent type
|
||||
DensityField* densityField();
|
||||
// getter for a raw pointer to the VelocityDistribution member
|
||||
VelocityDistribution* velocityDistibution();
|
||||
// getter for a raw pointer to the driftVelocity member
|
||||
DriftVelocity* driftVelocity();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user