Commit c7508e0e authored by tobias schroedter's avatar tobias schroedter

Added vtk output in intialization of the Direction Strategy, when needed

by user
parent cbd4d661
Pipeline #8721 failed with stages
in 14 seconds
......@@ -1414,7 +1414,8 @@ bool IniFileParser::ParseNodeToSolver(const TiXmlNode& solverNode)
bool IniFileParser::ParseStrategyNodeToObject(const TiXmlNode& strategyNode)
{
string query = "exit_crossing_strategy";
string query = "exit_crossing_strategy";
if (!strategyNode.FirstChild(query.c_str())) {
query = "exitCrossingStrategy";
Log->Write(
......@@ -1461,6 +1462,18 @@ bool IniFileParser::ParseStrategyNodeToObject(const TiXmlNode& strategyNode)
}
_exit_strat_number = pExitStrategy;
if (pExitStrategy == 8 || pExitStrategy ==9){
_config->set_write_VTK_files_direction(false);
if (strategyNode.FirstChild("write_VTK_files")) {
const char* tmp =
strategyNode.FirstChild("write_VTK_files")->FirstChild()->Value();
//remark: std::strcmp returns 0 if the strings are equal
bool tmp_write_VTK = !std::strcmp(tmp, "true");
_config->set_write_VTK_files_direction(tmp_write_VTK);
}
}
switch (pExitStrategy) {
case 1:
_exit_strategy = std::shared_ptr<DirectionStrategy>(new DirectionMiddlePoint());
......
......@@ -118,6 +118,7 @@ public:
//ff router
_has_specific_goals = false;
_write_VTK_files = false;
_write_VTK_files_direction = false;
//for random numbers
_rdGenerator=RandomNumberGenerator();
......@@ -272,7 +273,11 @@ public:
bool get_write_VTK_files() const {return _write_VTK_files;}
const std::string& GetHostname() const { return _hostname; };
void set_write_VTK_files_direction(bool write_VTK_files_direction) {_write_VTK_files_direction = write_VTK_files_direction;}
bool get_write_VTK_files_direction() const {return _write_VTK_files_direction;}
const std::string& GetHostname() const { return _hostname; };
void SetHostname(std::string hostname) { _hostname = hostname; };
......@@ -382,6 +387,7 @@ private:
//ff router
bool _has_specific_goals;
bool _write_VTK_files;
bool _write_VTK_files_direction;
std::string _hostname;
std::string _trajectoriesFile;
......
......@@ -404,9 +404,20 @@ void DirectionLocalFloorfield::Init(Building* buildingArg, double stepsize,
newfield->setSpeedMode(FF_HOMO_SPEED);
}
newfield->addAllTargetsParallel();
//newfield->writeFF("directionsOfRoom" + std::to_string(roomPair.first) + ".vtk", newfield->getKnownDoorUIDs());
}
end = std::chrono::system_clock::now();
if (_building->GetConfig()->get_write_VTK_files_direction()) {
for (unsigned int i = 0; i < _locffviafm.size(); ++i) {
auto iter = _locffviafm.begin();
std::advance(iter, i);
int roomNr = iter->first;
iter->second->writeFF("direction" + std::to_string(roomNr) + ".vtk", iter->second->getKnownDoorUIDs());
}
}
end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end-start;
Log->Write("INFO: \tTime to construct FF in DirectionLocalFloorfield: " + std::to_string(elapsed_seconds.count()));
_initDone = true;
......@@ -491,9 +502,21 @@ void DirectionSubLocalFloorfield::Init(Building* buildingArg, double stepsize,
}
floorfield->addAllTargetsParallel();
}
}
end = std::chrono::system_clock::now();
if (_building->GetConfig()->get_write_VTK_files_direction()) {
for (unsigned int i = 0; i < _locffviafm.size(); ++i) {
auto iter = _locffviafm.begin();
std::advance(iter, i);
int roomNr = iter->first;
iter->second->writeFF("direction" + std::to_string(roomNr) + ".vtk", iter->second->getKnownDoorUIDs());
}
}
end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end-start;
Log->Write("INFO: \tTaken time: " + std::to_string(elapsed_seconds.count()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment