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
JPSreport
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
JuPedSim
JPSreport
Commits
256fcad6
Commit
256fcad6
authored
Jun 19, 2019
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue108' into 'develop'
Method D and I modifications See merge request
!20
parents
9a484516
c10b7732
Pipeline
#21868
passed with stages
in 32 seconds
Changes
6
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
380 additions
and
331 deletions
+380
-331
Analysis.cpp
Analysis.cpp
+20
-11
Analysis.h
Analysis.h
+2
-1
methods/Method_D.cpp
methods/Method_D.cpp
+16
-6
methods/Method_D.h
methods/Method_D.h
+1
-1
methods/Method_I.cpp
methods/Method_I.cpp
+326
-302
methods/Method_I.h
methods/Method_I.h
+15
-10
No files found.
Analysis.cpp
View file @
256fcad6
...
...
@@ -166,7 +166,8 @@ void Analysis::InitArgs(ArgumentParser* args)
_StopFramesMethodD
=
args
->
GetStopFramesMethodD
();
_IndividualFDFlags
=
args
->
GetIndividualFDFlags
();
_plotTimeseriesD
=
args
->
GetIsPlotTimeSeriesD
();
_geoPoly
=
ReadGeometry
(
args
->
GetGeometryFilename
(),
_areaForMethod_D
);
_geoPolyMethodD
=
ReadGeometry
(
args
->
GetGeometryFilename
(),
_areaForMethod_D
);
}
if
(
args
->
GetIsMethodI
())
{
_DoesUseMethodI
=
true
;
...
...
@@ -179,14 +180,19 @@ void Analysis::InitArgs(ArgumentParser* args)
_StopFramesMethodI
=
args
->
GetStopFramesMethodI
();
_IndividualFDFlags
=
args
->
GetIndividualFDFlags
();
_plotTimeseriesI
=
args
->
GetIsPlotTimeSeriesI
();
_geoPoly
=
ReadGeometry
(
args
->
GetGeometryFilename
(),
_areaForMethod_I
);
_geoPoly
MethodI
=
ReadGeometry
(
args
->
GetGeometryFilename
(),
_areaForMethod_I
);
}
if
(
_DoesUseMethodD
&&
_DoesUseMethodI
)
{
Log
->
Write
(
"Warning:
\t
Using both method D and I is not safe!"
);
// because ReadGeomtry() may be called twice
}
// ToDo: obsolete ?
// if( _DoesUseMethodD && _DoesUseMethodI)
// {
// Log->Write("Warning:\t Using both method D and I is not safe!");
// // because ReadGeometry() may be called twice (line 169 and 182)
// // overwrite _geoPoly -> new value for each Method
// Log->Write("Info:\t Using both method D and I is safe! :-)");
// }
_deltaF
=
args
->
GetDelatT_Vins
();
_cutByCircle
=
args
->
GetIsCutByCircle
();
_getProfile
=
args
->
GetIsGetProfile
();
...
...
@@ -336,6 +342,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path)
if
(
result_A
)
{
Log
->
Write
(
"INFO:
\t
Success with Method A using measurement area id %d!
\n
"
,
_areaForMethod_A
[
i
]
->
_id
);
std
::
cout
<<
"INFO:
\t
Success with Method A using measurement area id "
<<
_areaForMethod_A
[
i
]
->
_id
<<
"
\n
"
;
}
else
{
...
...
@@ -361,6 +368,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path)
if
(
result_B
)
{
Log
->
Write
(
"INFO:
\t
Success with Method B using measurement area id %d!
\n
"
,
_areaForMethod_B
[
i
]
->
_id
);
std
::
cout
<<
"INFO:
\t
Success with Method B using measurement area id "
<<
_areaForMethod_B
[
i
]
->
_id
<<
"
\n
"
;
}
else
{
...
...
@@ -385,6 +393,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path)
if
(
result_C
)
{
Log
->
Write
(
"INFO:
\t
Success with Method C using measurement area id %d!
\n
"
,
_areaForMethod_C
[
i
]
->
_id
);
std
::
cout
<<
"INFO:
\t
Success with Method C using measurement area id "
<<
_areaForMethod_C
[
i
]
->
_id
<<
"
\n
"
;
if
(
_plotTimeseriesC
[
i
])
{
string
parameters_Timeseries
=
" "
+
_scriptsLocation
.
string
()
+
...
...
@@ -417,7 +426,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path)
method_D
.
SetStartFrame
(
_StartFramesMethodD
[
i
]);
method_D
.
SetStopFrame
(
_StopFramesMethodD
[
i
]);
method_D
.
SetCalculateIndividualFD
(
_IndividualFDFlags
[
i
]);
method_D
.
SetGeometryPolygon
(
_geoPoly
[
_areaForMethod_D
[
i
]
->
_id
]);
method_D
.
SetGeometryPolygon
(
_geoPoly
MethodD
[
_areaForMethod_D
[
i
]
->
_id
]);
method_D
.
SetGeometryFileName
(
_geometryFileName
);
method_D
.
SetGeometryBoundaries
(
_lowVertexX
,
_lowVertexY
,
_highVertexX
,
_highVertexY
);
method_D
.
SetGridSize
(
_grid_size_X
,
_grid_size_Y
);
...
...
@@ -470,15 +479,15 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path)
method_I
.
SetStartFrame
(
_StartFramesMethodI
[
i
]);
method_I
.
SetStopFrame
(
_StopFramesMethodI
[
i
]);
method_I
.
SetCalculateIndividualFD
(
_IndividualFDFlags
[
i
]);
method_I
.
SetGeometryPolygon
(
_geoPoly
[
_areaForMethod_I
[
i
]
->
_id
]);
method_I
.
SetGeometryPolygon
(
_geoPoly
MethodI
[
_areaForMethod_I
[
i
]
->
_id
]);
method_I
.
SetGeometryFileName
(
_geometryFileName
);
method_I
.
SetGeometryBoundaries
(
_lowVertexX
,
_lowVertexY
,
_highVertexX
,
_highVertexY
);
method_I
.
SetGridSize
(
_grid_size_X
,
_grid_size_Y
);
method_I
.
SetOutputVoronoiCellData
(
_outputGraph
);
method_I
.
SetPlotVoronoiGraph
(
_plotGraph
);
//
method_I.SetPlotVoronoiGraph(_plotGraph);
method_I
.
SetPlotVoronoiIndex
(
_plotIndex
);
method_I
.
SetDimensional
(
_isOneDimensional
);
method_I
.
SetCalculateProfiles
(
_getProfile
);
//
method_I.SetCalculateProfiles(_getProfile);
method_I
.
SetTrajectoriesLocation
(
path
);
if
(
_cutByCircle
)
{
...
...
Analysis.h
View file @
256fcad6
...
...
@@ -111,7 +111,8 @@ private:
Building
*
_building
;
//polygon_2d _geoPoly;
std
::
map
<
int
,
polygon_2d
>
_geoPoly
;
std
::
map
<
int
,
polygon_2d
>
_geoPolyMethodD
;
std
::
map
<
int
,
polygon_2d
>
_geoPolyMethodI
;
double
_grid_size_X
;
// the size of the grid
double
_grid_size_Y
;
...
...
methods/Method_D.cpp
View file @
256fcad6
...
...
@@ -140,6 +140,7 @@ bool Method_D::Process (const PedData& peddata,const fs::path& scriptsLocation,
vector
<
int
>
IdInFrame
=
peddata
.
GetIdInFrame
(
frameNr
,
ids
,
zPos_measureArea
);
vector
<
double
>
XInFrame
=
peddata
.
GetXInFrame
(
frameNr
,
ids
,
zPos_measureArea
);
vector
<
double
>
YInFrame
=
peddata
.
GetYInFrame
(
frameNr
,
ids
,
zPos_measureArea
);
vector
<
double
>
ZInFrame
=
peddata
.
GetZInFrame
(
frameNr
,
ids
,
zPos_measureArea
);
vector
<
double
>
VInFrame
=
peddata
.
GetVInFrame
(
frameNr
,
ids
,
zPos_measureArea
);
//vector int to_remove
//------------------------------Remove peds outside geometry------------------------------------------
...
...
@@ -151,6 +152,7 @@ bool Method_D::Process (const PedData& peddata,const fs::path& scriptsLocation,
IdInFrame
.
erase
(
IdInFrame
.
begin
()
+
i
);
XInFrame
.
erase
(
XInFrame
.
begin
()
+
i
);
YInFrame
.
erase
(
YInFrame
.
begin
()
+
i
);
ZInFrame
.
erase
(
ZInFrame
.
begin
()
+
i
);
VInFrame
.
erase
(
VInFrame
.
begin
()
+
i
);
i
--
;
}
...
...
@@ -189,7 +191,8 @@ bool Method_D::Process (const PedData& peddata,const fs::path& scriptsLocation,
{
if
(
!
_isOneDimensional
)
{
GetIndividualFD
(
polygons
,
VInFrame
,
IdInFrame
,
_areaForMethod_D
->
_poly
,
str_frid
);
// TODO polygons_id
// GetIndividualFD(polygons,VInFrame, IdInFrame, _areaForMethod_D->_poly, str_frid); // TODO polygons_id
GetIndividualFD
(
polygons
,
VInFrame
,
IdInFrame
,
_areaForMethod_D
->
_poly
,
str_frid
,
XInFrame
,
YInFrame
,
ZInFrame
);
}
}
if
(
_getProfile
)
...
...
@@ -257,7 +260,7 @@ bool Method_D::OpenFileIndividualFD()
{
fs
::
path
trajFileName
(
"_id_"
+
_measureAreaId
+
".dat"
);
fs
::
path
indFDPath
(
"Fundamental_Diagram"
);
indFDPath
=
_outputLocation
/
indFDPath
/
"IndividualFD"
/
(
_trajName
.
string
()
+
trajFileName
.
string
());
indFDPath
=
_outputLocation
/
indFDPath
/
"IndividualFD"
/
(
"IFD_D_"
+
_trajName
.
string
()
+
trajFileName
.
string
());
string
Individualfundment
=
indFDPath
.
string
();
if
((
_fIndividualFD
=
Analysis
::
CreateFile
(
Individualfundment
))
==
nullptr
)
{
...
...
@@ -268,11 +271,11 @@ bool Method_D::OpenFileIndividualFD()
{
if
(
_isOneDimensional
)
{
fprintf
(
_fIndividualFD
,
"#framerate (fps):
\t
%.2f
\n\n
#Frame
\t
PedId
\t
Individual density(m^(-1))
\t
Individual velocity(m/s)
\t
Headway(m)
\n
"
,
_fps
);
fprintf
(
_fIndividualFD
,
"#framerate (fps):
\t
%.2f
\n\n
#Frame
\t
PersID
\t
Individual density(m^(-1))
\t
Individual velocity(m/s)
\t
Headway(m)
\n
"
,
_fps
);
}
else
{
fprintf
(
_fIndividualFD
,
"#framerate (fps):
\t
%.2f
\n\n
#Frame
\t
PedId
\t
Individual density(m^(-2))
\t
Individual velocity(m/s)
\t
Voronoi Polygon
\t
Intersection Polygon
\n
"
,
_fps
);
fprintf
(
_fIndividualFD
,
"#framerate (fps):
\t
%.2f
\n\n
#Frame
\t
PersID
\t
x/m
\t
y/m
\t
z/m
\t
Individual density(m^(-2))
\t
Individual velocity(m/s)
\t
Voronoi Polygon
\t
Intersection Polygon
\n
"
,
_fps
);
}
return
true
;
}
...
...
@@ -561,10 +564,11 @@ void Method_D::OutputVoroGraph(const string & frameId, std::vector<std::pair<po
return polygon_str;
}*/
void
Method_D
::
GetIndividualFD
(
const
vector
<
polygon_2d
>&
polygon
,
const
vector
<
double
>&
Velocity
,
const
vector
<
int
>&
Id
,
const
polygon_2d
&
measureArea
,
const
string
&
frid
)
void
Method_D
::
GetIndividualFD
(
const
vector
<
polygon_2d
>&
polygon
,
const
vector
<
double
>&
Velocity
,
const
vector
<
int
>&
Id
,
const
polygon_2d
&
measureArea
,
const
string
&
frid
,
vector
<
double
>&
XInFrame
,
vector
<
double
>&
YInFrame
,
vector
<
double
>&
ZInFrame
)
{
double
uniquedensity
=
0
;
double
uniquevelocity
=
0
;
double
x
,
y
,
z
;
int
uniqueId
=
0
;
int
temp
=
0
;
for
(
const
auto
&
polygon_iterator
:
polygon
)
...
...
@@ -581,9 +585,15 @@ void Method_D::GetIndividualFD(const vector<polygon_2d>& polygon, const vector<d
uniquedensity
=
1.0
/
(
area
(
polygon_iterator
)
*
CMtoM
*
CMtoM
);
uniquevelocity
=
Velocity
[
temp
];
uniqueId
=
Id
[
temp
];
fprintf
(
_fIndividualFD
,
"%s
\t
%d
\t
%.3f
\t
%.3f
\t
%s
\t
%s
\n
"
,
x
=
XInFrame
[
temp
]
*
CMtoM
;
y
=
YInFrame
[
temp
]
*
CMtoM
;
z
=
ZInFrame
[
temp
]
*
CMtoM
;
fprintf
(
_fIndividualFD
,
"%s
\t
%d
\t
%.4f
\t
%.4f
\t
%.4f
\t
%.4f
\t
%.4f
\t
%s
\t
%s
\n
"
,
frid
.
c_str
(),
uniqueId
,
x
,
y
,
z
,
uniquedensity
,
uniquevelocity
,
polygon_str
.
c_str
(),
...
...
methods/Method_D.h
View file @
256fcad6
...
...
@@ -103,7 +103,7 @@ private:
std
::
tuple
<
double
,
double
>
GetVoronoiDensityVelocity
(
const
std
::
vector
<
polygon_2d
>&
polygon
,
const
std
::
vector
<
double
>&
Velocity
,
const
polygon_2d
&
measureArea
);
void
GetProfiles
(
const
std
::
string
&
frameId
,
const
std
::
vector
<
polygon_2d
>&
polygons
,
const
std
::
vector
<
double
>&
velocity
);
void
OutputVoroGraph
(
const
std
::
string
&
frameId
,
std
::
vector
<
std
::
pair
<
polygon_2d
,
int
>
>&
polygons
,
int
numPedsInFrame
,
const
std
::
vector
<
double
>&
VInFrame
);
void
GetIndividualFD
(
const
std
::
vector
<
polygon_2d
>&
polygon
,
const
std
::
vector
<
double
>&
Velocity
,
const
std
::
vector
<
int
>&
Id
,
const
polygon_2d
&
measureArea
,
const
std
::
string
&
frid
);
void
GetIndividualFD
(
const
std
::
vector
<
polygon_2d
>&
polygon
,
const
std
::
vector
<
double
>&
Velocity
,
const
std
::
vector
<
int
>&
Id
,
const
polygon_2d
&
measureArea
,
const
std
::
string
&
frid
,
std
::
vector
<
double
>&
XInFrame
,
std
::
vector
<
double
>&
YInFrame
,
std
::
vector
<
double
>&
ZInFrame
);
/**
* Reduce the precision of the points to two digits
* @param polygon
...
...
methods/Method_I.cpp
View file @
256fcad6
This diff is collapsed.
Click to expand it.
methods/Method_I.h
View file @
256fcad6
...
...
@@ -51,9 +51,9 @@ public:
void
SetGeometryFileName
(
const
fs
::
path
&
geometryFile
);
void
SetGeometryBoundaries
(
double
minX
,
double
minY
,
double
maxX
,
double
maxY
);
void
SetGridSize
(
double
x
,
double
y
);
void
SetCalculateProfiles
(
bool
calcProfile
);
void
SetCalculateProfiles
(
bool
calcProfile
);
// ToDo: obsolete ?
void
SetOutputVoronoiCellData
(
bool
outputCellData
);
void
SetPlotVoronoiGraph
(
bool
plotVoronoiGraph
);
void
SetPlotVoronoiGraph
(
bool
plotVoronoiGraph
);
// ToDo: obsolete ?
void
SetPlotVoronoiIndex
(
bool
plotVoronoiIndex
);
void
SetMeasurementArea
(
MeasurementArea_B
*
area
);
void
SetDimensional
(
bool
dimension
);
...
...
@@ -70,11 +70,11 @@ private:
fs
::
path
_outputLocation
;
fs
::
path
_scriptsLocation
;
bool
_calcIndividualFD
;
polygon_2d
_areaIndividualFD
;
bool
_getProfile
;
bool
_outputVoronoiCellData
;
bool
_plotVoronoiCellData
;
bool
_plotVoronoiIndex
;
polygon_2d
_areaIndividualFD
;
// ToDo: obsolete ?
bool
_getProfile
;
// ToDo: obsolete ?
bool
_outputVoronoiCellData
;
// ToDo: obsolete ?
bool
_plotVoronoiCellData
;
// ToDo: obsolete ?
bool
_plotVoronoiIndex
;
// ToDo: obsolete ?
bool
_isOneDimensional
;
bool
_cutByCircle
;
//Adjust whether cut each original voronoi cell by a circle
double
_cutRadius
;
...
...
@@ -86,10 +86,10 @@ private:
double
_geoMaxY
;
FILE
*
_fVoronoiRhoV
;
FILE
*
_fIndividualFD
;
double
_grid_size_X
;
// the size of the grid
double
_grid_size_Y
;
double
_grid_size_X
;
// the size of the grid
// ToDo: obsolete ?
double
_grid_size_Y
;
// ToDo: obsolete ?
float
_fps
;
bool
OpenFileMethodI
();
bool
OpenFileMethodI
();
// ToDo: obsolete ?
bool
OpenFileIndividualFD
();
fs
::
path
_geometryFileName
;
fs
::
path
_trajectoryPath
;
...
...
@@ -99,11 +99,13 @@ private:
std
::
vector
<
std
::
pair
<
polygon_2d
,
int
>
>
GetPolygons
(
std
::
vector
<
double
>&
XInFrame
,
std
::
vector
<
double
>&
YInFrame
,
std
::
vector
<
double
>&
VInFrame
,
std
::
vector
<
int
>&
IdInFrame
);
// ToDo: This functions are obsolete.
void
OutputVoronoiResults
(
const
std
::
vector
<
polygon_2d
>&
polygons
,
const
std
::
string
&
frid
,
const
std
::
vector
<
double
>&
VInFrame
);
std
::
tuple
<
double
,
double
>
GetVoronoiDensityVelocity
(
const
std
::
vector
<
polygon_2d
>&
polygon
,
const
std
::
vector
<
double
>&
Velocity
,
const
polygon_2d
&
measureArea
);
void
GetProfiles
(
const
std
::
string
&
frameId
,
const
std
::
vector
<
polygon_2d
>&
polygons
,
const
std
::
vector
<
double
>&
velocity
);
void
OutputVoroGraph
(
const
std
::
string
&
frameId
,
std
::
vector
<
std
::
pair
<
polygon_2d
,
int
>
>&
polygons
,
int
numPedsInFrame
,
const
std
::
vector
<
double
>&
VInFrame
);
void
GetIndividualFD
(
const
std
::
vector
<
polygon_2d
>&
polygon
,
const
std
::
vector
<
double
>&
Velocity
,
const
std
::
vector
<
int
>&
Id
,
const
std
::
string
&
frid
);
void
GetIndividualFD
(
const
std
::
vector
<
polygon_2d
>&
polygon
,
const
std
::
vector
<
double
>&
Velocity
,
const
std
::
vector
<
int
>&
Id
,
const
std
::
string
&
frid
,
std
::
vector
<
double
>&
XInFrame
,
std
::
vector
<
double
>&
YInFrame
,
std
::
vector
<
double
>&
ZInFrame
);
/**
* Reduce the precision of the points to two digits
...
...
@@ -111,7 +113,10 @@ private:
*/
void
CalcVoronoiResults1D
(
std
::
vector
<
double
>&
XInFrame
,
std
::
vector
<
double
>&
VInFrame
,
std
::
vector
<
int
>&
IdInFrame
,
const
polygon_2d
&
measureArea
,
const
std
::
string
&
frid
);
void
ReducePrecision
(
polygon_2d
&
polygon
);
// ToDo: This function is obsolete.
bool
IsPedInGeometry
(
int
frames
,
int
peds
,
double
**
Xcor
,
double
**
Ycor
,
int
*
firstFrame
,
int
*
lastFrame
);
//check whether all the pedestrians are in the geometry
double
getOverlapRatio
(
const
double
&
left
,
const
double
&
right
,
const
double
&
measurearea_left
,
const
double
&
measurearea_right
);
bool
IsPointsOnOneLine
(
std
::
vector
<
double
>&
XInFrame
,
std
::
vector
<
double
>&
YInFrame
);
};
...
...
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