Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
JPScore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JuPedSim
JPScore
Commits
c132e6bd
There was a problem fetching the pipeline summary.
Commit
c132e6bd
authored
Oct 5, 2017
by
Arne Graf
Browse files
Options
Downloads
Patches
Plain Diff
fixed 249 by using correct IsInSubRoom(...)
parent
1d36b4fd
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!10
Develop
Pipeline
#
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
routing/ff_router/UnivFFviaFM.cpp
+4
-1
4 additions, 1 deletion
routing/ff_router/UnivFFviaFM.cpp
routing/ff_router/ffRouter.cpp
+67
-49
67 additions, 49 deletions
routing/ff_router/ffRouter.cpp
with
71 additions
and
50 deletions
routing/ff_router/UnivFFviaFM.cpp
+
4
−
1
View file @
c132e6bd
...
@@ -1358,6 +1358,9 @@ void UnivFFviaFM::writeFF(const std::string& filename, std::vector<int> targetID
...
@@ -1358,6 +1358,9 @@ void UnivFFviaFM::writeFF(const std::string& filename, std::vector<int> targetID
//mode is argument, which should not be needed, the info is stored in members like speedmode, ...
//mode is argument, which should not be needed, the info is stored in members like speedmode, ...
double
UnivFFviaFM
::
getCostToDestination
(
const
int
destID
,
const
Point
&
position
,
int
mode
)
{
double
UnivFFviaFM
::
getCostToDestination
(
const
int
destID
,
const
Point
&
position
,
int
mode
)
{
// if (!_grid->includesPoint(position)) {
// Log->Write("Was ist denn hier los?");
// }
assert
(
_grid
->
includesPoint
(
position
));
assert
(
_grid
->
includesPoint
(
position
));
if
(
_costFieldWithKey
.
count
(
destID
)
==
1
&&
_costFieldWithKey
[
destID
])
{
if
(
_costFieldWithKey
.
count
(
destID
)
==
1
&&
_costFieldWithKey
[
destID
])
{
return
_costFieldWithKey
[
destID
][
_grid
->
getKeyAtPoint
(
position
)];
return
_costFieldWithKey
[
destID
][
_grid
->
getKeyAtPoint
(
position
)];
...
@@ -1370,7 +1373,7 @@ double UnivFFviaFM::getCostToDestination(const int destID, const Point& position
...
@@ -1370,7 +1373,7 @@ double UnivFFviaFM::getCostToDestination(const int destID, const Point& position
}
}
addTarget
(
destID
,
_costFieldWithKey
[
destID
],
_directionFieldWithKey
[
destID
]);
addTarget
(
destID
,
_costFieldWithKey
[
destID
],
_directionFieldWithKey
[
destID
]);
getCostToDestination
(
destID
,
position
,
mode
);
return
getCostToDestination
(
destID
,
position
,
mode
);
}
else
if
(
!
_directCalculation
&&
_doors
.
count
(
destID
)
>
0
)
{
}
else
if
(
!
_directCalculation
&&
_doors
.
count
(
destID
)
>
0
)
{
//omp critical
//omp critical
#pragma omp critical(UnivFFviaFM_toDo)
#pragma omp critical(UnivFFviaFM_toDo)
...
...
This diff is collapsed.
Click to expand it.
routing/ff_router/ffRouter.cpp
+
67
−
49
View file @
c132e6bd
...
@@ -456,59 +456,77 @@ int FFRouter::FindExit(Pedestrian* p)
...
@@ -456,59 +456,77 @@ int FFRouter::FindExit(Pedestrian* p)
if
(
_building
->
GetRoom
(
p
->
GetRoomID
())
->
GetSubRoom
(
p
->
GetSubRoomID
())
->
IsInSubRoom
(
p
->
GetPos
()))
{
if
(
_building
->
GetRoom
(
p
->
GetRoomID
())
->
GetSubRoom
(
p
->
GetSubRoomID
())
->
IsInSubRoom
(
p
->
GetPos
()))
{
//ped is in the subroom, according to its member attribs
//ped is in the subroom, according to its member attribs
}
else
{
}
else
{
// find next crossing / transition and set new room to the OTHER
bool
located
=
false
;
//candidates of current room (ID) (provided by Room)
SubRoom
*
oldSubRoom
=
_building
->
GetRoom
(
p
->
GetRoomID
())
->
GetSubRoom
(
p
->
GetSubRoomID
());
for
(
auto
transUID
:
_building
->
GetRoom
(
p
->
GetRoomID
())
->
GetAllTransitionsIDs
())
{
for
(
auto
&
room
:
_building
->
GetAllRooms
())
{
if
((
_CroTrByUID
.
count
(
transUID
)
!=
0
)
&&
(
_CroTrByUID
[
transUID
]
->
IsOpen
()))
{
if
(
located
)
{
break
;}
DoorUIDsOfRoom
.
emplace_back
(
transUID
);
for
(
auto
&
subroom
:
room
.
second
->
GetAllSubRooms
())
{
}
if
(
subroom
.
second
->
IsInSubRoom
(
p
->
GetPos
())
&&
subroom
.
second
->
IsDirectlyConnectedWith
(
oldSubRoom
))
{
}
//maybe room on wrong floor
for
(
auto
&
subIPair
:
_building
->
GetRoom
(
p
->
GetRoomID
())
->
GetAllSubRooms
())
{
p
->
SetRoomID
(
room
.
second
->
GetID
(),
room
.
second
->
GetCaption
());
for
(
auto
&
crossI
:
subIPair
.
second
->
GetAllCrossings
())
{
p
->
SetSubRoomID
(
subroom
.
second
->
GetSubRoomID
());
if
(
crossI
->
IsOpen
())
{
p
->
SetSubRoomUID
(
subroom
.
second
->
GetUID
());
DoorUIDsOfRoom
.
emplace_back
(
crossI
->
GetUniqueID
());
located
=
true
;
}
break
;
}
}
}
}
//find closest Door
}
int
UIDofLinePedStandsOn
;
if
(
!
located
)
{
//ped is outside
double
UIDsDistance
=
DBL_MAX
;
return
-
1
;
for
(
auto
dooruid
:
DoorUIDsOfRoom
)
{
}
if
(
UIDsDistance
>
_locffviafm
[
p
->
GetRoomID
()]
->
getCostToDestination
(
dooruid
,
p
->
GetPos
(),
_mode
))
{
// // find next crossing / transition and set new room to the OTHER
UIDofLinePedStandsOn
=
dooruid
;
// //candidates of current room (ID) (provided by Room)
UIDsDistance
=
_locffviafm
[
p
->
GetRoomID
()]
->
getCostToDestination
(
dooruid
,
p
->
GetPos
(),
_mode
);
// for (auto transUID : _building->GetRoom(p->GetRoomID())->GetAllTransitionsIDs()) {
}
// if ((_CroTrByUID.count(transUID) != 0) && (_CroTrByUID[transUID]->IsOpen())) {
}
// DoorUIDsOfRoom.emplace_back(transUID);
// }
//to that doors, find the (room/subroom) tuples of both sides of the door and then choose the one, that is not
// }
//equal to "pedTupel" (which is false information).
// for (auto &subIPair : _building->GetRoom(p->GetRoomID())->GetAllSubRooms()) {
//@todo: @ar.graf: if no second tupel exists, and pedTupel is false, the agent must be outside, right?
// for (auto &crossI : subIPair.second->GetAllCrossings()) {
std
::
pair
<
int
,
int
>
pedTupel
=
std
::
make_pair
(
p
->
GetRoomID
(),
p
->
GetSubRoomID
());
// if (crossI->IsOpen()) {
// DoorUIDsOfRoom.emplace_back(crossI->GetUniqueID());
std
::
pair
<
int
,
int
>
roomNsub1
=
std
::
make_pair
(
// }
_building
->
GetTransOrCrossByUID
(
UIDofLinePedStandsOn
)
->
GetSubRoom1
()
->
GetRoomID
(),
// }
_building
->
GetTransOrCrossByUID
(
UIDofLinePedStandsOn
)
->
GetSubRoom1
()
->
GetSubRoomID
());
// }
std
::
pair
<
int
,
int
>
roomNsub2
;
// //find closest Door
if
(
_building
->
GetTransOrCrossByUID
(
UIDofLinePedStandsOn
)
->
GetSubRoom2
())
{
// int UIDofLinePedStandsOn;
roomNsub2
=
std
::
make_pair
(
// double UIDsDistance = DBL_MAX;
_building
->
GetTransOrCrossByUID
(
UIDofLinePedStandsOn
)
->
GetSubRoom2
()
->
GetRoomID
(),
// for (auto dooruid : DoorUIDsOfRoom) {
_building
->
GetTransOrCrossByUID
(
UIDofLinePedStandsOn
)
->
GetSubRoom2
()
->
GetSubRoomID
());
// if (UIDsDistance > _locffviafm[p->GetRoomID()]->getCostToDestination(dooruid, p->GetPos(), _mode)) {
}
else
{
// if no second exists, then door leads to outside and nothing should change, which we do by roomNsub1 == roomNsub2
// UIDofLinePedStandsOn = dooruid;
roomNsub2
=
std
::
make_pair
(
// UIDsDistance = _locffviafm[p->GetRoomID()]->getCostToDestination(dooruid, p->GetPos(), _mode);
_building
->
GetTransOrCrossByUID
(
UIDofLinePedStandsOn
)
->
GetSubRoom1
()
->
GetRoomID
(),
// }
_building
->
GetTransOrCrossByUID
(
UIDofLinePedStandsOn
)
->
GetSubRoom1
()
->
GetSubRoomID
());
// }
}
//
if
(
pedTupel
==
roomNsub1
)
{
// //to that doors, find the (room/subroom) tuples of both sides of the door and then choose the one, that is not
p
->
SetRoomID
(
roomNsub2
.
first
,
_building
->
GetRoom
(
roomNsub2
.
first
)
->
GetCaption
());
// //equal to "pedTupel" (which is false information).
p
->
SetSubRoomID
(
roomNsub2
.
second
);
// //@todo: @ar.graf: if no second tupel exists, and pedTupel is false, the agent must be outside, right?
p
->
SetSubRoomUID
(
_building
->
GetRoom
(
roomNsub2
.
first
)
->
GetSubRoom
(
roomNsub2
.
second
)
->
GetUID
());
// std::pair<int, int> pedTupel = std::make_pair(p->GetRoomID(), p->GetSubRoomID());
}
else
{
//
p
->
SetRoomID
(
roomNsub1
.
first
,
_building
->
GetRoom
(
roomNsub1
.
first
)
->
GetCaption
());
// std::pair<int, int> roomNsub1 = std::make_pair(
p
->
SetSubRoomID
(
roomNsub1
.
second
);
// _building->GetTransOrCrossByUID(UIDofLinePedStandsOn)->GetSubRoom1()->GetRoomID(),
p
->
SetSubRoomUID
(
_building
->
GetRoom
(
roomNsub1
.
first
)
->
GetSubRoom
(
roomNsub1
.
second
)
->
GetUID
());
// _building->GetTransOrCrossByUID(UIDofLinePedStandsOn)->GetSubRoom1()->GetSubRoomID());
}
// std::pair<int, int> roomNsub2;
// if (_building->GetTransOrCrossByUID(UIDofLinePedStandsOn)->GetSubRoom2()) {
//Log->Write("ERROR: \tffRouter cannot handle incorrect room/subroom attribs of pedestrian %d!!", p->GetID());
// roomNsub2 = std::make_pair(
// _building->GetTransOrCrossByUID(UIDofLinePedStandsOn)->GetSubRoom2()->GetRoomID(),
// _building->GetTransOrCrossByUID(UIDofLinePedStandsOn)->GetSubRoom2()->GetSubRoomID());
// } else { // if no second exists, then door leads to outside and nothing should change, which we do by roomNsub1 == roomNsub2
// roomNsub2 = std::make_pair(
// _building->GetTransOrCrossByUID(UIDofLinePedStandsOn)->GetSubRoom1()->GetRoomID(),
// _building->GetTransOrCrossByUID(UIDofLinePedStandsOn)->GetSubRoom1()->GetSubRoomID());
// }
// if (pedTupel == roomNsub1) {
// p->SetRoomID(roomNsub2.first, _building->GetRoom(roomNsub2.first)->GetCaption());
// p->SetSubRoomID(roomNsub2.second);
// p->SetSubRoomUID(_building->GetRoom(roomNsub2.first)->GetSubRoom(roomNsub2.second)->GetUID());
// } else {
// p->SetRoomID(roomNsub1.first, _building->GetRoom(roomNsub1.first)->GetCaption());
// p->SetSubRoomID(roomNsub1.second);
// p->SetSubRoomUID(_building->GetRoom(roomNsub1.first)->GetSubRoom(roomNsub1.second)->GetUID());
// }
//
// //Log->Write("ERROR: \tffRouter cannot handle incorrect room/subroom attribs of pedestrian %d!!", p->GetID());
}
}
DoorUIDsOfRoom
.
clear
();
DoorUIDsOfRoom
.
clear
();
if
(
!
_targetWithinSubroom
)
{
if
(
!
_targetWithinSubroom
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment