8#ifndef OPENFPM_NUMERICS_SRC_PSE_KERNELS_TEST_UTIL_HPP_
9#define OPENFPM_NUMERICS_SRC_PSE_KERNELS_TEST_UTIL_HPP_
12#include "Space/Ghost.hpp"
13#include "Vector/vector_dist.hpp"
14#include "data_type/aggregate.hpp"
15#include "Decomposition/CartDecomposition.hpp"
24template<
typename T> T f_xex2(T x)
31 return x.get(0)*exp(-x.get(0)*x.get(0));
34template<
typename T> T Lapf_xex2(
Point<1,T> & x)
36 return 2.0*x.get(0)*(2.0*x.get(0)*x.get(0) - 3.0)*exp(-x.get(0)*x.get(0));
66template<
typename T,
typename Kernel>
void PSE_test(
size_t Npart,
size_t overlap,
struct PSEError & error)
72 T spacing = box.getHigh(0) / Npart;
75 const T eps = overlap*spacing;
81 Npart =
static_cast<size_t>(20*eps/spacing);
84 long int mp = Npart / 2;
86 size_t bc[1]={NON_PERIODIC};
91 auto it2 = vd.getIterator();
98 vd.getPos(key)[0] = 0.448000 - ((
long int)key.getKey() - mp) * spacing;
100 T d = vd.getPos(key)[0];
102 vd.template getProp<0>(key) = f_xex2(d);
111 auto cl = vd.getCellList(0.5);
123 T prp_x = vd.template getProp<0>(key);
126 auto NN = cl.template getNNIterator<NO_CHECK>(cl.getCell(p));
138 T ker = lker.value(p,xp);
141 T prp_y = vd.template getProp<0>(nnp);
144 T prp = 1.0/eps/eps * spacing * (prp_y - prp_x);
155 T sol = Lapf_xex2(p);
157 if (fabs(pse - sol) > linf)
158 linf =
static_cast<double>(fabs(pse - sol));
161 error.linf_error = (double)linf;
This class represent an N-dimensional box.
This class implement the point shape in an N-dimensional space.
Grid key for a distributed grid.
__device__ __host__ size_t getKey() const
Get the key.
__device__ __host__ void setKey(size_t key)
set the key
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data