mirror of https://github.com/CGAL/cgal
rename functions, remove useless duplicate, and order switch/case by vertex dim
This commit is contained in:
parent
a034df31f2
commit
493b78a6d7
|
|
@ -844,7 +844,7 @@ public:
|
||||||
Conforming_constrained_Delaunay_triangulation_3 convert_for_remeshing() && {
|
Conforming_constrained_Delaunay_triangulation_3 convert_for_remeshing() && {
|
||||||
auto& tr = cdt_impl;
|
auto& tr = cdt_impl;
|
||||||
for(auto vh : tr.all_vertex_handles()) {
|
for(auto vh : tr.all_vertex_handles()) {
|
||||||
vh->sync();
|
vh->sync_vertex_type_with_dimension_and_index(tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto ch : tr.all_cell_handles()) {
|
for(auto ch : tr.all_cell_handles()) {
|
||||||
|
|
@ -875,43 +875,6 @@ public:
|
||||||
/// \endcond
|
/// \endcond
|
||||||
// end SKIP_IN_MANUAL for convert_for_remeshing
|
// end SKIP_IN_MANUAL for convert_for_remeshing
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
|
||||||
Conforming_constrained_Delaunay_triangulation_3 prepare_for_tetrahedral_remeshing() &&
|
|
||||||
{
|
|
||||||
auto& tr = cdt_impl;
|
|
||||||
for(auto vh : tr.all_vertex_handles()) {
|
|
||||||
vh->reset_for_remeshing(tr);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(auto ch : tr.all_cell_handles()) {
|
|
||||||
ch->set_subdomain_index(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::stack<decltype(tr.infinite_cell())> stack;
|
|
||||||
stack.push(tr.infinite_cell());
|
|
||||||
while(!stack.empty()) {
|
|
||||||
auto ch = stack.top();
|
|
||||||
stack.pop();
|
|
||||||
ch->set_subdomain_index(0);
|
|
||||||
for(int i = 0; i < 4; ++i) {
|
|
||||||
if(ch->is_facet_on_surface(i))
|
|
||||||
continue;
|
|
||||||
auto n = ch->neighbor(i);
|
|
||||||
if(n->subdomain_index() == 1) {
|
|
||||||
stack.push(n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Conforming_constrained_Delaunay_triangulation_3 result{std::move(*this)};
|
|
||||||
// static_assert(CGAL::is_nothrow_movable_v<Conforming_constrained_Delaunay_triangulation_3>);
|
|
||||||
static_assert(
|
|
||||||
std::is_same_v<std::remove_reference_t<decltype(*this)>, Conforming_constrained_Delaunay_triangulation_3>);
|
|
||||||
*this = Conforming_constrained_Delaunay_triangulation_3{};
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/// \endcond
|
|
||||||
// end SKIP_IN_MANUAL for convert_for_remeshing
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bidirectional iterator for visiting all constrained facets of the triangulation.
|
* A bidirectional iterator for visiting all constrained facets of the triangulation.
|
||||||
* The value type of this iterator is `Triangulation::Facet`.
|
* The value type of this iterator is `Triangulation::Facet`.
|
||||||
|
|
|
||||||
|
|
@ -76,39 +76,11 @@ public:
|
||||||
std::size_t cached_number_of_incident_facets() const { return number_of_incident_facets_; }
|
std::size_t cached_number_of_incident_facets() const { return number_of_incident_facets_; }
|
||||||
std::size_t cached_number_of_components() const { return number_of_components_; }
|
std::size_t cached_number_of_components() const { return number_of_components_; }
|
||||||
|
|
||||||
void sync() {
|
|
||||||
switch(ccdt_3_data().vertex_type()) {
|
|
||||||
case CDT_3_vertex_type::FREE:
|
|
||||||
set_dimension(3);
|
|
||||||
set_index(0);
|
|
||||||
break;
|
|
||||||
case CDT_3_vertex_type::CORNER:
|
|
||||||
set_dimension(0);
|
|
||||||
set_index(0);
|
|
||||||
break;
|
|
||||||
case CDT_3_vertex_type::STEINER_ON_EDGE:
|
|
||||||
set_dimension(1);
|
|
||||||
set_index(0);
|
|
||||||
break;
|
|
||||||
case CDT_3_vertex_type::STEINER_IN_FACE:
|
|
||||||
set_dimension(2);
|
|
||||||
set_index(ccdt_3_data().face_index());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
CGAL_error();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Tr>
|
template<typename Tr>
|
||||||
void reset_for_remeshing(const Tr& tr)
|
void sync_vertex_type_with_dimension_and_index(const Tr& tr)
|
||||||
{
|
{
|
||||||
switch(ccdt_3_data().vertex_type())
|
switch(ccdt_3_data().vertex_type())
|
||||||
{
|
{
|
||||||
case CDT_3_vertex_type::FREE:
|
|
||||||
set_dimension(3);
|
|
||||||
set_index(0);
|
|
||||||
break;
|
|
||||||
case CDT_3_vertex_type::CORNER:
|
case CDT_3_vertex_type::CORNER:
|
||||||
set_dimension(0);
|
set_dimension(0);
|
||||||
set_index(0);
|
set_index(0);
|
||||||
|
|
@ -121,6 +93,10 @@ public:
|
||||||
set_dimension(2);
|
set_dimension(2);
|
||||||
set_index(ccdt_3_data().face_index());
|
set_index(ccdt_3_data().face_index());
|
||||||
break;
|
break;
|
||||||
|
case CDT_3_vertex_type::FREE:
|
||||||
|
set_dimension(3);
|
||||||
|
set_index(1);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
CGAL_error();
|
CGAL_error();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ auto make_conforming_constrained_Delaunay_triangulation_3(const PolygonMesh &mes
|
||||||
using CDT = typename CGAL::Default::Get<Triangulation,
|
using CDT = typename CGAL::Default::Get<Triangulation,
|
||||||
Conforming_constrained_Delaunay_triangulation_3<Mesh_geom_traits>>::type;
|
Conforming_constrained_Delaunay_triangulation_3<Mesh_geom_traits>>::type;
|
||||||
CDT cdt(mesh, np);
|
CDT cdt(mesh, np);
|
||||||
auto remeshing_cdt{std::move(cdt).prepare_for_tetrahedral_remeshing()};
|
auto remeshing_cdt{std::move(cdt).convert_for_remeshing()};
|
||||||
static_assert(std::is_same_v<decltype(remeshing_cdt), CDT>);
|
static_assert(std::is_same_v<decltype(remeshing_cdt), CDT>);
|
||||||
return remeshing_cdt;
|
return remeshing_cdt;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue