5#ifndef OPENFPM_PDATA_MONOMIALBASISELEMENT_CUH
6#define OPENFPM_PDATA_MONOMIALBASISELEMENT_CUH
8#include "Space/Shape/Point.hpp"
11template<
unsigned int dim>
16 unsigned int exponents[dim];
17 unsigned int scalar = 1;
25 __host__ __device__
explicit Monomial_gpu(
const unsigned int other[dim]);
32 __host__ __device__
unsigned int order()
const;
33 __host__ __device__
unsigned int getExponent(
unsigned int i)
const;
34 __host__ __device__
void setExponent(
unsigned int i,
unsigned int value);
36 __host__ __device__
unsigned int getScalar()
const {
return scalar; }
38 template<
typename T> __host__ __device__ T evaluate(
const Point<dim, T> x)
const;
39 template<
typename T> __host__ __device__ T evaluate(
const T (&x)[dim])
const;
42 __host__ __device__
void updateSum();
45template<
unsigned int dim>
48 for (
size_t i = 0; i < dim; ++i) exponents[i] = 0;
52template<
unsigned int dim>
55 for (
size_t i = 0; i < other.
nvals; ++i)
56 exponents[i] = other.
value(i);
60template<
unsigned int dim>
63 for (
size_t i = 0; i < other.
nvals; ++i)
64 exponents[i] = other.
value(i);
68template<
unsigned int dim>
71 for (
size_t i = 0; i < dim; ++i)
72 exponents[i] = other[i];
76template<
unsigned int dim>
78 :
sum(other.
sum), scalar(other.scalar)
80 for (
size_t i = 0; i < dim; ++i)
81 exponents[i] = other.exponents[i];
84template<
unsigned int dim>
86 :
sum(other.order()), scalar(other.getScalar())
88 for (
size_t i = 0; i < dim; ++i)
89 exponents[i] = other.getExponent(i);
92template<
unsigned int dim>
95 for (
size_t i = 0; i < dim; ++i)
96 exponents[i] = other.exponents[i];
99 scalar = other.scalar;
103template<
unsigned int dim>
106 for (
size_t i = 0; i < dim; ++i)
107 exponents[i] = other.getExponent(i);
110 scalar = other.getScalar();
114template<
unsigned int dim>
118 for (
unsigned int i = 0; i < dim; ++i)
122template<
unsigned int dim>
128template<
unsigned int dim>
134template<
unsigned int dim>
137 exponents[i] = value;
141template<
unsigned int dim>
147 for (
size_t i = 0; i < dim; ++i)
148 if (exponents[i] != other[i])
151 return EQ && (scalar == other.scalar);
154template<
unsigned int dim>
159 for (
unsigned int i = 0; i < dim; ++i)
160 res *= pow(x[i], getExponent(i));
165template<
unsigned int dim>
170 for (
unsigned int i = 0; i < dim; ++i)
171 res *= pow(x[i], getExponent(i));
176template<
unsigned int dim>
179 unsigned int s = scalar;
181 for (
unsigned int i = 0; i < dim; ++i)
183 unsigned int origExp = e.value(i);
184 int targetExp =
static_cast<int>(origExp) -
static_cast<int>(differentialOrder.
value(i));
185 for (
int k = origExp; k > targetExp && k >= 0; --k)
189 e.get(i) =
static_cast<unsigned int>((targetExp < 0) ? 0 : targetExp);
194template<
unsigned int dim>
198 scalar = other.scalar;
199 for (
size_t i = 0; i < dim; ++i)
200 exponents[i] = other.exponents[i];
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.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
It model an expression expr1 + ... exprn.