diff --git a/src/IO/simulation_output.cpp b/src/IO/simulation_output.cpp index b6d6c6e..3329cb0 100755 --- a/src/IO/simulation_output.cpp +++ b/src/IO/simulation_output.cpp @@ -141,6 +141,8 @@ void SimulationOutput::writeNumDeletions(DeletionLogger* logger, writer.write(pair.second, path_to_deletions + "/MaxInteractions"); } else if (pair.first == DeletionType::max_time_alive) { writer.write(pair.second, path_to_deletions + "/MaxTimeAlive"); + } else if (pair.first == DeletionType::cluster_formation) { + writer.write(pair.second, path_to_deletions + "/ClusterFormation"); } } } diff --git a/src/generators/logger_generator.cpp b/src/generators/logger_generator.cpp index ffe881e..b994744 100755 --- a/src/generators/logger_generator.cpp +++ b/src/generators/logger_generator.cpp @@ -22,6 +22,8 @@ std::shared_ptr buildDeletionLogger(json_t* object) { used_types.push_back(DeletionType::max_interactions); } else if (type_alias == "max_time_alive") { used_types.push_back(DeletionType::max_time_alive); + } else if (type_alias == "cluster_formation") { + used_types.push_back(DeletionType::cluster_formation); } else { ERROR("This deletion type is not known"); } @@ -32,6 +34,7 @@ std::shared_ptr buildDeletionLogger(json_t* object) { used_types.push_back(DeletionType::recombination); used_types.push_back(DeletionType::max_interactions); used_types.push_back(DeletionType::max_time_alive); + used_types.push_back(DeletionType::cluster_formation); } } diff --git a/src/interactions/recombination.cpp b/src/interactions/recombination.cpp index e46980a..6d5db92 100755 --- a/src/interactions/recombination.cpp +++ b/src/interactions/recombination.cpp @@ -1,6 +1,7 @@ #include "interactions/recombination.h" #include "simulation/density_field.h" +#include "simulation/logger.h" namespace interaction { @@ -20,6 +21,11 @@ InteractionOutput Recombination::performInteraction( InteractionOutput output; output.deleteCurrentParticle(true); + if (particle.specie()->deletionLogger()) { + particle.specie()->deletionLogger()->logDeletion( + particle.position(), DeletionType::recombination); + } + return output; } diff --git a/src/simulation/simulation.cpp b/src/simulation/simulation.cpp index c2df72c..adfd0f5 100755 --- a/src/simulation/simulation.cpp +++ b/src/simulation/simulation.cpp @@ -60,6 +60,7 @@ void Simulation::init(Parameter& parameter) { DEBUG_LEVEL_0("Init cpu synchronizer."); cpu_synchronizer_ = std::make_shared(); + DEBUG_LEVEL_3("Init done."); } int eventsThisCpu(int events_all_cpus) { @@ -187,15 +188,7 @@ void Simulation::processUntilTermination( was_reflected = true; } - if (particle.specie()->terminator()->reachedMaxInteractions(&particle)) { - DEBUG_LEVEL_3("Terminate particle" + particle.specie()->name() - + ". Reached max interactions."); - if (particle.specie()->deletionLogger()) { - particle.specie()->deletionLogger()->logDeletion( - particle.position(), DeletionType::max_interactions); - } - break; - } else if (particle.specie()->terminator()->reachedMaxTimeAlive( + if (particle.specie()->terminator()->reachedMaxTimeAlive( &particle)) { DEBUG_LEVEL_3("Terminate particle. Reached max time alive."); if (particle.specie()->deletionLogger()) { @@ -242,8 +235,19 @@ void Simulation::processUntilTermination( } if (output.deleteCurrentParticle()) { + DEBUG_LEVEL_3(particle.specie()->name() + " removed due to interaction."); break; } + + if (particle.specie()->terminator()->reachedMaxInteractions(&particle)) { + DEBUG_LEVEL_3("Terminate particle " + particle.specie()->name() + + ". Reached max interactions."); + if (particle.specie()->deletionLogger()) { + particle.specie()->deletionLogger()->logDeletion( + particle.position(), DeletionType::max_interactions); + } + break; + } } } }