diff --git a/Src/Kernels/Chebyshev/FAbstractChebKernel.hpp b/Src/Kernels/Chebyshev/FAbstractChebKernel.hpp index ecf9ba5d87aa7d1641c43ead36e057ca8ecfc3bf..40352b82665dd7ff98e8fb874349b393bff25545 100755 --- a/Src/Kernels/Chebyshev/FAbstractChebKernel.hpp +++ b/Src/Kernels/Chebyshev/FAbstractChebKernel.hpp @@ -45,95 +45,95 @@ class FAbstractChebKernel : public FAbstractKernels< CellClass, ContainerClass> { protected: enum {nnodes = TensorTraits::nnodes}; - typedef FChebInterpolator InterpolatorClass; - - /// Needed for P2M, M2M, L2L and L2P operators - const FSmartPointer Interpolator; - /// Needed for P2P operator - const FSmartPointer MatrixKernel; - /// Height of the entire oct-tree - const unsigned int TreeHeight; - /// Corner of oct-tree box - const FPoint BoxCorner; - /// Width of oct-tree box - const FReal BoxWidth; - /// Width of a leaf cell box - const FReal BoxWidthLeaf; - - /** - * Compute center of leaf cell from its tree coordinate. - * @param[in] Coordinate tree coordinate - * @return center of leaf cell - */ - const FPoint getLeafCellCenter(const FTreeCoordinate& Coordinate) const - { - return FPoint(BoxCorner.getX() + (FReal(Coordinate.getX()) + FReal(.5)) * BoxWidthLeaf, - BoxCorner.getY() + (FReal(Coordinate.getY()) + FReal(.5)) * BoxWidthLeaf, - BoxCorner.getZ() + (FReal(Coordinate.getZ()) + FReal(.5)) * BoxWidthLeaf); - } + typedef FChebInterpolator InterpolatorClass; + + /// Needed for P2M, M2M, L2L and L2P operators + const FSmartPointer Interpolator; + /// Needed for P2P operator + const FSmartPointer MatrixKernel; + /// Height of the entire oct-tree + const unsigned int TreeHeight; + /// Corner of oct-tree box + const FPoint BoxCorner; + /// Width of oct-tree box + const FReal BoxWidth; + /// Width of a leaf cell box + const FReal BoxWidthLeaf; + + /** + * Compute center of leaf cell from its tree coordinate. + * @param[in] Coordinate tree coordinate + * @return center of leaf cell + */ + const FPoint getLeafCellCenter(const FTreeCoordinate& Coordinate) const + { + return FPoint(BoxCorner.getX() + (FReal(Coordinate.getX()) + FReal(.5)) * BoxWidthLeaf, + BoxCorner.getY() + (FReal(Coordinate.getY()) + FReal(.5)) * BoxWidthLeaf, + BoxCorner.getZ() + (FReal(Coordinate.getZ()) + FReal(.5)) * BoxWidthLeaf); + } public: - /** - * The constructor initializes all constant attributes and it reads the - * precomputed and compressed M2L operators from a binary file (an - * runtime_error is thrown if the required file is not valid). - */ - FAbstractChebKernel(const int inTreeHeight, - const FPoint& inBoxCenter, - const FReal inBoxWidth) - : Interpolator(new InterpolatorClass()), - MatrixKernel(new MatrixKernelClass()), - TreeHeight(inTreeHeight), - BoxCorner(inBoxCenter - inBoxWidth / FReal(2.)), - BoxWidth(inBoxWidth), - BoxWidthLeaf(BoxWidth / FReal(FMath::pow(2, inTreeHeight - 1))) - { - /* empty */ - } + /** + * The constructor initializes all constant attributes and it reads the + * precomputed and compressed M2L operators from a binary file (an + * runtime_error is thrown if the required file is not valid). + */ + FAbstractChebKernel(const int inTreeHeight, + const FReal inBoxWidth, + const FPoint& inBoxCenter) + : Interpolator(new InterpolatorClass()), + MatrixKernel(new MatrixKernelClass()), + TreeHeight(inTreeHeight), + BoxCorner(inBoxCenter - inBoxWidth / FReal(2.)), + BoxWidth(inBoxWidth), + BoxWidthLeaf(BoxWidth / FReal(FMath::pow(2, inTreeHeight - 1))) + { + /* empty */ + } - virtual ~FAbstractChebKernel(){ - // should not be used - } + virtual ~FAbstractChebKernel(){ + // should not be used + } - const InterpolatorClass *const getPtrToInterpolator() const - { return Interpolator.getPtr(); } + const InterpolatorClass *const getPtrToInterpolator() const + { return Interpolator.getPtr(); } - virtual void P2M(CellClass* const LeafCell, - const ContainerClass* const SourceParticles) = 0; + virtual void P2M(CellClass* const LeafCell, + const ContainerClass* const SourceParticles) = 0; - virtual void M2M(CellClass* const FRestrict ParentCell, - const CellClass*const FRestrict *const FRestrict ChildCells, - const int TreeLevel) = 0; + virtual void M2M(CellClass* const FRestrict ParentCell, + const CellClass*const FRestrict *const FRestrict ChildCells, + const int TreeLevel) = 0; - virtual void M2L(CellClass* const FRestrict TargetCell, - const CellClass* SourceCells[343], - const int NumSourceCells, - const int TreeLevel) = 0; + virtual void M2L(CellClass* const FRestrict TargetCell, + const CellClass* SourceCells[343], + const int NumSourceCells, + const int TreeLevel) = 0; - virtual void L2L(const CellClass* const FRestrict ParentCell, - CellClass* FRestrict *const FRestrict ChildCells, - const int TreeLevel) = 0; + virtual void L2L(const CellClass* const FRestrict ParentCell, + CellClass* FRestrict *const FRestrict ChildCells, + const int TreeLevel) = 0; - virtual void L2P(const CellClass* const LeafCell, - ContainerClass* const TargetParticles) = 0; + virtual void L2P(const CellClass* const LeafCell, + ContainerClass* const TargetParticles) = 0; - virtual void P2P(const FTreeCoordinate& /* LeafCellCoordinate */, // needed for periodic boundary conditions - ContainerClass* const FRestrict TargetParticles, - const ContainerClass* const FRestrict /*SourceParticles*/, - ContainerClass* const NeighborSourceParticles[27], - const int /* size */) = 0; + virtual void P2P(const FTreeCoordinate& /* LeafCellCoordinate */, // needed for periodic boundary conditions + ContainerClass* const FRestrict TargetParticles, + const ContainerClass* const FRestrict /*SourceParticles*/, + ContainerClass* const NeighborSourceParticles[27], + const int /* size */) = 0; - virtual void P2PRemote(const FTreeCoordinate& /*inPosition*/, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/, - ContainerClass* const inNeighbors[27], const int /*inSize*/) = 0; + virtual void P2PRemote(const FTreeCoordinate& /*inPosition*/, + ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/, + ContainerClass* const inNeighbors[27], const int /*inSize*/) = 0; }; diff --git a/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp b/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp index 58dc8d5459c47ab8a8af8bae08609eefbec83aaa..87873f0ae69caadcbeece56f406c373ad2a34119 100755 --- a/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp @@ -105,9 +105,9 @@ public: * runtime_error is thrown if the required file is not valid). */ FChebFlopsSymKernel(const int _inTreeHeight, - const FPoint& inBoxCenter, - const FReal inBoxWidth, - const FReal Epsilon) + const FReal inBoxWidth, + const FPoint& inBoxCenter, + const FReal Epsilon) : MatrixKernel(new MatrixKernelClass()), SymHandler(new SymmetryHandler(MatrixKernel.getPtr(), Epsilon)), inTreeHeight(_inTreeHeight), flopsP2M(0), flopsM2M(0), flopsM2L(0), flopsL2L(0), flopsL2P(0), flopsP2P(0), diff --git a/Src/Kernels/Chebyshev/FChebKernel.hpp b/Src/Kernels/Chebyshev/FChebKernel.hpp index 2c169262dccee226664a81bf6f2d7846239669d8..dc99a1d98754f27ab17430b17389c530e2cc5e48 100755 --- a/Src/Kernels/Chebyshev/FChebKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebKernel.hpp @@ -61,13 +61,13 @@ public: * runtime_error is thrown if the required file is not valid). */ FChebKernel(const int inTreeHeight, - const FPoint& inBoxCenter, - const FReal inBoxWidth, - const FReal Epsilon) + const FReal inBoxWidth, + const FPoint& inBoxCenter, + const FReal Epsilon) : FAbstractChebKernel< CellClass, ContainerClass, MatrixKernelClass, ORDER, NVALS>(inTreeHeight, - inBoxCenter, - inBoxWidth), - M2LHandler(new M2LHandlerClass(Epsilon)) + inBoxWidth, + inBoxCenter), + M2LHandler(new M2LHandlerClass(Epsilon)) { // read precomputed compressed m2l operators from binary file //M2LHandler->ReadFromBinaryFileAndSet(); diff --git a/Src/Kernels/Chebyshev/FChebSymKernel.hpp b/Src/Kernels/Chebyshev/FChebSymKernel.hpp index 9143c569d3df31db88f6bedca3e98c498b4db249..3fc6bc3c3bd8373c0b6c597a34762b5568801cb1 100755 --- a/Src/Kernels/Chebyshev/FChebSymKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebSymKernel.hpp @@ -107,10 +107,10 @@ public: * runtime_error is thrown if the required file is not valid). */ FChebSymKernel(const int inTreeHeight, - const FPoint& inBoxCenter, - const FReal inBoxWidth, - const FReal Epsilon) - : AbstractBaseClass(inTreeHeight, inBoxCenter, inBoxWidth), + const FReal inBoxWidth, + const FPoint& inBoxCenter, + const FReal Epsilon) + : AbstractBaseClass(inTreeHeight, inBoxWidth, inBoxCenter), SymHandler(new SymmetryHandlerClass(AbstractBaseClass::MatrixKernel.getPtr(), Epsilon, inBoxWidth, inTreeHeight)), Loc(NULL), Mul(NULL), countExp(NULL) { diff --git a/Src/Kernels/Uniform/FAbstractUnifKernel.hpp b/Src/Kernels/Uniform/FAbstractUnifKernel.hpp index 18bcf6242ff89cf7bc5d9a9614f4c184d7843efb..6edde821496e82e2b2566cd47cbc0a97e5e0da54 100644 --- a/Src/Kernels/Uniform/FAbstractUnifKernel.hpp +++ b/Src/Kernels/Uniform/FAbstractUnifKernel.hpp @@ -79,8 +79,8 @@ public: * runtime_error is thrown if the required file is not valid). */ FAbstractUnifKernel(const int inTreeHeight, - const FPoint& inBoxCenter, - const FReal inBoxWidth) + const FReal inBoxWidth, + const FPoint& inBoxCenter) : Interpolator(new InterpolatorClass()), MatrixKernel(new MatrixKernelClass()), TreeHeight(inTreeHeight), diff --git a/Src/Kernels/Uniform/FUnifKernel.hpp b/Src/Kernels/Uniform/FUnifKernel.hpp index 4bd37ed90025df313ee5f8bdeb02e42974fc27bf..a017baaf4e789f89eba0d0da7234e400e624a1c4 100644 --- a/Src/Kernels/Uniform/FUnifKernel.hpp +++ b/Src/Kernels/Uniform/FUnifKernel.hpp @@ -61,11 +61,11 @@ public: * runtime_error is thrown if the required file is not valid). */ FUnifKernel(const int inTreeHeight, - const FPoint& inBoxCenter, - const FReal inBoxWidth) + const FReal inBoxWidth, + const FPoint& inBoxCenter) : FAbstractUnifKernel< CellClass, ContainerClass, MatrixKernelClass, ORDER, NVALS>(inTreeHeight, - inBoxCenter, - inBoxWidth), + inBoxWidth, + inBoxCenter), M2LHandler(new M2LHandlerClass()) { // read precomputed compressed m2l operators from binary file diff --git a/Tests/Kernels/testChebAlgorithm.cpp b/Tests/Kernels/testChebAlgorithm.cpp index e9e5a26dce0e4e4f568c1d98a484557c5dfcbd72..31238e191fdc598b275d254c3a339ab6e07b19c2 100755 --- a/Tests/Kernels/testChebAlgorithm.cpp +++ b/Tests/Kernels/testChebAlgorithm.cpp @@ -158,7 +158,7 @@ int main(int argc, char* argv[]) { // ----------------------------------------------------- std::cout << "\nChebyshev FMM (ORDER="<< ORDER << ",EPS="<< epsilon <<") ... " << std::endl; time.tic(); - KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth(), epsilon); + KernelClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(), epsilon); FmmClass algorithm(&tree, &kernels); algorithm.execute(); time.tac(); diff --git a/Tests/Kernels/testChebAlgorithmProc.cpp b/Tests/Kernels/testChebAlgorithmProc.cpp index fa201414cd2c47215ea884737d893f03b4d1352b..bbb1b7a1dbe777542c3c39fab0e5c69428825632 100644 --- a/Tests/Kernels/testChebAlgorithmProc.cpp +++ b/Tests/Kernels/testChebAlgorithmProc.cpp @@ -134,7 +134,7 @@ int main(int argc, char* argv[]) { // ----------------------------------------------------- std::cout << "\nChebyshev FMM (ORDER="<< ORDER << ",EPS="<< epsilon <<") ... " << std::endl; time.tic(); - KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth(), epsilon); + KernelClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(), epsilon); FmmClass algorithm(app.global(),&tree, &kernels); algorithm.execute(); time.tac(); diff --git a/Tests/Kernels/testCompareKernels.cpp b/Tests/Kernels/testCompareKernels.cpp index 7e2dd3e19ce725ba1502b0163b8a5e014a75e512..fff643495631fb77aae2348eaf33157fdb2267f5 100755 --- a/Tests/Kernels/testCompareKernels.cpp +++ b/Tests/Kernels/testCompareKernels.cpp @@ -153,7 +153,7 @@ int main(int argc, char* argv[]) { // ----------------------------------------------------- std::cout << "\nChebyshev FMM ... " << std::endl; time.tic(); - KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth(), epsilon); + KernelClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(), epsilon); FmmClass algorithm(&tree, &kernels); algorithm.execute(); time.tac(); diff --git a/Tests/Kernels/testFlopsChebAlgorithm.cpp b/Tests/Kernels/testFlopsChebAlgorithm.cpp index 3ff510e477b1c9e0ecea7d546f7fd149f06cd103..99738128a19e038c4c461b3998ac6c6ea60b1cc2 100755 --- a/Tests/Kernels/testFlopsChebAlgorithm.cpp +++ b/Tests/Kernels/testFlopsChebAlgorithm.cpp @@ -97,7 +97,7 @@ int main(int argc, char* argv[]) // ----------------------------------------------------- std::cout << "\nChebyshev FMM ... " << std::endl; - KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth(), epsilon); + KernelClass kernels(TreeHeight, loader.getBoxWidth(),loader.getCenterOfBox(), epsilon); FmmClass algorithm(&tree,&kernels); time.tic(); algorithm.execute(); diff --git a/Tests/Kernels/testNewCompareKernels.cpp b/Tests/Kernels/testNewCompareKernels.cpp index 1a0ef699d3f15f88fcb37b43214ef2a7b5e57f3f..fb9231d9278b5fd6d963dcda84f20cf604cfa21e 100644 --- a/Tests/Kernels/testNewCompareKernels.cpp +++ b/Tests/Kernels/testNewCompareKernels.cpp @@ -152,7 +152,7 @@ int main(int argc, char* argv[]) typedef FOctree OctreeClass; typedef FChebSymKernel KernelClass; - // typedef FChebKernel KernelClass; + // typedef FChebKernDel KernelClass; typedef FFmmAlgorithm FmmClass; @@ -178,7 +178,7 @@ int main(int argc, char* argv[]) { // ----------------------------------------------------- std::cout << "\nChebyshev FMM ... " << std::endl; time.tic(); - KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth(), epsilon); + KernelClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(), epsilon); FmmClass algorithm(&tree, &kernels); algorithm.execute(); time.tac(); @@ -333,7 +333,7 @@ int main(int argc, char* argv[]) { // ----------------------------------------------------- std::cout << "\nLagrange FMM ... " << std::endl; time.tic(); - KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth()); + KernelClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox()); FmmClass algorithm(&tree, &kernels); algorithm.execute(); time.tac(); diff --git a/Tests/Kernels/testSphericalEwalAlgorithm.cpp b/Tests/Kernels/testSphericalEwalAlgorithm.cpp index e7f38850860f4c1e38c94c6e7e258f31af1beee0..546c0882f61ec78593985e837d2864dd75365728 100755 --- a/Tests/Kernels/testSphericalEwalAlgorithm.cpp +++ b/Tests/Kernels/testSphericalEwalAlgorithm.cpp @@ -158,7 +158,7 @@ int main(int argc, char ** argv){ #ifndef ScalFMM_USE_BLAS KernelClass kernels( DevP, NbLevels, loader.getBoxWidth(), loader.getCenterOfBox()); #else - KernelClass kernels( NbLevels, loader.getCenterOfBox(), loader.getBoxWidth(),epsilon); + KernelClass kernels( NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), epsilon); #endif FmmClassNoPer algo(&tree,&kernels); algo.execute(); @@ -170,7 +170,7 @@ int main(int argc, char ** argv){ KernelClass kernels( DevP, algo.extendedTreeHeight(), algo.extendedBoxWidth(),algo.extendedBoxCenter()); // KernelClass kernels( DevP, algo.extendedTreeHeight(), algo.extendedBoxWidth(),algo.extendedBoxCenter()); #else - KernelClass kernels(algo.extendedTreeHeight(), algo.extendedBoxCenter(), algo.extendedBoxWidth(),epsilon); + KernelClass kernels(algo.extendedTreeHeight(), algo.extendedBoxWidth(),algo.extendedBoxCenter(), epsilon); #endif algo.setKernel(&kernels); algo.execute(); diff --git a/Tests/Kernels/testUnifAlgorithm.cpp b/Tests/Kernels/testUnifAlgorithm.cpp index 983e7b24fd5c5c04eb58932b59c68261eac44b65..9336e0f2e4b54461b3219c1171d829200a11e25d 100644 --- a/Tests/Kernels/testUnifAlgorithm.cpp +++ b/Tests/Kernels/testUnifAlgorithm.cpp @@ -156,7 +156,7 @@ int main(int argc, char* argv[]) { // ----------------------------------------------------- std::cout << "\nLagrange/Uniform grid FMM (ORDER="<< ORDER << ") ... " << std::endl; time.tic(); - KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth()); + KernelClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox()); FmmClass algorithm(&tree, &kernels); algorithm.execute(); time.tac(); diff --git a/Tests/Kernels/testUnifAlgorithmProc.cpp b/Tests/Kernels/testUnifAlgorithmProc.cpp index 1bfd95d62add9f687a86360e19d9546cb748d770..30cc89054d4224d092b7f687f91c84cd8c03457e 100644 --- a/Tests/Kernels/testUnifAlgorithmProc.cpp +++ b/Tests/Kernels/testUnifAlgorithmProc.cpp @@ -133,7 +133,7 @@ int main(int argc, char* argv[]) { // ----------------------------------------------------- std::cout << "\nChebyshev FMM (ORDER="<< ORDER << ",EPS="<< epsilon <<") ... " << std::endl; time.tic(); - KernelClass kernels(TreeHeight, loader.getCenterOfBox(), loader.getBoxWidth()); + KernelClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox()); FmmClass algorithm(app.global(),&tree, &kernels); algorithm.execute(); time.tac(); diff --git a/Tests/Utils/testFFTW.cpp b/Tests/Utils/testFFTW.cpp index 60ec8a9033ae3a148c1f11780d064fd22023cb36..bd275bfcaca9b34bd269e8cf005493d242fda7ce 100644 --- a/Tests/Utils/testFFTW.cpp +++ b/Tests/Utils/testFFTW.cpp @@ -22,10 +22,10 @@ #include // include for libfftw3 -//#include +#include // include for mkl_fftw3 -#include +//#include #include "../../Src/Utils/FGlobal.hpp" #include "../../Src/Utils/FComplexe.hpp" diff --git a/UTests/utestChebyshevDirect.cpp b/UTests/utestChebyshevDirect.cpp index 0d87c0d5729b06f8fd0d793c0e5d1c822de35ad0..a3f87f03528825a26fa4cc166ea261122921c7a7 100755 --- a/UTests/utestChebyshevDirect.cpp +++ b/UTests/utestChebyshevDirect.cpp @@ -105,7 +105,7 @@ class TestChebyshevDirect : public FUTester { // Run FMM Print("Fmm..."); - KernelClass kernels(NbLevels, loader.getCenterOfBox(), loader.getBoxWidth(), epsilon); + KernelClass kernels(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), epsilon); FmmClass algo(&tree,&kernels); algo.execute(); diff --git a/UTests/utestChebyshevDirectPeriodic.cpp b/UTests/utestChebyshevDirectPeriodic.cpp index 944db45165a5826f4cbcd291f271b4f59db432b1..8b9eb627cbfb19338b406fd9b3f42befdd6296b2 100755 --- a/UTests/utestChebyshevDirectPeriodic.cpp +++ b/UTests/utestChebyshevDirectPeriodic.cpp @@ -96,8 +96,8 @@ class TestChebyshevDirect : public FUTester { // Run FMM Print("Fmm..."); FmmClass algo(&tree,PeriodicDeep ); - KernelClass kernels(algo.extendedTreeHeight(), algo.extendedBoxCenter(), - algo.extendedBoxWidth(), epsilon); + KernelClass kernels(algo.extendedTreeHeight(), algo.extendedBoxWidth(), + algo.extendedBoxCenter(), epsilon); algo.setKernel(&kernels); algo.execute(); diff --git a/UTests/utestChebyshevMultiRhs.cpp b/UTests/utestChebyshevMultiRhs.cpp index b2634d28db2c507ac52b03d71740b01ba4422fab..7baa2e8e044a5ae8d09840c0622592d58d718d0c 100644 --- a/UTests/utestChebyshevMultiRhs.cpp +++ b/UTests/utestChebyshevMultiRhs.cpp @@ -105,7 +105,7 @@ class TestChebyshevDirect : public FUTester { // Run FMM Print("Fmm..."); - KernelClass kernels(NbLevels, loader.getCenterOfBox(), loader.getBoxWidth(), epsilon); + KernelClass kernels(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), epsilon); FmmClass algo(&tree,&kernels); algo.execute();