5#ifndef OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP
6#define OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP
8#include "vector_dist.hpp"
10template<
unsigned int dim,
24 typedef boost::mpl::int_<AggregateAppend<int,prop>::type::max_prop-1> flag_prop;
28 this->
template getProp<flag_prop::value>(key) = sub_id;
33 return this->
template getProp<flag_prop::value>(key);
36 void ghost_get_subset()
38 this->
template ghost_get<flag_prop::value>(NO_POSITION | SKIP_LABELLING);
41 void getLastSubset(
int sub_id)
43 this->
template getProp<flag_prop::value>(this->
size_local()-1) = sub_id;
46 inline bool write_frame(std::string out,
size_t iteration,
int opt = VTK_WRITER)
49 if(prop_names.size()==prop::max_prop){
50 prop_names.add({
"SubsetNumber"});
55 inline bool write_frame(std::string out,
size_t iteration,
double time,
int opt = VTK_WRITER)
58 if(prop_names.size()==prop::max_prop){
59 prop_names.add({
"SubsetNumber"});
65 inline bool write(std::string out,
int opt = VTK_WRITER)
68 if(prop_names.size()==prop::max_prop){
69 prop_names.add({
"SubsetNumber"});
77template<
unsigned int dim,
87 typedef boost::mpl::int_<AggregateAppend<int,prop>::type::max_prop-1> flag_prop;
96 int subsetUpdate_ctr=0;
102 for (
size_t i = 0 ; i < pid.
size() ; i++)
104 if (pid.template get<0>(i) >= vd.
size_local())
106 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error you have ghost particles in your subset" << std::endl;
122 typedef typename ivector_dist::stype
stype;
128 typedef int yes_i_am_vector_dist;
135 :vd(vd),sub_id(sub_id)
138 subsetUpdate_ctr=vd.getMapCtr();
148 if (vd.template getProp<flag_prop::value>(p) == sub_id)
151 pid.template get<0>(pid.
size()-1) = p.getKey();
160 void ghost_get_subset()
162 vd.template ghost_get<flag_prop::value>(NO_POSITION | SKIP_LABELLING);
176 int getUpdateCtr()
const{
177 return subsetUpdate_ctr;
181 return vd.getMapCtr();
191 subsetUpdate_ctr=vd.getMapCtr();
204 if (vd.template getProp<flag_prop::value>(p) == sub_id)
207 pid.template get<0>(pid.
size()-1) = p.getKey();
256#ifndef ONLY_READWRITE_GETTER
291 template<
unsigned int ... prp>
304 vd.template hostToDevicePos<0>();
318 return vd.
getPos(vec_key.getKey());
332 return vd.
getPos(vec_key.getKey());
347 return vd.template getProp<id>(
vect_dist_key_dx(pid.template get<0>(vec_key.getKey())));
362 return vd.template getProp<id>(
vect_dist_key_dx(pid.template get<0>(vec_key.getKey())));
397 template<
typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St>,
typename std::remove_reference<decltype(vd.getPosVector())>::type > >
409 return getCellList<CellL>(r_cut, g,no_se3);
438 template<
typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St> > >
455 cl_param_calculate(pbox, div, r_cut, enlarge);
457 cell_list.Initialize(pbox, div);
458 cell_list.set_gm(pid.
size());
471 cell_list.add(pos,pid.template get<0>(key.getKey()));
482 auto key = git.
get();
486 if (vd.template getProp<flag_prop::value>(key) == sub_id)
488 cell_list.add(pos,key.getKey());
515template<
unsigned int dim,
typename St,
typename prop,
typename Decomposition = CartDecomposition<dim,St,CudaMemory,memory_traits_lin>>
using vector_dist_ws_gpu =
vector_dist_ws<dim,St,prop,Decomposition,CudaMemory,memory_traits_lin>;
516template<
unsigned int dim,
typename St,
typename prop,
typename Decomposition = CartDecomposition<dim,St,CudaMemory,memory_traits_lin>>
using vector_dist_subset_gpu =
vector_dist_subset<dim,St,prop,Decomposition,CudaMemory,memory_traits_lin>;
This class represent an N-dimensional box.
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.
This class define the domain decomposition interface.
This class allocate, and destroy CPU memory.
This class implement the point shape in an N-dimensional space.
Implementation of 1-D std::vector like structure.
Grid key for a distributed grid.
__device__ __host__ size_t getKey() const
Get the key.
Iterator that Iterate across particle indexes.
vect_dist_key_dx get()
Get the actual key.
auto getPos(vect_dist_key_dx vec_key) const -> decltype(vd.getPos(vec_key))
Get the position of an element.
auto getPosOrig(vect_dist_key_dx vec_key) -> decltype(vd.getPos(vec_key))
Get the position of an element.
std::integral_constant< bool, true > is_it_a_subset
Subset detection.
auto getPosOrig(vect_dist_key_dx vec_key) const -> decltype(vd.getPos(vec_key))
Get the position of an element.
auto getProp(vect_dist_key_dx vec_key) -> decltype(vd.template getProp< id >(vec_key))
Get the property of an element.
static const unsigned int dims
dimensions of space
CellL getCellList(St r_cut, bool no_se3=false)
Construct a cell list starting from the stored particles.
void hostToDeviceProp()
Move the memory from the device to host memory.
size_t size_local() const
return the local size of the vector
ivector_dist::stype stype
space type
Decomposition & getDecomposition()
Get the decomposition.
bool isSubset() const
Indicate that this class is not a subset.
const Decomposition & getDecomposition() const
Get the decomposition.
vector_dist_subset< dim, St, prop, Decomposition, Memory, layout_base > & operator=(const vector_dist_subset< dim, St, prop, Decomposition, Memory, layout_base > &v)
Operator= for distributed vector.
vector_dist_iterator_subset getDomainIterator() const
Get an iterator that traverse the particles in the domain.
ivector_dist::value_type value_type
property object
size_t size_local_orig() const
return the local size of the original vector
auto getPos(vect_dist_key_dx vec_key) -> decltype(vd.getPos(vec_key))
Get the position of an element.
void update()
Update the subset indexes.
openfpm::vector< aggregate< int > > & getIds()
Return the ids.
CellL getCellList(St r_cut, const Ghost< dim, St > &enlarge, bool no_se3=false)
Construct a cell list starting from the stored particles.
void hostToDevicePos()
Move the memory from the device to host memory.
auto getProp(vect_dist_key_dx vec_key) const -> decltype(vd.template getProp< id >(vec_key))
Get the property of an element.
size_t size_local() const
return the local size of the vector
static const unsigned int dims
template parameters typedefs
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.
size_t opt
option used to create this vector
vector_dist_iterator getDomainIterator() const
Get an iterator that traverse the particles in the domain.
openfpm::vector< std::string > & getPropNames()
Get the properties names.
Decomposition & getDecomposition()
Get the decomposition.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
Transform the boost::fusion::vector into memory specification (memory_traits)