M2.h (622B)
1 // File : M2.h 2 // Date : Thu Nov 24 16:14:51 2016 3 // Author : Fabian Wermelinger 4 // Description: M2 interpolation kernel (Monaghan 19885) -- triangular function 5 // Copyright 2016 ETH Zurich. All Rights Reserved. 6 #ifndef M2_H_LQ69GRM8 7 #define M2_H_LQ69GRM8 8 9 #include <cmath> 10 #include "common.h" 11 12 class M2 13 { 14 public: 15 static constexpr int start = 0; 16 static constexpr int end = 2; 17 18 inline Real operator()(const Real x) const 19 { 20 const Real IxI = std::abs(x); 21 if (IxI <= 1.0) 22 return 1.0 - IxI; 23 else 24 return 0.0; 25 } 26 }; 27 28 #endif /* M2_H_LQ69GRM8 */