Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
find_cell_neighbors.cc File Reference
#include <dem/find_cell_neighbors.h>
#include <deal.II/grid/cell_id.h>
#include <deal.II/grid/grid_tools.h>
Include dependency graph for find_cell_neighbors.cc:

Go to the source code of this file.

Functions

template<int dim, bool reciprocal>
void find_cell_neighbors (const parallel::distributed::Triangulation< dim > &triangulation, typename dem_data_structures< dim >::cells_neighbor_list &cells_local_neighbor_list, typename dem_data_structures< dim >::cells_neighbor_list &cells_ghost_neighbor_list)
template<int dim>
void find_cell_periodic_neighbors (const parallel::distributed::Triangulation< dim > &triangulation, const typename dem_data_structures< dim >::periodic_boundaries_cells_info &periodic_boundaries_cells_information, typename dem_data_structures< dim >::cells_neighbor_list &cells_local_periodic_neighbor_list, typename dem_data_structures< dim >::cells_neighbor_list &cells_ghost_periodic_neighbor_list, typename dem_data_structures< dim >::cells_neighbor_list &cells_ghost_local_periodic_neighbor_list)
template<int dim>
void find_full_cell_neighbors (const parallel::distributed::Triangulation< dim > &triangulation, typename dem_data_structures< dim >::cells_total_neighbor_list &cells_total_neighbor_list)
template<int dim>
void get_periodic_neighbor_list (const typename Triangulation< dim >::active_cell_iterator &cell, const std::map< unsigned int, std::vector< unsigned int > > &coinciding_vertex_groups, const std::map< unsigned int, unsigned int > &vertex_to_coinciding_vertex_group, const std::vector< std::set< typename Triangulation< dim >::active_cell_iterator > > &v_to_c, typename dem_data_structures< dim >::cell_vector &periodic_neighbor_list)
template void find_cell_neighbors< 2, false > (const parallel::distributed::Triangulation< 2 > &triangulation, dem_data_structures< 2 >::cells_neighbor_list &cells_local_neighbor_list, dem_data_structures< 2 >::cells_neighbor_list &cells_ghost_neighbor_list)
template void find_cell_neighbors< 3, false > (const parallel::distributed::Triangulation< 3 > &triangulation, dem_data_structures< 3 >::cells_neighbor_list &cells_local_neighbor_list, dem_data_structures< 3 >::cells_neighbor_list &cells_ghost_neighbor_list)
template void find_cell_neighbors< 2, true > (const parallel::distributed::Triangulation< 2 > &triangulation, dem_data_structures< 2 >::cells_neighbor_list &cells_local_neighbor_list, dem_data_structures< 2 >::cells_neighbor_list &cells_ghost_neighbor_list)
template void find_cell_neighbors< 3, true > (const parallel::distributed::Triangulation< 3 > &triangulation, dem_data_structures< 3 >::cells_neighbor_list &cells_local_neighbor_list, dem_data_structures< 3 >::cells_neighbor_list &cells_ghost_neighbor_list)
template void find_cell_periodic_neighbors< 2 > (const parallel::distributed::Triangulation< 2 > &triangulation, const dem_data_structures< 2 >::periodic_boundaries_cells_info &periodic_boundaries_cells_information, dem_data_structures< 2 >::cells_neighbor_list &cells_local_periodic_neighbor_list, dem_data_structures< 2 >::cells_neighbor_list &cells_ghost_periodic_neighbor_list, dem_data_structures< 2 >::cells_neighbor_list &cells_ghost_local_periodic_neighbor_list)
template void find_cell_periodic_neighbors< 3 > (const parallel::distributed::Triangulation< 3 > &triangulation, const dem_data_structures< 3 >::periodic_boundaries_cells_info &periodic_boundaries_cells_information, dem_data_structures< 3 >::cells_neighbor_list &cells_local_periodic_neighbor_list, dem_data_structures< 3 >::cells_neighbor_list &cells_ghost_periodic_neighbor_list, dem_data_structures< 3 >::cells_neighbor_list &cells_ghost_local_periodic_neighbor_list)
template void find_full_cell_neighbors< 2 > (const parallel::distributed::Triangulation< 2 > &triangulation, dem_data_structures< 2 >::cells_total_neighbor_list &cells_total_neighbor_list)
template void find_full_cell_neighbors< 3 > (const parallel::distributed::Triangulation< 3 > &triangulation, dem_data_structures< 3 >::cells_total_neighbor_list &cells_total_neighbor_list)

Function Documentation

◆ find_cell_neighbors()

template<int dim, bool reciprocal>
void find_cell_neighbors ( const parallel::distributed::Triangulation< dim > & triangulation,
typename DEM::dem_data_structures< dim >::cells_neighbor_list & cells_local_neighbor_list,
typename DEM::dem_data_structures< dim >::cells_neighbor_list & cells_ghost_neighbor_list )

Finds the neighbor list (without repetition) of all the active cells in the triangulation. It gets the vertices of the cells to get lists of the neighbor for each cell. There is some check to prevent repetition of a cell in a list (up to 8 vertices can have the same cell in common in 3D). 2 types of container are used for cell neighbors : local-local cells and local-ghost cells.

Template Parameters
dimAn integer that denotes the dimension of the space in which the problem is solved.
reciprocalA boolean that denotes if the cells_local_neighbor_list of cell i and j contains cell j and i, respectively.
Parameters
triangulationTriangulation to access the information of the cells
cells_local_neighbor_listA vector (with size of the local cell number) of vectors (local adjacent cells of each local cell). First element of each set shows the main cell itself
cells_ghost_neighbor_listA vector (with size of the local cell number) of vectors (ghost adjacent cells of each local cell). First element of each set shows the main cell itself

Definition at line 13 of file find_cell_neighbors.cc.

◆ find_cell_neighbors< 2, false >()

template void find_cell_neighbors< 2, false > ( const parallel::distributed::Triangulation< 2 > & triangulation,
dem_data_structures< 2 >::cells_neighbor_list & cells_local_neighbor_list,
dem_data_structures< 2 >::cells_neighbor_list & cells_ghost_neighbor_list )

◆ find_cell_neighbors< 2, true >()

template void find_cell_neighbors< 2, true > ( const parallel::distributed::Triangulation< 2 > & triangulation,
dem_data_structures< 2 >::cells_neighbor_list & cells_local_neighbor_list,
dem_data_structures< 2 >::cells_neighbor_list & cells_ghost_neighbor_list )

◆ find_cell_neighbors< 3, false >()

template void find_cell_neighbors< 3, false > ( const parallel::distributed::Triangulation< 3 > & triangulation,
dem_data_structures< 3 >::cells_neighbor_list & cells_local_neighbor_list,
dem_data_structures< 3 >::cells_neighbor_list & cells_ghost_neighbor_list )

◆ find_cell_neighbors< 3, true >()

template void find_cell_neighbors< 3, true > ( const parallel::distributed::Triangulation< 3 > & triangulation,
dem_data_structures< 3 >::cells_neighbor_list & cells_local_neighbor_list,
dem_data_structures< 3 >::cells_neighbor_list & cells_ghost_neighbor_list )

◆ find_cell_periodic_neighbors()

template<int dim>
void find_cell_periodic_neighbors ( const parallel::distributed::Triangulation< dim > & triangulation,
const typename DEM::dem_data_structures< dim >::periodic_boundaries_cells_info & periodic_boundaries_cells_information,
typename DEM::dem_data_structures< dim >::cells_neighbor_list & cells_local_periodic_neighbor_list,
typename DEM::dem_data_structures< dim >::cells_neighbor_list & cells_ghost_periodic_neighbor_list,
typename DEM::dem_data_structures< dim >::cells_neighbor_list & cells_ghost_local_periodic_neighbor_list )

Finds the periodic neighbor list (without repetition) of all the active cells in the triangulation. It gets the coinciding vertices of the cells at the periodic boundary 0 to get lists of the periodic neighbor cells on the periodic boundary 1 for each cell. There is some check to prevent repetition of a cell in a list (up to 8 vertices can have the same cell in common in 3D). 3 types of container are used for periodic mapping of cell neighbors : local-local cells, local-ghost cells and ghost-local cells. The last container is necessary since the mapping are only from periodic boundary 0 to periodic boundary 1 and the ghost-local particle pairs need distinction for proper handling of search of particle pairs and contact forces.

Parameters
triangulationTriangulation to access the information of the cells
periodic_boundaries_cells_informationA container of information related to the pairs of cell at periodic boundaries, used to get the cells on periodic boundary 0
cells_local_periodic_neighbor_listA vector (with size of the local cell number) of vectors (local adjacent cells of each local cell). First element of each set shows the main cell itself
cells_ghost_periodic_neighbor_listA vector (with size of the local cell number) of vectors (ghost adjacent cells of each local cell). First element of each set shows the main cell itself
cells_ghost_local_periodic_neighbor_listA vector (with size of the ghost cell number) of vectors (local adjacent cells of each ghost cell). First element of each set shows the main ghost cell itself

Definition at line 107 of file find_cell_neighbors.cc.

References get_periodic_neighbor_list().

◆ find_cell_periodic_neighbors< 2 >()

template void find_cell_periodic_neighbors< 2 > ( const parallel::distributed::Triangulation< 2 > & triangulation,
const dem_data_structures< 2 >::periodic_boundaries_cells_info & periodic_boundaries_cells_information,
dem_data_structures< 2 >::cells_neighbor_list & cells_local_periodic_neighbor_list,
dem_data_structures< 2 >::cells_neighbor_list & cells_ghost_periodic_neighbor_list,
dem_data_structures< 2 >::cells_neighbor_list & cells_ghost_local_periodic_neighbor_list )

◆ find_cell_periodic_neighbors< 3 >()

template void find_cell_periodic_neighbors< 3 > ( const parallel::distributed::Triangulation< 3 > & triangulation,
const dem_data_structures< 3 >::periodic_boundaries_cells_info & periodic_boundaries_cells_information,
dem_data_structures< 3 >::cells_neighbor_list & cells_local_periodic_neighbor_list,
dem_data_structures< 3 >::cells_neighbor_list & cells_ghost_periodic_neighbor_list,
dem_data_structures< 3 >::cells_neighbor_list & cells_ghost_local_periodic_neighbor_list )

◆ find_full_cell_neighbors()

template<int dim>
void find_full_cell_neighbors ( const parallel::distributed::Triangulation< dim > & triangulation,
typename DEM::dem_data_structures< dim >::cells_total_neighbor_list & cells_total_neighbor_list )

Finds the full neighbor list (with repetition) of all the active cells in the triangulation. This function is used in particle-floating mesh contacts, as in this situation, we need to define all the particles located in the neighbor cells of the background cell (cut by the floating mesh) as contact candidates.

Parameters
triangulationTriangulation to access the information of the cells
cells_total_neighbor_listAn unordered_map (with size of the local cell number) of vectors (all adjacent cells of each local cell)

Definition at line 323 of file find_cell_neighbors.cc.

◆ find_full_cell_neighbors< 2 >()

template void find_full_cell_neighbors< 2 > ( const parallel::distributed::Triangulation< 2 > & triangulation,
dem_data_structures< 2 >::cells_total_neighbor_list & cells_total_neighbor_list )

◆ find_full_cell_neighbors< 3 >()

template void find_full_cell_neighbors< 3 > ( const parallel::distributed::Triangulation< 3 > & triangulation,
dem_data_structures< 3 >::cells_total_neighbor_list & cells_total_neighbor_list )

◆ get_periodic_neighbor_list()

template<int dim>
void get_periodic_neighbor_list ( const typename Triangulation< dim >::active_cell_iterator & cell,
const std::map< unsigned int, std::vector< unsigned int > > & coinciding_vertex_groups,
const std::map< unsigned int, unsigned int > & vertex_to_coinciding_vertex_group,
const std::vector< std::set< typename Triangulation< dim >::active_cell_iterator > > & v_to_c,
typename DEM::dem_data_structures< dim >::cell_vector & periodic_neighbor_list )

Generate a periodic neighbor cells list of the cell. With the coinciding_vertex_groups and the vertex_to_coinciding_vertex_group, we can get the coinciding vertices on a periodic boundary and with v_to_c we can get the list of the periodic neighbor cells to the main cell.

Here is an example to understand how the search works : Cell 8 has vertices 0, 1, 2, 3 on the periodic boundary. First, it checks in the coinciding_vertex_groups if the vertex 0 is a key in the map, and if it is, it gets a label, let's say that label is 10. In the vertex_to_coinciding_vertex_group, it can find the coinciding vertices with the label. Using the label 10, it gets the vertices 0 and 34, which means that vertices 0 and 34 are periodic. We do not want the cells attached to the vertex 0 since they are already found with the regular find_cell_neighbor function, so it skips vertex 0, but gets the cells 21, 22, 23, 24 attached to the vertex 34. The same checks are done for vertices 1, 2 and 3 and all periodic cells are returned as a vector.

Parameters
cellThe cell that needs the periodic neighbor list
coinciding_vertex_groupsA map of coinciding vertices labeled by an arbitrary element from them
vertex_to_coinciding_vertex_groupMap of a vertex to the label of a group of coinciding vertices
v_to_cA vector of set with adjacent cells of all the vertices
periodic_neighbor_listA vector which is the list of periodic cell neighbors

Definition at line 368 of file find_cell_neighbors.cc.