From 375ab23008aa587e3efca1b6f988cea54d5db825 Mon Sep 17 00:00:00 2001 From: csendlinger Date: Wed, 9 Jul 2025 14:04:30 +0200 Subject: [PATCH] Adjusted preprocessor debug stuff --- src/IO/simulation_output.cpp | 24 ++++++++++++------------ src/interactions/charge_exchange.cpp | 2 +- src/interactions/cluster_formation.cpp | 2 +- src/interactions/elastic_scattering.cpp | 2 +- src/interactions/excitation.cpp | 2 +- src/interactions/free_movement.cpp | 2 +- src/interactions/ionization.cpp | 2 +- src/interactions/recombination.cpp | 2 +- src/simulation/injector.cpp | 2 +- src/simulation/simulation.cpp | 12 ++++++------ 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/IO/simulation_output.cpp b/src/IO/simulation_output.cpp index 9461933..f5651f0 100755 --- a/src/IO/simulation_output.cpp +++ b/src/IO/simulation_output.cpp @@ -51,7 +51,7 @@ void SimulationOutput::writeSimulationData( int cpu_sync, std::map>& species) { if (MpiCommunication::mpi_rank == 0) { -#ifdef debug_level2 +#if defined(debug_level2) || defined(debug_level3) DEBUG_LEVEL_2("Write density field data."); #endif for (auto& task : tasks_density_fields_) { @@ -61,7 +61,7 @@ void SimulationOutput::writeSimulationData( specie_path, cpu_sync, task.overwrite_last); } } -#ifdef debug_level2 +#if defined(debug_level2) || defined(debug_level3) DEBUG_LEVEL_2("Write current collector data."); #endif for (auto& task : tasks_current_collector_) { @@ -71,7 +71,7 @@ void SimulationOutput::writeSimulationData( specie_path, cpu_sync, task.overwrite_last); } } -#ifdef debug_level2 +#if defined(debug_level2) || defined(debug_level3) DEBUG_LEVEL_2("Write deletion logger data."); #endif 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; -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write spectrum."); #endif writeSpectrum(density_field, path); -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write density."); #endif writeDensity(density_field, path); -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write time in bin."); #endif writeTimeInBin(density_field, path); -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write deleted particles."); #endif writeDeletedParticles(density_field, path); -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write physical time."); #endif writePhysicalTime(density_field, path); @@ -126,15 +126,15 @@ void SimulationOutput::writeSimulationData(CurrentCollector* current_collector, } std::string path = species_path + "/CurrentCollector/SimulationData/" + sync_path; -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write current crossings."); #endif writeCurrentCrossings(current_collector, path); -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write current."); #endif writeCurrent(current_collector, path); -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write physical time."); #endif writePhysicalTime(current_collector, path); @@ -149,7 +149,7 @@ void SimulationOutput::writeSimulationData(DeletionLogger* logger, sync_path = "LastSyncPeriod"; } std::string path = species_path + "/DeletionLogger/" + sync_path; -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Write number of deletions."); #endif writeNumDeletions(logger, path); diff --git a/src/interactions/charge_exchange.cpp b/src/interactions/charge_exchange.cpp index 4d36516..4bf3f78 100755 --- a/src/interactions/charge_exchange.cpp +++ b/src/interactions/charge_exchange.cpp @@ -13,7 +13,7 @@ ChargeExchange::ChargeExchange(std::function cross_section, InteractionOutput ChargeExchange::performInteraction( particle::Particle& particle, RandomNumbers* generator) { -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Perform charge exchange."); #endif diff --git a/src/interactions/cluster_formation.cpp b/src/interactions/cluster_formation.cpp index 9acc8d1..3815c35 100755 --- a/src/interactions/cluster_formation.cpp +++ b/src/interactions/cluster_formation.cpp @@ -18,7 +18,7 @@ ClusterFormation::ClusterFormation( InteractionOutput ClusterFormation::performInteraction( particle::Particle& particle, RandomNumbers* generator) { -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Perform cluster formation."); #endif const auto x_impact = particle.position(); diff --git a/src/interactions/elastic_scattering.cpp b/src/interactions/elastic_scattering.cpp index 279a57f..f0be13d 100755 --- a/src/interactions/elastic_scattering.cpp +++ b/src/interactions/elastic_scattering.cpp @@ -18,7 +18,7 @@ ElasticScattering::ElasticScattering( InteractionOutput ElasticScattering::performInteraction( particle::Particle& particle, RandomNumbers* generator) { -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Perform elastic scattering."); #endif // get the information of the incident particle diff --git a/src/interactions/excitation.cpp b/src/interactions/excitation.cpp index 526c227..bc69c98 100755 --- a/src/interactions/excitation.cpp +++ b/src/interactions/excitation.cpp @@ -18,7 +18,7 @@ Excitation::Excitation(std::function cross_section, InteractionOutput Excitation::performInteraction(particle::Particle& particle, RandomNumbers* generator) { -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Perform excitation."); #endif const blitz::TinyVector v_impact = diff --git a/src/interactions/free_movement.cpp b/src/interactions/free_movement.cpp index 37b476e..664607a 100755 --- a/src/interactions/free_movement.cpp +++ b/src/interactions/free_movement.cpp @@ -10,7 +10,7 @@ FreeMovement::FreeMovement() InteractionOutput FreeMovement::performInteraction(particle::Particle& particle, RandomNumbers* generator) { -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Perform free movement."); #endif // do nothing diff --git a/src/interactions/ionization.cpp b/src/interactions/ionization.cpp index adb2fb6..6d50c0c 100755 --- a/src/interactions/ionization.cpp +++ b/src/interactions/ionization.cpp @@ -29,7 +29,7 @@ ElectronIonization::ElectronIonization( InteractionOutput ElectronIonization::performInteraction( particle::Particle& particle, RandomNumbers* generator) { -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Perform ionization."); #endif diff --git a/src/interactions/recombination.cpp b/src/interactions/recombination.cpp index 7184cb1..5eabc16 100755 --- a/src/interactions/recombination.cpp +++ b/src/interactions/recombination.cpp @@ -16,7 +16,7 @@ Recombination::Recombination(std::function cross_section, InteractionOutput Recombination::performInteraction( particle::Particle& particle, RandomNumbers* generator) { -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Perform recombination."); #endif diff --git a/src/simulation/injector.cpp b/src/simulation/injector.cpp index b1f5070..12b1b87 100755 --- a/src/simulation/injector.cpp +++ b/src/simulation/injector.cpp @@ -45,7 +45,7 @@ std::vector Injector::rollNewParticles( // particles are assumed to be created by a decay process // therefore the resulting particles all start out at the same position CylinderCoordinate position = position_distribution_->rollPosition(engine); -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Injected z position: " + std::to_string(position.cylinderEntries()(2))); #endif diff --git a/src/simulation/simulation.cpp b/src/simulation/simulation.cpp index f10eebb..dfdc8e1 100755 --- a/src/simulation/simulation.cpp +++ b/src/simulation/simulation.cpp @@ -72,7 +72,7 @@ void Simulation::init(Parameter& parameter) { DEBUG_LEVEL_0("Init cpu synchronizer."); #endif cpu_synchronizer_ = std::make_shared(); -#ifdef debug_level3 +#if defined(debug_level3) DEBUG_LEVEL_3("Init done."); #endif } @@ -137,7 +137,7 @@ void Simulation::start() { std::to_string(leftover_events)); 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)); #endif leftover_events -= evenst_of_cycle; @@ -171,13 +171,13 @@ void Simulation::processEvents(int events) { particle_queue.reserve(100); int current_event = 0; 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)); #endif // if the particle queue is empty a new beta decay event is started if (particle_queue.empty()) { current_event += 1; -#ifdef debug_level2 +#if defined(debug_level2) || defined(debug_level3) DEBUG_LEVEL_2("Inject particles to queue."); #endif SimulationTimer::eventStartPoint(std::string("ParticleInjection")); @@ -185,14 +185,14 @@ void Simulation::processEvents(int events) { std::vector new_particles = determineInjectedParticles(random_.get()); SimulationTimer::eventStopPoint(std::string("ParticleInjection")); -#ifdef debug_level2 +#if defined(debug_level2) || defined(debug_level3) DEBUG_LEVEL_2("Injected particles to queue."); #endif particle_queue.insert(particle_queue.end(), new_particles.begin(), 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())); #endif // choose a random particle from the particle queue to be processed