Commit 835b7587 authored by berenger-bramas's avatar berenger-bramas

Removed FMB from scalfmm.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@398 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 26fd25a5
......@@ -20,8 +20,7 @@ class F3DPosition;
* @class FAbstractLoader
* Please read the license
*
* This class defined the FMB usual loader. A loader is the component
* that fills an octree.
* A loader is the component that fills an octree.
*
* If you want to use a specific file format you then need to inherite from this loader
* and implemente several methods.
......
......@@ -29,7 +29,7 @@
* X Y Z // one particle by line
* ....
* <code>
* FBasicLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* FBasicLoader<FBasicParticle> loader("../Adir/Tests/particles.basic.txt"); <br>
* if(!loader.isOpen()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
......
......@@ -29,7 +29,7 @@
* X Y Z // one particle by line
* ....
* <code>
* FFmaBinLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* FFmaBinLoader<FBasicParticle> loader("../Adir/Tests/particles.basic.txt"); <br>
* if(!loader.isOpen()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
......
......@@ -29,7 +29,7 @@
* X Y Z // one particle by line
* ....
* <code>
* FFmaLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* FFmaLoader<FBasicParticle> loader("../ADir/Tests/particles.basic.txt"); <br>
* if(!loader.isOpen()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
......
......@@ -29,7 +29,7 @@
* X Y Z // one particle by line
* ....
* <code>
* FFmaScanfLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* FFmaScanfLoader<FBasicParticle> loader("../Adir/Tests/particles.basic.txt"); <br>
* if(!loader.isOpen()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
......
......@@ -29,7 +29,7 @@
* X Y Z // one particle by line
* ....
* <code>
* FFmaTsmLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* FFmaTsmLoader<FBasicParticle> loader("../Adir/Tests/particles.basic.txt"); <br>
* if(!loader.isOpen()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
......
......@@ -29,7 +29,7 @@
* X Y Z // one particle by line
* ....
* <code>
* FHLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* FHLoader<FBasicParticle> loader("../ADir/Tests/particles.basic.txt"); <br>
* if(!loader.isOpen()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
......
......@@ -30,7 +30,7 @@
* X Y Z // one particle by line
* ....
* <code>
* FMpiFmaLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* FMpiFmaLoader<FBasicParticle> loader("../ADir/Tests/particles.basic.txt"); <br>
* if(!loader.isOpen()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
......
#ifndef FTREEMPICSVSAVER_HPP
#define FTREEMPICSVSAVER_HPP
#include "../Utils/FGlobal.hpp"
#include "../Utils/FMpi.hpp"
#include <cstring>
#include <iostream>
#include <fstream>
/** This class is to export a tree in csv file
*
*/
template <class OctreeClass, class ContainerClass , class ParticleClass>
class FTreeMpiCsvSaver {
FMpi::FComm comm; //< Communicator
const bool includeHeader; //< To include a line of header
int nbFrames; //< The current frame
char basefile[512]; //< The base file name like "~/OUT/simulation%d.csv"
public:
/** Constructor
* @param inBasefile is the output file name, you must put %d in it
*/
FTreeMpiCsvSaver(const char inBasefile[], const FMpi::FComm& communicator, const bool inIncludeHeader = false)
: comm(communicator), includeHeader(inIncludeHeader), nbFrames(0) {
strcpy(basefile, inBasefile);
}
/** Virtual destructor
*/
virtual ~FTreeMpiCsvSaver(){
}
/** to know how many frame has been saved
*/
int getNbFrames() const {
return nbFrames;
}
/** export a tree
*/
void exportTree(OctreeClass*const tree){
char currentFilename[512];
sprintf(currentFilename, basefile, nbFrames++);
std::ofstream file(currentFilename, std::ofstream::out );
if(includeHeader){
file << "x, y, z, value\n";
}
typename OctreeClass::Iterator octreeIterator(tree);
octreeIterator.gotoBottomLeft();
do{
typename ContainerClass::BasicIterator iter(*octreeIterator.getCurrentListTargets());
//const bool isUsingTsm = (octreeIterator.getCurrentListTargets() != octreeIterator.getCurrentListSrc());
while( iter.hasNotFinished() ){
file << iter.data().getPosition().getX() << "," << iter.data().getPosition().getY() << "," <<
iter.data().getPosition().getZ() << "," << getValue(&iter.data()) << "\n";
iter.gotoNext();
}
} while(octreeIterator.moveRight());
file.close();
}
/** Inherit from this class and customize this function if you need it
*/
virtual FReal getValue(ParticleClass*const part){
return FReal(0);
}
};
#endif // FTREEMPICSVSAVER_HPP
......@@ -822,7 +822,6 @@ private:
/////////////////////////////////////////////////////////////////////
//spherical_position_Set_ph
//FMB_INLINE COORDINATES_T angle_Convert_in_MinusPi_Pi(COORDINATES_T a){
FReal ph = FMath::Fmod(spherical.getPhi(), FReal(2)*FMath::FPi);
if (ph > M_PI) ph -= FReal(2) * FMath::FPi;
if (ph < -M_PI + FMath::Epsilon) ph += FReal(2) * FMath::Epsilon;
......
......@@ -279,7 +279,7 @@ void print(OctreeClass* const valideTree){
// Types
/////////////////////////////////////////////////////////////////////
/** Fmb class has to extend {FExtendForces,FExtendPotential,FExtendPhysicalValue}
/** class has to extend {FExtendForces,FExtendPotential,FExtendPhysicalValue}
* Because we use fma loader it needs {FExtendPhysicalValue}
*/
class TestParticle : public FTestParticle, public FExtendPhysicalValue {
......
......@@ -36,7 +36,6 @@
/**
* In this file we show an example of FBasicLoader use
* Démarrage de /home/berenger/Dropbox/Personnel/FMB++/FMB++-build-desktop/FMB++...
* Inserting 2000000 particles ...
* Done (5.77996).
* Deleting particles ...
......
......@@ -50,7 +50,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithm<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
std::cout << ">> This executable has to be used to test Spherical algorithm.\n";
//////////////////////////////////////////////////////////////
const int DevP = FParameters::getValue(argc,argv,"-p", 8);
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
......
......@@ -51,7 +51,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithm<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
std::cout << ">> This executable has to be used to test Spherical algorithm.\n";
//////////////////////////////////////////////////////////////
const int DevP = FParameters::getValue(argc,argv,"-p", 8);
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
......
......@@ -133,7 +133,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithm<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
std::cout << ">> This executable has to be used to test Spherical algorithm.\n";
//////////////////////////////////////////////////////////////
const int DevP = FParameters::getValue(argc,argv,"-p", 8);
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
......
......@@ -81,7 +81,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithmPeriodic<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
std::cout << ">> This executable has to be used to test Spherical algorithm.\n";
//////////////////////////////////////////////////////////////
const int NbLevels = FParameters::getValue(argc,argv,"-h", 4);
......
......@@ -78,7 +78,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithmThread<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
std::cout << ">> This executable has to be used to test Spherical algorithm.\n";
//////////////////////////////////////////////////////////////
const int NbLevels = FParameters::getValue(argc,argv,"-h", 6);
......
......@@ -180,7 +180,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithmThreadProc<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
typedef FFmmAlgorithmThread<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClassNoProc;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
std::cout << ">> This executable has to be used to test Spherical algorithm.\n";
//////////////////////////////////////////////////////////////
FMpi app( argc, argv);
......
......@@ -50,7 +50,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithm<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
std::cout << ">> This executable has to be used to test Spherical algorithm.\n";
//////////////////////////////////////////////////////////////
const int DevP = FParameters::getValue(argc,argv,"-p", 8);
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
......
......@@ -49,7 +49,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithmTsm<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test Fmb on a Tsm system.\n";
std::cout << ">> This executable has to be used to test Spherical on a Tsm system.\n";
//////////////////////////////////////////////////////////////
const int DevP = FParameters::getValue(argc,argv,"-p", 8);
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
......
......@@ -63,7 +63,7 @@ int main(int argc, char ** argv){
typedef FFmmAlgorithmThreadTsm<OctreeClassTyped, ParticleClassTyped, CellClassTyped, ContainerClassTyped, KernelClassTyped, LeafClassTyped > FmmClassTyped;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test Fmb on a Tsm system.\n";
std::cout << ">> This executable has to be used to test Spherical on a Tsm system.\n";
std::cout << ">> It compares the results between Tms and no Tms (except P2P & L2P).\n";
//////////////////////////////////////////////////////////////
const int DevP = FParameters::getValue(argc,argv,"-p", 8);
......
......@@ -45,7 +45,7 @@ public:
};
class TestFmbDirect : public FUTester<TestFmbDirect> {
class TestSphericalDirect : public FUTester<TestSphericalDirect> {
typedef IndexedParticle ParticleClass;
typedef FSphericalCell CellClass;
typedef FVector<ParticleClass> ContainerClass;
......@@ -62,7 +62,7 @@ class TestFmbDirect : public FUTester<TestFmbDirect> {
void TestDirect(){
// Warning in make test the exec dir it Build/UTests
// Load particles
FFmaBinLoader<ParticleClass> loader("../../Data/utestFmbDirect.bin.fma");
FFmaBinLoader<ParticleClass> loader("../../Data/utestSphericalDirect.bin.fma");
if(!loader.isOpen()){
Print("Cannot open particles file.");
assert(false);
......@@ -169,13 +169,13 @@ class TestFmbDirect : public FUTester<TestFmbDirect> {
// set test
void SetTests(){
AddTest(&TestFmbDirect::TestDirect,"Test Simu and with direct");
AddTest(&TestSphericalDirect::TestDirect,"Test Simu and with direct");
}
};
// You must do this
TestClass(TestFmbDirect)
TestClass(TestSphericalDirect)
......@@ -41,7 +41,7 @@ public:
};
/** The class to run the test */
class TestFmbDirectPeriodic : public FUTester<TestFmbDirectPeriodic> {
class TestSphericalDirectPeriodic : public FUTester<TestSphericalDirectPeriodic> {
/** Here we test only the P2P */
void TestPeriodicP2P(){
typedef IndexedParticle ParticleClass;
......@@ -453,15 +453,15 @@ class TestFmbDirectPeriodic : public FUTester<TestFmbDirectPeriodic> {
// set test
void SetTests(){
AddTest(&TestFmbDirectPeriodic::TestPeriodicFmm,"Test Simu and with direct compare to Test fmm periodic");
AddTest(&TestFmbDirectPeriodic::TestPeriodicP2P,"Test direct compare to real fmm periodic (P2P only)");
AddTest(&TestFmbDirectPeriodic::TestDirectHigh,"Test direct compare to real fmm periodic");
AddTest(&TestSphericalDirectPeriodic::TestPeriodicFmm,"Test Simu and with direct compare to Test fmm periodic");
AddTest(&TestSphericalDirectPeriodic::TestPeriodicP2P,"Test direct compare to real fmm periodic (P2P only)");
AddTest(&TestSphericalDirectPeriodic::TestDirectHigh,"Test direct compare to real fmm periodic");
}
};
// You must do this
TestClass(TestFmbDirectPeriodic)
TestClass(TestSphericalDirectPeriodic)
......@@ -40,12 +40,12 @@ typedef FOctree<ParticleClass, CellClass, ContainerClass , LeafClass > OctreeCl
typedef FFmmAlgorithm<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
class TestFmb : public FUTester<TestFmb> {
class TestSphericalWithPrevious : public FUTester<TestSphericalWithPrevious> {
void TestTree(){
// Warning in make test the exec dir it Build/UTests
const char* const DataFile = "../../Data/utestFmb.data";
const char* const ParticleFile = "../../Data/utestFmb.bin.fma";
const char* const DataFile = "../../Data/utestSpherical.data";
const char* const ParticleFile = "../../Data/utestSpherical.bin.fma";
const int NbLevels = 5;
const int SizeSubLevels = 3;
......@@ -167,14 +167,14 @@ class TestFmb : public FUTester<TestFmb> {
// set test
void SetTests(){
AddTest(&TestFmb::TestTree,"Test Simu and compare tree");
AddTest(&TestSphericalWithPrevious::TestTree,"Test Simu and compare tree");
}
};
// You must do this
TestClass(TestFmb)
TestClass(TestSphericalWithPrevious)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment