16 #include "Vector/vector_dist.hpp" 
   17 #include "Decomposition/CartDecomposition.hpp" 
   18 #include "PSE/Kernels.hpp" 
   19 #include "Plot/util.hpp" 
   20 #include "Plot/GoogleChart.hpp" 
   21 #include "data_type/aggregate.hpp" 
   32 double f_xex2(
double x)
 
   69     double prp_x = vd.template getProp<0>(key);
 
   72     auto NN = cl.template getNNIterator<NO_CHECK>(cl.getCell(p));
 
   81             double ker = lker.value(p,vd.getPos(nnp));
 
   84             double prp_y = vd.template getProp<0>(nnp);
 
   87             double prp = 1.0/eps/eps * (prp_y - prp_x) * spacing;
 
  129 inline void mirror(
vector_dist<1,
double, 
aggregate<double,double> > & vd, 
vect_dist_key_dx & key, 
const Box<1,double> & m_pad, 
Box<1,double> & m_pad2, 
const Box<1,double> & box)
 
  138         vd.getLastPos()[0] = - vd.getPos(key)[0];
 
  141         vd.template getLastProp<0>() = - vd.template getProp<0>(key);
 
  145     if (m_pad2.
isInsideNB(vd.getPos(key)) == 
true)
 
  154         vd.getLastPos()[0] = 2.0 * box.
getHigh(0) - vd.getPos(key)[0];
 
  157         vd.template getLastProp<0>() = f_xex2(vd.getLastPos()[0]);
 
  167 int main(
int argc, 
char* argv[])
 
  176     const size_t Npart = 1000;
 
  179         size_t NpartA[1] = {Npart+1};
 
  182     const size_t Nstep = 1000;
 
  185     const double dt = 10.0 / Nstep;
 
  188     const size_t Npad = 20;
 
  194     double spacing = box.
getHigh(0) / Npart;
 
  197     const double eps = 2*spacing;
 
  204         constexpr 
int Lap_U = 1;
 
  212     openfpm_init(&argc,&argv);
 
  213     Vcluster & v_cl = create_vcluster();
 
  215         size_t bc[1]={NON_PERIODIC};
 
  238         auto itp = vd.getGridIterator(NpartA);
 
  247         auto key = itp.get();
 
  250         vd.getPos(p)[0] = key.get(0) * spacing;
 
  253                 vd.template getProp<U>(p) = f_xex2(key.get(0) * spacing);
 
  307     if (Npad * spacing > 0.1)
 
  309         m_pad.
setHigh(0,Npad * spacing);
 
  310         m_pad2.
setLow(0,4.0 - Npad*spacing);
 
  311         enlarge = Npad * spacing;
 
  322     auto it = vd.getDomainIterator();
 
  323     size_t n_part = vd.size_local();
 
  329         mirror(vd,key,m_pad,m_pad2,box);
 
  345         auto cl = vd.getCellList(8*eps,gp);
 
  357         for (
double t = 0; t <= 10.0 ; t += dt)
 
  361             auto it_p = vd.getDomainIterator();
 
  362             while (it_p.isNext())
 
  371             if (x_p.
get(0) < 0.0 || x_p.
get(0) >= 4.0)
 
  378             vd.template getProp<Lap_U>(p) = calcLap(x_p,p,vd,eps,spacing,cl);
 
  389             auto it_p2 = vd.getDomainIterator();
 
  390             while (it_p2.isNext())
 
  393             auto p = it_p2.get();
 
  396             double pse = vd.template getProp<Lap_U>(p);
 
  399             vd.template getProp<0>(p) += D * pse * dt;
 
  402             mirror(vd,p,m_pad,m_pad2,box);
 
  428             bool operator<(
const pos_val & p)
 const 
  442         for (
size_t i = 0 ; i < vd.size_local() ; i++)
 
  445             v.get(i).pos = vd.getPos(i)[0];
 
  448             v.get(i).val = vd.template getProp<U>(i);
 
  474             for (
size_t i = 0 ; i < v_tot.
size() ; i++)
 
  477                 x.add(v_tot.get(i).pos);
 
  480             y.get(0).add(v_tot.get(i).val);
 
  483             y.get(1).add(f_xex2(v_tot.get(i).pos));
 
  491             options.
yAxis = std::string(
"U Axis");
 
  494             options.
xAxis = std::string(
"X Axis");
 
  506             cg.
write(
"PSE_plot.html");
 
Derivative second order on h (spacing) 
T getLow(int i) const 
get the i-coordinate of the low bound interval of the box 
void AddLines(openfpm::vector< X > &x, openfpm::vector< Y > &y, const GCoptions &opt)
Add lines graph. 
size_t getProcessUnitID()
Get the process unit id. 
T getHigh(int i) const 
get the high interval of the box 
void setHigh(int i, T val)
set the high interval of the box 
This class implement the point shape in an N-dimensional space. 
Grid key for a distributed grid. 
Implementation of the Laplacian kernels for PSE. 
Implementation of VCluster class. 
std::string yAxis
Y axis name. 
Small class to produce graph with Google chart in HTML. 
bool SGather(T &send, S &recv, size_t root)
Semantic Gather, gather the data from all processors into one node. 
const T & get(size_t i) const 
Get coordinate. 
void setLow(int i, T val)
set the low interval of the box 
size_t lineWidth
Width of the line. 
bool isInsideNB(const Point< dim, T > &p) const 
Check if the point is inside the region excluding the borders. 
size_t getKey() const 
Get the key. 
This class represent an N-dimensional box. 
This class is a trick to indicate the compiler a specific specialization pattern. ...
void write(std::string file)
It write the graphs on file in html format using Google charts. 
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
Implementation of 1-D std::vector like structure. 
std::string xAxis
X axis name.