debug statements in preprocessor clause
This commit is contained in:
@@ -51,7 +51,9 @@ void SimulationOutput::writeSimulationData(
|
|||||||
int cpu_sync,
|
int cpu_sync,
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species) {
|
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species) {
|
||||||
if (MpiCommunication::mpi_rank == 0) {
|
if (MpiCommunication::mpi_rank == 0) {
|
||||||
|
#ifdef debug_level2
|
||||||
DEBUG_LEVEL_2("Write density field data.");
|
DEBUG_LEVEL_2("Write density field data.");
|
||||||
|
#endif
|
||||||
for (auto& task : tasks_density_fields_) {
|
for (auto& task : tasks_density_fields_) {
|
||||||
if (cpu_sync % task.intervall == 0) {
|
if (cpu_sync % task.intervall == 0) {
|
||||||
std::string specie_path = "/" + task.specie_name;
|
std::string specie_path = "/" + task.specie_name;
|
||||||
@@ -59,7 +61,9 @@ void SimulationOutput::writeSimulationData(
|
|||||||
specie_path, cpu_sync, task.overwrite_last);
|
specie_path, cpu_sync, task.overwrite_last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef debug_level2
|
||||||
DEBUG_LEVEL_2("Write current collector data.");
|
DEBUG_LEVEL_2("Write current collector data.");
|
||||||
|
#endif
|
||||||
for (auto& task : tasks_current_collector_) {
|
for (auto& task : tasks_current_collector_) {
|
||||||
if (cpu_sync % task.intervall == 0) {
|
if (cpu_sync % task.intervall == 0) {
|
||||||
std::string specie_path = "/" + task.specie_name;
|
std::string specie_path = "/" + task.specie_name;
|
||||||
@@ -67,7 +71,9 @@ void SimulationOutput::writeSimulationData(
|
|||||||
specie_path, cpu_sync, task.overwrite_last);
|
specie_path, cpu_sync, task.overwrite_last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef debug_level2
|
||||||
DEBUG_LEVEL_2("Write deletion logger data.");
|
DEBUG_LEVEL_2("Write deletion logger data.");
|
||||||
|
#endif
|
||||||
for (auto& task : tasks_deletion_logger_) {
|
for (auto& task : tasks_deletion_logger_) {
|
||||||
if (cpu_sync % task.intervall == 0) {
|
if (cpu_sync % task.intervall == 0) {
|
||||||
std::string specie_path = "/" + task.specie_name;
|
std::string specie_path = "/" + task.specie_name;
|
||||||
@@ -88,15 +94,25 @@ void SimulationOutput::writeSimulationData(DynamicDensityField* density_field,
|
|||||||
}
|
}
|
||||||
std::string path = species_path + "/DensityField/SimulationData/" + sync_path;
|
std::string path = species_path + "/DensityField/SimulationData/" + sync_path;
|
||||||
|
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write spectrum.");
|
DEBUG_LEVEL_3("Write spectrum.");
|
||||||
|
#endif
|
||||||
writeSpectrum(density_field, path);
|
writeSpectrum(density_field, path);
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write density.");
|
DEBUG_LEVEL_3("Write density.");
|
||||||
|
#endif
|
||||||
writeDensity(density_field, path);
|
writeDensity(density_field, path);
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write time in bin.");
|
DEBUG_LEVEL_3("Write time in bin.");
|
||||||
|
#endif
|
||||||
writeTimeInBin(density_field, path);
|
writeTimeInBin(density_field, path);
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write deleted particles.");
|
DEBUG_LEVEL_3("Write deleted particles.");
|
||||||
|
#endif
|
||||||
writeDeletedParticles(density_field, path);
|
writeDeletedParticles(density_field, path);
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write physical time.");
|
DEBUG_LEVEL_3("Write physical time.");
|
||||||
|
#endif
|
||||||
writePhysicalTime(density_field, path);
|
writePhysicalTime(density_field, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,11 +126,17 @@ void SimulationOutput::writeSimulationData(CurrentCollector* current_collector,
|
|||||||
}
|
}
|
||||||
std::string path =
|
std::string path =
|
||||||
species_path + "/CurrentCollector/SimulationData/" + sync_path;
|
species_path + "/CurrentCollector/SimulationData/" + sync_path;
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write current crossings.");
|
DEBUG_LEVEL_3("Write current crossings.");
|
||||||
|
#endif
|
||||||
writeCurrentCrossings(current_collector, path);
|
writeCurrentCrossings(current_collector, path);
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write current.");
|
DEBUG_LEVEL_3("Write current.");
|
||||||
|
#endif
|
||||||
writeCurrent(current_collector, path);
|
writeCurrent(current_collector, path);
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write physical time.");
|
DEBUG_LEVEL_3("Write physical time.");
|
||||||
|
#endif
|
||||||
writePhysicalTime(current_collector, path);
|
writePhysicalTime(current_collector, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +149,9 @@ void SimulationOutput::writeSimulationData(DeletionLogger* logger,
|
|||||||
sync_path = "LastSyncPeriod";
|
sync_path = "LastSyncPeriod";
|
||||||
}
|
}
|
||||||
std::string path = species_path + "/DeletionLogger/" + sync_path;
|
std::string path = species_path + "/DeletionLogger/" + sync_path;
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Write number of deletions.");
|
DEBUG_LEVEL_3("Write number of deletions.");
|
||||||
|
#endif
|
||||||
writeNumDeletions(logger, path);
|
writeNumDeletions(logger, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ ChargeExchange::ChargeExchange(std::function<double(double)> cross_section,
|
|||||||
InteractionOutput ChargeExchange::performInteraction(
|
InteractionOutput ChargeExchange::performInteraction(
|
||||||
particle::Particle& particle,
|
particle::Particle& particle,
|
||||||
RandomNumbers* generator) {
|
RandomNumbers* generator) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Perform charge exchange.");
|
DEBUG_LEVEL_3("Perform charge exchange.");
|
||||||
|
#endif
|
||||||
|
|
||||||
const auto x_impact = particle.position();
|
const auto x_impact = particle.position();
|
||||||
// draw velocity of the target specie
|
// draw velocity of the target specie
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ ClusterFormation::ClusterFormation(
|
|||||||
InteractionOutput ClusterFormation::performInteraction(
|
InteractionOutput ClusterFormation::performInteraction(
|
||||||
particle::Particle& particle,
|
particle::Particle& particle,
|
||||||
RandomNumbers* generator) {
|
RandomNumbers* generator) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Perform cluster formation.");
|
DEBUG_LEVEL_3("Perform cluster formation.");
|
||||||
|
#endif
|
||||||
const auto x_impact = particle.position();
|
const auto x_impact = particle.position();
|
||||||
const blitz::TinyVector<double, 3> v_target =
|
const blitz::TinyVector<double, 3> v_target =
|
||||||
target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
|
target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ ElasticScattering::ElasticScattering(
|
|||||||
InteractionOutput ElasticScattering::performInteraction(
|
InteractionOutput ElasticScattering::performInteraction(
|
||||||
particle::Particle& particle,
|
particle::Particle& particle,
|
||||||
RandomNumbers* generator) {
|
RandomNumbers* generator) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Perform elastic scattering.");
|
DEBUG_LEVEL_3("Perform elastic scattering.");
|
||||||
|
#endif
|
||||||
// get the information of the incident particle
|
// get the information of the incident particle
|
||||||
const blitz::TinyVector<double, 3> v_impact =
|
const blitz::TinyVector<double, 3> v_impact =
|
||||||
particle.velocity().cartesianEntries();
|
particle.velocity().cartesianEntries();
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ Excitation::Excitation(std::function<double(double)> cross_section,
|
|||||||
|
|
||||||
InteractionOutput Excitation::performInteraction(particle::Particle& particle,
|
InteractionOutput Excitation::performInteraction(particle::Particle& particle,
|
||||||
RandomNumbers* generator) {
|
RandomNumbers* generator) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Perform excitation.");
|
DEBUG_LEVEL_3("Perform excitation.");
|
||||||
|
#endif
|
||||||
const blitz::TinyVector<double, 3> v_impact =
|
const blitz::TinyVector<double, 3> v_impact =
|
||||||
particle.velocity().cartesianEntries();
|
particle.velocity().cartesianEntries();
|
||||||
const blitz::TinyVector<double, 3> n_impact =
|
const blitz::TinyVector<double, 3> n_impact =
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ FreeMovement::FreeMovement()
|
|||||||
|
|
||||||
InteractionOutput FreeMovement::performInteraction(particle::Particle& particle,
|
InteractionOutput FreeMovement::performInteraction(particle::Particle& particle,
|
||||||
RandomNumbers* generator) {
|
RandomNumbers* generator) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Perform free movement.");
|
DEBUG_LEVEL_3("Perform free movement.");
|
||||||
|
#endif
|
||||||
// do nothing
|
// do nothing
|
||||||
return InteractionOutput();
|
return InteractionOutput();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ ElectronIonization::ElectronIonization(
|
|||||||
InteractionOutput ElectronIonization::performInteraction(
|
InteractionOutput ElectronIonization::performInteraction(
|
||||||
particle::Particle& particle,
|
particle::Particle& particle,
|
||||||
RandomNumbers* generator) {
|
RandomNumbers* generator) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Perform ionization.");
|
DEBUG_LEVEL_3("Perform ionization.");
|
||||||
|
#endif
|
||||||
|
|
||||||
const blitz::TinyVector<double, 3> v_impact =
|
const blitz::TinyVector<double, 3> v_impact =
|
||||||
particle.velocity().cartesianEntries();
|
particle.velocity().cartesianEntries();
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ Recombination::Recombination(std::function<double(double)> cross_section,
|
|||||||
InteractionOutput Recombination::performInteraction(
|
InteractionOutput Recombination::performInteraction(
|
||||||
particle::Particle& particle,
|
particle::Particle& particle,
|
||||||
RandomNumbers* generator) {
|
RandomNumbers* generator) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Perform recombination.");
|
DEBUG_LEVEL_3("Perform recombination.");
|
||||||
|
#endif
|
||||||
|
|
||||||
std::vector<double> macroscopic_bin_cross_sections_m;
|
std::vector<double> macroscopic_bin_cross_sections_m;
|
||||||
const int number_energy_bins = recombination_target_->dynamicDensityField()
|
const int number_energy_bins = recombination_target_->dynamicDensityField()
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ void CpuSynchronizer::synchronize(
|
|||||||
tracked_species) {
|
tracked_species) {
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
auto it = tracked_species.begin();
|
auto it = tracked_species.begin();
|
||||||
DEBUG_LEVEL_3("Timer Synchronization.");
|
// DEBUG_LEVEL_3("Timer Synchronization.");
|
||||||
synchronize(it->second->dynamicDensityField()->timer_.get(),
|
synchronize(it->second->dynamicDensityField()->timer_.get(),
|
||||||
it->second->lastSyncDensityField()->timer_.get());
|
it->second->lastSyncDensityField()->timer_.get());
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ std::vector<particle::Particle> Injector::rollNewParticles(
|
|||||||
// particles are assumed to be created by a decay process
|
// particles are assumed to be created by a decay process
|
||||||
// therefore the resulting particles all start out at the same position
|
// therefore the resulting particles all start out at the same position
|
||||||
CylinderCoordinate position = position_distribution_->rollPosition(engine);
|
CylinderCoordinate position = position_distribution_->rollPosition(engine);
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Injected z position: " +
|
DEBUG_LEVEL_3("Injected z position: " +
|
||||||
std::to_string(position.cylinderEntries()(2)));
|
std::to_string(position.cylinderEntries()(2)));
|
||||||
|
#endif
|
||||||
std::vector<particle::Particle> new_particles;
|
std::vector<particle::Particle> new_particles;
|
||||||
// draw the velocity of all particles to be injected an append them to the new_particles vector
|
// draw the velocity of all particles to be injected an append them to the new_particles vector
|
||||||
for (auto& injector_info : injector_infos_) {
|
for (auto& injector_info : injector_infos_) {
|
||||||
|
|||||||
@@ -38,29 +38,43 @@ void Simulation::init(Parameter& parameter) {
|
|||||||
magnetic_field_ = generator::magneticField(parameter);
|
magnetic_field_ = generator::magneticField(parameter);
|
||||||
electric_field_ = generator::electricField(parameter);
|
electric_field_ = generator::electricField(parameter);
|
||||||
|
|
||||||
|
#ifdef debug
|
||||||
DEBUG_LEVEL_0("Creating species.");
|
DEBUG_LEVEL_0("Creating species.");
|
||||||
|
#endif
|
||||||
generator::SpeciesBuilder builder(parameter);
|
generator::SpeciesBuilder builder(parameter);
|
||||||
tracked_species_ = builder.trackedSpecies();
|
tracked_species_ = builder.trackedSpecies();
|
||||||
background_species_ = builder.backgroundSpecies();
|
background_species_ = builder.backgroundSpecies();
|
||||||
timer_ = builder.timer();
|
timer_ = builder.timer();
|
||||||
|
|
||||||
|
#ifdef debug
|
||||||
DEBUG_LEVEL_0("Creating injector.");
|
DEBUG_LEVEL_0("Creating injector.");
|
||||||
|
#endif
|
||||||
injector_ = generator::buildInjector(tracked_species_, background_species_,
|
injector_ = generator::buildInjector(tracked_species_, background_species_,
|
||||||
parameter);
|
parameter);
|
||||||
|
|
||||||
|
#ifdef debug
|
||||||
DEBUG_LEVEL_0("Init random numbers.");
|
DEBUG_LEVEL_0("Init random numbers.");
|
||||||
|
#endif
|
||||||
random_ = generator::buildRandomNumbers(parameter);
|
random_ = generator::buildRandomNumbers(parameter);
|
||||||
|
|
||||||
|
#ifdef debug
|
||||||
DEBUG_LEVEL_0("Init output.");
|
DEBUG_LEVEL_0("Init output.");
|
||||||
|
#endif
|
||||||
output_ = generator::buildSimulationOutput(
|
output_ = generator::buildSimulationOutput(
|
||||||
parameter.jsonObjectFromBase({"Output"}), tracked_species_);
|
parameter.jsonObjectFromBase({"Output"}), tracked_species_);
|
||||||
|
|
||||||
|
#ifdef debug
|
||||||
DEBUG_LEVEL_0("Output meta data.");
|
DEBUG_LEVEL_0("Output meta data.");
|
||||||
|
#endif
|
||||||
output_->writeMetaData(tracked_species_);
|
output_->writeMetaData(tracked_species_);
|
||||||
|
|
||||||
|
#ifdef debug
|
||||||
DEBUG_LEVEL_0("Init cpu synchronizer.");
|
DEBUG_LEVEL_0("Init cpu synchronizer.");
|
||||||
|
#endif
|
||||||
cpu_synchronizer_ = std::make_shared<CpuSynchronizer>();
|
cpu_synchronizer_ = std::make_shared<CpuSynchronizer>();
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Init done.");
|
DEBUG_LEVEL_3("Init done.");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int eventsThisCpu(int events_all_cpus) {
|
int eventsThisCpu(int events_all_cpus) {
|
||||||
@@ -105,7 +119,7 @@ void Simulation::start() {
|
|||||||
if((events_this_cpu % event_stride == 0) &&
|
if((events_this_cpu % event_stride == 0) &&
|
||||||
(total_simulated_events % MpiCommunication::mpiSize()
|
(total_simulated_events % MpiCommunication::mpiSize()
|
||||||
<= MpiCommunication::mpiRank())) {
|
<= MpiCommunication::mpiRank())) {
|
||||||
DEBUG_LEVEL_3("empty loop");
|
// DEBUG_LEVEL_3("empty loop");
|
||||||
empty_loop = true;
|
empty_loop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +128,7 @@ void Simulation::start() {
|
|||||||
// special case of unbalanced cpu load, with a part of the cpus having one cycle
|
// special case of unbalanced cpu load, with a part of the cpus having one cycle
|
||||||
// that has no events, while the rest of the cpus have a single event (questionable if needed)
|
// that has no events, while the rest of the cpus have a single event (questionable if needed)
|
||||||
if(leftover_events == 0 && empty_loop) {
|
if(leftover_events == 0 && empty_loop) {
|
||||||
DEBUG_LEVEL_3("empty loop looped");
|
// DEBUG_LEVEL_3("empty loop looped");
|
||||||
empty_loop = false;
|
empty_loop = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +137,9 @@ void Simulation::start() {
|
|||||||
std::to_string(leftover_events));
|
std::to_string(leftover_events));
|
||||||
processEvents(evenst_of_cycle);
|
processEvents(evenst_of_cycle);
|
||||||
|
|
||||||
|
#ifdef debug_level1
|
||||||
DEBUG_LEVEL_1("Leftover events: " + std::to_string(leftover_events));
|
DEBUG_LEVEL_1("Leftover events: " + std::to_string(leftover_events));
|
||||||
|
#endif
|
||||||
leftover_events -= evenst_of_cycle;
|
leftover_events -= evenst_of_cycle;
|
||||||
|
|
||||||
SIM_INFO("Cpu sync.");
|
SIM_INFO("Cpu sync.");
|
||||||
@@ -148,27 +164,37 @@ int particleNumberFromQueue(int queue_length, RandomNumbers* random) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Simulation::processEvents(int events) {
|
void Simulation::processEvents(int events) {
|
||||||
|
#ifdef debug
|
||||||
DEBUG_LEVEL_0("Processing events.");
|
DEBUG_LEVEL_0("Processing events.");
|
||||||
|
#endif
|
||||||
std::vector<particle::Particle> particle_queue;
|
std::vector<particle::Particle> particle_queue;
|
||||||
particle_queue.reserve(100);
|
particle_queue.reserve(100);
|
||||||
int current_event = 0;
|
int current_event = 0;
|
||||||
while ((current_event < events) || (!particle_queue.empty())) {
|
while ((current_event < events) || (!particle_queue.empty())) {
|
||||||
|
#ifdef debug_level2
|
||||||
DEBUG_LEVEL_2("Current event: " + std::to_string(current_event));
|
DEBUG_LEVEL_2("Current event: " + std::to_string(current_event));
|
||||||
|
#endif
|
||||||
// if the particle queue is empty a new beta decay event is started
|
// if the particle queue is empty a new beta decay event is started
|
||||||
if (particle_queue.empty()) {
|
if (particle_queue.empty()) {
|
||||||
current_event += 1;
|
current_event += 1;
|
||||||
|
#ifdef debug_level2
|
||||||
DEBUG_LEVEL_2("Inject particles to queue.");
|
DEBUG_LEVEL_2("Inject particles to queue.");
|
||||||
|
#endif
|
||||||
SimulationTimer::eventStartPoint(std::string("ParticleInjection"));
|
SimulationTimer::eventStartPoint(std::string("ParticleInjection"));
|
||||||
// draw new beta decay particles
|
// draw new beta decay particles
|
||||||
std::vector<particle::Particle> new_particles =
|
std::vector<particle::Particle> new_particles =
|
||||||
determineInjectedParticles(random_.get());
|
determineInjectedParticles(random_.get());
|
||||||
SimulationTimer::eventStopPoint(std::string("ParticleInjection"));
|
SimulationTimer::eventStopPoint(std::string("ParticleInjection"));
|
||||||
|
#ifdef debug_level2
|
||||||
DEBUG_LEVEL_2("Injected particles to queue.");
|
DEBUG_LEVEL_2("Injected particles to queue.");
|
||||||
|
#endif
|
||||||
|
|
||||||
particle_queue.insert(particle_queue.end(), new_particles.begin(),
|
particle_queue.insert(particle_queue.end(), new_particles.begin(),
|
||||||
new_particles.end());
|
new_particles.end());
|
||||||
}
|
}
|
||||||
|
#ifdef debug_level2
|
||||||
DEBUG_LEVEL_2("Particles in queue: " + std::to_string(particle_queue.size()));
|
DEBUG_LEVEL_2("Particles in queue: " + std::to_string(particle_queue.size()));
|
||||||
|
#endif
|
||||||
// choose a random particle from the particle queue to be processed
|
// choose a random particle from the particle queue to be processed
|
||||||
const int particle_number =
|
const int particle_number =
|
||||||
particleNumberFromQueue(particle_queue.size(), random_.get());
|
particleNumberFromQueue(particle_queue.size(), random_.get());
|
||||||
@@ -185,7 +211,9 @@ void Simulation::processEvents(int events) {
|
|||||||
void Simulation::processUntilTermination(
|
void Simulation::processUntilTermination(
|
||||||
particle::Particle& particle,
|
particle::Particle& particle,
|
||||||
std::vector<particle::Particle>& particle_queue) {
|
std::vector<particle::Particle>& particle_queue) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Process particle until termination");
|
DEBUG_LEVEL_3("Process particle until termination");
|
||||||
|
#endif
|
||||||
while (particle.specie()->terminator()->isAlive(&particle)) {
|
while (particle.specie()->terminator()->isAlive(&particle)) {
|
||||||
auto old_position = particle.position();
|
auto old_position = particle.position();
|
||||||
double old_energy = particle.kineticEnergy_eV();
|
double old_energy = particle.kineticEnergy_eV();
|
||||||
@@ -205,7 +233,9 @@ void Simulation::processUntilTermination(
|
|||||||
bool was_reflected = false;
|
bool was_reflected = false;
|
||||||
if (particle.specie()->reflector()->needsReflectionBackToDomain(
|
if (particle.specie()->reflector()->needsReflectionBackToDomain(
|
||||||
&particle)) {
|
&particle)) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Reflect particle.");
|
DEBUG_LEVEL_3("Reflect particle.");
|
||||||
|
#endif
|
||||||
old_position = particle.position();
|
old_position = particle.position();
|
||||||
particle.specie()->reflector()->reflectBackToDomain(&particle);
|
particle.specie()->reflector()->reflectBackToDomain(&particle);
|
||||||
particle.specie()->currentCollector()->collect(&particle, old_position);
|
particle.specie()->currentCollector()->collect(&particle, old_position);
|
||||||
@@ -214,7 +244,9 @@ void Simulation::processUntilTermination(
|
|||||||
|
|
||||||
if (particle.specie()->terminator()->reachedMaxTimeAlive(
|
if (particle.specie()->terminator()->reachedMaxTimeAlive(
|
||||||
&particle)) {
|
&particle)) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Terminate particle. Reached max time alive.");
|
DEBUG_LEVEL_3("Terminate particle. Reached max time alive.");
|
||||||
|
#endif
|
||||||
if (particle.specie()->deletionLogger()) {
|
if (particle.specie()->deletionLogger()) {
|
||||||
particle.specie()->deletionLogger()->logDeletion(
|
particle.specie()->deletionLogger()->logDeletion(
|
||||||
particle.position(), DeletionType::max_time_alive);
|
particle.position(), DeletionType::max_time_alive);
|
||||||
@@ -222,11 +254,13 @@ void Simulation::processUntilTermination(
|
|||||||
break;
|
break;
|
||||||
} else if (particle.specie()->terminator()->leftSimulationDomain(
|
} else if (particle.specie()->terminator()->leftSimulationDomain(
|
||||||
&particle)) {
|
&particle)) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Terminate particle. Left simulation domain.");
|
DEBUG_LEVEL_3("Terminate particle. Left simulation domain.");
|
||||||
std::stringstream output_ss;
|
std::stringstream output_ss;
|
||||||
output_ss << "Position (cyl): " << particle.position().cylinderEntries();
|
output_ss << "Position (cyl): " << particle.position().cylinderEntries();
|
||||||
output_ss << " (cart): " << particle.position().cartesianEntries();
|
output_ss << " (cart): " << particle.position().cartesianEntries();
|
||||||
DEBUG_LEVEL_3(output_ss.str());
|
DEBUG_LEVEL_3(output_ss.str());
|
||||||
|
#endif
|
||||||
if (particle.specie()->deletionLogger()) {
|
if (particle.specie()->deletionLogger()) {
|
||||||
particle.specie()->deletionLogger()->logDeletion(particle.position(),
|
particle.specie()->deletionLogger()->logDeletion(particle.position(),
|
||||||
DeletionType::wall);
|
DeletionType::wall);
|
||||||
@@ -239,6 +273,7 @@ void Simulation::processUntilTermination(
|
|||||||
!(particle.specie()->dynamicDensityField()->changedEnergyBin(
|
!(particle.specie()->dynamicDensityField()->changedEnergyBin(
|
||||||
old_energy, particle.kineticEnergy_eV())) &&
|
old_energy, particle.kineticEnergy_eV())) &&
|
||||||
!was_reflected) {
|
!was_reflected) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Perform interaction.");
|
DEBUG_LEVEL_3("Perform interaction.");
|
||||||
DEBUG_LEVEL_3("Number of Interactions: " +
|
DEBUG_LEVEL_3("Number of Interactions: " +
|
||||||
std::to_string(particle.interactionCounter()));
|
std::to_string(particle.interactionCounter()));
|
||||||
@@ -247,6 +282,7 @@ void Simulation::processUntilTermination(
|
|||||||
std::stringstream output_ss;
|
std::stringstream output_ss;
|
||||||
output_ss << "Position (cyl): " << particle.position().cylinderEntries();
|
output_ss << "Position (cyl): " << particle.position().cylinderEntries();
|
||||||
DEBUG_LEVEL_3(output_ss.str());
|
DEBUG_LEVEL_3(output_ss.str());
|
||||||
|
#endif
|
||||||
|
|
||||||
SimulationTimer::eventStartPoint(std::string("Interaction"));
|
SimulationTimer::eventStartPoint(std::string("Interaction"));
|
||||||
interaction::InteractionOutput output = interact(particle, random_.get(),
|
interaction::InteractionOutput output = interact(particle, random_.get(),
|
||||||
@@ -260,13 +296,17 @@ void Simulation::processUntilTermination(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (output.deleteCurrentParticle()) {
|
if (output.deleteCurrentParticle()) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3(particle.specie()->name() + " removed due to interaction.");
|
DEBUG_LEVEL_3(particle.specie()->name() + " removed due to interaction.");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (particle.specie()->terminator()->reachedMaxInteractions(&particle)) {
|
if (particle.specie()->terminator()->reachedMaxInteractions(&particle)) {
|
||||||
|
#ifdef debug_level3
|
||||||
DEBUG_LEVEL_3("Terminate particle " + particle.specie()->name()
|
DEBUG_LEVEL_3("Terminate particle " + particle.specie()->name()
|
||||||
+ ". Reached max interactions.");
|
+ ". Reached max interactions.");
|
||||||
|
#endif
|
||||||
if (particle.specie()->deletionLogger()) {
|
if (particle.specie()->deletionLogger()) {
|
||||||
particle.specie()->deletionLogger()->logDeletion(
|
particle.specie()->deletionLogger()->logDeletion(
|
||||||
particle.position(), DeletionType::max_interactions);
|
particle.position(), DeletionType::max_interactions);
|
||||||
|
|||||||
Reference in New Issue
Block a user