summaryrefslogtreecommitdiff
path: root/src/Coxeter_triangulation/include/gudhi/IO
diff options
context:
space:
mode:
Diffstat (limited to 'src/Coxeter_triangulation/include/gudhi/IO')
-rw-r--r--src/Coxeter_triangulation/include/gudhi/IO/Mesh_medit.h12
-rw-r--r--src/Coxeter_triangulation/include/gudhi/IO/build_mesh_from_cell_complex.h127
-rw-r--r--src/Coxeter_triangulation/include/gudhi/IO/output_debug_traces_to_html.h390
-rw-r--r--src/Coxeter_triangulation/include/gudhi/IO/output_meshes_to_medit.h147
4 files changed, 292 insertions, 384 deletions
diff --git a/src/Coxeter_triangulation/include/gudhi/IO/Mesh_medit.h b/src/Coxeter_triangulation/include/gudhi/IO/Mesh_medit.h
index 28276bf7..203ed6c5 100644
--- a/src/Coxeter_triangulation/include/gudhi/IO/Mesh_medit.h
+++ b/src/Coxeter_triangulation/include/gudhi/IO/Mesh_medit.h
@@ -11,15 +11,15 @@
#ifndef IO_MESH_MEDIT_H_
#define IO_MESH_MEDIT_H_
-namespace Gudhi {
-
-namespace coxeter_triangulation {
-
#include <Eigen/Dense>
#include <vector>
#include <utility> // for std::pair
+namespace Gudhi {
+
+namespace coxeter_triangulation {
+
/* \class Mesh_medit
* \brief Structure to store a mesh that can be output in Medit .mesh file format
* using the output_meshes_to_medit method.
@@ -53,8 +53,8 @@ struct Mesh_medit {
Scalar_field_range tetrahedra_scalar_range;
};
-} // namespace coxeter_triangulation
+} // namespace coxeter_triangulation
-} // namespace Gudhi
+} // namespace Gudhi
#endif
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 abe6cdbf..0dc98f95 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
@@ -19,7 +19,7 @@
#include <map>
#include <set>
#include <string>
-#include <utility> // for std::make_pair
+#include <utility> // for std::make_pair
#include <algorithm> // for std::min
namespace Gudhi {
@@ -27,104 +27,90 @@ namespace Gudhi {
namespace coxeter_triangulation {
struct Configuration {
- Configuration(bool t_edges, bool t_triangles, bool t_tetrahedra,
- std::size_t r_edges, std::size_t r_triangles, std::size_t r_tetrahedra)
- : toggle_edges(t_edges), toggle_triangles(t_triangles), toggle_tetrahedra(t_tetrahedra),
- ref_edges(r_edges), ref_triangles(r_triangles), ref_tetrahedra(r_tetrahedra) {}
+ Configuration(bool t_edges, bool t_triangles, bool t_tetrahedra, std::size_t r_edges, std::size_t r_triangles,
+ std::size_t r_tetrahedra)
+ : toggle_edges(t_edges),
+ toggle_triangles(t_triangles),
+ toggle_tetrahedra(t_tetrahedra),
+ ref_edges(r_edges),
+ ref_triangles(r_triangles),
+ ref_tetrahedra(r_tetrahedra) {}
Configuration() {}
- bool toggle_edges = true,
- toggle_triangles = true,
- toggle_tetrahedra = true;
- std::size_t ref_edges = 1,
- ref_triangles = 1,
- ref_tetrahedra = 1;
+ bool toggle_edges = true, toggle_triangles = true, toggle_tetrahedra = true;
+ std::size_t ref_edges = 1, ref_triangles = 1, ref_tetrahedra = 1;
};
-
template <class Hasse_cell, class Simplex_cell_map>
-void populate_mesh(Mesh_medit& output,
- Simplex_cell_map& sc_map,
- Configuration configuration,
- std::size_t amb_d,
+void populate_mesh(Mesh_medit& output, Simplex_cell_map& sc_map, Configuration configuration, std::size_t amb_d,
std::map<Hasse_cell*, std::size_t> vi_map) {
using Mesh_element_vertices = Mesh_medit::Mesh_elements::value_type::first_type;
std::map<Hasse_cell*, std::size_t> ci_map;
- std::size_t index = vi_map.size() + 1; // current size of output.vertex_points
- if (sc_map.size() >= 3)
- for (const auto& sc_pair: sc_map[2]) {
+ std::size_t index = vi_map.size() + 1; // current size of output.vertex_points
+ if (sc_map.size() >= 3)
+ for (const auto& sc_pair : sc_map[2]) {
Eigen::VectorXd barycenter = Eigen::VectorXd::Zero(amb_d);
std::set<std::size_t> vertex_indices;
Hasse_cell* cell = sc_pair.second;
- for (const auto& ei_pair: cell->get_boundary())
- 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];
+ for (const auto& ei_pair : cell->get_boundary())
+ 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];
ci_map.emplace(std::make_pair(cell, index++));
- output.vertex_points.emplace_back((1./vertex_indices.size()) * barycenter);
+ output.vertex_points.emplace_back((1. / vertex_indices.size()) * barycenter);
#ifdef GUDHI_COX_OUTPUT_TO_HTML
- std::string vlist = " (" + std::to_string(index-1) + ")";
- for (const std::size_t& v: vertex_indices)
- vlist += " " + std::to_string(v);
+ 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));
#endif
}
if (configuration.toggle_edges && sc_map.size() >= 2)
- for (const auto& sc_map: sc_map[1]) {
+ for (const auto& sc_map : sc_map[1]) {
Hasse_cell* edge_cell = sc_map.second;
Mesh_element_vertices edge;
- for (const auto& vi_pair: edge_cell->get_boundary())
- edge.push_back(vi_map[vi_pair.first]);
+ 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
std::string vlist;
- for (const std::size_t& v: edge)
- vlist += " " + std::to_string(v);
+ for (const std::size_t& v : edge) vlist += " " + std::to_string(v);
cell_vlist_map.emplace(std::make_pair(to_string(edge_cell), vlist));
#endif
}
-
+
if (configuration.toggle_triangles && sc_map.size() >= 3)
- for (const auto& sc_pair: sc_map[2]) {
- for (const auto& ei_pair: sc_pair.second->get_boundary()) {
+ for (const auto& sc_pair : sc_map[2]) {
+ for (const auto& ei_pair : sc_pair.second->get_boundary()) {
Mesh_element_vertices triangle(1, ci_map[sc_pair.second]);
- for (const auto& vi_pair: ei_pair.first->get_boundary())
- triangle.push_back(vi_map[vi_pair.first]);
+ for (const auto& vi_pair : ei_pair.first->get_boundary()) triangle.push_back(vi_map[vi_pair.first]);
output.triangles.emplace_back(std::make_pair(triangle, configuration.ref_triangles));
}
}
-
+
if (configuration.toggle_tetrahedra && sc_map.size() >= 4)
- for (const auto& sc_pair: sc_map[3]) {
+ for (const auto& sc_pair : sc_map[3]) {
Eigen::VectorXd barycenter = Eigen::VectorXd::Zero(amb_d);
std::set<std::size_t> vertex_indices;
Hasse_cell* cell = sc_pair.second;
- for (const auto& ci_pair: cell->get_boundary())
- for (const auto& ei_pair: ci_pair.first->get_boundary())
- 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);
+ for (const auto& ci_pair : cell->get_boundary())
+ for (const auto& ei_pair : ci_pair.first->get_boundary())
+ 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
std::string vlist = " (" + std::to_string(index) + ")";
- for (const std::size_t& v: vertex_indices)
- vlist += " " + std::to_string(v);
+ for (const std::size_t& v : vertex_indices) vlist += " " + std::to_string(v);
cell_vlist_map.emplace(std::make_pair(to_string(cell), vlist));
#endif
- for (const auto& ci_pair: cell->get_boundary())
- for (const auto& ei_pair: ci_pair.first->get_boundary()) {
+ for (const auto& ci_pair : cell->get_boundary())
+ for (const auto& ei_pair : ci_pair.first->get_boundary()) {
Mesh_element_vertices tetrahedron = {index, ci_map[sc_pair.second]};
- for (const auto& vi_pair: ei_pair.first->get_boundary())
- tetrahedron.push_back(vi_map[vi_pair.first]);
+ for (const auto& vi_pair : ei_pair.first->get_boundary()) tetrahedron.push_back(vi_map[vi_pair.first]);
output.tetrahedra.emplace_back(std::make_pair(tetrahedron, configuration.ref_tetrahedra));
}
index++;
- }
+ }
}
template <class Cell_complex>
@@ -133,14 +119,13 @@ Mesh_medit build_mesh_from_cell_complex(const Cell_complex& cell_complex,
Configuration b_configuration = Configuration()) {
using Hasse_cell = typename Cell_complex::Hasse_cell;
Mesh_medit output;
- std::map<Hasse_cell*, std::size_t> vi_map; // one for vertices, other for 2d-cells
- std::size_t index = 1; // current size of output.vertex_points
-
- if (cell_complex.cell_point_map().empty())
- return output;
- 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()) {
+ std::map<Hasse_cell*, std::size_t> vi_map; // one for vertices, other for 2d-cells
+ std::size_t index = 1; // current size of output.vertex_points
+
+ if (cell_complex.cell_point_map().empty()) return output;
+ 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
std::string vlist;
vlist += " " + std::to_string(index);
@@ -153,29 +138,29 @@ 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
- for (const auto& sc_map: cell_complex.interior_simplex_cell_maps())
- for (const auto& sc_pair: sc_map) {
+ 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);
std::string cell = to_string(sc_pair.second);
std::string vlist = cell_vlist_map.at(cell).substr(1);
simplex_vlist_map.emplace(std::make_pair(simplex, vlist));
}
-#endif
- populate_mesh(output, cell_complex.boundary_simplex_cell_maps(), b_configuration, amb_d, vi_map);
+#endif
+ populate_mesh(output, cell_complex.boundary_simplex_cell_maps(), b_configuration, amb_d, vi_map);
#ifdef GUDHI_COX_OUTPUT_TO_HTML
- for (const auto& sc_map: cell_complex.boundary_simplex_cell_maps())
- for (const auto& sc_pair: sc_map) {
+ 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);
std::string cell = to_string(sc_pair.second);
std::string vlist = cell_vlist_map.at(cell).substr(1);
simplex_vlist_map.emplace(std::make_pair(simplex, vlist));
}
-#endif
+#endif
return output;
}
-} // namespace coxeter_triangulation
+} // namespace coxeter_triangulation
-} // namespace Gudhi
+} // namespace Gudhi
#endif
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 43cca967..147ab908 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
@@ -16,22 +16,21 @@ namespace coxeter_triangulation {
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vector) {
- os << "(";
+ os << "(";
if (vector.empty()) {
os << ")";
return os;
}
auto v_it = vector.begin();
os << *v_it++;
- for (; v_it != vector.end(); ++v_it)
- os << ", " << *v_it;
+ for (; v_it != vector.end(); ++v_it) os << ", " << *v_it;
os << ")";
return os;
}
/* A class to make the vector horizontal instead of vertical */
struct Straighten {
- Straighten (const Eigen::VectorXd& vector) : vector_(vector) {}
+ Straighten(const Eigen::VectorXd& vector) : vector_(vector) {}
const Eigen::VectorXd& vector_;
};
@@ -42,8 +41,7 @@ std::ostream& operator<<(std::ostream& os, const Straighten& str) {
os << ")";
return os;
}
- for (std::size_t i = 1; i < size; ++i)
- os << ", " << str.vector_(i);
+ for (std::size_t i = 1; i < size; ++i) os << ", " << str.vector_(i);
os << ")";
return os;
}
@@ -68,61 +66,57 @@ std::string to_string(const T& t) {
struct MT_inserted_info {
std::string qr_face_, init_face_, qr_intersection_;
bool qr_success_, is_boundary_;
- template <class Query_result,
- class Simplex_handle>
+ template <class Query_result, class Simplex_handle>
MT_inserted_info(const Query_result& qr, const Simplex_handle& face, bool is_boundary)
- : qr_face_(to_string(face)), init_face_(to_string(face)),
- qr_intersection_(to_string(qr.intersection)),
- qr_success_(qr.success), is_boundary_(is_boundary) {}
+ : qr_face_(to_string(face)),
+ init_face_(to_string(face)),
+ qr_intersection_(to_string(qr.intersection)),
+ qr_success_(qr.success),
+ is_boundary_(is_boundary) {}
};
std::list<MT_inserted_info> mt_seed_inserted_list, mt_inserted_list;
struct CC_summary_info {
std::string face_, cell_;
template <class SC_pair>
- CC_summary_info(const SC_pair& sc_pair)
- : face_(to_string(sc_pair.first)), cell_(to_string(sc_pair.second)) {}
+ CC_summary_info(const SC_pair& sc_pair) : face_(to_string(sc_pair.first)), cell_(to_string(sc_pair.second)) {}
};
using CC_summary_list = std::list<CC_summary_info>;
std::vector<CC_summary_list> cc_interior_summary_lists, cc_boundary_summary_lists;
struct CC_detail_info {
- enum class Result_type {self, face, coface, inserted, join_single, join_is_face};
+ enum class Result_type { self, face, coface, inserted, join_single, join_is_face };
std::string simplex_, trigger_, init_simplex_;
Result_type status_;
bool join_trigger_ = false;
std::list<std::string> faces_, post_faces_, cofaces_;
template <class Simplex_handle>
- CC_detail_info(const Simplex_handle& simplex)
- : simplex_(to_string(simplex)) {}
+ CC_detail_info(const Simplex_handle& simplex) : simplex_(to_string(simplex)) {}
};
using CC_detail_list = std::list<CC_detail_info>;
std::vector<CC_detail_list> cc_interior_detail_lists, cc_boundary_detail_lists;
std::vector<CC_detail_list> cc_interior_insert_detail_lists, cc_boundary_insert_detail_lists;
struct CC_prejoin_info {
- enum class Result_type {join_single, join_is_face, join_different, join_same};
+ enum class Result_type { join_single, join_is_face, join_different, join_same };
std::string simplex_, join_;
std::vector<std::string> faces_;
std::size_t dimension_;
Result_type status_;
template <class Simplex_handle>
- CC_prejoin_info(const Simplex_handle& simplex)
- : simplex_(to_string(simplex)), dimension_(simplex.dimension()) {}
+ CC_prejoin_info(const Simplex_handle& simplex) : simplex_(to_string(simplex)), dimension_(simplex.dimension()) {}
};
using CC_prejoin_list = std::list<CC_prejoin_info>;
std::vector<CC_prejoin_list> cc_interior_prejoin_lists, cc_boundary_prejoin_lists;
-
struct CC_join_info {
- enum class Result_type {self, face, coface, inserted, join_single, join_is_face};
+ enum class Result_type { self, face, coface, inserted, join_single, join_is_face };
std::string simplex_, join_, trigger_;
Result_type status_;
std::list<std::string> boundary_faces_;
std::list<std::string> faces_, post_faces_, cofaces_;
template <class Simplex_handle>
- CC_join_info(const Simplex_handle& simplex)
- : simplex_(to_string(simplex)) {}
+ CC_join_info(const Simplex_handle& simplex) : simplex_(to_string(simplex)) {}
};
bool join_switch = false;
std::vector<CC_detail_list> cc_interior_join_detail_lists, cc_boundary_join_detail_lists;
@@ -134,16 +128,15 @@ std::ostringstream mt_ostream, vis_ostream;
std::vector<std::ostringstream> cc_summary_ostream, cc_traces_ostream;
std::string simplex_format(const std::string& simplex, bool is_boundary) {
- std::string b_simplex = (is_boundary? "B": "I") + simplex;
+ std::string b_simplex = (is_boundary ? "B" : "I") + simplex;
std::string tooltiptext;
auto it = simplex_vlist_map.find(b_simplex);
if (it == simplex_vlist_map.end())
tooltiptext = "deleted";
else
tooltiptext = simplex_vlist_map.at(b_simplex);
- return (std::string)"<a class=\"" + (is_boundary? "boundary": "interior")
- + "\" href=\"#" + id_from_simplex(b_simplex) + "\">" + b_simplex
- + "<span class=\"tooltiptext\">" + tooltiptext + "</span></a>";
+ return (std::string) "<a class=\"" + (is_boundary ? "boundary" : "interior") + "\" href=\"#" +
+ id_from_simplex(b_simplex) + "\">" + b_simplex + "<span class=\"tooltiptext\">" + tooltiptext + "</span></a>";
}
std::string simplex_format(const std::string& b_simplex) {
@@ -154,12 +147,10 @@ std::string simplex_format(const std::string& b_simplex) {
tooltiptext = "deleted";
else
tooltiptext = simplex_vlist_map.at(b_simplex);
- return (std::string)"<a class=\"" + (is_boundary? "boundary": "interior")
- + "\" href=\"#" + id_from_simplex(b_simplex) + "\">" + b_simplex
- + "<span class=\"tooltiptext\">" + tooltiptext + "</span></a>";
+ return (std::string) "<a class=\"" + (is_boundary ? "boundary" : "interior") + "\" href=\"#" +
+ id_from_simplex(b_simplex) + "\">" + b_simplex + "<span class=\"tooltiptext\">" + tooltiptext + "</span></a>";
}
-
void write_head(std::ofstream& ofs) {
ofs << " <head>\n"
<< " <title>Cell complex debug trace</title>\n"
@@ -215,11 +206,11 @@ void write_head(std::ofstream& ofs) {
<< " .boundary:hover .tooltiptext {\n"
<< " visibility: visible;\n"
<< " opacity: 1;\n"
- << " }\n"
+ << " }\n"
<< " .interior:hover .tooltiptext {\n"
<< " visibility: visible;\n"
<< " opacity: 1;\n"
- << " }\n"
+ << " }\n"
<< " ul.nav {\n"
<< " list-style-type: none;\n"
<< " margin: 0;\n"
@@ -284,30 +275,26 @@ void write_mt(std::ofstream& ofs) {
ofs << " <h2> Manifold debug trace </h2>\n";
ofs << " <h3> Simplices inserted during the seed phase </h3>\n";
ofs << " <ul>\n";
- for (const MT_inserted_info& mt_info: mt_seed_inserted_list) {
+ for (const MT_inserted_info& mt_info : mt_seed_inserted_list) {
if (mt_info.qr_success_) {
ofs << " <li>Inserted " << simplex_format(mt_info.qr_face_, mt_info.is_boundary_);
if (mt_info.qr_face_ != mt_info.init_face_)
- ofs << " (initially " << simplex_format(mt_info.init_face_, mt_info.is_boundary_) << ")";
+ ofs << " (initially " << simplex_format(mt_info.init_face_, mt_info.is_boundary_) << ")";
ofs << " intersection point is " << mt_info.qr_intersection_ << "</li>\n";
- }
- else
- ofs << " <li>Failed to insert " << mt_info.init_face_
- << "</li>\n";
+ } else
+ ofs << " <li>Failed to insert " << mt_info.init_face_ << "</li>\n";
}
ofs << " </ul>\n";
ofs << " <h3> Simplices inserted during the while loop phase </h3>\n";
ofs << " <ul>\n";
- for (const MT_inserted_info& mt_info: mt_inserted_list) {
+ for (const MT_inserted_info& mt_info : mt_inserted_list) {
if (mt_info.qr_success_) {
ofs << " <li>Inserted " << simplex_format(mt_info.qr_face_, mt_info.is_boundary_);
if (mt_info.qr_face_ != mt_info.init_face_)
- ofs << " (initially " << simplex_format(mt_info.init_face_, mt_info.is_boundary_) << ")";
+ ofs << " (initially " << simplex_format(mt_info.init_face_, mt_info.is_boundary_) << ")";
ofs << " intersection point is " << mt_info.qr_intersection_ << "</li>\n";
- }
- else
- ofs << " <li>Failed to insert " << mt_info.init_face_
- << ")</li>\n";
+ } else
+ ofs << " <li>Failed to insert " << mt_info.init_face_ << ")</li>\n";
}
ofs << " </ul>\n";
ofs << " </div>\n";
@@ -325,13 +312,11 @@ void write_cc(std::ofstream& ofs) {
for (std::size_t i = 0; i < cc_interior_summary_lists.size(); ++i) {
ofs << " <h3 id=\"dim" << i << "\"> Dimension " << i << "</h3>\n";
ofs << " <h4 id=\"dim" << i << "i\"> Summary for interior simplices</h4>\n";
- if (i < cc_boundary_summary_lists.size())
- ofs << " <p><a href=\"#dim" << i << "b\">Go to boundary</a></p>\n";
+ if (i < cc_boundary_summary_lists.size()) ofs << " <p><a href=\"#dim" << i << "b\">Go to boundary</a></p>\n";
ofs << " <ul>\n";
- for (const CC_summary_info& cc_info: cc_interior_summary_lists[i])
+ for (const CC_summary_info& cc_info : cc_interior_summary_lists[i])
ofs << " <li id = \"" << id_from_simplex("I" + cc_info.face_) << "\">"
- << simplex_format(cc_info.face_, false)
- << " cell =" << cc_info.cell_ << "</li>\n";
+ << simplex_format(cc_info.face_, false) << " cell =" << cc_info.cell_ << "</li>\n";
ofs << " </ul>\n";
ofs << " <h4> Prejoin state of the interior cells of dimension " << i << "</h4>\n";
auto prejoin_it = cc_interior_prejoin_lists[i].begin();
@@ -340,57 +325,48 @@ void write_cc(std::ofstream& ofs) {
ofs << " <h5>" << j << "-dimensional ambient simplices</h5>\n";
ofs << " <ul>\n";
for (; prejoin_it->dimension_ == j; ++prejoin_it) {
- ofs << " <li>" << simplex_format(prejoin_it->simplex_, false)
- << " join = " << simplex_format(prejoin_it->join_, false)
- << " boundary:\n"
- << " <ul>\n";
- for (const auto& face: prejoin_it->faces_)
- ofs << " <li>" << simplex_format(face) << "</li>";
- ofs << " </ul>\n";
- switch (prejoin_it->status_) {
- case (CC_prejoin_info::Result_type::join_single):
- ofs << " <p style=\"color: red\">Deleted "
- << simplex_format(prejoin_it->simplex_, false)
- << " as it has a single face.</p>";
- break;
- case (CC_prejoin_info::Result_type::join_is_face):
- ofs << " <p style=\"color: red\">Deleted "
- << simplex_format(prejoin_it->simplex_, false)
- << " as its join " << simplex_format(prejoin_it->join_, false)
- << " is one of the faces.</p>";
- break;
- case (CC_prejoin_info::Result_type::join_different):
- ofs << " <p style=\"color: magenta\">Deleted " << simplex_format(prejoin_it->simplex_, false)
- << " and replaced by its join " << simplex_format(prejoin_it->join_, false)
- << ".</p>";
- break;
- case (CC_prejoin_info::Result_type::join_same):
- ofs << " <p style=\"color: green\">Kept " << simplex_format(prejoin_it->simplex_, false)
- << ".</p>";
- }
- ofs << " </li>";
+ ofs << " <li>" << simplex_format(prejoin_it->simplex_, false)
+ << " join = " << simplex_format(prejoin_it->join_, false) << " boundary:\n"
+ << " <ul>\n";
+ for (const auto& face : prejoin_it->faces_) ofs << " <li>" << simplex_format(face) << "</li>";
+ ofs << " </ul>\n";
+ switch (prejoin_it->status_) {
+ case (CC_prejoin_info::Result_type::join_single):
+ ofs << " <p style=\"color: red\">Deleted " << simplex_format(prejoin_it->simplex_, false)
+ << " as it has a single face.</p>";
+ break;
+ case (CC_prejoin_info::Result_type::join_is_face):
+ ofs << " <p style=\"color: red\">Deleted " << simplex_format(prejoin_it->simplex_, false)
+ << " as its join " << simplex_format(prejoin_it->join_, false) << " is one of the faces.</p>";
+ break;
+ case (CC_prejoin_info::Result_type::join_different):
+ ofs << " <p style=\"color: magenta\">Deleted " << simplex_format(prejoin_it->simplex_, false)
+ << " and replaced by its join " << simplex_format(prejoin_it->join_, false) << ".</p>";
+ break;
+ case (CC_prejoin_info::Result_type::join_same):
+ ofs << " <p style=\"color: green\">Kept " << simplex_format(prejoin_it->simplex_, false)
+ << ".</p>";
+ }
+ ofs << " </li>";
}
ofs << " </ul>\n";
}
ofs << " <h4> Details for interior simplices</h4>\n";
ofs << " <ul>\n";
- for (const CC_detail_info& cc_info: cc_interior_detail_lists[i]) {
+ for (const CC_detail_info& cc_info : cc_interior_detail_lists[i]) {
if (cc_info.status_ == CC_detail_info::Result_type::join_single) {
- ofs << " <li style=\"color:magenta\" id = \""
- << id_from_simplex("I" + cc_info.simplex_) << "\"> Simplex "
- << simplex_format(cc_info.simplex_, false) << " has only one face ("
- << simplex_format(cc_info.trigger_, false) << ") and is deleted.";
- continue;
+ ofs << " <li style=\"color:magenta\" id = \"" << id_from_simplex("I" + cc_info.simplex_)
+ << "\"> Simplex " << simplex_format(cc_info.simplex_, false) << " has only one face ("
+ << simplex_format(cc_info.trigger_, false) << ") and is deleted.";
+ continue;
}
if (cc_info.status_ == CC_detail_info::Result_type::join_single) {
- ofs << " <li style=\"color:darkmagenta\" id = \""
- << id_from_simplex("I" + cc_info.simplex_) << "\"> The join of the simplex "
- << simplex_format(cc_info.simplex_, false) << " is one of its faces ("
- << simplex_format(cc_info.trigger_, false) << "), hence it is is deleted.";
- continue;
+ ofs << " <li style=\"color:darkmagenta\" id = \"" << id_from_simplex("I" + cc_info.simplex_)
+ << "\"> The join of the simplex " << simplex_format(cc_info.simplex_, false) << " is one of its faces ("
+ << simplex_format(cc_info.trigger_, false) << "), hence it is is deleted.";
+ continue;
}
- ofs << " <li> Insert_cell called for " << simplex_format(cc_info.simplex_, false)
- << "\n";
+ ofs << " <li> Insert_cell called for " << simplex_format(cc_info.simplex_, false) << "\n";
ofs << " <ul>\n";
// for (const std::string& cof: cc_info.faces_)
// ofs << " <li>Checking if " << simplex_format(cc_info.simplex_, false)
@@ -398,34 +374,31 @@ void write_cc(std::ofstream& ofs) {
ofs << " </ul>\n";
ofs << " <ul>\n";
if (cc_info.status_ == CC_detail_info::Result_type::self) {
- ofs << " <p><span style=\"color:blue\">The simplex "
- << simplex_format(cc_info.simplex_, false)
- << " already exists in the cell complex!</span></p>\n";
+ ofs << " <p><span style=\"color:blue\">The simplex " << simplex_format(cc_info.simplex_, false)
+ << " already exists in the cell complex!</span></p>\n";
}
if (cc_info.status_ == CC_detail_info::Result_type::face) {
- ofs << " <p><span style=\"color:red\">The simplex "
- << simplex_format(cc_info.simplex_, false) << " is a face of the simplex "
- << simplex_format(cc_info.trigger_, false) << "!</span><br>\n";
- ofs << " <ul>\n";
- for (const std::string post_face: cc_info.post_faces_)
- ofs << " <li id = \"" << id_from_simplex("I" + post_face) << "\">"
- << "Post deleting " << simplex_format(post_face, false) << "</li>\n";
- ofs << " </ul>\n";
- ofs << " </p>\n";
- ofs << " <p id = \"" << id_from_simplex("I" + cc_info.trigger_) << "\">"
- << "Deleting " << simplex_format(cc_info.trigger_, false) << "</p>\n";
+ ofs << " <p><span style=\"color:red\">The simplex " << simplex_format(cc_info.simplex_, false)
+ << " is a face of the simplex " << simplex_format(cc_info.trigger_, false) << "!</span><br>\n";
+ ofs << " <ul>\n";
+ for (const std::string post_face : cc_info.post_faces_)
+ ofs << " <li id = \"" << id_from_simplex("I" + post_face) << "\">"
+ << "Post deleting " << simplex_format(post_face, false) << "</li>\n";
+ ofs << " </ul>\n";
+ ofs << " </p>\n";
+ ofs << " <p id = \"" << id_from_simplex("I" + cc_info.trigger_) << "\">"
+ << "Deleting " << simplex_format(cc_info.trigger_, false) << "</p>\n";
}
// for (const std::string& fac: cc_info.cofaces_)
// ofs << " <li>Checking if " << simplex_format(cc_info.simplex_, false)
// << " is a coface of " << simplex_format(fac, false) << "\n";
if (cc_info.status_ == CC_detail_info::Result_type::coface) {
- ofs << " <p><span style=\"color:darkorange\">The simplex "
- << simplex_format(cc_info.simplex_, false) << " is a coface of the simplex "
- << simplex_format(cc_info.trigger_, false) << "!</span><p>\n";
+ ofs << " <p><span style=\"color:darkorange\">The simplex " << simplex_format(cc_info.simplex_, false)
+ << " is a coface of the simplex " << simplex_format(cc_info.trigger_, false) << "!</span><p>\n";
}
if (cc_info.status_ == CC_detail_info::Result_type::inserted) {
- ofs << " <p><span style=\"color:green\">Successfully inserted "
- << simplex_format(cc_info.simplex_, false) << "!</span><p>\n";
+ ofs << " <p><span style=\"color:green\">Successfully inserted "
+ << simplex_format(cc_info.simplex_, false) << "!</span><p>\n";
}
ofs << " </ul>\n";
ofs << " </li>\n";
@@ -436,113 +409,101 @@ void write_cc(std::ofstream& ofs) {
ofs << " <h4 id=\"dim" << i << "b\"> Summary for boundary simplices</h4>\n";
ofs << " <p><a href=\"#dim" << i << "i\">Go to interior</a></p>\n";
ofs << " <ul>\n";
- for (const CC_summary_info& cc_info: cc_boundary_summary_lists[i])
- ofs << " <li id = \"" << id_from_simplex("B" + cc_info.face_) << "\">"
- << simplex_format(cc_info.face_, true)
- << " cell =" << cc_info.cell_ << "</li>\n";
+ for (const CC_summary_info& cc_info : cc_boundary_summary_lists[i])
+ ofs << " <li id = \"" << id_from_simplex("B" + cc_info.face_) << "\">"
+ << simplex_format(cc_info.face_, true) << " cell =" << cc_info.cell_ << "</li>\n";
ofs << " </ul>\n";
ofs << " <h4> Prejoin state of the boundary cells of dimension " << i << "</h4>\n";
auto prejoin_it = cc_boundary_prejoin_lists[i].begin();
while (prejoin_it != cc_boundary_prejoin_lists[i].end()) {
- std::size_t j = prejoin_it->dimension_;
- ofs << " <h5>" << j << "-dimensional ambient simplices</h5>\n";
- ofs << " <ul>\n";
- for (; prejoin_it->dimension_ == j; ++prejoin_it) {
- ofs << " <li>" << simplex_format(prejoin_it->simplex_, true)
- << " join = " << simplex_format(prejoin_it->join_, true)
- << " boundary:\n"
- << " <ul>\n";
- for (const auto& face: prejoin_it->faces_)
- ofs << " <li>" << simplex_format(face) << "</li>";
- ofs << " </ul>\n";
- switch (prejoin_it->status_) {
- case (CC_prejoin_info::Result_type::join_single):
- ofs << " <p style=\"color: red\">Deleted "
- << simplex_format(prejoin_it->simplex_, true)
- << " as it has a single face.</p>";
- break;
- case (CC_prejoin_info::Result_type::join_is_face):
- ofs << " <p style=\"color: red\">Deleted "
- << simplex_format(prejoin_it->simplex_, true)
- << " as its join " << simplex_format(prejoin_it->join_, true)
- << " is one of the faces.</p>";
- break;
- case (CC_prejoin_info::Result_type::join_different):
- ofs << " <p style=\"color: magenta\">Deleted " << simplex_format(prejoin_it->simplex_, true)
- << " and replaced by its join " << simplex_format(prejoin_it->join_, true)
- << ".</p>";
- break;
- case (CC_prejoin_info::Result_type::join_same):
- ofs << " <p style=\"color: green\">Kept " << simplex_format(prejoin_it->simplex_, true)
- << ".</p>";
- }
- ofs << " </li>";
- }
- ofs << " </ul>\n";
+ std::size_t j = prejoin_it->dimension_;
+ ofs << " <h5>" << j << "-dimensional ambient simplices</h5>\n";
+ ofs << " <ul>\n";
+ for (; prejoin_it->dimension_ == j; ++prejoin_it) {
+ ofs << " <li>" << simplex_format(prejoin_it->simplex_, true)
+ << " join = " << simplex_format(prejoin_it->join_, true) << " boundary:\n"
+ << " <ul>\n";
+ for (const auto& face : prejoin_it->faces_) ofs << " <li>" << simplex_format(face) << "</li>";
+ ofs << " </ul>\n";
+ switch (prejoin_it->status_) {
+ case (CC_prejoin_info::Result_type::join_single):
+ ofs << " <p style=\"color: red\">Deleted " << simplex_format(prejoin_it->simplex_, true)
+ << " as it has a single face.</p>";
+ break;
+ case (CC_prejoin_info::Result_type::join_is_face):
+ ofs << " <p style=\"color: red\">Deleted " << simplex_format(prejoin_it->simplex_, true)
+ << " as its join " << simplex_format(prejoin_it->join_, true) << " is one of the faces.</p>";
+ break;
+ case (CC_prejoin_info::Result_type::join_different):
+ ofs << " <p style=\"color: magenta\">Deleted " << simplex_format(prejoin_it->simplex_, true)
+ << " and replaced by its join " << simplex_format(prejoin_it->join_, true) << ".</p>";
+ break;
+ case (CC_prejoin_info::Result_type::join_same):
+ ofs << " <p style=\"color: green\">Kept " << simplex_format(prejoin_it->simplex_, true)
+ << ".</p>";
+ }
+ ofs << " </li>";
+ }
+ ofs << " </ul>\n";
}
}
if (i < cc_boundary_detail_lists.size()) {
ofs << " <h4> Details for boundary simplices</h4>\n"
- << " <ul>\n";
- for (const CC_detail_info& cc_info: cc_boundary_detail_lists[i]) {
- if (cc_info.status_ == CC_detail_info::Result_type::join_single) {
- ofs << " <li style=\"color:magenta\" id = \""
- << id_from_simplex("B" + cc_info.simplex_) << "\"> Simplex "
- << simplex_format(cc_info.simplex_, true) << " has only one face ("
- << simplex_format(cc_info.trigger_, true) << ") and is deleted.";
- continue;
- }
- if (cc_info.status_ == CC_detail_info::Result_type::join_single) {
- ofs << " <li style=\"color:darkmagenta\" id = \""
- << id_from_simplex("B" + cc_info.simplex_) << "\"> The join of the simplex "
- << simplex_format(cc_info.simplex_, true) << " is one of its faces ("
- << simplex_format(cc_info.trigger_, true) << "), hence it is is deleted.";
- continue;
- }
- ofs << " <li> Insert_simplex called on " << simplex_format(cc_info.simplex_, true);
- ofs << " <ul>\n";
- // for (const std::string& cof: cc_info.faces_)
- // ofs << " <li>Checking if " << simplex_format(cc_info.simplex_, true)
- // << " is a face of " << simplex_format(cof, true) << "\n";
- ofs << " </ul>\n";
- ofs << " <ul>\n";
- if (cc_info.status_ == CC_detail_info::Result_type::self) {
- ofs << " <p><span style=\"color:blue\">The simplex "
- << simplex_format(cc_info.simplex_, true)
- << " already exists in the cell complex!</span></p>\n";
- }
- if (cc_info.status_ == CC_detail_info::Result_type::face) {
- ofs << " <p><span style=\"color:red\">The simplex "
- << simplex_format(cc_info.simplex_, true) << " is a face of the simplex "
- << simplex_format(cc_info.trigger_, true) << "!</span><br>\n";
- ofs << " <ul>\n";
- for (const std::string post_face: cc_info.post_faces_)
- ofs << " <li id=\"" << id_from_simplex("B" + post_face)
- << "\">Post deleting " << simplex_format(post_face, true)
- << "</li>\n";
- ofs << " </ul>\n";
- ofs << " </p>\n";
- ofs << " <p id=\"" << id_from_simplex(cc_info.trigger_)
- << "\">Deleting " << simplex_format(cc_info.trigger_, true) << "</p>\n";
- }
- // for (const std::string& fac: cc_info.cofaces_)
- // ofs << " <li>Checking if " << simplex_format(cc_info.simplex_, true)
- // << " is a coface of " << simplex_format(fac, true) << "\n";
- ofs << " </ul>\n";
- ofs << " </li>\n";
- if (cc_info.status_ == CC_detail_info::Result_type::coface) {
- ofs << " <p><span style=\"color:darkorange\">The simplex "
- << simplex_format(cc_info.simplex_, true) << " is a coface of the simplex "
- << simplex_format(cc_info.trigger_, true) << "!</span><p>\n";
- }
- if (cc_info.status_ == CC_detail_info::Result_type::inserted) {
- ofs << " <p><span style=\"color:green\">Successfully inserted "
- << simplex_format(cc_info.simplex_, true) << "!</span><p>\n";
- }
+ << " <ul>\n";
+ for (const CC_detail_info& cc_info : cc_boundary_detail_lists[i]) {
+ if (cc_info.status_ == CC_detail_info::Result_type::join_single) {
+ ofs << " <li style=\"color:magenta\" id = \"" << id_from_simplex("B" + cc_info.simplex_)
+ << "\"> Simplex " << simplex_format(cc_info.simplex_, true) << " has only one face ("
+ << simplex_format(cc_info.trigger_, true) << ") and is deleted.";
+ continue;
+ }
+ if (cc_info.status_ == CC_detail_info::Result_type::join_single) {
+ ofs << " <li style=\"color:darkmagenta\" id = \"" << id_from_simplex("B" + cc_info.simplex_)
+ << "\"> The join of the simplex " << simplex_format(cc_info.simplex_, true) << " is one of its faces ("
+ << simplex_format(cc_info.trigger_, true) << "), hence it is is deleted.";
+ continue;
+ }
+ ofs << " <li> Insert_simplex called on " << simplex_format(cc_info.simplex_, true);
+ ofs << " <ul>\n";
+ // for (const std::string& cof: cc_info.faces_)
+ // ofs << " <li>Checking if " << simplex_format(cc_info.simplex_, true)
+ // << " is a face of " << simplex_format(cof, true) << "\n";
+ ofs << " </ul>\n";
+ ofs << " <ul>\n";
+ if (cc_info.status_ == CC_detail_info::Result_type::self) {
+ ofs << " <p><span style=\"color:blue\">The simplex " << simplex_format(cc_info.simplex_, true)
+ << " already exists in the cell complex!</span></p>\n";
+ }
+ if (cc_info.status_ == CC_detail_info::Result_type::face) {
+ ofs << " <p><span style=\"color:red\">The simplex " << simplex_format(cc_info.simplex_, true)
+ << " is a face of the simplex " << simplex_format(cc_info.trigger_, true) << "!</span><br>\n";
+ ofs << " <ul>\n";
+ for (const std::string post_face : cc_info.post_faces_)
+ ofs << " <li id=\"" << id_from_simplex("B" + post_face) << "\">Post deleting "
+ << simplex_format(post_face, true) << "</li>\n";
+ ofs << " </ul>\n";
+ ofs << " </p>\n";
+ ofs << " <p id=\"" << id_from_simplex(cc_info.trigger_) << "\">Deleting "
+ << simplex_format(cc_info.trigger_, true) << "</p>\n";
+ }
+ // for (const std::string& fac: cc_info.cofaces_)
+ // ofs << " <li>Checking if " << simplex_format(cc_info.simplex_, true)
+ // << " is a coface of " << simplex_format(fac, true) << "\n";
+ ofs << " </ul>\n";
+ ofs << " </li>\n";
+ if (cc_info.status_ == CC_detail_info::Result_type::coface) {
+ ofs << " <p><span style=\"color:darkorange\">The simplex "
+ << simplex_format(cc_info.simplex_, true) << " is a coface of the simplex "
+ << simplex_format(cc_info.trigger_, true) << "!</span><p>\n";
+ }
+ if (cc_info.status_ == CC_detail_info::Result_type::inserted) {
+ ofs << " <p><span style=\"color:green\">Successfully inserted "
+ << simplex_format(cc_info.simplex_, true) << "!</span><p>\n";
+ }
}
ofs << " </ul>\n";
}
- }
+ }
ofs << " </div>\n";
}
@@ -551,14 +512,12 @@ void write_visu(std::ofstream& ofs) {
<< " <h2> Visualization details debug trace </h2>\n";
// std::vector<std::map<std::string, std::string> > vs_maps(cc_interior_summary_lists.size());
std::map<std::string, std::string> vs_map;
- for (const auto& sv_pair: simplex_vlist_map)
- vs_map.emplace(std::make_pair(sv_pair.second, sv_pair.first));
+ for (const auto& sv_pair : simplex_vlist_map) vs_map.emplace(std::make_pair(sv_pair.second, sv_pair.first));
ofs << " <ul>\n";
- for (const auto& vs_pair: vs_map) {
+ for (const auto& vs_pair : vs_map) {
std::string w_simplex = vs_pair.second.substr(1);
bool is_boundary = vs_pair.second[0] == 'B';
- ofs << " <li><b>" << vs_pair.first << "</b>: "
- << simplex_format(w_simplex, is_boundary) << "</li>\n";
+ ofs << " <li><b>" << vs_pair.first << "</b>: " << simplex_format(w_simplex, is_boundary) << "</li>\n";
}
ofs << " </ul>\n";
ofs << " </div>\n";
@@ -574,16 +533,15 @@ void write_to_html(std::string file_name) {
ofs << " <h1> Debug traces for " << file_name << " </h1>\n";
write_mt(ofs);
write_cc(ofs);
- write_visu(ofs);
+ write_visu(ofs);
ofs << " </body>\n";
ofs << "</html>\n";
ofs.close();
}
-} // namespace coxeter_triangulation
+} // namespace coxeter_triangulation
-} // namespace Gudhi
+} // namespace Gudhi
#endif
-
diff --git a/src/Coxeter_triangulation/include/gudhi/IO/output_meshes_to_medit.h b/src/Coxeter_triangulation/include/gudhi/IO/output_meshes_to_medit.h
index 850736e9..4b454373 100644
--- a/src/Coxeter_triangulation/include/gudhi/IO/output_meshes_to_medit.h
+++ b/src/Coxeter_triangulation/include/gudhi/IO/output_meshes_to_medit.h
@@ -19,8 +19,8 @@
#include <fstream> // for std::ofstream
#include <vector>
#include <type_traits> // for std::enable_if
-#include <tuple> // for std::get
-#include <utility> // for std::make_pair
+#include <tuple> // for std::get
+#include <utility> // for std::make_pair
namespace Gudhi {
@@ -30,67 +30,46 @@ using Vertex_points = Mesh_medit::Vertex_points;
using Mesh_elements = Mesh_medit::Mesh_elements;
using Scalar_field_range = Mesh_medit::Scalar_field_range;
-template <std::size_t I = 0,
- typename... Meshes>
-typename std::enable_if<I == sizeof... (Meshes), void>::type
-fill_meshes (Vertex_points& vertex_points,
- Mesh_elements& edges,
- Mesh_elements& triangles,
- Mesh_elements& tetrahedra,
- Scalar_field_range& triangles_scalar_range,
- Scalar_field_range& tetrahedra_scalar_range,
- std::size_t index,
- const Meshes&... meshes) {
-}
-
-template <std::size_t I = 0,
- typename... Meshes>
-typename std::enable_if<I != sizeof... (Meshes), void>::type
-fill_meshes (Vertex_points& vertex_points,
- Mesh_elements& edges,
- Mesh_elements& triangles,
- Mesh_elements& tetrahedra,
- Scalar_field_range& triangles_scalar_range,
- Scalar_field_range& tetrahedra_scalar_range,
- std::size_t index,
- const Meshes&... meshes) {
+template <std::size_t I = 0, typename... Meshes>
+typename std::enable_if<I == sizeof...(Meshes), void>::type fill_meshes(Vertex_points& vertex_points,
+ Mesh_elements& edges, Mesh_elements& triangles,
+ Mesh_elements& tetrahedra,
+ Scalar_field_range& triangles_scalar_range,
+ Scalar_field_range& tetrahedra_scalar_range,
+ std::size_t index, const Meshes&... meshes) {}
+
+template <std::size_t I = 0, typename... Meshes>
+typename std::enable_if<I != sizeof...(Meshes), void>::type fill_meshes(Vertex_points& vertex_points,
+ Mesh_elements& edges, Mesh_elements& triangles,
+ Mesh_elements& tetrahedra,
+ Scalar_field_range& triangles_scalar_range,
+ Scalar_field_range& tetrahedra_scalar_range,
+ std::size_t index, const Meshes&... meshes) {
auto mesh = std::get<I>(std::forward_as_tuple(meshes...));
- for (const auto& v: mesh.vertex_points)
- vertex_points.push_back(v);
- for (const auto& e: mesh.edges) {
+ for (const auto& v : mesh.vertex_points) vertex_points.push_back(v);
+ for (const auto& e : mesh.edges) {
std::vector<std::size_t> edge;
- for (const auto& v_i: e.first)
- edge.push_back(v_i + index);
+ for (const auto& v_i : e.first) edge.push_back(v_i + index);
edges.emplace_back(std::make_pair(edge, e.second));
}
- for (const auto& t: mesh.triangles) {
+ for (const auto& t : mesh.triangles) {
std::vector<std::size_t> triangle;
- for (const auto& v_i: t.first)
- triangle.push_back(v_i + index);
+ for (const auto& v_i : t.first) triangle.push_back(v_i + index);
triangles.emplace_back(std::make_pair(triangle, t.second));
}
- for (const auto& t: mesh.tetrahedra) {
+ for (const auto& t : mesh.tetrahedra) {
std::vector<std::size_t> tetrahedron;
- for (const auto& v_i: t.first)
- tetrahedron.push_back(v_i + index);
+ for (const auto& v_i : t.first) tetrahedron.push_back(v_i + index);
tetrahedra.emplace_back(std::make_pair(tetrahedron, t.second));
}
- for (const auto& b: mesh.triangles_scalar_range)
- triangles_scalar_range.push_back(b);
- for (const auto& b: mesh.tetrahedra_scalar_range)
- tetrahedra_scalar_range.push_back(b);
- fill_meshes<I+1, Meshes...>(vertex_points,
- edges,
- triangles,
- tetrahedra,
- triangles_scalar_range,
- tetrahedra_scalar_range,
- index + mesh.vertex_points.size(),
- meshes...);
+ for (const auto& b : mesh.triangles_scalar_range) triangles_scalar_range.push_back(b);
+ for (const auto& b : mesh.tetrahedra_scalar_range) tetrahedra_scalar_range.push_back(b);
+ fill_meshes<I + 1, Meshes...>(vertex_points, edges, triangles, tetrahedra, triangles_scalar_range,
+ tetrahedra_scalar_range, index + mesh.vertex_points.size(), meshes...);
}
/** \brief Outputs a text file with specified meshes that can be visualized in Medit.
- *
+ *
* @param[in] amb_d Ambient dimension. Can be 2 or 3.
* @param[in] file_name The name of the output file.
* @param[in] meshes A pack of meshes to be specified separated by commas.
@@ -100,87 +79,73 @@ void output_meshes_to_medit(std::size_t amb_d, std::string file_name, const Mesh
Vertex_points vertex_points;
Mesh_elements edges, triangles, tetrahedra;
Scalar_field_range triangles_scalar_range, tetrahedra_scalar_range;
- fill_meshes(vertex_points,
- edges,
- triangles,
- tetrahedra,
- triangles_scalar_range,
- tetrahedra_scalar_range,
- 0,
- meshes...);
-
- std::ofstream ofs (file_name + ".mesh", std::ofstream::out);
- std::ofstream ofs_bb (file_name + ".bb", std::ofstream::out);
-
+ fill_meshes(vertex_points, edges, triangles, tetrahedra, triangles_scalar_range, tetrahedra_scalar_range, 0,
+ meshes...);
+
+ std::ofstream ofs(file_name + ".mesh", std::ofstream::out);
+ std::ofstream ofs_bb(file_name + ".bb", std::ofstream::out);
+
if (amb_d == 2) {
ofs << "MeshVersionFormatted 1\nDimension 2\n";
ofs_bb << "2 1 ";
ofs << "Vertices\n" << vertex_points.size() << "\n";
- for (auto p: vertex_points) {
+ for (auto p : vertex_points) {
ofs << p[0] << " " << p[1] << " 2\n";
}
ofs << "Edges " << edges.size() << "\n";
- for (auto e: edges) {
- for (auto v: e.first)
- ofs << v << " ";
+ for (auto e : edges) {
+ for (auto v : e.first) ofs << v << " ";
ofs << e.second << std::endl;
}
ofs << "Triangles " << triangles.size() << "\n";
- for (auto s: triangles) {
- for (auto v: s.first) {
- ofs << v << " ";
+ for (auto s : triangles) {
+ for (auto v : s.first) {
+ ofs << v << " ";
}
ofs << s.second << std::endl;
}
ofs_bb << triangles_scalar_range.size() << " 1\n";
- for (auto& b: triangles_scalar_range)
- ofs_bb << b << "\n";
+ for (auto& b : triangles_scalar_range) ofs_bb << b << "\n";
- }
- else {
+ } else {
ofs << "MeshVersionFormatted 1\nDimension 3\n";
ofs_bb << "3 1 ";
ofs << "Vertices\n" << vertex_points.size() << "\n";
- for (auto p: vertex_points) {
+ for (auto p : vertex_points) {
ofs << p[0] << " " << p[1] << " " << p[2] << " 2\n";
}
ofs << "Edges " << edges.size() << "\n";
- for (auto e: edges) {
- for (auto v: e.first)
- ofs << v << " ";
+ for (auto e : edges) {
+ for (auto v : e.first) ofs << v << " ";
ofs << e.second << std::endl;
}
ofs << "Triangles " << triangles.size() << "\n";
- for (auto s: triangles) {
- for (auto v: s.first) {
- ofs << v << " ";
+ for (auto s : triangles) {
+ for (auto v : s.first) {
+ ofs << v << " ";
}
ofs << s.second << std::endl;
}
ofs << "Tetrahedra " << tetrahedra.size() << "\n";
- for (auto s: tetrahedra) {
- for (auto v: s.first) {
- ofs << v << " ";
+ for (auto s : tetrahedra) {
+ for (auto v : s.first) {
+ ofs << v << " ";
}
ofs << s.second << std::endl;
}
ofs_bb << triangles_scalar_range.size() + tetrahedra_scalar_range.size() << " 1\n";
- for (auto& b: triangles_scalar_range)
- ofs_bb << b << "\n";
- for (auto& b: tetrahedra_scalar_range)
- ofs_bb << b << "\n";
+ for (auto& b : triangles_scalar_range) ofs_bb << b << "\n";
+ for (auto& b : tetrahedra_scalar_range) ofs_bb << b << "\n";
}
-
ofs.close();
ofs_bb.close();
-
}
-} // namespace coxeter_triangulation
+} // namespace coxeter_triangulation
-} // namespace Gudhi
+} // namespace Gudhi
#endif