FAbstractKernels.hpp 3.85 KB
Newer Older
1
// ===================================================================================
2 3 4 5 6 7 8 9
// Logiciel initial: ScalFmm Version 0.5
// Co-auteurs : Olivier Coulaud, Bérenger Bramas.
// Propriétaires : INRIA.
// Copyright © 2011-2012, diffusé sous les termes et conditions d’une licence propriétaire.
// Initial software: ScalFmm Version 0.5
// Co-authors: Olivier Coulaud, Bérenger Bramas.
// Owners: INRIA.
// Copyright © 2011-2012, spread under the terms and conditions of a proprietary license.
10
// ===================================================================================
11 12
#ifndef FABSTRACTKERNELS_HPP
#define FABSTRACTKERNELS_HPP
13

14 15 16 17 18 19 20 21 22 23 24

#include "../Utils/FGlobal.hpp"

/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FAbstractKernels
* @brief
* Please read the license
*
* If you want to create you own kernels you have to inherit from this class.
*/
berenger-bramas's avatar
berenger-bramas committed
25
template< class ParticleClass, class CellClass, class ContainerClass >
26 27 28 29 30 31 32 33 34 35 36 37
class FAbstractKernels{
public:
    /** Default destructor */
    virtual ~FAbstractKernels(){
    }

    /**
        * P2M
        * particles to multipole
        * @param pole the multipole to fill using the particles
        * @param particles the particles from the same spacial boxe
        */
berenger-bramas's avatar
berenger-bramas committed
38
    virtual void P2M(CellClass* const pole, const ContainerClass* const particles) = 0;
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58

    /**
        * M2M
        * Multipole to multipole
        * @param pole the father (the boxe that contains other ones)
        * @param child the boxe to take values from
        * @param the current computation level
        * the child array has a size of 8 elements (address if exists or 0 otherwise).
        * You must test if a pointer is 0 to know if an element exists inside this array
        */
    virtual void M2M(CellClass* const FRestrict pole, const CellClass*const FRestrict *const FRestrict child, const int inLevel) = 0;

    /**
        * M2L
        * Multipole to local
        * @param local the element to fill using distant neighbors
        * @param distantNeighbors is an array containing fathers's direct neighbors's child - direct neigbors
        * @param size the number of neighbors
        * @param inLevel the current level of the computation
        */
59
    virtual void M2L(CellClass* const FRestrict local, const CellClass* distantNeighbors[343],
60
                     const int size, const int inLevel) = 0;
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78

    /**
        * L2L
        * Local to local
        * @param the father to take value from
        * @param the child to downward values (child may have already been impacted by M2L)
        * @param level the current level of computation
        * the child array has a size of 8 elements (address if exists or 0 otherwise).
        * You must test if a pointer is 0 to know if an element exists inside this array
        */
    virtual void L2L(const CellClass* const FRestrict local, CellClass* FRestrict * const FRestrict child, const int inLevel) = 0;

    /**
        * L2P
        * Local to particles
        * @param local the leaf element (smaller boxe local element)
        * @param particles the list of particles inside this boxe
        */
berenger-bramas's avatar
berenger-bramas committed
79
    virtual void L2P(const CellClass* const local, ContainerClass* const particles) = 0;
80 81 82 83

    /**
        * P2P
        * Particles to particles
84
        * @param inLeafPosition tree coordinate of the leaf
85
        * @param targets current boxe targets particles
86
        * @param sources current boxe sources particles (can be == to targets)
87
        * @param directNeighborsParticles the particles from direct neighbors (this is an array of list)
88
        * @param size the number of direct neighbors
berenger-bramas's avatar
berenger-bramas committed
89
        */
berenger-bramas's avatar
berenger-bramas committed
90
    virtual void P2P(const FTreeCoordinate& inLeafPosition,
berenger-bramas's avatar
berenger-bramas committed
91
             ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
berenger-bramas's avatar
berenger-bramas committed
92
             ContainerClass* const directNeighborsParticles[27], const int size) = 0;
93

94 95 96 97 98
};


#endif //FABSTRACTKERNELS_HPP

99