11 #include "HDF5_wr/HDF5_wr.hpp"
12 #include "VCluster/VCluster.hpp"
13 #include "Space/Shape/Point.hpp"
14 #include "Vector/Iterators/vector_dist_iterator.hpp"
15 #include "Space/Shape/Box.hpp"
16 #include "Vector/vector_dist_key.hpp"
17 #include "memory/PtrMemory.hpp"
18 #include "NN/CellList/CellList.hpp"
19 #include "NN/CellList/CellListFast_gen.hpp"
20 #include "util/common.hpp"
21 #include "util/object_util.hpp"
22 #include "memory/ExtPreAlloc.hpp"
23 #include "CSVWriter/CSVWriter.hpp"
24 #include "VTKWriter/VTKWriter.hpp"
25 #include "Decomposition/common.hpp"
26 #include "Grid/Iterators/grid_dist_id_iterator_dec.hpp"
27 #include "Grid/grid_key_dx_iterator_hilbert.hpp"
28 #include "Vector/vector_dist_ofb.hpp"
29 #include "Decomposition/CartDecomposition.hpp"
30 #include "data_type/aggregate.hpp"
31 #include "NN/VerletList/VerletList.hpp"
32 #include "vector_dist_comm.hpp"
33 #include "DLB/LB_Model.hpp"
34 #include "Vector/vector_map_iterator.hpp"
35 #include "NN/CellList/ParticleIt_Cells.hpp"
36 #include "NN/CellList/ProcKeys.hpp"
38 #define DEC_GRAN(gr) ((size_t)gr << 32)
40 #define VECTOR_DIST_ERROR_OBJECT std::runtime_error("Runtime vector distributed error");
43 #include "se_class3_vector.hpp"
47 #define SE_CLASS3_VDIST_CONSTRUCTOR ,se3(getDecomposition(),*this)
49 #define SE_CLASS3_VDIST_CONSTRUCTOR
64 #define GCL_NON_SYMMETRIC 0
65 #define GCL_SYMMETRIC 1
70 template<
unsigned int dim,
typename St,
typename CellL,
typename Vector,
unsigned int impl>
84 return vd.template getCellList<CellL>(r_cut);
89 template<
unsigned int dim,
typename St,
typename CellL,
typename Vector>
103 return vd.getCellList_hilb(r_cut,g);
108 template<
unsigned int dim,
typename St,
typename CellL,
typename Vector>
122 return vd.getCellListSym(r_cut);
129 template<
unsigned int dim,
typename St,
typename CellL,
typename Vector,
unsigned int impl>
141 static inline CellL
get(
Vector & vd,
const size_t (& div)[dim],
const size_t (& pad)[dim],
const Ghost<dim,St> & g)
143 return vd.template getCellListSym<CellL>(div,pad);
147 #define CELL_MEMFAST(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St> >
148 #define CELL_MEMBAL(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_bal<>, shift<dim, St> >
149 #define CELL_MEMMW(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_mw<>, shift<dim, St> >
151 #define CELL_MEMFAST_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_fast<>, shift<dim, St> >
152 #define CELL_MEMBAL_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_bal<>, shift<dim, St> >
153 #define CELL_MEMMW_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_mw<>, shift<dim, St> >
155 #define VERLET_MEMFAST(dim,St) VerletList<dim,St,Mem_fast<>,shift<dim,St> >
156 #define VERLET_MEMBAL(dim,St) VerletList<dim,St,Mem_bal<>,shift<dim,St> >
157 #define VERLET_MEMMW(dim,St) VerletList<dim,St,Mem_mw<>,shift<dim,St> >
159 #define VERLET_MEMFAST_INT(dim,St) VerletList<dim,St,Mem_fast<unsigned int>,shift<dim,St> >
160 #define VERLET_MEMBAL_INT(dim,St) VerletList<dim,St,Mem_bal<unsigned int>,shift<dim,St> >
161 #define VERLET_MEMMW_INT(dim,St) VerletList<dim,St,Mem_mw<unsigned int>,shift<dim,St> >
195 template<
unsigned int dim,
276 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the domain is not valid " << box.
toString() << std::endl;
277 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
289 for (
size_t i = 0 ; i < dim ; i++)
293 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;
294 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
307 template<
typename CellL,
typename sfc_it>
321 for (
size_t i = 0; i < dim ; i++)
322 {ksum.
set_d(i,cell_list.getPadding(i));}
324 while (h_it.isNext())
326 auto key = h_it.get();
329 size_t lin = cell_list.getGrid().LinId(
key);
332 for (
size_t i = 0; i < cell_list.getNelements(lin); i++)
335 auto v = cell_list.get(lin,i);
336 v_pos_dest.get(count) =
v_pos.get(v);
337 v_prp_dest.get(count) =
v_prp.get(v);
351 static const unsigned int dims = dim;
360 vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> &
operator=(
const vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> & v)
362 static_cast<vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> *
>(
this)->
operator=(
static_cast<vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory>>(v));
384 vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> &
operator=(
vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> && v)
386 static_cast<vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> *
>(
this)->
operator=(
static_cast<vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> >(v));
411 check_new(
this,8,VECTOR_DIST_EVENT,4);
423 :
v_cl(v.
v_cl) SE_CLASS3_VDIST_CONSTRUCTOR
426 check_new(
this,8,VECTOR_DIST_EVENT,4);
443 vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory>(dec),
v_cl(create_vcluster()) SE_CLASS3_VDIST_CONSTRUCTOR
446 check_new(
this,8,VECTOR_DIST_EVENT,4);
470 :
v_cl(create_vcluster()),
opt(
opt) SE_CLASS3_VDIST_CONSTRUCTOR
473 check_new(
this,8,VECTOR_DIST_EVENT,4);
525 #ifndef ONLY_READWRITE_GETTER
539 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key.getKey());
542 return v_pos.template get<0>(vec_key.getKey());
557 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key.getKey());
559 return v_pos.template get<0>(vec_key.getKey());
571 inline auto getPos(
size_t vec_key) -> decltype(
v_pos.template get<0>(vec_key))
574 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key);
576 return v_pos.template get<0>(vec_key);
588 inline auto getPos(
size_t vec_key)
const -> decltype(
v_pos.template get<0>(vec_key))
591 check_for_pos_nan_inf<prop::max_prop_real,prop::max_prop>(*
this,vec_key);
593 return v_pos.template get<0>(vec_key);
609 check_for_prop_nan_inf<id,prop::max_prop+SE3_STATUS>(*
this,vec_key.getKey());
611 return v_prp.template get<id>(vec_key.getKey());
627 check_for_prop_nan_inf<id,prop::max_prop+SE3_STATUS>(*
this,vec_key.getKey());
629 return v_prp.template get<id>(vec_key.getKey());
642 template<
unsigned int id>
inline auto getProp(
size_t vec_key) -> decltype(
v_prp.template get<id>(vec_key))
645 check_for_prop_nan_inf<id,prop::max_prop+SE3_STATUS>(*
this,vec_key);
647 return v_prp.template get<id>(vec_key);
660 template<
unsigned int id>
inline auto getProp(
size_t vec_key)
const -> decltype(
v_prp.template get<id>(vec_key))
663 check_for_prop_nan_inf<id,prop::max_prop+SE3_STATUS>(*
this,vec_key);
665 return v_prp.template get<id>(vec_key);
683 return v_pos.template get<0>(vec_key.getKey());
697 return v_pos.template get<0>(vec_key.getKey());
709 inline auto getPosNC(
size_t vec_key) -> decltype(
v_pos.template get<0>(vec_key))
711 return v_pos.template get<0>(vec_key);
723 inline auto getPosNC(
size_t vec_key)
const -> decltype(
v_pos.template get<0>(vec_key))
725 return v_pos.template get<0>(vec_key);
740 return v_prp.template get<id>(vec_key.getKey());
755 return v_prp.template get<id>(vec_key.getKey());
768 template<
unsigned int id>
inline auto getPropNC(
size_t vec_key) -> decltype(
v_prp.template get<id>(vec_key))
770 return v_prp.template get<id>(vec_key);
783 template<
unsigned int id>
inline auto getPropNC(
size_t vec_key)
const -> decltype(
v_prp.template get<id>(vec_key))
785 return v_prp.template get<id>(vec_key);
802 se3.template write<prop::max_prop_real>(*
this,vec_key.getKey());
805 return v_pos.template get<0>(vec_key.getKey());
820 se3.template read<prop::max_prop_real>(*
this,vec_key.getKey());
823 return v_pos.template get<0>(vec_key.getKey());
839 se3.template write<id>(*
this,vec_key.getKey());
842 return v_prp.template get<id>(vec_key.getKey());
858 se3.template read<id>(*
this,vec_key.getKey());
861 return v_prp.template get<id>(vec_key.getKey());
882 for (
size_t i = 0 ; i < prop::max_prop_real+1 ; i++)
883 v_prp.template get<prop::max_prop_real>(
g_m-1)[i] = UNINITIALIZED;
887 #ifndef ONLY_READWRITE_GETTER
896 return v_pos.template get<0>(
g_m - 1);
908 return v_prp.template get<id>(
g_m - 1);
923 se3.template read<prop::max_prop_real>(*
this,
g_m-1);
926 return v_pos.template get<0>(
g_m - 1);
939 se3.read<
id>(*
this,
g_m-1);
942 return v_prp.template get<id>(
g_m - 1);
954 se3.template write<prop::max_prop_real>(*
this,
g_m-1);
957 return v_pos.template get<0>(
g_m - 1);
970 se3.template write<id>(*
this,
g_m-1);
973 return v_prp.template get<id>(
g_m - 1);
987 template<
typename CellL = CellList<dim, St, Mem_fast<>, shift<dim, St> > > CellL
getCellListSym(St r_cut)
990 if (!(
opt & BIND_DEC_TO_GHOST))
994 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;
995 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1004 CellDecomposer_sm<dim,St,shift<dim,St>> cd_sm;
1012 cell_list.Initialize(cd_sm,pbox,pad);
1029 template<
typename CellL = CellList<dim, St, Mem_fast<>, shift<dim, St> > >
1031 const size_t (& pad)[dim])
1034 if (!(
opt & BIND_DEC_TO_GHOST))
1038 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;
1039 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1044 size_t pad_max = pad[0];
1045 for (
size_t i = 1 ; i < dim ; i++)
1046 {
if (pad[i] > pad_max) {pad_max = pad[i];}}
1051 CellDecomposer_sm<dim,St,shift<dim,St>> cd_sm;
1059 cell_list.Initialize(cd_sm,pbox,pad_max);
1077 template<
typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St> > >
1081 if (no_se3 ==
false)
1092 return getCellList<CellL>(r_cut, g,no_se3);
1104 template<
typename CellL = CellList_gen<dim, St, Process_keys_hilb, Mem_fast<>, shift<dim, St> > >
1132 if (no_se3 ==
false)
1139 for (
size_t i = 0 ; i < dim ; i++)
1140 {r_cut = std::max(r_cut,cell_list.getCellBox().getHigh(i));}
1144 bool to_reconstruct = cell_list.get_ndec() !=
getDecomposition().get_ndec();
1146 if (to_reconstruct ==
false)
1148 populate_cell_list(
v_pos,cell_list,
g_m,CL_NON_SYMMETRIC);
1150 cell_list.set_gm(
g_m);
1156 cell_list.swap(cli_tmp);
1167 template<
typename CellL = CellList<dim, St, Mem_fast<>, shift<dim, St> > >
1176 bool to_reconstruct = cell_list.get_ndec() !=
getDecomposition().get_ndec();
1178 if (to_reconstruct ==
false)
1180 populate_cell_list(
v_pos,cell_list,
g_m,CL_SYMMETRIC);
1182 cell_list.set_gm(
g_m);
1187 cell_list.getDivWP(),
1188 cell_list.getPadding(),
1191 cell_list.swap(cli_tmp);
1211 template<
typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St> > >
1215 if (no_se3 ==
false)
1228 cl_param_calculate(pbox, div, r_cut, enlarge);
1230 cell_list.Initialize(pbox, div);
1231 cell_list.set_gm(
g_m);
1269 cl_param_calculate(pbox,div, r_cut, enlarge);
1271 cell_list.Initialize(pbox, div);
1272 cell_list.set_gm(
g_m);
1287 template <
typename VerletL = VerletList<dim,St,Mem_fast<>,shift<dim,St> >>
1313 template <
typename VerletL = VerletList<dim,St,Mem_fast<>,shift<dim,St> >>
1317 if (!(
opt & BIND_DEC_TO_GHOST))
1319 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;
1320 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1337 auto & NN = ver.getInternalCellList();
1343 for (
size_t i = 0 ; i < dim ; i++)
1344 shift.
set_d(i,NN.getPadding(i));
1350 ver.createVerletCrs(r_cut,
g_m,
v_pos,
1366 template <
typename VerletL = VerletList<dim,St,Mem_fast<>,shift<dim,St> >>
1406 if (
opt == VL_SYMMETRIC)
1408 auto & NN = ver.getInternalCellList();
1414 if (to_reconstruct ==
false)
1420 ver_tmp = getVerlet<VerletList<dim,St,Mem_type,shift<dim,St> >>(r_cut);
1424 else if (
opt == VL_CRS_SYMMETRIC)
1427 if ((
opt & BIND_DEC_TO_GHOST))
1429 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;
1430 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1434 auto & NN = ver.getInternalCellList();
1440 if (to_reconstruct ==
false)
1446 for (
size_t i = 0 ; i < dim ; i++)
1447 shift.
set_d(i,NN.getPadding(i));
1461 ver_tmp = getVerletCrs<VerletList<dim,St,Mem_type,shift<dim,St> >>(r_cut);
1467 auto & NN = ver.getInternalCellList();
1473 if (to_reconstruct ==
false)
1479 ver_tmp = getVerlet<VerletList<dim,St,Mem_type,shift<dim,St> >>(r_cut);
1493 template<
typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_bal<>,shift<dim,St> > >
1512 template<
typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_bal<>,shift<dim,St> > >
1532 for (
size_t i = 0 ; i < dim ; i++)
1537 cell_list.Initialize(pbox,div);
1538 cell_list.set_gm(
g_m);
1546 auto key = it.get();
1550 cell_list.add(xp,
key.getKey());
1561 if (
opt == reorder_opt::HILBERT)
1565 reorder_sfc<CellL,grid_key_dx_iterator_hilbert<dim>>(v_pos_dest,v_prp_dest,h_it,cell_list);
1567 else if (
opt == reorder_opt::LINEAR)
1572 reorder_sfc<CellL,grid_key_dx_iterator<dim>>(v_pos_dest,v_prp_dest,h_it,cell_list);
1577 v_pos.swap(v_pos_dest);
1578 v_prp.swap(v_prp_dest);
1581 v_pos.swap(v_pos_dest);
1582 v_prp.swap(v_prp_dest);
1647 for (
size_t i = 0; i < dim; i++)
1650 stop.
set_d(i, sz[i] - 1);
1700 for (
size_t i = 0 ; i < dim ; i++)
1814 template<
typename obp = KillParticle>
void map(
size_t opt = NONE)
1839 std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error the processor " <<
v_cl.
getProcessUnitID() <<
" has particles, but is supposed to be unloaded" << std::endl;
1840 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
1845 se3.template ghost_get_pre<prp...>(
opt);
1852 this->
template ghost_get_<prop::max_prop_real>(
v_pos,
v_prp,
g_m,
opt | KEEP_PROPERTIES);
1854 se3.template ghost_get_post<prp...>(
opt);
1869 template<
template<
typename,
typename>
class op,
int ... prp>
inline void ghost_put(
size_t opt_ = NONE)
1887 v_pos.remove(keys, start);
1888 v_prp.remove(keys, start);
1915 CellDecomposer_sm<dim, St, shift<dim,St>> cdsm;
1919 cdsm.setDimensions(dec.getDomain(), dec.getDistGrid().getSize(), 0);
1921 auto it = vd.getDomainIterator();
1925 size_t v = cdsm.getCell(vd.getPos(it.get()));
1927 md.addComputation(dec,vd,v,it.get().getKey());
1946 dec.computeCommunicationAndMigrationCosts(ts);
1950 for (
size_t i = 0 ; i < dist.getNOwnerSubSubDomains(); i++)
1951 {md.applyModel(dec,dist.getOwnerSubSubDomain(i));}
1953 dist.setDistTol(md.distributionTol());
1964 for (
size_t i = 0; i < dist.getNOwnerSubSubDomains() ; i++)
1965 {dec.setSubSubDomainComputationCost(dist.getOwnerSubSubDomain(i) , 1);}
1990 inline void save(
const std::string & filename)
const
2002 inline void load(
const std::string & filename)
2018 inline bool write(std::string out,
int opt = VTK_WRITER)
2021 if ((
opt & 0x0FFF0000) == CSV_WRITER)
2026 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.
getProcessUnitID()) + std::to_string(
".csv"));
2033 file_type ft = file_type::ASCII;
2035 if (
opt & FORMAT_BINARY)
2036 ft = file_type::BINARY;
2042 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.
getProcessUnitID()) + std::to_string(
".vtk"));
2045 return vtk_writer.write(output,
prp_names,
"particles",ft);
2090 if ((
opt & 0x0FFF0000) == CSV_WRITER)
2095 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.
getProcessUnitID()) +
"_" + std::to_string(iteration) + std::to_string(
".csv"));
2102 file_type ft = file_type::ASCII;
2104 if (
opt & FORMAT_BINARY)
2105 ft = file_type::BINARY;
2111 std::string output = std::to_string(out +
"_" + std::to_string(
v_cl.
getProcessUnitID()) +
"_" + std::to_string(iteration) + std::to_string(
".vtk"));
2114 return vtk_writer.write(output,
prp_names,
"particles",ft);
2136 cl_param_calculate(pbox, div,r_cut,enlarge);
2152 return check_whoami(
this,8);
2167 check_valid(
this,8);
2229 {sz += accu.get(i);}
2249 if (!(
opt & BIND_DEC_TO_GHOST))
2251 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;
2252 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
2260 for (
size_t i = 0 ; i < dim ; i++)
2261 shift.
set_d(i,NN.getPadding(i));
2296 if (!(
opt & BIND_DEC_TO_GHOST))
2298 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;
2299 ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
2317 return NN.getStartDomainCell();
2332 for (
size_t i = 0 ; i < dim ; i++)
size_t accum()
It return the sum of the particles in the previous processors.
openfpm::vector< prop > & getPropVector()
return the property vector of all the particles
VerletL getVerlet(St r_cut)
for each particle get the verlet list
openfpm::vector< prop, Memory, layout, layout_base > v_prp
auto getPropNC(vect_dist_key_dx vec_key) const -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
Transform the boost::fusion::vector into memory specification (memory_traits)
auto getProp(vect_dist_key_dx vec_key) -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
vector_dist_iterator getDomainAndGhostIterator() const
Get an iterator that traverse the particles in the domain.
auto getPosRead(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) -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
auto getPropNC(size_t vec_key) const -> decltype(v_prp.template get< id >(vec_key))
Get the property of an element.
openfpm::vector_key_iterator_seq< typename vrl::Mem_type_type::loc_index > getParticleIteratorCRS(vrl &NN)
Get a special particle iterator able to iterate across particles using symmetric crossing scheme...
bool isValid() const
Check if the Box is a valid box P2 >= P1.
grid_key_dx is the key to access any element in the grid
size_t getProcessUnitID()
Get the process unit id.
grid_key_dx< dim > getCRSStop(Celllist &NN)
Return from which cell we have to stop in case of CRS interation scheme.
void execute()
Execute all the requests.
void init_structures(size_t np)
Initialize the structures.
Sparse Matrix implementation stub object when OpenFPM is compiled with no linear algebra support...
Class for Verlet list implementation.
auto getLastProp() -> decltype(v_prp.template get< id >(0))
Get the property of the last element.
bool write_frame(std::string out, size_t iteration, int opt=VTK_WRITER)
Output particle position and properties.
auto getPosNC(size_t vec_key) const -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
auto getLastPropRead() -> decltype(v_prp.template get< id >(0))
Get the property of the last element.
auto getPos(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
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.
auto getPropNC(size_t vec_key) -> decltype(v_prp.template get< id >(vec_key))
Get the property of an element.
void magnify(T mg)
Magnify the box.
size_t size_local_with_ghost() const
return the local size of the vector
CellL getCellList_hilb(St r_cut, const Ghost< dim, St > &enlarge)
Construct an hilbert cell list starting from the stored particles.
Given the decomposition it create an iterator.
CellL getCellList(St r_cut, bool no_se3=false)
Construct a cell list starting from the stored particles.
void setDecompositionGranularity(size_t n_sub)
Set the minimum number of sub-domain per processor.
Iterator that Iterate across particle indexes.
void check_ghost_compatible_rcut(St r_cut)
It check that the r_cut is not bugger than the ghost.
const Decomposition & getDecomposition() const
Get the decomposition.
size_t g_m
Ghost marker, all the particle with id > g_m are ghost all with g_m < are real particle.
Decomposition & getDecomposition()
Get the decomposition.
VerletL getVerletCrs(St r_cut)
for each particle get the symmetric verlet list
CellL getCellList_hilb(St r_cut)
Construct an hilbert cell list starting from the stored particles.
This class implement the point shape in an N-dimensional space.
Grid key for a distributed grid.
openfpm::vector< Point< dim, St > > & getPosVector()
return the position vector of all the particles
vector_dist_iterator getGhostIterator() const
Get the iterator across the position of the ghost particles.
long int who()
It return the id of structure in the allocation list.
void deleteGhost()
Delete the particles on the ghost.
grid_key_dx< dim > getCRSStart(Celllist &NN)
Return from which cell we have to start in case of CRS interation scheme.
VerletL getVerletSym(St r_cut)
for each particle get the symmetric verlet list
grid_dist_id_iterator_dec< Decomposition > getGridIterator(const size_t(&sz)[dim])
Decomposition dec
Domain decomposition.
This class allocate, and destroy CPU memory.
This iterator iterate across the particles of a Cell-list following the Cell structure.
vector_dist< dim, St, prop, layout, layout_base, Decomposition, Memory > & operator=(const vector_dist< dim, St, prop, layout, layout_base, Decomposition, Memory > &v)
Operator= for distributed vector.
void save(const std::string &filename) const
Save the distributed vector on HDF5 file.
void finalizeComputationCosts(Model md=Model(), size_t ts=1)
Add the computation cost on the decomposition coming from the particles.
mem_id get(size_t i) const
Get the i index.
void updateCellList(CellL &cell_list, bool no_se3=false)
Update a cell list using the stored particles.
Implementation of VCluster class.
auto getProp(size_t vec_key) -> decltype(v_prp.template get< id >(vec_key))
Get the property of an element.
auto getPropRead(vect_dist_key_dx vec_key) const -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
This class define the domain decomposition interface.
size_t init_size_accum(size_t np)
It return the number of particles contained by the previous processors.
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 ghost_put(size_t opt_=NONE)
It synchronize the properties and position of the ghost particles.
vector_dist_iterator getDomainAndGhostIterator_no_se3() const
Get an iterator that traverse the particles in the domain.
auto getLastPosWrite() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element.
ParticleIt_Cells< dim, CellList > getDomainIteratorCells(CellList &NN)
Get an iterator that traverse the particles in the domain using a cell list.
bool write(std::string file, v_pos &v, v_prp &prp, size_t offset=0)
It write a CSV file.
This class decompose a space into sub-sub-domains and distribute them across processors.
auto getLastPosRead() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element.
vector_dist(const vector_dist< dim, St, prop, layout, layout_base, Decomposition, Memory > &v)
Copy Constructor.
Decomposition & getDecomposition()
Get the decomposition.
auto getPosNC(size_t vec_key) -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
void initializeComputationCosts()
Initialize the computational cost.
auto getPos(size_t vec_key) const -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
CellL getCellListSym(const size_t(&div)[dim], const size_t(&pad)[dim])
Construct a cell list symmetric based on a cut of radius.
vector_dist_iterator getGhostIterator_no_se3() const
Get the iterator across the position of the ghost particles.
void enlarge(const Box< dim, T > &gh)
Enlarge the box with ghost margin.
This class check for inconsistency access.
vector_dist(vector_dist< dim, St, prop, layout, layout_base, Decomposition, Memory > &&v) noexcept
Copy constructor.
void addComputationCosts(Model md=Model(), size_t ts=1)
Add the computation cost on the decomposition coming from the particles.
General function t get a cell-list.
vector_dist< dim, St, prop, layout, layout_base, Decomposition, Memory > & operator=(vector_dist< dim, St, prop, layout, layout_base, Decomposition, Memory > &&v)
Operator= for distributed vector.
void clear()
remove all the elements
size_t getPadding(size_t i) const
Return the number of padding cells of the Cell decomposer.
size_t size_local() const
return the local size of the 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.
openfpm::vector< Point< dim, St >, Memory > v_pos
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
This class is an helper for the communication of vector_dist.
General function t get a cell-list.
void addComputationCosts(const self &vd, Model md=Model())
Add the computation cost on the decomposition coming from the particles.
void map(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor...
auto getPosNC(vect_dist_key_dx vec_key) const -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
void ghost_get(size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
bool write(std::string out, int opt=VTK_WRITER)
Output particle position and properties.
void add()
Add local particle.
vector_dist(const Decomposition &dec, size_t np)
Constructor with predefined decomposition.
auto getPosWrite(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
This class is a trick to indicate the compiler a specific specialization pattern. ...
auto getLastPropWrite() -> decltype(v_prp.template get< id >(0))
Get the property of the last element.
CellL getCellList(St r_cut, const Ghost< dim, St > &enlarge, bool no_se3=false)
Construct a cell list starting from the stored particles.
ParticleItCRS_Cells< dim, cli > getParticleIteratorCRS_Cell(cli &NN)
Get a special particle iterator able to iterate across particles using symmetric crossing scheme...
void map_list(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor...
auto getPos(size_t vec_key) -> decltype(v_pos.template get< 0 >(vec_key))
Get the position of an element.
void map_list_(openfpm::vector< Point< dim, St >> &v_pos, openfpm::vector< prop > &v_prp, size_t &g_m, size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor...
auto getPos(vect_dist_key_dx vec_key) const -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
prop value_type
property object
void updateCellListSym(CellL &cell_list)
Update a cell list using the stored particles.
const openfpm::vector< Point< dim, St > > & getPosVector() const
return the position vector of all the particles
This iterator iterate across the particles of a Cell-list following the Cell structure.
void setPropNames(const openfpm::vector< std::string > &names)
Set the properties names.
void swap(VerletList< dim, T, Mem_type, transform, CellListImpl > &vl)
Swap the memory.
static CellL get(Vector &vd, const St &r_cut, const Ghost< dim, St > &g)
Get the Cell list based on the type.
vector_dist_iterator getIterator()
Get an iterator that traverse domain and ghost particles.
std::string toString() const
Produce a string from the object.
vector_dist_iterator getDomainIterator() const
Get an iterator that traverse the particles in the domain.
openfpm::vector< std::string > prp_names
Name of the properties.
This class is a container for the memory interface like HeapMemory CudaMemory.
auto getPosNC(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
void resize(size_t rs)
Resize the vector (locally)
void load(const std::string &filename)
Load the distributed vector from an HDF5 file.
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 ghost_get_(openfpm::vector< Point< dim, St >> &v_pos, openfpm::vector< prop, Memory, typename layout_base< prop >::type, layout_base > &v_prp, size_t &g_m, size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
Vcluster & v_cl
Virtual cluster.
void check_parameters(Box< dim, St > &box)
Check if the parameters describe a valid vector. In case it does not report an error.
auto getLastPos() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element.
void set_d(size_t i, mem_id id)
Set the i index.
vector_dist_iterator getDomainIterator_no_se3() const
Get an iterator that traverse the particles in the domain.
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.
auto getPropWrite(vect_dist_key_dx vec_key) -> decltype(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
void ghost_put_(openfpm::vector< Point< dim, St >> &v_pos, openfpm::vector< prop > &v_prp, size_t &g_m, size_t opt)
Ghost put.
Implementation of 1-D std::vector like structure.
Class for FAST cell list implementation.
size_t getProcessingUnits()
Get the total number of processors.
auto getProp(size_t vec_key) const -> decltype(v_prp.template get< id >(vec_key))
Get the property of an element.
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.
Vcluster & getVC()
Get the Virtual Cluster machine.
static const unsigned int dims
dimensions of space
bool allGather(T &send, openfpm::vector< T, Mem, gr > &v)
Gather the data from all processors.
const openfpm::vector< prop > & getPropVector() const
return the property vector of all the particles
CellL getCellListSym(St r_cut)
Construct a cell list symmetric based on a cut of radius.
size_t opt
option used to create this vector
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.
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...