Commit 5dc835ac authored by Ulrich Kemloh's avatar Ulrich Kemloh

Cleaning and memomry management.

parent 9fd5ea1e
......@@ -213,6 +213,7 @@ bool Simulation::InitArgs(const ArgumentParser& args)
_fps = args.Getfps();
sprintf(tmp, "\tfps: %f\n", _fps);
s.append(tmp);
//Log->Write(s.c_str());
_routingEngine = args.GetRoutingEngine();
auto distributor = std::unique_ptr<PedDistributor>(new PedDistributor(_argsParser.GetProjectFile(), _argsParser.GetAgentsParameters(),_argsParser.GetSeed()));
......@@ -220,6 +221,7 @@ bool Simulation::InitArgs(const ArgumentParser& args)
_building = std::unique_ptr<Building>(new Building(args.GetProjectFile(), args.GetProjectRootDir(), *_routingEngine, *distributor, args.GetLinkedCellSize()));
// Initialize the agents sources that have been collected in the pedestrians distributor
_agentSrcManager.SetBuilding(_building.get());
for (const auto& src: distributor->GetAgentsSources())
{
_agentSrcManager.AddSource(src);
......
......@@ -77,7 +77,7 @@ ArgumentParser::ArgumentParser()
//pNumberFilename = "inputfiles/persons.xml";
pSolver = 1;
_projectFile = "";
pTmax = 500;
pTmax = 900;
pfps = 1.0;
pdt = 0.01;
pExitStrategy = 2;
......@@ -116,13 +116,13 @@ ArgumentParser::ArgumentParser()
pSeed = 0;
pFormat = FORMAT_XML_PLAIN;
pPort = -1;
pHostname = "localhost";
_hostname = "localhost";
_embedMesh = 0;
pMaxOpenMPThreads = omp_get_thread_num();
_maxOpenMPThreads = omp_get_thread_num();
_profilingFlag = false;
_hpcFlag = 0;
_agentsParameters= std::map<int, std::shared_ptr<AgentsParameters> >();
p_routingengine = std::shared_ptr<RoutingEngine>(new RoutingEngine());
_routingengine = std::shared_ptr<RoutingEngine>(new RoutingEngine());
_showStatistics=false;
}
......@@ -276,19 +276,19 @@ bool ArgumentParser::ParseIniFile(string inifile)
else {
n = max_cpus;
}
pMaxOpenMPThreads = n;
Log->Write("INFO: \tnum_threads <%d>", pMaxOpenMPThreads);
_maxOpenMPThreads = n;
Log->Write("INFO: \tnum_threads <%d>", _maxOpenMPThreads);
#ifdef _OPENMP
if(n < omp_get_max_threads() )
omp_set_num_threads(pMaxOpenMPThreads);
omp_set_num_threads(_maxOpenMPThreads);
#endif
}
else { // no num_threads tag
pMaxOpenMPThreads = max_cpus;
_maxOpenMPThreads = max_cpus;
#ifdef _OPENMP
omp_set_num_threads(pMaxOpenMPThreads);
omp_set_num_threads(_maxOpenMPThreads);
#endif
Log->Write("INFO: \t Default num_threads <%d>", pMaxOpenMPThreads);
Log->Write("INFO: \t Default num_threads <%d>", _maxOpenMPThreads);
}
//logfile
if (xMainNode->FirstChild("logfile"))
......@@ -355,10 +355,10 @@ bool ArgumentParser::ParseIniFile(string inifile)
const char* tmp =
xTrajectories->FirstChildElement("socket")->Attribute("hostname");
if (tmp)
pHostname = tmp;
_hostname = tmp;
xTrajectories->FirstChildElement("socket")->Attribute("port", &pPort);
Log->Write("INFO: \tStreaming results to output [%s:%d] ",
pHostname.c_str(), pPort);
_hostname.c_str(), pPort);
}
}
......@@ -744,37 +744,37 @@ bool ArgumentParser::ParseRoutingStrategies(TiXmlNode *routingNode)
if (strategy == "local_shortest") {
pRoutingStrategies.push_back(make_pair(id, ROUTING_LOCAL_SHORTEST));
Router *r = new GlobalRouter(id, ROUTING_LOCAL_SHORTEST);
p_routingengine->AddRouter(r);
_routingengine->AddRouter(r);
}
else if (strategy == "global_shortest") {
pRoutingStrategies.push_back(make_pair(id, ROUTING_GLOBAL_SHORTEST));
Router *r = new GlobalRouter(id, ROUTING_GLOBAL_SHORTEST);
p_routingengine->AddRouter(r);
_routingengine->AddRouter(r);
}
else if (strategy == "quickest") {
pRoutingStrategies.push_back(make_pair(id, ROUTING_QUICKEST));
Router *r = new QuickestPathRouter(id, ROUTING_QUICKEST);
p_routingengine->AddRouter(r);
_routingengine->AddRouter(r);
}
else if (strategy == "nav_mesh") {
pRoutingStrategies.push_back(make_pair(id, ROUTING_NAV_MESH));
Router *r = new MeshRouter(id, ROUTING_NAV_MESH);
p_routingengine->AddRouter(r);
_routingengine->AddRouter(r);
}
else if (strategy == "dummy") {
pRoutingStrategies.push_back(make_pair(id, ROUTING_DUMMY));
Router *r = new DummyRouter(id, ROUTING_DUMMY);
p_routingengine->AddRouter(r);
_routingengine->AddRouter(r);
}
else if (strategy == "global_safest") {
pRoutingStrategies.push_back(make_pair(id, ROUTING_SAFEST));
Router *r = new SafestPathRouter(id, ROUTING_SAFEST);
p_routingengine->AddRouter(r);
_routingengine->AddRouter(r);
}
else if (strategy == "cognitive_map") {
pRoutingStrategies.push_back(make_pair(id, ROUTING_COGNITIVEMAP));
Router *r = new CognitiveMapRouter(id, ROUTING_COGNITIVEMAP);
p_routingengine->AddRouter(r);
_routingengine->AddRouter(r);
Log->Write("\nINFO: \tUsing CognitiveMapRouter");
///Parsing additional options
......@@ -802,7 +802,7 @@ bool ArgumentParser::ParseCogMapOpts(TiXmlNode *routerNode)
}
/// static_cast to get access to the method 'addOption' of the CognitiveMapRouter
CognitiveMapRouter* r = static_cast<CognitiveMapRouter*>(p_routingengine->GetAvailableRouters().back());
CognitiveMapRouter* r = static_cast<CognitiveMapRouter*>(_routingengine->GetAvailableRouters().back());
std::vector<std::string> sensorVec;
for (TiXmlElement* e = sensorNode->FirstChildElement("sensor"); e;
......@@ -927,11 +927,11 @@ const FileFormat& ArgumentParser::GetFileFormat() const
}
const string& ArgumentParser::GetHostname() const
{
return pHostname;
return _hostname;
}
void ArgumentParser::SetHostname(const string& hostname)
{
pHostname = hostname;
_hostname = hostname;
}
int ArgumentParser::GetPort() const
{
......@@ -984,7 +984,7 @@ bool ArgumentParser::GetLinkedCells() const
std::shared_ptr<RoutingEngine> ArgumentParser::GetRoutingEngine() const
{
return p_routingengine;
return _routingengine;
}
vector<pair<int, RoutingStrategy> > ArgumentParser::GetRoutingStrategy() const
......@@ -1151,7 +1151,7 @@ const string& ArgumentParser::GetErrorLogFile() const
int ArgumentParser::GetMaxOpenMPThreads() const
{
return pMaxOpenMPThreads;
return _maxOpenMPThreads;
}
const string& ArgumentParser::GetTrajectoriesFile() const
{
......
......@@ -53,7 +53,7 @@ class ArgumentParser
{
private:
string pHostname;
string _hostname;
string pTrajectoriesFile;
string pErrorLogFile;
string pNavMeshFilename;
......@@ -96,7 +96,7 @@ private:
int pLog;
int pPort;
int _embedMesh;
int pMaxOpenMPThreads;
int _maxOpenMPThreads;
int pModel;
FileFormat pFormat;
vector<pair<int, RoutingStrategy> > pRoutingStrategies;
......@@ -110,7 +110,7 @@ private:
*/
std::shared_ptr<DirectionStrategy> p_exit_strategy;
std::shared_ptr<OperationalModel> p_op_model;
std::shared_ptr<RoutingEngine> p_routingengine;
std::shared_ptr<RoutingEngine> _routingengine;
private:
bool ParseGCFMModel(TiXmlElement* xGCFM);
......
......@@ -937,7 +937,6 @@ void Building::InitGrid(double cellSize)
y_max = y_max + 1*cellSize;
double boundaries[4] = { x_min, x_max, y_min, y_max };
int pedsCount = _allPedestians.size();
//no algorithms
// the domain is made of a single cell
......@@ -953,7 +952,8 @@ void Building::InitGrid(double cellSize)
Log->Write("INFO: \tInitializing the grid with cell size: %f ", cellSize);
}
_linkedCellGrid = new LCGrid(boundaries, cellSize, pedsCount);
//_linkedCellGrid = new LCGrid(boundaries, cellSize, _allPedestians.size());
_linkedCellGrid = new LCGrid(boundaries, cellSize, Pedestrian::GetAgentsCreated());
_linkedCellGrid->ShallowCopy(_allPedestians);
Log->Write("INFO: \tDone with Initializing the grid ");
......@@ -1169,9 +1169,12 @@ void Building::AddPedestrian(Pedestrian* ped)
void Building::GetPedestrians(int room, int subroom, std::vector<Pedestrian*>& peds) const
{
for(unsigned int p = 0;p<_allPedestians.size();p++){
Pedestrian* ped=_allPedestians[p];
if(room==ped->GetRoomID() && subroom==ped->GetSubRoomID())
//for(unsigned int p = 0;p<_allPedestians.size();p++){
// Pedestrian* ped=_allPedestians[p];
for (auto&& ped : _allPedestians)
{
if ((room == ped->GetRoomID()) && (subroom == ped->GetSubRoomID()))
{
peds.push_back(ped);
}
......
......@@ -75,7 +75,7 @@ xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/0.6/jps_ini_core.xsd">
</agents_distribution>
<agents_sources><!-- frequency in persons/minute -->
<source id="1" frequency="1" agents_max="10" group_id="0" caption="source 1">
<source id="1" frequency="1" agents_max="100" group_id="0" caption="source 1">
</source>
</agents_sources>
......
......@@ -43,48 +43,49 @@ using namespace std;
LCGrid::LCGrid(double boundaries[4], double cellsize, int nPeds)
{
pGrid_xmin=boundaries[0];
pGrid_xmax=boundaries[1];
pGrid_ymin=boundaries[2];
pGrid_ymax=boundaries[3];
pCellSize=cellsize;
pNpeds=nPeds;
_gridXmin=boundaries[0];
_gridXmax=boundaries[1];
_gridYmin=boundaries[2];
_gridYmax=boundaries[3];
_cellSize=cellsize;
_nPeds=nPeds;
// add 1 to ensure that the whole area is covered by cells if not divisible without remainder
pGridSizeX = (int) ((pGrid_xmax - pGrid_xmin) / pCellSize) + 1 + 2; // 1 dummy cell on each side
pGridSizeY = (int) ((pGrid_ymax - pGrid_ymin) / pCellSize) + 1 + 2; // 1 dummy cell on each side
_gridSizeX = (int) ((_gridXmax - _gridXmin) / _cellSize) + 1 + 2; // 1 dummy cell on each side
_gridSizeY = (int) ((_gridYmax - _gridYmin) / _cellSize) + 1 + 2; // 1 dummy cell on each side
// allocate memory for cells (2D-array) and initialize
pCellHead= new int *[pGridSizeY];
_cellHead= new int *[_gridSizeY];
for (int i = 0; i < pGridSizeY; ++i) {
pCellHead[i] = new int[pGridSizeX]; // nx columns
for (int i = 0; i < _gridSizeY; ++i) {
_cellHead[i] = new int[_gridSizeX]; // nx columns
for (int j = 0; j < pGridSizeX; ++j) {
pCellHead[i][j] = LIST_EMPTY;
for (int j = 0; j < _gridSizeX; ++j) {
_cellHead[i][j] = LIST_EMPTY;
}
}
// creating and resetting the pedestrians list
pList = new int[nPeds];
for(int i=0; i<nPeds; i++) pList[i]=0;
_list = new int[nPeds];
for(int i=0; i<nPeds; i++) _list[i]=0;
//allocating the place for the peds copy
pLocalPedsCopy=new Pedestrian*[nPeds];
for(int i=0; i<nPeds; i++) pLocalPedsCopy[i]=NULL;
_localPedsCopy=new Pedestrian*[nPeds];
for(int i=0; i<nPeds; i++) _localPedsCopy[i]=NULL;
}
LCGrid::~LCGrid()
{
for(int i=0; i<pNpeds; i++) {
if(!pLocalPedsCopy[i])
delete pLocalPedsCopy[i];
for(int i=0; i<_nPeds; i++) {
if(!_localPedsCopy[i])
delete _localPedsCopy[i];
}
delete [] pList;
delete [] pLocalPedsCopy;
for (int i = 0; i < pGridSizeY; ++i) delete[] pCellHead[i];
delete[] pCellHead;
delete [] _list;
delete [] _localPedsCopy;
for (int i = 0; i < _gridSizeY; ++i) delete[] _cellHead[i];
delete[] _cellHead;
}
void LCGrid::ShallowCopy(const vector<Pedestrian*>& peds)
......@@ -92,7 +93,7 @@ void LCGrid::ShallowCopy(const vector<Pedestrian*>& peds)
for(unsigned int p=0; p<peds.size(); p++) {
int id= peds[p]->GetID()-1;
pLocalPedsCopy[id]=peds[p];
_localPedsCopy[id]=peds[p];
}
}
......@@ -106,15 +107,15 @@ void LCGrid::Update(const vector<Pedestrian*>& peds)
Pedestrian* ped = peds[p];
int id=ped->GetID()-1;
// determine the cell coordinates of pedestrian i
int ix = (int) ((ped->GetPos().GetX() - pGrid_xmin) / pCellSize) + 1; // +1 because of dummy cells
int iy = (int) ((ped->GetPos().GetY() - pGrid_ymin) / pCellSize) + 1;
int ix = (int) ((ped->GetPos().GetX() - _gridXmin) / _cellSize) + 1; // +1 because of dummy cells
int iy = (int) ((ped->GetPos().GetY() - _gridYmin) / _cellSize) + 1;
//printf("[%f, %f] ",ped->GetPos().GetX(), ped->GetPos().GetY());
// create lists
//printf("[%d=%d] ",ped->GetPedIndex(),id);
pList[id] = pCellHead[iy][ix];
pCellHead[iy][ix] = id;
_list[id] = _cellHead[iy][ix];
_cellHead[iy][ix] = id;
pLocalPedsCopy[id]=ped;
_localPedsCopy[id]=ped;
}
}
......@@ -123,29 +124,29 @@ void LCGrid::Update(Pedestrian* ped)
{
int id=ped->GetID()-1;
// determine the cell coordinates of pedestrian i
int ix = (int) ((ped->GetPos().GetX() - pGrid_xmin) / pCellSize) + 1; // +1 because of dummy cells
int iy = (int) ((ped->GetPos().GetY() - pGrid_ymin) / pCellSize) + 1;
int ix = (int) ((ped->GetPos().GetX() - _gridXmin) / _cellSize) + 1; // +1 because of dummy cells
int iy = (int) ((ped->GetPos().GetY() - _gridYmin) / _cellSize) + 1;
// update the list previously created
pList[id] = pCellHead[iy][ix];
pCellHead[iy][ix] = id;
_list[id] = _cellHead[iy][ix];
_cellHead[iy][ix] = id;
// this is probably a pedestrian coming from the mpi routine, so made a copy
pLocalPedsCopy[id]=ped;
_localPedsCopy[id]=ped;
}
void LCGrid::ClearGrid()
{
// start by resetting the current list
for (int i = 0; i < pGridSizeY; ++i) {
for (int j = 0; j < pGridSizeX; ++j) {
pCellHead[i][j] = LIST_EMPTY;
for (int i = 0; i < _gridSizeY; ++i) {
for (int j = 0; j < _gridSizeX; ++j) {
_cellHead[i][j] = LIST_EMPTY;
}
}
for(int i=0; i<pNpeds; i++) {
pList[i]=LIST_EMPTY;
pLocalPedsCopy[i]=NULL;
for(int i=0; i<_nPeds; i++) {
_list[i]=LIST_EMPTY;
_localPedsCopy[i]=NULL;
}
}
......@@ -154,9 +155,9 @@ void LCGrid::HighlightNeighborhood(int pedID, Building* building)
// force spotlight activation
Pedestrian::SetColorMode(BY_SPOTLIGHT);
//darken all
const vector< Pedestrian* >& allPeds = building->GetAllPedestrians();
for(unsigned int p=0;p<allPeds.size();p++){
allPeds[p]->SetSpotlight(false);
for(auto&& ped: building->GetAllPedestrians())
{
ped->SetSpotlight(false);
}
Pedestrian* ped=building->GetPedestrian(pedID);
......@@ -164,20 +165,49 @@ void LCGrid::HighlightNeighborhood(int pedID, Building* building)
if(ped){
vector<Pedestrian*> neighbours;
GetNeighbourhood(ped,neighbours);
for(unsigned int p=0;p<neighbours.size();p++){
neighbours[p]->SetSpotlight(true);
}
for(auto&& p: neighbours)
p->SetSpotlight(true);
}
}
/*
void LCGrid::HighlightNeighborhood(int pedID, Building* building)
{
// force spotlight activation
Pedestrian::SetColorMode(BY_SPOTLIGHT);
//darken all
//const vector< Pedestrian* >& allPeds = building->GetAllPedestrians();
//for(unsigned int p=0;p<allPeds.size();p++){
// allPeds[p]->SetSpotlight(false);
//}
for(auto&& ped: building->GetAllPedestrians())
{
ped->SetSpotlight(false);
}
Pedestrian* ped=building->GetPedestrian(pedID);
//get and highlight the neighborhood
if(ped){
vector<Pedestrian*> neighbours;
GetNeighbourhood(ped,neighbours);
for(auto&& p: neighbours)
p->SetSpotlight(true);
//for(unsigned int p=0;p<neighbours.size();p++){
// neighbours[p]->SetSpotlight(true);
//}
}
}
*/
void LCGrid::GetNeighbourhood(const Pedestrian* ped, vector<Pedestrian*>& neighbourhood)
{
double xPed=ped->GetPos().GetX();
double yPed=ped->GetPos().GetY();
int l = (int) ((xPed - pGrid_xmin) / pCellSize) + 1; // +1 because of dummy cells
int k = (int) ((yPed - pGrid_ymin) / pCellSize) + 1;
int l = (int) ((xPed - _gridXmin) / _cellSize) + 1; // +1 because of dummy cells
int k = (int) ((yPed - _gridYmin) / _cellSize) + 1;
//-1 to get correct mapping in the array local
int myID=ped->GetID()-1;
......@@ -186,7 +216,7 @@ void LCGrid::GetNeighbourhood(const Pedestrian* ped, vector<Pedestrian*>& neighb
for (int i = l - 1; i <= l + 1; ++i) {
for (int j = k - 1; j <= k + 1; ++j) {
//printf(" i=%d j=%d k=%d l=%d\n",i,j,nx,ny);
int p = pCellHead[j][i];
int p = _cellHead[j][i];
// all peds in one cell
while (p != LIST_EMPTY) {
// double x=pLocalPedsCopy[p]->GetPos().GetX();
......@@ -194,28 +224,52 @@ void LCGrid::GetNeighbourhood(const Pedestrian* ped, vector<Pedestrian*>& neighb
// double dist=((x-xPed)*(x-xPed) + (y-yPed)*(y-yPed));
if(p!=myID) {
// if((dist<pCellSize*pCellSize) && (p!=myID)) {
neighbourhood.push_back(pLocalPedsCopy[p]);
neighbourhood.push_back(_localPedsCopy[p]);
}
// next ped
p = pList[p];
p = _list[p];
}
}
}
}
void LCGrid::GetNeighbourhood(const Point& pos, std::vector<Pedestrian*>& neighbourhood)
{
double xPed=pos.GetX();
double yPed=pos.GetY();
int l = (int) ((xPed - _gridXmin) / _cellSize) + 1; // +1 because of dummy cells
int k = (int) ((yPed - _gridYmin) / _cellSize) + 1;
// all neighbor cells
for (int i = l - 1; i <= l + 1; ++i) {
for (int j = k - 1; j <= k + 1; ++j) {
//printf(" i=%d j=%d k=%d l=%d\n",i,j,nx,ny);
int p = _cellHead[j][i];
// all peds in one cell
while (p != LIST_EMPTY)
{
neighbourhood.push_back(_localPedsCopy[p]);
p = _list[p]; // next ped
}
}
}
}
double LCGrid::GetCellSize()
{
return pCellSize;
return _cellSize;
}
void LCGrid::Dump()
{
for(int l =1; l<_gridSizeY-1; l++) {
for(int k=1; k<_gridSizeX-1; k++) {
for(int l =1; l<pGridSizeY-1; l++) {
for(int k=1; k<pGridSizeX-1; k++) {
int ped = pCellHead[l][k];
int ped = _cellHead[l][k];
if(ped==LIST_EMPTY) continue;
......@@ -224,12 +278,12 @@ void LCGrid::Dump()
for (int i = l - 1; i <= l + 1; ++i) {
for (int j = k - 1; j <= k + 1; ++j) {
// dummy cells will be empty
int p = pCellHead[i][j];
int p = _cellHead[i][j];
// all peds in one cell
while (p != LIST_EMPTY) {
printf("%d, ",p+1);
// next ped
p = pList[p];
p = _list[p];
}
}
}
......@@ -240,10 +294,10 @@ void LCGrid::Dump()
void LCGrid::dumpCellsOnly()
{
for(int l =1; l<pGridSizeY-1; l++) {
for(int k=1; k<pGridSizeX-1; k++) {
for(int l =1; l<_gridSizeY-1; l++) {
for(int k=1; k<_gridSizeX-1; k++) {
int ped = pCellHead[l][k];
int ped = _cellHead[l][k];
if(ped==LIST_EMPTY) continue;
......@@ -251,12 +305,12 @@ void LCGrid::dumpCellsOnly()
// all neighbor cells
// dummy cells will be empty
int p = pCellHead[l][k];
int p = _cellHead[l][k];
// all peds in one cell
while (p != LIST_EMPTY) {
printf("%d, ",p+1);
// next ped
p = pList[p];
p = _list[p];
}
printf("}\n");
}
......@@ -266,23 +320,23 @@ void LCGrid::dumpCellsOnly()
std::string LCGrid::ToXML()
{
string grid;
for (double x=pGrid_xmin;x<=pGrid_xmax;x+=pCellSize)
for (double x=_gridXmin;x<=_gridXmax;x+=_cellSize)
{
char wall[500] = "";
grid.append("\t\t<wall>\n");
sprintf(wall, "\t\t\t<point xPos=\"%.2f\" yPos=\"%.2f\"/>\n",x*FAKTOR, pGrid_ymin * FAKTOR);
sprintf(wall, "\t\t\t<point xPos=\"%.2f\" yPos=\"%.2f\"/>\n",x*FAKTOR, _gridYmin * FAKTOR);
grid.append(wall);
sprintf(wall, "\t\t\t<point xPos=\"%.2f\" yPos=\"%.2f\"/>\n",x*FAKTOR, pGrid_ymax * FAKTOR);
sprintf(wall, "\t\t\t<point xPos=\"%.2f\" yPos=\"%.2f\"/>\n",x*FAKTOR, _gridYmax * FAKTOR);
grid.append(wall);
grid.append("\t\t</wall>\n");
}
for (double y=pGrid_ymin;y<=pGrid_ymax;y+=pCellSize)
for (double y=_gridYmin;y<=_gridYmax;y+=_cellSize)
{
char wall[500] = "";
grid.append("\t\t<wall>\n");
sprintf(wall, "\t\t\t<point xPos=\"%.2f\" yPos=\"%.2f\"/>\n",pGrid_xmin*FAKTOR, y * FAKTOR);
sprintf(wall, "\t\t\t<point xPos=\"%.2f\" yPos=\"%.2f\"/>\n",_gridXmin*FAKTOR, y * FAKTOR);
grid.append(wall);
sprintf(wall, "\t\t\t<point xPos=\"%.2f\" yPos=\"%.2f\"/>\n",pGrid_xmax*FAKTOR, y * FAKTOR);
sprintf(wall, "\t\t\t<point xPos=\"%.2f\" yPos=\"%.2f\"/>\n",_gridXmax*FAKTOR, y * FAKTOR);
grid.append(wall);
grid.append("\t\t</wall>\n");
}
......
......@@ -32,7 +32,6 @@
*
**/
#ifndef LCGRID_H_
#define LCGRID_H_
......@@ -44,29 +43,27 @@
class Pedestrian;
class Building;
class LCGrid {
class LCGrid
{
private:
/// the 'first' pedestrian in each cell
int **pCellHead;
int **_cellHead;
/// the next pedestrians. more efficient than the double linked- list
int *pList;
int *_list;
/// number of cells in x- and y-direction respectively.
/// Also to be interpreted as cell coordinates in the grid
int pGridSizeX, pGridSizeY;
int _gridSizeX, _gridSizeY;
/// the cell size default to 2.2 metres
double pCellSize;
double _cellSize;
/// rectangular area for linked cells which covers the whole geometry
double pGrid_xmin, pGrid_xmax, pGrid_ymin, pGrid_ymax;
double _gridXmin, _gridXmax, _gridYmin, _gridYmax;
/// for convenience
/// will be delete in next versions
Pedestrian** pLocalPedsCopy;
Pedestrian** _localPedsCopy;
///total number of pedestrians
int pNpeds;
int _nPeds;