11 #ifndef MANIFOLD_TRACING_H_
12 #define MANIFOLD_TRACING_H_
14 #include <gudhi/IO/output_debug_traces_to_html.h>
15 #include <gudhi/Coxeter_triangulation/Query_result.h>
17 #include <boost/functional/hash.hpp>
19 #include <Eigen/Dense>
22 #include <unordered_map>
26 namespace coxeter_triangulation {
38 template <
class Triangulation_>
41 using Simplex_handle =
typename Triangulation_::Simplex_handle;
44 typedef Simplex_handle argument_type;
45 typedef std::size_t result_type;
46 result_type operator()(
const argument_type& s)
const noexcept {
47 return boost::hash<typename Simplex_handle::Vertex>()(s.vertex());
56 typedef std::unordered_map<Simplex_handle, Eigen::VectorXd, Simplex_hash>
Out_simplex_map;
79 template <
class Po
int_range,
class Intersection_oracle>
82 std::size_t cod_d = oracle.cod_d();
83 std::queue<Simplex_handle> queue;
85 for (
const auto& p : seed_points) {
86 Simplex_handle full_simplex = triangulation.locate_point(p);
87 for (Simplex_handle face : full_simplex.face_range(cod_d)) {
91 mt_seed_inserted_list.push_back(MT_inserted_info(qr, face,
false));
99 while (!queue.empty()) {
100 Simplex_handle s = queue.front();
102 for (
auto cof : s.coface_range(cod_d + 1)) {
103 for (
auto face : cof.face_range(cod_d)) {
105 if (qr.
success && out_simplex_map.emplace(face, qr.
intersection).second) queue.emplace(face);
135 template <
class Po
int_range,
class Intersection_oracle>
137 const Intersection_oracle& oracle,
Out_simplex_map& interior_simplex_map,
139 std::size_t cod_d = oracle.cod_d();
140 std::queue<Simplex_handle> queue;
142 for (
const auto& p : seed_points) {
143 Simplex_handle full_simplex = triangulation.locate_point(p);
144 for (Simplex_handle face : full_simplex.face_range(cod_d)) {
145 auto qr = oracle.intersects(face, triangulation);
147 mt_seed_inserted_list.push_back(MT_inserted_info(qr, face,
false));
150 if (oracle.lies_in_domain(qr.intersection, triangulation)) {
151 if (interior_simplex_map.emplace(face, qr.intersection).second) queue.emplace(face);
153 for (Simplex_handle cof : face.coface_range(cod_d + 1)) {
154 auto qrb = oracle.intersects_boundary(cof, triangulation);
156 mt_seed_inserted_list.push_back(MT_inserted_info(qrb, cof,
true));
158 if (qrb.success) boundary_simplex_map.emplace(cof, qrb.intersection);
166 while (!queue.empty()) {
167 Simplex_handle s = queue.front();
169 for (
auto cof : s.coface_range(cod_d + 1)) {
170 for (
auto face : cof.face_range(cod_d)) {
171 auto qr = oracle.intersects(face, triangulation);
173 mt_inserted_list.push_back(MT_inserted_info(qr, face,
false));
176 if (oracle.lies_in_domain(qr.intersection, triangulation)) {
177 if (interior_simplex_map.emplace(face, qr.intersection).second) queue.emplace(face);
179 auto qrb = oracle.intersects_boundary(cof, triangulation);
181 mt_inserted_list.push_back(MT_inserted_info(qrb, cof,
true));
183 if (qrb.success) boundary_simplex_map.emplace(cof, qrb.intersection);
222 template <
class Po
int_range,
class Triangulation,
class Intersection_oracle,
class Out_simplex_map>
224 const Intersection_oracle& oracle, Out_simplex_map& out_simplex_map) {
258 template <
class Po
int_range,
class Triangulation,
class Intersection_oracle,
class Out_simplex_map>
260 const Intersection_oracle& oracle, Out_simplex_map& interior_simplex_map,
261 Out_simplex_map& boundary_simplex_map) {
A class that assembles methods for manifold tracing algorithm.
Definition: Manifold_tracing.h:39
void manifold_tracing_algorithm(const Point_range &seed_points, const Triangulation_ &triangulation, const Intersection_oracle &oracle, Out_simplex_map &interior_simplex_map, Out_simplex_map &boundary_simplex_map)
Computes the set of k-simplices that intersect the dimensional manifold given by an intersection orac...
Definition: Manifold_tracing.h:136
Manifold_tracing()
Empty constructor.
Definition: Manifold_tracing.h:192
std::unordered_map< Simplex_handle, Eigen::VectorXd, Simplex_hash > Out_simplex_map
Type of the output simplex map with keys of type Triangulation_::Simplex_handle and values of type Ei...
Definition: Manifold_tracing.h:56
void manifold_tracing_algorithm(const Point_range &seed_points, const Triangulation_ &triangulation, const Intersection_oracle &oracle, Out_simplex_map &out_simplex_map)
Computes the set of k-simplices that intersect a boundaryless implicit manifold given by an intersect...
Definition: Manifold_tracing.h:80
void manifold_tracing_algorithm(const Point_range &seed_points, const Triangulation &triangulation, const Intersection_oracle &oracle, Out_simplex_map &interior_simplex_map, Out_simplex_map &boundary_simplex_map)
Static method for Manifold_tracing<Triangulation_>::manifold_tracing_algorithm the dimensional manifo...
Definition: Manifold_tracing.h:259
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
The result of a query by an oracle such as Implicit_manifold_intersection_oracle.
Definition: Query_result.h:26
bool success
True if the query simplex intersects the manifold.
Definition: Query_result.h:33
Eigen::VectorXd intersection
The potentially lower-dimensional face of the query simplex that contains the intersection point....
Definition: Query_result.h:31