Commit d1cb64fa authored by COULAUD Olivier's avatar COULAUD Olivier

replace fabs by std::abs, remove unitialized variables

parent f2b2cac0
...@@ -494,7 +494,7 @@ public: ...@@ -494,7 +494,7 @@ public:
position_t other_center = other.getBox().center(); position_t other_center = other.getBox().center();
for(std::size_t i = 0; i < Dim; ++i) { for(std::size_t i = 0; i < Dim; ++i) {
FReal distance = fabs(my_center[i] - other_center[i]); FReal distance = std::abs(my_center[i] - other_center[i]);
if( Ffeq(distance, centers_distance) ) { if( Ffeq(distance, centers_distance) ) {
one_axis_is_at_exact_distance = true; one_axis_is_at_exact_distance = true;
} else if(distance > centers_distance) { } else if(distance > centers_distance) {
......
...@@ -49,18 +49,19 @@ public: ...@@ -49,18 +49,19 @@ public:
* @param filename the name of the file to open * @param filename the name of the file to open
* you can test if file is successfuly open by calling hasNotFinished() * you can test if file is successfuly open by calling hasNotFinished()
*/ */
FBasicLoader(const char* const filename): file(filename,std::ifstream::in){ FBasicLoader(const char* const filename): file(filename,std::ifstream::in){
// test if open // test if open
if(this->file.is_open()){ if(this->file.is_open()){
FReal x,y,z; FReal x,y,z;
this->file >> this->nbParticles >> this->boxWidth >> x >> y >> z; this->file >> this->nbParticles >> this->boxWidth >> x >> y >> z;
this->centerOfBox.setPosition(x,y,z); this->centerOfBox.setPosition(x,y,z);
}
else {
this->boxWidth = 0;
this->nbParticles = 0;
}
} }
else {
this->boxWidth = 0;
this->nbParticles = 0;
this->centerOfBox.setPosition(0.0,0.0,0.0);
}
}
/** /**
* Default destructor, simply close the file * Default destructor, simply close the file
......
...@@ -46,8 +46,8 @@ struct FChebRoots : FNoCopyable ...@@ -46,8 +46,8 @@ struct FChebRoots : FNoCopyable
static FReal T(const unsigned int n, FReal x) static FReal T(const unsigned int n, FReal x)
{ {
//std::cout << x << std::endl; //std::cout << x << std::endl;
assert(std::fabs(x)-1.<10.*std::numeric_limits<FReal>::epsilon()); assert(std::abs(x)-1.<10.*std::numeric_limits<FReal>::epsilon());
if (std::fabs(x)>1.) { if (std::abs(x)>1.) {
x = (x > FReal( 1.) ? FReal( 1.) : x); x = (x > FReal( 1.) ? FReal( 1.) : x);
x = (x < FReal(-1.) ? FReal(-1.) : x); x = (x < FReal(-1.) ? FReal(-1.) : x);
} }
...@@ -68,8 +68,8 @@ struct FChebRoots : FNoCopyable ...@@ -68,8 +68,8 @@ struct FChebRoots : FNoCopyable
*/ */
static FReal U(const unsigned int n, FReal x) static FReal U(const unsigned int n, FReal x)
{ {
assert(std::fabs(x)-1.<10.*std::numeric_limits<FReal>::epsilon()); assert(std::abs(x)-1.<10.*std::numeric_limits<FReal>::epsilon());
if (std::fabs(x)>1.) { if (std::abs(x)>1.) {
x = (x > FReal( 1.) ? FReal( 1.) : x); x = (x > FReal( 1.) ? FReal( 1.) : x);
x = (x < FReal(-1.) ? FReal(-1.) : x); x = (x < FReal(-1.) ? FReal(-1.) : x);
} }
......
...@@ -48,8 +48,8 @@ struct FUnifRoots : FNoCopyable ...@@ -48,8 +48,8 @@ struct FUnifRoots : FNoCopyable
*/ */
static FReal L(const unsigned int n, FReal x) static FReal L(const unsigned int n, FReal x)
{ {
assert(std::fabs(x)-1.<10.*std::numeric_limits<FReal>::epsilon()); assert(std::abs(x)-1.<10.*std::numeric_limits<FReal>::epsilon());
if (std::fabs(x)>1.) { if (std::abs(x)>1.) {
//std::cout << "x=" << x << " out of bounds!" << std::endl; //std::cout << "x=" << x << " out of bounds!" << std::endl;
x = (x > FReal( 1.) ? FReal( 1.) : x); x = (x > FReal( 1.) ? FReal( 1.) : x);
x = (x < FReal(-1.) ? FReal(-1.) : x); x = (x < FReal(-1.) ? FReal(-1.) : x);
...@@ -93,8 +93,8 @@ struct FUnifRoots : FNoCopyable ...@@ -93,8 +93,8 @@ struct FUnifRoots : FNoCopyable
*/ */
static FReal dL(const unsigned int n, FReal x) static FReal dL(const unsigned int n, FReal x)
{ {
assert(std::fabs(x)-1.<10.*std::numeric_limits<FReal>::epsilon()); assert(std::abs(x)-1.<10.*std::numeric_limits<FReal>::epsilon());
if (std::fabs(x)>1.) { if (std::abs(x)>1.) {
x = (x > FReal( 1.) ? FReal( 1.) : x); x = (x > FReal( 1.) ? FReal( 1.) : x);
x = (x < FReal(-1.) ? FReal(-1.) : x); x = (x < FReal(-1.) ? FReal(-1.) : x);
} }
......
...@@ -41,7 +41,7 @@ class FUTester{ ...@@ -41,7 +41,7 @@ class FUTester{
}; };
std::list<TestFuncDescriptor> tests; //< all tests std::list<TestFuncDescriptor> tests={}; //< all tests
int totalTests; //< number of tests int totalTests; //< number of tests
...@@ -53,9 +53,8 @@ class FUTester{ ...@@ -53,9 +53,8 @@ class FUTester{
protected: protected:
/** Constructor */ /** Constructor */
FUTester(){ FUTester() : totalTests(0),currentTest(0),currentStep(0),failedSteps(0),failedTests(0)
totalTests = 0; { }
}
/** Callback before processing test */ /** Callback before processing test */
virtual void Before(){} virtual void Before(){}
......
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