Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/dd/dd0/geometry_2utils_8h_source.html
DOLFINx  0.5.1
DOLFINx C++ interface
utils.h
1 // Copyright (C) 2019-2021 Garth N. Wells and Jørgen S. Dokken
2 //
3 // This file is part of DOLFINx (https://www.fenicsproject.org)
4 //
5 // SPDX-License-Identifier: LGPL-3.0-or-later
6 
7 #pragma once
8 
9 #include <array>
10 #include <cstdint>
11 #include <dolfinx/graph/AdjacencyList.h>
12 #include <span>
13 #include <vector>
14 
15 namespace dolfinx::mesh
16 {
17 class Mesh;
18 }
19 
20 namespace dolfinx::geometry
21 {
22 class BoundingBoxTree;
23 
30 BoundingBoxTree
31 create_midpoint_tree(const mesh::Mesh& mesh, int tdim,
32  const std::span<const std::int32_t>& entity_indices);
33 
39 std::vector<std::array<int, 2>>
40 compute_collisions(const BoundingBoxTree& tree0, const BoundingBoxTree& tree1);
41 
49 graph::AdjacencyList<std::int32_t>
50 compute_collisions(const BoundingBoxTree& tree,
51  const std::span<const double>& points);
52 
63 std::vector<std::int32_t> compute_closest_entity(
64  const BoundingBoxTree& tree, const BoundingBoxTree& midpoint_tree,
65  const mesh::Mesh& mesh, const std::span<const double>& points);
66 
72 double
73 compute_squared_distance_bbox(const std::array<std::array<double, 3>, 2>& b,
74  const std::array<double, 3>& x);
75 
85 std::vector<double>
86 shortest_vector(const mesh::Mesh& mesh, int dim,
87  const std::span<const std::int32_t>& entities,
88  const std::span<const double>& points);
89 
102 std::vector<double>
103 squared_distance(const mesh::Mesh& mesh, int dim,
104  const std::span<const std::int32_t>& entities,
105  const std::span<const double>& points);
106 
118 graph::AdjacencyList<int> compute_colliding_cells(
119  const mesh::Mesh& mesh,
120  const graph::AdjacencyList<std::int32_t>& candidate_cells,
121  const std::span<const double>& points);
122 } // namespace dolfinx::geometry
Geometry data structures and algorithms.
Definition: BoundingBoxTree.h:23
std::vector< double > shortest_vector(const mesh::Mesh &mesh, int dim, const std::span< const std::int32_t > &entities, const std::span< const double > &points)
Compute the shortest vector from a mesh entity to a point.
Definition: utils.cpp:377
std::vector< std::array< int, 2 > > compute_collisions(const BoundingBoxTree &tree0, const BoundingBoxTree &tree1)
Compute all collisions between two BoundingBoxTrees (local to process)
Definition: utils.cpp:261
std::vector< std::int32_t > compute_closest_entity(const BoundingBoxTree &tree, const BoundingBoxTree &midpoint_tree, const mesh::Mesh &mesh, const std::span< const double > &points)
Compute closest mesh entity to a point.
Definition: utils.cpp:302
std::vector< double > squared_distance(const mesh::Mesh &mesh, int dim, const std::span< const std::int32_t > &entities, const std::span< const double > &points)
Compute the squared distance between a point and a mesh entity. The distance is computed between the ...
Definition: utils.cpp:449
BoundingBoxTree create_midpoint_tree(const mesh::Mesh &mesh, int tdim, const std::span< const std::int32_t > &entity_indices)
Create a bounding box tree for a subset of entities (local to process) based on the entity midpoints.
Definition: utils.cpp:239
graph::AdjacencyList< int > compute_colliding_cells(const mesh::Mesh &mesh, const graph::AdjacencyList< std::int32_t > &candidate_cells, const std::span< const double > &points)
From a Mesh, find which cells collide with a set of points.
Definition: utils.cpp:461
double compute_squared_distance_bbox(const std::array< std::array< double, 3 >, 2 > &b, const std::array< double, 3 > &x)
Compute squared distance between point and bounding box.
Definition: utils.cpp:354
Mesh data structures and algorithms on meshes.
Definition: DofMap.h:30