Commit 60b744d8 authored by Arne Graf's avatar Arne Graf

merge ff_to_vtk into dev

parents 13f0a3ea b0c6c61b
Pipeline #9259 failed with stages
in 6 minutes and 50 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());
......
......@@ -119,6 +119,7 @@ public:
_has_specific_goals = false;
_write_VTK_files = false;
_exit_strat = 9;
_write_VTK_files_direction = false;
//for random numbers
_rdGenerator=RandomNumberGenerator();
......@@ -279,6 +280,10 @@ public:
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;}
void SetHostname(std::string hostname) { _hostname = hostname; };
const std::string& GetTrajectoriesFile() const { return _trajectoriesFile; };
......@@ -387,6 +392,7 @@ private:
//ff router
bool _has_specific_goals;
bool _write_VTK_files;
bool _write_VTK_files_direction;
int _exit_strat;
......
......@@ -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()));
......
......@@ -1527,7 +1527,7 @@ void UnivFFviaFM::writeFF(const std::string& filename, std::vector<int> targetID
int numTotal = numX * numY;
//std::cerr << numTotal << " numTotal" << std::endl;
//std::cerr << grid->GetnPoints() << " grid" << std::endl;
file.open(filename);
file.open(_configuration->GetProjectRootDir()+filename);
file << "# vtk DataFile Version 3.0" << std::endl;
file << "Testdata: Fast Marching: Test: " << std::endl;
......
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