Commit ffc59926 authored by Oliver Schmidts's avatar Oliver Schmidts

fixing little bugs and karthiks memory error

parent 95086b3f
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <cstdlib> #include <cstdlib>
#include <cmath>
using namespace std; using namespace std;
...@@ -56,8 +57,7 @@ int OutputHandler::GetErrors() ...@@ -56,8 +57,7 @@ int OutputHandler::GetErrors()
void OutputHandler::Write(const string& str) void OutputHandler::Write(const string& str)
{ {
if (this != NULL) cout << str << endl;
cout << str << endl;
} }
void OutputHandler::ProgressBar(double TotalPeds, double NowPeds) void OutputHandler::ProgressBar(double TotalPeds, double NowPeds)
...@@ -68,7 +68,7 @@ void OutputHandler::ProgressBar(double TotalPeds, double NowPeds) ...@@ -68,7 +68,7 @@ void OutputHandler::ProgressBar(double TotalPeds, double NowPeds)
int totaldotz=40; int totaldotz=40;
double fraction = NowPeds / TotalPeds; double fraction = NowPeds / TotalPeds;
// part of the progressmeter that's already "full" // part of the progressmeter that's already "full"
int dotz = round(fraction * totaldotz); int dotz = static_cast<int>(round(fraction * totaldotz));
// create the "meter" // create the "meter"
int ii=0; int ii=0;
......
...@@ -33,8 +33,17 @@ ...@@ -33,8 +33,17 @@
#include <vector> #include <vector>
OutputHandler* Log;
BOOST_AUTO_TEST_SUITE(SubRoomTest) BOOST_AUTO_TEST_SUITE(SubRoomTest)
struct Handler {
Handler() {Log = new STDIOHandler();}
~ Handler() {delete Log;}
};
BOOST_GLOBAL_FIXTURE(Handler)
BOOST_AUTO_TEST_CASE(JTol_WallGap_test) BOOST_AUTO_TEST_CASE(JTol_WallGap_test)
{ {
BOOST_MESSAGE("starting small gap between wall test"); BOOST_MESSAGE("starting small gap between wall test");
......
...@@ -91,7 +91,7 @@ Pedestrian::Pedestrian() ...@@ -91,7 +91,7 @@ Pedestrian::Pedestrian()
_agentsCreated++;//increase the number of object created _agentsCreated++;//increase the number of object created
} }
Pedestrian::Pedestrian(const StartDistribution& agentsParameters, const Building& building) Pedestrian::Pedestrian(const StartDistribution& agentsParameters, Building& building)
: _age(agentsParameters.GetAge()), : _age(agentsParameters.GetAge()),
_gender(agentsParameters.GetGender()), _gender(agentsParameters.GetGender()),
_height(agentsParameters.GetHeight()), _height(agentsParameters.GetHeight()),
......
...@@ -135,7 +135,7 @@ private: ...@@ -135,7 +135,7 @@ private:
public: public:
// constructors // constructors
Pedestrian(); Pedestrian();
explicit Pedestrian(const StartDistributionSubroom& agentsParameters, const Building& building); explicit Pedestrian(const StartDistribution& agentsParameters, Building& building);
virtual ~Pedestrian(); virtual ~Pedestrian();
// Setter-Funktionen // Setter-Funktionen
......
...@@ -71,13 +71,13 @@ private: ...@@ -71,13 +71,13 @@ private:
double _yMax; double _yMax;
//pre movement time distribution //pre movement time distribution
std::normal_distribution<double> _premovementTime; mutable std::normal_distribution<double> _premovementTime;
//risk tolerance distribution //risk tolerance distribution
std::normal_distribution<double> _riskTolerance; mutable std::normal_distribution<double> _riskTolerance;
//random number generator engine //random number generator engine
std::default_random_engine _generator; mutable std::default_random_engine _generator;
public: public:
StartDistribution(int seed); StartDistribution(int seed);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment