#include "generators/density_field_generator.h" #include "generators/binning_generator.h" #include "generators/scalar_field_generator.h" #include "simulation/position_binning.h" #include "simulation/scalar_field.h" #include "simulation/errors.h" namespace generator { std::shared_ptr buildConstantDensityField( json_t* object) { DEBUG_LEVEL_2("Creating constant density field."); json_path path = {"ScalarField"}; std::shared_ptr field = buildScalarField(json_object_by_path(object, path)); return std::shared_ptr(new ConstantDensityField(field)); } std::shared_ptr buildDynamicDensityField( Parameter& parameter, const json_path& path_to_field, std::shared_ptr& timer) { DEBUG_LEVEL_2("Creating dynamic density field with pitch angle."); json_path path_binning = json_path_append(path_to_field, {"PositionBinning"}); CylinderBinning position_binning = buildPositionBinningIncludingRedirection(parameter, path_binning); json_path path_energy_binning = json_path_append(path_to_field, {"EnergyBinning"}); EnergyBinning energy_binning = buildEnergyBinningIncludingRedirection(parameter, path_energy_binning); // TBD: make a function to build the pitchangle binning json_path path_pitch_angle_binning = json_path_append(path_to_field, {"PitchAngleBinning"}); PitchAngleBinning pitch_angle_binning = buildPitchAngleBinningIncludingRedirection(parameter, path_pitch_angle_binning); return std::shared_ptr( new DynamicDensityField(position_binning, energy_binning, pitch_angle_binning, timer)); } }; // namespace generator