From cc1bda3a17802cd35a07fa546fcc9e466a971abe Mon Sep 17 00:00:00 2001 From: Olivier Coulaud Date: Thu, 15 Mar 2018 09:50:41 +0100 Subject: [PATCH] Now we use scaoed enum for OPENMP priorities ; Rename typed particles (source, target) rather than FParticleSource --- NEWS.txt | 8 ++++++ Src/Arranger/FOctreeArranger.hpp | 4 +-- Src/Arranger/FParticleTypedIndexedMover.hpp | 10 +++---- Src/Components/FParticleType.hpp | 4 +-- Src/Components/FTypedLeaf.hpp | 2 +- Src/Files/FFmaTsmLoader.hpp | 6 +++-- Src/Files/FRandomLoader.hpp | 4 +-- Tests/Utils/testFmmAlgorithmProcTsm.cpp | 2 +- Tests/Utils/testFmmAlgorithmTsm.cpp | 30 ++++++++++----------- Tests/Utils/testOctreeRearrangeTsm.cpp | 4 +-- UTests/utestChebyshevDirectTsm.cpp | 4 +-- UTests/utestRotationDirectTsm.cpp | 4 +-- 12 files changed, 46 insertions(+), 36 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 752f768e..1377859e 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -7,6 +7,14 @@ This file contains the main features as well as overviews of specific bug fixes (and other actions) for each version of ScalFMM since version 1.1 +2.0 +----- +- New API for Kernels (The same kernel can be used witth all Octree) +- Use scoped enum (FParticleTYpe (target,source), OPM4_Priorities, ... +- StarPU wprks with Duplicate and Let trees with MPI (STF approach) +- Remove all warnings with gcc 7.2 +- std::complex is used for equispaced interpolation +- 1.5 ----- diff --git a/Src/Arranger/FOctreeArranger.hpp b/Src/Arranger/FOctreeArranger.hpp index a41606ed..88a06c46 100644 --- a/Src/Arranger/FOctreeArranger.hpp +++ b/Src/Arranger/FOctreeArranger.hpp @@ -71,7 +71,7 @@ public: const MortonIndex particuleIndex = tree->getMortonFromPosition(currentPart); if(particuleIndex != currentMortonIndex){ //Need to move this one - interface->removeFromLeafAndKeep(particles,currentPart,idxPart,FParticleType::FParticleTypeSource); + interface->removeFromLeafAndKeep(particles,currentPart,idxPart,FParticleType::source); } else{ //Need to increment idx; @@ -88,7 +88,7 @@ public: const MortonIndex particuleIndex = tree->getMortonFromPosition(currentPart); if(particuleIndex != currentMortonIndex){ //Need to move this one - interface->removeFromLeafAndKeep(particleTargets,currentPart,idxPart, FParticleType::FParticleTypeTarget); + interface->removeFromLeafAndKeep(particleTargets,currentPart,idxPart, FParticleType::target); } else{ //Need to increment idx; diff --git a/Src/Arranger/FParticleTypedIndexedMover.hpp b/Src/Arranger/FParticleTypedIndexedMover.hpp index a8286323..2b55459a 100644 --- a/Src/Arranger/FParticleTypedIndexedMover.hpp +++ b/Src/Arranger/FParticleTypedIndexedMover.hpp @@ -33,11 +33,11 @@ public: for(int idxAttr = 0 ; idxAttr < ContainerClass::NbAttributes ; ++idxAttr){ particleValues[idxAttr] = lf->getAttribute(idxAttr)[idxPart]; } - if(type == FParticleType::FParticleTypeTarget){ - toStoreRemovedTargetParts.push(particlePos,FParticleType::FParticleTypeTarget,lf->getIndexes()[idxPart],particleValues); + if(type == FParticleType::target){ + toStoreRemovedTargetParts.push(particlePos,FParticleType::target,lf->getIndexes()[idxPart],particleValues); } else{ - toStoreRemovedSourceParts.push(particlePos,FParticleType::FParticleTypeSource,lf->getIndexes()[idxPart],particleValues); + toStoreRemovedSourceParts.push(particlePos,FParticleType::source,lf->getIndexes()[idxPart],particleValues); } lf->removeParticles(&idxPart,1); } @@ -53,7 +53,7 @@ public: const FPoint particlePos(toStoreRemovedSourceParts.getPositions()[0][idxToInsert], toStoreRemovedSourceParts.getPositions()[1][idxToInsert], toStoreRemovedSourceParts.getPositions()[2][idxToInsert]); - tree->insert(particlePos, FParticleType::FParticleTypeSource, toStoreRemovedSourceParts.getIndexes()[idxToInsert], particleValues); + tree->insert(particlePos, FParticleType::source, toStoreRemovedSourceParts.getIndexes()[idxToInsert], particleValues); } for(FSize idxToInsert = 0; idxToInsertinsert(particlePos, FParticleType::FParticleTypeTarget, toStoreRemovedTargetParts.getIndexes()[idxToInsert], particleValues); + tree->insert(particlePos, FParticleType::target, toStoreRemovedTargetParts.getIndexes()[idxToInsert], particleValues); } toStoreRemovedSourceParts.clear(); diff --git a/Src/Components/FParticleType.hpp b/Src/Components/FParticleType.hpp index 4f55ccec..e1a9921b 100644 --- a/Src/Components/FParticleType.hpp +++ b/Src/Components/FParticleType.hpp @@ -6,8 +6,8 @@ * @brief The FParticleType enum is to make a difference between Target and Source (Tsm) */ enum class FParticleType { - FParticleTypeSource, - FParticleTypeTarget + source, + target // FParticleTypeSource = 0, // FParticleTypeTarget = 1 }; diff --git a/Src/Components/FTypedLeaf.hpp b/Src/Components/FTypedLeaf.hpp index 1c8e6959..54579067 100644 --- a/Src/Components/FTypedLeaf.hpp +++ b/Src/Components/FTypedLeaf.hpp @@ -37,7 +37,7 @@ public: */ template void push(const FPoint& inParticlePosition, const FParticleType type, Args ... args){ - if(type == FParticleType::FParticleTypeTarget) { + if(type == FParticleType::FParticleType::target) { targets.push(inParticlePosition, args...); // targets.push(inParticlePosition, FParticleType::FParticleTypeTarget, args...); } diff --git a/Src/Files/FFmaTsmLoader.hpp b/Src/Files/FFmaTsmLoader.hpp index 10d10d74..fa36547f 100644 --- a/Src/Files/FFmaTsmLoader.hpp +++ b/Src/Files/FFmaTsmLoader.hpp @@ -117,8 +117,10 @@ public: inParticlePositions->setPosition(x,y,z); *inPhysicalValue = data; - if(isTarget) (*particleType) = FParticleType::FParticleTypeTarget; - else (*particleType) = FParticleType::FParticleTypeSource; + if(isTarget){ + (*particleType) = FParticleType::target;} + else { + (*particleType) = FParticleType::source;} } }; diff --git a/Src/Files/FRandomLoader.hpp b/Src/Files/FRandomLoader.hpp index be6b4bd0..9a5fedd9 100644 --- a/Src/Files/FRandomLoader.hpp +++ b/Src/Files/FRandomLoader.hpp @@ -110,8 +110,8 @@ public: void fillParticle(FPoint*const inParticlePositions, FParticleType*const isTarget){ FRandomLoader::fillParticle(inParticlePositions); - if(FRandomLoader::getRandom() > 0.5 ) (*isTarget) = FParticleType::FParticleTypeTarget; - else (*isTarget) = FParticleType::FParticleTypeSource; + if(FRandomLoader::getRandom() > 0.5 ) (*isTarget) = FParticleType::target; + else (*isTarget) = FParticleType::source; } }; diff --git a/Tests/Utils/testFmmAlgorithmProcTsm.cpp b/Tests/Utils/testFmmAlgorithmProcTsm.cpp index 6599e17d..19e99a57 100644 --- a/Tests/Utils/testFmmAlgorithmProcTsm.cpp +++ b/Tests/Utils/testFmmAlgorithmProcTsm.cpp @@ -395,7 +395,7 @@ int main(int argc, char ** argv){ for(int idx = 0 ; idx < finalParticles.getSize(); ++idx){ realTree.insert(finalParticles[idx].position, - finalParticles[idx].isSource? FParticleType::FParticleTypeSource: FParticleType::FParticleTypeTarget); + finalParticles[idx].isSource? FParticleType::source: FParticleType::target); } delete[] particles; diff --git a/Tests/Utils/testFmmAlgorithmTsm.cpp b/Tests/Utils/testFmmAlgorithmTsm.cpp index 40a95c87..2ad83899 100644 --- a/Tests/Utils/testFmmAlgorithmTsm.cpp +++ b/Tests/Utils/testFmmAlgorithmTsm.cpp @@ -5,31 +5,31 @@ #include #include -#include "../../Src/Utils/FTic.hpp" +#include "Utils/FTic.hpp" -#include "../../Src/Containers/FOctree.hpp" -#include "../../Src/Containers/FVector.hpp" -#include "../../Src/Utils/FParameters.hpp" +#include "Containers/FOctree.hpp" +#include "Containers/FVector.hpp" +#include "Utils/FParameters.hpp" -#include "../../Src/Components/FTypedLeaf.hpp" +#include "Components/FTypedLeaf.hpp" -#include "../../Src/Utils/FPoint.hpp" +#include "Utils/FPoint.hpp" -#include "../../Src/Components/FTestCell.hpp" -#include "../../Src/Components/FTestKernels.hpp" +#include "Components/FTestCell.hpp" +#include "Components/FTestKernels.hpp" -#include "../../Src/Extensions/FExtendCellType.hpp" +#include "Extensions/FExtendCellType.hpp" -#include "../../Src/Core/FFmmAlgorithmTsm.hpp" -#include "../../Src/Core/FFmmAlgorithmThreadTsm.hpp" +#include "Core/FFmmAlgorithmTsm.hpp" +#include "Core/FFmmAlgorithmThreadTsm.hpp" -#include "../../Src/Components/FBasicKernels.hpp" +#include "Components/FBasicKernels.hpp" -#include "../../Src/Files/FRandomLoader.hpp" +#include "Files/FRandomLoader.hpp" -#include "../../Src/Components/FTestParticleContainer.hpp" +#include "Components/FTestParticleContainer.hpp" -#include "../../Src/Utils/FParameterNames.hpp" +#include "Utils/FParameterNames.hpp" /** This program show an example of use of * the fmm basic algo diff --git a/Tests/Utils/testOctreeRearrangeTsm.cpp b/Tests/Utils/testOctreeRearrangeTsm.cpp index d429528b..fe94392a 100644 --- a/Tests/Utils/testOctreeRearrangeTsm.cpp +++ b/Tests/Utils/testOctreeRearrangeTsm.cpp @@ -83,7 +83,7 @@ int main(int argc, char ** argv){ (BoxWidth*FReal(drand48())) + (BoxCenter-(BoxWidth/2)), (BoxWidth*FReal(drand48())) + (BoxCenter-(BoxWidth/2)), (BoxWidth*FReal(drand48())) + (BoxCenter-(BoxWidth/2))); - tree.insert(particleToFill,FParticleType::FParticleTypeSource,idxPart); + tree.insert(particleToFill,FParticleType::source,idxPart); } for(FSize idxPart = 0 ; idxPart < NbPart_Target; ++idxPart){ @@ -91,7 +91,7 @@ int main(int argc, char ** argv){ (BoxWidth*FReal(drand48())) + (BoxCenter-(BoxWidth/2)), (BoxWidth*FReal(drand48())) + (BoxCenter-(BoxWidth/2)), (BoxWidth*FReal(drand48())) + (BoxCenter-(BoxWidth/2))); - tree.insert(particleToFill,FParticleType::FParticleTypeTarget,idxPart); + tree.insert(particleToFill,FParticleType::target,idxPart); } } diff --git a/UTests/utestChebyshevDirectTsm.cpp b/UTests/utestChebyshevDirectTsm.cpp index 262ff87e..a00cd9f7 100644 --- a/UTests/utestChebyshevDirectTsm.cpp +++ b/UTests/utestChebyshevDirectTsm.cpp @@ -54,7 +54,7 @@ class TestChebyshevDirectTsm : public FUTester { FPoint position; loader.fillParticle(&position); // put in tree - tree.insert(position, FParticleType::FParticleTypeTarget, idxPart, physicalValue); + tree.insert(position, FParticleType::target, idxPart, physicalValue); // get copy particlesTargets[idxPart].setPosition(position); *(particlesTargets[idxPart].setPhysicalValue()) = physicalValue; @@ -69,7 +69,7 @@ class TestChebyshevDirectTsm : public FUTester { FPoint position; loader.fillParticle(&position); // put in tree - tree.insert(position, FParticleType::FParticleTypeSource, idxPart, physicalValue); + tree.insert(position, FParticleType::source, idxPart, physicalValue); // get copy particlesSources[idxPart].setPosition(position); *(particlesSources[idxPart].setPhysicalValue()) = physicalValue; diff --git a/UTests/utestRotationDirectTsm.cpp b/UTests/utestRotationDirectTsm.cpp index 0d4c14d5..060376a8 100644 --- a/UTests/utestRotationDirectTsm.cpp +++ b/UTests/utestRotationDirectTsm.cpp @@ -53,7 +53,7 @@ class TestRotationDirectTsm : public FUTester { FPoint position; loader.fillParticle(&position); // put in tree - tree.insert(position, FParticleType::FParticleTypeTarget, idxPart, physicalValue); + tree.insert(position, FParticleType::target, idxPart, physicalValue); // get copy particlesTargets[idxPart].setPosition(position); *(particlesTargets[idxPart].setPhysicalValue()) = physicalValue; @@ -68,7 +68,7 @@ class TestRotationDirectTsm : public FUTester { FPoint position; loader.fillParticle(&position); // put in tree - tree.insert(position, FParticleType::FParticleTypeSource, idxPart, physicalValue); + tree.insert(position, FParticleType::source, idxPart, physicalValue); // get copy particlesSources[idxPart].setPosition(position); *(particlesSources[idxPart].setPhysicalValue()) = physicalValue; -- 2.22.0