Replace boolean name and prevent maxx_domain=0

This commit is contained in:
Maxime Gimeno 2020-09-07 12:35:54 +02:00
parent 98c80402bc
commit aeda2ef58c
3 changed files with 11 additions and 13 deletions

View File

@ -25,7 +25,7 @@ class Mesh_complex_3_in_triangulation_3;
template<class Tr, bool c3t3_loader_failed>
bool build_triangulation_from_file(std::istream& is,
Tr& tr,
bool prevent_domain_0);
bool replace_domain_0);
template<class Tr, bool c3t3_loader_failed>
bool build_triangulation_from_file(std::istream& is,

View File

@ -107,7 +107,7 @@ bool build_finite_cells(Tr& tr,
std::vector<std::pair<typename Tr::Cell_handle, int> > >& incident_cells_map,
const std::map<std::array<int,3>, typename Tr::Cell::Surface_patch_index>& border_facets,
const bool verbose,
bool prevent_domain_0 = true)
bool replace_domain_0 = false)
{
typedef std::array<int, 5> Tet_with_ref; // 4 ids + 1 reference
@ -119,8 +119,8 @@ bool build_finite_cells(Tr& tr,
typename Tr::Geom_traits::Construct_point_3 cp =
tr.geom_traits().construct_point_3_object();
)
int max_domain = -1;
if(!prevent_domain_0)
int max_domain = 0;
if(replace_domain_0)
{
for(std::size_t i=0; i<finite_cells.size(); ++i)
{
@ -151,14 +151,12 @@ bool build_finite_cells(Tr& tr,
Cell_handle c = tr.tds().create_cell(vs[0], vs[1], vs[2], vs[3]);
c->set_subdomain_index(tet[4]); // the cell's info keeps the reference of the tetrahedron
//c->info() = tet[4]; // the cell's info keeps the reference of the tetrahedron
if(prevent_domain_0){
if(!replace_domain_0){
CGAL_precondition(tet[4] > 0);
}
else
{
c->set_subdomain_index(max_domain+1); // the cell's info keeps the reference of the tetrahedron
// c->info() = max_domain+1; // the cell's info keeps the reference of the tetrahedron
}
// assign cells to vertices
for(int j=0; j<4; ++j)
@ -347,7 +345,7 @@ bool build_triangulation(Tr& tr,
const std::map<std::array<int,3>, typename Tr::Cell::Surface_patch_index>& border_facets,
std::vector<typename Tr::Vertex_handle>& vertex_handle_vector,
const bool verbose = false,
bool prevent_domain_0 = true)
bool replace_domain_0 = false)
{
typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Cell_handle Cell_handle;
@ -379,7 +377,7 @@ bool build_triangulation(Tr& tr,
if (!finite_cells.empty())
{
if(!build_finite_cells<Tr>(tr, finite_cells, vertex_handle_vector, incident_cells_map,
border_facets, verbose, prevent_domain_0))
border_facets, verbose, replace_domain_0))
return false;
if(!build_infinite_cells<Tr>(tr, incident_cells_map, verbose))
return false;
@ -404,7 +402,7 @@ bool build_triangulation(Tr& tr,
template<class Tr, bool c3t3_loader_failed>
bool build_triangulation_from_file(std::istream& is,
Tr& tr,
bool prevent_domain_0)
bool replace_domain_0)
{
typedef typename Tr::Point Point_3;
@ -493,7 +491,7 @@ bool build_triangulation_from_file(std::istream& is,
std::vector<typename Tr::Vertex_handle> vertices(points.size() + 1);
bool is_well_built = build_triangulation<Tr, c3t3_loader_failed>(tr,
points, finite_cells, border_facets, vertices, false, prevent_domain_0);
points, finite_cells, border_facets, vertices, false, replace_domain_0);
return is_well_built;
}
@ -501,7 +499,7 @@ template<class Tr, bool c3t3_loader_failed>
bool build_triangulation_from_file(std::istream& is,
Tr& tr)
{
return build_triangulation_from_file<Tr, c3t3_loader_failed>(is, tr, true);
return build_triangulation_from_file<Tr, c3t3_loader_failed>(is, tr, false);
}
} // namespace CGAL

View File

@ -127,7 +127,7 @@ Polyhedron_demo_c3t3_binary_io_plugin::load(
item->setName(fileinfo.baseName());
item->set_valid(false);
if(CGAL::build_triangulation_from_file<C3t3::Triangulation, true>(in, item->c3t3().triangulation(), false))
if(CGAL::build_triangulation_from_file<C3t3::Triangulation, true>(in, item->c3t3().triangulation(), true))
{
item->c3t3().rescan_after_load_of_triangulation();
for( C3t3::Triangulation::Finite_cells_iterator