Commit 471476f1 authored by Mohcine Chraibi's avatar Mohcine Chraibi

cleanup some unused includes

parent 3a883162
......@@ -29,7 +29,7 @@
#include "../pedestrian/Pedestrian.h"
#include "../routing/DirectionStrategy.h"
//#include "../routing/DirectionStrategy.h"
#include "../mpi/LCGrid.h"
#include "../geometry/Wall.h"
#include "../geometry/SubRoom.h"
......@@ -233,7 +233,7 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building*
std::sort(spacings.begin(), spacings.end(), sort_pred());
double spacing = spacings[0].first;
//double winkel = spacings[0].second;
Point tmp;
//Point tmp;
Point speed = direction.Normalized() *OptimalSpeed(ped, spacing);
result_acc.push_back(speed);
spacings.clear(); //clear for ped p
......
/**
* \file VelocityModel.h
* \date Apr 15, 2014
* \version v0.7
* \version v0.8
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
......@@ -72,7 +72,7 @@ private:
*
* @param ped: Pointer to Pedestrians
* @param spacing: minimum spacing to the neighbors
* @param winkel: angle between <ped> and the nearest neighbor
* @param winkel: angle between <ped> and the nearest neighbor. Is not yet used!
*
* @return double
*/
......@@ -142,6 +142,7 @@ public:
*
* @return double
*/
/**
double GetaPed() const;
/**
......@@ -182,6 +183,7 @@ public:
* @param current the actual time
* @param deltaT the next timestep
* @param building the geometry object
* @param periodic: used in some utests for periodic scenarios (very specific)
*/
virtual void ComputeNextTimeStep(double current, double deltaT, Building* building, int periodic);
};
......
......@@ -29,16 +29,16 @@
#include "../geometry/Line.h"
#include "../geometry/NavLine.h"
#include "../geometry/Building.h"
#include "../geometry/Room.h"
//#include "../geometry/Room.h"
#include "../pedestrian/Pedestrian.h"
#include "../geometry/SubRoom.h"
#include "../geometry/Wall.h"
//#include "../geometry/Wall.h"
#include "../routing/FloorfieldViaFM.h"
#include "../routing/LocalFloorfieldViaFM.h"
#include "DirectionStrategy.h"
#include <fstream>
#include <chrono>
#include <ctime>
//#include "DirectionStrategy.h"
//#include <fstream>
//#include <chrono>
//#include <ctime>
#define UNUSED(x) [&x]{}() // c++11 silence warnings
......@@ -454,8 +454,8 @@ Point DirectionLocalFloorfield::GetTarget(Room* room, Pedestrian* ped) const
#endif // DEBUG
//this should not execute:
std::cerr << "Failure in DirectionFloorfield::GetTarget!!" << std::endl;
exit(EXIT_FAILURE);
//std::cerr << "Failure in DirectionFloorfield::GetTarget!!" << std::endl;
// exit(EXIT_FAILURE);
}
Point DirectionLocalFloorfield::GetDir2Wall(Pedestrian* ped) const
......@@ -592,8 +592,8 @@ Point DirectionSubLocalFloorfield::GetTarget(Room* room, Pedestrian* ped) const
#endif // DEBUG
//this should not execute:
std::cerr << "Failure in DirectionFloorfield::GetTarget!!" << std::endl;
exit(EXIT_FAILURE);
//std::cerr << "Failure in DirectionFloorfield::GetTarget!!" << std::endl;
//exit(EXIT_FAILURE);
}
Point DirectionSubLocalFloorfield::GetDir2Wall(Pedestrian* ped) const
......
......@@ -28,12 +28,12 @@
#define TESTING
#define GEO_UP_SCALE 1
#include "FloorfieldViaFM.h"
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <cfloat>
#include <chrono>
//#include <iostream>
//#include <string>
//#include <sstream>
//#include <fstream>
//#include <cfloat>
//#include <chrono>
#ifdef _OPENMP
#include <omp.h>
......@@ -530,10 +530,10 @@ double FloorfieldViaFM::getDistance2WallAt(const Point& position) {
}
}
int FloorfieldViaFM::getSubroomUIDAt(const Point &position) {
long int key = grid->getKeyAtPoint(position);
return subroomUID[key];
}
//int FloorfieldViaFM::getSubroomUIDAt(const Point &position) {
// long int key = grid->getKeyAtPoint(position);
// return subroomUID[key];
//}
/*!
* \brief Parsing geo-info but conflicts in multi-floor-buildings OBSOLETE
......@@ -576,7 +576,7 @@ void FloorfieldViaFM::parseBuilding(const Building* const buildingArg, const dou
costmap.emplace(trans.second->GetUniqueID(), nullptr);
neggradmap.emplace(trans.second->GetUniqueID(), nullptr);
}
numOfExits = exitsFromScope.size();
numOfExits = (unsigned int) exitsFromScope.size();
for (auto& trans : allTransitions) {
if (!trans.second->IsOpen()) {
wall.emplace_back(Line ( (Line) *(trans.second)));
......@@ -759,7 +759,7 @@ void FloorfieldViaFM::parseBuildingForExits(const Building* const buildingArg, c
costmap.emplace(trans.second->GetUniqueID(), nullptr);
neggradmap.emplace(trans.second->GetUniqueID(), nullptr);
}
numOfExits = exitsFromScope.size();
numOfExits = (unsigned int) exitsFromScope.size();
for (auto& trans : allTransitions) {
if (!trans.second->IsOpen()) {
wall.emplace_back(Line ( (Line) *(trans.second)));
......@@ -938,20 +938,20 @@ void FloorfieldViaFM::prepareForDistanceFieldCalculation(const bool onlyRoomsWit
}
void FloorfieldViaFM::clearAndPrepareForFloorfieldReCalc(double* costarray) {
for (long int i = 0; i < grid->GetnPoints(); ++i) {
if ((gcode[i] == WALL) || (gcode[i] == OUTSIDE) || (gcode[i] == CLOSED_TRANSITION) || (gcode[i] == CLOSED_CROSSING)){ //wall or blocker
costarray[i] = -7.; //this is done in calculateFloorfield again
} else { //inside
costarray[i] = -2.;
}
}
}
//void FloorfieldViaFM::clearAndPrepareForFloorfieldReCalc(double* costarray) {
// for (long int i = 0; i < grid->GetnPoints(); ++i) {
// if ((gcode[i] == WALL) || (gcode[i] == OUTSIDE) || (gcode[i] == CLOSED_TRANSITION) || (gcode[i] == CLOSED_CROSSING)){ //wall or blocker
// costarray[i] = -7.; //this is done in calculateFloorfield again
// } else { //inside
// costarray[i] = -2.;
// }
// }
//}
void FloorfieldViaFM::setNewGoalAfterTheClear(double* costarray, std::vector<Line>& LineArg) {
drawLinesOnGrid(LineArg, costarray, 0.);
//std::cerr << LineArg[0].GetUniqueID() << " " << LineArg[0].GetPoint1()._x << " " << LineArg[0].GetPoint1()._y << " " << LineArg[0].GetPoint2()._x << " " << LineArg[0].GetPoint2()._y << std::endl;
}
//void FloorfieldViaFM::setNewGoalAfterTheClear(double* costarray, std::vector<Line>& LineArg) {
// drawLinesOnGrid(LineArg, costarray, 0.);
// //std::cerr << LineArg[0].GetUniqueID() << " " << LineArg[0].GetPoint1()._x << " " << LineArg[0].GetPoint1()._y << " " << LineArg[0].GetPoint2()._x << " " << LineArg[0].GetPoint2()._y << std::endl;
//}
/*!
* \brief [brief description]
......@@ -987,12 +987,12 @@ void FloorfieldViaFM::drawLinesOnGrid(std::vector<Line>& wallArg, double* const
for (auto& line : wallArg) {
key = grid->getKeyAtPoint(line.GetPoint1());
iStart = grid->get_i_fromKey(key);
jStart = grid->get_j_fromKey(key);
iStart = (long) grid->get_i_fromKey(key);
jStart = (long) grid->get_j_fromKey(key);
key = grid->getKeyAtPoint(line.GetPoint2());
iEnd = grid->get_i_fromKey(key);
jEnd = grid->get_j_fromKey(key);
iEnd = (long) grid->get_i_fromKey(key);
jEnd = (long) grid->get_j_fromKey(key);
deltaX = (int) (iEnd - iStart);
deltaY = (int) (jEnd - jStart);
......@@ -1087,12 +1087,12 @@ void FloorfieldViaFM::drawLinesOnGrid(std::vector<Line>& wallArg, int* const tar
for (auto& line : wallArg) {
key = grid->getKeyAtPoint(line.GetPoint1());
iStart = grid->get_i_fromKey(key);
jStart = grid->get_j_fromKey(key);
iStart = (long) grid->get_i_fromKey(key);
jStart = (long) grid->get_j_fromKey(key);
key = grid->getKeyAtPoint(line.GetPoint2());
iEnd = grid->get_i_fromKey(key);
jEnd = grid->get_j_fromKey(key);
iEnd = (long) grid->get_i_fromKey(key);
jEnd = (long) grid->get_j_fromKey(key);
deltaX = (int) (iEnd - iStart);
deltaY = (int) (jEnd - jStart);
......@@ -1376,7 +1376,7 @@ void FloorfieldViaFM::calcDist2Wall(Trial* trialfield, int* flag, const long int
row = 100000.;
col = 100000.;
aux = -1;
//aux = -1;
directNeighbor dNeigh = grid->getNeighbors(key);
......@@ -1491,7 +1491,7 @@ void FloorfieldViaFM::calcFloorfield(Trial* trialfield, int* flag, const long in
row = DBL_MAX;
col = DBL_MAX;
aux = -1;
//aux = -1;
directNeighbor dNeigh = grid->getNeighbors(key);
......
This diff is collapsed.
......@@ -75,7 +75,7 @@ void LocalFloorfieldViaFM::parseRoom(const Room* const roomArg,
}
}
}
numOfExits = exitsFromScope.size();
numOfExits = (unsigned int) exitsFromScope.size();
//put closed doors next, they are considered as walls later (index >= numOfExits)
for (auto& trans : allTransitions) {
if (!trans.second->IsOpen()) {
......@@ -187,12 +187,12 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
for(auto& line : wall) {
key = grid->getKeyAtPoint(line.GetPoint1());
iStart = grid->get_i_fromKey(key);
jStart = grid->get_j_fromKey(key);
iStart = (long) grid->get_i_fromKey(key);
jStart = (long) grid->get_j_fromKey(key);
key = grid->getKeyAtPoint(line.GetPoint2());
iEnd = grid->get_i_fromKey(key);
jEnd = grid->get_j_fromKey(key);
iEnd = (long) grid->get_i_fromKey(key);
jEnd = (long) grid->get_j_fromKey(key);
deltaX = (int) (iEnd - iStart);
deltaY = (int) (jEnd - jStart);
......@@ -257,12 +257,12 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
for(auto& line : exitsFromScope) {
key = grid->getKeyAtPoint(line.GetPoint1());
iStart = grid->get_i_fromKey(key);
jStart = grid->get_j_fromKey(key);
iStart = (long) grid->get_i_fromKey(key);
jStart = (long) grid->get_j_fromKey(key);
key = grid->getKeyAtPoint(line.GetPoint2());
iEnd = grid->get_i_fromKey(key);
jEnd = grid->get_j_fromKey(key);
iEnd = (long) grid->get_i_fromKey(key);
jEnd = (long) grid->get_j_fromKey(key);
deltaX = (int) (iEnd - iStart);
deltaY = (int) (jEnd - jStart);
......
......@@ -582,7 +582,7 @@ vector<MeshEdge*> MeshRouter::AStar(Pedestrian* p,int& status)const
for(unsigned int i=0; i<act_cell->GetEdges().size(); i++) {
int act_edge_id=act_cell->GetEdges().at(i);
MeshEdge* act_edge=_meshdata->GetEdges().at(act_edge_id);
MeshEdge* act_edge=_meshdata->GetEdges().at((unsigned long) act_edge_id);
int nb_id=-1;
// Find neighbouring cell
......@@ -595,8 +595,8 @@ vector<MeshEdge*> MeshRouter::AStar(Pedestrian* p,int& status)const
}
int n1_pos=act_edge->GetNode1();
int n2_pos=act_edge->GetNode2();
Point p1_p=*_meshdata->GetNodes().at(n1_pos);
Point p2_p=*_meshdata->GetNodes().at(n2_pos);
Point p1_p=*_meshdata->GetNodes().at((unsigned long) n1_pos);
Point p2_p=*_meshdata->GetNodes().at((unsigned long) n2_pos);
double length=(p1_p-p2_p).Norm();
MeshCell* nb_cell=_meshdata->GetCellAtPos(nb_id);
// Calculate
......
This diff is collapsed.
......@@ -30,7 +30,7 @@
#include "../tinyxml/tinyxml.h"
#include "../mpi/LCGrid.h"
#include "../geometry/SubRoom.h"
#include "../IO/OutputHandler.h"
//#include "../IO/OutputHandler.h"
using namespace std;
......@@ -45,10 +45,10 @@ bool QuickestPathRouter::Init(Building* building)
// prefer path through corridors to path through rooms
SetEdgeCost(2.0);
if (GlobalRouter::Init(building) == false)
if (!GlobalRouter::Init(building))
return false;
if (ParseAdditionalParameters() == false)
if (!ParseAdditionalParameters())
return false;
// activate the spotlight for tracking some pedestrians
......@@ -132,8 +132,8 @@ int QuickestPathRouter::FindNextExit(Pedestrian* ped)
else
{
//check that the next destination is in the actual room of the pedestrian
if (_accessPoints[nextDestination]->isInRange(
sub->GetUID())==false)
if (!_accessPoints[nextDestination]->isInRange(
sub->GetUID()))
{
//return the last destination if defined
int previousDestination = ped->GetNextDestination();
......@@ -316,7 +316,7 @@ bool QuickestPathRouter::SelectReferencePedestrian(Pedestrian* myself, Pedestria
}
}
} while (done==false);
} while (!done);
//debug area
......@@ -420,11 +420,7 @@ bool QuickestPathRouter::IsDirectVisibilityBetween(Pedestrian* ped, Pedestrian*
unsigned int obstacles = GetObstaclesCountBetween(ped->GetPos(), ref->GetPos(),
ignore_hline, ignore_ped1, ignore_ped2);
if (obstacles > _visibilityObstruction)
{
return false;
}
return true;
return _visibilityObstruction<obstacles ? false : true;
}
bool QuickestPathRouter::IsDirectVisibilityBetween(Pedestrian* myself, Hline* hline)
......@@ -434,11 +430,7 @@ bool QuickestPathRouter::IsDirectVisibilityBetween(Pedestrian* myself, Hline* hl
unsigned int obstacles = GetObstaclesCountBetween(myself->GetPos(),
hline->GetCentre(), hline, ignore_ped1, ignore_ped2);
if (obstacles > _visibilityObstruction)
{
return false;
}
return true;
return obstacles > _visibilityObstruction ? false : true;
}
unsigned int QuickestPathRouter::GetObstaclesCountBetween(const Point& p1, const Point& p2, Hline* hline,
......@@ -544,10 +536,8 @@ int QuickestPathRouter::isCongested(Pedestrian* ped)
double ratio = inFrontofMe / (inFrontofMe + behindMe);
// the threshold is defined by the middle of the queue
if (ratio > 0.5)
return true;
return ratio > 0.5 ? true : false;
return false;
}
double QuickestPathRouter::GetEstimatedTravelTimeVia(Pedestrian* ped, int exitid)
......@@ -666,13 +656,13 @@ void QuickestPathRouter::Redirect(Pedestrian* ped)
for(const auto& wall: sub->GetAllWalls())
{
if(segment.IntersectionWith(wall)==true)
if(segment.IntersectionWith(wall))
{
isVisible=false;
break;
}
}
if(isVisible==false) continue;
if(!isVisible) continue;
double time=GetEstimatedTravelTimeVia(ped, exitid);
......@@ -743,7 +733,7 @@ int QuickestPathRouter::GetBestDefaultRandomExit(Pedestrian* ped)
AccessPoint* ap=relevantAPs[g];
if (ap->isInRange(sub->GetUID()) == false)
if (!ap->isInRange(sub->GetUID()))
continue;
//check if that exit is open.
if (ap->IsClosed())
......@@ -862,7 +852,7 @@ bool QuickestPathRouter::ParseAdditionalParameters()
if (!doc.LoadFile()) {
Log->Write("ERROR: \t%s", doc.ErrorDesc());
Log->Write("ERROR: \t GlobalRouter: could not parse the project file");
return "";
return false;
}
// everything is fine. proceed with parsing
......
......@@ -33,13 +33,13 @@
#include "../geometry/SubRoom.h"
#include <iostream>
#include <sstream>
#include <fstream>
#include <map>
//#include <iostream>
//#include <sstream>
//#include <fstream>
//#include <map>
#include "../pedestrian/Pedestrian.h"
//#include "../pedestrian/Pedestrian.h"
#define UPDATE_FREQUENCY 1 // in seconds
......
......@@ -157,31 +157,31 @@ void CognitiveMap::AddWaypoints(Waypoints waypoints)
}
void CognitiveMap::AssessDoors()
{
SubRoom * sub_room = _building->GetRoom(_ped->GetRoomID())->GetSubRoom(_ped->GetSubRoomID());
GraphVertex * vertex = (*_network->GetNavigationGraph())[sub_room];
const GraphVertex::EdgesContainer edges = *(vertex->GetAllEdges());
//const Point rpWaypoint=_waypContainer[0]->GetPos();
if (!_waypContainer.empty())
{
std::vector<GraphEdge* > sortedEdges = SortConShortestPath(_waypContainerSorted.top(),edges);
//Log->Write(std::to_string(nextDoor->GetCrossing()->GetID()));
for (unsigned int i=0; i<sortedEdges.size(); ++i)
{
sortedEdges[i]->SetFactor(0.5+0.1*i,"SpatialKnowledge");
//Log->Write("INFO:\t "+std::to_string(sortedEdges[i]->GetCrossing()->GetID()));
//Log->Write("INFO:\t "+std::to_string(sortedEdges[i]->GetFactor()));
}
//Log->Write(std::to_string(nextDoor->GetCrossing()->GetID()));
//Log->Write("INFO: Door assessed!");
}
}
//void CognitiveMap::AssessDoors()
//{
// SubRoom * sub_room = _building->GetRoom(_ped->GetRoomID())->GetSubRoom(_ped->GetSubRoomID());
// GraphVertex * vertex = (*_network->GetNavigationGraph())[sub_room];
// const GraphVertex::EdgesContainer edges = *(vertex->GetAllEdges());
//
// //const Point rpWaypoint=_waypContainer[0]->GetPos();
//
// if (!_waypContainer.empty())
// {
// std::vector<GraphEdge* > sortedEdges = SortConShortestPath(_waypContainerSorted.top(),edges);
// //Log->Write(std::to_string(nextDoor->GetCrossing()->GetID()));
//
// for (unsigned int i=0; i<sortedEdges.size(); ++i)
// {
// sortedEdges[i]->SetFactor(0.5+0.1*i,"SpatialKnowledge");
// //Log->Write("INFO:\t "+std::to_string(sortedEdges[i]->GetCrossing()->GetID()));
// //Log->Write("INFO:\t "+std::to_string(sortedEdges[i]->GetFactor()));
// }
//
// //Log->Write(std::to_string(nextDoor->GetCrossing()->GetID()));
// //Log->Write("INFO: Door assessed!");
// }
//
//}
std::vector<GraphEdge *> CognitiveMap::SortConShortestPath(ptrWaypoint waypoint, const GraphVertex::EdgesContainer edges)
{
......@@ -299,10 +299,10 @@ double CognitiveMap::ShortestPathDistance(const GraphEdge* edge, const ptrWaypoi
return polyline.length();
}
const Point &CognitiveMap::GetOwnPos()
{
return _YAHPointer.GetPos();
}
//const Point &CognitiveMap::GetOwnPos()
//{
// return _YAHPointer.GetPos();
//}
void CognitiveMap::WriteToFile()
{
......
......@@ -107,11 +107,12 @@ void FireMeshStorage::CreateFireMeshes()
const FireMesh &FireMeshStorage::get_FireMesh(const Point &doorCentre, const double &simTime) const
{
int simT=simTime/_updateIntervall;
int simT;
simT = (int) (simTime/_updateIntervall);
simT*=_updateIntervall;
if (simT>=_finalTime)
simT=_finalTime;
simT= (int) _finalTime;
std::string str = "Door_X_"+ std::to_string(doorCentre._x)
+ "_Y_" + std::to_string(doorCentre._y) + "_t_"+std::to_string(simT)+".000000";
......
......@@ -28,18 +28,18 @@
#include "GraphVertex.h"
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <functional>
//#include <utility>
//#include <cmath>
//#include <set>
//#include <map>
//#include <queue>
//#include <functional>
#include "GraphEdge.h"
#include "../../../geometry/SubRoom.h"
#include "../NavigationGraph.h"
#include "../../../geometry/Transition.h"
#include <algorithm>
//#include <algorithm>
#define UNUSED(x) [&x]{}() // c++11 silence warnings
using namespace std;
......@@ -98,26 +98,26 @@ GraphEdge * GraphVertex::operator[](const Crossing * crossing)
}
int GraphVertex::RemoveOutEdge(GraphEdge * edge)
{
EdgesContainer::iterator it = out_edges.find(edge);
if(it != out_edges.end()) {
delete (*it);
out_edges.erase(it);
return 1;
}
return 0;
}
//int GraphVertex::RemoveOutEdge(GraphEdge * edge)
//{
// EdgesContainer::iterator it = out_edges.find(edge);
// if(it != out_edges.end()) {
// delete (*it);
// out_edges.erase(it);
// return 1;
// }
// return 0;
//}
//@todo: remove this function with obvious return?
int GraphVertex::RemoveOutEdge(const GraphVertex * dest)
{
UNUSED(dest);
//return out_edges.erase(dest);
return 1;
}
//int GraphVertex::RemoveOutEdge(const GraphVertex * dest)
//{
// UNUSED(dest);
// //return out_edges.erase(dest);
// return 1;
//
//}
const std::string GraphVertex::GetCaption() const
{
......
......@@ -33,8 +33,8 @@
#include "../../../geometry/Building.h"
#include "../cognitiveMap/cognitivemap.h"
#include "../../../pedestrian/Pedestrian.h"
#include <vector>
#include <set>
//#include <vector>
//#include <set>
#define UNUSED(x) [&x]{}() // c++11 silence warnings
LastDestinationsSensor::~LastDestinationsSensor()
......
......@@ -48,9 +48,9 @@
#include <cfloat>
#include <algorithm>
#include "ffRouter.h"
#include "../geometry/Building.h"
#include "../pedestrian/Pedestrian.h"
#include "../IO/OutputHandler.h"
//#include "../geometry/Building.h"
//#include "../pedestrian/Pedestrian.h"
//#include "../IO/OutputHandler.h"
FFRouter::FFRouter()
{
......
......@@ -25,20 +25,20 @@ License along with VisiLibity. If not, see <http://www.gnu.org/licenses/>.
#include "visilibity.hpp" //VisiLibity header
#include <cmath> //math functions in std namespace
#include <vector>
#include <queue> //queue and priority_queue
#include <set> //priority queues with iteration,
//#include <cmath> //math functions in std namespace
//#include <vector>
//#include <queue> //queue and priority_queue
//#include <set> //priority queues with iteration,
//integrated keys
#include <list>
#include <algorithm> //sorting, min, max, reverse
#include <cstdlib> //rand and srand
#include <ctime> //Unix time
#include <fstream> //file I/O
#include <iostream>
#include <cstring> //gives C-string manipulation
#include <string> //string class
#include <cassert> //assertions
//#include <list>
//#include <algorithm> //sorting, min, max, reverse
//#include <cstdlib> //rand and srand