8#ifndef SRC_VECTOR_PERFORMANCE_VECTOR_DIST_PERFORMANCE_COMMON_HPP_
9#define SRC_VECTOR_PERFORMANCE_VECTOR_DIST_PERFORMANCE_COMMON_HPP_
11#include "Vector/vector_dist.hpp"
19template<
unsigned int dim,
size_t prp = 0,
typename T,
typename V>
void calc_forces(T & NN, V & vd,
float r_cut)
21 auto it_v = vd.getDomainIterator();
25 for (
size_t i = 0; i < dim; i++)
36 for (
size_t i = 0; i < dim; i++)
40 auto cell_it = NN.template getNNIterator<NO_CHECK>(NN.getCell(p));
42 while(cell_it.isNext())
44 auto nnp = cell_it.get();
59 for (
size_t i = 0; i < dim; i++)
60 num[i] = vd.getPos(key)[i] - vd.getPos(nnp)[i];
63 for (
size_t i = 0; i < dim; i++)
64 denom += num[i] * num[i];
67 for (
size_t i = 0; i < dim; i++)
68 res[i] = num[i] / denom;
70 for (
size_t i = 0; i < dim; i++)
78 for (
size_t i = 0; i < dim; i++)
79 vd.template getProp<prp>(key)[i] +=
sum[i];
97template<
unsigned int dim,
unsigned int prp,
typename T,
typename V>
void cross_calc(T & NN, T & NN2, V & vd, V & vd2)
99 auto it_v = vd.getDomainIterator();
101 while (it_v.isNext())
110 auto cell_it = NN2.template getNNIterator<NO_CHECK>(NN2.getCell(p));
114 while(cell_it.isNext())
116 auto nnp = cell_it.get();
126 vd.template getProp<prp>(key) =
sum;
137template<
unsigned int dim,
typename v_dist>
142 std::uniform_real_distribution<float> ud(0.0f, 1.0f);
146 auto it = vd.getIterator();
152 for (
size_t i = 0; i < dim; i++)
153 {vd.getPos(key)[i] = ud(eg);}
168template<
unsigned int dim,
typename v_dist>
173 std::uniform_real_distribution<float> ud(0.0f, 1.0f);
175 auto it = vd.getIterator(start,stop);
181 for (
size_t i = 0; i < dim; i++)
195template<
unsigned int dim,
typename v_dist>
void vd_initialize_double(v_dist & vd,v_dist & vd2,
Vcluster<> & v_cl,
size_t k_int)
199 std::uniform_real_distribution<float> ud(0.0f, 1.0f);
203 auto it = vd.getIterator();
209 for (
size_t i = 0; i < dim; i++)
211 vd.getPos(key)[i] = ud(eg);
212 vd2.getPos(key)[i] = vd.getPos(key)[i];
230template<
unsigned int dim,
size_t prp = 0,
typename T,
typename V>
void calc_forces_hilb(T & NN, V & vd,
float r_cut)
232 auto it_cl = NN.getIterator();
236 for (
size_t i = 0; i < dim; i++)
239 while (it_cl.isNext())
242 auto key = it_cl.get();
247 for (
size_t i = 0; i < dim; i++)
251 auto cell_it = NN.template getNNIterator<NO_CHECK>(NN.getCell(p));
253 while(cell_it.isNext())
255 auto nnp = cell_it.get();
270 for (
size_t i = 0; i < dim; i++)
271 num[i] = vd.getPos(key)[i] - vd.getPos(nnp)[i];
274 for (
size_t i = 0; i < dim; i++)
275 denom += num[i] * num[i];
278 for (
size_t i = 0; i < dim; i++)
279 res[i] = num[i] / denom;
281 for (
size_t i = 0; i < dim; i++)
289 for (
size_t i = 0; i < dim; i++)
290 vd.template getProp<prp>(key)[i] +=
sum[i];
This class represent an N-dimensional box.
__device__ __host__ T getLow(int i) const
get the i-coordinate of the low bound interval of the box
__device__ __host__ T getHigh(int i) const
get the high interval of the box
This class implement the point shape in an N-dimensional space.
T distance2(const Point< dim, T > &q) const
It calculate the square distance between 2 points.
size_t getProcessUnitID()
Get the process unit id.
Implementation of VCluster class.
Grid key for a distributed grid.
__device__ __host__ size_t getKey() const
Get the key.
It model an expression expr1 + ... exprn.