5#ifndef OPENFPM_PDATA_MONOMIALBASISELEMENT_H
6#define OPENFPM_PDATA_MONOMIALBASISELEMENT_H
11#include "Space/Shape/Point.hpp"
13template<
unsigned int dim>
20 unsigned int scalar = 1;
29 explicit Monomial(
const unsigned int other[dim]);
37 unsigned int order()
const;
39 unsigned int getExponent(
unsigned int i)
const;
41 void setExponent(
unsigned int i,
unsigned int value);
47 T evaluate(
const T x[dim])
const;
51 template<
typename charT,
typename traits>
52 friend std::basic_ostream<charT, traits> &
53 operator<<(std::basic_ostream<charT, traits> &lhs,
Monomial<dim> const &rhs)
55 return lhs << rhs.scalar <<
" : " << rhs.exponents.
toString();
58 __host__ __device__
unsigned int getScalar()
const {
return scalar; }
65template<
unsigned int dim>
72template<
unsigned int dim>
74 : exponents(other), scalar(scalar)
79template<
unsigned int dim>
83 for (
size_t i = 0; i < other.
nvals; ++i)
90template<
unsigned int dim>
94template<
unsigned int dim>
96 : exponents(other.exponents),
98 scalar(other.scalar) {}
100template<
unsigned int dim>
103 exponents = other.exponents;
105 scalar = other.scalar;
109template<
unsigned int dim>
112 unsigned int partialSum = 0;
113 for (
unsigned int i = 0; i < dim; ++i)
115 partialSum += exponents.value(i);
120template<
unsigned int dim>
126template<
unsigned int dim>
129 return exponents.value(i);
132template<
unsigned int dim>
135 exponents.get(i) = value;
139template<
unsigned int dim>
143 return (exponents == other.exponents) && (scalar == other.scalar);
146template<
unsigned int dim>
151 for (
unsigned int i = 0; i < dim; ++i)
153 res *= openfpm::math::intpowlog(x.value(i), getExponent(i));
158template<
unsigned int dim>
161 unsigned int s = scalar;
163 for (
unsigned int i = 0; i < dim; ++i)
165 unsigned int origExp = e.value(i);
166 int targetExp =
static_cast<int>(origExp) -
static_cast<int>(differentialOrder.
value(i));
167 for (
int k = origExp; k > targetExp && k >= 0; --k)
171 e.get(i) =
static_cast<unsigned int>(std::max(targetExp, 0));
176template<
unsigned int dim>
This class implement the point shape in an N-dimensional space.
static const unsigned int nvals
expose the dimension with a different name
__device__ __host__ T & value(size_t i)
Return the reference to the value at coordinate i.
__device__ __host__ const T & get(unsigned int i) const
Get coordinate.
std::string toString() const
Return the string with the point coordinate.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
It model an expression expr1 + ... exprn.