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

Improvements

parent 707a196a
......@@ -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) ;
}
}
//
......
......@@ -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());
//
......
......@@ -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(){
......
// ===================================================================================
// 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.
//
......
......@@ -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);
......
......@@ -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) );
......
// ===================================================================================
// 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) {
}
......
......@@ -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
......@@ -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
......@@ -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;
......
......@@ -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
......
// ===================================================================================
// 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(),
......
......@@ -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"));
// -----------------------------------------------------
......
......@@ -18,6 +18,7 @@
#include <cstdio>
#include <cstdlib>