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
6fd2a795
Commit
6fd2a795
authored
Feb 24, 2019
by
tobias schroedter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP commit
parent
5f0a498d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
4 deletions
+71
-4
CMakeLists.txt
CMakeLists.txt
+1
-1
Simulation.cpp
Simulation.cpp
+1
-0
geometry/Building.cpp
geometry/Building.cpp
+2
-0
geometry/Point.cpp
geometry/Point.cpp
+3
-0
geometry/Point.h
geometry/Point.h
+2
-2
math/VelocityModel.cpp
math/VelocityModel.cpp
+23
-0
mpi/LCGrid.cpp
mpi/LCGrid.cpp
+35
-1
pedestrian/Pedestrian.cpp
pedestrian/Pedestrian.cpp
+3
-0
routing/Router.h
routing/Router.h
+1
-0
No files found.
CMakeLists.txt
View file @
6fd2a795
...
...
@@ -811,7 +811,7 @@ set(warning_flags "-Wall -Wextra")
# Initialize CXXFLAGS.
if
(
CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL
"Clang"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
warning_flags
}
"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
${
warning_flags
}
-
O0 -g -
Wunused-variable -Wunused-parameter -Wunused-function -Wshadow -Wunused -DTRACE_LOGGING"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
${
warning_flags
}
-Wunused-variable -Wunused-parameter -Wunused-function -Wshadow -Wunused -DTRACE_LOGGING"
)
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
endif
()
...
...
Simulation.cpp
View file @
6fd2a795
...
...
@@ -625,6 +625,7 @@ void Simulation::ProcessAgentsQueue()
/* std::cout << "Add to building : " << ped->GetPos()._x << ", " << ped->GetPos()._y << " t: "<< Pedestrian::GetGlobalTime() << std::endl; */
_building
->
AddPedestrian
(
ped
);
}
_building
->
UpdateGrid
();
// for(auto pp: _building->GetAllPedestrians())
// std::cout<< KBLU << "BUL: Simulation: " << pp->GetPos()._x << ", " << pp->GetPos()._y << " t: "<< Pedestrian::GetGlobalTime() <<RESET << std::endl;
...
...
geometry/Building.cpp
View file @
6fd2a795
...
...
@@ -38,6 +38,7 @@
#include "../mpi/LCGrid.h"
#include "../IO/GeoFileParser.h"
#include <filesystem>
#include <thread> // std::thread, std::thread::id, std::this_thread::get_id
namespace
fs
=
std
::
filesystem
;
...
...
@@ -1156,6 +1157,7 @@ bool Building::SanityCheck()
void
Building
::
UpdateGrid
()
{
// std::cout << Pedestrian::GetGlobalTime() <<":\t\tBuilding::UpdateGrid from: " << std::this_thread::get_id() <<std::endl;
_linkedCellGrid
->
Update
(
_allPedestians
);
}
...
...
geometry/Point.cpp
View file @
6fd2a795
...
...
@@ -35,6 +35,9 @@
Point
::
Point
(
const
Point
&
orig
)
{
// std::cout << "Point: " << toString() << std::endl;
// std::cout << "orig: " << toString() << std::endl;
_x
=
orig
.
_x
;
_y
=
orig
.
_y
;
}
...
...
geometry/Point.h
View file @
6fd2a795
...
...
@@ -39,8 +39,8 @@
class
Point
{
public:
double
_x
;
//*<x-coordinate of a 2-d point*/
double
_y
;
//*<y-coordinate of a 2-d point*/
double
_x
=
0.
;
//*<x-coordinate of a 2-d point*/
double
_y
=
0.
;
//*<y-coordinate of a 2-d point*/
public:
...
...
math/VelocityModel.cpp
View file @
6fd2a795
...
...
@@ -178,6 +178,9 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building*
partSize
=
((
int
)
nSize
>
nThreads
)
?
(
int
)
(
nSize
/
nThreads
)
:
(
int
)
nSize
;
if
(
partSize
==
(
int
)
nSize
)
nThreads
=
1
;
// not worthy to parallelize
//TODO richtig parallelisieren!
#pragma omp parallel default(shared) num_threads(nThreads)
{
vector
<
Point
>
result_acc
=
vector
<
Point
>
();
...
...
@@ -199,11 +202,31 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building*
vector
<
Pedestrian
*>
neighbours
;
building
->
GetGrid
()
->
GetNeighbourhood
(
ped
,
neighbours
);
double
time
=
Pedestrian
::
GetGlobalTime
();
int
size
=
(
int
)
neighbours
.
size
();
//// if (ped->GetID() == 71) {
//// std::cout << "------------------------------------" << std::endl;
// std::cout << Pedestrian::GetGlobalTime() << ":\t\tVelocity Model debug ped: " << ped->GetID()
// << "\t" << ped->GetPos().toString() << "\t" << size<< std::endl;
//// }
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
Pedestrian
*
ped1
=
neighbours
[
i
];
// if (ped->GetID() == 71) {
// std::cout << "Velocity Model debug ped1: " << ped1->GetID() << "\t" << ped1->GetPos().toString() <<std::endl;
// }
// std::cout << "Velocity Model debug ped1: " << ped1 << std::endl;
// std::cout << ped1->GetID() << std::endl;
if
(
ped1
==
nullptr
){
std
::
cout
<<
"Velocity Model debug: "
<<
size
<<
std
::
endl
;
}
//if they are in the same subroom
Point
p1
=
ped
->
GetPos
();
Point
p2
=
ped1
->
GetPos
();
//subrooms to consider when looking for neighbour for the 3d visibility
vector
<
SubRoom
*>
emptyVector
;
...
...
mpi/LCGrid.cpp
View file @
6fd2a795
...
...
@@ -36,9 +36,13 @@
#include"LCGrid.h"
#include "../pedestrian/Pedestrian.h"
#include <mutex>
using
namespace
std
;
std
::
mutex
grid_mutex
;
//FIXME:
#define MAX_AGENT_COUNT 10000 // 1000000
...
...
@@ -99,11 +103,12 @@ void LCGrid::ShallowCopy(const vector<Pedestrian*>& peds)
void
LCGrid
::
Update
(
const
vector
<
Pedestrian
*>&
peds
)
{
grid_mutex
.
lock
();
ClearGrid
();
for
(
auto
&
ped
:
peds
)
{
//Pedestrian* ped = peds[p];
//Pedestrian* ped = peds[p];
int
id
=
ped
->
GetID
()
-
1
;
// determine the cell coordinates of pedestrian i
int
ix
=
(
int
)
((
ped
->
GetPos
().
_x
-
_gridXmin
)
/
_cellSize
)
+
1
;
// +1 because of dummy cells
...
...
@@ -115,13 +120,22 @@ void LCGrid::Update(const vector<Pedestrian*>& peds)
_cellHead
[
iy
][
ix
]
=
id
;
_localPedsCopy
[
id
]
=
ped
;
// if (ped->GetID() == 71) {
// std::cout << "pos: " << ped->GetPos().toString() << " ix:" << ix << " iy:" << iy << std::endl;
// }
}
grid_mutex
.
unlock
();
}
// I hope you had called Clear() first
// todo: can be used to solve the issue with MAX_AGENT_COUNT
void
LCGrid
::
Update
(
Pedestrian
*
ped
)
{
grid_mutex
.
lock
();
int
id
=
ped
->
GetID
()
-
1
;
// determine the cell coordinates of pedestrian i
int
ix
=
(
int
)
((
ped
->
GetPos
().
_x
-
_gridXmin
)
/
_cellSize
)
+
1
;
// +1 because of dummy cells
...
...
@@ -133,6 +147,8 @@ void LCGrid::Update(Pedestrian* ped)
// this is probably a pedestrian coming from the mpi routine, so made a copy
_localPedsCopy
[
id
]
=
ped
;
grid_mutex
.
unlock
();
}
void
LCGrid
::
ClearGrid
()
...
...
@@ -202,6 +218,7 @@ void LCGrid::HighlightNeighborhood(int pedID, Building* building)
*/
void
LCGrid
::
GetNeighbourhood
(
const
Pedestrian
*
ped
,
vector
<
Pedestrian
*>&
neighbourhood
)
{
grid_mutex
.
lock
();
double
xPed
=
ped
->
GetPos
().
_x
;
double
yPed
=
ped
->
GetPos
().
_y
;
...
...
@@ -231,10 +248,25 @@ void LCGrid::GetNeighbourhood(const Pedestrian* ped, vector<Pedestrian*>& neighb
}
}
}
if
((
myID
==
70
)
&&
(
fmod
(
Pedestrian
::
GetGlobalTime
()
,
45.
)
==
0
)
){
std
::
cout
<<
Pedestrian
::
GetGlobalTime
()
<<
":
\t\t
Neighborhood of 71 "
<<
neighbourhood
.
size
()
<<
std
::
endl
;
for
(
auto
&
ped
:
neighbourhood
){
std
::
cout
<<
"Neighbor added: "
<<
ped
->
GetID
()
<<
" at "
<<
ped
->
GetPos
().
toString
()
<<
std
::
endl
;
}
std
::
cout
<<
"---------------------------"
<<
std
::
endl
;
}
grid_mutex
.
unlock
();
}
void
LCGrid
::
GetNeighbourhood
(
const
Point
&
pos
,
std
::
vector
<
Pedestrian
*>&
neighbourhood
)
{
grid_mutex
.
lock
();
double
xPed
=
pos
.
_x
;
double
yPed
=
pos
.
_y
;
...
...
@@ -255,6 +287,8 @@ void LCGrid::GetNeighbourhood(const Point& pos, std::vector<Pedestrian*>& neighb
}
}
}
grid_mutex
.
unlock
();
}
...
...
pedestrian/Pedestrian.cpp
View file @
6fd2a795
...
...
@@ -206,6 +206,9 @@ Pedestrian::Pedestrian(const StartDistribution& agentsParameters, Building& buil
Pedestrian
::~
Pedestrian
()
{
if
((
_id
>
72
)
&&
(
_id
<
81
)){
std
::
cout
<<
"Ped destructor"
<<
std
::
endl
;
}
}
...
...
routing/Router.h
View file @
6fd2a795
...
...
@@ -142,6 +142,7 @@ public:
void
SetTrips
(
const
Trips
&
trips
);
};
#endif
/* _ROUTING_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