Commit a79c8594 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Update the unit test to use the correct file (single or double precision)

parent b1c9ed76
......@@ -209,7 +209,10 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter;
const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.bin.fma");
const char* const defaultFilename = (sizeof(FReal) == sizeof(float))?
"../../Data/test20k.bin.fma.single":
"../../Data/test20k.bin.fma.double";
const char* const filename = FParameters::getStr(argc,argv,"-f", defaultFilename);
std::cout << "Opening : " << filename << "\n";
......
......@@ -332,8 +332,10 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter;
const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.bin.fma");
const char* const defaultFilename = (sizeof(FReal) == sizeof(float))?
"../../Data/test20k.bin.fma.single":
"../../Data/test20k.bin.fma.double";
const char* const filename = FParameters::getStr(argc,argv,"-f", defaultFilename);
std::cout << "Opening : " << filename << "\n";
FMpiFmaLoader<ParticleClass> loader(filename,app.global());
......
......@@ -43,7 +43,10 @@ int main(int argc, char ** argv){
// Box width
const FReal BoxWidth = 1.0/2;
// Output file please let .temp extension
const char* const Output = FParameters::getStr(argc,argv,"-f", "../Data/test20k.bin.fma");
const char* const defaultFilename = (sizeof(FReal) == sizeof(float))?
"../../Data/test20k.bin.fma.single":
"../../Data/test20k.bin.fma.double";
const char* const Output = FParameters::getStr(argc,argv,"-f", defaultFilename);
std::cout << "Creating : " << Output << "\n";
// Create file
......
......@@ -65,7 +65,10 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
void RunTest(const FReal epsilon) {
// Warning in make test the exec dir it Build/UTests
// Load particles
FFmaBinLoader<ParticleClass> loader("../../Data/utestSphericalDirect.bin.fma");
const char* const filename = (sizeof(FReal) == sizeof(float))?
"../../Data/utestDirect.bin.fma.single":
"../../Data/utestDirect.bin.fma.double";
FFmaBinLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){
Print("Cannot open particles file.");
uassert(false);
......@@ -159,8 +162,8 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
Print(fz.getInfNorm());
// Assert
const FReal MaximumDiffPotential = FReal(1e-5);
const FReal MaximumDiffForces = FReal(1e-3);
const FReal MaximumDiffPotential = FReal(9e-5);
const FReal MaximumDiffForces = FReal(9e-3);
uassert(potentialDiff.getL2Norm() < MaximumDiffPotential);
uassert(potentialDiff.getInfNorm() < MaximumDiffPotential);
......
......@@ -54,10 +54,13 @@ class TestRotationDirect : public FUTester<TestRotationDirect> {
/** The test method to factorize all the test based on different kernels */
template <class ParticleClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass,
class OctreeClass, class FmmClass>
void RunTest(const bool isBlasKernel){
void RunTest(){
// Warning in make test the exec dir it Build/UTests
// Load particles
FFmaBinLoader<ParticleClass> loader("../../Data/utestSphericalDirect.bin.fma");
const char* const filename = (sizeof(FReal) == sizeof(float))?
"../../Data/utestDirect.bin.fma.single":
"../../Data/utestDirect.bin.fma.double";
FFmaBinLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){
Print("Cannot open particles file.");
uassert(false);
......@@ -178,7 +181,7 @@ class TestRotationDirect : public FUTester<TestRotationDirect> {
typedef FFmmAlgorithm<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
RunTest<ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass,
OctreeClass, FmmClass>(false);
OctreeClass, FmmClass>();
}
///////////////////////////////////////////////////////////
......
......@@ -59,7 +59,10 @@ class TestSphericalDirect : public FUTester<TestSphericalDirect> {
void RunTest(const bool isBlasKernel){
// Warning in make test the exec dir it Build/UTests
// Load particles
FFmaBinLoader<ParticleClass> loader("../../Data/utestSphericalDirect.bin.fma");
const char* const filename = (sizeof(FReal) == sizeof(float))?
"../../Data/utestDirect.bin.fma.single":
"../../Data/utestDirect.bin.fma.double";
FFmaBinLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){
Print("Cannot open particles file.");
uassert(false);
......
......@@ -51,8 +51,12 @@ class TestSphericalWithPrevious : public FUTester<TestSphericalWithPrevious> {
/** the test */
void TestTree(){
// Warning in make test the exec dir it Build/UTests
const char* const DataFile = "../../Data/utestSpherical.data";
const char* const ParticleFile = "../../Data/utestSpherical.bin.fma";
const char* const DataFile = (sizeof(FReal) == sizeof(float))?
"../../Data/utestSphericalPrevious.data.single":
"../../Data/utestSphericalPrevious.data.double";
const char* const ParticleFile = (sizeof(FReal) == sizeof(float))?
"../../Data/utestDirect.bin.fma.single":
"../../Data/utestDirect.bin.fma.double";
const int NbLevels = 5;
const int SizeSubLevels = 3;
......
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