Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JPScore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JuPedSim
JPScore
Commits
487614fb
Verified
Commit
487614fb
authored
May 31, 2019
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First Working train schedule
- Works only for model=3 + ff_quickest + strategy 8 - Later will be extended to other models
parent
f02696b0
Pipeline
#21033
passed with stages
in 9 minutes and 20 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
222 additions
and
150 deletions
+222
-150
IO/GeoFileParser.cpp
IO/GeoFileParser.cpp
+4
-1
Simulation.cpp
Simulation.cpp
+71
-43
Simulation.h
Simulation.h
+1
-1
geometry/Building.cpp
geometry/Building.cpp
+124
-85
geometry/Building.h
geometry/Building.h
+7
-7
routing/DirectionStrategy.cpp
routing/DirectionStrategy.cpp
+14
-12
routing/ff_router/ffRouter.cpp
routing/ff_router/ffRouter.cpp
+1
-1
No files found.
IO/GeoFileParser.cpp
View file @
487614fb
...
...
@@ -470,7 +470,7 @@ bool GeoFileParser::parseDoorNode(TiXmlElement * xDoor, int id, Building* buildi
building
->
GetTransition
(
id
)
->
TempClose
();
break
;
case
DoorState
::
Error
:
Log
->
Write
(
"WARNING:
\t
Unknown door state: <%s>. open
or
close. Default: open"
,
Log
->
Write
(
"WARNING:
\t
Unknown door state: <%s>. open
, close or temp_
close. Default: open"
,
stateStr
.
c_str
());
building
->
GetTransition
(
id
)
->
Open
();
break
;
...
...
@@ -926,6 +926,7 @@ std::shared_ptr<TrainTimeTable> GeoFileParser::parseTrainTimeTableNode(TiXmlElem
float
arrival_time
=
xmltof
(
e
->
Attribute
(
"arrival_time"
),
-
1
);
float
departure_time
=
xmltof
(
e
->
Attribute
(
"departure_time"
),
-
1
);
// @todo: check these values for correctness e.g. arrival < departure
Log
->
Write
(
"INFO:
\t
Train time table:"
);
Log
->
Write
(
"INFO:
\t
id: %d"
,
id
);
Log
->
Write
(
"INFO:
\t
type: %s"
,
type
.
c_str
());
...
...
@@ -953,6 +954,8 @@ std::shared_ptr<TrainTimeTable> GeoFileParser::parseTrainTimeTableNode(TiXmlElem
train_start
,
train_end
,
platform_id
,
false
,
false
,
});
return
trainTimeTab
;
...
...
Simulation.cpp
View file @
487614fb
...
...
@@ -575,19 +575,36 @@ double Simulation::RunBody(double maxSimTime)
//here we could place router-tasks (calc new maps) that can use multiple cores AND we have 't'
//update quickestRouter
if
(
_routingEngine
.
get
()
->
GetRouter
(
ROUTING_FF_QUICKEST
))
{
FFRouter
*
ffrouter
=
dynamic_cast
<
FFRouter
*>
(
_routingEngine
.
get
()
->
GetRouter
(
ROUTING_FF_QUICKEST
));
if
(
geometryChanged
)
{
ffrouter
->
Init
(
_building
.
get
());
std
::
cout
<<
KBLU
<<
" Init router in simulation
\n
"
<<
RESET
;
}
FFRouter
*
ffrouter2
=
dynamic_cast
<
FFRouter
*>
(
_routingEngine
.
get
()
->
GetRouter
(
ROUTING_FF_QUICKEST
));
ffrouter2
->
Init
(
_building
.
get
());
// debug
fs
::
path
f
(
"tmp_"
+
std
::
to_string
(
t
)
+
"_"
+
_config
->
GetGeometryFile
());
std
::
string
filename
=
f
.
string
();
std
::
cout
<<
"
\n
Write geometry --> "
<<
filename
.
c_str
()
<<
"
\n
"
;
_building
->
SaveGeometry
(
filename
);
//
double
_deltaH
=
_building
->
GetConfig
()
->
get_deltaH
();
double
_wallAvoidDistance
=
_building
->
GetConfig
()
->
get_wall_avoid_distance
();
bool
_useWallAvoidance
=
_building
->
GetConfig
()
->
get_use_wall_avoidance
();
if
(
auto
dirlocff
=
dynamic_cast
<
DirectionLocalFloorfield
*>
(
_building
->
GetConfig
()
->
get_dirStrategy
())){
Log
->
Write
(
"INFO:
\t
Init DirectionLOCALFloorfield starting ..."
);
dirlocff
->
Init
(
_building
.
get
(),
_deltaH
,
_wallAvoidDistance
,
_useWallAvoidance
);
Log
->
Write
(
"INFO:
\t
Init DirectionLOCALFloorfield done"
);
}
if
(
ffrouter
->
MustReInit
())
{
ffrouter
->
ReInit
();
ffrouter
->
SetRecalc
(
t
);
std
::
cout
<<
KBLU
<<
" Init router in simulation
\n
"
<<
RESET
;
}
else
{
FFRouter
*
ffrouter
=
dynamic_cast
<
FFRouter
*>
(
_routingEngine
.
get
()
->
GetRouter
(
ROUTING_FF_QUICKEST
));
if
(
ffrouter
->
MustReInit
())
{
ffrouter
->
ReInit
();
ffrouter
->
SetRecalc
(
t
);
}
}
}
// here the used routers are update, when needed due to external changes
...
...
@@ -703,18 +720,24 @@ bool Simulation::WriteTrajectories(std::string trajectoryName)
* add doors
* set _routingEngine->setNeedUpdate(true);
*/
bool
Simulation
::
correctGeometry
(
std
::
shared_ptr
<
Building
>
building
,
std
::
s
tring
trainType
,
Point
TrackStart
,
Point
TrackEnd
)
bool
Simulation
::
correctGeometry
(
std
::
shared_ptr
<
Building
>
building
,
std
::
s
hared_ptr
<
TrainTimeTable
>
tab
)
{
std
::
cout
<<
"enter with train "
<<
trainType
.
c_str
()
<<
"
\n
"
;
std
::
cout
<<
KBLU
<<
"Enter correctGeometry: Building Has "
<<
building
->
GetAllTransitions
().
size
()
<<
" Transitions
\n
"
<<
RESET
;
//auto platforms = building->GetPlatforms();
SubRoom
*
subroom
;
int
room_id
,
subroom_id
;
auto
mytrack
=
building
->
GetTrackWalls
(
TrackStart
,
TrackEnd
,
room_id
,
subroom_id
);
std
::
cout
<<
"room: "
<<
room_id
<<
" subroom_id "
<<
subroom_id
<<
"
\n
"
;
Room
*
room
=
building
->
GetRoom
(
room_id
);
subroom
=
room
->
GetSubRoom
(
subroom_id
);
//todo safety check
int
transition_id
=
10000
;
//auto platforms = building->GetPlatforms();
int
trainId
=
tab
->
id
;
std
::
string
trainType
=
tab
->
type
;
Point
TrackStart
=
tab
->
pstart
;
Point
TrackEnd
=
tab
->
pend
;
SubRoom
*
subroom
;
int
room_id
,
subroom_id
;
auto
mytrack
=
building
->
GetTrackWalls
(
TrackStart
,
TrackEnd
,
room_id
,
subroom_id
);
Room
*
room
=
building
->
GetRoom
(
room_id
);
subroom
=
room
->
GetSubRoom
(
subroom_id
);
//todo safety check
int
transition_id
=
10000
;
std
::
cout
<<
"enter with train "
<<
trainType
.
c_str
()
<<
"
\n
"
;
std
::
cout
<<
KBLU
<<
"Enter correctGeometry: Building Has "
<<
building
->
GetAllTransitions
().
size
()
<<
" Transitions
\n
"
<<
RESET
;
std
::
cout
<<
"room: "
<<
room_id
<<
" subroom_id "
<<
subroom_id
<<
"
\n
"
;
if
(
mytrack
.
empty
()
||
subroom
==
nullptr
)
return
false
;
...
...
@@ -730,7 +753,7 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::string
subroom
->
GetUID
();
auto
walls
=
subroom
->
GetAllWalls
();
// debugging
std
::
cout
<<
"------
\n
"
;
//
std::cout << "------\n";
for
(
auto
pw
:
pws
)
{
auto
pw1
=
pw
.
first
;
...
...
@@ -739,9 +762,9 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::string
auto
w1
=
pw1
.
second
;
auto
p2
=
pw2
.
first
;
auto
w2
=
pw2
.
second
;
std
::
cout
<<
"p1 "
<<
p1
.
toString
()
<<
", wall: "
<<
w1
.
toString
()
<<
"
\n
"
;
std
::
cout
<<
"p2 "
<<
p2
.
toString
()
<<
", wall: "
<<
w2
.
toString
()
<<
"
\n
"
;
std
::
cout
<<
"------
\n
"
;
//
std::cout << "p1 " << p1.toString() << ", wall: " << w1.toString() << "\n";
//
std::cout << "p2 " << p2.toString() << ", wall: " << w2.toString() << "\n";
//
std::cout << "------\n";
// case 1
Point
P
;
if
(
w1
==
w2
)
...
...
@@ -758,10 +781,6 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::string
e
->
SetSubRoom1
(
subroom
);
subroom
->
AddTransition
(
e
);
// danger area
building
->
AddTransition
(
e
);
// danger area
std
::
cout
<<
"added transition
\n
"
;
std
::
cout
<<
"open: "
<<
e
->
IsOpen
()
<<
"
\n
"
;
std
::
cout
<<
"Close: "
<<
e
->
IsClose
()
<<
"
\n
"
;
std
::
cout
<<
"TempClose: "
<<
e
->
IsTempClose
()
<<
"
\n
"
;
std
::
cout
<<
KGRN
<<
"Transition added. Building Has "
<<
building
->
GetAllTransitions
().
size
()
<<
" Transitions
\n
"
<<
RESET
;
double
dist_pt1
=
(
w1
.
GetPoint1
()
-
e
->
GetPoint1
()).
NormSquare
();
double
dist_pt2
=
(
w1
.
GetPoint1
()
-
e
->
GetPoint2
()).
NormSquare
();
...
...
@@ -781,10 +800,10 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::string
Wall
NewWall
(
w1
.
GetPoint1
(),
A
);
Wall
NewWall1
(
w1
.
GetPoint2
(),
B
);
// add new lines to be controled against overlap with exits
building
->
TempAddedWalls
.
push_back
(
NewWall
);
building
->
TempAddedWalls
.
push_back
(
NewWall1
);
building
->
TempAddedDoors
.
push_back
(
*
e
);
building
->
TempRemovedWalls
.
push_back
(
w1
);
building
->
TempAddedWalls
[
trainId
]
.
push_back
(
NewWall
);
building
->
TempAddedWalls
[
trainId
]
.
push_back
(
NewWall1
);
building
->
TempAddedDoors
[
trainId
]
.
push_back
(
*
e
);
building
->
TempRemovedWalls
[
trainId
]
.
push_back
(
w1
);
subroom
->
AddWall
(
NewWall
);
subroom
->
AddWall
(
NewWall1
);
subroom
->
RemoveWall
(
w1
);
...
...
@@ -963,31 +982,40 @@ int Simulation::GetMaxSimTime() const{
// return true is changes are made to the geometry
bool
Simulation
::
TrainTraffic
()
{
// here open transition that should be closed
// TODO fix, opens door everytime...
bool
trainHere
=
false
;
bool
trainLeave
=
false
;
std
::
string
trainType
=
""
;
Point
trackStart
,
trackEnd
;
int
trainId
=
0
;
auto
now
=
Pedestrian
::
GetGlobalTime
();
static
int
once
=
1
;
for
(
auto
&&
tab
:
TrainTimeTables
)
{
if
(
(
now
>=
tab
.
second
->
tin
)
&&
(
now
<=
tab
.
second
->
tout
)
)
trainType
=
tab
.
second
->
type
;
trainId
=
tab
.
second
->
id
;
trackStart
=
tab
.
second
->
pstart
;
trackEnd
=
tab
.
second
->
pend
;
if
(
!
tab
.
second
->
arrival
&&
(
now
>=
tab
.
second
->
tin
)
&&
(
now
<=
tab
.
second
->
tout
))
{
trainHere
=
true
;
trainType
=
tab
.
second
->
type
;
trackStart
=
tab
.
second
->
pstart
;
trackEnd
=
tab
.
second
->
pend
;
continue
;
TrainTimeTables
.
at
(
trainId
)
->
arrival
=
true
;
std
::
cout
<<
KRED
<<
"Arrival: TRAIN "
<<
trainType
<<
" at time: "
<<
now
<<
"
\n
"
<<
RESET
;
correctGeometry
(
_building
,
tab
.
second
);
}
else
if
(
tab
.
second
->
arrival
&&
now
>=
tab
.
second
->
tout
)
{
std
::
cout
<<
KGRN
<<
"Departure: TRAIN "
<<
trainType
<<
" at time: "
<<
now
<<
"
\n
"
<<
RESET
;
_building
->
resetGeometry
(
tab
.
second
);
trainLeave
=
true
;
TrainTimeTables
.
at
(
trainId
)
->
arrival
=
false
;
}
}
// todo: correctgeometry on arrival of a train. Reset it on departure of train.
if
(
trainHere
&&
onc
e
)
if
(
trainHere
||
trainLeav
e
)
{
correctGeometry
(
_building
,
trainType
,
trackStart
,
trackEnd
);
std
::
cout
<<
KRED
<<
">> update router
\n
"
<<
RESET
;
once
=
0
;
return
true
;
}
...
...
Simulation.h
View file @
487614fb
...
...
@@ -192,7 +192,7 @@ public:
int
GetMaxSimTime
()
const
;
void
incrementCountTraj
();
bool
correctGeometry
(
std
::
shared_ptr
<
Building
>
building
,
std
::
s
tring
trainType
,
Point
TrackStart
,
Point
TrackEnd
);
bool
correctGeometry
(
std
::
shared_ptr
<
Building
>
building
,
std
::
s
hared_ptr
<
TrainTimeTable
>
);
bool
WriteTrajectories
(
std
::
string
trajName
);
bool
TrainTraffic
();
...
...
geometry/Building.cpp
View file @
487614fb
...
...
@@ -410,7 +410,7 @@ const std::vector<Wall> Building::GetTrackWalls(Point TrackStart, Point TrackEnd
{
track_id
=
track
.
first
;
int
commonPoints
=
0
;
std
::
cout
<<
"
\t
track "
<<
track
.
first
<<
"
\n
"
;
//
std::cout << "\t track " << track.first << "\n";
auto
walls
=
track
.
second
;
for
(
auto
wall
:
walls
)
{
...
...
@@ -439,13 +439,15 @@ const std::vector<Wall> Building::GetTrackWalls(Point TrackStart, Point TrackEnd
room_id
=
_platforms
.
at
(
platform_id
)
->
rid
;
subroom_id
=
_platforms
.
at
(
platform_id
)
->
sid
;
mytrack
=
_platforms
.
at
(
platform_id
)
->
tracks
[
track_id
];
std
::
cout
<<
"track has walls: "
<<
mytrack
.
size
()
<<
"
\n
"
;
std
::
cout
<<
"platform "
<<
platform_id
<<
" track "
<<
track_id
<<
"
\n
"
;
std
::
cout
<<
"room "
<<
room_id
<<
" subroom "
<<
subroom_id
<<
"
\n
"
;
//
std::cout << "track has walls: " << mytrack.size() << "\n";
//
std::cout << "platform " << platform_id << " track " << track_id << "\n";
//
std::cout << "room " << room_id << " subroom " << subroom_id << "\n";
}
else
{
std
::
cout
<<
"could not find any track!
\n
"
;
std
::
cout
<<
"could not find any track! Exit.
\n
"
;
exit
(
-
1
);
}
return
mytrack
;
}
...
...
@@ -490,107 +492,144 @@ const std::vector<std::pair<PointWall, PointWall > > Building::GetIntersectionPo
/* std::cout << "intersection at :" << interPoint2.toString() << "\n"; */
}
}
// tracks
std
::
cout
<<
"door: "
<<
door
.
toString
()
<<
", intersections: "
<<
nintersections
<<
"
\n
"
;
//
std::cout << "door: " << door.toString() << ", intersections: " << nintersections << "\n";
if
(
nintersections
==
2
)
pws
.
push_back
(
std
::
make_pair
(
pw1
,
pw2
));
}
// doors
return
pws
;
}
bool
Building
::
resetTempVectors
()
// reset changes made by trainTimeTable[id]
bool
Building
::
resetGeometry
(
std
::
shared_ptr
<
TrainTimeTable
>
tab
)
{
// this function is composed of three copy/pasted blocks.
int
room_id
,
subroom_id
;
SubRoom
*
subroom
;
// remove temp added walls
for
(
auto
wall
:
TempAddedWalls
)
for
(
auto
id_
wall
:
TempAddedWalls
)
{
for
(
auto
platform
:
_platforms
)
{
auto
tracks
=
platform
.
second
->
tracks
;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
if
(
r
.
first
!=
room_id
)
continue
;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
}
for
(
auto
track
:
tracks
)
{
auto
walls
=
track
.
second
;
for
(
auto
trackWall
:
walls
)
{
if
(
trackWall
==
wall
)
{
std
::
cout
<<
"todo
\n
"
;
int
i
=
id_wall
.
first
;
if
(
i
!=
tab
->
id
)
continue
;
auto
tempWalls
=
id_wall
.
second
;
for
(
auto
wall
:
tempWalls
)
{
for
(
auto
platform
:
_platforms
)
{
auto
tracks
=
platform
.
second
->
tracks
;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
if
(
r
.
first
!=
room_id
)
continue
;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
}
for
(
auto
track
:
tracks
)
{
auto
walls
=
track
.
second
;
for
(
auto
trackWall
:
walls
)
{
if
(
trackWall
==
wall
)
{
subroom
->
RemoveWall
(
wall
);
}
}
}
}
auto
it
=
std
::
find
(
tempWalls
.
begin
(),
tempWalls
.
end
(),
wall
);
if
(
it
!=
tempWalls
.
end
())
{
// std::cout<< KGRN << "delete wall ..." << RESET <<std::endl;
// wallPiece.WriteToErrorLog();
tempWalls
.
erase
(
it
);
}
}
}
}
}
}
}
/* // add remove walls */
for
(
auto
wall
:
TempRemovedWalls
)
for
(
auto
id_
wall
:
TempRemovedWalls
)
{
for
(
auto
platform
:
_platforms
)
{
auto
tracks
=
platform
.
second
->
tracks
;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
if
(
r
.
first
!=
room_id
)
continue
;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
}
for
(
auto
track
:
tracks
)
{
auto
walls
=
track
.
second
;
for
(
auto
trackWall
:
walls
)
{
if
(
trackWall
==
wall
)
{
subroom
->
AddWall
(
wall
);
std
::
cout
<<
"todo
\n
"
;
}
}
}
}
int
i
=
id_wall
.
first
;
if
(
i
!=
tab
->
id
)
continue
;
auto
tempWalls
=
id_wall
.
second
;
for
(
auto
wall
:
tempWalls
)
{
for
(
auto
platform
:
_platforms
)
{
auto
tracks
=
platform
.
second
->
tracks
;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
if
(
r
.
first
!=
room_id
)
continue
;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
}
for
(
auto
track
:
tracks
)
{
auto
walls
=
track
.
second
;
for
(
auto
trackWall
:
walls
)
{
if
(
trackWall
==
wall
)
{
subroom
->
AddWall
(
wall
);
auto
it
=
std
::
find
(
tempWalls
.
begin
(),
tempWalls
.
end
(),
wall
);
if
(
it
!=
tempWalls
.
end
())
{
// std::cout<< KGRN << "delete wall ..." << RESET <<std::endl;
// wallPiece.WriteToErrorLog();
tempWalls
.
erase
(
it
);
}
}
}
}
}
}
}
/* // remove added doors */
for
(
auto
door
:
TempAddedDoors
)
for
(
auto
id_wall
:
TempAddedDoors
)
{
for
(
auto
platform
:
_platforms
)
{
auto
tracks
=
platform
.
second
->
tracks
;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
if
(
r
.
first
!=
room_id
)
continue
;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
}
for
(
auto
track
:
tracks
)
{
auto
walls
=
track
.
second
;
for
(
auto
trackWall
:
walls
)
{
if
(
trackWall
==
door
)
{
int
i
=
id_wall
.
first
;
if
(
i
!=
tab
->
id
)
continue
;
auto
tempWalls
=
id_wall
.
second
;
for
(
auto
door
:
tempWalls
)
{
for
(
auto
platform
:
_platforms
)
{
auto
tracks
=
platform
.
second
->
tracks
;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
if
(
r
.
first
!=
room_id
)
continue
;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
}
for
(
auto
track
:
tracks
)
{
auto
walls
=
track
.
second
;
for
(
auto
trackWall
:
walls
)
{
if
(
trackWall
==
door
)
{
subroom
->
RemoveTransition
(
&
door
);
std
::
cout
<<
"todo
\n
"
;
}
}
}
}
auto
it
=
std
::
find
(
tempWalls
.
begin
(),
tempWalls
.
end
(),
door
);
if
(
it
!=
tempWalls
.
end
())
{
// std::cout<< KGRN << "delete wall ..." << RESET <<std::endl;
// wallPiece.WriteToErrorLog();
tempWalls
.
erase
(
it
);
}
}
}
}
}
}
}
TempAddedWalls
.
clear
();
TempRemovedWalls
.
clear
();
TempAddedDoors
.
clear
();
return
true
;
}
bool
Building
::
InitPlatforms
()
...
...
geometry/Building.h
View file @
487614fb
...
...
@@ -70,6 +70,8 @@ struct TrainTimeTable
Point
tstart
;
// train start
Point
tend
;
// train end
int
pid
;
// Platform id
bool
arrival
;
bool
departure
;
};
struct
TrainType
{
...
...
@@ -119,15 +121,13 @@ private:
public:
/// constructor
Building
();
std
::
vector
<
Wall
>
TempAddedWalls
;
std
::
vector
<
Wall
>
TempRemovedWalls
;
std
::
vector
<
Transition
>
TempAddedDoors
;
bool
resetTempVectors
();
std
::
map
<
int
,
std
::
vector
<
Wall
>
>
TempAddedWalls
;
// map to trainTimeTable
std
::
map
<
int
,
std
::
vector
<
Wall
>
>
TempRemovedWalls
;
std
::
map
<
int
,
std
::
vector
<
Transition
>
>
TempAddedDoors
;
// Building(const std::string &, const std::string &, RoutingEngine &, PedDistributor &, double);
Building
(
Configuration
*
config
,
PedDistributor
&
pedDistributor
);
bool
resetGeometry
(
std
::
shared_ptr
<
TrainTimeTable
>
tab
);
/// destructor
virtual
~
Building
();
...
...
@@ -406,7 +406,7 @@ private:
* @param subroom
* @return bool
*/
bool
RemoveOverlappingDoors
(
bool
RemoveOverlappingDoors
(
const
std
::
shared_ptr
<
SubRoom
>&
subroom
)
const
;
/** @} */
// end of group
...
...
routing/DirectionStrategy.cpp
View file @
487614fb
...
...
@@ -167,7 +167,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
#if DEBUG
printf
(
"
\n
----------
\n
Enter GetTarget() with PED=%d
\n
----------
\n
"
,
ped
->
GetID
());
printf
(
"nextPointOn Line: %f %f
\n
"
,
NextPointOnLine
.
GetX
(),
NextPointOnLine
.
GetY
()
);
printf
(
"nextPointOn Line: %f %f
\n
"
,
NextPointOnLine
.
_x
,
NextPointOnLine
.
_y
);
#endif
double
dist
;
int
inear
=
-
1
;
...
...
@@ -186,7 +186,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
#if DEBUG
printf
(
"Check wall number %d. Dist = %f (%f)
\n
"
,
i
,
dist
,
minDist
);
printf
(
"%f %f --- %f %f
\n
===========
\n
"
,
walls
[
i
].
GetPoint1
().
GetX
(),
walls
[
i
].
GetPoint1
().
GetY
(),
walls
[
i
].
GetPoint2
().
GetX
(),
walls
[
i
].
GetPoint2
().
GetY
()
);
printf
(
"%f %f --- %f %f
\n
===========
\n
"
,
walls
[
i
].
GetPoint1
().
_x
,
walls
[
i
].
GetPoint1
().
_y
,
walls
[
i
].
GetPoint2
().
_x
,
walls
[
i
].
GetPoint2
().
_y
);
#endif
}
...
...
@@ -207,7 +207,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
iObs
=
obs
;
#if DEBUG
printf
(
"Check OBS:obs=%d, i=%d Dist = %f (%f)
\n
"
,
obs
,
i
,
dist
,
minDist
);
printf
(
"%f %f --- %f %f
\n
===========
\n
"
,
owalls
[
i
].
GetPoint1
().
GetX
(),
owalls
[
i
].
GetPoint1
().
GetY
(),
owalls
[
i
].
GetPoint2
().
GetX
(),
owalls
[
i
].
GetPoint2
().
GetY
()
);
printf
(
"%f %f --- %f %f
\n
===========
\n
"
,
owalls
[
i
].
GetPoint1
().
_x
,
owalls
[
i
].
GetPoint1
().
_y
,
owalls
[
i
].
GetPoint2
().
_x
,
owalls
[
i
].
GetPoint2
().
_y
);
#endif
}
}
//walls of obstacle
...
...
@@ -226,7 +226,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
// angle = tmpDirection.GetDeviationAngle(owalls[inear].enlarge(2*ped->GetLargerAxis()));
#if DEBUG
printf
(
"COLLISION WITH OBSTACLE %f %f --- %f %f
\n
===========
\n
"
,
owalls
[
inear
].
GetPoint1
().
GetX
(),
owalls
[
inear
].
GetPoint1
().
GetY
(),
owalls
[
inear
].
GetPoint2
().
GetX
(),
owalls
[
inear
].
GetPoint2
().
GetY
()
);
printf
(
"COLLISION WITH OBSTACLE %f %f --- %f %f
\n
===========
\n
"
,
owalls
[
inear
].
GetPoint1
().
_x
,
owalls
[
inear
].
GetPoint1
().
_y
,
owalls
[
inear
].
GetPoint2
().
_x
,
owalls
[
inear
].
GetPoint2
().
_y
);
#endif
}
//iObs
...
...
@@ -234,7 +234,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
angle
=
tmpDirection
.
GetDeviationAngle
(
walls
[
inear
].
Enlarge
(
2
*
ped
->
GetLargerAxis
()));
#if DEBUG
printf
(
"COLLISION WITH WALL %f %f --- %f %f
\n
===========
\n
"
,
walls
[
inear
].
GetPoint1
().
GetX
(),
walls
[
inear
].
GetPoint1
().
GetY
(),
walls
[
inear
].
GetPoint2
().
GetX
(),
walls
[
inear
].
GetPoint2
().
GetY
()
);
printf
(
"COLLISION WITH WALL %f %f --- %f %f
\n
===========
\n
"
,
walls
[
inear
].
GetPoint1
().
_x
,
walls
[
inear
].
GetPoint1
().
_y
,
walls
[
inear
].
GetPoint2
().
_x
,
walls
[
inear
].
GetPoint2
().
_y
);
#endif
}
//else
}
//inear
...
...
@@ -263,9 +263,9 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
#if DEBUG
printf
(
"inear=%d, iObs=%d, minDist=%f
\n
"
,
inear
,
iObs
,
minDist
);
printf
(
"PED=%d
\n
"
,
ped
->
GetID
());
printf
(
"MC Posx = %.2f, Posy=%.2f, Lot=[%.2f, %.2f]
\n
"
,
ped
->
GetPos
().
GetX
(),
ped
->
GetPos
().
GetY
(),
NextPointOnLine
.
GetX
(),
NextPointOnLine
.
GetY
()
);
printf
(
"MC p1=[%.2f, %.2f] p2=[%.2f, %.2f]
\n
"
,
p1
.
GetX
(),
p1
.
GetY
(),
p2
.
GetX
(),
p2
.
GetY
()
);
printf
(
"angle=%f, G=[%.2f, %.2f]
\n
"
,
angle
,
G
.
GetX
(),
G
.
GetY
()
);
printf
(
"MC Posx = %.2f, Posy=%.2f, Lot=[%.2f, %.2f]
\n
"
,
ped
->
GetPos
().
_x
,
ped
->
GetPos
().
_y
,
NextPointOnLine
.
_x
,
NextPointOnLine
.
_y
);
printf
(
"MC p1=[%.2f, %.2f] p2=[%.2f, %.2f]
\n
"
,
p1
.
_x
,
p1
.
_y
,
p2
.
_x
,
p2
.
_y
);
printf
(
"angle=%f, G=[%.2f, %.2f]
\n
"
,
angle
,
G
.
_x
,
G
.
_y
);
printf
(
"
\n
----------
\n
LEAVE function with PED=%d
\n
----------
\n
"
,
ped
->
GetID
());
// getc(stdin);
...
...
@@ -292,7 +292,8 @@ Point DirectionFloorfield::GetTarget(Room* room, Pedestrian* ped) const
{
UNUSED
(
room
);
#if DEBUG
if
(
initDone
&&
(
ffviafm
!=
nullptr
))
{
if
(
1
)
{
#endif // DEBUG
Point
p
;
...
...
@@ -351,7 +352,7 @@ DirectionFloorfield::~DirectionFloorfield() {
Point
DirectionLocalFloorfield
::
GetTarget
(
Room
*
room
,
Pedestrian
*
ped
)
const
{
#if DEBUG
if
(
initDone
&&
(
ffviafm
!=
nullptr
)
)
{
if
(
1
)
{
#endif // DEBUG
Point
p
;
...
...
@@ -367,6 +368,7 @@ Point DirectionLocalFloorfield::GetTarget(Room* room, Pedestrian* ped) const
// if (floorfield->getCostToDestination(ped->GetExitIndex(), ped->GetPos()) < 1.0) {
// p = p * floorfield->getCostToDestination(ped->GetExitIndex(), ped->GetPos());
// }
Point
P
=
p
+
ped
->
GetPos
();
return
(
p
+
ped
->
GetPos
());
#if DEBUG
...
...
@@ -374,7 +376,7 @@ Point DirectionLocalFloorfield::GetTarget(Room* room, Pedestrian* ped) const
#endif // DEBUG
//this should not execute:
//
std::cerr << "Failure in DirectionFloorfield::GetTarget!!" << std::endl;
std
::
cerr
<<
"Failure in DirectionFloorfield::GetTarget!!"
<<
std
::
endl
;
// exit(EXIT_FAILURE);
}
...
...
@@ -456,7 +458,7 @@ Point DirectionSubLocalFloorfield::GetTarget(Room* room, Pedestrian* ped) const
{
(
void
)
room
;
// silence warning
#if DEBUG
if
(
initDone
&&
(
ffviafm
!=
nullptr
)
)
{
if
(
1
)
{
#endif // DEBUG
Point
p
;
...
...
routing/ff_router/ffRouter.cpp
View file @
487614fb
...
...
@@ -108,7 +108,7 @@ bool FFRouter::Init(Building* building)
_goalToLineUIDmap
=
_globalFF
->
getGoalToLineUIDmap
();
_goalToLineUIDmap2
=
_globalFF
->
getGoalToLineUIDmap2
();
_goalToLineUIDmap3
=
_globalFF
->
getGoalToLineUIDmap3
();
//
_globalFF->writeGoalFF("goal.vtk", goalIDs);
_globalFF
->
writeGoalFF
(
"goal.vtk"
,
goalIDs
);
}
//get all door UIDs
_allDoorUIDs
.
clear
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!