Minor changes in debug output, added information

to error messages
This commit is contained in:
2024-03-15 15:49:40 +01:00
parent 55c51f8434
commit 2fccef7132
19 changed files with 41 additions and 32 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ EnergyBinning buildEnergyBinning(json_t* object) {
ASSERT_POSITIVE(&min_energy, "Min Energy must be positive");
double max_energy =
json_read_energy(json_object_by_path(object, {"MaxEnergy"}), "eV");
ASSERT_POSITIVE(&max_energy, "Min Energy must be positive");
ASSERT_POSITIVE(&max_energy, "Max Energy must be positive");
DEBUG_LEVEL_3("with number of bins: " + std::to_string(number_of_bins));
DEBUG_LEVEL_3("with min energy: " + std::to_string(min_energy));
+1 -1
View File
@@ -29,7 +29,7 @@ std::shared_ptr<DriftVelocity> buildDriftVelocityIncludingRedirection(
std::stringstream cpath;
if (parameter.jsonObjectFromBase(
json_path_append(path_to_drift_velocity, {"CreateSameAs"}))) {
DEBUG_LEVEL_2("Creating Drift velocity: CreateSameAs.");
DEBUG_LEVEL_2("Creating drift velocity: CreateSameAs.");
json_path path_to_same = json_path_get(parameter.jsonObjectFromBase(
json_path_append(path_to_drift_velocity, {"CreateSameAs"})));
std::stringstream path;
+2 -2
View File
@@ -15,7 +15,7 @@ std::shared_ptr<ElectricField> electricField(json_t* object) {
background = buildVectorField(
json_object_by_path(object, {"Background", "VectorField"}));
} else {
ERROR("Can not find background for electric field");
ERROR("Can not find background for electric field.");
}
if (json_object_by_path(object, {"Dynamic"})) {
@@ -23,7 +23,7 @@ std::shared_ptr<ElectricField> electricField(json_t* object) {
dynamic = buildVectorField(
json_object_by_path(object, {"Dynamic", "VectorField"}));
} else {
ERROR("Can not find dynamic for electric field");
ERROR("Can not find dynamic for electric field.");
}
return std::shared_ptr<ElectricField>(new ElectricField(background, dynamic));
@@ -29,7 +29,7 @@ std::shared_ptr<EnergyDistributionFunction> buildEnergyDistributionFunction(
return std::shared_ptr<EnergyDistributionFunction>(
new Constant(constant_eV));
}
ERROR("This Energy Distribution is not implemented");
ERROR("This Energy Distribution is not implemented.");
return nullptr;
}
+2 -2
View File
@@ -37,7 +37,7 @@ std::shared_ptr<Injector> buildInjector(
}
// EventPositionDistribution
DEBUG_LEVEL_2("Creating event distribution");
DEBUG_LEVEL_2("Creating event distribution.");
std::shared_ptr<ScalarField> field = buildScalarField(json_object_by_path(
object, {"EventPositionDistribution", "ScalarField"}));
@@ -76,7 +76,7 @@ std::shared_ptr<Injector> buildInjector(
position_limit_phi, position_limit_z));
// MotherDriftVelocity
DEBUG_LEVEL_2("Creating mother drift velocity");
DEBUG_LEVEL_2("Creating mother drift velocity.");
std::shared_ptr<DriftVelocity> drift_velocity = buildDriftVelocity(
parameter, json_path_append(path_to_injector, {"MotherDriftVelocity"}));
+7 -6
View File
@@ -43,7 +43,7 @@ void addInteractions(
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
DEBUG_LEVEL_3("with target" + target_name);
DEBUG_LEVEL_3("with target " + target_name);
std::shared_ptr<species::Specie> target =
findTarget(target_name, tracked_species, background_species);
@@ -180,7 +180,7 @@ void addInteractions(
ionization_energy_distribution, scattering_angle_distribution,
ionization_energy_eV));
} else {
ERROR("This ionization model is not implemented.");
ERROR("This ionization model is not implemented: " + ionization_model);
}
} else if (type == "Excitation") {
DEBUG_LEVEL_2("Adding interactions: Excitation");
@@ -228,6 +228,7 @@ void addInteractions(
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
new interaction::ChargeExchange(cross_section, target)));
} else if (type == "Recombination") {
DEBUG_LEVEL_2("Adding interactions: Recombination");
std::string target_name =
json_string(json_object_by_path(value, {"Target"}));
std::shared_ptr<species::TrackedSpecie> target =
@@ -305,7 +306,7 @@ std::function<double(double)> buildTotalCrossSection(json_t* object) {
json_object_by_path(object, {"ExcitationFunction", "ExcitationState"}));
return buildExcitationCrossSection(excitation_state);
} else {
ERROR("This type of cross section is not implemented");
ERROR("This type of cross section is not implemented.");
return nullptr;
}
}
@@ -443,7 +444,7 @@ std::function<double(double)> buildExcitationCrossSection(
} else {
ERROR(
"This type of cross section ExcitationState is not implemented in "
"buildExcitationCrossSection.");
"buildExcitationCrossSection: " + excitation_state);
return nullptr;
}
}
@@ -513,7 +514,7 @@ std::shared_ptr<species::Specie> findTarget(
} else if (tracked_species.count(target_name)) {
return tracked_species.at(target_name);
} else {
ERROR("The specified target does not exist.");
ERROR("The specified target " + target_name + " does not exist.");
return nullptr;
}
};
@@ -525,7 +526,7 @@ std::shared_ptr<species::TrackedSpecie> findTracked(
if (tracked_species.count(target_name)) {
return tracked_species.at(target_name);
} else {
ERROR("The specified target does not exist.");
ERROR("The specified target " + target_name + " does not exist.");
return nullptr;
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ std::shared_ptr<DeletionLogger> buildDeletionLogger(json_t* object) {
} else if (type_alias == "cluster_formation") {
used_types.push_back(DeletionType::cluster_formation);
} else {
ERROR("This deletion type is not known");
ERROR("This deletion type " + type_alias + " is not known.");
}
}
} else {
+1 -1
View File
@@ -27,7 +27,7 @@ double buildMass(json_t* object) {
if (SpeciesAlias::isAlias(name)) {
return SpeciesMasses::mass(SpeciesAlias::alias(name));
} else {
ERROR("This specie type is not known.");
ERROR("The specie type " + name + " is not known.");
return 0.;
}
} else if (json_object_by_path(object, {"value"})) {
+1 -1
View File
@@ -19,7 +19,7 @@ std::shared_ptr<Reflector> buildReflector(Parameter& parameter,
DEBUG_LEVEL_2("Create reflector: NoReflector");
return std::shared_ptr<Reflector>(new NoReflector());
} else {
ERROR("This reflector is not implemented");
ERROR("This reflector is not implemented.");
return nullptr;
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ std::shared_ptr<ScalarField> buildScalarField(json_t* object) {
json_object_by_path(object, {"ScalarFieldFunctionInZ", "zFunction"}));
return std::shared_ptr<ScalarField>(new ScalarFieldFunctionInZ(z_function));
} else {
ERROR("This scalar field is not implemented");
ERROR("This scalar field is not implemented.");
return nullptr;
}
return nullptr;
@@ -47,7 +47,8 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
output->addDensityFieldOutput(task);
}
} else {
ERROR("This species can not be outputted.");
ERROR("DensityFields: Species to be outputted have to be "
"given as an array or using the keyword \"all\".");
}
}
}
@@ -84,7 +85,8 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
output->addCurrentBorderOutput(task);
}
} else {
ERROR("This species can not be outputted.");
ERROR("CurrentBorders: Species to be outputted have to be "
"given as an array or using the keyword \"all\".");
}
}
}
@@ -124,7 +126,8 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
output->addDeletionLoggerOutput(task);
}
} else {
ERROR("This species can not be outputted.");
ERROR("DeletionLogger: Species to be outputted have to be "
"given as an array or using the keyword \"all\".");
}
}
}
@@ -140,7 +143,7 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
intervall = 1;
}
ASSERT_POSITIVE(&intervall,
"The intervall for the potential must be positive");
"The intervall for the poisson solver output must be positive");
bool overwrite_last = json_bool(
json_object_by_path(object, {"PoissonSolver", "OverwriteLast"}));
+1 -1
View File
@@ -211,7 +211,7 @@ void SpeciesBuilder::fillMass() {
}
void SpeciesBuilder::fillCharge() {
DEBUG_LEVEL_2("Fill charges");
DEBUG_LEVEL_2("Fill charges.");
for (auto& b : background_species_info) {
b.second.charge_C = SpeciesCharges::charge(b.second.type);
}
+1 -1
View File
@@ -13,7 +13,7 @@ Excitation::Excitation(std::function<double(double)> cross_section,
: Interaction(cross_section, target),
excitation_energy_eV_(excitation_energy_eV) {
ASSERT_POSITIVE(&excitation_energy_eV_,
"The exitationenergy must be positive.");
"The exitation energy must be positive.");
}
InteractionOutput Excitation::performInteraction(particle::Particle& particle,
+3 -2
View File
@@ -65,8 +65,9 @@ InteractionOutput Recombination::performInteraction(
macroscopic_bin_cross_sections_m.end(), 0.0);
if(total_macroscopic_cross_section_m <= 0.) {
ERROR("Total cross section is " + std::to_string(total_macroscopic_cross_section_m) +
". But recombination was chosen.");
ERROR("Total cross section is " +
std::to_string(total_macroscopic_cross_section_m) +
". But recombination was chosen.");
}
std::discrete_distribution<int> energy_bin_decider(
+6 -3
View File
@@ -54,6 +54,7 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
potential_(i,j,k) = {BoundaryType::no_boundary, 0.};
break;
default:
// include position in output
ERROR("Something went terribly wrong. Position is nowhere.");
break;
}
@@ -246,9 +247,11 @@ blitz::Array<double, 3> PoissonSolver::potential() {
return potentialValues;
}
blitz::Array<double, 3> PoissonSolver::interpolateDensityToPotentialGrid(const blitz::Array<double, 3> density) {
if((potential_.extent(0) - 1 != density.extent(0)) || (potential_.extent(1) != density.extent(1))
|| (potential_.extent(2) - 1 != density.extent(2))) {
blitz::Array<double, 3> PoissonSolver::interpolateDensityToPotentialGrid(
const blitz::Array<double, 3> density) {
if((potential_.extent(0) - 1 != density.extent(0)) ||
(potential_.extent(1) != density.extent(1)) ||
(potential_.extent(2) - 1 != density.extent(2))) {
ERROR("Extent of the cylinder binning and the provided chargedensity do not match.");
}
//probably include a check for the lowerbound of the provided chargedensity
+1 -1
View File
@@ -55,7 +55,7 @@ void CpuSynchronizer::sumToAll(long int& value, long int& last_sync_value) {
void CpuSynchronizer::synchronize(Timer* timer, Timer* last_sync_timer) {
if(timer == last_sync_timer) {
ERROR("Synchronization of timers cannot work, point to same object");
ERROR("Synchronization of timers cannot work, point to same object.");
}
double time_s = timer->time();
double last_sync_time_s = last_sync_timer->time();
+1
View File
@@ -2,6 +2,7 @@
#include <math.h>
#include <algorithm>
// probably rename to indicate what type of borders are created
std::vector<double> generateBinBorders(double bin_min,
double bin_max,
int num_bins) {
+1 -1
View File
@@ -337,7 +337,7 @@ blitz::Array<double,3> Simulation::chargedensity() {
std::shared_ptr<species::TrackedSpecie> firstTracked = tracked_species_.begin()->second;
DEBUG_LEVEL_3("shared pointer extracted, key: " + tracked_species_.begin()->first);
if(!firstTracked)
ERROR("extracted pointer is null");
ERROR("Extracted pointer is null.");
blitz::Array<double,3> init = firstTracked->dynamicDensityField()->densityArray();
blitz::Array<double, 3> chargeden(init.lbound(), init.extent());
chargeden = 0.;
+2 -2
View File
@@ -12,7 +12,7 @@ double lengthPrefactor(const std::string& unit) {
} else if (unit == "mm") {
return 1E-3;
} else {
ERROR("I dont know this length unit.");
ERROR("I dont know this length unit: " + unit);
return 0;
}
}
@@ -32,7 +32,7 @@ double energyPrefactor(const std::string& unit) {
} else if (unit == "J") {
return 1 / SI::e;
} else {
ERROR("I dont know this energy unit.");
ERROR("I dont know this energy unit: " + unit);
return 0;
}
}