8#ifndef SRC_DECOMPOSITION_DOMAIN_NN_CALCULATOR_CART_HPP_
9#define SRC_DECOMPOSITION_DOMAIN_NN_CALCULATOR_CART_HPP_
11#include <Vector/map_vector.hpp>
12#include "NN/CellList/ParticleItCRS_Cells.hpp"
20template<
unsigned int dim>
111 const ::Box<dim,long int> &
proc_box,
123 for (
size_t j = 0 ; j < dim ; j++)
132 for (
size_t i = 0 ; i < dim ; i++)
140 for (
size_t i = 0 ; i < loc_box.size() ; i++)
145 for (
size_t j = 0 ; j < dim ; j++)
155 auto key = sub.
get();
157 for (
size_t j = 0 ; j < csr.
size() ; j++)
161 g.template get<0>(src).add(dst);
180 if (g.template get<0>(key).size() == openfpm::math::pow(3,dim)/2+1)
183 dom_subsub.add(key -
one);
185 else if (g.template get<0>(key).size() != 0)
188 sub_keys.last().subsub = key -
one;
191 sub_keys.last().NN_subsub.resize(g.template get<0>(key).size());
193 for (
size_t i = 0 ; i < g.template get<0>(key).size() ; i++)
194 {sub_keys.last().NN_subsub.
get(i) = g.template get<0>(key).get(i) -
one;}
218 for (
size_t i = 0 ; i <
anom.
size() ; i++)
224 long int self_cell = -1;
226 for (
size_t j = 0 ; j <
anom.get(i).NN_subsub.
size() ; j++)
233 if (
anom_lin.get(i).NN_subsub.last() == 0)
241 size_t tmp =
anom_lin.get(i).NN_subsub.get(0);
242 anom_lin.get(i).NN_subsub.get(0) = 0;
243 anom_lin.get(i).NN_subsub.get(self_cell) = tmp;
290 for (
size_t i = 0 ; i <
dom.
size() ; i++)
This class represent an N-dimensional box.
__device__ __host__ T getLow(int i) const
get the i-coordinate of the low bound interval of the box
__device__ __host__ T getHigh(int i) const
get the high interval of the box
This class calculate processor domains and neighborhood of each processor domain.
void linearize_subsub(const openfpm::vector< subsub< dim > > &anom, openfpm::vector< subsub_lin< dim > > &anom_lin, const grid_key_dx< dim > &shift, const grid_sm< dim, void > &gs)
Linearize the sub-sub-domains ids.
openfpm::vector< size_t > & getCRSDomainCells()
Get the domain Cells.
openfpm::vector< size_t > dom_cells_lin
Set of linearized domain cells.
openfpm::vector< subsub_lin< dim > > & getCRSAnomDomainCells()
Get the domain anomalous cells.
void CalculateDomAndAnomCells(openfpm::vector< subsub< dim > > &sub_keys, openfpm::vector< grid_key_dx< dim > > &dom_subsub, openfpm::vector< grid_key_dx< dim > > &dom_cells, const ::Box< dim, long int > &proc_box, const openfpm::vector<::Box< dim, size_t > > &loc_box)
Calculate the subdomain that are in the skin part of the domain.
openfpm::vector< subsub_lin< dim > > anom_lin
Set of anomalous CRS domain cells linearized.
openfpm::vector< size_t > & getDomainCells()
Get the domain Cells.
openfpm::vector< grid_key_dx< dim > > dom
Set of normal domain cells for CRS.
grid_sm< dim, void > gs
Processor cells-grid.
openfpm::vector< subsub< dim > > anom
anomalous cell neighborhood for CRS
bool are_domain_anom_computed
True if domain and anomalous domain cells are computed.
void setParameters(const Box< dim, long int > &proc_box)
Set parameters to calculate the cell neighborhood.
void reset()
In case you have to recompute the indexes.
void setNNParameters(openfpm::vector<::Box< dim, size_t > > &loc_box, const grid_key_dx< dim > &shift, const grid_sm< dim, void > &gs)
Set parameters to calculate the cell neighborhood.
Box< dim, long int > proc_box
Processor box.
openfpm::vector< grid_key_dx< dim > > dom_cells
Set of domain cells.
grid_key_dx< dim > one
key with all coordinates set to one
openfpm::vector< size_t > dom_lin
Set of normal CRS domain cells linearized.
Declaration grid_key_dx_iterator_sub.
grid_key_dx< dim > get() const
Return the actual grid key iterator.
bool isNext()
Check if there is the next element.
const grid_key_dx< dim > & get() const
Get the actual key.
bool isNext()
Check if there is the next element.
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.
void setDimensions(const size_t(&dims)[N])
Reset the dimension of the grid.
mem_id LinId(const grid_key_dx< N, ids_type > &gk, const signed char sum_id[N]) const
Linearization of the grid_key_dx with a specified shift.
Implementation of 1-D std::vector like structure.
Linearized version of subsub.