Commit e4b8d3b4 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files
parents e120810c a4869a85
...@@ -30,6 +30,7 @@ class FTreeCoordinate; ...@@ -30,6 +30,7 @@ class FTreeCoordinate;
// ==== CMAKE ===== // ==== CMAKE =====
// @FUSE_BLAS // @FUSE_BLAS
// @FUSE_FFT
// ================ // ================
// for verbosity only!!! // for verbosity only!!!
...@@ -221,7 +222,7 @@ public: ...@@ -221,7 +222,7 @@ public:
// Target cell: local // Target cell: local
const FReal localCellWidth(KernelBaseClass::BoxWidth / FReal(FMath::pow(2.0, localLevel))); const FReal localCellWidth(KernelBaseClass::BoxWidth / FReal(FMath::pow(2.0, localLevel)));
const FPoint localCellCenter(KernelBaseClass::getCellCenter(local->getCoordinate(),localLevel)); const FPoint localCellCenter(KernelBaseClass::getCellCenter(local->getCoordinate(),localLevel));
std::cout << " call P2L localLevel "<< localLevel << " localCellCenter "<< localCellCenter <<std::endl; // std::cout << " call P2L localLevel "<< localLevel << " localCellCenter "<< localCellCenter <<std::endl;
// interpolation points of target (X) cell // interpolation points of target (X) cell
FPoint X[nnodes]; FPoint X[nnodes];
FUnifTensor<order>::setRoots(localCellCenter, localCellWidth, X); FUnifTensor<order>::setRoots(localCellCenter, localCellWidth, X);
...@@ -458,7 +459,7 @@ public: ...@@ -458,7 +459,7 @@ public:
for(int idxContainer = 0 ; idxContainer < nbContainers ; ++idxContainer){ for(int idxContainer = 0 ; idxContainer < nbContainers ; ++idxContainer){
counterParticles += particles[idxContainer]->getNbParticles(); counterParticles += particles[idxContainer]->getNbParticles();
} }
std::cout << " Part("<<counterParticles<< ") "; // std::cout << " Part("<<counterParticles<< ") ";
return counterParticles >this->sminM; return counterParticles >this->sminM;
} }
}; };
......
// =================================================================================== // ===================================================================================
// 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.
// //
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
* To chose which operation has to be performed. * To chose which operation has to be performed.
*/ */
enum FFmmOperations { enum FFmmOperations {
FFmmP2P = (1 << 0), FFmmP2P = (1 << 0),
FFmmP2M = (1 << 1), FFmmP2M = (1 << 1),
FFmmM2M = (1 << 2), FFmmM2M = (1 << 2),
FFmmM2L = (1 << 3), FFmmM2L = (1 << 3),
FFmmL2L = (1 << 4), FFmmL2L = (1 << 4),
FFmmL2P = (1 << 5), FFmmL2P = (1 << 5),
//
FFmmNearField = FFmmP2P, FFmmNearField = FFmmP2P,
FFmmFarField = (FFmmP2M|FFmmM2M|FFmmM2L|FFmmL2L|FFmmL2P), FFmmFarField = (FFmmP2M|FFmmM2M|FFmmM2L|FFmmL2L|FFmmL2P),
//
FFmmNearAndFarFields = (FFmmNearField|FFmmFarField) FFmmNearAndFarFields = (FFmmNearField|FFmmFarField)
}; };
...@@ -52,12 +52,15 @@ protected: ...@@ -52,12 +52,15 @@ protected:
int nbLevelsInTree; int nbLevelsInTree;
void setNbLevelsInTree(const int inNbLevelsInTree){ void setNbLevelsInTree(const int inNbLevelsInTree){
nbLevelsInTree = inNbLevelsInTree; nbLevelsInTree = inNbLevelsInTree;
lowerWorkingLevel = nbLevelsInTree; lowerWorkingLevel = nbLevelsInTree;
} }
void validateLevels() const { void validateLevels() const {
std::cout << "upperWorkingLevel: "<< FAbstractAlgorithm::upperWorkingLevel << std::endl
<< "lowerWorkingLevel "<< FAbstractAlgorithm::lowerWorkingLevel << std::endl ;
FAssertLF(FAbstractAlgorithm::upperWorkingLevel <= FAbstractAlgorithm::lowerWorkingLevel); FAssertLF(FAbstractAlgorithm::upperWorkingLevel <= FAbstractAlgorithm::lowerWorkingLevel);
std::cout << "End assert 1" << std::endl ;
FAssertLF(2 <= FAbstractAlgorithm::upperWorkingLevel); FAssertLF(2 <= FAbstractAlgorithm::upperWorkingLevel);
} }
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
// =================================================================================== // ===================================================================================
// ==== CMAKE ===== // ==== CMAKE =====
// @FUSE_BLAS
// @FUSE_FFT // @FUSE_FFT
// ================ // ================
// Keep in private GIT // Keep in private GIT
...@@ -30,9 +29,6 @@ ...@@ -30,9 +29,6 @@
#include "Utils/FTic.hpp" #include "Utils/FTic.hpp"
#include "Containers/FOctree.hpp" #include "Containers/FOctree.hpp"
//#include "Containers/FVector.hpp"
//#include "Components/FSimpleLeaf.hpp"
#include "Utils/FPoint.hpp" #include "Utils/FPoint.hpp"
...@@ -102,15 +98,12 @@ int main(int argc, char ** argv){ ...@@ -102,15 +98,12 @@ int main(int argc, char ** argv){
// const unsigned int NbThreads = FParameters::getValue(argc, argv, FParameterDefinitions::NbThreads.options, 1); // const unsigned int NbThreads = FParameters::getValue(argc, argv, FParameterDefinitions::NbThreads.options, 1);
// //
// accuracy // accuracy
const unsigned int P = 5 ; const unsigned int P = 7 ;
const int sminM = FParameters::getValue(argc,argv,LocalOptionMinMultipoleThreshod.options, P*P*P); const int sminM = FParameters::getValue(argc,argv,LocalOptionMinMultipoleThreshod.options, P*P*P);
const int sminL = FParameters::getValue(argc,argv,LocalOptionMinLocalThreshod.options, P*P*P); const int sminL = FParameters::getValue(argc,argv,LocalOptionMinLocalThreshod.options, P*P*P);
//
// typedef FTestCell CellClass;
// typedef FAdaptiveTestKernel< CellClass, ContainerClass > KernelClass;
typedef FUnifCell<P> CellClass; typedef FUnifCell<P> CellClass;
typedef FP2PParticleContainerIndexed<> ContainerClass; typedef FP2PParticleContainerIndexed<> ContainerClass;
typedef FSimpleIndexedLeaf<ContainerClass> LeafClass; typedef FSimpleIndexedLeaf<ContainerClass> LeafClass;
...@@ -191,8 +184,9 @@ int main(int argc, char ** argv){ ...@@ -191,8 +184,9 @@ int main(int argc, char ** argv){
std::cout << "Working on particles ..." << std::endl; std::cout << "Working on particles ..." << std::endl;
counter.tic(); counter.tic();
const MatrixKernelClass MatrixKernel; const MatrixKernelClass MatrixKernel;
KernelWrapperClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(),&MatrixKernel,sminM,sminL); // FTestKernels FBasicKernels KernelWrapperClass *kernels = new KernelWrapperClass(TreeHeight, loader.getBoxWidth(),
FmmClass algo(&tree,&kernels); //FFmmAlgorithm FFmmAlgorithmThread loader.getCenterOfBox(),&MatrixKernel,sminM,sminL); // FTestKernels FBasicKernels
FmmClass algo(&tree,kernels); //FFmmAlgorithm FFmmAlgorithmThread
// For debug purpose // For debug purpose
// Set Global id // Set Global id
...@@ -200,7 +194,7 @@ int main(int argc, char ** argv){ ...@@ -200,7 +194,7 @@ int main(int argc, char ** argv){
long int idCell = setGlobalID(tree); long int idCell = setGlobalID(tree);
// //
algo.execute(); algo.execute();
//
counter.tac(); counter.tac();
std::cout << "Done " << "(@Algorithm = " << counter.elapsed() << " s)." << std::endl; std::cout << "Done " << "(@Algorithm = " << counter.elapsed() << " s)." << std::endl;
// //
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// ==== CMAKE ===== // ==== CMAKE =====
// @FUSE_BLAS // @FUSE_BLAS
// ============== // ==============
#include <array>
#include "ScalFmmConfig.h" #include "ScalFmmConfig.h"
#include "Utils/FGlobal.hpp" #include "Utils/FGlobal.hpp"
...@@ -35,29 +36,33 @@ ...@@ -35,29 +36,33 @@
#include "Kernels/Chebyshev/FChebCell.hpp" #include "Kernels/Chebyshev/FChebCell.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp" #include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "Kernels/Chebyshev/FChebKernel.hpp"
#include "Kernels/Chebyshev/FChebSymKernel.hpp" #include "Kernels/Chebyshev/FChebSymKernel.hpp"
#include "Kernels/Uniform/FUnifCell.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "Kernels/Uniform/FUnifKernel.hpp"
#include "Kernels/P2P/FP2PParticleContainerIndexed.hpp" #include "Kernels/P2P/FP2PParticleContainerIndexed.hpp"
/* /*
In this test we compare the spherical FMM results and the direct results. In this test we compare the spherical FMM results and the direct results.
*/ */
/** the test class /** the test class
* *
*/ */
class TestChebyshevDirect : public FUTester<TestChebyshevDirect> { class TestInterpolationKernel : public FUTester<TestInterpolationKernel> {
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// The tests! // The tests!
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
template <class CellClass, class ContainerClass, class KernelClass, class MatrixKernelClass, template <class CellClass, class ContainerClass, class KernelClass, class MatrixKernelClass,
class LeafClass, class OctreeClass, class FmmClass, const int NVals> class LeafClass, class OctreeClass, class FmmClass, const int NVals>
void RunTest() { void RunTest() {
// Warning in make test the exec dir it Build/UTests // Warning in make test the exec dir it Build/UTests
// Load particles // Load particles
// //
// Load particles // Load particles
// //
...@@ -72,101 +77,113 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> { ...@@ -72,101 +77,113 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
std::string filename(SCALFMMDataPath+parFile); std::string filename(SCALFMMDataPath+parFile);
// //
FFmaGenericLoader loader(filename); FFmaGenericLoader loader(filename);
if(!loader.isOpen()){ if(!loader.isOpen()){
Print("Cannot open particles file."); Print("Cannot open particles file.");
uassert(false); uassert(false);
return; return;
} }
Print("Number of particles:"); Print("Number of particles:");
Print(loader.getNumberOfParticles()); Print(loader.getNumberOfParticles());
const int NbLevels = 4; const int NbLevels = 4;
const int SizeSubLevels = 2; const int SizeSubLevels = 2;
// Create Matrix Kernel // std::cout << "\nInterpolation FMM (ORDER="<< ORDER << ") ... " << std::endl;
const MatrixKernelClass MatrixKernel; // FUKernelTester is only designed to work with 1/R, i.e. matrix kernel ctor takes no argument.
// // Create Matrix Kernel
const MatrixKernelClass MatrixKernel; // FUKernelTester is only designed to work with 1/R, i.e. matrix kernel ctor takes no argument.
//
FSize nbParticles = loader.getNumberOfParticles() ; FSize nbParticles = loader.getNumberOfParticles() ;
FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles]; FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles];
loader.fillParticle(particles,nbParticles); loader.fillParticle(particles,nbParticles);
// //
// Create octree // Create octree
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox()); OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
// Insert particle in the tree // Insert particle in the tree
// //
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){ // For each particles we associate Nvals charge ( q,0,0,0)
tree.insert(particles[idxPart].getPosition() , idxPart, particles[idxPart].getPhysicalValue() ,0.0,0.0,0.0); //
/* for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
double q = particles[idxPart].getPhysicalValue();
tree.insert(particles[idxPart].getPosition() , idxPart, q,q);//,0.0,0.0,0.0);
}*/
for(int idxPart = 0 ; idxPart < nbParticles ; ++idxPart){
// // Convert FReal[NVALS] to std::array<FReal,NVALS>
std::array<FReal, (1+4*1)*NVals> physicalState;
for(int idxVals = 0 ; idxVals < NVals ; ++idxVals){
double q = particles[idxPart].getPhysicalValue();
physicalState[0*NVals+idxVals]= particles[idxPart].getPhysicalValue();
physicalState[1*NVals+idxVals]=0.0;
physicalState[2*NVals+idxVals]=0.0;
physicalState[3*NVals+idxVals]=0.0;
physicalState[4*NVals+idxVals]=0.0;
}
// put in tree
tree.insert(particles[idxPart].getPosition(), idxPart, physicalState);
} }
// //
// // Create octree
// for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
// FPoint position;
// FReal physicalValue;
// loader.fillParticle(&position,&physicalValue);
// // put in tree
// tree.insert(position, idxPart, physicalValue);
// // get copy
// particles[idxPart].position = position;
// particles[idxPart].physicalValue = physicalValue;
// particles[idxPart].potential = 0.0;
// particles[idxPart].forces[0] = 0.0;
// particles[idxPart].forces[1] = 0.0;
// particles[idxPart].forces[2] = 0.0;
// }
// Run FMM
Print("Fmm...");
KernelClass kernels(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(),&MatrixKernel);
FmmClass algo(&tree,&kernels);
algo.execute();
//
FReal energy= 0.0 , energyD = 0.0 ;
// Run direct computation //
Print("Direct...");
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
*(particles[idx].setPotential()) *= NVals ;
particles[idx].getForces()[0] *= NVals ;
particles[idx].getForces()[1] *= NVals ;
particles[idx].getForces()[2] *= NVals ;
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
//
// Compare
Print("Compute Diff...");
FMath::FAccurater potentialDiff;
FMath::FAccurater fx, fy, fz;
{ // Check that each particle has been summed with all other
// Run FMM
Print("Fmm...");
KernelClass kernels(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(),&MatrixKernel);
FmmClass algo(&tree,&kernels);
algo.execute();
//
FReal energy= 0.0 , energyD = 0.0 ;
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
//
// Compare
Print("Compute Diff...");
FMath::FAccurater potentialDiff[NVals];
FMath::FAccurater fx, fy, fz;
{
tree.forEachLeaf([&](LeafClass* leaf){ tree.forEachLeaf([&](LeafClass* leaf){
const FReal*const potentials = leaf->getTargets()->getPotentials(); //
const FReal*const physicalValues = leaf->getTargets()->getPhysicalValues(); for(int idxVals = 0 ; idxVals < NVals ; ++idxVals){
const FReal*const forcesX = leaf->getTargets()->getForcesX(); const FReal* const physicalValues = leaf->getTargets()->getPhysicalValues(idxVals);
const FReal*const forcesY = leaf->getTargets()->getForcesY(); const FReal*const potentials = leaf->getTargets()->getPotentials(idxVals);
const FReal*const forcesZ = leaf->getTargets()->getForcesZ(); const FReal*const forcesX = leaf->getTargets()->getForcesX(idxVals);
const int nbParticlesInLeaf = leaf->getTargets()->getNbParticles(); const FReal*const forcesY = leaf->getTargets()->getForcesY(idxVals);
const FVector<int>& indexes = leaf->getTargets()->getIndexes(); const FReal*const forcesZ = leaf->getTargets()->getForcesZ(idxVals);
const int nbParticlesInLeaf = leaf->getTargets()->getNbParticles();
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){ const FVector<int>& indexes = leaf->getTargets()->getIndexes();
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].getPotential(),potentials[idxPart]); for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
fx.add(particles[indexPartOrig].getForces()[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].getForces()[1],forcesY[idxPart]); const int indexPartOrig = indexes[idxPart];
fz.add(particles[indexPartOrig].getForces()[2],forcesZ[idxPart]); // std::cout << " index "<< indexPartOrig << " " << particles[indexPartOrig].getPotential() << " " << potentials[idxPart] << std::endl;
energy += potentials[idxPart]*physicalValues[idxPart]; potentialDiff[idxVals].add(particles[indexPartOrig].getPotential(),potentials[idxPart]);
//
fx.add(particles[indexPartOrig].getForces()[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].getForces()[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].getForces()[2],forcesZ[idxPart]);
//
energy += potentials[idxPart]*physicalValues[idxPart];
}
} }
}); });
}
}
delete[] particles; delete[] particles;
energy /=NVals;
// Print for information // Print for information
double errorPotRL2=0.0, errorPotRMS=0.0;
Print("Potential diff is = "); Print("Potential diff is = ");
printf(" Pot L2Norm %e\n",potentialDiff.getL2Norm()); for(int idxVals = 0 ; idxVals < NVals ; ++idxVals){
printf(" Pot RL2Norm %e\n",potentialDiff.getRelativeL2Norm()); printf(" Charge: %d\n", idxVals);
printf(" Pot RMSError %e\n",potentialDiff.getRMSError()); printf(" Pot L2Norm %e\n",potentialDiff[idxVals].getL2Norm());
printf(" Pot RL2Norm %e\n",potentialDiff[idxVals].getRelativeL2Norm());
printf(" Pot RMSError %e\n",potentialDiff[idxVals].getRMSError());
errorPotRL2 = std::max(errorPotRL2, potentialDiff[idxVals].getRelativeL2Norm());
errorPotRMS = std::max(errorPotRMS, potentialDiff[idxVals].getRMSError());
}
Print("Fx diff is = "); Print("Fx diff is = ");
printf(" Fx L2Norm %e\n",fx.getL2Norm()); printf(" Fx L2Norm %e\n",fx.getL2Norm());
printf(" Fx RL2Norm %e\n",fx.getRelativeL2Norm()); printf(" Fx RL2Norm %e\n",fx.getRelativeL2Norm());
...@@ -185,14 +202,14 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> { ...@@ -185,14 +202,14 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
printf(" Energy FMM = %.12e\n",FMath::Abs(energy)); printf(" Energy FMM = %.12e\n",FMath::Abs(energy));
printf(" Energy DIRECT = %.12e\n",FMath::Abs(energyD)); printf(" Energy DIRECT = %.12e\n",FMath::Abs(energyD));
// Assert // Assert
const FReal MaximumDiffPotential = FReal(9e-3); const FReal MaximumDiffPotential = FReal(9e-3);
const FReal MaximumDiffForces = FReal(9e-2); const FReal MaximumDiffForces = FReal(9e-2);
Print("Test1 - Error Relative L2 norm Potential "); Print("Test1 - Error Relative L2 norm Potential ");
uassert(potentialDiff.getRelativeL2Norm() < MaximumDiffPotential); //1 uassert(errorPotRL2 < MaximumDiffPotential); //1
Print("Test2 - Error RMS L2 norm Potential "); Print("Test2 - Error RMS L2 norm Potential ");
uassert(potentialDiff.getRMSError() < MaximumDiffPotential); //2 uassert(errorPotRMS< MaximumDiffPotential); //2
Print("Test3 - Error Relative L2 norm FX "); Print("Test3 - Error Relative L2 norm FX ");
uassert(fx.getRelativeL2Norm() < MaximumDiffForces); //3 uassert(fx.getRelativeL2Norm() < MaximumDiffForces); //3
Print("Test4 - Error RMS L2 norm FX "); Print("Test4 - Error RMS L2 norm FX ");
...@@ -211,92 +228,96 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> { ...@@ -211,92 +228,96 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
uassert(FMath::Abs(energy-energyD) /energyD< MaximumDiffPotential); //10 Total Energy uassert(FMath::Abs(energy-energyD) /energyD< MaximumDiffPotential); //10 Total Energy
// Compute multipole local rhs diff // Compute multipole local rhs diff
FMath::FAccurater localDiff; FMath::FAccurater localDiff;
FMath::FAccurater multiPoleDiff; FMath::FAccurater multiPoleDiff;
tree.forEachCell([&](CellClass* cell){ tree.forEachCell([&](CellClass* cell){
for( int idxRhs = 1 ; idxRhs < NVals ; ++idxRhs){ for( int idxRhs = 1 ; idxRhs < NVals ; ++idxRhs){
localDiff.add(cell->getLocal(0), cell->getLocal(idxRhs), cell->getVectorSize()); localDiff.add(cell->getLocal(0), cell->getLocal(idxRhs), cell->getVectorSize());
multiPoleDiff.add(cell->getMultipole(0), cell->getMultipole(idxRhs), cell->getVectorSize()); multiPoleDiff.add(cell->getMultipole(0), cell->getMultipole(idxRhs), cell->getVectorSize());
} }
}); });
Print("Local diff is = "); Print("Local diff is = ");
Print(localDiff.getL2Norm()); Print(localDiff.getL2Norm());
Print(localDiff.getInfNorm()); Print(localDiff.getInfNorm());
Print("Multipole diff is = "); Print("Multipole diff is = ");
Print(multiPoleDiff.getL2Norm()); Print(multiPoleDiff.getL2Norm());
Print(multiPoleDiff.getInfNorm()); Print(multiPoleDiff.getInfNorm());
uassert(localDiff.getL2Norm() < 1e-10); uassert(localDiff.getL2Norm() < 1e-10);
uassert(localDiff.getInfNorm() < 1e-10); uassert(localDiff.getInfNorm() < 1e-10);
uassert(multiPoleDiff.getL2Norm() < 1e-10); uassert(multiPoleDiff.getL2Norm() < 1e-10);
uassert(multiPoleDiff.getInfNorm() < 1e-10); uassert(multiPoleDiff.getInfNorm() < 1e-10);
} }
/** If memstas is running print the memory used */ /** If memstas is running print the memory used */
void PostTest() { void PostTest() {
if( FMemStats::controler.isUsed() ){ if( FMemStats::controler.isUsed() ){
std::cout << "Memory used at the end " << FMemStats::controler.getCurrentAllocated() std::cout << "Memory used at the end " << FMemStats::controler.getCurrentAllocated()
<< " Bytes (" << FMemStats::controler.getCurrentAllocatedMB() << "MB)\n"; << " Bytes (" << FMemStats::controler.getCurrentAllocatedMB() << "MB)\n";
std::cout << "Max memory used " << FMemStats::controler.getMaxAllocated() std::cout << "Max memory used " << FMemStats::controler.getMaxAllocated()
<< " Bytes (" << FMemStats::controler.getMaxAllocatedMB() << "MB)\n"; << " Bytes (" << FMemStats::controler.getMaxAllocatedMB() << "MB)\n";
std::cout << "Total memory used " << FMemStats::controler.getTotalAllocated() std::cout << "Total memory used " << FMemStats::controler.getTotalAllocated()
<< " Bytes (" << FMemStats::controler.getTotalAllocatedMB() << "MB)\n"; << " Bytes (" << FMemStats::controler.getTotalAllocatedMB() << "MB)\n";
} }
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Set the tests! // Set the tests!
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
/** TestChebKernel */ /** TestUnifKernel */
void TestChebKernel(){ void TestUnifKernel(){
const int NVals = 4; const int NVals = 1;
const unsigned int ORDER = 6 ; const unsigned int ORDER = 6 ;
typedef FP2PParticleContainerIndexed<> ContainerClass; // run test
typedef FSimpleLeaf<ContainerClass> LeafClass; typedef FInterpMatrixKernelR MatrixKernelClass;
typedef FInterpMatrixKernelR MatrixKernelClass;
typedef FChebCell<ORDER, 1, 1, NVals> CellClass;
typedef FOctree<CellClass,ContainerClass,LeafClass> OctreeClass; typedef FP2PParticleContainerIndexed<1,1,NVals> ContainerClass;
typedef FChebKernel<CellClass,ContainerClass,MatrixKernelClass,ORDER, NVals> KernelClass; typedef FSimpleLeaf< ContainerClass > LeafClass;
typedef FFmmAlgorithm<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass; typedef FUnifCell<ORDER,1,1,NVals> CellClass;
// run test typedef FOctree<CellClass,ContainerClass,LeafClass> OctreeClass;
RunTest<CellClass,ContainerClass,KernelClass,MatrixKernelClass,LeafClass,OctreeClass,FmmClass, NVals>(); typedef FUnifKernel<CellClass,ContainerClass,MatrixKernelClass,ORDER,NVals> KernelClass;
} typedef FFmmAlgorithm<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
/** TestChebSymKernel */ RunTest<CellClass,ContainerClass,KernelClass,MatrixKernelClass,LeafClass,OctreeClass,FmmClass, NVals>();
void TestChebSymKernel(){ }
const int NVals = 4;
const unsigned int ORDER = 6; /** TestChebSymKernel */
typedef FP2PParticleContainerIndexed<> ContainerClass; void TestChebSymKernel(){
typedef FSimpleLeaf<ContainerClass> LeafClass;