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
45d7003e
Verified
Commit
45d7003e
authored
Mar 01, 2019
by
Mohcine Chraibi
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: Save index of pedestrians in a Matrix
untested..
parent
32ae45bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
Analysis.cpp
Analysis.cpp
+1
-1
methods/PedData.cpp
methods/PedData.cpp
+11
-9
methods/PedData.h
methods/PedData.h
+3
-1
No files found.
Analysis.cpp
View file @
45d7003e
...
...
@@ -283,7 +283,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path)
for
(
int
frameNr
=
0
;
frameNr
<
data
.
GetNumFrames
();
frameNr
++
)
{
vector
<
int
>
ids
=
_peds_t
[
frameNr
];
vector
<
int
>
IdInFrame
=
data
.
GetIdInFrame
(
ids
);
vector
<
int
>
IdInFrame
=
data
.
GetIdInFrame
(
frameNr
,
ids
);
vector
<
double
>
XInFrame
=
data
.
GetXInFrame
(
frameNr
,
ids
);
vector
<
double
>
YInFrame
=
data
.
GetYInFrame
(
frameNr
,
ids
);
for
(
unsigned
int
i
=
0
;
i
<
IdInFrame
.
size
();
i
++
)
...
...
methods/PedData.cpp
View file @
45d7003e
...
...
@@ -240,8 +240,6 @@ bool PedData::InitializeVariables(const fs::path& filename)
Log
->
Write
(
"INFO: Total number of Agents: %d"
,
_numPeds
);
CreateGlobalVariables
(
_numPeds
,
_numFrames
);
Log
->
Write
(
"INFO: Create Global Variables done"
);
for
(
int
i
=
_minID
;
i
<
_minID
+
_numPeds
;
i
++
){
int
firstFrameIndex
=
INT_MAX
;
//The first frame index of a pedestrian
int
lastFrameIndex
=-
1
;
//The last frame index of a pedestrian
...
...
@@ -303,6 +301,7 @@ bool PedData::InitializeVariables(const fs::path& filename)
_xCor
(
ID
,
frm
)
=
x
;
_yCor
(
ID
,
frm
)
=
y
;
_zCor
(
ID
,
frm
)
=
z
;
_id
(
ID
,
frm
)
=
_IdsTXT
[
i
];
if
(
_vComponent
==
"F"
)
{
_vComp
(
ID
,
frm
)
=
vcmp
[
i
];
...
...
@@ -317,6 +316,7 @@ bool PedData::InitializeVariables(const fs::path& filename)
//save the data for each frame
for
(
unsigned
int
i
=
0
;
i
<
_FramesTXT
.
size
();
i
++
)
{
int
id
=
_IdsTXT
[
i
]
-
_minID
;
// this make the assumption that
// indexes in the trajectories
// are consecutive
...
...
@@ -331,7 +331,6 @@ bool PedData::InitializeVariables(const fs::path& filename)
{
id
=
std
::
distance
(
unique_ids
.
begin
(),
itIds
);
}
int
t
=
_FramesTXT
[
i
]
-
_minFrame
;
_peds_t
[
t
].
push_back
(
id
);
...
...
@@ -339,7 +338,6 @@ bool PedData::InitializeVariables(const fs::path& filename)
return
true
;
}
// initialize the global variables. xml format
bool
PedData
::
InitializeVariables
(
TiXmlElement
*
xRootNode
)
{
...
...
@@ -433,6 +431,7 @@ bool PedData::InitializeVariables(TiXmlElement* xRootNode)
_xCor
(
ID
,
frameNr
)
=
x
*
M2CM
;
_yCor
(
ID
,
frameNr
)
=
y
*
M2CM
;
_zCor
(
ID
,
frameNr
)
=
z
*
M2CM
;
_id
(
ID
,
frameNr
)
=
ID
+
_minID
;
if
(
_vComponent
==
"F"
)
{
if
(
xAgent
->
Attribute
(
"VD"
))
...
...
@@ -574,13 +573,12 @@ vector<double> PedData::GetZInFrame(int frame, const vector<int>& ids) const
return
ZInFrame
;
}
vector
<
int
>
PedData
::
GetIdInFrame
(
const
vector
<
int
>&
ids
)
const
vector
<
int
>
PedData
::
GetIdInFrame
(
int
frame
,
const
vector
<
int
>&
ids
)
const
{
vector
<
int
>
IdInFrame
;
for
(
int
id
:
ids
)
{
id
=
id
+
_minID
;
IdInFrame
.
push_back
(
id
);
IdInFrame
.
push_back
(
_id
(
id
,
frame
));
}
return
IdInFrame
;
}
...
...
@@ -594,12 +592,14 @@ vector<int> PedData::GetIdInFrame(int frame, const vector<int>& ids, double zPos
{
if
(
fabs
(
_zCor
(
id
,
frame
)
-
zPos
*
M2CM
)
<
J_EPS_EVENT
)
{
IdInFrame
.
push_back
(
id
+
_minID
);
//IdInFrame.push_back(id +_minID);
IdInFrame
.
push_back
(
_id
(
id
,
frame
));
}
}
else
{
IdInFrame
.
push_back
(
id
+
_minID
);
// IdInFrame.push_back(id +_minID);
IdInFrame
.
push_back
(
_id
(
id
,
frame
));
}
}
return
IdInFrame
;
...
...
@@ -736,6 +736,8 @@ void PedData::CreateGlobalVariables(int numPeds, int numFrames)
_yCor
=
ub
::
matrix
<
double
>
(
numPeds
,
numFrames
);
Log
->
Write
(
"INFO: allocate memory for zCor"
);
_zCor
=
ub
::
matrix
<
double
>
(
numPeds
,
numFrames
);
Log
->
Write
(
"INFO: allocate memory for index"
);
_id
=
ub
::
matrix
<
double
>
(
numPeds
,
numFrames
);
Log
->
Write
(
"INFO: allocate memory for vComp"
);
_vComp
=
ub
::
matrix
<
std
::
string
>
(
numPeds
,
numFrames
);
Log
->
Write
(
" Finished memory allocation"
);
...
...
methods/PedData.h
View file @
45d7003e
...
...
@@ -67,9 +67,10 @@ public:
ub
::
matrix
<
double
>
GetXCor
()
const
;
ub
::
matrix
<
double
>
GetYCor
()
const
;
ub
::
matrix
<
double
>
GetZCor
()
const
;
ub
::
matrix
<
double
>
GetId
()
const
;
int
*
GetFirstFrame
()
const
;
int
*
GetLastFrame
()
const
;
std
::
vector
<
int
>
GetIdInFrame
(
const
std
::
vector
<
int
>&
ids
)
const
;
std
::
vector
<
int
>
GetIdInFrame
(
int
frame
,
const
std
::
vector
<
int
>&
ids
)
const
;
std
::
vector
<
int
>
GetIdInFrame
(
int
frame
,
const
std
::
vector
<
int
>&
ids
,
double
zPos
)
const
;
std
::
vector
<
double
>
GetXInFrame
(
int
frame
,
const
std
::
vector
<
int
>&
ids
,
double
zPos
)
const
;
std
::
vector
<
double
>
GetYInFrame
(
int
frame
,
const
std
::
vector
<
int
>&
ids
,
double
zPos
)
const
;
...
...
@@ -108,6 +109,7 @@ private:
ub
::
matrix
<
double
>
_xCor
;
ub
::
matrix
<
double
>
_yCor
;
ub
::
matrix
<
double
>
_zCor
;
ub
::
matrix
<
double
>
_id
;
ub
::
matrix
<
std
::
string
>
_vComp
;
};
...
...
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