summaryrefslogtreecommitdiff
path: root/src/Coxeter_triangulation
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-11-10 15:02:29 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-11-10 15:02:29 +0100
commitb118b86b7f2e7ae9ee7f080ec89d956b161aedfd (patch)
tree94811a60c52f3dddfdca8eb077f74fe0e5a4e181 /src/Coxeter_triangulation
parenteb8164b76a062fe510a9281bfebfa34f66c72163 (diff)
Modify debug traces for coxeter to use gudhi DEBUG_TRACES mechanism
Diffstat (limited to 'src/Coxeter_triangulation')
-rw-r--r--src/Coxeter_triangulation/include/gudhi/Cell_complex.h15
-rw-r--r--src/Coxeter_triangulation/include/gudhi/IO/build_mesh_from_cell_complex.h17
-rw-r--r--src/Coxeter_triangulation/include/gudhi/IO/output_debug_traces_to_html.h9
-rw-r--r--src/Coxeter_triangulation/include/gudhi/Manifold_tracing.h11
4 files changed, 29 insertions, 23 deletions
diff --git a/src/Coxeter_triangulation/include/gudhi/Cell_complex.h b/src/Coxeter_triangulation/include/gudhi/Cell_complex.h
index 9cac58d9..b386e369 100644
--- a/src/Coxeter_triangulation/include/gudhi/Cell_complex.h
+++ b/src/Coxeter_triangulation/include/gudhi/Cell_complex.h
@@ -17,6 +17,7 @@
#include <map>
#include <utility> // for std::make_pair
+#include <gudhi/IO/output_debug_traces_to_html.h> // for DEBUG_TRACES
#include <gudhi/Permutahedral_representation/Simplex_comparator.h>
#include <gudhi/Cell_complex/Hasse_diagram_cell.h> // for Hasse_cell
@@ -73,7 +74,7 @@ class Cell_complex {
private:
Hasse_cell* insert_cell(const Simplex_handle& simplex, std::size_t cell_d, bool is_boundary) {
Simplex_cell_maps& simplex_cell_maps = (is_boundary ? boundary_simplex_cell_maps_ : interior_simplex_cell_maps_);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
CC_detail_list& cc_detail_list =
(is_boundary ? cc_boundary_detail_lists[cell_d] : cc_interior_detail_lists[cell_d]);
cc_detail_list.emplace_back(CC_detail_info(simplex));
@@ -85,12 +86,12 @@ class Cell_complex {
Hasse_cell* new_cell = hasse_cells_.back();
simplex_cell_map.emplace(std::make_pair(simplex, new_cell));
cell_simplex_map_.emplace(std::make_pair(new_cell, simplex));
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
cc_detail_list.back().status_ = CC_detail_info::Result_type::inserted;
#endif
return new_cell;
}
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
CC_detail_info& cc_info = cc_detail_list.back();
cc_info.trigger_ = to_string(map_it->first);
cc_info.status_ = CC_detail_info::Result_type::self;
@@ -130,7 +131,7 @@ class Cell_complex {
}
void construct_complex_(const Out_simplex_map_& out_simplex_map) {
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
cc_interior_summary_lists.resize(interior_simplex_cell_maps_.size());
cc_interior_prejoin_lists.resize(interior_simplex_cell_maps_.size());
cc_interior_detail_lists.resize(interior_simplex_cell_maps_.size());
@@ -148,7 +149,7 @@ class Cell_complex {
}
void construct_complex_(const Out_simplex_map_& interior_simplex_map, const Out_simplex_map_& boundary_simplex_map) {
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
cc_interior_summary_lists.resize(interior_simplex_cell_maps_.size());
cc_interior_prejoin_lists.resize(interior_simplex_cell_maps_.size());
cc_interior_detail_lists.resize(interior_simplex_cell_maps_.size());
@@ -168,7 +169,7 @@ class Cell_complex {
Hasse_cell* new_cell = insert_cell(simplex, 0, false);
cell_point_map_.emplace(std::make_pair(new_cell, point));
}
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
for (const auto& sc_pair : interior_simplex_cell_maps_[0])
cc_interior_summary_lists[0].push_back(CC_summary_info(sc_pair));
for (const auto& sc_pair : boundary_simplex_cell_maps_[0])
@@ -179,7 +180,7 @@ class Cell_complex {
cell_d < interior_simplex_cell_maps_.size() && !interior_simplex_cell_maps_[cell_d - 1].empty(); ++cell_d) {
expand_level(cell_d);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
for (const auto& sc_pair : interior_simplex_cell_maps_[cell_d])
cc_interior_summary_lists[cell_d].push_back(CC_summary_info(sc_pair));
if (cell_d < boundary_simplex_cell_maps_.size())
diff --git a/src/Coxeter_triangulation/include/gudhi/IO/build_mesh_from_cell_complex.h b/src/Coxeter_triangulation/include/gudhi/IO/build_mesh_from_cell_complex.h
index 0dc98f95..c794cfa4 100644
--- a/src/Coxeter_triangulation/include/gudhi/IO/build_mesh_from_cell_complex.h
+++ b/src/Coxeter_triangulation/include/gudhi/IO/build_mesh_from_cell_complex.h
@@ -11,6 +11,7 @@
#ifndef IO_BUILD_MESH_FROM_CELL_COMPLEX_H_
#define IO_BUILD_MESH_FROM_CELL_COMPLEX_H_
+#include <gudhi/IO/output_debug_traces_to_html.h> // for DEBUG_TRACES
#include <gudhi/IO/Mesh_medit.h>
#include <Eigen/Dense>
@@ -58,7 +59,7 @@ void populate_mesh(Mesh_medit& output, Simplex_cell_map& sc_map, Configuration c
for (const std::size_t& v : vertex_indices) barycenter += output.vertex_points[v - 1];
ci_map.emplace(std::make_pair(cell, index++));
output.vertex_points.emplace_back((1. / vertex_indices.size()) * barycenter);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
std::string vlist = " (" + std::to_string(index - 1) + ")";
for (const std::size_t& v : vertex_indices) vlist += " " + std::to_string(v);
cell_vlist_map.emplace(std::make_pair(to_string(cell), vlist));
@@ -66,12 +67,12 @@ void populate_mesh(Mesh_medit& output, Simplex_cell_map& sc_map, Configuration c
}
if (configuration.toggle_edges && sc_map.size() >= 2)
- for (const auto& sc_map : sc_map[1]) {
- Hasse_cell* edge_cell = sc_map.second;
+ for (const auto& sc_pair : sc_map[1]) {
+ Hasse_cell* edge_cell = sc_pair.second;
Mesh_element_vertices edge;
for (const auto& vi_pair : edge_cell->get_boundary()) edge.push_back(vi_map[vi_pair.first]);
output.edges.emplace_back(std::make_pair(edge, configuration.ref_edges));
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
std::string vlist;
for (const std::size_t& v : edge) vlist += " " + std::to_string(v);
cell_vlist_map.emplace(std::make_pair(to_string(edge_cell), vlist));
@@ -97,7 +98,7 @@ void populate_mesh(Mesh_medit& output, Simplex_cell_map& sc_map, Configuration c
for (const auto& vi_pair : ei_pair.first->get_boundary()) vertex_indices.emplace(vi_map[vi_pair.first]);
for (const std::size_t& v : vertex_indices) barycenter += output.vertex_points[v - 1];
output.vertex_points.emplace_back((1. / vertex_indices.size()) * barycenter);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
std::string vlist = " (" + std::to_string(index) + ")";
for (const std::size_t& v : vertex_indices) vlist += " " + std::to_string(v);
cell_vlist_map.emplace(std::make_pair(to_string(cell), vlist));
@@ -126,7 +127,7 @@ Mesh_medit build_mesh_from_cell_complex(const Cell_complex& cell_complex,
std::size_t amb_d = std::min((int)cell_complex.cell_point_map().begin()->second.size(), 3);
for (const auto& cp_pair : cell_complex.cell_point_map()) {
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
std::string vlist;
vlist += " " + std::to_string(index);
cell_vlist_map.emplace(std::make_pair(to_string(cp_pair.first), vlist));
@@ -137,7 +138,7 @@ Mesh_medit build_mesh_from_cell_complex(const Cell_complex& cell_complex,
}
populate_mesh(output, cell_complex.interior_simplex_cell_maps(), i_configuration, amb_d, vi_map);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
for (const auto& sc_map : cell_complex.interior_simplex_cell_maps())
for (const auto& sc_pair : sc_map) {
std::string simplex = "I" + to_string(sc_pair.first);
@@ -147,7 +148,7 @@ Mesh_medit build_mesh_from_cell_complex(const Cell_complex& cell_complex,
}
#endif
populate_mesh(output, cell_complex.boundary_simplex_cell_maps(), b_configuration, amb_d, vi_map);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
for (const auto& sc_map : cell_complex.boundary_simplex_cell_maps())
for (const auto& sc_pair : sc_map) {
std::string simplex = "B" + to_string(sc_pair.first);
diff --git a/src/Coxeter_triangulation/include/gudhi/IO/output_debug_traces_to_html.h b/src/Coxeter_triangulation/include/gudhi/IO/output_debug_traces_to_html.h
index 147ab908..1d5ee4cd 100644
--- a/src/Coxeter_triangulation/include/gudhi/IO/output_debug_traces_to_html.h
+++ b/src/Coxeter_triangulation/include/gudhi/IO/output_debug_traces_to_html.h
@@ -1,5 +1,7 @@
-#ifdef GUDHI_DEBUG
-#define GUDHI_COX_OUTPUT_TO_HTML
+#ifndef IO_OUTPUT_DEBUG_TRACES_TO_HTML_H_
+#define IO_OUTPUT_DEBUG_TRACES_TO_HTML_H_
+
+#ifdef DEBUG_TRACES // All this part of code can be skipped if DEBUG_TRACES are not ON - cmake -DDEBUG_TRACES=ON .
#include <sstream>
#include <fstream>
@@ -544,4 +546,5 @@ void write_to_html(std::string file_name) {
} // namespace Gudhi
-#endif
+#endif // DEBUG_TRACES
+#endif // IO_OUTPUT_DEBUG_TRACES_TO_HTML_H_
diff --git a/src/Coxeter_triangulation/include/gudhi/Manifold_tracing.h b/src/Coxeter_triangulation/include/gudhi/Manifold_tracing.h
index b678566a..f7de5252 100644
--- a/src/Coxeter_triangulation/include/gudhi/Manifold_tracing.h
+++ b/src/Coxeter_triangulation/include/gudhi/Manifold_tracing.h
@@ -11,6 +11,7 @@
#ifndef MANIFOLD_TRACING_H_
#define MANIFOLD_TRACING_H_
+#include <gudhi/IO/output_debug_traces_to_html.h> // for DEBUG_TRACES
#include <gudhi/Query_result.h>
#include <boost/functional/hash.hpp>
@@ -85,7 +86,7 @@ class Manifold_tracing {
for (Simplex_handle face : full_simplex.face_range(cod_d)) {
Query_result<Simplex_handle> qr = oracle.intersects(face, triangulation);
if (qr.success && out_simplex_map.emplace(std::make_pair(face, qr.intersection)).second) {
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
mt_seed_inserted_list.push_back(MT_inserted_info(qr, face, false));
#endif
queue.emplace(face);
@@ -141,7 +142,7 @@ class Manifold_tracing {
Simplex_handle full_simplex = triangulation.locate_point(p);
for (Simplex_handle face : full_simplex.face_range(cod_d)) {
auto qr = oracle.intersects(face, triangulation);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
mt_seed_inserted_list.push_back(MT_inserted_info(qr, face, false));
#endif
if (qr.success) {
@@ -150,7 +151,7 @@ class Manifold_tracing {
} else {
for (Simplex_handle cof : face.coface_range(cod_d + 1)) {
auto qrb = oracle.intersects_boundary(cof, triangulation);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
mt_seed_inserted_list.push_back(MT_inserted_info(qrb, cof, true));
#endif
if (qrb.success) boundary_simplex_map.emplace(cof, qrb.intersection);
@@ -167,7 +168,7 @@ class Manifold_tracing {
for (auto cof : s.coface_range(cod_d + 1)) {
for (auto face : cof.face_range(cod_d)) {
auto qr = oracle.intersects(face, triangulation);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
mt_inserted_list.push_back(MT_inserted_info(qr, face, false));
#endif
if (qr.success) {
@@ -175,7 +176,7 @@ class Manifold_tracing {
if (interior_simplex_map.emplace(face, qr.intersection).second) queue.emplace(face);
} else {
auto qrb = oracle.intersects_boundary(cof, triangulation);
-#ifdef GUDHI_COX_OUTPUT_TO_HTML
+#ifdef DEBUG_TRACES
mt_inserted_list.push_back(MT_inserted_info(qrb, cof, true));
#endif
// assert (qrb.success); // always a success