Commit f962fec9 authored by COULAUD Olivier's avatar COULAUD Olivier

Now we can load files with and without potential and forces

parent b1f3080b
......@@ -46,6 +46,7 @@
#include "Core/FFmmAlgorithmTask.hpp"
#include "Core/FFmmAlgorithmNewTask.hpp"
#include "Core/FFmmAlgorithmSectionTask.hpp"
#include "Core/FFmmAlgorithmOmp4.hpp"
#else
#include "Core/FFmmAlgorithm.hpp"
#endif
......@@ -73,6 +74,7 @@ using KernelType = FInterpolationKernel<FReal,CellType,ContainerType,MatrixKe
using TaskFmmAlgo = FFmmAlgorithmTask<OctreeType,CellType,ContainerType,KernelType,LeafType>;
using TaskNewFmmAlgo = FFmmAlgorithmNewTask<OctreeType,CellType,ContainerType,KernelType,LeafType>;
using SectionTaskFmmAlgo = FFmmAlgorithmSectionTask<OctreeType,CellType,ContainerType,KernelType,LeafType> ;
using Omp4FmmAlgo = FFmmAlgorithmOmp4<OctreeType,CellType,ContainerType,KernelType,LeafType>;
#else
using FmmType = FFmmAlgorithm<OctreeType,CellType,ContainerType,KernelType,LeafType>;
#endif
......@@ -128,18 +130,29 @@ int main(int argc, char* argv[]) {
////////////////////////////////////////////////////////////////////
//
FFmaGenericLoader<FReal> loader(filename);
if (loader.getNbRecordPerline() !=8 ){
if (loader.getNbRecordPerline() !=8 && FParameters::existParameter(argc, argv, "-cmp") ){
std::cerr << "File should contain 8 data to read (x,y,z,q,p,fx,fy,fz)\n";
std::exit(EXIT_FAILURE);
}
FSize nbParticles = loader.getNumberOfParticles() ;
FmaRWParticle<FReal,8,8> * const particles = new FmaRWParticle<FReal, 8,8>[nbParticles];
//
//
//
// open particle file
////////////////////////////////////////////////////////////////////
//
loader.fillParticle(particles,nbParticles);
if(loader.getNbRecordPerline() == 8 ){
loader.fillParticle(particles,nbParticles);
}
else {
FmaRWParticle<FReal,4,4> * const part = new FmaRWParticle<FReal, 4,4>[nbParticles];
loader.fillParticle(part,nbParticles);
for(int idx = 0 ; idx < nbParticles ; ++idx){
auto p = part[idx].getPosition() ;
particles[idx].setPosition(p) ;
particles[idx].setPhysicalValue(part[idx].getPhysicalValue() );
}
}
time.tac();
//
// init oct-tree
......@@ -186,7 +199,7 @@ int main(int argc, char* argv[]) {
TaskFmmAlgo algo1(&tree, kernels.get() );
TaskNewFmmAlgo algo2(&tree, kernels.get() );
SectionTaskFmmAlgo algo3(&tree, kernels.get() );
Omp4FmmAlgo algo4(&tree, kernels.get() );
FAbstractAlgorithm * algo = nullptr;
FAlgorithmTimers * timer = nullptr;
......@@ -198,7 +211,10 @@ int main(int argc, char* argv[]) {
timer = &algo2 ;
} else if ( "sectiontask" == algoStr ) {
algo = &algo3 ;
timer = &algo3 ;
timer = &algo3 ;
} else if ( "omp4" == algoStr ) {
algo = &algo4 ;
timer = &algo4 ;
} else {
std::cout << "Unknown algorithm: " << algoStr << std::endl;
std::exit(EXIT_FAILURE);
......
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