From 75ffdf9cb69aeaacb43c7dd7d5ba03d3aab33dda Mon Sep 17 00:00:00 2001
From: Olivier Coulaud <Olivier.Coulaud@inria.fr>
Date: Mon, 16 Jun 2014 08:54:28 +0200
Subject: [PATCH] Improvements

---
 Examples/generateDistributions.cpp           |  10 +-
 Examples/statisticsOnOctree.cpp              |  11 +-
 Src/AdaptiveTree/FAdaptCell.hpp              |   3 +-
 Src/Components/FFmaParticleContainer.hpp     |   2 +-
 Src/Core/FFmmAlgorithmThreadProc.hpp         |   3 +-
 Src/Files/FFmaGenericLoader.hpp              |  72 ++++----
 Src/Files/FRandomLoader.hpp                  |  15 +-
 Src/ScalFmmConfig.h.cmake                    |   6 +
 Src/Utils/FGenerateDistribution.hpp          | 163 +++++++++++++++++--
 Tests/Kernels/DirectAlgorithm.cpp            |  13 +-
 Tests/Kernels/testNewCompareKernels.cpp      |  19 ++-
 Tests/Utils/testFmmAlgorithmProcRotation.cpp |   6 +-
 Tests/Utils/testMpiCsvSaver.cpp              |  14 +-
 Tests/Utils/testTreeIO.cpp                   |  91 ++++++-----
 UTests/CMakeLists.txt                        |   4 +
 UTests/noDist/utestListBlockAllocator.cpp    | 105 ++++++++++++
 UTests/utestChebyshevMultiRhs.cpp            |   3 +-
 UTests/utestLagrange.cpp                     |  19 +--
 UTests/utestSphericalDirectDebug.cpp         |   4 +-
 19 files changed, 414 insertions(+), 149 deletions(-)
 create mode 100644 UTests/noDist/utestListBlockAllocator.cpp

diff --git a/Examples/generateDistributions.cpp b/Examples/generateDistributions.cpp
index 2ecd1d096..6f2195214 100644
--- a/Examples/generateDistributions.cpp
+++ b/Examples/generateDistributions.cpp
@@ -258,23 +258,23 @@ int main(int argc, char ** argv){
 			exit(-1)	;
 		}	//
 		//
-		// Export data in cvs format
+		// Export data in VTK format
 		//
 		if( fmt == "vtp" ){
 			std::cout << "Writes in XML VTP format  (visualization) in file "<< visufile <<std::endl ;
-			exportVTKxml( file, NbPoints, particles)  ;
+			exportVTKxml( file, particles, NbPoints)  ;
 		}
 		else		if( fmt == "vtk" ){
 			std::cout << "Writes in VTK format  (visualization) in file "<< visufile <<std::endl ;
-			exportVTK( file, NbPoints, particles)  ;
+			exportVTK( file, particles, NbPoints)  ;
 		}
 		else if( fmt == "cosmo" ){
 			std::cout << "Writes in COSMO format  (visualization) in file "<< visufile <<std::endl ;
-			exportCOSMOS( file, NbPoints, particles)  ;
+			exportCOSMOS( file, particles, NbPoints)  ;
 		}
 		else {
 			std::cout << "Writes in CVS format  (visualization) in file "<<visufile<<std::endl ;
-			exportCVS( file, NbPoints, particles)  ;
+			exportCVS( file, particles, NbPoints)  ;
 		}
 	}
 	//
diff --git a/Examples/statisticsOnOctree.cpp b/Examples/statisticsOnOctree.cpp
index 8965adca6..8c63ca401 100755
--- a/Examples/statisticsOnOctree.cpp
+++ b/Examples/statisticsOnOctree.cpp
@@ -99,16 +99,7 @@ int main(int argc, char ** argv){
 			<<std::endl;
 
 	//
-	std::cout << "Opening : " << filename << "\n";
-	bool binaryMode = false;
-	if(FParameters::existParameter(argc, argv, "-bin")){
-		binaryMode = true;
-	}
-	FFmaGenericLoader loader(filename,binaryMode);
-	if(!loader.isOpen()){
-		std::cout << "Loader Error, " << filename << " is missing\n";
-		return 1;
-	}
+	FFmaGenericLoader loader(filename);
 	// -----------------------------------------------------
 	OctreeClass tree(TreeHeight, SubTreeHeight,loader.getBoxWidth(),loader.getCenterOfBox());
 	//
diff --git a/Src/AdaptiveTree/FAdaptCell.hpp b/Src/AdaptiveTree/FAdaptCell.hpp
index 6208c7e8b..b6610145d 100755
--- a/Src/AdaptiveTree/FAdaptCell.hpp
+++ b/Src/AdaptiveTree/FAdaptCell.hpp
@@ -17,6 +17,7 @@
 #define FADAPTCELL_HPP
 
 #include <cstddef>
+#include <iostream>
 #include <vector>
 //
 #include "Components/FBasicCell.hpp"
@@ -58,7 +59,7 @@ protected:
 	//
 	CellClass   * trueFMMCell ;                   //<a pointer on the cell that contains Multipole and local values
 public:
-	FAdaptCell(): gID(-1), nbP(0), adaptive(false),trueFMMCell(nullptr) {
+	FAdaptCell(): gID(-1), nbP(0), adaptive(false),sminMCriteria(false),trueFMMCell(nullptr) {
 	}
 	/** Default destructor */
 	virtual ~FAdaptCell(){
diff --git a/Src/Components/FFmaParticleContainer.hpp b/Src/Components/FFmaParticleContainer.hpp
index ee359400f..ccbe8c683 100755
--- a/Src/Components/FFmaParticleContainer.hpp
+++ b/Src/Components/FFmaParticleContainer.hpp
@@ -1,5 +1,5 @@
 // ===================================================================================
-// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
+// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
 // olivier.coulaud@inria.fr, berenger.bramas@inria.fr
 // This software is a computer program whose purpose is to compute the FMM.
 //
diff --git a/Src/Core/FFmmAlgorithmThreadProc.hpp b/Src/Core/FFmmAlgorithmThreadProc.hpp
index c29b03603..4727bbc20 100644
--- a/Src/Core/FFmmAlgorithmThreadProc.hpp
+++ b/Src/Core/FFmmAlgorithmThreadProc.hpp
@@ -1052,7 +1052,8 @@ private:
 		FMpiBufferWriter** sendBuffer;
 		FMpiBufferReader** recvBuffer;
 
-#pragma omp parallel /*default(none)*/ shared(m2lSelf,computationCounter,globalReceiveMap,requests,sendBuffer,recvBuffer,iterRequest,status,singleCounter,toSend,gatherCounter,sendCounter)
+// #pragma omp parallel /*default(none)*/ shared(m2lSelf,globalReceiveMap,requests,sendBuffer,recvBuffer,iterRequest,status,singleCounter,toSend,gatherCounter,sendCounter)
+#pragma omp parallel /*default(none)*/ shared(globalReceiveMap,requests,sendBuffer,recvBuffer,iterRequest,status,toSend)
 		{
 	int threadIdx = omp_get_thread_num();
 	typename OctreeClass::Iterator octreeIterator(tree);
diff --git a/Src/Files/FFmaGenericLoader.hpp b/Src/Files/FFmaGenericLoader.hpp
index bd55e6a65..60a15a8c0 100755
--- a/Src/Files/FFmaGenericLoader.hpp
+++ b/Src/Files/FFmaGenericLoader.hpp
@@ -18,10 +18,12 @@
 #ifndef FFmaGenericLoader_HPP
 #define FFmaGenericLoader_HPP
 
+#include <ios>
 #include <iostream>
 #include <iomanip>
 #include <fstream>
 #include <string>
+#include <cstdlib>
 //
 #include "Utils/FGlobal.hpp"
 #include "FAbstractLoader.hpp"
@@ -31,18 +33,17 @@
 //
 
 
-//! \class  FmaBasicParticle
+//! \class  FmaR4W4Particle
 //!
 //! \brief Basic  Particle class used in FMA loader and writer
 //!
-//!  Here we consider the position, the physical value in the structure
-//! but we read only the four first values the position, the physical value
-//! this class is used in the generateDistributions example.
+//!  Here we consider only the position and the physical value in the structure
+//!  We read (R4) and write  (W4)  the four values: the position, the physical value.
+//!  This class is used in the generateDistributions example.
 //!
-class FmaBasicParticle {
+class FmaR4W4Particle {
 public:
 	FPoint position;            ///< position of the particle
-	//	FReal  x,y,z;                 ///< position of the particle
 	FReal  physicalValue;    ///<  its physical value
 	/**
 	 *  return a pointer on the first value of the structure
@@ -65,19 +66,18 @@ public:
 	 *  return size in byte of the structure. it is used in FMAGenericWriter
 	 */
 	unsigned int getWriteDataSize() const
-	{ return sizeof(FmaBasicParticle);}
+	{ return sizeof(FmaR4W4Particle);}
 };
 
-//! \class  FmaRParticle
+//! \class  FmaR4W8Particle
 //!
 //! \brief The Particle class used in FMA loader and writer
 //!
-//! Here we consider the position, the physical value, the potential and the force in the structure
-//! but we read only the four first values the position, the physical value and we write all the data in a file.
-//! This class is used if you create an array of particles and you read them from a file generate by gerateDistributions
-//! and you want to store the result.
+//! In this class we consider the position, the physical value, the potential and the force in the structure
+//! but we read (R4) only the four first values: the position and the physical value and we write (W8) all the data (8 values) in a file.
+//! This class can be used if you read a file  generated by generateDistributions and you want to store the result of a direct computations or a FFM one..
 //!
-class FmaRParticle {
+class FmaR4W8Particle {
 public:
 	FPoint position;            ///< position of the particle
 	FReal  physicalValue;    ///< its physical value (mass or charge
@@ -105,20 +105,19 @@ public:
 	 *  return size in byte of the structure. it is used in FMAGenericWriter
 	 */
 	unsigned int getWriteDataSize() const
-	{ return sizeof(FmaRParticle);}
+	{ return sizeof(FmaR4W8Particle);}
 };
 //
-//! \class  FmaParticle
+//! \class  FmaR8W8Particle
 //!
 //! \brief The Particle class used in FMA loader and writer
 //!
-//! Here we consider the position, the physical value, the potential and the force in the structure
-//! and we read and write all the data in the structure
+//! Same as FmaR4W8Particle class but here we want to read  (R8) all the data (8 values) and want to store also all the data.
 //! This class is used if you create an array of particles  from a file generate by a previous computation (directComputation or a FMM computation)
-//! and you want to compare the result.
+//! and you want to compare your result with the read values .
 
 //!
-class FmaParticle : public FmaRParticle {
+class FmaR8W8Particle : public FmaR4W8Particle {
 public:
 	/**
 	 *  return The number of data to read. it is used in FMAGenericLoader  (here 8)
@@ -128,10 +127,12 @@ public:
 	int getReadDataNumber()
 	{ return 8;}
 };
-
-typedef FmaBasicParticle FmaR4W4Particle ;
-typedef FmaRParticle       FmaR4W8Particle ;
-typedef FmaParticle         FmaR8W8Particle ;
+//!\typedef FmaBasicParticle an alias of FmaR4W4Particle
+//!  Particle contains 4 values of type FReal and we read and write the four values
+//!
+typedef FmaR4W4Particle FmaBasicParticle  ;
+typedef FmaR4W8Particle FmaRParticle        ;
+typedef FmaR8W8Particle FmaParticle          ;
 //
 //! \class  FFmaGenericLoader
 //!
@@ -149,9 +150,9 @@ typedef FmaParticle         FmaR8W8Particle ;
 //!      8   the Particle Values  are X X Y Z Q  P FX FY FZ<br>
 //!
 //! There is 3 methods to read the data from the file <br>
-//!  1) 	fillParticle(FPoint*, FReal*);<br>
-//!  2)   fillParticle(FReal*, int);<br>
-//!  3   fillParticle(PartClass);<br>
+//!    -# 	fillParticle(FPoint*, FReal*);<br>
+//!    -#    fillParticle(FReal*, int);<br>
+//!    -#    fillParticle(PartClass);<br>
 //!
 //!  \code
 //!     FFmaGenericLoader  loader("../Data/unitCubeXYZQ20k.fma");    // extension fma --> ascii format
@@ -201,7 +202,7 @@ public:
 		// test if open
 		if(! this->file->is_open()){
 			std::cerr << "File "<< filename<<" not opened! " <<std::endl;
-			exit(-1);
+			std::exit( EXIT_FAILURE);
 		}
 		this->readHeader();
 	}
@@ -213,7 +214,8 @@ public:
 	 *  This means that we can obtain after the call the number of particles, ...
 	 * you can test if file is successfully open by calling hasNotFinished()
 	 */
-	FFmaGenericLoader(const std::string & filename) : binaryFile(false) ,tmpVal(nullptr),otherDataToRead(0){
+	FFmaGenericLoader(const std::string & filename) : file(nullptr),binaryFile(false),
+			centerOfBox(0.0,0.0,0.0),boxWidth(0.0),nbParticles(0),tmpVal(nullptr),otherDataToRead(0) {
 		std::string ext(".bfma");
 		// open particle file
 		if(filename.find(ext) != std::string::npos) {
@@ -225,12 +227,12 @@ public:
 		}
 		else  {
 			std::cout << "Input file not allowed only .fma or .bfma extensions" <<std::endl;
-			exit (-1) ;
+			std::exit ( EXIT_FAILURE) ;
 		}
 		// test if open
 		if(! this->file->is_open()){
 			std::cerr << "File "<< filename<<" not opened! " <<std::endl;
-			exit(-1);
+			std::exit( EXIT_FAILURE);
 		}
 		this->readHeader();
 	}
@@ -418,7 +420,7 @@ private:
 		std::cout << "   Datatype "<< typeData[0] << " "<< typeData[1] << std::endl;
 		if(typeData[0] != sizeof(FReal)){
 			std::cerr << "Size of elements in part file " << typeData[0] << " is different from size of FReal " << sizeof(FReal)<<std::endl;
-			exit(-1);
+			std::exit( EXIT_FAILURE);
 		}
 		else{
 			file->read( (char*)&(this->nbParticles), sizeof(FSize) );
@@ -493,12 +495,12 @@ public:
 		}
 		else  {
 			std::cout << "Input file not allowed only .fma or .bfma extensions" <<std::endl;
-			exit (-1) ;
+			std::exit ( EXIT_FAILURE) ;
 		}
 		// test if open
 		if(! this->file->is_open()){
 			std::cerr << "File "<< filename<<" not opened! " <<std::endl;
-			exit(-1);
+			std::exit( EXIT_FAILURE);
 		}
 	}
 	/**
@@ -522,7 +524,7 @@ public:
 		// test if open
 		if(! this->file->is_open()){
 			std::cerr << "File "<< filename<<" not opened! " <<std::endl;
-			exit(-1);
+			std::exit( EXIT_FAILURE);
 		}
 	}
 	/**
@@ -710,7 +712,7 @@ private:
 		file->write((char*)typeFReal,2*sizeof(unsigned int));
 		if(typeFReal[0]  != sizeof(FReal)){
 			std::cout << "Size of elements in part file " << typeFReal[0] << " is different from size of FReal " << sizeof(FReal)<<std::endl;
-			exit(-1);
+			std::exit( EXIT_FAILURE);
 		}
 		else{
 			file->write( (char*)&(nbParticles), sizeof(FSize) );
diff --git a/Src/Files/FRandomLoader.hpp b/Src/Files/FRandomLoader.hpp
index 84574f83c..b466937c9 100755
--- a/Src/Files/FRandomLoader.hpp
+++ b/Src/Files/FRandomLoader.hpp
@@ -1,5 +1,5 @@
 // ===================================================================================
-// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
+// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
 // olivier.coulaud@inria.fr, berenger.bramas@inria.fr
 // This software is a computer program whose purpose is to compute the FMM.
 //
@@ -18,7 +18,7 @@
 
 
 #include <cstdlib>
-#include <time.h>
+#include <ctime>
 
 
 #include "../Utils/FGlobal.hpp"
@@ -41,13 +41,18 @@ protected:
 public:
     /**
     * The constructor need the simulation data
+    *  @param   inNbParticles Number of partcles to generate randomly
+    *  @param  inBoxWidth     the width of the box
+    *  @param  inCenterOfBox the center of the box
+    *  @param  inSeed The seed for the random generator (default value time(0))
+    *
     */
     FRandomLoader(const size_t inNbParticles, const FReal inBoxWidth = 1.0,
-                  const FPoint& inCenterOfBox = FPoint(0,0,0), const unsigned int inSeed = static_cast<unsigned int>(0))
+                  const FPoint& inCenterOfBox = FPoint(0,0,0),
+                  const unsigned int inSeed = static_cast<long int>(time(0)))
         : nbParticles(inNbParticles), boxWidth(inBoxWidth), centerOfBox(inCenterOfBox) {
         srand48(inSeed);
     }
-
     /**
     * Default destructor
     */
@@ -110,7 +115,7 @@ public:
 class FRandomLoaderTsm : public FRandomLoader {
 public:
     FRandomLoaderTsm(const size_t inNbParticles, const FReal inBoxWidth = 1.0,
-                  const FPoint& inCenterOfBox = FPoint(0,0,0), const unsigned int inSeed = static_cast<unsigned int>(time(NULL)))
+                  const FPoint& inCenterOfBox = FPoint(0,0,0), const unsigned int inSeed = static_cast<unsigned int>(time(0)))
         : FRandomLoader(inNbParticles,inBoxWidth,inCenterOfBox,inSeed) {
     }
 
diff --git a/Src/ScalFmmConfig.h.cmake b/Src/ScalFmmConfig.h.cmake
index 04f8308df..58e581659 100755
--- a/Src/ScalFmmConfig.h.cmake
+++ b/Src/ScalFmmConfig.h.cmake
@@ -98,4 +98,10 @@
 #pragma warning (disable : 2326 ) 
 #endif
 
+///////////////////////////////////////////////////////
+// Path to the ScalFMM DATA (For UTests)
+///////////////////////////////////////////////////////
+#include <string>
+const std::string SCALFMMDataPath("@CMAKE_SOURCE_DIR@/Data/");
+
 #endif // CONFIG_H
diff --git a/Src/Utils/FGenerateDistribution.hpp b/Src/Utils/FGenerateDistribution.hpp
index 45e116d5e..ad4509039 100644
--- a/Src/Utils/FGenerateDistribution.hpp
+++ b/Src/Utils/FGenerateDistribution.hpp
@@ -171,7 +171,7 @@ void unifRandonPointsOnSphere(const int N , const FReal R, FReal * points) {
 		points[j+2]  *= R ;
 	}
 };
-//!  \fn FReal plummerDist(int & cpt, const FReal &R)
+//!  \fn void plummerDist(int & cpt, const FReal &R)
 
 //! \brief   Radial Plummer distribution
 
@@ -180,11 +180,11 @@ void unifRandonPointsOnSphere(const int N , const FReal R, FReal * points) {
 //! \param R    : Radius of the sphere that contains the particles
 //! @return Return the radius according to the Plummer distribution either double type or float type
 //!
-FReal plummerDist(int & cpt, const FReal &R) {
+FReal  plummerDist(int & cpt, const FReal &R) {
 	//
 	FReal radius ,u ;
 	do  {
-		//radius =  getRandom() ;
+		//
 		u        = FMath::pow (getRandom() , 2.0/3.0) ;
 		radius = FMath::Sqrt (u/(1.0-u));
 		cpt++;
@@ -226,23 +226,48 @@ void unifRandonPlummer(const int N , const FReal R, const FReal M, FReal * point
 			<<100*static_cast<FReal>(cpt-N)/cpt << " %" <<std::endl;
 
 } ;
-//! \fn void exportCVS(std::ofstream& file, const int N, const FReal * particles )
+//! \fn void exportCVS(std::ofstream& file, const FReal * particles , const int N, const int nbDataPerParticle=4)
 
 //! \brief  Export particles in CVS Format
 //!
 //! Export particles in CVS Format as follow
-//!      x ,  y  , z , physicalValue
+//!      x ,  y  , z , physicalValue, P, FX,  FY,  FY
 //! It is useful to plot the distribution with paraView
 //!
-void exportCVS(std::ofstream& file, const int N, const FReal * particles ){
+//!  @param file stream to save the data
+//!  @param  N number of particles
+//!  @param  particles array of particles of type FReal (float or double) Its size is N*nbDataPerParticle
+//!  @param  nbDataPerParticle number of values per particles (default value 4)
+//!
+void exportCVS(std::ofstream& file, const FReal * particles , const int N, const int nbDataPerParticle=4){
 	int j = 0;
-	file << " x ,  y , z, q " <<std::endl;
-	for(int i = 0 ; i< N; ++i, j+=4){
-		file <<    particles[j]    << " , "    <<   particles[j+1]    << " , "   <<   particles[j+2]    << " , "   <<   particles[j+3]   <<std::endl;
+	if (nbDataPerParticle==4){
+		file << " x ,  y , z, q  " <<std::endl;
+	}
+	else {
+		file << " x ,  y , z, q P FX FY FZ" <<std::endl;
+	}
+	for(int i = 0 ; i< N; ++i, j+=nbDataPerParticle){
+		file <<    particles[j]   ;
+		for (int k = 1 ; k< nbDataPerParticle ; ++k) {
+			file   << "  , "  <<    particles[j+k]     ;
+		}
+		file   << std::endl;
 	}
 }
 //
-void exportCOSMOS(std::ofstream& file, const int N, const FReal * particles ){
+//! \fn void exportCOSMOS(std::ofstream& file,  const FReal * particles, const int N )
+
+//! \brief  Export particles in CVS Format
+//!
+//! Export particles in CVS Format as follow
+//!      x ,  y  , z , 0.0, 0.0, 0.0, physicalValue
+//!
+//!  @param file stream to save the data
+//!  @param  particles array of particles of type FReal (float or double) Its size is 4*N (X,Y,Z,M)
+//!  @param  N number of particles
+//!
+void exportCOSMOS(std::ofstream& file, const FReal * particles , const int N){
 	int j = 0;
 	file << " x ,  y , z, q " <<std::endl;
 	for(int i = 0 ; i< N; ++i, j+=4){
@@ -250,7 +275,20 @@ void exportCOSMOS(std::ofstream& file, const int N, const FReal * particles ){
 	}
 }
 //
-void exportVTK(std::ofstream& VTKfile, const int N, const FReal * particles ){
+//
+//! \fn void exportVTK(std::ofstream& file,  const FReal * particles, const int N )
+
+//! \brief  Export particles in CVS Format
+//!
+//! Export particles in old polydata Format.
+//!   A particle is composed of 4 fields    x ,  y  , z ,  physicalValue
+//! It is useful to plot the distribution with paraView
+//!
+//!  @param file stream to save the data
+//!  @param  particles array of particles of type FReal (float or double) Its size is 4*N (X,Y,Z,M)
+//!  @param  N number of particles
+//!
+void exportVTK(std::ofstream& VTKfile, const FReal * particles, const int N, const int nbDataPerParticle=4 ){
 	int j = 0;
 	//---------------------------
 	// print generic information
@@ -266,26 +304,39 @@ void exportVTK(std::ofstream& VTKfile, const int N, const FReal * particles ){
 	//---------------------------------
 	VTKfile << "POINTS " << N << "  float" << "\n";
 	//
-	for(int i = 0 ; i< N; ++i, j+=4){
+	for(int i = 0 ; i< N; ++i, j+=nbDataPerParticle){
 		VTKfile <<    particles[j]    << "  "    <<   particles[j+1]    << "   "   <<   particles[j+2]      <<std::endl;
 	}
 	// ------------------------------------------
 	VTKfile << "\n";
 	VTKfile << "VERTICES  " <<  N << " " << 2*N << "\n";
-	for(int i = 0 ; i< N; ++i, j+=4){
+	for(int i = 0 ; i< N; ++i){
 		VTKfile <<    "  1 "    << " "    <<i<<std::endl;
 	}
 	VTKfile << "POINT_DATA  " <<  N << "\n";
 	VTKfile << "SCALARS PhysicalValue  float 1" << "\n"
 			<< "LOOKUP_TABLE default" << "\n" ;
 	j = 0 ;
-	for(int i = 0 ; i< N; ++i, j+=4){
+	for(int i = 0 ; i< N; ++i, j+=nbDataPerParticle){
 		VTKfile <<    particles[j+3]    << " "    <<std::endl;
 	}
 	VTKfile << "\n";
 };
+//
+//
+//! \fn void exportVTKxml(std::ofstream& file,  const FReal * particles, const int N )
 
-void exportVTKxml(std::ofstream& VTKfile, const int N, const FReal * particles ){
+//! \brief  Export particles in xml polydata VTK  Format
+//!
+//! Export particles in the xml polydata VTK  Format.
+//!   A particle is composed of 4 fields    x ,  y  , z ,  physicalValue
+//! It is useful to plot the distribution with paraView
+//!
+//!  @param file stream to save the data
+//!  @param  particles array of particles of type FReal (float or double) Its size is 4*N (X,Y,Z,M)
+//!  @param  N number of particles
+//!
+void exportVTKxml(std::ofstream& VTKfile, const FReal * particles, const int N ){
 	int j = 0;
 
 	VTKfile << "<?xml version=\"1.0\"?>" <<std::endl
@@ -329,5 +380,87 @@ void exportVTKxml(std::ofstream& VTKfile, const int N, const FReal * particles )
 			<< "</VTKFile>"<<std::endl;
 } ;
 //
+//
+//
+//! \fn void exportVTKxml(std::ofstream& file,  const FReal * particles, const int N, const int nbDataPerParticle )
+
+//! \brief  Export particles in CVS Format
+//!
+//! Export particles in the new PolyData Format.
+//!   A particle is composed of 4 fields    x ,  y  , z ,  physicalValue
+//! It is useful to plot the distribution with paraView
+//!
+//!  @param file stream to save the data
+//!  @param  particles array of particles of type FReal (float or double) Its size is nbDataPerParticle*N
+//!  @param  N number of particles
+//!  @param  nbDataPerParticle number of values per particles (default value 4)
+//!
+void exportVTKxml(std::ofstream& VTKfile, const FReal * particles, const int N, const int nbDataPerParticle ){
+	int j = 0;
 
+	VTKfile << "<?xml version=\"1.0\"?>" <<std::endl
+			<< "<VTKFile type=\"PolyData\" version=\"0.1\" byte_order=\"LittleEndian\"> "<<std::endl
+			<< "<PolyData>"<<std::endl
+			<< "<Piece NumberOfPoints=\" " << N << " \"  NumberOfVerts=\" "<<N <<" \" NumberOfLines=\" 0\" NumberOfStrips=\"0\" NumberOfPolys=\"0\">"<<std::endl
+			<< "<Points>"<<std::endl
+			<< "<DataArray type=\"Float64\" NumberOfComponents=\"3\" format=\"ascii\"> "<<std::endl ;
+	j = 0 ;
+	for(int i = 0 ; i< N; ++i, j+=nbDataPerParticle){
+		VTKfile <<    particles[j]    << "  "    <<   particles[j+1]    << "   "   <<   particles[j+2]      << "   "   ;
+	}
+	VTKfile <<std::endl<< "</DataArray> "<<std::endl
+			<< "</Points> "<<std::endl ;
+	if (nbDataPerParticle==8 ) {
+		VTKfile<< "<PointData Scalars=\"PhysicalValue\" > "<<std::endl
+				<< "<DataArray type=\"Float64\" Name=\"PhysicalValue\"  format=\"ascii\">"<<std::endl ;
+		j = 0 ;
+		for(int i = 0 ; i< N; ++i, j+=nbDataPerParticle){
+			VTKfile <<    particles[j+3]    << " "   ;
+		}
+		VTKfile <<std::endl << "</DataArray>"<<std::endl ;
+		VTKfile  << "<DataArray type=\"Float64\" Name=\"Potential\"  format=\"ascii\">"<<std::endl ;
+		j = 0 ;
+		for(int i = 0 ; i< N; ++i, j+=nbDataPerParticle){
+			VTKfile <<    particles[j+4]    << " "   ;
+		}
+		VTKfile <<std::endl << "</DataArray>"<<std::endl ;
+		VTKfile<< "<DataArray type=\"Float64\"  Name=\"Force\" NumberOfComponents=\"3\" format=\"ascii\"> "<<std::endl ;
+		j = 0 ;
+		for(int i = 0 ; i< N; ++i, j+=nbDataPerParticle){
+			VTKfile <<    particles[j+5]    << "  "    <<   particles[j+6]    << "   "   <<   particles[j+7]      << "   "   ;
+		}
+		VTKfile <<std::endl<< "</DataArray> "<<std::endl;
+	}
+	else {
+		VTKfile		<< "<PointData Scalars=\"PhysicalValue\" > "<<std::endl
+				<< "<DataArray type=\"Float64\" Name=\"PhysicalValue\"  format=\"ascii\">"<<std::endl ;
+		j = 0 ;
+		for(int i = 0 ; i< N; ++i, j+=nbDataPerParticle){
+			VTKfile <<    particles[j+3]    << " "   ;
+		}
+		VTKfile <<std::endl << "</DataArray>"<<std::endl ;
+	}
+
+	VTKfile		<< "	</PointData>"<<std::endl
+			<< "	<CellData>"<<" </CellData>"<<std::endl
+			<< "	<Verts>"<<std::endl
+			<< "	<DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">"<<std::endl ;
+	for(int i = 0 ; i< N; ++i){
+		VTKfile <<   i   << " "   ;
+	}
+	VTKfile<<std::endl << "</DataArray>" <<std::endl
+			<< "<DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">"<<std::endl ;
+	for(int i = 1 ; i< N+1; ++i){
+		VTKfile <<   i   << " "   ;
+	}
+	VTKfile<<std::endl  << "</DataArray>"<<std::endl
+			<< "	</Verts>"<<std::endl
+			<< "<Lines></Lines>"<<std::endl
+			<< "<Strips></Strips>"<<std::endl
+			<< "<Polys></Polys>"<<std::endl
+			<< "</Piece>"<<std::endl
+			<< "</PolyData>"<<std::endl
+			<< "</VTKFile>"<<std::endl;
+} ;
+//
 #endif
diff --git a/Tests/Kernels/DirectAlgorithm.cpp b/Tests/Kernels/DirectAlgorithm.cpp
index 0be7d6369..607992da9 100755
--- a/Tests/Kernels/DirectAlgorithm.cpp
+++ b/Tests/Kernels/DirectAlgorithm.cpp
@@ -18,10 +18,13 @@
 #include <iostream>
 #include <iomanip>
 
-#include <cstdio>
+#include <cstdio>  //printf
 #include <cstdlib>
+#include <cstring>  //memset
+
 #include <cmath>
 #include <algorithm>
+#include <string>
 
 #include  "ScalFmmConfig.h"
 #include "../../Src/Utils/FTic.hpp"
@@ -99,12 +102,12 @@ int main(int argc, char ** argv){
 		std::cout << "     -noper no periodic boundary conditions   " << std::endl;
 		std::cout << "     -verbose : print index x y z fx fy fy Q and V" << std::endl;
 		std::cout << "     -fout filenameOUT  binary output file " << std::endl;
-		exit(-1);
+		std::exit( EXIT_FAILURE);
 
 	}
 	if(FParameters::existParameter(argc, argv, "-per") &&FParameters::existParameter(argc, argv, "-noper")  ){
 		std::cerr <<" Error -per X and -noper are forbidden together " << std::endl;
-		exit(-1);
+		std::exit( EXIT_FAILURE);
 	}
 
 	//////////////////////////////////////////////////////////////
@@ -147,10 +150,10 @@ int main(int argc, char ** argv){
 	FPoint electricMoment(0.0,0.0,0.0) ;
 	// const --> then shared
 	MDParticle * const particles = new MDParticle[loader->getNumberOfParticles()];
-	memset(particles, 0, sizeof(MDParticle) * loader->getNumberOfParticles()) ;
+	std::memset(particles, 0, sizeof(MDParticle) * loader->getNumberOfParticles()) ;
 	MDParticle* particlesDirect = nullptr;
 	particlesDirect = new MDParticle[loader->getNumberOfParticles()];
-	memset(particlesDirect, 0, sizeof(MDParticle) * loader->getNumberOfParticles()) ;
+	std::memset(particlesDirect, 0, sizeof(MDParticle) * loader->getNumberOfParticles()) ;
 	//
 	int nbParticles = static_cast<int>(loader->getNumberOfParticles());
 	double totalCharge = 0.0;
diff --git a/Tests/Kernels/testNewCompareKernels.cpp b/Tests/Kernels/testNewCompareKernels.cpp
index fe6d8b708..c11a512d9 100644
--- a/Tests/Kernels/testNewCompareKernels.cpp
+++ b/Tests/Kernels/testNewCompareKernels.cpp
@@ -65,7 +65,8 @@
 #ifdef ScalFMM_USE_FFT
 // Uniform grid kernel
 #include "../../Src/Kernels/Uniform/FUnifCell.hpp"
-//#include "../../Src/Kernels/Interpolation/FInterpMatrixKernel.hpp"
+#include "../../Src/Kernels/Interpolation/FInterpMatrixKernel.hpp"
+
 #include "../../Src/Kernels/Uniform/FUnifKernel.hpp"
 #endif
 
@@ -299,14 +300,14 @@ int main(int argc, char* argv[])
       const unsigned int ORDER = 7;
 
       // typedefs
-      typedef FP2PParticleContainerIndexed<> ContainerClass;
-      typedef FSimpleLeaf<ContainerClass> LeafClass;
-      typedef FInterpMatrixKernelR MatrixKernelClass;
-      typedef FUnifCell<ORDER> CellClass;
-      typedef FOctree<CellClass,ContainerClass,LeafClass> OctreeClass;
-
-      typedef FUnifKernel<CellClass,ContainerClass,MatrixKernelClass,ORDER> KernelClass;
-      typedef FFmmAlgorithm<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
+
+	    typedef FP2PParticleContainerIndexed<> ContainerClass;
+	    typedef FSimpleLeaf< ContainerClass >  LeafClass;
+	    typedef FInterpMatrixKernelR MatrixKernelClass;
+	    typedef FUnifCell<ORDER> CellClass;
+	    typedef FOctree<CellClass,ContainerClass,LeafClass> OctreeClass;
+	    typedef FUnifKernel<CellClass,ContainerClass,MatrixKernelClass,ORDER> KernelClass;
+	    typedef FFmmAlgorithm<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
 
 
       // init oct-tree
diff --git a/Tests/Utils/testFmmAlgorithmProcRotation.cpp b/Tests/Utils/testFmmAlgorithmProcRotation.cpp
index c68eb468a..984fb95ab 100644
--- a/Tests/Utils/testFmmAlgorithmProcRotation.cpp
+++ b/Tests/Utils/testFmmAlgorithmProcRotation.cpp
@@ -1,5 +1,5 @@
 // ===================================================================================
-// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
+// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
 // olivier.coulaud@inria.fr, berenger.bramas@inria.fr
 // This software is a computer program whose purpose is to compute the FMM.
 //
@@ -42,7 +42,7 @@
 #include "../../Src/Files/FMpiTreeBuilder.hpp"
 #include "../../Src/Files/FFmaBinLoader.hpp"
 
-#include "../../Src/BalanceTree/FLeafBalance.hpp"
+#include "BalanceTree/FLeafBalance.hpp"
 
 #include <iostream>
 
@@ -284,7 +284,7 @@ int main(int argc, char ** argv){
     }
 
     FVector<TestParticle> finalParticles;
-    FleafBalance balancer;
+    FLeafBalance balancer;
     FMpiTreeBuilder< TestParticle >::ArrayToTree(app.global(), particles, loader.getNumberOfParticles(),
 						 tree.getBoxCenter(),
 						 tree.getBoxWidth(),
diff --git a/Tests/Utils/testMpiCsvSaver.cpp b/Tests/Utils/testMpiCsvSaver.cpp
index 544ef3f0f..fdab77ae0 100755
--- a/Tests/Utils/testMpiCsvSaver.cpp
+++ b/Tests/Utils/testMpiCsvSaver.cpp
@@ -19,9 +19,9 @@
 // ================
 
 #include <iostream>
-
 #include <cstdio>
 #include <cstdlib>
+#include <string>
 
 #include "../../Src/Utils/FTic.hpp"
 #include "../../Src/Utils/FParameters.hpp"
@@ -69,12 +69,12 @@ public:
 
 class GalaxyLoader : public FFmaGenericLoader {
 public:
-    GalaxyLoader(const char* const filename) : FFmaGenericLoader(filename) {
+    GalaxyLoader(const std::string & filename) : FFmaGenericLoader(filename) {
     }
 
     void fillParticle(FPoint* position, FReal* physivalValue, FPoint* velocity){
         FReal x,y,z,data, vx, vy, vz;
-        this->file >> x >> y >> z >> data >> vx >> vy >> vz;
+        (*this->file)  >> x >> y >> z >> data >> vx >> vy >> vz;
         position->setPosition(x,y,z);
         *physivalValue = (data);
         velocity->setPosition(vx,vy,vz);
@@ -84,10 +84,10 @@ public:
 struct TestParticle{
     FPoint position;
     FReal physicalValue;
-    FReal forces[3];
     FReal potential;
-    FPoint velocity;
-    const FPoint& getPosition(){
+     FReal forces[3];
+     FPoint velocity;
+   const FPoint& getPosition(){
         return position;
     }
 };
@@ -141,7 +141,7 @@ int main(int argc, char ** argv){
     const int NbLevels = FParameters::getValue(argc,argv,"-depth", 6);
     const int SizeSubLevels = FParameters::getValue(argc,argv,"-subdepth", 3);
 
-    GalaxyLoader loader(FParameters::getStr(argc,argv,"-f", "../Data/galaxy.fma.tmp"));
+    GalaxyLoader loader(FParameters::getStr(argc,argv,"-f", "../Data/galaxy.fma"));
 
     // -----------------------------------------------------
 
diff --git a/Tests/Utils/testTreeIO.cpp b/Tests/Utils/testTreeIO.cpp
index 343557a73..5bb201d7d 100755
--- a/Tests/Utils/testTreeIO.cpp
+++ b/Tests/Utils/testTreeIO.cpp
@@ -18,6 +18,7 @@
 
 #include <cstdio>
 #include <cstdlib>
+#include <string>
 
 #include "../../Src/Utils/FTic.hpp"
 #include "../../Src/Utils/FParameters.hpp"
@@ -34,64 +35,74 @@
 
 #include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp"
 
-
+void usage() {
+	std::cout << "Exemple to store and load a tree" << std::endl;
+	std::cout <<	 "Options  "<< std::endl
+			<<     "      -help         to see the parameters    " << std::endl
+			<<	  "      -depth       the depth of the octree   "<< std::endl
+			<<	  "      -subdepth  specifies the size of the sub octree   " << std::endl
+			<<     "      -fin    name    name specifies the file of the particle distribution" << std::endl
+			<<     "      -fout   name    file name of the octree  " << std::endl;
+}
 // Simply create particles and try the kernels
 int main(int argc, char ** argv){
-    typedef FSphericalCell                 CellClass;
-    typedef FP2PParticleContainer<>         ContainerClass;
 
-    typedef FSimpleLeaf< ContainerClass >                     LeafClass;
-    typedef FOctree< CellClass, ContainerClass , LeafClass >  OctreeClass;
+	if(FParameters::existParameter(argc, argv, "-h")||FParameters::existParameter(argc, argv, "-help")){
+		usage() ;
+		exit(EXIT_SUCCESS);
+	}
+	typedef FSphericalCell                 CellClass;
+	typedef FP2PParticleContainer<>         ContainerClass;
 
-    ///////////////////////What we do/////////////////////////////
-    std::cout << ">> This executable has to be used to load or retrieve an entier tree.\n";
-    //////////////////////////////////////////////////////////////
+	typedef FSimpleLeaf< ContainerClass >                     LeafClass;
+	typedef FOctree< CellClass, ContainerClass , LeafClass >  OctreeClass;
 
-    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.fma");
-    std::cout << "Opening : " << filename << "\n";
+	///////////////////////What we do/////////////////////////////
+	std::cout << ">> This executable has to be used to load or retrieve an entier tree.\n";
+	//////////////////////////////////////////////////////////////
+	const unsigned int TreeHeight       = FParameters::getValue(argc, argv, "-depth", 5);
+	const unsigned int SubTreeHeight  = FParameters::getValue(argc, argv, "-subdepth", 2);
 
-    FFmaGenericLoader loader(filename);
-    if(!loader.isOpen()){
-        std::cout << "Loader Error, " << filename << " is missing\n";
-        return 1;
-    }
+	FTic counter;
+	const std::string filenameIN     = FParameters::getStr(argc,argv,"-fin", "../Data/test20k.fma");
+	const std::string filenameOUT = FParameters::getStr(argc,argv,"-fout", "tmp_tree.data");
+	std::cout << "Opening : " << filenameIN << "\n";
 
-    // -----------------------------------------------------
-    CellClass::Init(5);
-    OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
+	FFmaGenericLoader loader(filenameIN);
+	//
+	// -----------------------------------------------------
+	CellClass::Init(5);
+	OctreeClass tree(TreeHeight, SubTreeHeight, loader.getBoxWidth(), loader.getCenterOfBox());
 
-    // -----------------------------------------------------
+	// -----------------------------------------------------
 
-    std::cout << "Creating & Inserting " << loader.getNumberOfParticles() << " particles ..." << std::endl;
-    std::cout << "\tHeight : " << NbLevels << " \t sub-height : " << SizeSubLevels << std::endl;
-    counter.tic();
+	std::cout << "Creating & Inserting " << loader.getNumberOfParticles() << " particles ..." << std::endl;
+	std::cout << "\tHeight : " << TreeHeight << " \t sub-height : " << SubTreeHeight << std::endl;
+	counter.tic();
 
-    for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
-        FPoint particlePosition;
-        FReal physicalValue = 0.0;
-        loader.fillParticle(&particlePosition,&physicalValue);
-        tree.insert(particlePosition, physicalValue );
-    }
+	for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
+		FPoint particlePosition;
+		FReal physicalValue = 0.0;
+		loader.fillParticle(&particlePosition,&physicalValue);
+		tree.insert(particlePosition, physicalValue );
+	}
 
-    counter.tac();
-    std::cout << "Done  " << "(@Creating and Inserting Particles = " << counter.elapsed() << "s)." << std::endl;
+	counter.tac();
+	std::cout << "Done  " << "(@Creating and Inserting Particles = " << counter.elapsed() << "s)." << std::endl;
 
-    // -----------------------------------------------------
+	// -----------------------------------------------------
 
-    std::cout << "Save tree ..." << std::endl;
+	std::cout << "Save tree in binary format ..." << std::endl;
 
-    FTreeIO::Save<OctreeClass, CellClass, LeafClass, ContainerClass >("/tmp/tree.data", tree);
+	FTreeIO::Save<OctreeClass, CellClass, LeafClass, ContainerClass >(filenameOUT.c_str(), tree);
 
-    // -----------------------------------------------------
+	// -----------------------------------------------------
 
-    std::cout << "Load tree ..." << std::endl;
+	std::cout << "Load tree in binary format  ..." << std::endl;
 
-    FTreeIO::Load<OctreeClass, CellClass, LeafClass, ContainerClass >("/tmp/tree.data", tree);
+	FTreeIO::Load<OctreeClass, CellClass, LeafClass, ContainerClass >(filenameOUT.c_str(),tree);
 
-    return 0;
+	return 0;
 }
 
 
diff --git a/UTests/CMakeLists.txt b/UTests/CMakeLists.txt
index 00dc1aebe..ba304301f 100755
--- a/UTests/CMakeLists.txt
+++ b/UTests/CMakeLists.txt
@@ -108,5 +108,9 @@ foreach(exec ${source_tests_files})
 			${execname}
 			${CMAKE_CURRENT_BINARY_DIR}/${execname}
 		)
+#			add_test(
+#			${execname}
+#			${CMAKE_CURRENT_BINARY_DIR}/${execname}
+#		)
 	endif()
 endforeach(exec)
diff --git a/UTests/noDist/utestListBlockAllocator.cpp b/UTests/noDist/utestListBlockAllocator.cpp
new file mode 100644
index 000000000..69fb188ce
--- /dev/null
+++ b/UTests/noDist/utestListBlockAllocator.cpp
@@ -0,0 +1,105 @@
+
+// ===================================================================================
+// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Brenger Bramas, Matthias Messner
+// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
+// This software is a computer program whose purpose is to compute the FMM.
+//
+// This software is governed by the CeCILL-C and LGPL licenses and
+// abiding by the rules of distribution of free software.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public and CeCILL-C Licenses for more details.
+// "http://www.cecill.info".
+// "http://www.gnu.org/licenses".
+// ===================================================================================
+#include "../FUTester.hpp"
+
+#include "Containers/FBlockAllocator.hpp"
+
+#include <cstring>
+
+/**
+* This file is a unit test for the List block allocator
+*/
+
+/**
+* This class is simply used to count alloc dealloc
+*/
+static const int SizeArray = 50;
+class TestObject{
+public:
+    static int counter;
+    static int dealloced;
+
+    int array[SizeArray];
+
+    TestObject(){
+        memset(array, 0, SizeArray * sizeof(int));
+        ++counter;
+    }
+    TestObject(const TestObject&){
+        ++counter;
+    }
+    ~TestObject(){
+        ++dealloced;
+    }
+};
+
+int TestObject::counter(0);
+int TestObject::dealloced(0);
+
+
+/** this class test the list container */
+class TestBlock : public FUTester<TestBlock> {
+    // Called before each test : simply set counter to 0
+    void PreTest(){
+        TestObject::counter = 0;
+        TestObject::dealloced = 0;
+    }
+
+    // test copy
+    void TestBlockFunction(){
+        FListBlockAllocator<TestObject, 10> alloc;
+
+        const int NbAlloc = 2;
+        TestObject* ptr[NbAlloc];
+        for(int idx = 0 ; idx < NbAlloc ; ++idx){
+            TestObject* dl1 = alloc.newObject();
+            TestObject* dl2 = alloc.newObject();
+            alloc.deleteObject(dl1);
+            ptr[idx] = alloc.newObject();
+            alloc.deleteObject(dl2);
+        }
+
+        for(int idx = 0 ; idx < 2 ; ++idx){
+            for(int idxval = 0 ; idxval < 17 ; ++idxval){
+                ptr[idx]->array[idxval] += (idxval * idx);
+            }
+        }
+
+        for(int idx = 0 ; idx < NbAlloc ; ++idx){
+            for(int idxval = 0 ; idxval < SizeArray ; ++idxval){
+                uassert(ptr[idx]->array[idxval] == (idxval * idx));
+            }
+        }
+
+        for(int idx = 0 ; idx < NbAlloc ; ++idx){
+            alloc.deleteObject(ptr[idx]);
+        }
+
+        uassert(TestObject::counter == (3*NbAlloc));
+        uassert(TestObject::counter == TestObject::dealloced);
+    }
+
+    // set test
+    void SetTests(){
+            AddTest(&TestBlock::TestBlockFunction,"Test Allocate Deallocate");
+    }
+};
+
+// You must do this
+TestClass(TestBlock)
+
+
diff --git a/UTests/utestChebyshevMultiRhs.cpp b/UTests/utestChebyshevMultiRhs.cpp
index 971c4aeac..fbdc1aafe 100644
--- a/UTests/utestChebyshevMultiRhs.cpp
+++ b/UTests/utestChebyshevMultiRhs.cpp
@@ -1,5 +1,5 @@
 // ===================================================================================
-// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
+// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
 // olivier.coulaud@inria.fr, berenger.bramas@inria.fr
 // This software is a computer program whose purpose is to compute the FMM.
 //
@@ -18,6 +18,7 @@
 // @FUSE_BLAS
 // ================
 
+#include "ScalFmmConfig.h"
 #include "../Src/Utils/FGlobal.hpp"
 
 #include "../Src/Containers/FOctree.hpp"
diff --git a/UTests/utestLagrange.cpp b/UTests/utestLagrange.cpp
index 226ba9bca..c5ef4269f 100755
--- a/UTests/utestLagrange.cpp
+++ b/UTests/utestLagrange.cpp
@@ -15,16 +15,15 @@
 // ===================================================================================
 
 // ==== CMAKE =====
-// @FUSE_BLAS
+// @FUSE_FFT
 // ================
-
+#include "ScalFmmConfig.h"
 #include "Utils/FGlobal.hpp"
 
 #include "Containers/FOctree.hpp"
 
 #include "Files/FFmaGenericLoader.hpp"
 
-#include "Core/FFmmAlgorithmThread.hpp"
 #include "Core/FFmmAlgorithm.hpp"
 
 #include "FUTester.hpp"
@@ -59,12 +58,14 @@ class TestLagrange : public FUTester<TestLagrange> {
 		//
 		if(sizeof(FReal) == sizeof(float) ) {
 			std::cerr << "No input data available for Float "<< std::endl;
-			exit(-1);
+			exit(EXIT_FAILURE);
 		}
-		const char* const filename = (sizeof(FReal) == sizeof(float))?
-				"../Data/UTest/DirectFloatbfma":
-				"../Data/UTest/DirectDouble.bfma";
-		//checkDirect.bfma
+		const std::string parFile( (sizeof(FReal) == sizeof(float))?
+				"Test/DirectFloatbfma":
+				"UTest/DirectDouble.bfma");
+		//
+		std::string filename(SCALFMMDataPath+parFile);
+		//
 		FFmaGenericLoader loader(filename);
 		Print("Number of particles:");
 		Print(loader.getNumberOfParticles());
@@ -213,8 +214,6 @@ class TestLagrange : public FUTester<TestLagrange> {
 	    typedef FOctree<CellClass,ContainerClass,LeafClass> OctreeClass;
 	    typedef FUnifKernel<CellClass,ContainerClass,MatrixKernelClass,ORDER> KernelClass;
 	    typedef FFmmAlgorithm<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
-	    //  typedef FFmmAlgorithmThread<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
-
 		// run test
 		RunTest<CellClass,ContainerClass,KernelClass,MatrixKernelClass,LeafClass,OctreeClass,FmmClass>();
 	}
diff --git a/UTests/utestSphericalDirectDebug.cpp b/UTests/utestSphericalDirectDebug.cpp
index 1a01b3889..c0b3fa3e9 100755
--- a/UTests/utestSphericalDirectDebug.cpp
+++ b/UTests/utestSphericalDirectDebug.cpp
@@ -1,5 +1,5 @@
 // ===================================================================================
-// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
+// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
 // olivier.coulaud@inria.fr, berenger.bramas@inria.fr
 // This software is a computer program whose purpose is to compute the FMM.
 //
@@ -14,6 +14,8 @@
 // "http://www.gnu.org/licenses".
 // ===================================================================================
 
+#include <iostream>
+
 #include "../Src/Utils/FGlobal.hpp"
 
 #include "../Src/Containers/FOctree.hpp"
-- 
GitLab