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
b74b3931
Commit
b74b3931
authored
Mar 17, 2015
by
Oliver Schmidts
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.7' of
https://cst.version.fz-juelich.de/jupedsim/jpscore
into v0.7
parents
99af59e0
46626dbc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
147 additions
and
26 deletions
+147
-26
CMakeLists.txt
CMakeLists.txt
+4
-0
routing/CognitiveMapRouter.cpp
routing/CognitiveMapRouter.cpp
+1
-1
routing/cognitive_map/fire_mesh/FireMeshStorage.cpp
routing/cognitive_map/fire_mesh/FireMeshStorage.cpp
+61
-0
routing/cognitive_map/fire_mesh/FireMeshStorage.h
routing/cognitive_map/fire_mesh/FireMeshStorage.h
+32
-0
routing/cognitive_map/navigation_graph/GraphEdge.cpp
routing/cognitive_map/navigation_graph/GraphEdge.cpp
+20
-20
routing/cognitive_map/navigation_graph/GraphEdge.h
routing/cognitive_map/navigation_graph/GraphEdge.h
+4
-4
routing/cognitive_map/sensor/SmokeSensor.cpp
routing/cognitive_map/sensor/SmokeSensor.cpp
+19
-0
routing/cognitive_map/sensor/SmokeSensor.h
routing/cognitive_map/sensor/SmokeSensor.h
+6
-1
No files found.
CMakeLists.txt
View file @
b74b3931
...
...
@@ -227,6 +227,7 @@ set ( source_files
routing/cognitive_map/sensor/SmokeSensor.cpp
routing/cognitive_map/fire_mesh/FireMesh.cpp
routing/cognitive_map/fire_mesh/Knot.cpp
routing/cognitive_map/fire_mesh/FireMeshStorage.cpp
poly2tri/common/shapes.cpp
poly2tri/sweep/sweep_context.cpp
...
...
@@ -266,6 +267,9 @@ set ( header_files
routing/cognitive_map/sensor/JamSensor.h
routing/cognitive_map/sensor/LastDestinationsSensor.h
routing/cognitive_map/sensor/SmokeSensor.h
routing/cognitive_map/fire_mesh/FireMesh.h
routing/cognitive_map/fire_mesh/Knot.h
routing/cognitive_map/fire_mesh/FireMeshStorage.h
pedestrian/Pedestrian.h
pedestrian/PedDistributor.h
...
...
routing/CognitiveMapRouter.cpp
View file @
b74b3931
...
...
@@ -86,7 +86,7 @@ int CognitiveMapRouter::FindExit(Pedestrian * p)
}
if
(
std
::
fmod
(
p
->
GetGlobalTime
(),
1
)
==
0
)
if
(
std
::
fmod
(
p
->
GetGlobalTime
(),
1
0
)
==
0
)
{
sensor_manager
->
execute
(
p
,
SensorManager
::
PERIODIC
);
//std::cout << p->GetGlobalTime() << std::endl;
...
...
routing/cognitive_map/fire_mesh/FireMeshStorage.cpp
0 → 100644
View file @
b74b3931
#include "FireMeshStorage.h"
FireMeshStorage
::
FireMeshStorage
(
const
Building
*
const
b
,
const
std
::
string
&
filepath
,
const
double
&
updateintervall
,
const
double
&
finalTime
)
{
_building
=
b
;
_filepath
=
filepath
;
CreateTimeList
(
updateintervall
,
finalTime
);
IdentifyDoors
();
CreateFireMeshes
();
}
FireMeshStorage
::~
FireMeshStorage
()
{
}
void
FireMeshStorage
::
CreateTimeList
(
const
double
&
updateIntervall
,
const
double
&
finalTime
,
const
double
&
startTime
)
{
//fulfill list with times when new Mesh should be used
double
i
=
0
;
while
(
i
<=
finalTime
)
{
_timelist
.
push_back
(
i
);
i
+=
updateIntervall
;
}
}
void
FireMeshStorage
::
IdentifyDoors
()
{
const
std
::
map
<
int
,
std
::
unique_ptr
<
Door
>>
doors
=
_building
->
GetAllRooms
();
for
(
auto
it
=
doors
.
begin
();
it
!=
doors
.
end
();
++
it
)
{
_doors
.
push_back
(
it
.
second
);
}
}
void
FireMeshStorage
::
CreateFireMeshes
()
{
for
(
auto
&
door
:
_doors
)
{
for
(
auto
&
i
:
_timelist
)
{
std
::
string
filename
=
_filepath
+
"/Door_X_"
+
std
::
to_string
(
door
->
GetCentre
().
GetX
())
+
"_Y_"
+
std
::
to_string
(
door
->
GetCentre
().
GetY
())
+
"/t_"
+
std
::
to_string
(
i
)
+
".csv"
;
FireMesh
mesh
(
filename
);
_fMContainer
.
emplace
(
std
::
make_pair
(
door
->
GetCentre
(),
i
),
mesh
);
}
}
}
const
FireMesh
&
FireMeshStorage
::
get_FireMesh
(
const
Point
&
doorCentre
,
const
double
&
simTime
)
{
return
_fMContainer
.
at
(
std
::
make_pair
(
doorCentre
,
simTime
));
}
routing/cognitive_map/fire_mesh/FireMeshStorage.h
0 → 100644
View file @
b74b3931
#ifndef FIREMESHSTORAGE_H
#define FIREMESHSTORAGE_H
#include <unordered_map>
#include "FireMesh.h"
#include "../../../geometry/Building.h"
// Container to store all fireMeshs. Sorted first by coordinates of the corresponding door, secondly by simulation's global time
using
fireMeshContainer
=
std
::
unordered_map
<
std
::
pair
<
Point
,
double
>
,
FireMesh
>
;
class
FireMeshStorage
{
public:
FireMeshStorage
(
const
Building
*
const
b
,
const
std
::
string
&
filepath
,
const
double
&
updateintervall
,
const
double
&
finalTime
);
~
FireMeshStorage
();
void
CreateTimeList
(
const
double
&
updateIntervall
,
const
double
&
finalTime
,
const
double
&
startTime
=
0
);
void
IdentifyDoors
();
void
CreateFireMeshes
();
const
FireMesh
&
get_FireMesh
(
const
Point
&
doorCentre
,
const
double
&
simTime
);
private:
Building
*
_building
;
fireMeshContainer
_fMContainer
;
std
::
string
_filepath
;
std
::
vector
<
double
>
_timelist
;
std
::
vector
<
Door
>
_doors
;
};
#endif // FIREMESHSTORAGE_H
routing/cognitive_map/navigation_graph/GraphEdge.cpp
View file @
b74b3931
...
...
@@ -153,32 +153,32 @@ const Crossing * GraphEdge::GetCrossing() const
return
_crossing
;
}
const
FireMesh
&
GraphEdge
::
GetFireMesh
()
const
{
return
_fireMesh
;
}
//const FireMesh *
GraphEdge::GetFireMesh() const
//
{
//
return _fireMesh;
//
}
void
GraphEdge
::
SetUpFireMesh
()
{
//
void GraphEdge::SetUpFireMesh()
//
{
//TODO: read this prefix from the ini file
// std::string filename = "D:/workspace/JuPedSim/jpscore/inputfiles/cognitive_map";
std
::
string
prefix
=
"D:/workspace/JPS/JPScore/inputfiles/cognitive_map"
;
//
//TODO: read this prefix from the ini file
//
// std::string filename = "D:/workspace/JuPedSim/jpscore/inputfiles/cognitive_map";
//
std::string prefix = "D:/workspace/JPS/JPScore/inputfiles/cognitive_map";
std
::
string
filename
=
prefix
+
"/Door_X_"
+
std
::
to_string
(
_crossing
->
GetCentre
().
GetX
())
+
"_Y_"
+
std
::
to_string
(
_crossing
->
GetCentre
().
GetY
())
+
".csv"
;
_fireMesh
.
SetKnotValuesFromFile
(
filename
);
}
//
std::string filename = prefix + "/Door_X_" + std::to_string(_crossing->GetCentre().GetX())
//
+ "_Y_" + std::to_string(_crossing->GetCentre().GetY()) + ".csv";
//
_fireMesh.SetKnotValuesFromFile(filename);
//
}
double
GraphEdge
::
GetSmokeFactor
(
const
Point
&
pointPed
)
const
{
//std::cout << pointPed.GetX() << " " << pointPed.GetY() << std::endl;
if
(
_fireMesh
.
statusMesh
()
==
true
)
return
_fireMesh
.
GetKnotValue
(
pointPed
.
GetX
(),
pointPed
.
GetY
());
else
return
1.0
;
//
double GraphEdge::GetSmokeFactor(const Point &pointPed) const
//
{ //std::cout << pointPed.GetX() << " " << pointPed.GetY() << std::endl;
//
if (_fireMesh.statusMesh()==true)
//
return _fireMesh.GetKnotValue(pointPed.GetX(),pointPed.GetY());
//
else
//
return 1.0;
}
//
}
bool
GraphEdge
::
IsExit
()
const
{
...
...
routing/cognitive_map/navigation_graph/GraphEdge.h
View file @
b74b3931
...
...
@@ -63,10 +63,10 @@ public:
const
Crossing
*
GetCrossing
()
const
;
///FireMesh
const
FireMesh
&
GetFireMesh
()
const
;
void
SetUpFireMesh
();
//const FireMesh *
GetFireMesh() const;
//
void SetUpFireMesh();
double
GetSmokeFactor
(
const
Point
&
pointPed
)
const
;
//
double GetSmokeFactor(const Point &pointPed) const;
double
GetApproximateDistance
()
const
;
double
GetApproximateDistance
(
const
Point
&
)
const
;
void
SetFactor
(
double
factor
,
std
::
string
name
);
...
...
@@ -80,7 +80,7 @@ private:
const
GraphVertex
*
const
_src
;
const
GraphVertex
*
const
_dest
;
const
Crossing
*
const
_crossing
;
FireMesh
_fireMesh
;
//FireMesh *
_fireMesh;
/**
* Factor Bag
...
...
routing/cognitive_map/sensor/SmokeSensor.cpp
View file @
b74b3931
...
...
@@ -12,8 +12,15 @@
#include "../../../pedestrian/Pedestrian.h"
#include "../../../geometry/SubRoom.h"
#include "../fire_mesh/FireMesh.h"
#include "../fire_mesh/FireMeshStorage.h"
#include <set>
SmokeSensor
::
SmokeSensor
(
const
Building
*
b
,
const
&
filepath
,
const
&
updateintervall
,
const
&
finalTime
)
:
AbstractSensor
(
b
)
{
_FMStorage
=
new
FireMeshStorage
(
b
,
filepath
,
updateintervall
,
finalTime
);
}
SmokeSensor
::~
SmokeSensor
()
{
}
...
...
@@ -68,4 +75,16 @@ void SmokeSensor::execute(const Pedestrian * pedestrian, CognitiveMap * cognitiv
}
void
SmokeSensor
::
set_FMStorage
(
const
&
fmStorage
)
{
_FMStorage
=
fmStorage
;
}
const
FireMeshStorage
*
SmokeSensor
::
get_FMStorage
()
{
return
_FMStorage
;
}
routing/cognitive_map/sensor/SmokeSensor.h
View file @
b74b3931
...
...
@@ -12,21 +12,26 @@
#include "AbstractSensor.h"
class
Point
;
class
FireMeshStorage
;
class
SmokeSensor
:
public
AbstractSensor
{
public:
SmokeSensor
(
const
Building
*
b
)
:
AbstractSensor
(
b
)
{
}
SmokeSensor
(
const
Building
*
b
,
const
&
filepath
,
const
&
updateintervall
,
const
&
finalTime
);
virtual
~
SmokeSensor
();
std
::
string
GetName
()
const
;
void
execute
(
const
Pedestrian
*
,
CognitiveMap
*
)
const
;
void
set_FMStorage
(
const
&
fmStorage
);
const
FireMeshStorage
*
get_FMStorage
();
private:
std
::
shared_ptr
<
FireMeshStorage
>
_FMStorage
;
};
#endif // SMOKESENSOR_H
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