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
d65740a5
Commit
d65740a5
authored
Jul 24, 2017
by
Arne Graf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refac: useWallAvoid -> useWallDistances
parent
d0fd5d08
Pipeline
#3877
failed with stages
in 7 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
46 deletions
+52
-46
routing/DirectionStrategy.cpp
routing/DirectionStrategy.cpp
+10
-22
routing/ff_router/UnivFFviaFM.cpp
routing/ff_router/UnivFFviaFM.cpp
+32
-17
routing/ff_router/UnivFFviaFM.h
routing/ff_router/UnivFFviaFM.h
+9
-6
routing/ff_router/ffRouter.cpp
routing/ff_router/ffRouter.cpp
+1
-1
No files found.
routing/DirectionStrategy.cpp
View file @
d65740a5
...
...
@@ -314,28 +314,16 @@ double DirectionFloorfield::GetDistance2Wall(Pedestrian* ped) const
void
DirectionFloorfield
::
Init
(
Building
*
building
,
double
stepsize
,
double
threshold
,
bool
useDistancMap
)
{
//implement mechanic, that can read-in an existing floorfield (from a previous run)
string
s
=
building
->
GetGeometryFilename
();
Log
->
Write
(
"INFO:
\t
GeometryFilename <"
+
s
+
">"
);
s
.
erase
(
s
.
find_last_of
(
"."
,
string
::
npos
));
// delete ending
if
(
s
.
find_last_of
(
"/"
)
!=
string
::
npos
)
{
s
.
erase
(
0
,
s
.
find_last_of
(
"/"
)
+
1
);
// delete directories before filename (espacially "..")
}
string
FF_filename
=
(
building
->
GetProjectRootDir
()
+
"FF_"
+
s
+
"_"
+
std
::
to_string
(
threshold
)
+
".vtk"
).
c_str
();
std
::
ifstream
test
(
FF_filename
);
if
(
test
.
good
())
{
Log
->
Write
(
"INFO:
\t
Read Floorfield from file <"
+
FF_filename
+
">"
);
_ffviafm
=
new
FloorfieldViaFM
(
FF_filename
);
}
else
{
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
>
start
,
end
;
start
=
std
::
chrono
::
system_clock
::
now
();
Log
->
Write
(
"INFO:
\t
Calling Construtor of FloorfieldViaFM"
);
_ffviafm
=
new
FloorfieldViaFM
(
building
,
stepsize
,
stepsize
,
threshold
,
useDistancMap
,
false
);
end
=
std
::
chrono
::
system_clock
::
now
();
std
::
chrono
::
duration
<
double
>
elapsed_seconds
=
end
-
start
;
Log
->
Write
(
"INFO:
\t
Taken time: "
+
std
::
to_string
(
elapsed_seconds
.
count
()));
}
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
>
start
,
end
;
start
=
std
::
chrono
::
system_clock
::
now
();
Log
->
Write
(
"INFO:
\t
Calling Construtor of FloorfieldViaFM"
);
_ffviafm
=
new
FloorfieldViaFM
(
building
,
stepsize
,
stepsize
,
threshold
,
useDistancMap
,
false
);
end
=
std
::
chrono
::
system_clock
::
now
();
std
::
chrono
::
duration
<
double
>
elapsed_seconds
=
end
-
start
;
Log
->
Write
(
"INFO:
\t
Taken time: "
+
std
::
to_string
(
elapsed_seconds
.
count
()));
_initDone
=
true
;
}
...
...
routing/ff_router/UnivFFviaFM.cpp
View file @
d65740a5
...
...
@@ -35,21 +35,21 @@ UnivFFviaFM::~UnivFFviaFM() {
}
}
UnivFFviaFM
::
UnivFFviaFM
(
Room
*
r
,
Building
*
b
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
)
:
UnivFFviaFM
(
r
,
b
->
GetConfig
(),
hx
,
wallAvoid
,
useWall
Avoid
)
{
UnivFFviaFM
::
UnivFFviaFM
(
Room
*
r
,
Building
*
b
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
)
:
UnivFFviaFM
(
r
,
b
->
GetConfig
(),
hx
,
wallAvoid
,
useWall
Distances
)
{
_building
=
b
;
}
UnivFFviaFM
::
UnivFFviaFM
(
SubRoom
*
sr
,
Building
*
b
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
)
:
UnivFFviaFM
(
sr
,
b
->
GetConfig
(),
hx
,
wallAvoid
,
useWall
Avoid
)
{
UnivFFviaFM
::
UnivFFviaFM
(
SubRoom
*
sr
,
Building
*
b
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
)
:
UnivFFviaFM
(
sr
,
b
->
GetConfig
(),
hx
,
wallAvoid
,
useWall
Distances
)
{
_building
=
b
;
}
UnivFFviaFM
::
UnivFFviaFM
(
Room
*
r
,
Configuration
*
const
conf
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
)
:
UnivFFviaFM
(
r
,
conf
,
hx
,
wallAvoid
,
useWall
Avoid
,
std
::
vector
<
int
>
()){
UnivFFviaFM
::
UnivFFviaFM
(
Room
*
r
,
Configuration
*
const
conf
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
)
:
UnivFFviaFM
(
r
,
conf
,
hx
,
wallAvoid
,
useWall
Distances
,
std
::
vector
<
int
>
()){
}
UnivFFviaFM
::
UnivFFviaFM
(
Room
*
roomArg
,
Configuration
*
const
confArg
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
,
std
::
vector
<
int
>
wantedDoors
)
{
UnivFFviaFM
::
UnivFFviaFM
(
Room
*
roomArg
,
Configuration
*
const
confArg
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
,
std
::
vector
<
int
>
wantedDoors
)
{
//build the vector with walls(wall or obstacle), the map with <UID, Door(Cross or Trans)>, the vector with targets(UIDs)
//then call other constructor including the mode
...
...
@@ -92,15 +92,15 @@ UnivFFviaFM::UnivFFviaFM(Room* roomArg, Configuration* const confArg, double hx,
}
}
create
(
lines
,
tmpDoors
,
wantedDoors
,
FF_HOMO_SPEED
,
hx
,
wallAvoid
,
useWall
Avoid
);
//create(lines, tmpDoors, wantedDoors, FF_WALL_AVOID, hx, wallAvoid, useWall
Avoid
);
create
(
lines
,
tmpDoors
,
wantedDoors
,
FF_HOMO_SPEED
,
hx
,
wallAvoid
,
useWall
Distances
);
//create(lines, tmpDoors, wantedDoors, FF_WALL_AVOID, hx, wallAvoid, useWall
Distances
);
}
UnivFFviaFM
::
UnivFFviaFM
(
SubRoom
*
sr
,
Configuration
*
const
conf
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
)
:
UnivFFviaFM
(
sr
,
conf
,
hx
,
wallAvoid
,
useWall
Avoid
,
std
::
vector
<
int
>
()){
UnivFFviaFM
::
UnivFFviaFM
(
SubRoom
*
sr
,
Configuration
*
const
conf
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
)
:
UnivFFviaFM
(
sr
,
conf
,
hx
,
wallAvoid
,
useWall
Distances
,
std
::
vector
<
int
>
()){
}
UnivFFviaFM
::
UnivFFviaFM
(
SubRoom
*
subRoomArg
,
Configuration
*
const
confArg
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
,
std
::
vector
<
int
>
wantedDoors
)
{
UnivFFviaFM
::
UnivFFviaFM
(
SubRoom
*
subRoomArg
,
Configuration
*
const
confArg
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
,
std
::
vector
<
int
>
wantedDoors
)
{
//build the vector with walls(wall or obstacle), the map with <UID, Door(Cross or Trans)>, the vector with targets(UIDs)
//then call other constructor including the mode
_configuration
=
confArg
;
...
...
@@ -135,14 +135,14 @@ UnivFFviaFM::UnivFFviaFM(SubRoom* subRoomArg, Configuration* const confArg, doub
tmpDoors
.
emplace
(
std
::
make_pair
(
uidNotConst
,
(
Line
)
*
trans
));
}
create
(
lines
,
tmpDoors
,
wantedDoors
,
FF_HOMO_SPEED
,
hx
,
wallAvoid
,
useWall
Avoid
);
create
(
lines
,
tmpDoors
,
wantedDoors
,
FF_HOMO_SPEED
,
hx
,
wallAvoid
,
useWall
Distances
);
}
void
UnivFFviaFM
::
create
(
std
::
vector
<
Line
>&
walls
,
std
::
map
<
int
,
Line
>&
doors
,
std
::
vector
<
int
>
targetUIDs
,
int
mode
,
double
spacing
,
double
wallAvoid
,
bool
useWall
Avoid
)
{
double
spacing
,
double
wallAvoid
,
bool
useWall
Distances
)
{
_wallAvoidDistance
=
wallAvoid
;
_useWall
Avoidance
=
useWallAvoid
;
_useWall
Distances
=
useWallDistances
;
_speedmode
=
mode
;
//find circumscribing rectangle (x_min/max, y_min/max) //create RectGrid
...
...
@@ -156,7 +156,7 @@ void UnivFFviaFM::create(std::vector<Line>& walls, std::map<int, Line>& doors, s
std
::
fill
(
_speedFieldSelector
[
INITIAL_SPEED
],
_speedFieldSelector
[
INITIAL_SPEED
]
+
_nPoints
,
1.0
);
//allocate _initalSpeed and maybe _modifiedSpeed
if
(
mode
==
FF_WALL_AVOID
)
{
if
(
(
mode
==
FF_WALL_AVOID
)
||
(
useWallDistances
)
)
{
double
*
cost_alias_walldistance
=
new
double
[
_nPoints
];
_costFieldWithKey
[
0
]
=
cost_alias_walldistance
;
Point
*
gradient_alias_walldirection
=
new
Point
[
_nPoints
];
...
...
@@ -995,7 +995,7 @@ void UnivFFviaFM::addTarget(const int uid, double* costarrayDBL, Point* gradarra
if
(
_mode
==
CENTERPOINT
)
{
newArrayDBL
[
_grid
->
getKeyAtPoint
(
tempCenterPoint
)]
=
magicnum
(
TARGET_REGION
);
}
//the following condition is not clean: we have _speedmode and _useWall
Avoidance
which are redundant
//the following condition is not clean: we have _speedmode and _useWall
Distances
which are redundant
if
(
_speedmode
==
FF_WALL_AVOID
)
{
calcFF
(
newArrayDBL
,
newArrayPt
,
_speedFieldSelector
[
REDU_WALL_SPEED
]);
}
else
if
(
_speedmode
==
FF_HOMO_SPEED
)
{
...
...
@@ -1288,6 +1288,21 @@ void UnivFFviaFM::getDirectionToUID(int destID, const long int key, Point& direc
return
;
}
double
UnivFFviaFM
::
getDistance2WallAt
(
const
Point
&
pos
)
{
if
(
_useWallDistances
||
(
_speedmode
==
FF_WALL_AVOID
))
{
return
_costFieldWithKey
[
0
][
_grid
->
getKeyAtPoint
(
pos
)];
}
return
DBL_MAX
;
}
void
UnivFFviaFM
::
getDir2WallAt
(
const
Point
&
pos
,
Point
&
p
)
{
if
(
_useWallDistances
||
(
_speedmode
==
FF_WALL_AVOID
))
{
p
=
_directionFieldWithKey
[
0
][
_grid
->
getKeyAtPoint
(
pos
)];
}
else
{
p
=
Point
(
0.0
,
0.0
);
}
}
/* Log:
* todo:
* - implement error treatment: extend fctns to throw errors and handle them
...
...
routing/ff_router/UnivFFviaFM.h
View file @
d65740a5
...
...
@@ -81,12 +81,12 @@ class UnivFFviaFM {
public:
UnivFFviaFM
(
Room
*
a
,
Building
*
b
,
double
c
,
double
e
,
bool
f
);
UnivFFviaFM
(
SubRoom
*
a
,
Building
*
b
,
double
c
,
double
e
,
bool
f
);
UnivFFviaFM
(
Room
*
a
,
Configuration
*
const
b
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
);
UnivFFviaFM
(
Room
*
a
,
Configuration
*
const
b
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
,
std
::
vector
<
int
>
wantedDoors
);
UnivFFviaFM
(
SubRoom
*
sr
,
Configuration
*
const
conf
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
);
UnivFFviaFM
(
SubRoom
*
subRoomArg
,
Configuration
*
const
confArg
,
double
hx
,
double
wallAvoid
,
bool
useWall
Avoid
,
std
::
vector
<
int
>
wantedDoors
);
UnivFFviaFM
(
Room
*
a
,
Configuration
*
const
b
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
);
UnivFFviaFM
(
Room
*
a
,
Configuration
*
const
b
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
,
std
::
vector
<
int
>
wantedDoors
);
UnivFFviaFM
(
SubRoom
*
sr
,
Configuration
*
const
conf
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
);
UnivFFviaFM
(
SubRoom
*
subRoomArg
,
Configuration
*
const
confArg
,
double
hx
,
double
wallAvoid
,
bool
useWall
Distances
,
std
::
vector
<
int
>
wantedDoors
);
void
create
(
std
::
vector
<
Line
>&
walls
,
std
::
map
<
int
,
Line
>&
doors
,
std
::
vector
<
int
>
targetUIDs
,
int
mode
,
double
spacing
,
double
wallAvoidDist
,
bool
useWall
Avoid
);
double
spacing
,
double
wallAvoidDist
,
bool
useWall
Distances
);
UnivFFviaFM
()
{};
UnivFFviaFM
(
UnivFFviaFM
&
){};
virtual
~
UnivFFviaFM
();
...
...
@@ -106,6 +106,9 @@ public:
RectGrid
*
getGrid
();
virtual
void
getDirectionToUID
(
int
destID
,
const
long
int
key
,
Point
&
direction
,
int
mode
);
void
getDirectionToUID
(
int
destID
,
const
long
int
key
,
Point
&
direction
);
double
getDistance2WallAt
(
const
Point
&
pos
);
void
getDir2WallAt
(
const
Point
&
pos
,
Point
&
p
);
void
writeFF
(
const
std
::
string
&
,
std
::
vector
<
int
>
targetID
);
void
createRectGrid
(
std
::
vector
<
Line
>&
walls
,
std
::
map
<
int
,
Line
>&
doors
,
double
spacing
);
...
...
@@ -147,7 +150,7 @@ private:
SubRoom
*
*
_subrooms
=
nullptr
;
// this is an array (first asterisk) of pointers (second asterisk)
double
_wallAvoidDistance
=
0.
;
bool
_useWall
Avoidance
=
false
;
bool
_useWall
Distances
=
false
;
//the following maps are responsible for dealloc the arrays
std
::
map
<
int
,
double
*>
_costFieldWithKey
;
...
...
routing/ff_router/ffRouter.cpp
View file @
d65740a5
...
...
@@ -517,7 +517,7 @@ int FFRouter::FindExit(Pedestrian* p)
#pragma omp critical(finalDoors)
_finalDoors
.
emplace
(
std
::
make_pair
(
p
->
GetID
(),
bestFinalDoor
));
if
(
_CroTrByUID
.
count
(
bestDoor
))
{
p
->
SetExitIndex
(
bestDoor
);
p
->
SetExitLine
(
_CroTrByUID
.
at
(
bestDoor
));
...
...
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!
Cancel
Please
register
or
sign in
to comment