FInterpP2PKernels.hpp 2.82 KB
Newer Older
1 2 3 4 5
#ifndef FINTERPP2PKERNELS_HPP
#define FINTERPP2PKERNELS_HPP


#include "../P2P/FP2P.hpp"
6
#include "../P2P/FP2PR.hpp"
7

8 9 10 11
///////////////////////////////////////////////////////
// P2P Wrappers
///////////////////////////////////////////////////////

12 13
template <int NCMP, int NVALS> 
struct DirectInteractionComputer
14
{
15
  template <typename ContainerClass, typename MatrixKernelClass>
16
  static void P2P( ContainerClass* const FRestrict TargetParticles,
17 18
                   ContainerClass* const NeighborSourceParticles[27],
                   const MatrixKernelClass *const MatrixKernel){
19
      FP2P::FullMutualKIJ(TargetParticles,NeighborSourceParticles,14,MatrixKernel);
20 21
  }

22
  template <typename ContainerClass, typename MatrixKernelClass>
23 24
  static void P2PRemote( ContainerClass* const FRestrict inTargets,
                         ContainerClass* const inNeighbors[27],
25 26
                         const int inSize,
                         const MatrixKernelClass *const MatrixKernel){
27
      FP2P::FullRemoteKIJ(inTargets,inNeighbors,inSize,MatrixKernel);
28 29 30
  }
};

31 32

/*! Specialization for scalar kernels */
33
template <int NVALS>
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
struct DirectInteractionComputer<1,NVALS>
{
  template <typename ContainerClass, typename MatrixKernelClass>
  static void P2P( ContainerClass* const FRestrict TargetParticles,
                   ContainerClass* const NeighborSourceParticles[27],
                   const MatrixKernelClass *const MatrixKernel){
      FP2P::FullMutualMultiRhs(TargetParticles,NeighborSourceParticles,14,MatrixKernel);
  }

  template <typename ContainerClass, typename MatrixKernelClass>
  static void P2PRemote( ContainerClass* const FRestrict inTargets,
                         ContainerClass* const inNeighbors[27],
                         const int inSize,
                         const MatrixKernelClass *const MatrixKernel){
      FP2P::FullRemoteMultiRhs(inTargets,inNeighbors,inSize,MatrixKernel);
  }
};

/*! Specialization for scalar kernels and single rhs*/
template <>
struct DirectInteractionComputer<1,1>
55 56 57 58 59
{
  template <typename ContainerClass, typename MatrixKernelClass>
  static void P2P( ContainerClass* const FRestrict TargetParticles,
                   ContainerClass* const NeighborSourceParticles[27],
                   const MatrixKernelClass *const MatrixKernel){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
60
      FP2PT<FReal>::FullMutual<ContainerClass,MatrixKernelClass> (TargetParticles,NeighborSourceParticles,14,MatrixKernel);
61 62 63 64 65 66 67
  }

  template <typename ContainerClass, typename MatrixKernelClass>
  static void P2PRemote( ContainerClass* const FRestrict inTargets,
                         ContainerClass* const inNeighbors[27],
                         const int inSize,
                         const MatrixKernelClass *const MatrixKernel){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
68
      FP2PT<FReal>::FullRemote<ContainerClass,MatrixKernelClass>(inTargets,inNeighbors,inSize,MatrixKernel);
69 70 71
  }
};

72
#endif // FINTERPP2PKERNELS_HPP