Commit 64e8b292 authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

Changes : FmaParticleR8W8 does not exist anymore. Changes needed in utest and test done.

parent 074a1bcc
......@@ -46,10 +46,15 @@ public:
return FPoint(data[0],data[1],data[2]);
}
FReal * setPosition(){
return data;
// FReal * setPosition(){
// return data;
// }
void setPosition(FPoint & inPoint){
data[0] = inPoint.getX();
data[1] = inPoint.getY();
data[2] = inPoint.getZ();
}
FReal getPhysicalValue() const{
return data[3];
}
......@@ -61,9 +66,17 @@ public:
return data[4];
}
FReal* setPotential() {
return &data[4];
}
FReal* getForces() {
return &data[5];
}
FReal* setForces() {
return &data[5];
}
FReal * getPtrFirstData(){
return data;
......@@ -170,22 +183,22 @@ public:
//! and you want to compare your result with the read values .
//!
class FmaR8W8Particle : public FmaR4W8Particle {
public:
/**
* return The number of data to read. it is used in FMAGenericLoader (here 8)
* Useful to read the result of the output of DirectComputation and to compare the potential and the force
* with the FMM computation
*/
int getReadDataNumber()
{ return 8;}
};
// class FmaR8W8Particle : public FmaR4W8Particle {
// public:
// /**
// * return The number of data to read. it is used in FMAGenericLoader (here 8)
// * Useful to read the result of the output of DirectComputation and to compare the potential and the force
// * with the FMM computation
// */
// int getReadDataNumber()
// { return 8;}
// };
//!\typedef FmaBasicParticle an alias of FmaR4W4Particle
//! Particle contains 4 values of type FReal and we read and write the four values
//!
typedef FmaR4W4Particle FmaBasicParticle ;
typedef FmaR4W8Particle FmaRParticle ;
typedef FmaR8W8Particle FmaParticle ;
typedef FmaRWParticle<8,8> FmaParticle ;
//
//! \class FFmaGenericLoader
//!
......
......@@ -474,7 +474,7 @@ public:
const int finalNbParticles = particleSaver->getSize();
if(communicator.processId() != 0){
MPI_Gather((int*)&finalNbParticles,1,MPI_INT,0,1,MPI_INT,0,communicator.getComm());
MPI_Gather((int*)&finalNbParticles,1,MPI_INT,nullptr,1,MPI_INT,0,communicator.getComm());
}
else{
const int nbProcs = communicator.processCount();
......
......@@ -130,7 +130,7 @@ int main(int argc, char* argv[])
//
FSize nbParticles = loader.getNumberOfParticles() ;
FmaR8W8Particle* const particles = new FmaR8W8Particle[nbParticles];
FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles];
//
loader.fillParticle(particles,nbParticles);
//
......@@ -140,8 +140,8 @@ int main(int argc, char* argv[])
#pragma omp parallel for reduction(+:energyD,totPhysicalValue)
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
energyD += particles[idx].potential*particles[idx].physicalValue ;
totPhysicalValue += particles[idx].physicalValue ;
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
totPhysicalValue += particles[idx].getPhysicalValue() ;
}
std::cout << " Total Physical values: "<< totPhysicalValue <<std::endl;
std::cout << " Energy of the system: "<< energyD <<std::endl;
......@@ -172,7 +172,7 @@ int main(int argc, char* argv[])
time.tic();
for(int idxPart = 0 ; idxPart < nbParticles; ++idxPart){
// put in tree
tree.insert(particles[idxPart].position, idxPart, particles[idxPart].physicalValue);
tree.insert(particles[idxPart].getPosition(), idxPart, particles[idxPart].getPhysicalValue());
}
time.tac();
std::cout << "(FChebKernel @ Inserting Particles = "<< time.elapsed() << " s)." << std::endl;
......@@ -202,10 +202,10 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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] ;
}
});
......@@ -244,7 +244,7 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticles; ++idxPart){
// put in tree
tree.insert(particles[idxPart].position, idxPart, particles[idxPart].physicalValue);
tree.insert(particles[idxPart].getPosition(), idxPart, particles[idxPart].getPhysicalValue());
}
time.tac();
......@@ -275,10 +275,10 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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] ;
}
});
......@@ -315,7 +315,7 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
// put in tree
tree.insert(particles[idxPart].position, idxPart, particles[idxPart].physicalValue);
tree.insert(particles[idxPart].getPosition(), idxPart, particles[idxPart].getPhysicalValue());
}
time.tac();
......@@ -347,10 +347,10 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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] ;
}
});
......@@ -396,7 +396,7 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart <nbParticles ; ++idxPart){
// put in tree
tree.insert(particles[idxPart].position, idxPart, particles[idxPart].physicalValue);
tree.insert(particles[idxPart].getPosition(), idxPart, particles[idxPart].getPhysicalValue());
}
time.tac();
......@@ -428,10 +428,10 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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] ;
}
});
......@@ -466,7 +466,7 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticles; ++idxPart){
// put in tree
tree.insert(particles[idxPart].position, idxPart, particles[idxPart].physicalValue);
tree.insert(particles[idxPart].getPosition(), idxPart, particles[idxPart].getPhysicalValue());
}
time.tac();
......@@ -501,10 +501,10 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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] ;
}
});
......@@ -538,7 +538,7 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticles; ++idxPart){
// put in tree
tree.insert(particles[idxPart].position, idxPart, particles[idxPart].physicalValue);
tree.insert(particles[idxPart].getPosition(), idxPart, particles[idxPart].getPhysicalValue());
}
time.tac();
......@@ -572,10 +572,10 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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] ;
}
});
......@@ -614,7 +614,7 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart <nbParticles ; ++idxPart){
// put in tree
tree.insert(particles[idxPart].position, idxPart, particles[idxPart].physicalValue);
tree.insert(particles[idxPart].getPosition(), idxPart, particles[idxPart].getPhysicalValue());
}
time.tac();
......@@ -646,10 +646,10 @@ int main(int argc, char* argv[])
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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] ;
}
});
......
......@@ -77,7 +77,7 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
FSize nbParticles = loader.getNumberOfParticles() ;
FmaR8W8Particle* const particles = new FmaR8W8Particle[nbParticles];
FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles];
loader.fillParticle(particles,nbParticles);
//
......@@ -86,7 +86,7 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
// Insert particle in the tree
//
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
tree.insert(particles[idxPart].position , idxPart, particles[idxPart].physicalValue );
tree.insert(particles[idxPart].getPosition() , idxPart, particles[idxPart].getPhysicalValue() );
}
//
/////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -103,7 +103,7 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
/////////////////////////////////////////////////////////////////////////////////////////////////
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
energyD += particles[idx].potential*particles[idx].physicalValue ;
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
// Compare
......@@ -124,10 +124,10 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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];
}
});
......
......@@ -69,11 +69,11 @@ class TestChebyshevMpiDirect : public FUTesterMpi<TestChebyshevMpiDirect>{
// Create octree
struct TestParticle : public FmaR8W8Particle{
struct TestParticle : public FmaRWParticle<8,8>{
FSize index;
const FPoint& getPosition(){
return position;
}
// const FPoint& getPosition(){
// return position;
// }
};
FSize nbParticles = loader.getMyNumberOfParticles();
......@@ -103,7 +103,7 @@ class TestChebyshevMpiDirect : public FUTesterMpi<TestChebyshevMpiDirect>{
tree.getBoxWidth(),tree.getHeight(),
&finalParticles, &balancer);
for(int idx = 0 ; idx < finalParticles.getSize(); ++idx){
tree.insert(finalParticles[idx].position,int(finalParticles[idx].index),finalParticles[idx].physicalValue);
tree.insert(finalParticles[idx].getPosition(),int(finalParticles[idx].index),finalParticles[idx].getPhysicalValue());
}
......@@ -160,10 +160,10 @@ class TestChebyshevMpiDirect : public FUTesterMpi<TestChebyshevMpiDirect>{
}
//I already have this part
else{
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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];
//if(particles[indexPartOrig].getPosition().getX() != leaf->getTargets()->getPositions()[0][idxPart]){
// printf("%d - Problem %d !! [%e,%e,%e,%e] [%e,%e,%e,%e] \n",
......@@ -180,7 +180,7 @@ class TestChebyshevMpiDirect : public FUTesterMpi<TestChebyshevMpiDirect>{
//Compute Direct Energy
FReal energyD = 0.0;
for(int idx = 0 ; idx < loader.getMyNumberOfParticles() ; ++idx){
energyD += particles[idx].potential*particles[idx].physicalValue ;
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
FReal energyDTot = 0.0;
......
......@@ -85,7 +85,7 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
//
FSize nbParticles = loader.getNumberOfParticles() ;
FmaR8W8Particle* const particles = new FmaR8W8Particle[nbParticles];
FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles];
loader.fillParticle(particles,nbParticles);
//
......@@ -94,7 +94,7 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
// Insert particle in the tree
//
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
tree.insert(particles[idxPart].position , idxPart, particles[idxPart].physicalValue ,0.0,0.0,0.0);
tree.insert(particles[idxPart].getPosition() , idxPart, particles[idxPart].getPhysicalValue() ,0.0,0.0,0.0);
}
// //
// // Create octree
......@@ -124,14 +124,14 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
// Run direct computation
Print("Direct...");
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
particles[idx].potential *= NVals ;
particles[idx].forces[0] *= NVals ;
particles[idx].forces[1] *= NVals ;
particles[idx].forces[2] *= NVals ;
energyD += particles[idx].potential*particles[idx].physicalValue ;
}
//
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;
......@@ -149,10 +149,10 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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];
}
});
......
......@@ -84,7 +84,7 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
// Create octree
FSize nbParticles = loader.getNumberOfParticles() ;
FmaR8W8Particle* const particles = new FmaR8W8Particle[nbParticles];
FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles];
loader.fillParticle(particles,nbParticles);
//
......@@ -92,7 +92,7 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
//
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
tree.insert(particles[idxPart].position , idxPart, particles[idxPart].physicalValue );
tree.insert(particles[idxPart].getPosition() , idxPart, particles[idxPart].getPhysicalValue() );
}
//
/////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -109,7 +109,7 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
/////////////////////////////////////////////////////////////////////////////////////////////////
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
energyD += particles[idx].potential*particles[idx].physicalValue ;
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
// Compare
......@@ -130,10 +130,10 @@ class TestChebyshevDirect : public FUTester<TestChebyshevDirect> {
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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];
}
});
......
......@@ -76,7 +76,7 @@ class TestLagrange : public FUTester<TestLagrange> {
// Create octree
FSize nbParticles = loader.getNumberOfParticles() ;
FmaR8W8Particle* const particles = new FmaR8W8Particle[nbParticles];
FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles];
loader.fillParticle(particles,nbParticles);
//
......@@ -84,7 +84,7 @@ class TestLagrange : public FUTester<TestLagrange> {
//
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
tree.insert(particles[idxPart].position , idxPart, particles[idxPart].physicalValue );
tree.insert(particles[idxPart].getPosition(), idxPart, particles[idxPart].getPhysicalValue() );
}
//
/////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -101,7 +101,7 @@ class TestLagrange : public FUTester<TestLagrange> {
/////////////////////////////////////////////////////////////////////////////////////////////////
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
energyD += particles[idx].potential*particles[idx].physicalValue ;
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
// Compare
......@@ -122,10 +122,10 @@ class TestLagrange : public FUTester<TestLagrange> {
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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];
}
});
......
......@@ -84,7 +84,7 @@ class TestLagrange : public FUTester<TestLagrange> {
// Create octree
FSize nbParticles = loader.getNumberOfParticles() ;
FmaR8W8Particle* const particles = new FmaR8W8Particle[nbParticles];
FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles];
loader.fillParticle(particles,nbParticles);
//
......@@ -92,7 +92,7 @@ class TestLagrange : public FUTester<TestLagrange> {
//
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
tree.insert(particles[idxPart].position , idxPart, particles[idxPart].physicalValue );
tree.insert(particles[idxPart].getPosition() , idxPart, particles[idxPart].getPhysicalValue() );
}
//
/////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -109,7 +109,7 @@ class TestLagrange : public FUTester<TestLagrange> {
/////////////////////////////////////////////////////////////////////////////////////////////////
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
energyD += particles[idx].potential*particles[idx].physicalValue ;
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
// Compare
......@@ -130,10 +130,10 @@ class TestLagrange : public FUTester<TestLagrange> {
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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];
}
});
......
This diff is collapsed.
......@@ -54,7 +54,7 @@ class TestRotationDirectSeveralTime : public FUTester<TestRotationDirectSeveralT
const int SizeSubLevels = 2;
//
FSize nbParticles = loader.getNumberOfParticles() ;
FmaR8W8Particle* const particles = new FmaR8W8Particle[nbParticles];
FmaRWParticle<8,8>* const particles = new FmaRWParticle<8,8>[nbParticles];
loader.fillParticle(particles,nbParticles);
//
......@@ -64,7 +64,7 @@ class TestRotationDirectSeveralTime : public FUTester<TestRotationDirectSeveralT
// Insert particle in the tree
//
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
tree.insert(particles[idxPart].position , idxPart, particles[idxPart].physicalValue );
tree.insert(particles[idxPart].getPosition() , idxPart, particles[idxPart].getPhysicalValue() );
}
//
FReal energy= 0.0 , energyD = 0.0 ;
......@@ -73,7 +73,7 @@ class TestRotationDirectSeveralTime : public FUTester<TestRotationDirectSeveralT
/////////////////////////////////////////////////////////////////////////////////////////////////
for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){
energyD += particles[idx].potential*particles[idx].physicalValue ;
energyD += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
// Run FMM
Print("Fmm...");
......@@ -119,10 +119,10 @@ class TestRotationDirectSeveralTime : public FUTester<TestRotationDirectSeveralT
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particles[indexPartOrig].potential,potentials[idxPart]);
fx.add(particles[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particles[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particles[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.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];
}
});
......
......@@ -62,30 +62,30 @@ class TestRotationDirectTsm : public FUTester<TestRotationDirectTsm> {
const FReal physicalValue = 0.10;
//
FmaR8W8Particle* const particlesTargets = new FmaR8W8Particle[nbTargets];
FmaRWParticle<8,8>* const particlesTargets = new FmaRWParticle<8,8>[nbTargets];
for(int idxPart = 0 ; idxPart < nbTargets ; ++idxPart){
FPoint position;
loader.fillParticle(&position);
// put in tree
tree.insert(position, FParticleTypeTarget, idxPart, physicalValue);
// get copy
particlesTargets[idxPart].position = position;
particlesTargets[idxPart].physicalValue = physicalValue;
particlesTargets[idxPart].potential = 0.0;
particlesTargets[idxPart].forces[0] = 0.0;
particlesTargets[idxPart].forces[1] = 0.0;
particlesTargets[idxPart].forces[2] = 0.0;
particlesTargets[idxPart].setPosition(position);
*(particlesTargets[idxPart].setPhysicalValue()) = physicalValue;
*(particlesTargets[idxPart].setPotential()) = 0.0;
particlesTargets[idxPart].setForces()[0] = 0.0;
particlesTargets[idxPart].setForces()[1] = 0.0;
particlesTargets[idxPart].setForces()[2] = 0.0;
}
FmaR8W8Particle* const particlesSources = new FmaR8W8Particle[nbSources];
FmaRWParticle<8,8>* const particlesSources = new FmaRWParticle<8,8>[nbSources];
for(int idxPart = 0 ; idxPart < nbSources ; ++idxPart){
FPoint position;
loader.fillParticle(&position);
// put in tree
tree.insert(position, FParticleTypeSource, idxPart, physicalValue);
// get copy
particlesSources[idxPart].position = position;
particlesSources[idxPart].physicalValue = physicalValue;
particlesSources[idxPart].setPosition(position);
*(particlesSources[idxPart].setPhysicalValue()) = physicalValue;
}
......@@ -103,12 +103,12 @@ class TestRotationDirectTsm : public FUTester<TestRotationDirectTsm> {
for(int idxTarget = 0 ; idxTarget < nbTargets ; ++idxTarget){
for(int idxOther = 0 ; idxOther < nbSources ; ++idxOther){
FP2P::NonMutualParticles(
particlesSources[idxOther].position.getX(), particlesSources[idxOther].position.getY(),
particlesSources[idxOther].position.getZ(),particlesSources[idxOther].physicalValue,
particlesTargets[idxTarget].position.getX(), particlesTargets[idxTarget].position.getY(),
particlesTargets[idxTarget].position.getZ(),particlesTargets[idxTarget].physicalValue,
&particlesTargets[idxTarget].forces[0],&particlesTargets[idxTarget].forces[1],
&particlesTargets[idxTarget].forces[2],&particlesTargets[idxTarget].potential);
particlesSources[idxOther].getPosition().getX(), particlesSources[idxOther].getPosition().getY(),
particlesSources[idxOther].getPosition().getZ(),particlesSources[idxOther].getPhysicalValue(),
particlesTargets[idxTarget].getPosition().getX(), particlesTargets[idxTarget].getPosition().getY(),
particlesTargets[idxTarget].getPosition().getZ(),particlesTargets[idxTarget].getPhysicalValue(),
&particlesTargets[idxTarget].setForces()[0],&particlesTargets[idxTarget].setForces()[1],
&particlesTargets[idxTarget].setForces()[2],particlesTargets[idxTarget].setPotential());
}
}
......@@ -119,7 +119,7 @@ class TestRotationDirectTsm : public FUTester<TestRotationDirectTsm> {
/////////////////////////////////////////////////////////////////////////////////////////////////
FReal energy= 0.0 , energyD = 0.0 ;
for(int idx = 0 ; idx < nbTargets ; ++idx){
energyD += particlesTargets[idx].potential*particlesTargets[idx].physicalValue ;
energyD += particlesTargets[idx].getPotential()*particlesTargets[idx].getPhysicalValue() ;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
// Compare
......@@ -141,10 +141,10 @@ class TestRotationDirectTsm : public FUTester<TestRotationDirectTsm> {
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
const int indexPartOrig = indexes[idxPart];
potentialDiff.add(particlesTargets[indexPartOrig].potential,potentials[idxPart]);
fx.add(particlesTargets[indexPartOrig].forces[0],forcesX[idxPart]);
fy.add(particlesTargets[indexPartOrig].forces[1],forcesY[idxPart]);
fz.add(particlesTargets[indexPartOrig].forces[2],forcesZ[idxPart]);
potentialDiff.add(particlesTargets[indexPartOrig].getPotential(),potentials[idxPart]);
fx.add(particlesTargets[indexPartOrig].getForces()[0],forcesX[idxPart]);
fy.add(particlesTargets[indexPartOrig].getForces()[1],forcesY[idxPart]);
fz.add(particlesTargets[indexPartOrig].getForces()[2],forcesZ[idxPart]);
energy += potentials[idxPart]*physicalValues[idxPart];
}
}
......
......@@ -66,7 +66,7 @@ class TestRotationDirect : public FUTester<TestRotationDirect> {
const int SizeSubLevels = 2;
//