preprocessor now filters debug output

This commit is contained in:
2025-05-28 15:27:00 +02:00
parent e2167fb75b
commit f510d0a39a
39 changed files with 375 additions and 14 deletions
+22
View File
@@ -33,7 +33,9 @@ void addInteractions(
std::string type = json_string(json_object_by_path(value, {"Type"}));
if (type == "ElasticScattering") {
#ifdef debug_level2
DEBUG_LEVEL_2("Adding interactions: ElasticScattering");
#endif
std::function<double(double)> cross_section =
buildTotalCrossSection(json_object_by_path(value, {"CrossSection"}));
@@ -43,7 +45,9 @@ void addInteractions(
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
#ifdef debug_level3
DEBUG_LEVEL_3("with target " + target_name);
#endif
std::shared_ptr<species::Specie> target =
findTarget(target_name, tracked_species, background_species);
@@ -53,11 +57,15 @@ void addInteractions(
scattering_angle_distribution)));
} else if (type == "FreeMovement") {
#ifdef debug_level2
DEBUG_LEVEL_2("Adding interactions: FreeMovement");
#endif
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::FreeMovement()));
} else if (type == "ElectronIonization") {
#ifdef debug_level2
DEBUG_LEVEL_2("Adding interactions: Ionization");
#endif
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::Specie> target =
@@ -183,7 +191,9 @@ void addInteractions(
ERROR("This ionization model is not implemented: " + ionization_model);
}
} else if (type == "Excitation") {
#ifdef debug_level2
DEBUG_LEVEL_2("Adding interactions: Excitation");
#endif
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::Specie> target =
@@ -201,7 +211,9 @@ void addInteractions(
cross_section, target, excitation_energy)));
} else if (type == "Clustering") {
#ifdef debug_level2
DEBUG_LEVEL_2("Adding interactions: Clustering");
#endif
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::Specie> target =
@@ -217,7 +229,9 @@ void addInteractions(
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::ClusterFormation(cross_section, target, product)));
} else if (type == "ChargeExchange") {
#ifdef debug_level2
DEBUG_LEVEL_2("Adding interactions: ChargeExchange");
#endif
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::Specie> target =
@@ -228,7 +242,9 @@ void addInteractions(
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::ChargeExchange(cross_section, target)));
} else if (type == "Recombination") {
#ifdef debug_level2
DEBUG_LEVEL_2("Adding interactions: Recombination");
#endif
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::TrackedSpecie> target =
@@ -471,18 +487,24 @@ std::function<double(double, double)> build2DCrossSection(json_t* object) {
std::shared_ptr<ScatteringAngleDistribution> buildScatteringAngleDistribution(
json_t* object) {
if (json_object_by_path(object, {"Isotropic"})) {
#ifdef debug_level2
DEBUG_LEVEL_2("Adding ScatteringAngleDistribution: Isotropic");
#endif
return std::shared_ptr<ScatteringAngleDistribution>(
new IsotropicAngleDistribution());
} else if (json_object_by_path(object, {"AngleDistributionFromFile"})) {
#ifdef debug_level2
DEBUG_LEVEL_2(
"Adding ScatteringAngleDistribution: AngleDistributionFromFile");
#endif
std::string absolute_filepath = readAbsoluteFilename(
json_object_by_path(object, {"AngleDistributionFromFile", "PathToH5"}));
return std::make_shared<AngleDistributionFromFile>(absolute_filepath);
} else if (json_object_by_path(object, {"CompositeAngleDistribution"})) {
#ifdef debug_level2
DEBUG_LEVEL_2(
"Adding ScatteringAngleDistribution: CompositeAngleDistribution");
#endif
json_t* object_composite =
json_object_by_path(object, {"CompositeAngleDistribution"});
const double decider_energy = json_read_energy(