Commit e7b78dd7 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Add destructor to class PedDistributor

parent da927a2e
...@@ -28,6 +28,10 @@ PedDistributionParser::PedDistributionParser(const Configuration* configuration) ...@@ -28,6 +28,10 @@ PedDistributionParser::PedDistributionParser(const Configuration* configuration)
} }
PedDistributionParser::~PedDistributionParser() {
// delete _configuration;
}
bool PedDistributionParser::LoadPedDistribution(vector<std::shared_ptr<StartDistribution> >& startDis, bool PedDistributionParser::LoadPedDistribution(vector<std::shared_ptr<StartDistribution> >& startDis,
vector<std::shared_ptr<StartDistribution> >& startDisSub, vector<std::shared_ptr<StartDistribution> >& startDisSub,
std::vector<std::shared_ptr<AgentsSource> >& startDisSources) std::vector<std::shared_ptr<AgentsSource> >& startDisSources)
......
...@@ -28,10 +28,10 @@ class PedDistributionParser : public PedDistributionLoader { ...@@ -28,10 +28,10 @@ class PedDistributionParser : public PedDistributionLoader {
public: public:
PedDistributionParser(const Configuration* configuration); PedDistributionParser(const Configuration* configuration);
~PedDistributionParser();
virtual bool LoadPedDistribution(std::vector<std::shared_ptr<StartDistribution>>& startDis, virtual bool LoadPedDistribution(std::vector<std::shared_ptr<StartDistribution> >& startDis,
std::vector<std::shared_ptr<StartDistribution>>& startDisSub, std::vector<std::shared_ptr<StartDistribution> >& startDisSub,
std::vector<std::shared_ptr<AgentsSource>>& startDisSources) override; std::vector<std::shared_ptr<AgentsSource> >& startDisSources) override;
private: private:
const Configuration* _configuration; const Configuration* _configuration;
......
...@@ -186,10 +186,10 @@ void AgentsSourcesManager::ComputeBestPositionVoronoi(AgentsSource* src, ...@@ -186,10 +186,10 @@ void AgentsSourcesManager::ComputeBestPositionVoronoi(AgentsSource* src,
for (auto&& ped : peds) for (auto&& ped : peds)
{ {
double dist = (pos - ped->GetPos()).NormSquare(); double distance = (pos - ped->GetPos()).NormSquare();
if (dist < min_dist) if (distance < min_dist)
{ {
min_dist = dist; min_dist = distance;
} }
} }
map_dist_to_position[min_dist] = pos; map_dist_to_position[min_dist] = pos;
......
...@@ -14,6 +14,7 @@ public: ...@@ -14,6 +14,7 @@ public:
virtual bool LoadPedDistribution(std::vector<std::shared_ptr<StartDistribution>> &startDis, virtual bool LoadPedDistribution(std::vector<std::shared_ptr<StartDistribution>> &startDis,
std::vector<std::shared_ptr<StartDistribution>> &startDisSub, std::vector<std::shared_ptr<StartDistribution>> &startDisSub,
std::vector<std::shared_ptr<AgentsSource>> &startDisSources) = 0; std::vector<std::shared_ptr<AgentsSource>> &startDisSources) = 0;
virtual ~PedDistributionLoader() {};
}; };
#endif //JPSCORE_PEDDISTRIBUTIONLOADER_H #endif //JPSCORE_PEDDISTRIBUTIONLOADER_H
......
...@@ -62,7 +62,7 @@ PedDistributor::PedDistributor(const Configuration *configuration) : _configurat ...@@ -62,7 +62,7 @@ PedDistributor::PedDistributor(const Configuration *configuration) : _configurat
} }
parser->LoadPedDistribution(_start_dis,_start_dis_sub,_start_dis_sources); parser->LoadPedDistribution(_start_dis,_start_dis_sub,_start_dis_sources);
delete parser;
} }
...@@ -166,7 +166,7 @@ bool PedDistributor::Distribute(Building *building) const { ...@@ -166,7 +166,7 @@ bool PedDistributor::Distribute(Building *building) const {
// Distributing // Distributing
Log->Write("INFO: \tDistributing %d Agents in Room/Subrom [%d/%d]! Maximum allowed: %d", N, roomID, subroomID, Log->Write("INFO: \tDistributing %d Agents in Room/Subrom [%d/%d]! Maximum allowed: %d", N, roomID, subroomID,
max_pos); max_pos);
DistributeInSubRoom(sr, N, allpos, &pid, dist.get(), building); DistributeInSubRoom(N, allpos, &pid, dist.get(), building);
Log->Write("\t...Done"); Log->Write("\t...Done");
nPeds_is += N; nPeds_is += N;
} }
...@@ -242,7 +242,7 @@ bool PedDistributor::Distribute(Building *building) const { ...@@ -242,7 +242,7 @@ bool PedDistributor::Distribute(Building *building) const {
dist->SetSubroomID(sr->GetSubRoomID()); dist->SetSubroomID(sr->GetSubRoomID());
//dist->SetSubroomUID(sr->GetSubRoomUID()) //dist->SetSubroomUID(sr->GetSubRoomUID())
if (akt_anz[is] > 0) { if (akt_anz[is] > 0) {
DistributeInSubRoom(sr, akt_anz[is], allFreePosInRoom[is], &pid, dist.get(), building); DistributeInSubRoom(akt_anz[is], allFreePosInRoom[is], &pid, dist.get(), building);
} }
} }
nPeds_is += N; nPeds_is += N;
...@@ -483,7 +483,7 @@ vector<Point> PedDistributor::PossiblePositions(const SubRoom &r) { ...@@ -483,7 +483,7 @@ vector<Point> PedDistributor::PossiblePositions(const SubRoom &r) {
* nächsten Aufruf) * nächsten Aufruf)
* - routing: wird benötigt um die Zielline der Fußgänger zu initialisieren * - routing: wird benötigt um die Zielline der Fußgänger zu initialisieren
* */ * */
void PedDistributor::DistributeInSubRoom(SubRoom *r, int nAgents, vector<Point> &positions, int *pid, void PedDistributor::DistributeInSubRoom(int nAgents, vector<Point> &positions, int *pid,
StartDistribution *para, Building *building) const { StartDistribution *para, Building *building) const {
// set the pedestrians // set the pedestrians
for (int i = 0; i < nAgents; ++i) { for (int i = 0; i < nAgents; ++i) {
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
/** /**
* Distribute the pedestrians in the Subroom with the given parameters * Distribute the pedestrians in the Subroom with the given parameters
*/ */
void DistributeInSubRoom(SubRoom *r, int N, std::vector<Point> &positions, int *pid, void DistributeInSubRoom(int N, std::vector<Point> &positions, int *pid,
StartDistribution *parameters, Building *building) const; StartDistribution *parameters, Building *building) const;
/** /**
......
...@@ -684,8 +684,8 @@ void DirectionSubLocalFloorfield::Init(Building* buildingArg, double stepsize, ...@@ -684,8 +684,8 @@ void DirectionSubLocalFloorfield::Init(Building* buildingArg, double stepsize,
targets.emplace_back(pair.second); targets.emplace_back(pair.second);
} }
} }
std::string filename = "floorfield" + std::to_string(subroomUID) + ".vtk"; std::string filename1 = "floorfield" + std::to_string(subroomUID) + ".vtk";
locffviafm[subroomUID]->writeFF(filename, targets); locffviafm[subroomUID]->writeFF(filename1, targets);
} }
} }
......
...@@ -2708,8 +2708,7 @@ namespace VisiLibity ...@@ -2708,8 +2708,7 @@ namespace VisiLibity
} }
void Guards::snap_to_boundary_of(const Environment& environment_temp, void Guards::snap_to_boundary_of(const Environment& environment_temp)
double epsilon)
{ {
for(unsigned i=0; i<positions_.size(); i++) for(unsigned i=0; i<positions_.size(); i++)
positions_[i].snap_to_boundary_of(environment_temp); positions_[i].snap_to_boundary_of(environment_temp);
......
...@@ -1781,8 +1781,7 @@ namespace VisiLibity ...@@ -1781,8 +1781,7 @@ namespace VisiLibity
* \remarks O(N*n) time complexity, where N is the guard count and * \remarks O(N*n) time complexity, where N is the guard count and
* n is the number of vertices in \a environment_temp * n is the number of vertices in \a environment_temp
*/ */
void snap_to_boundary_of(const Environment& environment_temp, void snap_to_boundary_of(const Environment& environment_temp);
double epsilon=0.0);
/** \brief relocate each guard to closest Point on boundary if /** \brief relocate each guard to closest Point on boundary if
* within \a epsilon of the boundary (of \a polygon_temp) * within \a epsilon of the boundary (of \a polygon_temp)
* *
......
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