Added Terminator type, which detects the crossing across two surfaces (very rudamentary check)
This commit is contained in:
@@ -8,22 +8,90 @@ std::shared_ptr<Terminator> buildTerminator(
|
||||
Parameter& parameter,
|
||||
const json_path& path_to_terminator) {
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Creating terminator.");
|
||||
DEBUG_LEVEL_2("Creating terminator.");
|
||||
#endif
|
||||
long int max_interactions = static_cast<long int>(parameter.doubleValue(
|
||||
json_path_append(path_to_terminator, {"MaximumInteractions"})));
|
||||
double max_time_alive = parameter.doubleValue(
|
||||
json_path_append(path_to_terminator, {"MaxTimeAlive", "value"}));
|
||||
if (parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_terminator, {"Cylinder"}))) {
|
||||
long int max_interactions = static_cast<long int>(parameter.doubleValue(
|
||||
json_path_append(path_to_terminator, {"Cylinder", "MaximumInteractions"})));
|
||||
double max_time_alive = parameter.doubleValue(
|
||||
json_path_append(path_to_terminator, {"Cylinder", "MaxTimeAlive", "value"}));
|
||||
#ifdef debug_level3
|
||||
DEBUG_LEVEL_3("with max interactions: " + std::to_string(max_interactions));
|
||||
DEBUG_LEVEL_3("with max time alive: " + std::to_string(max_time_alive));
|
||||
DEBUG_LEVEL_3("with max interactions: " + std::to_string(max_interactions));
|
||||
DEBUG_LEVEL_3("with max time alive: " + std::to_string(max_time_alive));
|
||||
#endif
|
||||
|
||||
std::shared_ptr<Geometry> geometry = buildGeometryIncludingRedirection(
|
||||
parameter, json_path_append(path_to_terminator, {"BoundaryGeometry"}));
|
||||
std::shared_ptr<Geometry> geometry = buildGeometryIncludingRedirection(
|
||||
parameter, json_path_append(path_to_terminator, {"Cylinder", "BoundaryGeometry"}));
|
||||
|
||||
return std::shared_ptr<Terminator>(
|
||||
new Terminator(max_interactions, max_time_alive, geometry));
|
||||
return std::shared_ptr<Terminator>(
|
||||
new Terminator(max_interactions, max_time_alive, geometry));
|
||||
|
||||
} else if (parameter.jsonObjectFromBase(json_path_append(path_to_terminator,
|
||||
{"CylinderWithPlates"}))) {
|
||||
long int max_interactions = static_cast<long int>(parameter.doubleValue(
|
||||
json_path_append(path_to_terminator, {"CylinderWithPlates", "MaximumInteractions"})));
|
||||
double max_time_alive = parameter.doubleValue(
|
||||
json_path_append(path_to_terminator, {"CylinderWithPlates", "MaxTimeAlive", "value"}));
|
||||
#ifdef debug_level3
|
||||
DEBUG_LEVEL_3("with max interactions: " + std::to_string(max_interactions));
|
||||
DEBUG_LEVEL_3("with max time alive: " + std::to_string(max_time_alive));
|
||||
#endif
|
||||
|
||||
std::shared_ptr<Geometry> geometry = buildGeometryIncludingRedirection(
|
||||
parameter, json_path_append(path_to_terminator, {"CylinderWithPlates", "BoundaryGeometry"}));
|
||||
|
||||
double zpos1 = json_read_length(
|
||||
parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_terminator,
|
||||
{"CylinderWithPlates", "Plate1", "zPosition"})));
|
||||
|
||||
double rInner1 = json_read_length(
|
||||
parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_terminator,
|
||||
{"CylinderWithPlates", "Plate1", "innerRadius"})));
|
||||
|
||||
double rOuter1 = json_read_length(
|
||||
parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_terminator,
|
||||
{"CylinderWithPlates", "Plate1", "outerRadius"})));
|
||||
|
||||
double zpos2 = json_read_length(
|
||||
parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_terminator,
|
||||
{"CylinderWithPlates", "Plate2", "zPosition"})));
|
||||
|
||||
double rInner2 = json_read_length(
|
||||
parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_terminator,
|
||||
{"CylinderWithPlates", "Plate2", "innerRadius"})));
|
||||
|
||||
double rOuter2 = json_read_length(
|
||||
parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_terminator,
|
||||
{"CylinderWithPlates", "Plate2", "outerRadius"})));
|
||||
|
||||
if(MpiCommunication::mpi_rank == 0) {
|
||||
std::stringstream out;
|
||||
out << "Specifications of Plate 1:\n";
|
||||
out << "\tz position: " << zpos1 << " m\n\t";
|
||||
out << "inner radius: " << rInner1 << " m\n\t";
|
||||
out << "outer radius: " << rOuter1 << " m\n";
|
||||
out << "Specifications of Plate 2:\n";
|
||||
out << "\tz position: " << zpos2 << " m\n\t";
|
||||
out << "inner radius: " << rInner2 << " m\n\t";
|
||||
out << "outer radius: " << rOuter2 << " m\n";
|
||||
SIM_INFO(out.str());
|
||||
}
|
||||
|
||||
return std::shared_ptr<TerminatorWithPlates>(
|
||||
new TerminatorWithPlates(max_interactions, max_time_alive, geometry,
|
||||
zpos1, zpos2, rInner1, rInner2, rOuter1, rOuter2));
|
||||
|
||||
} else {
|
||||
ERROR("Unknown Terminator type");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace generator
|
||||
Reference in New Issue
Block a user