5#ifndef OPENFPM_PDATA_MONOMIALBASIS_H
6#define OPENFPM_PDATA_MONOMIALBASIS_H
8#include "Vector/map_vector.hpp"
9#include <Grid/grid_sm.hpp>
10#include <Grid/iterators/grid_key_dx_iterator_sub_bc.hpp>
11#include "Monomial.hpp"
12#include "Monomial.cuh"
15template<
unsigned int dim,
typename T = Monomial<dim>,
template<
typename,
template<
typename...>
class...>
class vector_type =
openfpm::vector_std,
template<
typename...>
class... Args>
26 MonomialBasis(
unsigned int degrees[dim],
unsigned int convergenceOrder);
36 __host__ __device__
unsigned int size()
const;
38 __host__ __device__
const T &getElement(
size_t i)
const;
40 __host__ __device__ T &getElement(
size_t i);
42 __host__ __device__
const vector_type<T, Args...> &getElements()
const;
46 __host__ __device__
bool operator==(
const MonomialBasis &other)
const;
48 __host__ __device__
vector_type<T, Args...>& getBasis() {
return basis; }
50 template<
typename charT,
typename traits>
51 friend std::basic_ostream<charT, traits> &
54 lhs <<
"MonomialBasis: size=" << rhs.size() <<
", elements={ ";
55 for (
const auto &el : rhs.getElements())
57 lhs <<
"(" << el <<
") ";
59 lhs <<
"}" << std::endl;
69template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
72 generateBasis(degrees, convergenceOrder);
75template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
79template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
85template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
92template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
98template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
104template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
110template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
115 unsigned int mSum = 0U;
116 for (
size_t i = 0; i < m.size(); ++i) mSum += m.get(i);
118 unsigned int orderLimit = mSum + r;
119 size_t dimensions[dim];
120 std::fill(dimensions, dimensions + dim, orderLimit);
125 long int startV[dim] = {};
130 std::fill(bc, bc + dim, NON_PERIODIC);
135 unsigned char alphaMin =
static_cast<unsigned char>(!(mSum % 2));
146 T candidateBasisElement(p);
148 if (candidateBasisElement.order() < orderLimit && candidateBasisElement.order() >= alphaMin)
150 basis.add(candidateBasisElement);
156template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
162template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
167 for (
size_t i = 0; i < basis.size(); ++i)
170 T d = basis.get(i).getDerivative(differentialOrder);
177template<
unsigned int dim,
typename T,
template<
typename,
template<
typename...>
class...>
class vector_type,
template<
typename...>
class... Args>
180 return basis == other.basis;
This class implement the point shape in an N-dimensional space.
__device__ __host__ const T & get(unsigned int i) const
Get coordinate.
The same as grid_key_dx_iterator_sub_p but with periodic boundary.
grid_key_dx is the key to access any element in the grid
Implementation of 1-D std::vector like structure.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data