28 lines
1.1 KiB
C++
Executable File
28 lines
1.1 KiB
C++
Executable File
#include "generators/geometry_generator.h"
|
|
#include <string>
|
|
#include "simulation/errors.h"
|
|
namespace generator {
|
|
|
|
std::shared_ptr<Geometry> buildGeometry(Parameter& parameter,
|
|
const json_path& path_to_geometry) {
|
|
if (parameter.jsonObjectFromBase(
|
|
json_path_append(path_to_geometry, {"Cylinder"}))) {
|
|
DEBUG_LEVEL_2("Creating geometry: cylinder.");
|
|
double radius =
|
|
json_read_length(parameter.jsonObjectFromBase(json_path_append(
|
|
path_to_geometry, {"Cylinder", "Radius"})),
|
|
"m");
|
|
double height =
|
|
json_read_length(parameter.jsonObjectFromBase(json_path_append(
|
|
path_to_geometry, {"Cylinder", "Height"})),
|
|
"m");
|
|
DEBUG_LEVEL_3("with radius: " + std::to_string(radius) + " m");
|
|
DEBUG_LEVEL_3("with height: " + std::to_string(height) + " m");
|
|
return std::shared_ptr<Geometry>(new Cylinder(radius, height));
|
|
} else {
|
|
ERROR("This geometry is not implemented.");
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
}; // namespace generator
|