OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
VandermondeRowBuilder.hpp
1 //
2 // Created by tommaso on 22/03/19.
3 //
4 
5 #ifndef OPENFPM_PDATA_VANDERMONDEROW_HPP
6 #define OPENFPM_PDATA_VANDERMONDEROW_HPP
7 
8 #include "MonomialBasis.hpp"
9 
10 template <unsigned int dim, typename T>
12 {
13 private:
14  const MonomialBasis<dim> monomialBasis;
15 
16 public:
17  VandermondeRowBuilder(const MonomialBasis<dim> &monomialBasis) : monomialBasis(monomialBasis) {}
18 
19  template <typename MatrixType>
20  void buildRow(MatrixType &M, unsigned int row, Point<dim, T> x, T eps);
21 };
22 
23 template<unsigned int dim, typename T>
24 template <typename MatrixType>
25 void VandermondeRowBuilder<dim, T>::buildRow(MatrixType &M, unsigned int row, Point<dim, T> x, T eps)
26 {
27  unsigned int col = 0;
28  for (auto& basisElement : monomialBasis.getElements())
29  {
30  Monomial<dim> m = monomialBasis.getElement(col);
31  M(row, col) = m.evaluate(x);
32  M(row, col) /= openfpm::math::intpowlog(eps, m.order());
33  ++col;
34  }
35 }
36 
37 #endif //OPENFPM_PDATA_VANDERMONDEROW_HPP
This class implement the point shape in an N-dimensional space.
Definition: Point.hpp:27