12#include "util/cuda_launch.hpp"
13#include "HDF5_wr/HDF5_wr.hpp"
14#include "VCluster/VCluster.hpp"
15#include "Space/Shape/Point.hpp"
16#include "Vector/Iterators/vector_dist_iterator.hpp"
17#include "Space/Shape/Box.hpp"
18#include "Vector/vector_dist_key.hpp"
19#include "memory/PtrMemory.hpp"
20#include "NN/CellList/CellList.hpp"
21#include "NN/CellList/CellListFast_gen.hpp"
22#include "util/common.hpp"
23#include "util/object_util.hpp"
24#include "memory/ExtPreAlloc.hpp"
25#include "CSVWriter/CSVWriter.hpp"
26#include "VTKWriter/VTKWriter.hpp"
27#include "Decomposition/common.hpp"
28#include "Grid/Iterators/grid_dist_id_iterator_dec.hpp"
29#include "Grid/grid_key_dx_iterator_hilbert.hpp"
30#include "Vector/vector_dist_ofb.hpp"
31#include "Decomposition/CartDecomposition.hpp"
32#include "data_type/aggregate.hpp"
33#include "NN/VerletList/VerletList.hpp"
34#include "vector_dist_comm.hpp"
35#include "DLB/LB_Model.hpp"
36#include "Vector/vector_map_iterator.hpp"
37#include "NN/CellList/ParticleIt_Cells.hpp"
38#include "NN/CellList/ProcKeys.hpp"
39#include "Vector/vector_dist_kernel.hpp"
40#include "NN/CellList/cuda/CellList_gpu.hpp"
41#include "lib/pdata.hpp"
42#include "cuda/vector_dist_operators_list_ker.hpp"
47#define DEC_GRAN(gr) ((size_t)gr << 32)
50template<
unsigned int dim,
typename St>
using CELLLIST_GPU_SPARSE = CellList_gpu<dim,St,CudaMemory,shift_only<dim, St>,
unsigned int,
int,
true>;
53#define VECTOR_DIST_ERROR_OBJECT std::runtime_error("Runtime vector distributed error");
56#include "se_class3_vector.hpp"
60 #define SE_CLASS3_VDIST_CONSTRUCTOR ,se3(getDecomposition(),*this)
62 #define SE_CLASS3_VDIST_CONSTRUCTOR
74constexpr int NO_GHOST = 0;
75constexpr int WITH_GHOST = 2;
77constexpr int GCL_NON_SYMMETRIC = 0;
78constexpr int GCL_SYMMETRIC = 1;
79constexpr int GCL_HILBERT = 2;
84 template<
unsigned int dim,
typename St,
typename CellL,
typename Vector,
unsigned int impl>
87 return vd.template getCellList<CellL>(r_cut);
91template<
unsigned int ... prp>
94 template<
unsigned int dim,
typename St,
typename CellL,
typename Vector,
unsigned int impl>
97 return vd.template getCellListGPU<CellL,prp...>(r_cut);
102template<
unsigned int dim,
typename St,
typename CellL,
typename Vector,
unsigned int impl,
unsigned int ... prp>
121template<
unsigned int dim,
typename St,
typename CellL,
typename Vector>
135 return vd.getCellList_hilb(r_cut,g);
140template<
unsigned int dim,
typename St,
typename CellL,
typename Vector>
154 return vd.getCellListSym(r_cut);
161template<
unsigned int dim,
typename St,
typename CellL,
typename Vector,
unsigned int impl>
175 return vd.template getCellListSym<CellL>(div,pad);
179#define CELL_MEMFAST(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St> >
180#define CELL_MEMBAL(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_bal<>, shift<dim, St> >
181#define CELL_MEMMW(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_mw<>, shift<dim, St> >
183#define CELL_MEMFAST_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_fast<>, shift<dim, St> >
184#define CELL_MEMBAL_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_bal<>, shift<dim, St> >
185#define CELL_MEMMW_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_mw<>, shift<dim, St> >
187#define VERLET_MEMFAST(dim,St) VerletList<dim,St,Mem_fast<>,shift<dim,St> >
188#define VERLET_MEMBAL(dim,St) VerletList<dim,St,Mem_bal<>,shift<dim,St> >
189#define VERLET_MEMMW(dim,St) VerletList<dim,St,Mem_mw<>,shift<dim,St> >
191#define VERLET_MEMFAST_INT(dim,St) VerletList<dim,St,Mem_fast<HeapMemory,unsigned int>,shift<dim,St> >
192#define VERLET_MEMBAL_INT(dim,St) VerletList<dim,St,Mem_bal<unsigned int>,shift<dim,St> >
193#define VERLET_MEMMW_INT(dim,St) VerletList<dim,St,Mem_mw<unsigned int>,shift<dim,St> >
202template<
typename vector,
unsigned int impl>
205 typedef decltype(std::declval<vector>().getCellListGPU(0.0)) ctype;
207 static ctype get(vector & v,
208 typename vector::stype & r_cut)
210 return v.getCellListGPU(r_cut);
214template<
typename vector>
217 typedef decltype(std::declval<vector>().getCellList(0.0)) ctype;
219 static ctype get(vector & v,
220 typename vector::stype & r_cut)
222 return v.getCellList(r_cut);
226template<
typename vector_type>
253 v.template getMemory<T::value>().decRef();
291template<
unsigned int dim,
313 static const unsigned int dims = dim;
317 typedef Memory Memory_type;
366 size_t p_np = np /
v_cl.getProcessingUnits();
369 size_t r = np %
v_cl.getProcessingUnits();
372 if (
v_cl.getProcessUnitID() < r)
394 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the domain is not valid " << box.
toString() << std::endl;
395 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
407 for (
size_t i = 0 ; i < dim ; i++)
411 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the cut off radius " << r_cut <<
" is bigger that the ghost layer on the dimension " << i <<
" lower=" <<
getDecomposition().getGhost().getLow(i) << std::endl;
412 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
425 template<
typename CellL,
typename sfc_it>
431 v_pos_dest.resize(
v_pos.size());
432 v_prp_dest.resize(
v_prp.size());
439 for (
size_t i = 0; i < dim ; i++)
440 {ksum.
set_d(i,cell_list.getPadding(i));}
442 while (h_it.isNext())
444 auto key = h_it.get();
447 size_t lin = cell_list.getGrid().LinId(key);
450 for (
size_t i = 0; i < cell_list.getNelements(lin); i++)
453 auto v = cell_list.get(lin,i);
454 v_pos_dest.get(count) =
v_pos.get(v);
455 v_prp_dest.get(count) =
v_prp.get(v);
464 typedef decltype(
v_pos) internal_position_vector_type;
485 static_cast<vector_dist_comm<dim,St,prop,Decomposition,Memory,layout_base> *
>(
this)->
operator=(
static_cast<vector_dist_comm<dim,St,prop,Decomposition,Memory,layout_base>>(v));
510 static_cast<vector_dist_comm<dim,St,prop,Decomposition,Memory,layout_base> *
>(
this)->
operator=(
static_cast<vector_dist_comm<dim,St,prop,Decomposition,Memory,layout_base> >(v));
539 check_new(
this,8,VECTOR_DIST_EVENT,4);
553 check_new(
this,8,VECTOR_DIST_EVENT,4);
573 check_new(
this,8,VECTOR_DIST_EVENT,4);
596 :
opt(0) SE_CLASS3_VDIST_CONSTRUCTOR
626 :
opt(
opt) SE_CLASS3_VDIST_CONSTRUCTOR
629 check_new(
this,8,VECTOR_DIST_EVENT,4);
659 for (
int i = 0 ; i <
v_pos.template getMemory<0>().ref() - 1; i++)
661 v_pos.template getMemory<0>().decRef();
664 for (
int i = 0 ; i <
v_prp.template getMemory<0>().ref() - 1; i++)
668 boost::mpl::for_each_ref<boost::mpl::range_c<int,0,
decltype(
v_prp)::value_type::max_prop>>(m);
711#ifndef ONLY_READWRITE_GETTER
725 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key.getKey());
728 return v_pos.template get<0>(vec_key.getKey());
743 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key.getKey());
745 return v_pos.template get<0>(vec_key.getKey());
757 inline auto getPos(
size_t vec_key) ->
decltype(
v_pos.template get<0>(vec_key))
760 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key);
762 return v_pos.template get<0>(vec_key);
777 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key.getKey());
779 return v_pos.template get<0>(vec_key.getKey());
794 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key);
796 return v_pos.template get<0>(vec_key);
808 inline auto getPos(
size_t vec_key)
const ->
decltype(
v_pos.template get<0>(vec_key))
811 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key);
813 return v_pos.template get<0>(vec_key);
829 check_for_prop_nan_inf<id,prop::max_prop+SE3_STATUS>(*
this,vec_key.getKey());
831 return v_prp.template get<id>(vec_key.getKey());
847 check_for_prop_nan_inf<id,prop::max_prop+SE3_STATUS>(*
this,vec_key.getKey());
849 return v_prp.template get<id>(vec_key.getKey());
862 template<
unsigned int id>
inline auto getProp(
size_t vec_key) ->
decltype(
v_prp.template get<id>(vec_key))
865 check_for_prop_nan_inf<id,prop::max_prop+SE3_STATUS>(*
this,vec_key);
867 return v_prp.template get<id>(vec_key);
880 template<
unsigned int id>
inline auto getProp(
size_t vec_key)
const ->
decltype(
v_prp.template get<id>(vec_key))
883 check_for_prop_nan_inf<id,prop::max_prop+SE3_STATUS>(*
this,vec_key);
885 return v_prp.template get<id>(vec_key);
903 return v_pos.template get<0>(vec_key.getKey());
917 return v_pos.template get<0>(vec_key.getKey());
929 inline auto getPosNC(
size_t vec_key) ->
decltype(
v_pos.template get<0>(vec_key))
931 return v_pos.template get<0>(vec_key);
943 inline auto getPosNC(
size_t vec_key)
const ->
decltype(
v_pos.template get<0>(vec_key))
945 return v_pos.template get<0>(vec_key);
960 return v_prp.template get<id>(vec_key.getKey());
975 return v_prp.template get<id>(vec_key.getKey());
988 template<
unsigned int id>
inline auto getPropNC(
size_t vec_key) ->
decltype(
v_prp.template get<id>(vec_key))
990 return v_prp.template get<id>(vec_key);
1003 template<
unsigned int id>
inline auto getPropNC(
size_t vec_key)
const ->
decltype(
v_prp.template get<id>(vec_key))
1005 return v_prp.template get<id>(vec_key);
1022 se3.template write<prop::max_prop_real>(*
this,vec_key.getKey());
1025 return v_pos.template get<0>(vec_key.getKey());
1040 se3.template read<prop::max_prop_real>(*
this,vec_key.getKey());
1043 return v_pos.template get<0>(vec_key.getKey());
1059 se3.template write<id>(*
this,vec_key.getKey());
1062 return v_prp.template get<id>(vec_key.getKey());
1078 se3.template read<id>(*
this,vec_key.getKey());
1081 return v_prp.template get<id>(vec_key.getKey());
1102 for (
size_t i = 0 ; i < prop::max_prop_real+1 ; i++)
1103 v_prp.template get<prop::max_prop_real>(
g_m-1)[i] = UNINITIALIZED;
1123#ifndef ONLY_READWRITE_GETTER
1132 return v_pos.template get<0>(
g_m - 1);
1143 return v_pos.template get<0>(
v_pos.size() - 1);
1155 return v_prp.template get<id>(
g_m - 1);
1170 se3.template read<prop::max_prop_real>(*
this,
g_m-1);
1173 return v_pos.template get<0>(
g_m - 1);
1186 se3.read<
id>(*
this,
g_m-1);
1189 return v_prp.template get<id>(
g_m - 1);
1201 se3.template write<prop::max_prop_real>(*
this,
g_m-1);
1204 return v_pos.template get<0>(
g_m - 1);
1217 se3.template write<id>(*
this,
g_m-1);
1220 return v_prp.template get<id>(
g_m - 1);
1239 template<
typename CellL = CellList<dim, St, Mem_fast<>, shift<dim, St>,
internal_position_vector_type > >
1243 if (!(
opt & BIND_DEC_TO_GHOST))
1247 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the vector has been constructed without BIND_DEC_TO_GHOST, If you construct a vector without BIND_DEC_TO_GHOST the ghost must be full without reductions " << std::endl;
1248 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1257 CellDecomposer_sm<dim,St,shift<dim,St>> cd_sm;
1265 cell_list.Initialize(cd_sm,pbox,pad);
1282 template<
typename CellL = CellList<dim, St, Mem_fast<>, shift<dim, St> > >
1284 const size_t (& pad)[dim])
1287 if (!(
opt & BIND_DEC_TO_GHOST))
1291 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the vector has been constructed without BIND_DEC_TO_GHOST, If you construct a vector without BIND_DEC_TO_GHOST the ghost must be full without reductions " << std::endl;
1292 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1297 size_t pad_max = pad[0];
1298 for (
size_t i = 1 ; i < dim ; i++)
1299 {
if (pad[i] > pad_max) {pad_max = pad[i];}}
1304 CellDecomposer_sm<dim,St,shift<dim,St>> cd_sm;
1312 cell_list.Initialize(cd_sm,pbox,pad_max);
1330 template<
unsigned int impl>
1346 template<
typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St>, decltype(v_pos) > >
1350 if (no_se3 ==
false)
1361 return getCellList<CellL>(r_cut, g,no_se3);
1373 template<
typename CellType = CellList_gpu<dim,St,CudaMemory,shift_only<dim, St>>,
unsigned int ... prp>
1374 CellType getCellListGPU(St r_cut,
bool no_se3 =
false)
1377 if (no_se3 ==
false)
1388 return getCellListGPU<CellType>(r_cut, g,no_se3);
1407 template<
typename CellType = CellList_gpu<dim,St,CudaMemory,shift_only<dim, St>>,
unsigned int ... prp>
1408 CellType getCellListGPU(St r_cut,
const Ghost<dim, St> & enlarge,
bool no_se3 =
false)
1411 if (no_se3 ==
false)
1424 cl_param_calculate(pbox, div, r_cut, enlarge);
1426 CellType cell_list(pbox,div);
1434 cell_list.set_gm(
g_m);
1437 this->update_sort(this->toKernel_sorted());
1457 auto getCellListDevice(St r_cut,
bool no_se3 =
false) ->
decltype(this->getCellListGPU(r_cut,no_se3))
1459 return this->getCellListGPU(r_cut,no_se3);
1490 template<
typename CellL = CellList_gen<dim, St, Process_keys_hilb, Mem_fast<>, shift<dim, St> > >
1515 template<
unsigned int ... prp,
typename CellL>
1516 void updateCellList(CellL & cell_list,
bool no_se3 =
false, cl_construct_opt
opt = cl_construct_opt::Full)
1519 if (no_se3 ==
false)
1527 St r_cut = cell_list.getCellBox().getRcut();
1531 bool to_reconstruct = cell_list.get_ndec() !=
getDecomposition().get_ndec();
1533 if (to_reconstruct ==
false)
1535 populate_cell_list<dim,St,
prop,Memory,layout_base,CellL,prp ...>(
v_pos,
v_pos_out,
v_prp,
v_prp_out,cell_list,
v_cl.getgpuContext(
false),
g_m,CL_NON_SYMMETRIC,
opt);
1537 cell_list.set_gm(
g_m);
1543 cell_list.swap(cli_tmp);
1544 cell_list.re_setBoxNN();
1555 template<
typename CellL = CellList<dim, St, Mem_fast<>, shift<dim, St> > >
1566 bool to_reconstruct = cell_list.get_ndec() !=
getDecomposition().get_ndec();
1568 if (to_reconstruct ==
false)
1572 cell_list.set_gm(
g_m);
1577 cell_list.getDivWP(),
1578 cell_list.getPadding(),
1581 cell_list.swap(cli_tmp);
1601 template<
typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St> > >
1605 if (no_se3 ==
false)
1618 cl_param_calculate(pbox, div, r_cut, enlarge);
1620 cell_list.Initialize(pbox, div);
1621 cell_list.set_gm(
g_m);
1659 cl_param_calculate(pbox,div, r_cut, enlarge);
1661 cell_list.Initialize(pbox, div);
1662 cell_list.set_gm(
g_m);
1677 template <
typename VerletL = VerletList<dim,St,Mem_fast<>,shift<dim,St> >>
1703 template <
typename VerletL = VerletList<dim,St,Mem_fast<>,shift<dim,St> >>
1707 if (!(
opt & BIND_DEC_TO_GHOST))
1709 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the vector has been constructed without BIND_DEC_TO_GHOST, getVerletCrs require the vector to be constructed with BIND_DEC_TO_GHOST option " << std::endl;
1710 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1727 auto & NN = ver.getInternalCellList();
1733 for (
size_t i = 0 ; i < dim ; i++)
1734 shift.set_d(i,NN.getPadding(i));
1740 ver.createVerletCrs(r_cut,
g_m,
v_pos,
1756 template <
typename VerletL = VerletList<dim,St,Mem_fast<>,shift<dim,St>,decltype(v_pos) >>
1796 if (
opt == VL_SYMMETRIC)
1798 auto & NN = ver.getInternalCellList();
1804 if (to_reconstruct ==
false)
1810 ver_tmp = getVerlet<VerletList<dim,St,Mem_type,shift<dim,St> >>(r_cut);
1814 else if (
opt == VL_CRS_SYMMETRIC)
1817 if ((
opt & BIND_DEC_TO_GHOST))
1819 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the vector has been constructed without BIND_DEC_TO_GHOST, updateVerlet with the option VL_CRS_SYMMETRIC require the vector to be constructed with BIND_DEC_TO_GHOST option " << std::endl;
1820 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1824 auto & NN = ver.getInternalCellList();
1830 if (to_reconstruct ==
false)
1836 for (
size_t i = 0 ; i < dim ; i++)
1837 shift.set_d(i,NN.getPadding(i));
1851 ver_tmp = getVerletCrs<VerletList<dim,St,Mem_type,shift<dim,St> >>(r_cut);
1857 auto & NN = ver.getInternalCellList();
1863 if (to_reconstruct ==
false)
1869 ver_tmp = getVerlet<VerletList<dim,St,Mem_type,shift<dim,St> >>(r_cut);
1883 template<
typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_bal<>,shift<dim,St> > >
1903 template<
typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_bal<>,shift<dim,St> > >
1923 for (
size_t i = 0 ; i < dim ; i++)
1928 cell_list.Initialize(pbox,div);
1929 cell_list.set_gm(
g_m);
1937 auto key = it.get();
1941 cell_list.add(xp,key.getKey());
1952 if (
opt == reorder_opt::HILBERT)
1956 reorder_sfc<CellL,grid_key_dx_iterator_hilbert<dim>>(v_pos_dest,v_prp_dest,h_it,cell_list);
1958 else if (
opt == reorder_opt::LINEAR)
1963 reorder_sfc<CellL,grid_key_dx_iterator<dim>>(v_pos_dest,v_prp_dest,h_it,cell_list);
1968 v_pos.swap(v_pos_dest);
1969 v_prp.swap(v_prp_dest);
1972 v_pos.swap(v_pos_dest);
1973 v_prp.swap(v_prp_dest);
1989 template<
typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_bal<>,shift<dim,St> > >
1996 auto cell_list = getCellList<CellL>(r_cut);
2005 for (
size_t i = 0 ; i < dim ; i++)
2006 {div[i] = cell_list.getGrid().
size(i) - 2*cell_list.getPadding()[i];}
2011 reorder_sfc<CellL,grid_key_dx_iterator<dim>>(v_pos_dest,v_prp_dest,h_it,cell_list);
2013 v_pos.swap(v_pos_dest);
2014 v_prp.swap(v_prp_dest);
2039 size_t p_np = np /
v_cl.getProcessingUnits();
2042 size_t r = np %
v_cl.getProcessingUnits();
2047 if (
v_cl.getProcessUnitID() <= r)
2097 for (
size_t i = 0; i < dim; i++)
2100 stop.
set_d(i, sz[i] - 1);
2150 for (
size_t i = 0 ; i < dim ; i++)
2181 ite_gpu<1> getDomainIteratorGPU(
size_t n_thr = default_kernel_wg_threads_)
const
2187 return v_pos.getGPUIteratorTo(
g_m-1,n_thr);
2195 ite_gpu<1> getDomainAndGhostIteratorGPU(
size_t n_thr = default_kernel_wg_threads_)
const
2201 return v_pos.getGPUIteratorTo(
v_pos.size()-1,n_thr);
2209 template<
unsigned int ... prp,
typename id_1,
typename id_2,
bool is_sparse>
2212#if defined(__NVCC__)
2214 auto ite =
v_pos.getGPUIteratorTo(
g_m-1,n_thr);
2215 bool has_work = has_work_gpu(ite);
2217 if (has_work ==
true)
2219 CUDA_LAUNCH((merge_sort_part<
false,
decltype(
v_pos.toKernel()),
decltype(
v_prp.toKernel()),
decltype(cl.getNonSortToSort().toKernel()),prp...>),
2234 template<
unsigned int prp>
2235 void debugPrintVector(
bool print_sorted =
false)
2237 if (print_sorted ==
false)
2238 {this->v_prp.template deviceToHost<prp>();}
2240 {this->v_prp_out.template deviceToHost<prp>();}
2248 for (
size_t i = 0 ; i < std::extent<typename boost::mpl::at<typename prop::type,boost::mpl::int_<prp>>::type>::value ; i++)
2250 if (print_sorted ==
false)
2251 {std::cout <<
v_prp.template get<prp>(p.getKey())[i] <<
" ";}
2253 {std::cout <<
v_prp_out.template get<prp>(p.getKey())[i] <<
" ";}
2256 std::cout << std::endl;
2269 template<
unsigned int prp>
2270 void debugPrintScalar(
bool print_sorted =
false)
2272 if (print_sorted ==
false)
2273 {this->v_prp.template deviceToHost<prp>();}
2275 {this->v_prp_out.template deviceToHost<prp>();}
2283 if (print_sorted ==
false)
2284 {std::cout <<
v_prp_out.template get<prp>(p.getKey()) <<
" " << std::endl;}
2286 {std::cout <<
v_prp_out.template get<prp>(p.getKey()) <<
" " << std::endl;}
2297 template<
unsigned int ... prp>
void merge_sort_with_pos(CellList_gpu<dim,St,
CudaMemory,
shift_only<dim, St>> & cl,
size_t n_thr = default_kernel_wg_threads_)
2299#if defined(__NVCC__)
2301 auto ite =
v_pos.getGPUIteratorTo(
g_m-1,n_thr);
2303 CUDA_LAUNCH((merge_sort_part<
true,
decltype(
v_pos.toKernel()),
decltype(
v_prp.toKernel()),
decltype(cl.getNonSortedToSorted().toKernel()),prp...>),
2319 auto getDomainIteratorDevice(
size_t n_thr = default_kernel_wg_threads_)
const ->
decltype(this->getDomainIteratorGPU(n_thr))
2321 return this->getDomainIteratorGPU(n_thr);
2416 this->
update(this->toKernel());
2436 template<
typename obp = KillParticle>
void map(
size_t opt = NONE)
2448 this->
update(this->toKernel());
2456 int getMapCtr()
const
2488 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the processor " <<
v_cl.getProcessUnitID() <<
" has particles, but is supposed to be unloaded" << std::endl;
2489 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
2494 se3.template ghost_get_pre<prp...>(
opt);
2500 this->
update(this->toKernel());
2505 this->
template ghost_get_<prop::max_prop_real>(
v_pos,
v_prp,
g_m,
opt | KEEP_PROPERTIES);
2507 se3.template ghost_get_post<prp...>(
opt);
2526 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the processor " <<
v_cl.getProcessUnitID() <<
" has particles, but is supposed to be unloaded" << std::endl;
2527 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
2532 se3.template ghost_get_pre<prp...>(
opt);
2552 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the processor " <<
v_cl.getProcessUnitID() <<
" has particles, but is supposed to be unloaded" << std::endl;
2553 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
2560 this->
update(this->toKernel());
2565 this->
template ghost_get_<prop::max_prop_real>(
v_pos,
v_prp,
g_m,
opt | KEEP_PROPERTIES);
2567 se3.template ghost_get_post<prp...>(
opt);
2582 template<
template<
typename,
typename>
class op,
int ... prp>
inline void ghost_put(
size_t opt_ = NONE)
2600 v_pos.remove(keys, start);
2601 v_prp.remove(keys, start);
2616 v_pos.remove(keys, start);
2617 v_prp.remove(keys, start);
2644 CellDecomposer_sm<dim, St, shift<dim,St>> cdsm;
2648 cdsm.setDimensions(
dec.getDomain(),
dec.getDistGrid().getSize(), 0);
2655 size_t v = cdsm.getCell(p);
2657 md.addComputation(
dec,vd,v,it.get().getKey());
2676 dec.computeCommunicationAndMigrationCosts(ts);
2680 for (
size_t i = 0 ; i < dist.getNOwnerSubSubDomains(); i++)
2681 {md.applyModel(
dec,dist.getOwnerSubSubDomain(i));}
2683 dist.setDistTol(md.distributionTol());
2694 for (
size_t i = 0; i < dist.getNOwnerSubSubDomains() ; i++)
2695 {
dec.setSubSubDomainComputationCost(dist.getOwnerSubSubDomain(i) , 1);}
2720 inline void save(
const std::string & filename)
const
2732 inline void load(
const std::string & filename)
2759 inline bool write(std::string out ,
int opt = VTK_WRITER)
2774 inline bool write(std::string out, std::string meta_info ,
int opt = VTK_WRITER)
2778 if ((
opt & 0x0FFF0000) == CSV_WRITER)
2782 vector_dist_prop > csv_writer;
2784 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.getProcessUnitID()) + std::to_string(
".csv"));
2791 file_type ft = file_type::ASCII;
2793 if (
opt & FORMAT_BINARY)
2794 ft = file_type::BINARY;
2797 VTKWriter<boost::mpl::pair<vector_dist_pos,
2799 VECTOR_POINTS> vtk_writer;
2802 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.getProcessUnitID()) + std::to_string(
".vtp"));
2811 bool ret=vtk_writer.write(output,
prp_names,
"particles",meta_info,ft);
2843 this->
update(this->toKernel());
2859 this->
update(this->toKernel());
2890 inline bool write_frame(std::string out,
size_t iteration, std::string meta_info,
int opt = VTK_WRITER)
2894 if ((
opt & 0x0FFF0000) == CSV_WRITER)
2898 vector_dist_prop > csv_writer;
2900 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.getProcessUnitID()) +
"_" + std::to_string(iteration) + std::to_string(
".csv"));
2903 return csv_writer.write(output,
v_pos,
v_prp);
2907 file_type ft = file_type::ASCII;
2909 if (
opt & FORMAT_BINARY)
2910 ft = file_type::BINARY;
2913 VTKWriter<boost::mpl::pair<vector_dist_pos,
2914 vector_dist_prop>, VECTOR_POINTS> vtk_writer;
2917 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.getProcessUnitID()) +
"_" + std::to_string(iteration) + std::to_string(
".vtp"));
2928 bool ret=vtk_writer.write(output,
prp_names,
"particles",meta_info,ft);
2945 inline bool write_frame(std::string out,
size_t iteration,
double time,
int opt = VTK_WRITER)
2949 if ((
opt & 0x0FFF0000) == CSV_WRITER)
2953 vector_dist_prop > csv_writer;
2955 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.getProcessUnitID()) +
"_" + std::to_string(iteration) + std::to_string(
".csv"));
2958 return csv_writer.write(output,
v_pos,
v_prp);
2962 file_type ft = file_type::ASCII;
2964 if (
opt & FORMAT_BINARY)
2965 ft = file_type::BINARY;
2968 VTKWriter<boost::mpl::pair<vector_dist_pos,
2969 vector_dist_prop>, VECTOR_POINTS> vtk_writer;
2972 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.getProcessUnitID()) +
"_" + std::to_string(iteration) + std::to_string(
".vtp"));
2982 bool ret=vtk_writer.write(output,
prp_names,
"particles",
"",ft);
3005 cl_param_calculate(pbox, div,r_cut,enlarge);
3021 return check_whoami(
this,8);
3036 check_valid(
this,8);
3038 return create_vcluster<Memory>();;
3134 v_cl.allGather(sz,accu);
3139 for (
size_t i = 0 ; i <
v_cl.getProcessUnitID() ; i++)
3140 {sz += accu.get(i);}
3160 if (!(
opt & BIND_DEC_TO_GHOST))
3162 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the vector has been constructed without BIND_DEC_TO_GHOST, getParticleIteratorCRS_Cell require the vector to be constructed with BIND_DEC_TO_GHOST option " << std::endl;
3163 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
3171 for (
size_t i = 0 ; i < dim ; i++)
3172 shift.set_d(i,NN.getPadding(i));
3218 if (!(
opt & BIND_DEC_TO_GHOST))
3220 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the vector has been constructed without BIND_DEC_TO_GHOST, getParticleIteratorCRS_Cell require the vector to be constructed with BIND_DEC_TO_GHOST option " << std::endl;
3221 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
3239 return NN.getStartDomainCell();
3254 for (
size_t i = 0 ; i < dim ; i++)
3278 template<
unsigned int ... prp> vector_dist_ker<dim,St,prop,layout_base> toKernel()
3280 vector_dist_ker<dim,St,prop,layout_base> v(
g_m,
v_pos.toKernel(),
v_prp.toKernel());
3303 template<
unsigned int ... prp> vector_dist_ker<dim,St,prop,layout_base> toKernel_sorted()
3317 v_prp.template deviceToHost<prp ...>();
3328 template<
unsigned int ... prp>
void deviceToHostProp(
size_t start,
size_t stop)
3330 v_prp.template deviceToHost<prp ...>(start,stop);
3340 v_pos.template deviceToHost<0>();
3350 v_prp.template hostToDevice<prp ...>();
3360 v_pos.template hostToDevice<0>();
3363 void set_g_m(
size_t g_m)
3375 template<
typename CellList_type>
3376 void make_sort(CellList_type & NN)
3396 template<
typename CellList_type>
3397 void make_sort_from(CellList_type & cl)
3399#if defined(__NVCC__)
3401 auto ite =
v_pos.getGPUIteratorTo(
g_m-1);
3403 CUDA_LAUNCH((merge_sort_all<
decltype(
v_pos.toKernel()),
decltype(
v_prp.toKernel()),
decltype(cl.getNonSortToSort().toKernel())>),
3420 bool compareHostAndDevicePos(St tol, St near = -1.0,
bool silent =
false)
3433 template<
unsigned int prp>
3434 bool compareHostAndDeviceProp(St tol, St near = -1.0,
bool silent =
false)
3437 boost::mpl::int_<prp> >::type,prp>::compare(
v_prp,tol,near,silent);
3488template<
unsigned int dim,
typename St,
typename prop,
typename Decomposition = CartDecomposition<dim,St,CudaMemory,memory_traits_
inte>>
using vector_dist_gpu =
vector_dist<dim,St,prop,Decomposition,CudaMemory,memory_traits_inte>;
3489template<
unsigned int dim,
typename St,
typename prop,
typename Decomposition = CartDecomposition<dim,St,HeapMemory,memory_traits_
inte>>
using vector_dist_soa =
vector_dist<dim,St,prop,Decomposition,HeapMemory,memory_traits_inte>;
3490template<
unsigned int dim,
typename St,
typename prop,
typename Decomposition = CartDecomposition<dim,St,CudaMemory,memory_traits_
inte>>
using vector_dist_dev =
vector_dist<dim,St,prop,Decomposition,CudaMemory,memory_traits_inte>;
Header file containing functions for creating files and folders.
static void create_directory_if_not_exist(std::string path, bool silent=0)
Creates a directory if not already existent.
This class represent an N-dimensional box.
std::string toString() const
Produce a string from the object.
void enlarge(const Box< dim, T > &gh)
Enlarge the box with ghost margin.
bool isValid() const
Check if the Box is a valid box P2 >= P1.
void magnify(T mg)
Magnify the box.
This class decompose a space into sub-sub-domains and distribute them across processors.
Class for FAST cell list implementation.
size_t getPadding(size_t i) const
Return the number of padding cells of the Cell decomposer.
This class define the domain decomposition interface.
This class allocate, and destroy CPU memory.
This iterator iterate across the particles of a Cell-list following the Cell structure.
This iterator iterate across the particles of a Cell-list following the Cell structure.
This class implement the point shape in an N-dimensional space.
Implementation of VCluster class.
Sparse Matrix implementation stub object when OpenFPM is compiled with no linear algebra support.
Class for Verlet list implementation.
void swap(VerletList< dim, T, Mem_type, transform, vector_pos_type, CellListImpl > &vl)
Swap the memory.
Given the decomposition it create an iterator.
grid_key_dx is the key to access any element in the grid
__device__ __host__ void set_d(index_type i, index_type id)
Set the i index.
__device__ __host__ index_type get(index_type i) const
Get the i index.
Implementation of 1-D std::vector like structure.
This class check for inconsistency access.
void map_post()
Operation to do after map.
void Initialize()
Initialize the se_class2 structure.
Grid key for a distributed grid.
This class is an helper for the communication of vector_dist.
void init_decomposition(Box< dim, St > &box, const size_t(&bc)[dim], const Ghost< dim, St > &g, size_t opt, const grid_sm< dim, void > &gdist)
Initialize the decomposition.
void init_decomposition_gr_cell(Box< dim, St > &box, const size_t(&bc)[dim], const Ghost< dim, St > &g, size_t opt, const grid_sm< dim, void > &gdist)
Initialize the decomposition.
Decomposition dec
Domain decomposition.
void map_list_(openfpm::vector< Point< dim, St > > &v_pos, openfpm::vector< prop > &v_prp, size_t &g_m, size_t opt)
It move all the particles that does not belong to the local processor to the respective processor.
void ghost_put_(openfpm::vector< Point< dim, St >, Memory, layout_base > &v_pos, openfpm::vector< prop, Memory, layout_base > &v_prp, size_t &g_m, size_t opt)
Ghost put.
void ghost_wait_(openfpm::vector< Point< dim, St >, Memory, layout_base > &v_pos, openfpm::vector< prop, Memory, layout_base > &v_prp, size_t &g_m, size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
Vcluster< Memory > & v_cl
VCluster.
Decomposition & getDecomposition()
Get the decomposition.
void setDecompositionGranularity(size_t n_sub)
Set the minimum number of sub-domain per processor.
void ghost_get_(openfpm::vector< Point< dim, St >, Memory, layout_base > &v_pos, openfpm::vector< prop, Memory, layout_base > &v_prp, size_t &g_m, size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
Iterator that Iterate across particle indexes.
This class contain a list of all tracked vector_dist_ker around.
void update(const int &v)
Update the addresses of all vector_dist_kernels around.
void remove(size_t key)
Remove one element from the distributed vector.
auto getLastPropWrite() -> decltype(v_prp.template get< id >(0))
Get the property of the last element.
size_t g_m
Ghost marker, all the particle with id > g_m are ghost all with g_m < are real particle.
void updateVerlet(VerletList< dim, St, Mem_type, shift< dim, St > > &ver, St r_cut, size_t opt=VL_NON_SYMMETRIC)
for each particle get the verlet list
auto getPropWrite(vect_dist_key_dx vec_key) -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
grid_key_dx< dim > getCRSStart(Celllist &NN)
Return from which cell we have to start in case of CRS interation scheme.
size_t size_local() const
return the local size of the vector
CellL getCellListSym(const size_t(&div)[dim], const size_t(&pad)[dim])
Construct a cell list symmetric based on a cut of radius.
auto getDomainIteratorDevice(size_t n_thr=default_kernel_wg_threads_) const -> decltype(this->getDomainIterator())
Get an iterator that traverse the particles in the domain.
auto getLastPosRead() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element.
void remove(openfpm::vector< size_t > &keys, size_t start=0)
Remove a set of elements from the distributed vector.
bool write_frame(std::string out, size_t iteration, int opt=VTK_WRITER)
Output particle position and properties.
void getCellListParams(St r_cut, size_t(&div)[dim], Box< dim, St > &box, Ghost< dim, St > enlarge=Ghost< dim, St >(0.0))
Get the Celllist parameters.
void resize(size_t rs)
Resize the vector (locally)
auto getProp(vect_dist_key_dx vec_key) -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
const vector_dist_prop & getPropVector() const
return the property vector of all the particles
vector_dist_prop & getPropVectorSort()
return the property vector of all the particles
grid_dist_id_iterator_dec< Decomposition > getGridIterator(const size_t(&sz)[dim])
grid_key_dx< dim > getCRSStop(Celllist &NN)
Return from which cell we have to stop in case of CRS interation scheme.
auto getLastProp() -> decltype(v_prp.template get< id >(0))
Get the property of the last element.
static const unsigned int dims
template parameters typedefs
vector_dist< dim, St, prop, Decomposition, Memory, layout_base > self
Self type.
auto getPropNC(size_t vec_key) -> decltype(v_prp.template get< id >(vec_key))
Get the property of an element.
auto getPosRead(vect_dist_key_dx vec_key) const -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
void Ighost_get(size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
size_t init_size_accum(size_t np)
It return the number of particles contained by the previous processors.
void check_parameters(Box< dim, St > &box)
Check if the parameters describe a valid vector. In case it does not report an error.
bool isSubset() const
Indicate that this class is not a subset.
size_t size_local_with_ghost() const
return the local size of the vector
auto getProp(size_t vec_key) -> decltype(v_prp.template get< id >(vec_key))
Get the property of an element.
void deviceToHostPos()
Move the memory from the device to host memory.
auto getPosOrig(size_t vec_key) -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
void init_structures(size_t np)
Initialize the structures.
void check_ghost_compatible_rcut(St r_cut)
It check that the r_cut is not bugger than the ghost.
vector_dist_iterator getDomainIterator_no_se3() const
Get an iterator that traverse the particles in the domain.
auto getPos(size_t vec_key) const -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
vector_dist< dim, St, prop, Decomposition, Memory, layout_base > & operator=(const vector_dist< dim, St, prop, Decomposition, Memory, layout_base > &v)
Operator= for distributed vector.
int yes_i_am_vector_dist
yes I am vector dist
void setCapacity(unsigned int ns)
Reserve space for the internal vectors.
vector_dist_pos & getPosVector()
return the position vector of all the particles
void updateCellList(CellL &cell_list, bool no_se3=false, cl_construct_opt opt=cl_construct_opt::Full)
Update a cell list using the stored particles.
vector_dist_iterator getDomainAndGhostIterator_no_se3() const
Get an iterator that traverse the particles in the domain.
auto getPosNC(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
void setPropNames(const openfpm::vector< std::string > &names)
Set the properties names.
openfpm::vector_key_iterator_seq< typename vrl::Mem_type_type::local_index_type > getParticleIteratorCRS(vrl &NN)
Get a special particle iterator able to iterate across particles using symmetric crossing scheme.
VerletL getVerlet(St r_cut)
for each particle get the verlet list
cell_list_selector< self, impl >::ctype getCellListDev(St r_cut)
Construct a cell list starting from the stored particles.
vector_dist_iterator getGhostIterator() const
Get the iterator across the position of the ghost particles.
auto getPos(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
CellL getCellList(St r_cut, const Ghost< dim, St > &enlarge, bool no_se3=false)
Construct a cell list starting from the stored particles.
auto getCellListDevice(St r_cut, bool no_se3=false) -> decltype(this->getCellList(r_cut, no_se3))
Construct a cell list from the stored particles.
long int who()
It return the id of structure in the allocation list.
bool write_frame(std::string out, size_t iteration, double time, int opt=VTK_WRITER)
Output particle position and properties and add a time stamp to pvtp.
CellL getCellList_hilb(St r_cut, const Ghost< dim, St > &enlarge)
Construct an hilbert cell list starting from the stored particles.
void map_list(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor.
vector_dist_prop & getPropVector()
return the property vector of all the particles
size_t opt
option used to create this vector
std::integral_constant< bool, false > is_it_a_subset
yes I am vector subset dist
auto getProp(vect_dist_key_dx vec_key) const -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
void reorder(int32_t m, const Ghost< dim, St > &enlarge, reorder_opt opt=reorder_opt::HILBERT)
Construct a cell list starting from the stored particles and reorder a vector according to the Hilber...
void addAtEnd()
Add at the END of local and ghost particle.
openfpm::vector< std::string > prp_names
Name of the properties.
auto getPosNC(vect_dist_key_dx vec_key) const -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
auto getPropNC(vect_dist_key_dx vec_key) const -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
ParticleItCRS_Cells< dim, cli, decltype(v_pos)> getParticleIteratorCRS_Cell(cli &NN)
Get a special particle iterator able to iterate across particles using symmetric crossing scheme.
CellL getCellList(St r_cut, bool no_se3=false)
Construct a cell list starting from the stored particles.
void ghost_wait(size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
vector_dist_iterator getDomainIterator() const
Get an iterator that traverse the particles in the domain.
vector_dist(const Decomposition &dec, size_t np)
Constructor with predefined decomposition.
bool write(std::string out, std::string meta_info, int opt=VTK_WRITER)
Output particle position and properties.
void ghost_get(size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
auto getPropNC(vect_dist_key_dx vec_key) -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
void setReferenceCounterToOne()
CellL getCellList_hilb(St r_cut)
Construct an hilbert cell list starting from the stored particles.
vector_dist_iterator getIterator(size_t start, size_t stop)
Get an iterator that traverse domain and ghost particles.
void finalizeComputationCosts(Model md=Model(), size_t ts=1)
Add the computation cost on the decomposition coming from the particles.
auto getLastPosWrite() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element.
void hostToDevicePos()
Move the memory from the device to host memory.
void map(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor.
auto getLastPosEnd() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element after ghost.
void ghost_put(size_t opt_=NONE)
It synchronize the properties and position of the ghost particles.
vector_dist_iterator getIterator()
Get an iterator that traverse domain and ghost particles.
size_t accum()
It return the sum of the particles in the previous processors.
auto getPos(size_t vec_key) -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
auto getPosNC(size_t vec_key) -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
const vector_dist_pos & getPosVector() const
return the position vector of all the particles
ParticleIt_Cells< dim, CellList > getDomainIteratorCells(CellList &NN)
Get an iterator that traverse the particles in the domain using a cell list.
CellL getCellListSym(St r_cut)
Construct a cell list symmetric based on a cut of radius.
void initializeComputationCosts()
Initialize the computational cost.
bool write_frame(std::string out, size_t iteration, std::string meta_info, int opt=VTK_WRITER)
Output particle position and properties.
const vector_dist_prop & getPropVectorSort() const
return the property vector of all the particles
void clear()
remove all the elements
const vector_dist_pos & getPosVectorSort() const
return the position vector of all the particles
bool write(std::string out, int opt=VTK_WRITER)
Output particle position and properties.
void reorder_rcut(St r_cut)
Construct a cell list starting from the stored particles and reorder a vector according to the Hilber...
VerletL getVerletSym(St r_cut)
for each particle get the symmetric verlet list
auto getLastPos() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element.
VerletL getVerletCrs(St r_cut)
for each particle get the symmetric verlet list
openfpm::vector< std::string > & getPropNames()
Get the properties names.
auto getPosOrig(vect_dist_key_dx vec_key) const -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
void reorder(int32_t m, reorder_opt opt=reorder_opt::HILBERT)
Construct a cell list starting from the stored particles and reorder a vector according to the Hilber...
void deviceToHostProp()
Move the memory from the device to host memory.
auto getProp(size_t vec_key) const -> decltype(v_prp.template get< id >(vec_key))
Get the property of an element.
auto getPosWrite(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
vector_dist_iterator getDomainAndGhostIterator() const
Get an iterator that traverse the particles in the domain.
void save(const std::string &filename) const
Save the distributed vector on HDF5 file.
Vcluster< Memory > & getVC()
Get the Virtual Cluster machine.
vector_dist_iterator getGhostIterator_no_se3() const
Get the iterator across the position of the ghost particles.
vector_dist< dim, St, prop, Decomposition, Memory, layout_base > & operator=(vector_dist< dim, St, prop, Decomposition, Memory, layout_base > &&v)
Operator= for distributed vector.
vector_dist(const vector_dist< dim, St, prop, Decomposition, Memory, layout_base > &v)
Copy Constructor.
void add()
Add local particle.
vector_dist_prop v_prp_out
reordered v_pos buffer
void hostToDeviceProp()
Move the memory from the device to host memory.
const Decomposition & getDecomposition() const
Get the decomposition.
void addComputationCosts(Model md=Model(), size_t ts=1)
Add the computation cost on the decomposition coming from the particles.
auto getPos(vect_dist_key_dx vec_key) const -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
void load(const std::string &filename)
Load the distributed vector from an HDF5 file.
vector_dist(size_t np, Box< dim, St > box, const size_t(&bc)[dim], const Ghost< dim, St > &g, const grid_sm< dim, void > &gdist)
Constructor of a distributed vector.
void addComputationCosts(const self &vd, Model md=Model())
Add the computation cost on the decomposition coming from the particles.
auto getPosNC(size_t vec_key) const -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
void reorder_sfc(openfpm::vector< Point< dim, St > > &v_pos_dest, openfpm::vector< prop > &v_prp_dest, sfc_it &h_it, CellL &cell_list)
Reorder based on hilbert space filling curve.
vector_dist_pos v_pos_out
reordered v_prp buffer
vector_dist(vector_dist< dim, St, prop, Decomposition, Memory, layout_base > &&v) noexcept
Copy constructor.
vector_dist_pos & getPosVectorSort()
return the position vector of all the particles
void remove(openfpm::vector< aggregate< int > > &keys, size_t start=0)
Remove a set of elements from the distributed vector.
vector_dist(size_t np, Box< dim, St > box, const size_t(&bc)[dim], const Ghost< dim, St > &g, size_t opt=0, const grid_sm< dim, void > &gdist=grid_sm< dim, void >())
Constructor of a distributed vector.
void ghost_get_subset()
Stub does not do anything.
void deleteGhost()
Delete the particles on the ghost.
auto getPropRead(vect_dist_key_dx vec_key) const -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
size_t size_local_orig() const
return the local size of the vector
void updateCellListSym(CellL &cell_list)
Update a cell list using the stored particles.
auto getPropNC(size_t vec_key) const -> decltype(v_prp.template get< id >(vec_key))
Get the property of an element.
auto getLastPropRead() -> decltype(v_prp.template get< id >(0))
Get the property of the last element.
Decomposition & getDecomposition()
Get the decomposition.
void resizeAtEnd(size_t rs)
Resize the vector at the end of the ghost (locally)
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
boost::fusion::vector< list... > type
internal type containing the data
decrement_memory(vector_type &v)
constructor
void operator()(T &t) const
It call the copy function for each property.
static CellL get(Vector &vd, const St &r_cut, const Ghost< dim, St > &g)
Get the Cell list based on the type.
static CellL get(Vector &vd, const St &r_cut, const Ghost< dim, St > &g)
Get the Cell list based on the type.
General function t get a cell-list.
static CellL get(Vector &vd, const size_t(&div)[dim], const size_t(&pad)[dim], const Ghost< dim, St > &g)
Get the Cell list based on the type.
General function t get a cell-list.
static CellL get(Vector &vd, const St &r_cut, const Ghost< dim, St > &g)
Get the Cell list based on the type.
Check this is a gpu or cpu type cell-list.
Transform the boost::fusion::vector into memory specification (memory_traits)