Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit ea5984ac authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

Chebyshev Proc and not Proc updated

parent 0131962d
...@@ -182,6 +182,10 @@ int main(int argc, char* argv[]) ...@@ -182,6 +182,10 @@ int main(int argc, char* argv[])
std::cout.precision(10) ; std::cout.precision(10) ;
tree.forEachLeaf([&](LeafClass* leaf){ tree.forEachLeaf([&](LeafClass* leaf){
const FReal*const posX = leaf->getTargets()->getPositions()[0];
const FReal*const posY = leaf->getTargets()->getPositions()[1];
const FReal*const posZ = leaf->getTargets()->getPositions()[2];
const FReal*const potentials = leaf->getTargets()->getPotentials(); const FReal*const potentials = leaf->getTargets()->getPotentials();
const FReal*const forcesX = leaf->getTargets()->getForcesX(); const FReal*const forcesX = leaf->getTargets()->getForcesX();
const FReal*const forcesY = leaf->getTargets()->getForcesY(); const FReal*const forcesY = leaf->getTargets()->getForcesY();
...@@ -195,7 +199,8 @@ int main(int argc, char* argv[]) ...@@ -195,7 +199,8 @@ int main(int argc, char* argv[])
const int indexPartOrig = indexes[idxPart]; const int indexPartOrig = indexes[idxPart];
if ((indexPartOrig == N1) || (indexPartOrig == N2) || (indexPartOrig == N3) ) { if ((indexPartOrig == N1) || (indexPartOrig == N2) || (indexPartOrig == N3) ) {
std::cout << "Index "<< indexPartOrig <<" potential " << potentials[idxPart] std::cout << "Index "<< indexPartOrig <<" potential " << potentials[idxPart]
<< " Forces: " << forcesX[idxPart] << " " << forcesY[idxPart] << " "<< forcesZ[idxPart] <<std::endl; << " Pos "<<posX[idxPart]<<" "<<posY[idxPart]<<" "<<posZ[idxPart]
<< " Forces: " << forcesX[idxPart] << " " << forcesY[idxPart] << " "<< forcesZ[idxPart] <<std::endl;
} }
energy += potentials[idxPart]*physicalValues[idxPart] ; energy += potentials[idxPart]*physicalValues[idxPart] ;
} }
......
...@@ -45,12 +45,12 @@ ...@@ -45,12 +45,12 @@
#include "../../Src/Utils/FParameters.hpp" #include "../../Src/Utils/FParameters.hpp"
/// \file RotationFMMProc.cpp /// \file ChebyshevInterpolationAlgorithmProc
//! //!
//! \brief This program runs the FMM Algorithm Proc (i.e. using MPI) with harmonic spherical approximation of 1/r kernel //! \brief This program runs the FMM Algorithm Proc (i.e. using MPI) with Chebyshev interpolation of 1/r kernel
//! \authors B. Bramas, O. Coulaud //! \authors B. Bramas, O. Coulaud
//! //!
//! This code is a short example to use the rotation harmonic spherical approximation for the 1/r kernel //! This code is a short example to use the FMM Algorithm Proc with Chebyshev Interpolation for the 1/r kernel
//! //!
//! //!
//! <b> General arguments:</b> //! <b> General arguments:</b>
...@@ -130,7 +130,8 @@ int main(int argc, char* argv[]) ...@@ -130,7 +130,8 @@ int main(int argc, char* argv[])
// init oct-tree // init oct-tree
OctreeClass tree(TreeHeight, SubTreeHeight, loader.getBoxWidth(), loader.getCenterOfBox()); OctreeClass tree(TreeHeight, SubTreeHeight, loader.getBoxWidth(), loader.getCenterOfBox());
printf("There \n");
{ // ----------------------------------------------------- { // -----------------------------------------------------
std::cout << "Creating & Inserting " << loader.getNumberOfParticles() std::cout << "Creating & Inserting " << loader.getNumberOfParticles()
...@@ -138,8 +139,9 @@ int main(int argc, char* argv[]) ...@@ -138,8 +139,9 @@ int main(int argc, char* argv[])
std::cout << "\tHeight : " << TreeHeight << " \t sub-height : " << SubTreeHeight << std::endl; std::cout << "\tHeight : " << TreeHeight << " \t sub-height : " << SubTreeHeight << std::endl;
time.tic(); time.tic();
// //
struct TestParticle{ struct TestParticle{
int index;
FPoint position; FPoint position;
FReal physicalValue; FReal physicalValue;
const FPoint& getPosition(){ const FPoint& getPosition(){
...@@ -148,11 +150,18 @@ int main(int argc, char* argv[]) ...@@ -148,11 +150,18 @@ int main(int argc, char* argv[])
}; };
TestParticle* particles = new TestParticle[loader.getNumberOfParticles()]; TestParticle* particles = new TestParticle[loader.getNumberOfParticles()];
memset(particles, 0, (unsigned int) (sizeof(TestParticle) * loader.getNumberOfParticles())); memset(particles, 0, (unsigned int) (sizeof(TestParticle) * loader.getNumberOfParticles()));
//idx (in file) of the first part that will be used by this proc.
int idxStart = loader.getStart();
printf("Proc %d idxStart %d \n",app.global().processId(),idxStart);
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){ for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
//Storage of the index (in the original file) of each part.
particles[idxPart].index = idxPart + idxStart;
// Read particles from file // Read particles from file
loader.fillParticle(&particles[idxPart].position,&particles[idxPart].physicalValue); loader.fillParticle(&particles[idxPart].position,&particles[idxPart].physicalValue);
} }
FVector<TestParticle> finalParticles; FVector<TestParticle> finalParticles;
FLeafBalance balancer; FLeafBalance balancer;
FMpiTreeBuilder< TestParticle >::ArrayToTree(app.global(), particles, loader.getNumberOfParticles(), FMpiTreeBuilder< TestParticle >::ArrayToTree(app.global(), particles, loader.getNumberOfParticles(),
...@@ -161,8 +170,9 @@ int main(int argc, char* argv[]) ...@@ -161,8 +170,9 @@ int main(int argc, char* argv[])
tree.getHeight(), &finalParticles,&balancer); tree.getHeight(), &finalParticles,&balancer);
for(int idx = 0 ; idx < finalParticles.getSize(); ++idx){ for(int idx = 0 ; idx < finalParticles.getSize(); ++idx){
tree.insert(finalParticles[idx].position,idx,finalParticles[idx].physicalValue); tree.insert(finalParticles[idx].position,finalParticles[idx].index,finalParticles[idx].physicalValue);
} }
printf("%d parts have been inserted in Tree \n",finalParticles.getSize());
delete[] particles; delete[] particles;
time.tac(); time.tac();
...@@ -192,7 +202,7 @@ int main(int argc, char* argv[]) ...@@ -192,7 +202,7 @@ int main(int argc, char* argv[])
// //
// //
{ // ----------------------------------------------------- { // -----------------------------------------------------
long int N1=0, N2= loader.getNumberOfParticles()/4, N3= (loader.getNumberOfParticles() -1)/2; ; long int N1=0, N2= loader.getTotalNumberOfParticles()/2, N3= (loader.getTotalNumberOfParticles()-1); ;
FReal energy =0.0 ; FReal energy =0.0 ;
// //
// Loop over all leaves // Loop over all leaves
...@@ -202,6 +212,10 @@ int main(int argc, char* argv[]) ...@@ -202,6 +212,10 @@ int main(int argc, char* argv[])
std::cout.precision(10) ; std::cout.precision(10) ;
tree.forEachLeaf([&](LeafClass* leaf){ tree.forEachLeaf([&](LeafClass* leaf){
const FReal*const posX = leaf->getTargets()->getPositions()[0];
const FReal*const posY = leaf->getTargets()->getPositions()[1];
const FReal*const posZ = leaf->getTargets()->getPositions()[2];
const FReal*const potentials = leaf->getTargets()->getPotentials(); const FReal*const potentials = leaf->getTargets()->getPotentials();
const FReal*const forcesX = leaf->getTargets()->getForcesX(); const FReal*const forcesX = leaf->getTargets()->getForcesX();
const FReal*const forcesY = leaf->getTargets()->getForcesY(); const FReal*const forcesY = leaf->getTargets()->getForcesY();
...@@ -215,14 +229,17 @@ int main(int argc, char* argv[]) ...@@ -215,14 +229,17 @@ int main(int argc, char* argv[])
const int indexPartOrig = indexes[idxPart]; const int indexPartOrig = indexes[idxPart];
if ((indexPartOrig == N1) || (indexPartOrig == N2) || (indexPartOrig == N3) ) { if ((indexPartOrig == N1) || (indexPartOrig == N2) || (indexPartOrig == N3) ) {
std::cout << "Proc "<< app.global().processId() << " Index "<< indexPartOrig <<" potential " << potentials[idxPart] std::cout << "Proc "<< app.global().processId() << " Index "<< indexPartOrig <<" potential " << potentials[idxPart]
<< " Pos "<<posX[idxPart]<<" "<<posY[idxPart]<<" "<<posZ[idxPart]
<< " 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] ;
} }
}); });
std::cout <<std::endl<<"Energy: "<< energy<<std::endl; FReal gloEnergy = app.global().reduceSum(energy);
std::cout <<std::endl<<" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "<<std::endl<<std::endl; if(0 == app.global().processId()){
std::cout <<std::endl << "Proc "<< app.global().processId() << " Energy: "<< gloEnergy <<std::endl;
std::cout <<std::endl <<" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "<<std::endl<<std::endl;
}
} }
// ----------------------------------------------------- // -----------------------------------------------------
......
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