5 #ifndef OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP 6 #define OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP 8 #include "vector_dist.hpp" 10 template<
unsigned int dim,
20 typedef prop value_type;
24 typedef boost::mpl::int_<AggregateAppend<int,prop>::type::max_prop-1> flag_prop;
28 this->
template getProp<flag_prop::value>(key) = sub_id;
31 void ghost_get_subset()
33 this->
template ghost_get<flag_prop::value>(NO_POSITION | SKIP_LABELLING);
36 void getLastSubset(
int sub_id)
38 this->
template getProp<flag_prop::value>(this->
size_local()-1) = sub_id;
41 inline bool write_frame(std::string out,
size_t iteration,
int opt = VTK_WRITER)
44 if(prop_names.size()<prop::max_prop+1){
45 prop_names.add({
"SubsetNumber"});
51 inline bool write(std::string out,
int opt = VTK_WRITER)
54 if(prop_names.size()<prop::max_prop+1){
55 prop_names.add({
"SubsetNumber"});
63 template<
unsigned int dim,
73 typedef boost::mpl::int_<AggregateAppend<int,prop>::type::max_prop-1> flag_prop;
82 int subsetUpdate_ctr=0;
88 for (
size_t i = 0 ; i < pid.
size() ; i++)
92 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error you have ghost particles in your subset" << std::endl;
114 typedef int yes_i_am_vector_dist;
121 :vd(vd),sub_id(sub_id)
124 subsetUpdate_ctr=vd.getMapCtr();
134 if (vd.template getProp<flag_prop::value>(p) == sub_id)
137 pid.template get<0>(pid.
size()-1) = p.getKey();
146 void ghost_get_subset()
148 vd.template ghost_get<flag_prop::value>(NO_POSITION | SKIP_LABELLING);
162 int getUpdateCtr()
const{
163 return subsetUpdate_ctr;
167 return vd.getMapCtr();
177 subsetUpdate_ctr=vd.getMapCtr();
190 if (vd.template getProp<flag_prop::value>(p) == sub_id)
193 pid.template get<0>(pid.
size()-1) = p.getKey();
242 #ifndef ONLY_READWRITE_GETTER 283 return vd.
getPos(vec_key.getKey());
297 return vd.
getPos(vec_key.getKey());
312 return vd.template getProp<id>(
vect_dist_key_dx(pid.template get<0>(vec_key.getKey())));
327 return vd.template getProp<id>(
vect_dist_key_dx(pid.template get<0>(vec_key.getKey())));
362 template<
typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St>,
typename std::remove_reference<decltype(vd.getPosVector())>::type > >
374 return getCellList<CellL>(r_cut, g,no_se3);
403 template<
typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<>, shift<dim, St> > >
420 cl_param_calculate(pbox, div, r_cut, enlarge);
422 cell_list.Initialize(pbox, div);
423 cell_list.set_gm(pid.
size());
436 cell_list.add(pos,pid.template get<0>(key.getKey()));
447 auto key = git.
get();
451 if (vd.template getProp<flag_prop::value>(key) == sub_id)
453 cell_list.add(pos,key.getKey());
481 #endif //OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP bool isSubset() const
Indicate that this class is not a subset.
Decomposition & getDecomposition()
Get the decomposition.
Transform the boost::fusion::vector into memory specification (memory_traits)
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 magnify(T mg)
Magnify the box.
const Decomposition & getDecomposition() const
Get the decomposition.
auto getPos(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
This class implement the point shape in an N-dimensional space.
Grid key for a distributed grid.
vector_dist_iterator getGhostIterator() const
Get the iterator across the position of the ghost particles.
This class allocate, and destroy CPU memory.
auto getPos(vect_dist_key_dx vec_key) -> decltype(vd.getPos(vec_key))
Get the position of an element.
CellL getCellList(St r_cut, bool no_se3=false)
Construct a cell list starting from the stored particles.
This class define the domain decomposition interface.
std::integral_constant< bool, true > is_it_a_subset
Subset detection.
size_t size_local() const
return the local size of the vector
This class decompose a space into sub-sub-domains and distribute them across processors.
auto getProp(vect_dist_key_dx vec_key) -> 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
auto getPos(vect_dist_key_dx vec_key) const -> decltype(vd.getPos(vec_key))
Get the position of an element.
openfpm::vector< std::string > & getPropNames()
Get the properties names.
static const unsigned int dims
dimensions of space
ivector_dist::value_type value_type
property object
ivector_dist::stype stype
space type
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.
Iterator that Iterate across particle indexes.
vector_dist_iterator_subset getDomainIterator() const
Get an iterator that traverse the particles in the domain.
__device__ __host__ size_t getKey() const
Get the key.
size_t opt
option used to create this vector
auto getPosOrig(vect_dist_key_dx vec_key) -> decltype(vd.getPos(vec_key))
Get the position of an element.
vect_dist_key_dx get()
Get the actual key.
size_t size_local_orig() const
return the local size of the original vector
void update()
Update the subset indexes.
Implementation of 1-D std::vector like structure.
auto getProp(vect_dist_key_dx vec_key) const -> decltype(vd.template getProp< id >(vec_key))
Get the property of an element.
Class for FAST cell list implementation.
vector_dist_iterator getDomainIterator() const
Get an iterator that traverse the particles in the domain.
static const unsigned int dims
dimensions of space
Decomposition & getDecomposition()
Get the decomposition.
auto getPosOrig(vect_dist_key_dx vec_key) const -> decltype(vd.getPos(vec_key))
Get the position of an element.