Template Class LatticeNeighbors#

Class Documentation#

template<typename distance_policy>
class LatticeNeighbors#

Public Types

typedef VecN<ndim, size_t> cell_vec_t#

Public Functions

inline LatticeNeighbors(
std::shared_ptr<distance_policy> const &dist,
pele::Array<double> const &boxvec,
const double rcut,
pele::Array<size_t> const &ncells_vec
)#
inline size_t cell_vec_to_global_ind(cell_vec_t const &v) const#

convert a cell vector to the global cell index The cell vector needs to be within range [0, m_ncells_vec]

inline size_t cell_vec_to_local_ind(cell_vec_t const &v, const size_t isubdom) const#

convert a cell vector to the local cell index The cell vector needs to be within range [0, m_ncells_vec]

inline cell_vec_t global_ind_to_cell_vec(const size_t icell) const#

convert a global cell index to a cell vector

inline cell_vec_t local_ind_to_cell_vec(const size_t icell, const size_t isubdom) const#

convert a local cell index to a cell vector

inline VecN<ndim> cell_vec_to_position(cell_vec_t const &v) const#

convert a cell vector to a positional vector in real space

inline cell_vec_t position_to_cell_vec(const double *const x) const#

return the cell vector of the cell containing position x

inline void position_to_local_ind(
const double *const x,
size_t &icell,
size_t &isubdom
) const#

return the subdomain and the local index of the cell that contains position x

inline void position_to_global_ind(const double *const x, size_t &icell) const#

return the global index of the cell that contains position x

inline void global_ind_to_local_ind(
const size_t icell_global,
size_t &icell_local,
size_t &isubdom
) const#

convert a global cell index to the subdomain and local index

inline size_t local_ind_to_global_ind(
const size_t icell_local,
const size_t isubdom
) const#

convert local cell index and subdomain to the global index

inline size_t get_subdomain(cell_vec_t const &v) const#

return the subdomain containing the cell

inline size_t get_subdomain(const size_t icell_global) const#

return the subdomain containing the cell defined by its global index

inline double minimum_distance(cell_vec_t const &v1, cell_vec_t const &v2) const#

return the minimum corner to corner distance between two cells

inline void find_global_neighbor_inds(
const size_t idim,
cell_vec_t const &v0,
std::vector<size_t> &neighbors,
cell_vec_t const &vorigin
) const#

recursive function to find the neighbors of a given cell using global cell indices

inline void find_global_neighbor_inds_nearest(
const size_t idim,
cell_vec_t const &possible_neighbor,
std::vector<size_t> &neighbors,
cell_vec_t const &cell
) const#
inline std::vector<size_t> find_all_global_neighbor_inds(const size_t icell) const#

return a vector of all the neighbors of icell (including icell itself) using global cell indices

inline void find_neighbor_pairs(
std::vector<std::vector<std::array<cell_t*, 2>>> &cell_neighbors_inner,
std::vector<std::vector<std::array<cell_t*, 2>>> &cell_neighbors_boundary,
std::vector<std::vector<cell_t*>> &cell_neighbors,
std::vector<std::vector<cell_t>> &cells
) const#

return a list of all pairs of neighboring cells

inline void find_neighbor_pairs_subdom(
std::vector<std::array<cell_t*, 2>> &neighbor_pairs_inner,
std::vector<std::array<cell_t*, 2>> &neighbor_pairs_boundary,
std::vector<std::vector<cell_t*>> &cell_neighbors,
std::vector<std::vector<cell_t>> &cells,
const size_t isubdom
) const#

return a list of all pairs of neighboring cells originating from a subdomain

inline bool pos_direction_y(const size_t icell, const size_t jcell) const#

Check if the direction of this neighborhood is positive.

True, if the direction is downward facing considering boundary conditions

Public Members

const std::shared_ptr<distance_policy> m_dist#

the distance function

pele::VecN<ndim> m_boxvec#
pele::VecN<ndim> m_inv_boxvec#

inverse of boxvec

double m_rcut#
cell_vec_t m_ncells_vec#

the number of cells in each dimension

pele::VecN<ndim> m_rcell_vec#

the cell length in each dimension

size_t m_ncells#
size_t m_nsubdoms#
std::vector<size_t> m_subdom_limits#

boundary indices of each subdomain in the split direction (y)

std::vector<size_t> m_subdom_ncells#

number of cells of each subdomain

bool m_subdoms_balanced#

true if all subdomains have the same number of cells

size_t m_subdom_avg_len#

Average subdomain length. Only used in balanced case, therefore integer.

Public Static Attributes

static const size_t ndim = distance_policy::_ndim#

Protected Functions

inline void calc_subdom_stats()#

Calculate number of cells of each subdomain in the split direction (y).