Adjusted preprocessor debug stuff

This commit is contained in:
2025-07-09 14:04:30 +02:00
parent 532bdf7979
commit 375ab23008
10 changed files with 26 additions and 26 deletions
+12 -12
View File
@@ -51,7 +51,7 @@ 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 #if defined(debug_level2) || defined(debug_level3)
DEBUG_LEVEL_2("Write density field data."); DEBUG_LEVEL_2("Write density field data.");
#endif #endif
for (auto& task : tasks_density_fields_) { for (auto& task : tasks_density_fields_) {
@@ -61,7 +61,7 @@ void SimulationOutput::writeSimulationData(
specie_path, cpu_sync, task.overwrite_last); specie_path, cpu_sync, task.overwrite_last);
} }
} }
#ifdef debug_level2 #if defined(debug_level2) || defined(debug_level3)
DEBUG_LEVEL_2("Write current collector data."); DEBUG_LEVEL_2("Write current collector data.");
#endif #endif
for (auto& task : tasks_current_collector_) { for (auto& task : tasks_current_collector_) {
@@ -71,7 +71,7 @@ void SimulationOutput::writeSimulationData(
specie_path, cpu_sync, task.overwrite_last); specie_path, cpu_sync, task.overwrite_last);
} }
} }
#ifdef debug_level2 #if defined(debug_level2) || defined(debug_level3)
DEBUG_LEVEL_2("Write deletion logger data."); DEBUG_LEVEL_2("Write deletion logger data.");
#endif #endif
for (auto& task : tasks_deletion_logger_) { for (auto& task : tasks_deletion_logger_) {
@@ -94,23 +94,23 @@ 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 #if defined(debug_level3)
DEBUG_LEVEL_3("Write spectrum."); DEBUG_LEVEL_3("Write spectrum.");
#endif #endif
writeSpectrum(density_field, path); writeSpectrum(density_field, path);
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Write density."); DEBUG_LEVEL_3("Write density.");
#endif #endif
writeDensity(density_field, path); writeDensity(density_field, path);
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Write time in bin."); DEBUG_LEVEL_3("Write time in bin.");
#endif #endif
writeTimeInBin(density_field, path); writeTimeInBin(density_field, path);
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Write deleted particles."); DEBUG_LEVEL_3("Write deleted particles.");
#endif #endif
writeDeletedParticles(density_field, path); writeDeletedParticles(density_field, path);
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Write physical time."); DEBUG_LEVEL_3("Write physical time.");
#endif #endif
writePhysicalTime(density_field, path); writePhysicalTime(density_field, path);
@@ -126,15 +126,15 @@ 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 #if defined(debug_level3)
DEBUG_LEVEL_3("Write current crossings."); DEBUG_LEVEL_3("Write current crossings.");
#endif #endif
writeCurrentCrossings(current_collector, path); writeCurrentCrossings(current_collector, path);
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Write current."); DEBUG_LEVEL_3("Write current.");
#endif #endif
writeCurrent(current_collector, path); writeCurrent(current_collector, path);
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Write physical time."); DEBUG_LEVEL_3("Write physical time.");
#endif #endif
writePhysicalTime(current_collector, path); writePhysicalTime(current_collector, path);
@@ -149,7 +149,7 @@ 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 #if defined(debug_level3)
DEBUG_LEVEL_3("Write number of deletions."); DEBUG_LEVEL_3("Write number of deletions.");
#endif #endif
writeNumDeletions(logger, path); writeNumDeletions(logger, path);
+1 -1
View File
@@ -13,7 +13,7 @@ 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 #if defined(debug_level3)
DEBUG_LEVEL_3("Perform charge exchange."); DEBUG_LEVEL_3("Perform charge exchange.");
#endif #endif
+1 -1
View File
@@ -18,7 +18,7 @@ ClusterFormation::ClusterFormation(
InteractionOutput ClusterFormation::performInteraction( InteractionOutput ClusterFormation::performInteraction(
particle::Particle& particle, particle::Particle& particle,
RandomNumbers* generator) { RandomNumbers* generator) {
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Perform cluster formation."); DEBUG_LEVEL_3("Perform cluster formation.");
#endif #endif
const auto x_impact = particle.position(); const auto x_impact = particle.position();
+1 -1
View File
@@ -18,7 +18,7 @@ ElasticScattering::ElasticScattering(
InteractionOutput ElasticScattering::performInteraction( InteractionOutput ElasticScattering::performInteraction(
particle::Particle& particle, particle::Particle& particle,
RandomNumbers* generator) { RandomNumbers* generator) {
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Perform elastic scattering."); DEBUG_LEVEL_3("Perform elastic scattering.");
#endif #endif
// get the information of the incident particle // get the information of the incident particle
+1 -1
View File
@@ -18,7 +18,7 @@ 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 #if defined(debug_level3)
DEBUG_LEVEL_3("Perform excitation."); DEBUG_LEVEL_3("Perform excitation.");
#endif #endif
const blitz::TinyVector<double, 3> v_impact = const blitz::TinyVector<double, 3> v_impact =
+1 -1
View File
@@ -10,7 +10,7 @@ FreeMovement::FreeMovement()
InteractionOutput FreeMovement::performInteraction(particle::Particle& particle, InteractionOutput FreeMovement::performInteraction(particle::Particle& particle,
RandomNumbers* generator) { RandomNumbers* generator) {
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Perform free movement."); DEBUG_LEVEL_3("Perform free movement.");
#endif #endif
// do nothing // do nothing
+1 -1
View File
@@ -29,7 +29,7 @@ ElectronIonization::ElectronIonization(
InteractionOutput ElectronIonization::performInteraction( InteractionOutput ElectronIonization::performInteraction(
particle::Particle& particle, particle::Particle& particle,
RandomNumbers* generator) { RandomNumbers* generator) {
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Perform ionization."); DEBUG_LEVEL_3("Perform ionization.");
#endif #endif
+1 -1
View File
@@ -16,7 +16,7 @@ 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 #if defined(debug_level3)
DEBUG_LEVEL_3("Perform recombination."); DEBUG_LEVEL_3("Perform recombination.");
#endif #endif
+1 -1
View File
@@ -45,7 +45,7 @@ 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 #if defined(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 #endif
+6 -6
View File
@@ -72,7 +72,7 @@ void Simulation::init(Parameter& parameter) {
DEBUG_LEVEL_0("Init cpu synchronizer."); DEBUG_LEVEL_0("Init cpu synchronizer.");
#endif #endif
cpu_synchronizer_ = std::make_shared<CpuSynchronizer>(); cpu_synchronizer_ = std::make_shared<CpuSynchronizer>();
#ifdef debug_level3 #if defined(debug_level3)
DEBUG_LEVEL_3("Init done."); DEBUG_LEVEL_3("Init done.");
#endif #endif
} }
@@ -137,7 +137,7 @@ void Simulation::start() {
std::to_string(leftover_events)); std::to_string(leftover_events));
processEvents(evenst_of_cycle); processEvents(evenst_of_cycle);
#ifdef debug_level1 #if defined(debug_level1) || defined(debug_level2) || defined(debug_level3)
DEBUG_LEVEL_1("Leftover events: " + std::to_string(leftover_events)); DEBUG_LEVEL_1("Leftover events: " + std::to_string(leftover_events));
#endif #endif
leftover_events -= evenst_of_cycle; leftover_events -= evenst_of_cycle;
@@ -171,13 +171,13 @@ void Simulation::processEvents(int events) {
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 #if defined(debug_level2) || defined(debug_level3)
DEBUG_LEVEL_2("Current event: " + std::to_string(current_event)); DEBUG_LEVEL_2("Current event: " + std::to_string(current_event));
#endif #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 #if defined(debug_level2) || defined(debug_level3)
DEBUG_LEVEL_2("Inject particles to queue."); DEBUG_LEVEL_2("Inject particles to queue.");
#endif #endif
SimulationTimer::eventStartPoint(std::string("ParticleInjection")); SimulationTimer::eventStartPoint(std::string("ParticleInjection"));
@@ -185,14 +185,14 @@ void Simulation::processEvents(int events) {
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 #if defined(debug_level2) || defined(debug_level3)
DEBUG_LEVEL_2("Injected particles to queue."); DEBUG_LEVEL_2("Injected particles to queue.");
#endif #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 #if defined(debug_level2) || defined(debug_level3)
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 #endif
// choose a random particle from the particle queue to be processed // choose a random particle from the particle queue to be processed