Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
particle_particle_broad_search.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2020-2022, 2024-2025 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_particle_particle_broad_search_h
5#define lethe_particle_particle_broad_search_h
6
9
10#include <deal.II/particles/particle.h>
11#include <deal.II/particles/particle_handler.h>
12#include <deal.II/particles/particle_iterator.h>
13
14/**
15 * @brief Finds a vector of pairs (particle_particle_candidates) which shows the
16 * candidate particle-particle collision pairs. These collision pairs will be
17 * used in the fine search to investigate if they are in contact or not.
18 *
19 * @param[in] particle_handler The particle handler of particles in the broad
20 * search
21 * @param[in] cells_local_neighbor_list A vector (with size equal to the number
22 * of local cells) of vectors. Each sub-vector have a size equal to the number
23 * of adjacent local cells plus one. First element of each sub-vector shows the
24 * main cell itself.
25 * @param[in] cells_ghost_neighbor_list A vector (with size equal to the number
26 * of local cells) of vectors. Each sub-vector have a size equal to the number
27 * of adjacent ghost cells plus one. First element of each sub-vector shows the
28 * main cell itself.
29 * @param[out] local_contact_pair_candidates Ankerl unordered dense map. Stores
30 * potential pairs of local-local particle in contact without redundancy.
31 * Keys are particle ids and mapped types are vectors of particle ids.
32 * @param[out] ghost_contact_pair_candidates Ankerl unordered dense map. Stores
33 * potential pairs of local-ghost particle in contact. Keys are particle ids and
34 * mapped types are vectors of particle ids.
35 */
36template <int dim>
37void
39 dealii::Particles::ParticleHandler<dim> &particle_handler,
41 &cells_local_neighbor_list,
43 &cells_ghost_neighbor_list,
45 &local_contact_pair_candidates,
47 &ghost_contact_pair_candidates);
48
49/**
50 * @brief Finds a vector of pairs (particle_particle_candidates) which shows the
51 * candidate particle-particle collision pairs. These collision pairs will be
52 * used in the fine search to investigate if they are in contact or not.
53 * This version of the function is used when adaptive sparse contacts is
54 * enabled.
55 *
56 * @tparam dim An integer that denotes the number of spatial dimensions.
57 * @tparam PropertiesIndex Index of the properties used within the ParticleHandler.
58 *
59 * @param particle_handler The particle handler of particles in the broad
60 * search
61 * @param[in] cells_local_neighbor_list A vector (with size equal to the number
62 * of local cells) of vectors. Each sub-vector have a size equal to the number
63 * of adjacent local cells of the main cell plus one. The first element of each
64 * sub-vector shows the main cell itself.
65 * @param[in] cells_ghost_neighbor_list A vector (with size equal to the number
66 * of local cells) of vectors. Each sub-vector have a size equal to the number
67 * of adjacent ghost cells of the main cell plus one. The first element of each
68 * sub-vector shows the main cell itself.
69 * @param[out] local_contact_pair_candidates Ankerl unordered dense map. Stores
70 * potential pairs of local-local particles in contact without redundancy.
71 * Keys are particle ids and mapped types are vectors of particle ids.
72 * @param[in] ghost_contact_pair_candidates Ankerl unordered dense map. Stores
73 * potential pairs of local-ghost particle in contact. Keys are particle ids and
74 * mapped types are vectors of particle ids.
75 * @param[in] sparse_contacts_object The object that contains the
76 * information about the mobility status of cells
77 */
78template <int dim, typename PropertiesIndex>
79void
81 dealii::Particles::ParticleHandler<dim> &particle_handler,
83 &cells_local_neighbor_list,
85 &cells_ghost_neighbor_list,
87 &local_contact_pair_candidates,
89 &ghost_contact_pair_candidates,
90 const AdaptiveSparseContacts<dim, PropertiesIndex> &sparse_contacts_object);
91
92/**
93 * @brief Finds vectors of pairs (particle_particle_candidates) which contains the
94 * candidate particle-particle collision pairs. These collision pairs will be
95 * used in the fine search to investigate if they are in contact or not.
96 *
97 * @param[in] particle_handler The particle handler of particles in the broad
98 * search.
99 * @param[in] cells_local_periodic_neighbor_list A vector (with size equal to
100 * the number of local periodic cells at boundary 0) of vectors. Each sub-vector
101 * have a size equal to the number of adjacent local cells of the main cell plus
102 * one. The first element of each sub-vector shows the main cell itself.
103 * @param[in] cells_ghost_periodic_neighbor_list A vector (with size equal to
104 * the number of local periodic cells at boundary 0) of vectors. Each sub-vector
105 * have a size equal to the number of adjacent ghost cells of the main cell plus
106 * one. The first element of each sub-vector shows the main cell itself.
107 * @param[in] cells_ghost_local_periodic_neighbor_list A vector (with size equal
108 * to the number of ghost periodic cells at boundary 0) of vectors. Each
109 * sub-vector have a size equal to the number of adjacent local cells of the
110 * main ghost cell plus one. The first element of each sub-vector shows the main
111 * ghost cell itself.
112 * @param[out] local_contact_pair_periodic_candidates Ankerl unordered dense
113 * map. Stores potential pairs of local-local periodic particles in contact.
114 * Keys are local particle ids at boundary 0 and mapped types are vectors of
115 * local particle ids at boundary 1.
116 * @param[out] ghost_contact_pair_periodic_candidates Ankerl unordered dense
117 * map. Stores potential pairs of local-ghost periodic particles in contact.
118 * Keys are local particle ids at boundary 0 and mapped types are vectors of
119 * ghost particle ids at boundary 1.
120 * @param[out] ghost_local_contact_pair_periodic_candidates Ankerl unordered
121 * dense map. Stores potential pairs of local-ghost periodic particles in
122 * contact. Keys are ghost at boundary 0 particle ids and mapped types are
123 * vectors of local particle ids at boundary 1.
124 */
125template <int dim>
126void
128 dealii::Particles::ParticleHandler<dim> &particle_handler,
130 &cells_local_periodic_neighbor_list,
132 &cells_ghost_periodic_neighbor_list,
134 &cells_ghost_local_periodic_neighbor_list,
136 &local_contact_pair_periodic_candidates,
138 &ghost_contact_pair_periodic_candidates,
140 &ghost_local_contact_pair_periodic_candidates);
141
142/**
143 * @brief Finds a vector of pairs (particle_particle_candidates) which contains the
144 * candidate particle-particle collision pairs. These collision pairs will be
145 * used in the fine search to investigate if they are in contact or not.
146 * This version of the function is used when adaptive sparse contacts is
147 * enabled.
148 *
149 * @param[in] particle_handler The particle handler of particles in the broad
150 * search.
151 * @param[in] cells_local_periodic_neighbor_list A vector (with size equal to
152 * the number of local periodic cells at boundary 0) of vectors. Each sub-vector
153 * have a size equal to the number of adjacent local cells of the main cell plus
154 * one. The first element of each sub-vector shows the main cell itself.
155 * @param[in] cells_ghost_periodic_neighbor_list A vector (with size equal to
156 * the number of local periodic cells at boundary 0) of vectors. Each sub-vector
157 * have a size equal to the number of adjacent ghost cells of the main cell plus
158 * one. The first element of each sub-vector shows the main cell itself.
159 * @param[in] cells_ghost_local_periodic_neighbor_list A vector (with size equal
160 * to the number of ghost periodic cells at boundary 0) of vectors. Each
161 * sub-vector have a size equal to the number of adjacent local cells of the
162 * main ghost cell plus one. The first element of each sub-vector shows the main
163 * ghost cell itself.
164 * @param[out] local_contact_pair_periodic_candidates Ankerl unordered dense
165 * map. Stores potential pairs of local-local periodic particles in contact.
166 * Keys are local particle ids at boundary 0 and mapped types are vectors of
167 * local particle ids at boundary 1.
168 * @param[out] ghost_contact_pair_periodic_candidates Ankerl unordered dense
169 * map. Stores potential pairs of local-ghost periodic particles in contact.
170 * Keys are local particle ids at boundary 0 and mapped types are vectors of
171 * ghost particle ids at boundary 1.
172 * @param[out] ghost_local_contact_pair_periodic_candidates Ankerl unordered
173 * dense map. Stores potential pairs of local-ghost periodic particles in
174 * contact. Keys are ghost at boundary 0 particle ids and mapped types are
175 * vectors of local particle ids at boundary 1.
176 * @param sparse_contacts_object The object that contains the
177 * information about the mobility status of cells
178 */
179template <int dim, typename PropertiesIndex>
180void
182 dealii::Particles::ParticleHandler<dim> &particle_handler,
184 &cells_local_periodic_neighbor_list,
186 &cells_ghost_periodic_neighbor_list,
188 &cells_ghost_local_periodic_neighbor_list,
190 &local_contact_pair_periodic_candidates,
192 &ghost_contact_pair_periodic_candidates,
194 &ghost_local_contact_pair_periodic_candidates,
195 const AdaptiveSparseContacts<dim, PropertiesIndex> &sparse_contacts_object);
196
197/**
198 * @brief Stores the candidate particle-particle collision pairs with a given
199 * particle iterator. particle_begin iterator is useful to skip storage of the
200 * first particle in main cell (particle_begin will be the iterator after the
201 * particles_to_evaluate.begin() in that case). When particle_begin is
202 * particles_to_evaluate.begin(), it stores all the particle id in
203 * contact_pair_candidates.
204 *
205 * @param main_particle_id The id of the main particle to store the candidate.
206 * @param particle_begin The particle iterator to start storing particle ids.
207 * @param particles_to_evaluate The particle range to evaluate with the
208 * particle iterator prior storing ids.
209 * @param contact_pair_candidates A map which will contain all the particle
210 * pairs candidate.
211 */
212template <int dim>
213inline void
215 const types::particle_index &main_particle_id,
216 const typename dealii::Particles::ParticleHandler<
217 dim>::particle_iterator_range::iterator &particle_begin,
218 const typename dealii::Particles::ParticleHandler<
219 dim>::particle_iterator_range &particles_to_evaluate,
221 &contact_pair_candidates);
222
223#endif
Mechanism that disables contacts computation through mobility status of cells based on granular tempe...
void find_particle_particle_contact_pairs(dealii::Particles::ParticleHandler< dim > &particle_handler, const typename DEM::dem_data_structures< dim >::cells_neighbor_list &cells_local_neighbor_list, const typename DEM::dem_data_structures< dim >::cells_neighbor_list &cells_ghost_neighbor_list, typename DEM::dem_data_structures< dim >::particle_particle_candidates &local_contact_pair_candidates, typename DEM::dem_data_structures< dim >::particle_particle_candidates &ghost_contact_pair_candidates)
Finds a vector of pairs (particle_particle_candidates) which shows the candidate particle-particle co...
void find_particle_particle_periodic_contact_pairs(dealii::Particles::ParticleHandler< dim > &particle_handler, const typename DEM::dem_data_structures< dim >::cells_neighbor_list &cells_local_periodic_neighbor_list, const typename DEM::dem_data_structures< dim >::cells_neighbor_list &cells_ghost_periodic_neighbor_list, const typename DEM::dem_data_structures< dim >::cells_neighbor_list &cells_ghost_local_periodic_neighbor_list, typename DEM::dem_data_structures< dim >::particle_particle_candidates &local_contact_pair_periodic_candidates, typename DEM::dem_data_structures< dim >::particle_particle_candidates &ghost_contact_pair_periodic_candidates, typename DEM::dem_data_structures< dim >::particle_particle_candidates &ghost_local_contact_pair_periodic_candidates)
Finds vectors of pairs (particle_particle_candidates) which contains the candidate particle-particle ...
void store_candidates(const types::particle_index &main_particle_id, const typename dealii::Particles::ParticleHandler< dim >::particle_iterator_range::iterator &particle_begin, const typename dealii::Particles::ParticleHandler< dim >::particle_iterator_range &particles_to_evaluate, typename DEM::dem_data_structures< dim >::particle_particle_candidates &contact_pair_candidates)
Stores the candidate particle-particle collision pairs with a given particle iterator....
std::vector< std::vector< typename Triangulation< dim >::active_cell_iterator > > cells_neighbor_list
ankerl::unordered_dense::map< types::particle_index, std::vector< types::particle_index > > particle_particle_candidates