#ifndef SPECIES_H #define SPECIES_H #include #include #include #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, double charge_C, std::shared_ptr mover, std::shared_ptr terminator, std::shared_ptr reflector, std::shared_ptr density_field, std::shared_ptr velocity_distribution, std::shared_ptr drift_velocity, std::shared_ptr 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 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 new_logger); // getter for a raw pointer to the CurrentCollector member CurrentCollector* currentCollector(); // setter for the CurrentCollector member void currentCollector(std::shared_ptr 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 new_collector); // vector of shared_ptr to Interaction objects, defines the different types // of interactions that the specie can take part in std::vector> interactions(); // adds the shared_ptr of the Interaction object "interaction" to the vector // of possible interactions void addInteraction(std::shared_ptr interaction); private: std::shared_ptr density_field_; std::shared_ptr velocity_distribution_; std::shared_ptr drift_velocity_; std::shared_ptr mover_; std::shared_ptr terminator_; std::shared_ptr reflector_; // object to keep track of how particles of the specie are removed from the simulation std::shared_ptr deletion_logger_; std::shared_ptr current_collector_; std::vector> interactions_; // 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 last_sync_density_field_; std::shared_ptr last_sync_deletion_logger_; std::shared_ptr 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, double charge_C, std::shared_ptr density_field, std::shared_ptr velocity_distribution, std::shared_ptr 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: std::shared_ptr density_field_; std::shared_ptr velocity_distribution_; std::shared_ptr drift_velocity_; }; }; // namespace species #endif /* SPECIES_H */