utestChebyshevAdaptative.cpp 3.69 KB
Newer Older
1
// ===================================================================================
2 3 4 5
// Copyright ScalFmm 2016 INRIA, Olivier Coulaud, Bérenger Bramas,
// Matthias Messner olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the
// FMM.
6
//
7
// This software is governed by the CeCILL-C and LGPL licenses and
8
// abiding by the rules of distribution of free software.
9 10 11
// An extension to the license is given to allow static linking of scalfmm
// inside a proprietary application (no matter its license).
// See the main license file for more details.
12 13 14 15
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 17 18
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
19 20 21 22
// ===================================================================================

// ==== CMAKE =====
// @FUSE_BLAS
23
// @SCALFMM_PRIVATE
24 25 26 27
// ================

#include "FUKernelTester.hpp"

BRAMAS Berenger's avatar
BRAMAS Berenger committed
28
#include "Components/FSimpleLeaf.hpp"
29

BRAMAS Berenger's avatar
BRAMAS Berenger committed
30 31 32 33
#include "Kernels/Chebyshev/FChebCell.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "Kernels/Chebyshev/FChebKernel.hpp"
#include "Kernels/Chebyshev/FChebSymKernel.hpp"
34

BRAMAS Berenger's avatar
BRAMAS Berenger committed
35
#include "Kernels/P2P/FP2PParticleContainerIndexed.hpp"
36

BRAMAS Berenger's avatar
BRAMAS Berenger committed
37 38 39 40
#include "Adaptive/FAdaptiveCell.hpp"
#include "Adaptive/FAdaptiveKernelWrapper.hpp"
#include "Adaptive/FAbstractAdaptiveKernel.hpp"
#include "Adaptive/FAdaptChebSymKernel.hpp"
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

/*
  In this test we compare the Chebyschev fmm results and the direct results.
 */

/** the test class
 *
 */
class TestChebyshevDirect : public FUKernelTester<TestChebyshevDirect> {

    ///////////////////////////////////////////////////////////
    // Set the tests!
    ///////////////////////////////////////////////////////////


    /** TestChebKernel */
    void TestChebKernel(){
58
        typedef double FReal;
59
        const unsigned int ORDER = 6;
60 61 62 63 64
        typedef FChebCell<FReal,ORDER>                                        CellClass;
        typedef FP2PParticleContainerIndexed<FReal>            ContainerClass;
        typedef FSimpleLeaf<FReal, ContainerClass>    LeafClass;
        typedef FInterpMatrixKernelR<FReal>                               MatrixKernelClass;
        typedef FAdaptiveChebSymKernel<FReal,CellClass,ContainerClass,MatrixKernelClass,ORDER> KernelClass;
65 66
        typedef FAdaptiveCell< CellClass, ContainerClass >                                        CellWrapperClass;
        typedef FAdaptiveKernelWrapper< KernelClass, CellClass, ContainerClass >   KernelWrapperClass;
67
        typedef FOctree< FReal, CellWrapperClass, ContainerClass , LeafClass >                  OctreeClass;
68 69 70 71
        // FFmmAlgorithmTask FFmmAlgorithmThread
        typedef FFmmAlgorithm<OctreeClass, CellWrapperClass, ContainerClass, KernelWrapperClass, LeafClass >     FmmClass;

        // run test
72
        RunTest<FReal,CellClass,ContainerClass,KernelWrapperClass,MatrixKernelClass,LeafClass,OctreeClass,FmmClass>(
73
                          [&](int NbLevels, FReal boxWidth, FPoint<FReal> centerOfBox, const MatrixKernelClass *const MatrixKernel){
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
             return std::unique_ptr<KernelWrapperClass>(new KernelWrapperClass(NbLevels, boxWidth, centerOfBox, MatrixKernel, 4, 4));
        });
    }



    ///////////////////////////////////////////////////////////
    // Set the tests!
    ///////////////////////////////////////////////////////////

    /** set test */
    void SetTests(){
        AddTest(&TestChebyshevDirect::TestChebKernel,"Test Chebyshev Kernel with one big SVD");
    }
};


// You must do this
TestClass(TestChebyshevDirect)