Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f1c73fe2 authored by Olivier COULAUD's avatar Olivier COULAUD
Browse files

add output for debug purpose

parent f3683c88
No related branches found
No related tags found
No related merge requests found
...@@ -70,7 +70,7 @@ using FmmClassProcPER = FFmmAlgorithmThreadProcPeriodic<FReal,OctreeClass,CellC ...@@ -70,7 +70,7 @@ using FmmClassProcPER = FFmmAlgorithmThreadProcPeriodic<FReal,OctreeClass,CellC
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
///////// PARAMETERS HANDLING ////////////////////////////////////// ///////// PARAMETERS HANDLING //////////////////////////////////////
// const FParameterNames LocalOptionPeriodicDeep { {"-periodic","-per"}, "Perdiodic boundary condition (-per 5) the box grow by a facor (3L)^5"}; const FParameterNames localIncreaseBox = { {"ratio","-L"}, "Increase teh Box size by a factor L:= ratio"};
FHelpDescribeAndExit(argc, argv, FHelpDescribeAndExit(argc, argv,
"Driver for Chebyshev Interpolation kernel using MPI (1/r kernel). " "Driver for Chebyshev Interpolation kernel using MPI (1/r kernel). "
"Usully run using : mpirun -np nb_proc_needed ./ChebyshevInterpolationAlgorithm [params].", "Usully run using : mpirun -np nb_proc_needed ./ChebyshevInterpolationAlgorithm [params].",
...@@ -79,7 +79,10 @@ int main(int argc, char* argv[]) ...@@ -79,7 +79,10 @@ int main(int argc, char* argv[])
FParameterDefinitions::InputFile, FParameterDefinitions::InputFile,
FParameterDefinitions::OutputFile, FParameterDefinitions::OutputFile,
FParameterDefinitions::NbThreads, FParameterDefinitions::NbThreads,
FParameterDefinitions::PeriodicityNbLevels); FParameterDefinitions::PeriodicityNbLevels,
localIncreaseBox
)
;
const std::string defaultFile("../Data/test20k.fma"); const std::string defaultFile("../Data/test20k.fma");
const std::string filename = FParameters::getStr(argc,argv, FParameterDefinitions::InputFile.options, defaultFile.c_str()); const std::string filename = FParameters::getStr(argc,argv, FParameterDefinitions::InputFile.options, defaultFile.c_str());
...@@ -121,16 +124,25 @@ int main(int argc, char* argv[]) ...@@ -121,16 +124,25 @@ int main(int argc, char* argv[])
if(!loader.isOpen()) { if(!loader.isOpen()) {
throw std::runtime_error("Particle file couldn't be opened!") ; throw std::runtime_error("Particle file couldn't be opened!") ;
} }
auto boxWidth = loader.getBoxWidth() ;
//
if(FParameters::existParameter(argc, argv, localIncreaseBox.options)){
FReal ratio= FParameters::getValue(argc, argv, localIncreaseBox.options, 1.0);
boxWidth *= ratio;
}
// Initialize empty oct-tree // Initialize empty oct-tree
OctreeClass tree(TreeHeight, SubTreeHeight, loader.getBoxWidth(), loader.getCenterOfBox()); OctreeClass tree(TreeHeight, SubTreeHeight, boxWidth, loader.getCenterOfBox());
FSize localParticlesNumber = 0 ; FSize localParticlesNumber = 0 ;
{ // ----------------------------------------------------- { // -----------------------------------------------------
if(app.global().processId() == 0){ if(app.global().processId() == 0){
std::cout << "Loading & Inserting " << loader.getNumberOfParticles() std::cout << "Loading & Inserting " << loader.getNumberOfParticles()
<< " particles ..." << std::endl; << " particles ..." << std::endl
<<" Box: "<< std::endl
<< " width " << boxWidth << std::endl
<< " Centre " << loader.getCenterOfBox()<< std::endl;
std::cout << "\tHeight : " << TreeHeight << " \t sub-height : " << SubTreeHeight << std::endl; std::cout << "\tHeight : " << TreeHeight << " \t sub-height : " << SubTreeHeight << std::endl;
} }
time.tic(); time.tic();
...@@ -221,7 +233,7 @@ int main(int argc, char* argv[]) ...@@ -221,7 +233,7 @@ int main(int argc, char* argv[])
// non periodic FMM algorithm // non periodic FMM algorithm
std::unique_ptr<KernelClass> kernelsNoPer(new KernelClass(TreeHeight, loader.getBoxWidth(), std::unique_ptr<KernelClass> kernelsNoPer(new KernelClass(TreeHeight, boxWidth,
loader.getCenterOfBox(),&MatrixKernel)); loader.getCenterOfBox(),&MatrixKernel));
FmmClassProc algoNoPer(app.global(),&tree, kernelsNoPer.get()); FmmClassProc algoNoPer(app.global(),&tree, kernelsNoPer.get());
// //
...@@ -240,8 +252,8 @@ int main(int argc, char* argv[]) ...@@ -240,8 +252,8 @@ int main(int argc, char* argv[])
//timer = &algoPer ; //timer = &algoPer ;
} }
// //
// FMM exectution FFmmFarField // FMM exectution FFmmFarField FFmmNearField
algorithm->execute(); algorithm->execute(FFmmNearField);
// //
time.tac(); time.tac();
...@@ -270,7 +282,9 @@ FReal energy =0.0 ; ...@@ -270,7 +282,9 @@ FReal energy =0.0 ;
// //
std::cout <<std::endl<<" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "<<std::endl; std::cout <<std::endl<<" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "<<std::endl;
std::cout << std::scientific; std::cout << std::scientific;
std::cout.precision(10) ; std::cout.precision(15) ;
FReal TotalPhysicalValue=0.0 ;
tree.forEachLeaf([&](LeafClass* leaf){ tree.forEachLeaf([&](LeafClass* leaf){
const FReal*const posX = leaf->getTargets()->getPositions()[0]; const FReal*const posX = leaf->getTargets()->getPositions()[0];
...@@ -294,11 +308,12 @@ tree.forEachLeaf([&](LeafClass* leaf){ ...@@ -294,11 +308,12 @@ tree.forEachLeaf([&](LeafClass* leaf){
<< " Forces: " << forcesX[idxPart] << " " << forcesY[idxPart] << " "<< forcesZ[idxPart] <<std::endl; << " Forces: " << forcesX[idxPart] << " " << forcesY[idxPart] << " "<< forcesZ[idxPart] <<std::endl;
} }
energy += potentials[idxPart]*physicalValues[idxPart] ; energy += potentials[idxPart]*physicalValues[idxPart] ;
TotalPhysicalValue += physicalValues[idxPart] ;
} }
}); });
FReal gloEnergy = app.global().reduceSum(energy); FReal gloEnergy = app.global().reduceSum(energy);
if(0 == app.global().processId()){ if(0 == app.global().processId()){
std::cout <<std::endl << "Proc "<< app.global().processId() << " Energy: "<< gloEnergy <<std::endl; std::cout <<std::endl<<"aboveRoot: " << aboveTree << " Energy: "<< energy<<" TotalPhysicalValue: " << TotalPhysicalValue<< std::endl; std::cout <<std::endl << "Proc "<< app.global().processId() << " Energy: "<< gloEnergy <<std::endl;
std::cout <<std::endl <<" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "<<std::endl<<std::endl; std::cout <<std::endl <<" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "<<std::endl<<std::endl;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment