Commit 7342eb81 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Remove some warnings, and split P2PR which is P2P only for one over R and P2P...

Remove some warnings, and split P2PR which is P2P only for one over R and P2P which can accept a matrix kernel (which can be one over R or anything else), both approaches support SSE and AVX but have not been tested.
parent 487253de
......@@ -300,7 +300,7 @@ public:
*/
FDlpolyBinLoader(const char* const filename): file(fopen(filename, "rb")) {
// test if open
if(this->file != NULL){
if(this->file != nullptr){
energy = readValue<double>();
double boxDim[3];
boxWidth = readArray<double>(boxDim,3)[0];
......@@ -325,7 +325,7 @@ public:
* @return true if loader can work
*/
bool isOpen() const{
return this->file != NULL;
return this->file != nullptr;
}
// /**
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef FP2PR_HPP
#define FP2PR_HPP
#include "Utils/FGlobal.hpp"
#include "Utils/FMath.hpp"
/**
* @brief The FP2PR namespace
*/
namespace FP2PR{
inline void MutualParticles(const FReal sourceX,const FReal sourceY,const FReal sourceZ, const FReal sourcePhysicalValue,
FReal* sourceForceX, FReal* sourceForceY, FReal* sourceForceZ, FReal* sourcePotential,
const FReal targetX,const FReal targetY,const FReal targetZ, const FReal targetPhysicalValue,
FReal* targetForceX, FReal* targetForceY, FReal* targetForceZ, FReal* targetPotential
){
FReal dx = sourceX - targetX;
FReal dy = sourceY - targetY;
FReal dz = sourceZ - targetZ;
FReal inv_square_distance = FReal(1.0) / (dx*dx + dy*dy + dz*dz);
FReal inv_distance = FMath::Sqrt(inv_square_distance);
inv_square_distance *= inv_distance;
inv_square_distance *= targetPhysicalValue * sourcePhysicalValue;
dx *= inv_square_distance;
dy *= inv_square_distance;
dz *= inv_square_distance;
*targetForceX += dx;
*targetForceY += dy;
*targetForceZ += dz;
*targetPotential += ( inv_distance * sourcePhysicalValue );
*sourceForceX -= dx;
*sourceForceY -= dy;
*sourceForceZ -= dz;
*sourcePotential += ( inv_distance * targetPhysicalValue );
}
inline void NonMutualParticles(const FReal sourceX,const FReal sourceY,const FReal sourceZ, const FReal sourcePhysicalValue,
const FReal targetX,const FReal targetY,const FReal targetZ, const FReal targetPhysicalValue,
FReal* targetForceX, FReal* targetForceY, FReal* targetForceZ, FReal* targetPotential){
FReal dx = sourceX - targetX;
FReal dy = sourceY - targetY;
FReal dz = sourceZ - targetZ;
FReal inv_square_distance = FReal(1.0) / (dx*dx + dy*dy + dz*dz);
FReal inv_distance = FMath::Sqrt(inv_square_distance);
inv_square_distance *= inv_distance;
inv_square_distance *= targetPhysicalValue * sourcePhysicalValue;
dx *= inv_square_distance;
dy *= inv_square_distance;
dz *= inv_square_distance;
*targetForceX += dx;
*targetForceY += dy;
*targetForceZ += dz;
*targetPotential += ( inv_distance * sourcePhysicalValue );
}
}
#ifdef ScalFMM_USE_SSE
#include "FP2PRSse.hpp"
#elif defined(ScalFMM_USE_AVX)
#include "FP2PRAvx.hpp"
#else
#include "FP2PRClassic.hpp"
#endif //Includes
#endif // FP2PR_HPP
#ifndef FP2PAVX_HPP
#define FP2PAVX_HPP
#ifndef FP2PRAVX_HPP
#define FP2PRAVX_HPP
#include "../../Utils/FGlobal.hpp"
#include "../../Utils/FMath.hpp"
......@@ -7,7 +7,7 @@
#include "../../Utils/FAvx.hpp"
namespace FP2P{
namespace FP2PR{
#ifdef ScalFMM_USE_DOUBLE_PRECISION
template <class ContainerClass>
......@@ -513,4 +513,4 @@ namespace FP2P{
#endif
}
#endif //FP2PAVX_HPP
#endif //FP2PRAVX_HPP
#ifndef FP2PRCLASSIC_HPP
#define FP2PRCLASSIC_HPP
#include "../../Utils/FGlobal.hpp"
#include "../../Utils/FMath.hpp"
namespace FP2PR{
template <class ContainerClass>
inline void FullMutual(ContainerClass* const FRestrict inTargets, ContainerClass* const inNeighbors[],
const int limiteNeighbors){
const int nbParticlesTargets = inTargets->getNbParticles();
const FReal*const targetsPhysicalValues = inTargets->getPhysicalValues();
const FReal*const targetsX = inTargets->getPositions()[0];
const FReal*const targetsY = inTargets->getPositions()[1];
const FReal*const targetsZ = inTargets->getPositions()[2];
FReal*const targetsForcesX = inTargets->getForcesX();
FReal*const targetsForcesY = inTargets->getForcesY();
FReal*const targetsForcesZ = inTargets->getForcesZ();
FReal*const targetsPotentials = inTargets->getPotentials();
for(int idxNeighbors = 0 ; idxNeighbors < limiteNeighbors ; ++idxNeighbors){
if( inNeighbors[idxNeighbors] ){
const int nbParticlesSources = inNeighbors[idxNeighbors]->getNbParticles();
const FReal*const sourcesPhysicalValues = inNeighbors[idxNeighbors]->getPhysicalValues();
const FReal*const sourcesX = inNeighbors[idxNeighbors]->getPositions()[0];
const FReal*const sourcesY = inNeighbors[idxNeighbors]->getPositions()[1];
const FReal*const sourcesZ = inNeighbors[idxNeighbors]->getPositions()[2];
FReal*const sourcesForcesX = inNeighbors[idxNeighbors]->getForcesX();
FReal*const sourcesForcesY = inNeighbors[idxNeighbors]->getForcesY();
FReal*const sourcesForcesZ = inNeighbors[idxNeighbors]->getForcesZ();
FReal*const sourcesPotentials = inNeighbors[idxNeighbors]->getPotentials();
for(int idxTarget = 0 ; idxTarget < nbParticlesTargets ; ++idxTarget){
for(int idxSource = 0 ; idxSource < nbParticlesSources ; ++idxSource){
FReal dx = sourcesX[idxSource] - targetsX[idxTarget];
FReal dy = sourcesY[idxSource] - targetsY[idxTarget];
FReal dz = sourcesZ[idxSource] - targetsZ[idxTarget];
FReal inv_square_distance = FReal(1.0) / (dx*dx + dy*dy + dz*dz);
const FReal inv_distance = FMath::Sqrt(inv_square_distance);
inv_square_distance *= inv_distance;
inv_square_distance *= targetsPhysicalValues[idxTarget] * sourcesPhysicalValues[idxSource];
dx *= inv_square_distance;
dy *= inv_square_distance;
dz *= inv_square_distance;
targetsForcesX[idxTarget] += dx;
targetsForcesY[idxTarget] += dy;
targetsForcesZ[idxTarget] += dz;
targetsPotentials[idxTarget] += inv_distance * sourcesPhysicalValues[idxSource];
sourcesForcesX[idxSource] -= dx;
sourcesForcesY[idxSource] -= dy;
sourcesForcesZ[idxSource] -= dz;
sourcesPotentials[idxSource] += inv_distance * targetsPhysicalValues[idxTarget];
}
}
}
}
for(int idxTarget = 0 ; idxTarget < nbParticlesTargets ; ++idxTarget){
for(int idxSource = idxTarget + 1 ; idxSource < nbParticlesTargets ; ++idxSource){
FReal dx = targetsX[idxSource] - targetsX[idxTarget];
FReal dy = targetsY[idxSource] - targetsY[idxTarget];
FReal dz = targetsZ[idxSource] - targetsZ[idxTarget];
FReal inv_square_distance = FReal(1.0) / (dx*dx + dy*dy + dz*dz);
const FReal inv_distance = FMath::Sqrt(inv_square_distance);
inv_square_distance *= inv_distance;
inv_square_distance *= targetsPhysicalValues[idxTarget] * targetsPhysicalValues[idxSource];
dx *= inv_square_distance;
dy *= inv_square_distance;
dz *= inv_square_distance;
targetsForcesX[idxTarget] += dx;
targetsForcesY[idxTarget] += dy;
targetsForcesZ[idxTarget] += dz;
targetsPotentials[idxTarget] += inv_distance * targetsPhysicalValues[idxSource];
targetsForcesX[idxSource] -= dx;
targetsForcesY[idxSource] -= dy;
targetsForcesZ[idxSource] -= dz;
targetsPotentials[idxSource] += inv_distance * targetsPhysicalValues[idxTarget];
}
}
}
template <class ContainerClass>
static void FullRemote(ContainerClass* const FRestrict inTargets, ContainerClass* const inNeighbors[],
const int limiteNeighbors){
const int nbParticlesTargets = inTargets->getNbParticles();
const FReal*const targetsPhysicalValues = inTargets->getPhysicalValues();
const FReal*const targetsX = inTargets->getPositions()[0];
const FReal*const targetsY = inTargets->getPositions()[1];
const FReal*const targetsZ = inTargets->getPositions()[2];
FReal*const targetsForcesX = inTargets->getForcesX();
FReal*const targetsForcesY = inTargets->getForcesY();
FReal*const targetsForcesZ = inTargets->getForcesZ();
FReal*const targetsPotentials = inTargets->getPotentials();
for(int idxNeighbors = 0 ; idxNeighbors < limiteNeighbors ; ++idxNeighbors){
if( inNeighbors[idxNeighbors] ){
const int nbParticlesSources = inNeighbors[idxNeighbors]->getNbParticles();
const FReal*const sourcesPhysicalValues = inNeighbors[idxNeighbors]->getPhysicalValues();
const FReal*const sourcesX = inNeighbors[idxNeighbors]->getPositions()[0];
const FReal*const sourcesY = inNeighbors[idxNeighbors]->getPositions()[1];
const FReal*const sourcesZ = inNeighbors[idxNeighbors]->getPositions()[2];
for(int idxTarget = 0 ; idxTarget < nbParticlesTargets ; ++idxTarget){
for(int idxSource = 0 ; idxSource < nbParticlesSources ; ++idxSource){
FReal dx = sourcesX[idxSource] - targetsX[idxTarget];
FReal dy = sourcesY[idxSource] - targetsY[idxTarget];
FReal dz = sourcesZ[idxSource] - targetsZ[idxTarget];
FReal inv_square_distance = FReal(1.0) / (dx*dx + dy*dy + dz*dz);
const FReal inv_distance = FMath::Sqrt(inv_square_distance);
inv_square_distance *= inv_distance;
inv_square_distance *= targetsPhysicalValues[idxTarget] * sourcesPhysicalValues[idxSource];
dx *= inv_square_distance;
dy *= inv_square_distance;
dz *= inv_square_distance;
targetsForcesX[idxTarget] += dx;
targetsForcesY[idxTarget] += dy;
targetsForcesZ[idxTarget] += dz;
targetsPotentials[idxTarget] += inv_distance * sourcesPhysicalValues[idxSource];
}
}
}
}
}
}
#endif //FP2PRCLASSIC_HPP
This diff is collapsed.
This diff is collapsed.
......@@ -23,7 +23,7 @@
#include "Utils/FSpherical.hpp"
#include "Utils/FMath.hpp"
#include "../P2P/FP2P.hpp"
#include "../P2P/FP2PR.hpp"
/** This is a recursion to get the minimal size of the matrix dlmk
*/
......@@ -1310,7 +1310,7 @@ public:
void P2P(const FTreeCoordinate& /*inPosition*/,
ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/,
ContainerClass* const inNeighbors[27], const int /*inSize*/){
FP2P::FullMutual(inTargets,inNeighbors,14);
FP2PR::FullMutual(inTargets,inNeighbors,14);
}
......@@ -1318,7 +1318,7 @@ public:
void P2PRemote(const FTreeCoordinate& /*inPosition*/,
ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/,
ContainerClass* const inNeighbors[27], const int /*inSize*/){
FP2P::FullRemote(inTargets,inNeighbors,27);
FP2PR::FullRemote(inTargets,inNeighbors,27);
}
};
......
......@@ -22,7 +22,7 @@
#include "../../Utils/FMemUtils.hpp"
#include "../../Utils/FSpherical.hpp"
#include "../P2P/FP2P.hpp"
#include "../P2P/FP2PR.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
......@@ -800,7 +800,7 @@ public:
void P2P(const FTreeCoordinate& /*inPosition*/,
ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/,
ContainerClass* const inNeighbors[27], const int /*inSize*/){
FP2P::FullMutual(inTargets,inNeighbors,14);
FP2PR::FullMutual(inTargets,inNeighbors,14);
}
......@@ -808,7 +808,7 @@ public:
void P2PRemote(const FTreeCoordinate& /*inPosition*/,
ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/,
ContainerClass* const inNeighbors[27], const int /*inSize*/){
FP2P::FullRemote(inTargets,inNeighbors,27);
FP2PR::FullRemote(inTargets,inNeighbors,27);
}
};
......
......@@ -28,7 +28,7 @@
#include "../../Containers/FTreeCoordinate.hpp"
#include "../P2P/FP2P.hpp"
#include "../P2P/FP2PR.hpp"
#include "FHarmonic.hpp"
......@@ -222,7 +222,7 @@ public:
void P2P(const FTreeCoordinate& inLeafPosition,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
ContainerClass* const directNeighborsParticles[27], const int /*size*/){
FP2P::FullMutual(targets,directNeighborsParticles,14);
FP2PR::FullMutual(targets,directNeighborsParticles,14);
}
/** This P2P has to be used when target != sources
......@@ -236,7 +236,7 @@ public:
void P2PRemote(const FTreeCoordinate& ,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict ,
ContainerClass* const directNeighborsParticles[27], const int /*size*/){
FP2P::FullRemote(targets,directNeighborsParticles,27);
FP2PR::FullRemote(targets,directNeighborsParticles,27);
}
private:
......
......@@ -20,7 +20,7 @@
#include "../../Utils/FMemUtils.hpp"
#include "../../Utils/FLog.hpp"
#include "../../Utils/FSmartPointer.hpp"
#include "../P2P/FP2P.hpp"
#include "../P2P/FP2PR.hpp"
/**
* @author Cyrille Piacibello
......@@ -969,7 +969,7 @@ public:
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict /*sources*/,
ContainerClass* const directNeighborsParticles[27], const int /*size*/)
{
FP2P::FullMutual(targets,directNeighborsParticles,14);
FP2PR::FullMutual(targets,directNeighborsParticles,14);
}
};
......
......@@ -73,7 +73,7 @@ struct FUnifRoots : FNoCopyable
int omn = order-n-1;
if(omn%2) scale=-1.; // (-1)^(n-1-(k+1)+1)=(-1)^(omn-1)
else scale=1.;
scale/=FMath::pow(2.,order-1)*FMath::factorial(n)*FMath::factorial(omn);
scale/=FMath::pow(2.,order-1)*FMath::factorial<FReal>(n)*FMath::factorial<FReal>(omn);
// compute L
FReal L=FReal(1.);
......
This diff is collapsed.
......@@ -42,6 +42,7 @@
#include "../../Src/Files/FDlpolyLoader.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Kernels/P2P/FP2P.hpp"
#include "../../Src/Kernels/P2P/FP2PParticleContainerIndexed.hpp"
#include "../../Src/Kernels/Interpolation/FInterpMatrixKernel.hpp"
......
......@@ -68,7 +68,7 @@ typedef FFmmAlgorithm<OctreeClass, CellClass, ContainerClass, KernelClass, LeafC
void doATest(const int NbParticles, const int minP, const int maxP, const int minH, const int maxH,
const FReal physicalValue, const bool neutral ,
FMath::FAccurater* allPotentialDiff, FReal* allAbsoluteDiff, FReal* timing,
const int SizeSubLevels = 3, FReal* timeForDirect = 0){
const int SizeSubLevels = 3, FReal* timeForDirect = nullptr){
FTic counter;
FRandomLoader loader(NbParticles);
......@@ -92,17 +92,16 @@ void doATest(const int NbParticles, const int minP, const int maxP, const int mi
if(computeDirectAndDiff){
printf("Compute direct!\n");
counter.tic();
const FInterpMatrixKernelR MatrixKernel;
for(int idxTarget = 0 ; idxTarget < loader.getNumberOfParticles() ; ++idxTarget){
for(int idxOther = idxTarget + 1 ; idxOther < loader.getNumberOfParticles() ; ++idxOther){
FP2P::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
FP2PR::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
particles[idxTarget].position.getZ(),particles[idxTarget].physicalValue,
&particles[idxTarget].forces[0],&particles[idxTarget].forces[1],
&particles[idxTarget].forces[2],&particles[idxTarget].potential,
particles[idxOther].position.getX(), particles[idxOther].position.getY(),
particles[idxOther].position.getZ(),particles[idxOther].physicalValue,
&particles[idxOther].forces[0],&particles[idxOther].forces[1],
&particles[idxOther].forces[2],&particles[idxOther].potential,&MatrixKernel);
&particles[idxOther].forces[2],&particles[idxOther].potential);
}
}
if(timeForDirect) *timeForDirect = counter.tacAndElapsed();
......@@ -230,8 +229,8 @@ int main(int argc, char ** argv){
printf("Size array %d \n", (NbLevels+1-2)*(DevP+1-2));
doATest(NbParticles,2,DevP,2,NbLevels,
physicalValue, neutral, allPotentialDiff, 0,
0, SizeSubLevels);
physicalValue, neutral, allPotentialDiff, nullptr,
nullptr, SizeSubLevels);
{
FILE* fres = fopen("test-hp.res", "w");
......@@ -301,15 +300,14 @@ int main(int argc, char ** argv){
FmmClass algo(&tree,&kernels);
algo.execute();
const FInterpMatrixKernelR MatrixKernel;
FP2P::MutualParticles(centeredParticle.position.getX(), centeredParticle.position.getY(),
FP2PR::MutualParticles(centeredParticle.position.getX(), centeredParticle.position.getY(),
centeredParticle.position.getZ(),centeredParticle.physicalValue,
&centeredParticle.forces[0],&centeredParticle.forces[1],
&centeredParticle.forces[2],&centeredParticle.potential,
otherParticle.position.getX(), otherParticle.position.getY(),
otherParticle.position.getZ(),otherParticle.physicalValue,
&otherParticle.forces[0],&otherParticle.forces[1],
&otherParticle.forces[2],&otherParticle.potential,&MatrixKernel);
&otherParticle.forces[2],&otherParticle.potential);
{ // Check that each particle has been summed with all other
......@@ -375,7 +373,7 @@ int main(int argc, char ** argv){
for(int idxP = 0 ; idxP < 3 ; ++idxP){
doATest(NbParticles,DevsP[idxP],DevsP[idxP],2,NbLevels,
physicalValue, neutral, 0, 0,
physicalValue, neutral, nullptr, nullptr,
timeCounter[idxP], SizeSubLevels, &directTime);
}
......@@ -421,7 +419,7 @@ int main(int argc, char ** argv){
for(int idxPart = 0 ; idxPart < NbSteps ; ++idxPart){
for(int idxP = 0 ; idxP < 3 ; ++idxP){
doATest(ParticlesNumbers[idxPart],DevsP[idxP],DevsP[idxP],AllLevels[idxPart],AllLevels[idxPart],
physicalValue, neutral, 0, 0,
physicalValue, neutral, nullptr, nullptr,
timeCounter[idxP]+idxPart, SizeSubLevels);
}
}
......@@ -469,7 +467,7 @@ int main(int argc, char ** argv){
doATest(NbParticles,1,DevP,NbLevels,NbLevels,
physicalValue, neutral, potentialDiff, potentialAbsoluteDiff,
0, SizeSubLevels);
nullptr, SizeSubLevels);
{
FILE* fres = fopen("test-p.res", "w");
......
......@@ -37,6 +37,7 @@
#include "../../Src/Files/FDlpolyLoader.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Kernels/P2P/FP2P.hpp"
#include "../../Src/Kernels/P2P/FP2PParticleContainerIndexed.hpp"
#include "../Src/Kernels/Interpolation/FInterpMatrixKernel.hpp"
......
......@@ -91,19 +91,16 @@ int main(int argc, char* argv[])
particles[idxPart].forces[2] = 0.0;
}
{
// interaction evaluator
const FInterpMatrixKernelR MatrixKernel;
for(int idxTarget = 0 ; idxTarget < loader.getNumberOfParticles() ; ++idxTarget){
for(int idxOther = idxTarget + 1 ; idxOther < loader.getNumberOfParticles() ; ++idxOther){
FP2P::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
FP2PR::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
particles[idxTarget].position.getZ(),particles[idxTarget].physicalValue,
&particles[idxTarget].forces[0],&particles[idxTarget].forces[1],
&particles[idxTarget].forces[2],&particles[idxTarget].potential,
particles[idxOther].position.getX(), particles[idxOther].position.getY(),
particles[idxOther].position.getZ(),particles[idxOther].physicalValue,
&particles[idxOther].forces[0],&particles[idxOther].forces[1],
&particles[idxOther].forces[2],&particles[idxOther].potential, &MatrixKernel);
&particles[idxOther].forces[2],&particles[idxOther].potential);
}
}
}
......
This diff is collapsed.
......@@ -28,7 +28,7 @@
#include "Utils/FParameters.hpp"
#include "Files/FFmaGenericLoader.hpp"
#include "Kernels/P2P/FP2P.hpp"
#include "Kernels/P2P/FP2PR.hpp"
#include "Kernels/P2P/FP2PParticleContainer.hpp"
#include "Components/FBasicCell.hpp"
......@@ -163,7 +163,7 @@ int main(int argc, char ** argv){
FTreeCoordinate coord = iterator.getCurrentGlobalCoordinate();
ContainerClass** neighbors = new ContainerClass*[27];
tree.getLeafsNeighbors(neighbors,coord,1);
FP2P::FullMutual(iterator.getCurrentLeaf()->getTargets(),neighbors,27);
FP2PR::FullMutual(iterator.getCurrentLeaf()->getTargets(),neighbors,27);
}while(iterator.moveRight());
}
......
......@@ -129,17 +129,16 @@ class TestSphericalDirect : public FUTester<TestSphericalDirect> {
// Run direct computation
//Print("Direct...");
const FInterpMatrixKernelR MatrixKernel;
for(int idxTarget = 0 ; idxTarget < nbParticles ; ++idxTarget){
for(int idxOther = idxTarget + 1 ; idxOther < nbParticles ; ++idxOther){
FP2P::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
FP2PR::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
particles[idxTarget].position.getZ(),particles[idxTarget].physicalValue,
&particles[idxTarget].forces[0],&particles[idxTarget].forces[1],
&particles[idxTarget].forces[2],&particles[idxTarget].potential,
particles[idxOther].position.getX(), particles[idxOther].position.getY(),
particles[idxOther].position.getZ(),particles[idxOther].physicalValue,
&particles[idxOther].forces[0],&particles[idxOther].forces[1],
&particles[idxOther].forces[2],&particles[idxOther].potential,&MatrixKernel);
&particles[idxOther].forces[2],&particles[idxOther].potential);
}
}
......
......@@ -109,17 +109,16 @@ class TestRotationDirect : public FUTester<TestRotationDirect> {
// Run direct computation
// Print("Direct...");
const FInterpMatrixKernelR MatrixKernel;
for(int idxTarget = 0 ; idxTarget < nbParticles ; ++idxTarget){
for(int idxOther = idxTarget + 1 ; idxOther < nbParticles ; ++idxOther){
FP2P::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
FP2PR::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
particles[idxTarget].position.getZ(),particles[idxTarget].physicalValue,
&particles[idxTarget].forces[0],&particles[idxTarget].forces[1],
&particles[idxTarget].forces[2],&particles[idxTarget].potential,
particles[idxOther].position.getX(), particles[idxOther].position.getY(),
particles[idxOther].position.getZ(),particles[idxOther].physicalValue,
&particles[idxOther].forces[0],&particles[idxOther].forces[1],
&particles[idxOther].forces[2],&particles[idxOther].potential,&MatrixKernel);
&particles[idxOther].forces[2],&particles[idxOther].potential);
}
}
......
......@@ -91,17 +91,16 @@ class TestRotationDirectPeriodic : public FUTester<TestRotationDirectPeriodic> {
Print("Run direct...");
FTreeCoordinate min, max;
algo.repetitionsIntervals(&min, &max);
const FInterpMatrixKernelR MatrixKernel;
for(int idxTarget = 0 ; idxTarget < loader.getNumberOfParticles() ; ++idxTarget){
for(int idxOther = idxTarget + 1 ; idxOther < loader.getNumberOfParticles() ; ++idxOther){
FP2P::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
FP2PR::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
particles[idxTarget].position.getZ(),particles[idxTarget].physicalValue,
&particles[idxTarget].forces[0],&particles[idxTarget].forces[1],
&particles[idxTarget].forces[2],&particles[idxTarget].potential,
particles[idxOther].position.getX(), particles[idxOther].position.getY(),
particles[idxOther].position.getZ(),particles[idxOther].physicalValue,
&particles[idxOther].forces[0],&particles[idxOther].forces[1],
&particles[idxOther].forces[2],&particles[idxOther].potential,&MatrixKernel);
&particles[idxOther].forces[2],&particles[idxOther].potential);
}
for(int idxX = min.getX() ; idxX <= max.getX() ; ++idxX){
for(int idxY = min.getY() ; idxY <= max.getY() ; ++idxY){
......@@ -117,13 +116,13 @@ class TestRotationDirectPeriodic : public FUTester<TestRotationDirectPeriodic> {
TestParticle source = particles[idxSource];
source.position += offset;
FP2P::NonMutualParticles(
FP2PR::NonMutualParticles(
source.position.getX(), source.position.getY(),
source.position.getZ(),source.physicalValue,
particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
particles[idxTarget].position.getZ(),particles[idxTarget].physicalValue,
&particles[idxTarget].forces[0],&particles[idxTarget].forces[1],
&particles[idxTarget].forces[2],&particles[idxTarget].potential,&MatrixKernel);
&particles[idxTarget].forces[2],&particles[idxTarget].potential);
}
}
}
......
......@@ -100,17 +100,16 @@ class TestRotationDirectTsm : public FUTester<TestRotationDirectTsm> {
//
// Run direct computation
Print("Direct...");
const FInterpMatrixKernelR MatrixKernel;
Print("Direct...");
for(int idxTarget = 0 ; idxTarget < nbTargets ; ++idxTarget){
for(int idxOther = 0 ; idxOther < nbSources ; ++idxOther){
FP2P::NonMutualParticles(
FP2PR::NonMutualParticles(
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(),&MatrixKernel);
&particlesTargets[idxTarget].setForces()[2],particlesTargets[idxTarget].setPotential());
}
}
......
......@@ -92,17 +92,16 @@ class TestSphericalDirectPeriodic : public FUTester<TestSphericalDirectPeriodic>
Print("Run direct...");
FTreeCoordinate min, max;
algo.repetitionsIntervals(&min, &max);
const FInterpMatrixKernelR MatrixKernel;
for(int idxTarget = 0 ; idxTarget < loader.getNumberOfParticles() ; ++idxTarget){
for(int idxOther = idxTarget + 1 ; idxOther < loader.getNumberOfParticles() ; ++idxOther){
FP2P::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
FP2PR::MutualParticles(particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
particles[idxTarget].position.getZ(),particles[idxTarget].physicalValue,
&particles[idxTarget].forces[0],&particles[idxTarget].forces[1],
&particles[idxTarget].forces[2],&particles[idxTarget].potential,
particles[idxOther].position.getX(), particles[idxOther].position.getY(),
particles[idxOther].position.getZ(),particles[idxOther].physicalValue,
&particles[idxOther].forces[0],&particles[idxOther].forces[1],
&particles[idxOther].forces[2],&particles[idxOther].potential, &MatrixKernel);
&particles[idxOther].forces[2],&particles[idxOther].potential);
}