Commit 205e0efb authored by Quentin Khan's avatar Quentin Khan

Update tests to take previous changes into account

the changes are the new data layout, the deprecation of the POD cell
adaptors.

Changed tests are:
  - testBlockedAlgorithm,
  - testBlockedAlgorithmDyn,
  - testBlockedMpiAlgorithm,
  - testBlockedChebyshev,
  - testBlockedMpiChebyshev,
  - testBlockedRotation,
  - testBlockedRotationCompare,
  - testBlockedRotationMpi,
  - testBlockedSpeedOperators,
  - testBlockedTaylor,
  - testBlockedTree,
  - testBlockedUniform,
  - testBlockedUniformBench,
  - testBlockedUniformCompare
parent 7b3ed043
......@@ -4,6 +4,9 @@
#include "../../Src/Utils/FGlobal.hpp"
//#undef SCALFMM_USE_STARPU
//#undef SCALFMM_USE_OMP4
#include "../../Src/GroupTree/Core/FGroupTree.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
......@@ -33,9 +36,9 @@
#include "../../Src/Components/FTestParticleContainer.hpp"
#include "../../Src/Components/FTestCell.hpp"
#include "Components/FSymbolicData.hpp"
#include "../../Src/Components/FTestKernels.hpp"
#include "../../Src/GroupTree/TestKernel/FGroupTestParticleContainer.hpp"
#include "../../Src/GroupTree/TestKernel/FTestCellPOD.hpp"
#include "../../Src/Files/FFmaGenericLoader.hpp"
#include "../../Src/Core/FFmmAlgorithm.hpp"
......@@ -53,14 +56,13 @@ int main(int argc, char* argv[]){
typedef double FReal;
// Initialize the types
typedef FTestCellPODCore GroupCellSymbClass;
typedef FTestCellPODData GroupCellUpClass;
typedef FTestCellPODData GroupCellDownClass;
typedef FTestCellPOD GroupCellClass;
using GroupCellClass = FTestCell;
using GroupCellUpClass = typename FTestCell::multipole_t;
using GroupCellDownClass = typename FTestCell::local_expansion_t;
using GroupCellSymbClass = FSymbolicData;
typedef FGroupTestParticleContainer<FReal> GroupContainerClass;
typedef FGroupTree< FReal, GroupCellClass, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass,
typedef FGroupTree< FReal, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass,
GroupContainerClass, 0, 1, long long int> GroupOctreeClass;
#ifdef SCALFMM_USE_STARPU
typedef FStarPUAllCpuCapacities<FTestKernels< GroupCellClass, GroupContainerClass >> GroupKernelClass;
......@@ -125,17 +127,26 @@ int main(int argc, char* argv[]){
groupedTree.printInfoBlocks();
// Check tree structure at leaf level
groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass gcell, GroupContainerClass* gleaf){
const ContainerClass* src = tree.getLeafSrc(gcell.getMortonIndex());
if(src == nullptr){
std::cout << "[PartEmpty] Error cell should not exist " << gcell.getMortonIndex() << "\n";
}
else {
if(src->getNbParticles() != gleaf->getNbParticles()){
std::cout << "[Part] Nb particles is different at index " << gcell.getMortonIndex() << " is " << gleaf->getNbParticles() << " should be " << src->getNbParticles() << "\n";
// groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass gcell, GroupContainerClass* gleaf){
groupedTree.forEachCellLeaf<GroupContainerClass>(
[&](GroupCellSymbClass* gsymb,
GroupCellUpClass* /* gmul */,
GroupCellDownClass* /* gloc */,
GroupContainerClass* gleaf)
{
const ContainerClass* src = tree.getLeafSrc(gsymb->getMortonIndex());
if(src == nullptr){
std::cout << "[PartEmpty] Error cell should not exist "
<< gsymb->getMortonIndex() << "\n";
} else {
if(src->getNbParticles() != gleaf->getNbParticles()) {
std::cout << "[Part] Nb particles is different at index "
<< gsymb->getMortonIndex()
<< " is " << gleaf->getNbParticles()
<< " should be " << src->getNbParticles() << "\n";
}
}
}
});
});
// Run the algorithm
GroupKernelClass groupkernel;
......@@ -148,36 +159,52 @@ int main(int argc, char* argv[]){
algo.execute();
// Validate the result
groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass cell, GroupContainerClass* leaf){
const FSize nbPartsInLeaf = leaf->getNbParticles();
if(cell.getDataUp() != nbPartsInLeaf){
std::cout << "[P2M] Error a Cell has " << cell.getDataUp() << " (it should be " << nbPartsInLeaf << ")\n";
}
});
groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass cell, GroupContainerClass* leaf){
const FSize nbPartsInLeaf = leaf->getNbParticles();
const long long int* dataDown = leaf->getDataDown();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeaf ; ++idxPart){
if(dataDown[idxPart] != loader.getNumberOfParticles()-1){
std::cout << "[Full] Error a particle has " << dataDown[idxPart] << " (it should be " << (loader.getNumberOfParticles()-1) << ") at index " << cell.getMortonIndex() << "\n";
groupedTree.forEachCellLeaf<GroupContainerClass>(
[&](GroupCellSymbClass* /*gsymb*/,
GroupCellUpClass* gmul,
GroupCellDownClass* /*gloc*/,
GroupContainerClass* leaf)
{
const FSize nbPartsInLeaf = leaf->getNbParticles();
if(gmul->get() != nbPartsInLeaf){
std::cout << "[P2M] Error a Cell has " << gmul->get()
<< " (it should be " << nbPartsInLeaf << ")\n";
}
});
groupedTree.forEachCellLeaf<GroupContainerClass>(
[&](GroupCellSymbClass* gsymb,
GroupCellUpClass* /*gmul*/,
GroupCellDownClass* /*gloc*/,
GroupContainerClass* leaf)
{
const FSize nbPartsInLeaf = leaf->getNbParticles();
const long long int* dataDown = leaf->getDataDown();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeaf ; ++idxPart){
if(dataDown[idxPart] != loader.getNumberOfParticles()-1){
std::cout << "[Full] Error a particle has " << dataDown[idxPart] << " (it should be " << (loader.getNumberOfParticles()-1) << ") at index " << gsymb->getMortonIndex() << "\n";
}
}
}
});
});
// Compare the results
groupedTree.forEachCellWithLevel([&](GroupCellClass gcell, const int level){
const CellClass* cell = tree.getCell(gcell.getMortonIndex(), level);
if(cell == nullptr){
std::cout << "[Empty] Error cell should not exist " << gcell.getMortonIndex() << "\n";
}
else {
if(gcell.getDataUp() != cell->getDataUp()){
std::cout << "[Up] Up is different at index " << gcell.getMortonIndex() << " level " << level << " is " << gcell.getDataUp() << " should be " << cell->getDataUp() << "\n";
groupedTree.forEachCellWithLevel(
[&](GroupCellSymbClass* gsymb,
GroupCellUpClass* gmul,
GroupCellDownClass* gloc,
const int level)
{
const CellClass* cell = tree.getCell(gsymb->getMortonIndex(), level);
if(cell == nullptr){
std::cout << "[Empty] Error cell should not exist " << gsymb->getMortonIndex() << "\n";
}
if(gcell.getDataDown() != cell->getDataDown()){
std::cout << "[Down] Down is different at index " << gcell.getMortonIndex() << " level " << level << " is " << gcell.getDataDown() << " should be " << cell->getDataDown() << "\n";
else {
if(gmul->get() != cell->getDataUp().get()){
std::cout << "[Up] Up is different at index " << gsymb->getMortonIndex() << " level " << level << " is " << *gsymb << " should be " << cell->getDataUp() << "\n";
}
if(gloc->get() != cell->getDataDown().get()){
std::cout << "[Down] Down is different at index " << gsymb->getMortonIndex() << " level " << level << " is " << *gloc << " should be " << cell->getDataDown() << "\n";
}
}
}
});
});
return 0;
}
This diff is collapsed.
......@@ -9,15 +9,15 @@
#include "../../Src/GroupTree/Core/FGroupTree.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FSymbolicData.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp"
#include "../../Src/Kernels/Chebyshev/FChebSymKernel.hpp"
#include "../../Src/Kernels/Chebyshev/FChebCell.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "../../Src/GroupTree/Chebyshev/FChebCellPOD.hpp"
#include "../../Src/Utils/FMath.hpp"
#include "../../Src/Utils/FMemUtils.hpp"
#include "../../Src/Utils/FParameters.hpp"
......@@ -60,14 +60,13 @@ int main(int argc, char* argv[]){
static const int ORDER = 6;
typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
typedef FChebCellPODCore GroupCellSymbClass;
typedef FChebCellPODPole<FReal,ORDER> GroupCellUpClass;
typedef FChebCellPODLocal<FReal,ORDER> GroupCellDownClass;
typedef FChebCellPOD<FReal,ORDER> GroupCellClass;
using GroupCellClass = FChebCell<FReal, ORDER>;
using GroupCellUpClass = typename GroupCellClass::multipole_t;
using GroupCellDownClass = typename GroupCellClass::local_expansion_t;
using GroupCellSymbClass = FSymbolicData;
typedef FP2PGroupParticleContainer<FReal> GroupContainerClass;
typedef FGroupTree< FReal, GroupCellClass, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupContainerClass, 1, 4, FReal> GroupOctreeClass;
typedef FGroupTree< FReal, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupContainerClass, 1, 4, FReal> GroupOctreeClass;
#ifdef SCALFMM_USE_STARPU
typedef FStarPUAllCpuCapacities<FChebSymKernel<FReal,GroupCellClass,GroupContainerClass,MatrixKernelClass,ORDER>> GroupKernelClass;
typedef FStarPUCpuWrapper<typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass> GroupCpuWrapper;
......@@ -132,22 +131,27 @@ int main(int argc, char* argv[]){
FReal*const allPosY = const_cast<FReal*>( allParticles.getPositions()[1]);
FReal*const allPosZ = const_cast<FReal*>( allParticles.getPositions()[2]);
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >([&](GroupCellClass cellTarget, FP2PGroupParticleContainer<FReal> * leafTarget){
const FReal*const physicalValues = leafTarget->getPhysicalValues();
const FReal*const posX = leafTarget->getPositions()[0];
const FReal*const posY = leafTarget->getPositions()[1];
const FReal*const posZ = leafTarget->getPositions()[2];
const FSize nbPartsInLeafTarget = leafTarget->getNbParticles();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeafTarget ; ++idxPart){
allPhysicalValues[offsetParticles + idxPart] = physicalValues[idxPart];
allPosX[offsetParticles + idxPart] = posX[idxPart];
allPosY[offsetParticles + idxPart] = posY[idxPart];
allPosZ[offsetParticles + idxPart] = posZ[idxPart];
}
offsetParticles += nbPartsInLeafTarget;
});
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >(
[&](GroupCellSymbClass* /* gsymb */,
GroupCellUpClass* /* gmul */,
GroupCellDownClass* /* gloc */,
FP2PGroupParticleContainer<FReal> * leafTarget)
{
const FReal*const physicalValues = leafTarget->getPhysicalValues();
const FReal*const posX = leafTarget->getPositions()[0];
const FReal*const posY = leafTarget->getPositions()[1];
const FReal*const posZ = leafTarget->getPositions()[2];
const FSize nbPartsInLeafTarget = leafTarget->getNbParticles();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeafTarget ; ++idxPart){
allPhysicalValues[offsetParticles + idxPart] = physicalValues[idxPart];
allPosX[offsetParticles + idxPart] = posX[idxPart];
allPosY[offsetParticles + idxPart] = posY[idxPart];
allPosZ[offsetParticles + idxPart] = posZ[idxPart];
}
offsetParticles += nbPartsInLeafTarget;
});
FAssertLF(offsetParticles == loader.getNumberOfParticles());
......@@ -170,22 +174,26 @@ int main(int argc, char* argv[]){
FMath::FAccurater<FReal> potentialDiff;
FMath::FAccurater<FReal> fx, fy, fz;
offsetParticles = 0;
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >([&](GroupCellClass cellTarget, FP2PGroupParticleContainer<FReal> * leafTarget){
const FReal*const potentials = leafTarget->getPotentials();
const FReal*const forcesX = leafTarget->getForcesX();
const FReal*const forcesY = leafTarget->getForcesY();
const FReal*const forcesZ = leafTarget->getForcesZ();
const FSize nbPartsInLeafTarget = leafTarget->getNbParticles();
for(int idxTgt = 0 ; idxTgt < nbPartsInLeafTarget ; ++idxTgt){
potentialDiff.add(allDirectPotentials[idxTgt + offsetParticles], potentials[idxTgt]);
fx.add(allDirectforcesX[idxTgt + offsetParticles], forcesX[idxTgt]);
fy.add(allDirectforcesY[idxTgt + offsetParticles], forcesY[idxTgt]);
fz.add(allDirectforcesZ[idxTgt + offsetParticles], forcesZ[idxTgt]);
}
offsetParticles += nbPartsInLeafTarget;
});
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >(
[&](GroupCellSymbClass* /* gsymb */,
GroupCellUpClass* /* gmul */,
GroupCellDownClass* /* gloc */,
FP2PGroupParticleContainer<FReal> * leafTarget){
const FReal*const potentials = leafTarget->getPotentials();
const FReal*const forcesX = leafTarget->getForcesX();
const FReal*const forcesY = leafTarget->getForcesY();
const FReal*const forcesZ = leafTarget->getForcesZ();
const FSize nbPartsInLeafTarget = leafTarget->getNbParticles();
for(int idxTgt = 0 ; idxTgt < nbPartsInLeafTarget ; ++idxTgt){
potentialDiff.add(allDirectPotentials[idxTgt + offsetParticles], potentials[idxTgt]);
fx.add(allDirectforcesX[idxTgt + offsetParticles], forcesX[idxTgt]);
fy.add(allDirectforcesY[idxTgt + offsetParticles], forcesY[idxTgt]);
fz.add(allDirectforcesZ[idxTgt + offsetParticles], forcesZ[idxTgt]);
}
offsetParticles += nbPartsInLeafTarget;
});
std::cout << "Error : Potential " << potentialDiff << "\n";
std::cout << "Error : fx " << fx << "\n";
......@@ -195,4 +203,3 @@ int main(int argc, char* argv[]){
return 0;
}
......@@ -9,6 +9,7 @@
#include "../../Src/GroupTree/Core/FGroupTree.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FSymbolicData.hpp"
#include "../../Src/Containers/FVector.hpp"
......@@ -30,8 +31,6 @@
#include "../../Src/Components/FTestCell.hpp"
#include "../../Src/GroupTree/TestKernel/FGroupTestParticleContainer.hpp"
#include "../../Src/GroupTree/TestKernel/FTestCellPOD.hpp"
#include "../../Src/BalanceTree/FLeafBalance.hpp"
#include "../../Src/Files/FMpiTreeBuilder.hpp"
......@@ -55,13 +54,13 @@ int main(int argc, char* argv[]){
LocalOptionBlocSize);
typedef double FReal;
// Initialize the types
typedef FTestCellPODCore GroupCellSymbClass;
typedef FTestCellPODData GroupCellUpClass;
typedef FTestCellPODData GroupCellDownClass;
typedef FTestCellPOD GroupCellClass;
using GroupCellClass = FTestCell;
using GroupCellUpClass = typename FTestCell::multipole_t;
using GroupCellDownClass = typename FTestCell::local_expansion_t;
using GroupCellSymbClass = FSymbolicData;
typedef FGroupTestParticleContainer<FReal> GroupContainerClass;
typedef FGroupTree< FReal, GroupCellClass, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass,
typedef FGroupTree< FReal, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass,
GroupContainerClass, 0, 1, long long int> GroupOctreeClass;
typedef FStarPUAllCpuCapacities<FTestKernels< GroupCellClass, GroupContainerClass >> GroupKernelClass;
typedef FStarPUCpuWrapper<typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass> GroupCpuWrapper;
......@@ -144,15 +143,23 @@ int main(int argc, char* argv[]){
std::cout << "Wait Others... " << std::endl;
mpiComm.global().barrier();
groupedTree.forEachCellLeaf<GroupContainerClass>([&](GroupCellClass cell, GroupContainerClass* leaf){
const FSize nbPartsInLeaf = leaf->getNbParticles();
const long long int* dataDown = leaf->getDataDown();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeaf ; ++idxPart){
if(dataDown[idxPart] != totalNbParticles-1){
std::cout << "[Full] Error a particle has " << dataDown[idxPart] << " (it should be " << (totalNbParticles-1) << ") at index " << cell.getMortonIndex() << "\n";
groupedTree.forEachCellLeaf<GroupContainerClass>(
[&](GroupCellSymbClass* gsymb,
GroupCellUpClass* /* gmul */,
GroupCellDownClass* /* gloc */,
GroupContainerClass* leaf)
{
const FSize nbPartsInLeaf = leaf->getNbParticles();
const long long int* dataDown = leaf->getDataDown();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeaf ; ++idxPart){
if(dataDown[idxPart] != totalNbParticles-1){
std::cout << "[Full] Error a particle has " << dataDown[idxPart]
<< " (it should be " << (totalNbParticles-1)
<< ") at index " << gsymb->getMortonIndex()
<< "\n";
}
}
}
});
});
......@@ -180,22 +187,26 @@ int main(int argc, char* argv[]){
algo.execute();
// Compare the results
groupedTree.forEachCellWithLevel([&](GroupCellClass gcell, const int level){
const CellClass* cell = tree.getCell(gcell.getMortonIndex(), level);
if(cell == nullptr){
std::cout << "[Empty] Error cell should not exist " << gcell.getMortonIndex() << "\n";
}
else {
if(gcell.getDataUp() != cell->getDataUp()){
std::cout << "[Up] Up is different at index " << gcell.getMortonIndex() << " level " << level << " is " << gcell.getDataUp() << " should be " << cell->getDataUp() << "\n";
groupedTree.forEachCellWithLevel(
[&](GroupCellSymbClass* gsymb,
GroupCellUpClass* gmul,
GroupCellDownClass* gloc,
const int level)
{
const CellClass* cell = tree.getCell(gsymb->getMortonIndex(), level);
if(cell == nullptr){
std::cout << "[Empty] Error cell should not exist " << gsymb->getMortonIndex() << "\n";
}
if(gcell.getDataDown() != cell->getDataDown()){
std::cout << "[Down] Down is different at index " << gcell.getMortonIndex() << " level " << level << " is " << gcell.getDataDown() << " should be " << cell->getDataDown() << "\n";
else {
if(*gmul != cell->getDataUp()){
std::cout << "[Up] Up is different at index " << gsymb->getMortonIndex() << " level " << level << " is " << *gmul << " should be " << cell->getDataUp() << "\n";
}
if(*gloc != cell->getDataDown()){
std::cout << "[Down] Down is different at index " << gsymb->getMortonIndex() << " level " << level << " is " << *gloc << " should be " << cell->getDataDown() << "\n";
}
}
}
});
});
}
return 0;
}
......@@ -11,13 +11,13 @@
#include "../../Src/GroupTree/Core/FGroupTree.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FSymbolicData.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp"
#include "../../Src/Kernels/Chebyshev/FChebSymKernel.hpp"
#include "../../Src/Kernels/Chebyshev/FChebCell.hpp"
#include "../../Src/GroupTree/Chebyshev/FChebCellPOD.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "../../Src/Utils/FMath.hpp"
......@@ -63,14 +63,14 @@ int main(int argc, char* argv[]){
static const int ORDER = 6;
typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
typedef FChebCellPODCore GroupCellSymbClass;
typedef FChebCellPODPole<FReal,ORDER> GroupCellUpClass;
typedef FChebCellPODLocal<FReal,ORDER> GroupCellDownClass;
typedef FChebCellPOD<FReal,ORDER> GroupCellClass;
using GroupCellClass = FChebCell<FReal, ORDER>;
using GroupCellUpClass = typename GroupCellClass::multipole_t;
using GroupCellDownClass = typename GroupCellClass::local_expansion_t;
using GroupCellSymbClass = FSymbolicData;
typedef FP2PGroupParticleContainer<FReal> GroupContainerClass;
typedef FGroupTree< FReal, GroupCellClass, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupContainerClass, 1, 4, FReal> GroupOctreeClass;
typedef FGroupTree< FReal, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupContainerClass, 1, 4, FReal> GroupOctreeClass;
typedef FStarPUAllCpuCapacities<FChebSymKernel<FReal,GroupCellClass,GroupContainerClass,MatrixKernelClass,ORDER>> GroupKernelClass;
typedef FStarPUCpuWrapper<typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass> GroupCpuWrapper;
......@@ -194,29 +194,39 @@ int main(int argc, char* argv[]){
algorithm.execute();
std::cout << "Algo is over" << std::endl;
groupedTree.forEachCellWithLevel([&](GroupCellClass gcell, const int level){
const CellClass* cell = treeCheck.getCell(gcell.getMortonIndex(), level);
if(cell == nullptr){
std::cout << "[Empty] Error cell should exist " << gcell.getMortonIndex() << "\n";
}
else {
FMath::FAccurater<FReal> diffUp;
diffUp.add(cell->getMultipole(0), gcell.getMultipole(0), gcell.getVectorSize());
if(diffUp.getRelativeInfNorm() > epsi || diffUp.getRelativeL2Norm() > epsi){
std::cout << "[Up] Up is different at index " << gcell.getMortonIndex() << " level " << level << " is " << diffUp << "\n";
groupedTree.forEachCellWithLevel(
[&](GroupCellSymbClass* gsymb ,
GroupCellUpClass* gmul,
GroupCellDownClass* gloc,
const int level)
{
const CellClass* cell = treeCheck.getCell(gsymb->getMortonIndex(), level);
if(cell == nullptr){
std::cout << "[Empty] Error cell should exist " << gsymb->getMortonIndex() << "\n";
}
FMath::FAccurater<FReal> diffDown;
diffDown.add(cell->getLocal(0), gcell.getLocal(0), gcell.getVectorSize());
if(diffDown.getRelativeInfNorm() > epsi || diffDown.getRelativeL2Norm() > epsi){
std::cout << "[Up] Down is different at index " << gcell.getMortonIndex() << " level " << level << " is " << diffDown << "\n";
else {
FMath::FAccurater<FReal> diffUp;
diffUp.add(cell->getMultipoleData().get(0), gmul->get(0), gmul->getVectorSize());
if(diffUp.getRelativeInfNorm() > epsi || diffUp.getRelativeL2Norm() > epsi){
std::cout << "[Up] Up is different at index " << gsymb->getMortonIndex() << " level " << level << " is " << diffUp << "\n";
}
FMath::FAccurater<FReal> diffDown;
diffDown.add(cell->getLocalExpansionData().get(0), gloc->get(0), gloc->getVectorSize());
if(diffDown.getRelativeInfNorm() > epsi || diffDown.getRelativeL2Norm() > epsi){
std::cout << "[Up] Down is different at index " << gsymb->getMortonIndex() << " level " << level << " is " << diffDown << "\n";
}
}
}
});
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >([&](GroupCellClass gcell, FP2PGroupParticleContainer<FReal> * leafTarget){
const ContainerClass* targets = treeCheck.getLeafSrc(gcell.getMortonIndex());
});
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >(
[&](GroupCellSymbClass* gsymb ,
GroupCellUpClass* /* gmul */,
GroupCellDownClass* /* gloc */,
FP2PGroupParticleContainer<FReal> * leafTarget)
{
const ContainerClass* targets = treeCheck.getLeafSrc(gsymb->getMortonIndex());
if(targets == nullptr){
std::cout << "[Empty] Error leaf should exist " << gcell.getMortonIndex() << "\n";
std::cout << "[Empty] Error leaf should exist " << gsymb->getMortonIndex() << "\n";
}
else{
const FReal*const gposX = leafTarget->getPositions()[0];
......@@ -238,7 +248,7 @@ int main(int argc, char* argv[]){
const FReal*const potential = targets->getPotentials();
if(gnbPartsInLeafTarget != nbPartsInLeafTarget){
std::cout << "[Empty] Not the same number of particles at " << gcell.getMortonIndex()
std::cout << "[Empty] Not the same number of particles at " << gsymb->getMortonIndex()
<< " gnbPartsInLeafTarget " << gnbPartsInLeafTarget << " nbPartsInLeafTarget " << nbPartsInLeafTarget << "\n";
}
else{
......@@ -247,7 +257,7 @@ int main(int argc, char* argv[]){
for(FSize idxPart = 0 ; idxPart < nbPartsInLeafTarget ; ++idxPart){
if(gposX[idxPart] != posX[idxPart] || gposY[idxPart] != posY[idxPart]
|| gposZ[idxPart] != posZ[idxPart]){
std::cout << "[Empty] Not the same particlea at " << gcell.getMortonIndex() << " idx " << idxPart
std::cout << "[Empty] Not the same particlea at " << gsymb->getMortonIndex() << " idx " << idxPart
<< gposX[idxPart] << " " << posX[idxPart] << " " << gposY[idxPart] << " " << posY[idxPart]
<< " " << gposZ[idxPart] << " " << posZ[idxPart] << "\n";
}
......@@ -259,16 +269,16 @@ int main(int argc, char* argv[]){
}
}
if(potentialDiff.getRelativeInfNorm() > epsi || potentialDiff.getRelativeL2Norm() > epsi){
std::cout << "[Up] potentialDiff is different at index " << gcell.getMortonIndex() << " is " << potentialDiff << "\n";
std::cout << "[Up] potentialDiff is different at index " << gsymb->getMortonIndex() << " is " << potentialDiff << "\n";
}
if(fx.getRelativeInfNorm() > epsi || fx.getRelativeL2Norm() > epsi){
std::cout << "[Up] fx is different at index " << gcell.getMortonIndex() << " is " << fx << "\n";
std::cout << "[Up] fx is different at index " << gsymb->getMortonIndex() << " is " << fx << "\n";
}
if(fy.getRelativeInfNorm() > epsi || fy.getRelativeL2Norm() > epsi){
std::cout << "[Up] fy is different at index " << gcell.getMortonIndex() << " is " << fy << "\n";
std::cout << "[Up] fy is different at index " << gsymb->getMortonIndex() << " is " << fy << "\n";
}
if(fz.getRelativeInfNorm() > epsi || fz.getRelativeL2Norm() > epsi){
std::cout << "[Up] fz is different at index " << gcell.getMortonIndex() << " is " << fz << "\n";
std::cout << "[Up] fz is different at index " << gsymb->getMortonIndex() << " is " << fz << "\n";
}
}
}
......@@ -279,5 +289,3 @@ int main(int argc, char* argv[]){
return 0;
}
......@@ -6,12 +6,13 @@
#include "../../Src/GroupTree/Core/FGroupTree.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FSymbolicData.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp"
#include "../../Src/Kernels/Rotation/FRotationKernel.hpp"
#include "../../Src/GroupTree/Rotation/FRotationCellPOD.hpp"
#include "../../Src/Kernels/Rotation/FRotationCell.hpp"
#include "../../Src/Utils/FMath.hpp"
#include "../../Src/Utils/FMemUtils.hpp"
......@@ -47,13 +48,14 @@ int main(int argc, char* argv[]){
// Initialize the types
typedef double FReal;
static const int P = 9;
typedef FRotationCellPODCore GroupCellSymbClass;
typedef FRotationCellPODPole<FReal,P> GroupCellUpClass;
typedef FRotationCellPODLocal<FReal,P> GroupCellDownClass;
typedef FRotationCellPOD<FReal,P> GroupCellClass;
using GroupCellClass = FRotationCell<FReal, P>;
using GroupCellUpClass = typename GroupCellClass::multipole_t;
using GroupCellDownClass = typename GroupCellClass::local_expansion_t;
using GroupCellSymbClass = FSymbolicData;
typedef FP2PGroupParticleContainer<FReal> GroupContainerClass;
typedef FGroupTree< FReal, GroupCellClass, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupContainerClass, 1, 4, FReal> GroupOctreeClass;
typedef FGroupTree< FReal, GroupCellSymbClass, GroupCellUpClass, GroupCellDownClass, GroupContainerClass, 1, 4, FReal> GroupOctreeClass;
#ifdef SCALFMM_USE_STARPU
typedef FStarPUAllCpuCapacities<FRotationKernel< FReal, GroupCellClass, GroupContainerClass , P>> GroupKernelClass;
typedef FStarPUCpuWrapper<typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass> GroupCpuWrapper;
......@@ -111,22 +113,27 @@ int main(int argc, char* argv[]){
FReal*const allPosY = const_cast<FReal*>( allParticles.getPositions()[1]);
FReal*const allPosZ = const_cast<FReal*>( allParticles.getPositions()[2]);
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >([&](GroupCellClass cellTarget, FP2PGroupParticleContainer<FReal> * leafTarget){
const FReal*const physicalValues = leafTarget->getPhysicalValues();
const FReal*const posX = leafTarget->getPositions()[0];
const FReal*const posY = leafTarget->getPositions()[1];
const FReal*const posZ = leafTarget->getPositions()[2];
const FSize nbPartsInLeafTarget = leafTarget->getNbParticles();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeafTarget ; ++idxPart){
allPhysicalValues[offsetParticles + idxPart] = physicalValues[idxPart];
allPosX[offsetParticles + idxPart] = posX[idxPart];
allPosY[offsetParticles + idxPart] = posY[idxPart];
allPosZ[offsetParticles + idxPart] = posZ[idxPart];
}
offsetParticles += nbPartsInLeafTarget;
});
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >(
[&](GroupCellSymbClass* /* gsymb */,
GroupCellUpClass* /* gmul */,
GroupCellDownClass* /* gloc */,
FP2PGroupParticleContainer<FReal> * leafTarget)
{
const FReal*const physicalValues = leafTarget->getPhysicalValues();
const FReal*const posX = leafTarget->getPositions()[0];
const FReal*const posY = leafTarget->getPositions()[1];
const FReal*const posZ = leafTarget->getPositions()[2];
const FSize nbPartsInLeafTarget = leafTarget->getNbParticles();
for(FSize idxPart = 0 ; idxPart < nbPartsInLeafTarget ; ++idxPart){
allPhysicalValues[offsetParticles + idxPart] = physicalValues[idxPart];
allPosX[offsetParticles + idxPart] = posX[idxPart];
allPosY[offsetParticles + idxPart] = posY[idxPart];
allPosZ[offsetParticles + idxPart] = posZ[idxPart];
}
offsetParticles += nbPartsInLeafTarget;
});
FAssertLF(offsetParticles == loader.getNumberOfParticles());
......@@ -149,22 +156,27 @@ int main(int argc, char* argv[]){
FMath::FAccurater<FReal> potentialDiff;
FMath::FAccurater<FReal> fx, fy, fz;
offsetParticles = 0;
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >([&](GroupCellClass cellTarget, FP2PGroupParticleContainer<FReal> * leafTarget){
const FReal*const potentials = leafTarget->getPotentials();
const FReal*const forcesX = leafTarget->getForcesX();
const FReal*const forcesY = leafTarget->getForcesY();
const FReal*const forcesZ = leafTarget->getForcesZ();
const FSize nbPartsInLeafTarget = leafTarget->getNbParticles();
for(int idxTgt = 0 ; idxTgt < nbPartsInLeafTarget ; ++idxTgt){
potentialDiff.add(allDirectPotentials[idxTgt + offsetParticles], potentials[idxTgt]);
fx.add(allDirectforcesX[idxTgt + offsetParticles], forcesX[idxTgt]);
fy.add(allDirectforcesY[idxTgt + offsetParticles], forcesY[idxTgt]);
fz.add(allDirectforcesZ[idxTgt + offsetParticles], forcesZ[idxTgt]);
}
offsetParticles += nbPartsInLeafTarget;
});
groupedTree.forEachCellLeaf<FP2PGroupParticleContainer<FReal> >(
[&](GroupCellSymbClass* /* gsymb */,
GroupCellUpClass* /* gmul */,
GroupCellDownClass* /* gloc */,
FP2PGroupParticleContainer<FReal> * leafTarget)
{
const FReal*const potentials = leafTarget->getPotentials();
const FReal*const forcesX = leafTarget->getForcesX();
const FReal*const forcesY = leafTarget->getForcesY();
const FReal*const forcesZ = leafTarget->getForcesZ();
const FSize nbPartsInLeafTarget = leafTarget->getNbParticles();
for(int idxTgt = 0 ; idxTgt < nbPartsInLeafTarget ; ++idxTgt){
potentialDiff.add(allDirectPotentials[idxTgt + offsetParticles], potentials[idxTgt]);
fx.add(allDirectforcesX[idxTgt + offsetParticles], forcesX[idxTgt]);
fy.add(allDirectforcesY[idxTgt + offsetParticles], forcesY[idxTgt]);
fz.add(allDirectforcesZ[idxTgt + offsetParticles], forcesZ[idxTgt]);
}
offsetParticles += nbPartsInLeafTarget;
});
std::cout << "Error : Potential " << potentialDiff << "\n";
std::cout << "Error : fx " << fx << "\n";
......@@ -174,4 +186,3 @@ int main(int argc, char* argv[]){
return 0;
}
......@@ -9,6 +9,7 @@
#include "../../Src/GroupTree/Core/FGroupTree.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FSymbolicData.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp"
......@@ -48,7 +49,6 @@
#include "Kernels/Rotation/FRotationCell.hpp"
#include "Kernels/Rotation/FRotationKernel.hpp"
#include "../../Src/GroupTree/Rotation/FRotationCellPOD.hpp"
#include "Components/FSimpleLeaf.hpp"
#include "Kernels/P2P/FP2PParticleContainerIndexed.hpp"
......@@ -565,18 +565,17 @@ struct RunContainer{
leaf->getTargets()->resetForcesAndPotential();
});
}
}
else{
typedef FRotationCellPODCore GroupCellSymbClass;