Commit 75ffdf9c authored by COULAUD Olivier's avatar COULAUD Olivier

Improvements

parent 707a196a
...@@ -258,23 +258,23 @@ int main(int argc, char ** argv){ ...@@ -258,23 +258,23 @@ int main(int argc, char ** argv){
exit(-1) ; exit(-1) ;
} // } //
// //
// Export data in cvs format // Export data in VTK format
// //
if( fmt == "vtp" ){ if( fmt == "vtp" ){
std::cout << "Writes in XML VTP format (visualization) in file "<< visufile <<std::endl ; 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" ){ else if( fmt == "vtk" ){
std::cout << "Writes in VTK format (visualization) in file "<< visufile <<std::endl ; std::cout << "Writes in VTK format (visualization) in file "<< visufile <<std::endl ;
exportVTK( file, NbPoints, particles) ; exportVTK( file, particles, NbPoints) ;
} }
else if( fmt == "cosmo" ){ else if( fmt == "cosmo" ){
std::cout << "Writes in COSMO format (visualization) in file "<< visufile <<std::endl ; std::cout << "Writes in COSMO format (visualization) in file "<< visufile <<std::endl ;
exportCOSMOS( file, NbPoints, particles) ; exportCOSMOS( file, particles, NbPoints) ;
} }
else { else {
std::cout << "Writes in CVS format (visualization) in file "<<visufile<<std::endl ; std::cout << "Writes in CVS format (visualization) in file "<<visufile<<std::endl ;
exportCVS( file, NbPoints, particles) ; exportCVS( file, particles, NbPoints) ;
} }
} }
// //
......
...@@ -99,16 +99,7 @@ int main(int argc, char ** argv){ ...@@ -99,16 +99,7 @@ int main(int argc, char ** argv){
<<std::endl; <<std::endl;
// //
std::cout << "Opening : " << filename << "\n"; FFmaGenericLoader loader(filename);
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;
}
// ----------------------------------------------------- // -----------------------------------------------------
OctreeClass tree(TreeHeight, SubTreeHeight,loader.getBoxWidth(),loader.getCenterOfBox()); OctreeClass tree(TreeHeight, SubTreeHeight,loader.getBoxWidth(),loader.getCenterOfBox());
// //
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#define FADAPTCELL_HPP #define FADAPTCELL_HPP
#include <cstddef> #include <cstddef>
#include <iostream>
#include <vector> #include <vector>
// //
#include "Components/FBasicCell.hpp" #include "Components/FBasicCell.hpp"
...@@ -58,7 +59,7 @@ protected: ...@@ -58,7 +59,7 @@ protected:
// //
CellClass * trueFMMCell ; //<a pointer on the cell that contains Multipole and local values CellClass * trueFMMCell ; //<a pointer on the cell that contains Multipole and local values
public: public:
FAdaptCell(): gID(-1), nbP(0), adaptive(false),trueFMMCell(nullptr) { FAdaptCell(): gID(-1), nbP(0), adaptive(false),sminMCriteria(false),trueFMMCell(nullptr) {
} }
/** Default destructor */ /** Default destructor */
virtual ~FAdaptCell(){ virtual ~FAdaptCell(){
......
// =================================================================================== // ===================================================================================
// 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 // olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM. // This software is a computer program whose purpose is to compute the FMM.
// //
......
...@@ -1052,7 +1052,8 @@ private: ...@@ -1052,7 +1052,8 @@ private:
FMpiBufferWriter** sendBuffer; FMpiBufferWriter** sendBuffer;
FMpiBufferReader** recvBuffer; 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(); int threadIdx = omp_get_thread_num();
typename OctreeClass::Iterator octreeIterator(tree); typename OctreeClass::Iterator octreeIterator(tree);
......
...@@ -18,10 +18,12 @@ ...@@ -18,10 +18,12 @@
#ifndef FFmaGenericLoader_HPP #ifndef FFmaGenericLoader_HPP
#define FFmaGenericLoader_HPP #define FFmaGenericLoader_HPP
#include <ios>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <cstdlib>
// //
#include "Utils/FGlobal.hpp" #include "Utils/FGlobal.hpp"
#include "FAbstractLoader.hpp" #include "FAbstractLoader.hpp"
...@@ -31,18 +33,17 @@ ...@@ -31,18 +33,17 @@
// //
//! \class FmaBasicParticle //! \class FmaR4W4Particle
//! //!
//! \brief Basic Particle class used in FMA loader and writer //! \brief Basic Particle class used in FMA loader and writer
//! //!
//! Here we consider the position, the physical value in the structure //! Here we consider only the position and the physical value in the structure
//! but we read only the four first values the position, the physical value //! We read (R4) and write (W4) the four values: the position, the physical value.
//! this class is used in the generateDistributions example. //! This class is used in the generateDistributions example.
//! //!
class FmaBasicParticle { class FmaR4W4Particle {
public: public:
FPoint position; ///< position of the particle FPoint position; ///< position of the particle
// FReal x,y,z; ///< position of the particle
FReal physicalValue; ///< its physical value FReal physicalValue; ///< its physical value
/** /**
* return a pointer on the first value of the structure * return a pointer on the first value of the structure
...@@ -65,19 +66,18 @@ public: ...@@ -65,19 +66,18 @@ public:
* return size in byte of the structure. it is used in FMAGenericWriter * return size in byte of the structure. it is used in FMAGenericWriter
*/ */
unsigned int getWriteDataSize() const unsigned int getWriteDataSize() const
{ return sizeof(FmaBasicParticle);} { return sizeof(FmaR4W4Particle);}
}; };
//! \class FmaRParticle //! \class FmaR4W8Particle
//! //!
//! \brief The Particle class used in FMA loader and writer //! \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 //! In this class 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. //! 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 is used if you create an array of particles and you read them from a file generate by gerateDistributions //! 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..
//! and you want to store the result.
//! //!
class FmaRParticle { class FmaR4W8Particle {
public: public:
FPoint position; ///< position of the particle FPoint position; ///< position of the particle
FReal physicalValue; ///< its physical value (mass or charge FReal physicalValue; ///< its physical value (mass or charge
...@@ -105,20 +105,19 @@ public: ...@@ -105,20 +105,19 @@ public:
* return size in byte of the structure. it is used in FMAGenericWriter * return size in byte of the structure. it is used in FMAGenericWriter
*/ */
unsigned int getWriteDataSize() const unsigned int getWriteDataSize() const
{ return sizeof(FmaRParticle);} { return sizeof(FmaR4W8Particle);}
}; };
// //
//! \class FmaParticle //! \class FmaR8W8Particle
//! //!
//! \brief The Particle class used in FMA loader and writer //! \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 //! Same as FmaR4W8Particle class but here we want to read (R8) all the data (8 values) and want to store also all the data.
//! and we read and write all the data in the structure
//! This class is used if you create an array of particles from a file generate by a previous computation (directComputation or a FMM computation) //! 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: public:
/** /**
* return The number of data to read. it is used in FMAGenericLoader (here 8) * return The number of data to read. it is used in FMAGenericLoader (here 8)
...@@ -128,10 +127,12 @@ public: ...@@ -128,10 +127,12 @@ public:
int getReadDataNumber() int getReadDataNumber()
{ return 8;} { return 8;}
}; };
//!\typedef FmaBasicParticle an alias of FmaR4W4Particle
typedef FmaBasicParticle FmaR4W4Particle ; //! Particle contains 4 values of type FReal and we read and write the four values
typedef FmaRParticle FmaR4W8Particle ; //!
typedef FmaParticle FmaR8W8Particle ; typedef FmaR4W4Particle FmaBasicParticle ;
typedef FmaR4W8Particle FmaRParticle ;
typedef FmaR8W8Particle FmaParticle ;
// //
//! \class FFmaGenericLoader //! \class FFmaGenericLoader
//! //!
...@@ -149,9 +150,9 @@ typedef FmaParticle FmaR8W8Particle ; ...@@ -149,9 +150,9 @@ typedef FmaParticle FmaR8W8Particle ;
//! 8 the Particle Values are X X Y Z Q P FX FY FZ<br> //! 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> //! There is 3 methods to read the data from the file <br>
//! 1) fillParticle(FPoint*, FReal*);<br> //! -# fillParticle(FPoint*, FReal*);<br>
//! 2) fillParticle(FReal*, int);<br> //! -# fillParticle(FReal*, int);<br>
//! 3 fillParticle(PartClass);<br> //! -# fillParticle(PartClass);<br>
//! //!
//! \code //! \code
//! FFmaGenericLoader loader("../Data/unitCubeXYZQ20k.fma"); // extension fma --> ascii format //! FFmaGenericLoader loader("../Data/unitCubeXYZQ20k.fma"); // extension fma --> ascii format
...@@ -201,7 +202,7 @@ public: ...@@ -201,7 +202,7 @@ public:
// test if open // test if open
if(! this->file->is_open()){ if(! this->file->is_open()){
std::cerr << "File "<< filename<<" not opened! " <<std::endl; std::cerr << "File "<< filename<<" not opened! " <<std::endl;
exit(-1); std::exit( EXIT_FAILURE);
} }
this->readHeader(); this->readHeader();
} }
...@@ -213,7 +214,8 @@ public: ...@@ -213,7 +214,8 @@ public:
* This means that we can obtain after the call the number of particles, ... * This means that we can obtain after the call the number of particles, ...
* you can test if file is successfully open by calling hasNotFinished() * 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"); std::string ext(".bfma");
// open particle file // open particle file
if(filename.find(ext) != std::string::npos) { if(filename.find(ext) != std::string::npos) {
...@@ -225,12 +227,12 @@ public: ...@@ -225,12 +227,12 @@ public:
} }
else { else {
std::cout << "Input file not allowed only .fma or .bfma extensions" <<std::endl; std::cout << "Input file not allowed only .fma or .bfma extensions" <<std::endl;
exit (-1) ; std::exit ( EXIT_FAILURE) ;
} }
// test if open // test if open
if(! this->file->is_open()){ if(! this->file->is_open()){
std::cerr << "File "<< filename<<" not opened! " <<std::endl; std::cerr << "File "<< filename<<" not opened! " <<std::endl;
exit(-1); std::exit( EXIT_FAILURE);
} }
this->readHeader(); this->readHeader();
} }
...@@ -418,7 +420,7 @@ private: ...@@ -418,7 +420,7 @@ private:
std::cout << " Datatype "<< typeData[0] << " "<< typeData[1] << std::endl; std::cout << " Datatype "<< typeData[0] << " "<< typeData[1] << std::endl;
if(typeData[0] != sizeof(FReal)){ 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; 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{ else{
file->read( (char*)&(this->nbParticles), sizeof(FSize) ); file->read( (char*)&(this->nbParticles), sizeof(FSize) );
...@@ -493,12 +495,12 @@ public: ...@@ -493,12 +495,12 @@ public:
} }
else { else {
std::cout << "Input file not allowed only .fma or .bfma extensions" <<std::endl; std::cout << "Input file not allowed only .fma or .bfma extensions" <<std::endl;
exit (-1) ; std::exit ( EXIT_FAILURE) ;
} }
// test if open // test if open
if(! this->file->is_open()){ if(! this->file->is_open()){
std::cerr << "File "<< filename<<" not opened! " <<std::endl; std::cerr << "File "<< filename<<" not opened! " <<std::endl;
exit(-1); std::exit( EXIT_FAILURE);
} }
} }
/** /**
...@@ -522,7 +524,7 @@ public: ...@@ -522,7 +524,7 @@ public:
// test if open // test if open
if(! this->file->is_open()){ if(! this->file->is_open()){
std::cerr << "File "<< filename<<" not opened! " <<std::endl; std::cerr << "File "<< filename<<" not opened! " <<std::endl;
exit(-1); std::exit( EXIT_FAILURE);
} }
} }
/** /**
...@@ -710,7 +712,7 @@ private: ...@@ -710,7 +712,7 @@ private:
file->write((char*)typeFReal,2*sizeof(unsigned int)); file->write((char*)typeFReal,2*sizeof(unsigned int));
if(typeFReal[0] != sizeof(FReal)){ 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; 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{ else{
file->write( (char*)&(nbParticles), sizeof(FSize) ); file->write( (char*)&(nbParticles), sizeof(FSize) );
......
// =================================================================================== // ===================================================================================
// 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 // olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM. // This software is a computer program whose purpose is to compute the FMM.
// //
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <cstdlib> #include <cstdlib>
#include <time.h> #include <ctime>
#include "../Utils/FGlobal.hpp" #include "../Utils/FGlobal.hpp"
...@@ -41,13 +41,18 @@ protected: ...@@ -41,13 +41,18 @@ protected:
public: public:
/** /**
* The constructor need the simulation data * 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, 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) { : nbParticles(inNbParticles), boxWidth(inBoxWidth), centerOfBox(inCenterOfBox) {
srand48(inSeed); srand48(inSeed);
} }
/** /**
* Default destructor * Default destructor
*/ */
...@@ -110,7 +115,7 @@ public: ...@@ -110,7 +115,7 @@ public:
class FRandomLoaderTsm : public FRandomLoader { class FRandomLoaderTsm : public FRandomLoader {
public: public:
FRandomLoaderTsm(const size_t inNbParticles, const FReal inBoxWidth = 1.0, 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) { : FRandomLoader(inNbParticles,inBoxWidth,inCenterOfBox,inSeed) {
} }
......
...@@ -98,4 +98,10 @@ ...@@ -98,4 +98,10 @@
#pragma warning (disable : 2326 ) #pragma warning (disable : 2326 )
#endif #endif
///////////////////////////////////////////////////////
// Path to the ScalFMM DATA (For UTests)
///////////////////////////////////////////////////////
#include <string>
const std::string SCALFMMDataPath("@CMAKE_SOURCE_DIR@/Data/");
#endif // CONFIG_H #endif // CONFIG_H
...@@ -171,7 +171,7 @@ void unifRandonPointsOnSphere(const int N , const FReal R, FReal * points) { ...@@ -171,7 +171,7 @@ void unifRandonPointsOnSphere(const int N , const FReal R, FReal * points) {
points[j+2] *= R ; points[j+2] *= R ;
} }
}; };
//! \fn FReal plummerDist(int & cpt, const FReal &R) //! \fn void plummerDist(int & cpt, const FReal &R)
//! \brief Radial Plummer distribution //! \brief Radial Plummer distribution
...@@ -180,11 +180,11 @@ void unifRandonPointsOnSphere(const int N , const FReal R, FReal * points) { ...@@ -180,11 +180,11 @@ void unifRandonPointsOnSphere(const int N , const FReal R, FReal * points) {
//! \param R : Radius of the sphere that contains the particles //! \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 //! @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 ; FReal radius ,u ;
do { do {
//radius = getRandom() ; //
u = FMath::pow (getRandom() , 2.0/3.0) ; u = FMath::pow (getRandom() , 2.0/3.0) ;
radius = FMath::Sqrt (u/(1.0-u)); radius = FMath::Sqrt (u/(1.0-u));
cpt++; cpt++;
...@@ -226,23 +226,48 @@ void unifRandonPlummer(const int N , const FReal R, const FReal M, FReal * point ...@@ -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; <<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 //! \brief Export particles in CVS Format
//! //!
//! Export particles in CVS Format as follow //! 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 //! 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; int j = 0;
file << " x , y , z, q " <<std::endl; if (nbDataPerParticle==4){
for(int i = 0 ; i< N; ++i, j+=4){ file << " x , y , z, q " <<std::endl;
file << particles[j] << " , " << particles[j+1] << " , " << particles[j+2] << " , " << particles[j+3] <<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; int j = 0;
file << " x , y , z, q " <<std::endl; file << " x , y , z, q " <<std::endl;
for(int i = 0 ; i< N; ++i, j+=4){ for(int i = 0 ; i< N; ++i, j+=4){
...@@ -250,7 +275,20 @@ void exportCOSMOS(std::ofstream& file, const int N, const FReal * particles ){ ...@@ -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; int j = 0;
//--------------------------- //---------------------------
// print generic information // print generic information
...@@ -266,26 +304,39 @@ void exportVTK(std::ofstream& VTKfile, const int N, const FReal * particles ){ ...@@ -266,26 +304,39 @@ void exportVTK(std::ofstream& VTKfile, const int N, const FReal * particles ){
//--------------------------------- //---------------------------------
VTKfile << "POINTS " << N << " float" << "\n"; 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 << particles[j] << " " << particles[j+1] << " " << particles[j+2] <<std::endl;
} }
// ------------------------------------------ // ------------------------------------------
VTKfile << "\n"; VTKfile << "\n";
VTKfile << "VERTICES " << N << " " << 2*N << "\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 << " 1 " << " " <<i<<std::endl;
} }
VTKfile << "POINT_DATA " << N << "\n"; VTKfile << "POINT_DATA " << N << "\n";
VTKfile << "SCALARS PhysicalValue float 1" << "\n" VTKfile << "SCALARS PhysicalValue float 1" << "\n"
<< "LOOKUP_TABLE default" << "\n" ; << "LOOKUP_TABLE default" << "\n" ;
j = 0 ; j = 0 ;
for(int i = 0 ; i< N; ++i, j+=4){ for(int i = 0 ; i< N;