13#include "config/config.h"
14#include "Vector/vector_dist.hpp"
15#include "Decomposition/CartDecomposition.hpp"
16#include "PSE/Kernels.hpp"
17#include "data_type/aggregate.hpp"
21#ifdef HAVE_LIBQUADMATH
23#include <boost/multiprecision/float128.hpp>
25typedef boost::multiprecision::float128 float128;
37float128 f_xex2(float128 x)
44 return x.get(0)*exp(-x.get(0)*x.get(0));
49 return 2.0*x.get(0)*(2.0*x.get(0)*x.get(0) - 3.0)*exp(-x.get(0)*x.get(0));
58int main(
int argc,
char* argv[])
74 const size_t Npart = 125;
77 const size_t Npad = 40;
83 float128 spacing = box.
getHigh(0) / Npart;
86 const float128 eps = 2*spacing;
97 openfpm_init(&argc,&argv);
100 size_t bc[1]={NON_PERIODIC};
130 size_t base = vd.init_size_accum(Npart+1);
131 auto it2 = vd.getIterator();
135 auto key = it2.get();
138 vd.getPos(key)[0] = (key.getKey() + base) * spacing;
140 vd.template getProp<0>(key) = f_xex2((key.getKey() + base) * spacing);
179 float128 enlarge = 0.1;
182 if (Npad * spacing > 0.1)
184 m_pad.
setHigh(0,Npad * spacing);
185 m_pad2.setLow(0,4.0 - Npad*spacing);
186 enlarge = Npad * spacing;
189 auto it = vd.getDomainIterator();
196 if (m_pad.isInsideNB(vd.getPos(key)) ==
true)
199 vd.getLastPos()[0] = - vd.getPos(key)[0];
200 vd.template getLastProp<0>() = - vd.template getProp<0>(key);
204 if (m_pad2.isInsideNB(vd.getPos(key)) ==
true)
207 vd.getLastPos()[0] = 2.0 * box.getHigh(0) - vd.getPos(key)[0];
208 vd.template getLastProp<0>() = f_xex2(vd.getLastPos()[0]);
223 auto cl = vd.getCellList(12*eps,gp);
239 auto it_p = vd.getDomainIterator();
240 while (it_p.isNext())
253 if (p.
get(0) < 0.0 || p.
get(0) >= 4.0)
260 float128 prp_x = vd.template getProp<0>(key);
263 auto NN = cl.template getNNIterator<NO_CHECK>(cl.getCell(p));
273 float128 ker = lker.value(p,vd.getPos(nnp));
276 float128 prp_y = vd.template getProp<0>(nnp);
279 float128 prp = 1.0/eps/eps * (prp_y - prp_x) * spacing;
290 float128 sol = Lapf_xex2(p);
292 if (fabs(pse - sol) > linf)
293 linf =
static_cast<double>(fabs(pse - sol));
309 std::cout <<
"Norm infinity: " << linf <<
"\n";
321int main(
int argc,
char* argv[])
This class represent an N-dimensional box.
__device__ __host__ T getHigh(int i) const
get the high interval of the box
__device__ __host__ void setHigh(int i, T val)
set the high interval of the box
This class decompose a space into sub-sub-domains and distribute them across processors.
This class implement the point shape in an N-dimensional space.
__device__ __host__ const T & get(unsigned int i) const
Get coordinate.
void execute()
Execute all the requests.
size_t getProcessUnitID()
Get the process unit id.
void max(T &num)
Get the maximum number across all processors (or reduction with infinity norm)
Implementation of VCluster class.
Grid key for a distributed grid.
__device__ __host__ size_t getKey() const
Get the key.
Implementation of the Laplacian kernels for PSE.