6 #ifndef OPENFPM_PDATA_SUPPORTBUILDER_HPP 7 #define OPENFPM_PDATA_SUPPORTBUILDER_HPP 12 #include <Space/Shape/Point.hpp> 13 #include <Vector/vector_dist.hpp> 14 #include "Support.hpp" 23 template<
typename vector_type>
28 decltype(std::declval<vector_type>().getCellList(0.0)) cellList;
37 template<
typename iterator_type>
38 Support getSupport(iterator_type itPoint,
unsigned int requiredSize, support_options opt)
47 std::set<grid_key_dx<vector_type::dims>> supportCells;
48 supportCells.insert(curCellKey);
51 enlargeSetOfCellsUntilSize(supportCells, requiredSize + 1,opt);
55 std::vector<size_t> supportKeys = getPointsInSetOfCells(supportCells,p,pOrig,requiredSize,opt);
57 auto p_o = domain.getOriginKey(p.
getKey());
58 std::remove(supportKeys.begin(), supportKeys.end(), p_o.getKey());
59 return Support(p_o.getKey(), supportKeys);
78 template<
typename vector_type>
82 differentialSignature(differentialSignature),
89 template<
typename vector_type>
92 const size_t curCellId = getCellLinId(cellKey);
93 size_t numElements = cellList.getNelements(curCellId);
97 template<
typename vector_type>
101 for (
const auto cell : set)
103 tot += getNumElementsInCell(cell);
108 template<
typename vector_type>
112 if (opt==support_options::RADIUS){
113 auto cell=*set.begin();
115 int n=std::ceil(rCut/cellList.getCellBox().getHigh(0));
128 if (isCellKeyInBounds(key))
136 while (getNumElementsInSetOfCells(set) < 5.0*requiredSize)
139 for (
const auto el : tmpSet)
143 const auto pOneEl = el.move(i, +1);
144 const auto mOneEl = el.move(i, -1);
145 if (isCellKeyInBounds(pOneEl))
149 if (isCellKeyInBounds(mOneEl))
161 template<
typename vector_type>
164 mem_id
id = cellList.getGrid().LinId(cellKey);
165 return static_cast<size_t>(
id);
168 template<
typename vector_type>
172 size_t requiredSupportSize,
180 bool operator<(
const reord & p)
const 181 {
return this->dist < p.dist;}
185 std::vector<size_t> points;
187 for (
const auto cellKey : set)
189 const size_t cellLinId = getCellLinId(cellKey);
190 const size_t elemsInCell = getNumElementsInCell(cellKey);
191 for (
size_t k = 0; k < elemsInCell; ++k)
193 size_t el = cellList.get(cellLinId, k);
195 if (pOrig.
getKey() == el) {
continue;}
209 if (opt == support_options::RADIUS)
211 for (
int i = 0 ; i < rp.
size() ; i++)
213 if (rp.get(i).dist < rCut)
215 points.push_back(rp.get(i).offset);
228 for (
int i = 0 ; i < requiredSupportSize ; i++)
230 points.push_back(rp.get(i).offset);
237 template<
typename vector_type>
241 template<
typename vector_type>
244 const size_t *cellGridSize = cellList.getGrid().getSize();
247 if (key.
value(i) < 0 || key.
value(i) >= cellGridSize[i])
255 #endif //OPENFPM_PDATA_SUPPORTBUILDER_HPP auto getPosOrig(vect_dist_key_dx vec_key) const -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
grid_key_dx is the key to access any element in the grid
auto getPos(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
Grid key for a distributed grid.
CellL getCellList(St r_cut, bool no_se3=false)
Construct a cell list starting from the stored particles.
__device__ __host__ mem_id value(size_t i) const
Get the i index.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
static const unsigned int dims
dimensions of space
__device__ __host__ size_t getKey() const
Get the key.
__device__ __host__ T distance(const Point< dim, T > &q) const
It calculate the distance between 2 points.
__device__ __host__ void set_d(index_type i, index_type id)
Set the i index.
Implementation of 1-D std::vector like structure.