utestChebyshevAdaptative.cpp 3.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software.
//
// 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
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
// ===================================================================================

// ==== CMAKE =====
// @FUSE_BLAS
// ================

#include "FUKernelTester.hpp"

BRAMAS Berenger's avatar
BRAMAS Berenger committed
23
#include "Components/FSimpleLeaf.hpp"
24

BRAMAS Berenger's avatar
BRAMAS Berenger committed
25 26 27 28
#include "Kernels/Chebyshev/FChebCell.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "Kernels/Chebyshev/FChebKernel.hpp"
#include "Kernels/Chebyshev/FChebSymKernel.hpp"
29

BRAMAS Berenger's avatar
BRAMAS Berenger committed
30
#include "Kernels/P2P/FP2PParticleContainerIndexed.hpp"
31

BRAMAS Berenger's avatar
BRAMAS Berenger committed
32 33 34 35
#include "Adaptive/FAdaptiveCell.hpp"
#include "Adaptive/FAdaptiveKernelWrapper.hpp"
#include "Adaptive/FAbstractAdaptiveKernel.hpp"
#include "Adaptive/FAdaptChebSymKernel.hpp"
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

/*
  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(){
        const unsigned int ORDER = 6;
        typedef FChebCell<ORDER>                                        CellClass;
        typedef FP2PParticleContainerIndexed<>            ContainerClass;
        typedef FSimpleLeaf<ContainerClass>    LeafClass;
        typedef FInterpMatrixKernelR                               MatrixKernelClass;
        typedef FAdaptiveChebSymKernel<CellClass,ContainerClass,MatrixKernelClass,ORDER> KernelClass;
        typedef FAdaptiveCell< CellClass, ContainerClass >                                        CellWrapperClass;
        typedef FAdaptiveKernelWrapper< KernelClass, CellClass, ContainerClass >   KernelWrapperClass;
        typedef FOctree< CellWrapperClass, ContainerClass , LeafClass >                  OctreeClass;
        // FFmmAlgorithmTask FFmmAlgorithmThread
        typedef FFmmAlgorithm<OctreeClass, CellWrapperClass, ContainerClass, KernelWrapperClass, LeafClass >     FmmClass;

        // run test
        RunTest<CellClass,ContainerClass,KernelWrapperClass,MatrixKernelClass,LeafClass,OctreeClass,FmmClass>(
                          [&](int NbLevels, FReal boxWidth, FPoint centerOfBox, const MatrixKernelClass *const MatrixKernel){
             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)