157 lines
4.4 KiB
C++
Executable File
157 lines
4.4 KiB
C++
Executable File
#include "simulation/species.h"
|
|
|
|
#include "simulation/current_collector.h"
|
|
#include "simulation/density_field.h"
|
|
#include "simulation/drift_velocity.h"
|
|
#include "simulation/interaction.h"
|
|
#include "simulation/logger.h"
|
|
#include "simulation/mover.h"
|
|
#include "simulation/parameter.h"
|
|
#include "simulation/terminator.h"
|
|
#include "simulation/velocity_distribution.h"
|
|
|
|
namespace species {
|
|
|
|
Specie::Specie(ImplementedSpecies type,
|
|
std::string name,
|
|
double mass_kg,
|
|
double charge_C)
|
|
: type_(type), name_(name), mass_kg_(mass_kg), charge_C_(charge_C) {}
|
|
|
|
double Specie::mass_kg() const {
|
|
return mass_kg_;
|
|
}
|
|
double Specie::charge_C() const {
|
|
return charge_C_;
|
|
}
|
|
ImplementedSpecies Specie::type() const {
|
|
return type_;
|
|
}
|
|
std::string Specie::name() const {
|
|
return name_;
|
|
}
|
|
|
|
TrackedSpecie::TrackedSpecie(
|
|
ImplementedSpecies type,
|
|
std::string name,
|
|
double mass_kg,
|
|
double charge_C,
|
|
std::shared_ptr<Mover> mover,
|
|
std::shared_ptr<Terminator> terminator,
|
|
std::shared_ptr<Reflector> reflector,
|
|
std::shared_ptr<DynamicDensityField> density_field,
|
|
std::shared_ptr<VelocityDistribution> velocity_distribution,
|
|
std::shared_ptr<DriftVelocity> drift_velocity,
|
|
std::shared_ptr<DynamicDensityField> last_sync_density_field)
|
|
: Specie(type, name, mass_kg, charge_C),
|
|
mover_(mover),
|
|
terminator_(terminator),
|
|
reflector_(reflector),
|
|
density_field_(density_field),
|
|
deletion_logger_(std::shared_ptr<DeletionLogger>(nullptr)),
|
|
current_collector_(std::shared_ptr<CurrentCollector>(nullptr)),
|
|
velocity_distribution_(velocity_distribution),
|
|
drift_velocity_(drift_velocity),
|
|
last_sync_density_field_(last_sync_density_field),
|
|
last_sync_deletion_logger_(std::shared_ptr<DeletionLogger>(nullptr)),
|
|
last_sync_current_collector_(std::shared_ptr<CurrentCollector>(nullptr)) {}
|
|
|
|
DensityField* TrackedSpecie::densityField() {
|
|
return density_field_.get();
|
|
}
|
|
|
|
VelocityDistribution* TrackedSpecie::velocityDistibution() {
|
|
return velocity_distribution_.get();
|
|
}
|
|
DriftVelocity* TrackedSpecie::driftVelocity() {
|
|
return drift_velocity_.get();
|
|
}
|
|
|
|
DynamicDensityField* TrackedSpecie::dynamicDensityField() {
|
|
return density_field_.get();
|
|
}
|
|
|
|
DynamicDensityField* TrackedSpecie::lastSyncDensityField() {
|
|
return last_sync_density_field_.get();
|
|
}
|
|
|
|
Mover* TrackedSpecie::mover() {
|
|
return mover_.get();
|
|
}
|
|
|
|
Terminator* TrackedSpecie::terminator() {
|
|
return terminator_.get();
|
|
}
|
|
|
|
Reflector* TrackedSpecie::reflector() {
|
|
return reflector_.get();
|
|
}
|
|
|
|
DeletionLogger* TrackedSpecie::deletionLogger() {
|
|
return deletion_logger_.get();
|
|
}
|
|
|
|
DeletionLogger* TrackedSpecie::lastSyncDeletionLogger() {
|
|
return last_sync_deletion_logger_.get();
|
|
}
|
|
|
|
CurrentCollector* TrackedSpecie::currentCollector() {
|
|
return current_collector_.get();
|
|
}
|
|
|
|
CurrentCollector* TrackedSpecie::lastSyncCurrentCollector() {
|
|
return last_sync_current_collector_.get();
|
|
}
|
|
|
|
std::vector<std::shared_ptr<interaction::Interaction>>
|
|
TrackedSpecie::interactions() {
|
|
return interactions_;
|
|
}
|
|
|
|
void TrackedSpecie ::addInteraction(
|
|
std::shared_ptr<interaction::Interaction> interaction) {
|
|
interactions_.push_back(interaction);
|
|
}
|
|
|
|
void TrackedSpecie::deletionLogger(std::shared_ptr<DeletionLogger> new_logger) {
|
|
deletion_logger_ = new_logger;
|
|
}
|
|
|
|
void TrackedSpecie::lastSyncDeletionLogger(std::shared_ptr<DeletionLogger> new_logger) {
|
|
last_sync_deletion_logger_ = new_logger;
|
|
}
|
|
|
|
void TrackedSpecie::currentCollector(
|
|
std::shared_ptr<CurrentCollector> new_collector) {
|
|
current_collector_ = new_collector;
|
|
}
|
|
|
|
void TrackedSpecie::lastSyncCurrentCollector(
|
|
std::shared_ptr<CurrentCollector> new_collector) {
|
|
last_sync_current_collector_ = new_collector;
|
|
}
|
|
|
|
BackgroundSpecie::BackgroundSpecie(
|
|
ImplementedSpecies type,
|
|
std::string name,
|
|
double mass_kg,
|
|
double charge_C,
|
|
std::shared_ptr<ConstantDensityField> density_field,
|
|
std::shared_ptr<VelocityDistribution> velocity_distribution,
|
|
std::shared_ptr<DriftVelocity> drift_velocity)
|
|
: Specie(type, name, mass_kg, charge_C),
|
|
density_field_(density_field),
|
|
velocity_distribution_(velocity_distribution),
|
|
drift_velocity_(drift_velocity) {}
|
|
|
|
DensityField* BackgroundSpecie::densityField() {
|
|
return density_field_.get();
|
|
}
|
|
VelocityDistribution* BackgroundSpecie::velocityDistibution() {
|
|
return velocity_distribution_.get();
|
|
}
|
|
DriftVelocity* BackgroundSpecie::driftVelocity() {
|
|
return drift_velocity_.get();
|
|
}
|
|
|
|
} // namespace species
|