Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
lethe_grid_tools.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2021-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_lethe_grid_tools_h
5#define lethe_lethe_grid_tools_h
6
7#include <core/serial_solid.h>
8
9#include <deal.II/base/tensor.h>
10
11#include <deal.II/dofs/dof_handler.h>
12
13#include <deal.II/fe/mapping_q_cache.h>
14
15#include <tuple>
16
17using namespace dealii;
19{
20 /**
21 * @brief
22 * Map the vertex index to the cells that includes that vertex.
23 *
24 * @param dof_handler DofHandler of the triangulation on which to create the map
25 *
26 * @param vertices_cell_map The map container of vertex ids with its set of neighbor cells
27 */
28
29 template <int dim>
30 void
32 const DoFHandler<dim> &dof_handler,
33 std::map<unsigned int,
34 std::set<typename DoFHandler<dim>::active_cell_iterator>>
35 &vertices_cell_map);
36
37 /**
38 * @brief
39 * Map the vertex index to the cells on periodic boundaries that includes the
40 * periodic coinciding vertex.
41 *
42 * @param dof_handler DofHandler of the triangulation on which to create the map
43 *
44 * @param vertices_cell_map The map of vertex ids at periodic boundary to the
45 * set of periodic neighbor cells
46 */
47
48 template <int dim>
49 void
51 const DoFHandler<dim> &dof_handler,
52 std::map<unsigned int,
53 std::set<typename DoFHandler<dim>::active_cell_iterator>>
54 &vertices_cell_map);
55
56 /**
57 * @brief
58 * Return the cell around a point by starting from the least refined level and
59 * iterating over children.
60 *
61 * @param point The point around which we want to find the cell.
62 *
63 */
64 template <int dim>
65 typename DoFHandler<dim>::active_cell_iterator
66 find_cell_around_point_with_tree(const DoFHandler<dim> &dof_handler,
67 const Point<dim> &point);
68
69 /**
70 * @brief
71 * Return the cell around a point based on an initial guess of a nearby cell
72 *
73 * @param cell The initial cell. We suspect that the point is in one of the neighbours of this cell.
74 *
75 * @param point The point around which we want to find the cell.
76 *
77 * @param vertices_cell_map see vertices_cell_mapping function description.
78 */
79 template <int dim>
80 typename DoFHandler<dim>::active_cell_iterator
82 const DoFHandler<dim> &dof_handler,
83 std::map<unsigned int,
84 std::set<typename DoFHandler<dim>::active_cell_iterator>>
85 &vertices_cell_map,
86 const typename DoFHandler<dim>::active_cell_iterator &cell,
87 const Point<dim> &point);
88
89 /**
90 * @brief
91 * Return a vector of cells around a cell. The vector of cells includes all
92 * the cells that share a vertex with the initial cell, including the initial
93 * cell.
94 *
95 * @param cell The initial cell. We want to know all the cells that share a vertex with this cell.
96 * @param vertices_cell_map see vertices_cell_mapping function description.
97 */
98 template <int dim>
99 std::vector<typename DoFHandler<dim>::active_cell_iterator>
101 std::map<unsigned int,
102 std::set<typename DoFHandler<dim>::active_cell_iterator>>
103 &vertices_cell_map,
104 const typename DoFHandler<dim>::active_cell_iterator &cell);
105
106 /**
107 * @brief
108 * Return a vector of cells around a flat cell in spacedim. A flat cell has a
109 * dim of spacedim-1.
110 *
111 * @param cell The cell that describes the flat. We want to know all the cells that are cut by the flat.
112 *
113 * @param vertices_cell_map see vertices_cell_mapping function description.
114 */
115
116 template <int dim>
117 std::vector<typename DoFHandler<dim>::active_cell_iterator>
119 const DoFHandler<dim> &dof_handler,
120 const typename DoFHandler<dim - 1, dim>::active_cell_iterator &cell,
121 std::map<unsigned int,
122 std::set<typename DoFHandler<dim>::active_cell_iterator>>
123 &vertices_cell_map);
124
125 /**
126 * @brief
127 * Return a vector of cells around an edge cell in spacedim. An edge cell as a
128 * dim of 1.
129 *
130 * @param point_1 The first point that describes the edge
131 *
132 * @param point_2 The second point that describes the edge
133 *
134 * @param vertices_cell_map see vertices_cell_mapping function description.
135 */
136 template <int dim>
137 std::vector<typename DoFHandler<dim>::active_cell_iterator>
139 const DoFHandler<dim> &dof_handler,
140 std::map<unsigned int,
141 std::set<typename DoFHandler<dim>::active_cell_iterator>>
142 &vertices_cell_map,
143 const typename DoFHandler<dim>::active_cell_iterator &cell,
144 Point<dim> &point_1,
145 Point<dim> &point_2);
146
147 /**
148 * @brief Flag for refinement of all the cells of a triangulation which lie within
149 * a refinement box
150 *
151 * @param[in] dof_handler The DoFHandler of the triangulation whose cells must
152 * be flagged. No dofs need to be distributed on it, since the search is
153 * purely geometric.
154 *
155 * @param[in] box_triangulation The triangulation delimiting the refinement
156 * box, as built by build_refinement_box_triangulation()
157 *
158 * @remark Only the refinement flags are set. It is up to the caller to
159 * execute the coarsening and refinement of the triangulation, since the
160 * solvers must transfer their solutions across it.
161 */
162 template <int dim>
163 void
164 flag_cells_in_refinement_box(const DoFHandler<dim> &dof_handler,
165 const Triangulation<dim> &box_triangulation);
166
167 /**
168 * @brief
169 * Return a vector of cells from the dof_handler that are inside a cell from
170 * another mesh.
171 *
172 * @param cell Describes the volume for which we want to obtain the enclosed cells.
173 */
174 template <int dim>
175 std::vector<typename DoFHandler<dim>::active_cell_iterator>
177 const DoFHandler<dim> &dof_handler,
178 const typename DoFHandler<dim>::active_cell_iterator &cell);
179
180 /**
181 * @brief
182 * Return a bool that indicates if a cell is cut by a flat cell
183 *
184 * @param cell The cell that we want to check.
185 *
186 * @param cell_flat The cell that describes the flat.
187 */
188 template <int dim>
189 bool
191 const typename DoFHandler<dim>::active_cell_iterator &cell,
192 const typename DoFHandler<dim - 1, dim>::active_cell_iterator &cell_flat);
193
194 /**
195 * @brief
196 * Return a bool that say if a cell is cut by a edge cell
197 *
198 * @param cell The cell that we want to check.
199 *
200 * @param cell_edge The cell that describes the edge.
201 */
202 template <int dim>
203 bool
205 const typename DoFHandler<dim>::active_cell_iterator &cell,
206 const TriaIterator<CellAccessor<1, dim>> &cell_edge);
207
208 /**
209 * @brief
210 * Return a bool that say if a cell is cut by a edge cell
211 *
212 * @param cell The cell that we want to check.
213 *
214 * @param point_1 The first point that describes the edge
215 *
216 * @param point_2 The second point that describes the edge
217 */
218 template <int dim>
219 bool
221 const typename DoFHandler<dim>::active_cell_iterator &cell,
222 Point<dim> point_1,
223 Point<dim> point_2);
224
225
226 /**
227 * @brief
228 * A copy of the project_to_d_linear from dealii that also outputs the normal
229 * of the flat
230 *
231 * @param object The flat or the edge.
232 *
233 * @param trial_point The point we project on the flat or edge
234 *
235 */
236 template <int spacedim, int structdim>
237 std::pair<std::pair<Point<spacedim>, bool>, Tensor<1, spacedim>>
239 const typename DoFHandler<structdim, spacedim>::active_cell_iterator
240 &object,
241 const Point<spacedim> &trial_point);
242
243 /**
244 * @brief
245 * Function returns all the boundary cells with at least one vertex in a
246 * sphere.
247 *
248 * @param dof_handler the dof handler containing all the elements.
249 *
250 * @param center The center of the sphere.
251 *
252 * @param radius The radius of the sphere.
253 *
254 */
255 template <int dim>
256 std::vector<typename DoFHandler<dim>::active_cell_iterator>
257 find_boundary_cells_in_sphere(const DoFHandler<dim> &dof_handler,
258 const Point<dim> &center,
259 const double radius);
260
261
262 /**
263 * @brief
264 * Function returns all the cells cut by a list of object defined by a mesh
265 *
266 * @param dof_handler the dof handler containing all the elements.
267 * @param vertices_cell_map An objects that maps the vertices to cells.
268 * @param list_of_objects Solid objects
269 *
270 *
271 */
272 template <int spacedim, int structdim>
273 std::map<
274 typename DoFHandler<spacedim>::active_cell_iterator,
275 std::map<unsigned int,
276 typename DoFHandler<structdim, spacedim>::active_cell_iterator>>
278 const DoFHandler<spacedim> &dof_handler,
279 std::map<unsigned int,
280 std::set<typename DoFHandler<spacedim>::active_cell_iterator>>
281 &vertices_cell_map,
282 std::vector<SerialSolid<structdim, spacedim>> &list_of_objects);
283
284
285 /**
286 * @enum ParticleTriangleContactIndicator
287 * @brief Indicates the type of contact between a particle and a triangle.
288 */
296
297 /**
298 * @brief Particle-independent geometric data of a triangle (its first
299 * vertex, edge vectors, unit normal, and the coefficients of its first
300 * fundamental form), precomputed once by prepare_triangle_projection_data
301 * so that repeated find_particle_triangle_projection queries against the
302 * same triangle (e.g. for several nearby particles) do not recompute it.
303 * This data is defined "Geometric Tools for Computer Graphics, Eberly 2003
304 * Chapter 10.3.2 - Point to triangle."
305 *
306 * @tparam dim An integer that denotes the number of spatial dimensions.
307 */
308 template <int dim>
310 {
311 Point<dim> p_0; // Point 0
312 Tensor<1, dim> e_0; // Vector (0 -> 1)
313 Tensor<1, dim> e_1; // Vector (0 -> 2)
314 Tensor<1, dim> unit_normal; // Normal unit vector of the triangle
315 double a; // squared length of edge 0 (e_0.norm_square())
316 double b; // dot product between the two edge vectors (mixed term)
317 double c; // squared length of edge 1 (e_1.norm_square())
318 double det; // Determinant
319 };
320
321 /**
322 * @brief Precomputes the particle-independent geometric data of a triangle
323 * (see TriangleProjectionData) used by find_particle_triangle_projection.
324 *
325 * @tparam dim An integer that denotes the number of spatial dimensions.
326 *
327 * @param triangle A vector of points that defines a triangle
328 *
329 * @return The precomputed triangle data.
330 */
331 template <int dim>
333 prepare_triangle_projection_data(const std::vector<Point<dim>> &triangle);
334
335 /**
336 * @brief Finds the contact point between a triangle (defined using three
337 * vertices) and a particle center, the normal contact vector and the contact
338 * type. The particle center is first compared to the plane formed by the
339 * triangle. If the particle is farther from the plane than the defined
340 * cutoff distance, the function returns right away with a
341 * "pass_distance_check = false". Otherwise, the full contact point
342 * calculation is taken from Geometric Tools for
343 * Computer Graphics, Eberly 2003 Chapter 10.3.2 - Point to triangle.
344 * The entire reference is available at:
345 * https://www.sciencedirect.com/science/article/pii/B9781558605947500138
346 * A full implementation of the above reference is also available here:
347 * https://www.geometrictools.com/Documentation/DistancePoint3Triangle3.pdf
348 * Variables name are taken straight from this reference to ensure a better
349 * readability.
350 *
351 * @tparam dim An integer that denotes the number of spatial dimensions.
352 *
353 * @param triangle_data Precomputed particle-independent geometric data of
354 * the triangle, from prepare_triangle_projection_data. Reusing it across
355 * several particles tested against the same triangle avoids recomputing
356 * this triangle's edge vectors, normal and fundamental-form coefficients
357 * for each particle.
358 * @param particle_position Location of the particle center.
359 * @param cutoff_distance Largest distance between the particle center and
360 * the plane of the triangle for which the projection is calculated.
361 *
362 * @return A tuple in which: 0. a bool that is true if the particle center
363 * is at most cutoff_distance away from the triangle plane, 1. a projected
364 * location of the particle on the triangle, 2. a normal contact
365 * vector between the triangle and the particle, 3. a contact
366 * type between the particle and the triangle. When the bool is false, the
367 * projected location and the normal vector are zero and the contact type is
368 * no_contact.
369 */
370 template <int dim>
371 std::tuple<bool, Point<3>, Tensor<1, 3>, ParticleTriangleContactIndicator>
373 const TriangleProjectionData<dim> &triangle_data,
374 const Point<dim> &particle_position,
375 const double cutoff_distance);
376
377 /**
378 * @brief Calculates the distance between points and a triangle (defined using
379 * three vertices). The full calculation is taken from Geometric Tools for
380 * Computer Graphics, Eberly 2003 Chapter 10.3.2 - Point to triangle.
381 * The entire reference is available at:
382 * https://www.sciencedirect.com/science/article/pii/B9781558605947500138
383 * A full implementation of the above reference is also available here:
384 * https://www.geometrictools.com/Documentation/DistancePoint3Triangle3.pdf
385 * Variables name are taken straight from this reference to ensure a better
386 * readability.
387 *
388 * @return A distance
389 *
390 * @param triangle_vertices A vector of points that defines a triangle
391 * @param point A point for which we want to find the distance to the triangle
392 *
393 */
394 template <int dim>
395 double
396 find_point_triangle_distance(const std::vector<Point<dim>> &triangle_vertices,
397 const Point<dim> &point);
398
399
400 /**
401 * @brief Calculates the intersection points between a line and a sphere. The
402 * full calculation is taken from Geometric Tools for Computer Graphics,
403 * Eberly 2003 Chapter 11.3.2 - LINEAR COMPONENTS AND A SPHERE. The entire
404 * reference is available at:
405 * https://www.sciencedirect.com/science/article/pii/B978155860594750014X
406 *
407 * @param[in] line_start The starting point of the line
408 * @param[in] line_direction The direction of the line
409 * @param[in] sphere_center The center of the sphere
410 * @param[in] sphere_diameter The diameter of the sphere
411 * @return A vector of points that are the intersection points between the line
412 * and the sphere. The vector can be empty if there is no intersection, or
413 * contain one or two points if there is an intersection.
414 */
415 template <int dim>
416 std::vector<Point<dim>>
417 find_line_sphere_intersection(const Point<dim> &line_start,
418 const Tensor<1, dim> &line_direction,
419 const Point<dim> &sphere_center,
420 const double &sphere_diameter);
421
422
423 /**
424 * @brief Calculate the minimum distance between a point and a line (defined using
425 * its orign and direction). The full calculation is taken from
426 * Geometric Tools for Computer Graphics, Eberly 2003 Chapter 10.2 - Point
427 * to linear component. The entire reference is available at:
428 * https://www.sciencedirect.com/science/article/pii/B9781558605947500138
429 * A full implementation of the above reference is also available here:
430 * https://www.geometrictools.com/Documentation/DistancePointLine.pdf
431 * Variables name are taken straight from this reference to ensure a better
432 * readability.
433 *
434 * @return A distance
435 *
436 * @param[in] line_origin Origin of the line (any point on the line)
437 * @param[in] line_direction Vector tangent to the line
438 * @param[in] point A point for which we want to find the minimum distance to
439 * the line
440 *
441 * return distance
442 *
443 */
444 template <int dim>
445 inline double
446 find_point_line_distance(const Point<dim> &line_origin,
447 const Tensor<1, dim> &line_direction,
448 const Point<dim> &point)
449 {
450 Tensor<1, dim> diff = point - line_origin;
451
452 double t_0 = line_direction * diff;
453 t_0 /= line_direction.norm();
454
455 const Point<dim> closest_point_on_line = line_origin + t_0 * line_direction;
456
457 return point.distance(closest_point_on_line);
458 }
459
460 /**
461 * @brief
462 * A functor that provides a unique and uniformly distributed hash for a
463 * a cell. Used to store cells in hash sets.
464 */
465 template <int dim>
467 {
468 std::size_t
470 const typename DoFHandler<dim>::active_cell_iterator &cell) const noexcept
471 {
472 return std::hash<int>()(cell->global_active_cell_index());
473 }
474 };
475
476 /**
477 * @brief Transform angular velocity into linear velocity considering that the
478 * angular velocity @p omega is constant in all directions.
479 *
480 * @param[in] omega Angular velocity value
481 * @param[in] point Coordinates of the point at which the linear velocity is
482 * being calculated
483 * @param[in] rotation_axis_direction Direction of the rotation axis. In 2D,
484 * we apply a rotation around the z-axis.
485 *
486 * @return Linear velocity at @p point
487 */
488 template <int dim>
489 inline Tensor<1, dim>
490 angular_to_linear_velocity(const double omega,
491 const Tensor<1, dim> &point,
492 const unsigned int rotation_axis_direction = 2)
493 {
494 Tensor<1, dim> result;
495
496 if constexpr (dim == 2)
497 {
498 result[0] = -omega * point[1];
499 result[1] = omega * point[0];
500 }
501
502 if constexpr (dim == 3)
503 {
504 // Store angular velocity according to unit vector that defines the
505 // rotation axis
506 Tensor<1, dim> omega_vec;
507 omega_vec[rotation_axis_direction] = omega;
508 // Compute cross product
509 result = cross_product_3d(omega_vec, point);
510 }
511
512 return result;
513 }
514
515 /**
516 * @brief Rotate the mapping according to the rotation angle in a rotor-stator configuration
517 *
518 * @param[in] dof_handler DofHandler of the triangulation
519 * @param[in,out] mapping_cache Rotated mapping
520 * @param[in] mapping Current mapping
521 * @param[in] rotation_angle Rotation angle of the rotor domain
522 * @param[in] center_of_rotation Center of rotation of the rotor domain.
523 * Default is the origin
524 * @param[in] rotation_axis_direction Direction of the rotation axis
525 */
526 template <int dim>
527 void
528 rotate_mapping(const DoFHandler<dim> &dof_handler,
529 MappingQCache<dim> &mapping_cache,
530 const Mapping<dim> &mapping,
531 const double rotation_angle,
532 const Point<dim> &center_of_rotation = Point<dim>(),
533 const unsigned int rotation_axis_direction = 2);
534
535 /**
536 * @brief
537 * A functor that provides a way to check if two cells are the same cell.
538 * Used to store cells in hash sets.
539 */
540 template <int dim>
542 {
543 std::size_t
544 operator()(const typename DoFHandler<dim>::active_cell_iterator &cell1,
545 const typename DoFHandler<dim>::active_cell_iterator &cell2)
546 const noexcept
547 {
548 return cell1->global_active_cell_index() ==
549 cell2->global_active_cell_index();
550 }
551 };
552
553 /**
554 * @brief Map the vertex index to the cells which include that vertex.
555 *
556 * @param tria Triangulation
557 * @param vertices_cell_map The map container of vertex ids with its set of
558 * neighbor cells.
559 */
560 template <int dim, int spacedim>
561 void
563 const Triangulation<dim, spacedim> &tria,
564 std::map<
565 unsigned int,
566 std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
567 &vertices_cell_map);
568
569
570 /**
571 * @brief Return a vector of cells around a cell. This vector includes
572 * all the cells that share a vertex with the initial cell, including the
573 * initial cell.
574 *
575 * @param cell The initial cell. We want to know all the cells that share a
576 * vertex with this cell.
577 * @param vertices_cell_map Map of vertex ids to the set of neighbor cells.
578 */
579 template <int dim, int spacedim = dim>
580 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>
582 std::map<
583 unsigned int,
584 std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
585 &vertices_cell_map,
586 const typename Triangulation<dim, spacedim>::active_cell_iterator &cell);
587
588} // namespace LetheGridTools
589#endif // lethe_lethegridtools_h
double find_point_triangle_distance(const std::vector< Point< dim > > &triangle_vertices, const Point< dim > &point)
Calculates the distance between points and a triangle (defined using three vertices)....
std::vector< typename DoFHandler< dim >::active_cell_iterator > find_cells_in_cells(const DoFHandler< dim > &dof_handler, const typename DoFHandler< dim >::active_cell_iterator &cell)
Return a vector of cells from the dof_handler that are inside a cell from another mesh.
void vertices_cell_mapping(const DoFHandler< dim > &dof_handler, std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > &vertices_cell_map)
Map the vertex index to the cells that includes that vertex.
std::vector< typename DoFHandler< dim >::active_cell_iterator > find_cells_around_edge(const DoFHandler< dim > &dof_handler, std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > &vertices_cell_map, const typename DoFHandler< dim >::active_cell_iterator &cell, Point< dim > &point_1, Point< dim > &point_2)
Return a vector of cells around an edge cell in spacedim. An edge cell as a dim of 1.
bool cell_pierced_by_edge(const typename DoFHandler< dim >::active_cell_iterator &cell, const TriaIterator< CellAccessor< 1, dim > > &cell_edge)
Return a bool that say if a cell is cut by a edge cell.
void vertices_cell_mapping_with_periodic_boundaries(const DoFHandler< dim > &dof_handler, std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > &vertices_cell_map)
Map the vertex index to the cells on periodic boundaries that includes the periodic coinciding vertex...
std::vector< Point< dim > > find_line_sphere_intersection(const Point< dim > &line_start, const Tensor< 1, dim > &line_direction, const Point< dim > &sphere_center, const double &sphere_diameter)
Calculates the intersection points between a line and a sphere. The full calculation is taken from Ge...
void rotate_mapping(const DoFHandler< dim > &dof_handler, MappingQCache< dim > &mapping_cache, const Mapping< dim > &mapping, const double rotation_angle, const Point< dim > &center_of_rotation=Point< dim >(), const unsigned int rotation_axis_direction=2)
Rotate the mapping according to the rotation angle in a rotor-stator configuration.
std::vector< typename DoFHandler< dim >::active_cell_iterator > find_cells_around_cell(std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > &vertices_cell_map, const typename DoFHandler< dim >::active_cell_iterator &cell)
Return a vector of cells around a cell. The vector of cells includes all the cells that share a verte...
std::pair< std::pair< Point< spacedim >, bool >, Tensor< 1, spacedim > > project_to_d_linear_object(const typename DoFHandler< structdim, spacedim >::active_cell_iterator &object, const Point< spacedim > &trial_point)
A copy of the project_to_d_linear from dealii that also outputs the normal of the flat.
double find_point_line_distance(const Point< dim > &line_origin, const Tensor< 1, dim > &line_direction, const Point< dim > &point)
Calculate the minimum distance between a point and a line (defined using its orign and direction)....
ParticleTriangleContactIndicator
Indicates the type of contact between a particle and a triangle.
TriangleProjectionData< dim > prepare_triangle_projection_data(const std::vector< Point< dim > > &triangle)
Precomputes the particle-independent geometric data of a triangle (see TriangleProjectionData) used b...
std::vector< typename DoFHandler< dim >::active_cell_iterator > find_boundary_cells_in_sphere(const DoFHandler< dim > &dof_handler, const Point< dim > &center, const double radius)
Function returns all the boundary cells with at least one vertex in a sphere.
DoFHandler< dim >::active_cell_iterator find_cell_around_point_with_neighbors(const DoFHandler< dim > &dof_handler, std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > &vertices_cell_map, const typename DoFHandler< dim >::active_cell_iterator &cell, const Point< dim > &point)
Return the cell around a point based on an initial guess of a nearby cell.
bool cell_cut_by_flat(const typename DoFHandler< dim >::active_cell_iterator &cell, const typename DoFHandler< dim - 1, dim >::active_cell_iterator &cell_flat)
Return a bool that indicates if a cell is cut by a flat cell.
void flag_cells_in_refinement_box(const DoFHandler< dim > &dof_handler, const Triangulation< dim > &box_triangulation)
Flag for refinement of all the cells of a triangulation which lie within a refinement box.
std::tuple< bool, Point< 3 >, Tensor< 1, 3 >, ParticleTriangleContactIndicator > find_particle_triangle_projection(const TriangleProjectionData< dim > &triangle_data, const Point< dim > &particle_position, const double cutoff_distance)
Finds the contact point between a triangle (defined using three vertices) and a particle center,...
std::map< typename DoFHandler< spacedim >::active_cell_iterator, std::map< unsigned int, typename DoFHandler< structdim, spacedim >::active_cell_iterator > > find_cells_cut_by_object(const DoFHandler< spacedim > &dof_handler, std::map< unsigned int, std::set< typename DoFHandler< spacedim >::active_cell_iterator > > &vertices_cell_map, std::vector< SerialSolid< structdim, spacedim > > &list_of_objects)
Function returns all the cells cut by a list of object defined by a mesh.
DoFHandler< dim >::active_cell_iterator find_cell_around_point_with_tree(const DoFHandler< dim > &dof_handler, const Point< dim > &point)
Return the cell around a point by starting from the least refined level and iterating over children.
Tensor< 1, dim > angular_to_linear_velocity(const double omega, const Tensor< 1, dim > &point, const unsigned int rotation_axis_direction=2)
Transform angular velocity into linear velocity considering that the angular velocity omega is consta...
std::vector< typename DoFHandler< dim >::active_cell_iterator > find_cells_around_flat_cell(const DoFHandler< dim > &dof_handler, const typename DoFHandler< dim - 1, dim >::active_cell_iterator &cell, std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > &vertices_cell_map)
Return a vector of cells around a flat cell in spacedim. A flat cell has a dim of spacedim-1.
Particle-independent geometric data of a triangle (its first vertex, edge vectors,...
A functor that provides a way to check if two cells are the same cell. Used to store cells in hash se...
std::size_t operator()(const typename DoFHandler< dim >::active_cell_iterator &cell1, const typename DoFHandler< dim >::active_cell_iterator &cell2) const noexcept
A functor that provides a unique and uniformly distributed hash for a a cell. Used to store cells in ...
std::size_t operator()(const typename DoFHandler< dim >::active_cell_iterator &cell) const noexcept