mirror of https://github.com/CGAL/cgal
Replace boolean name and prevent maxx_domain=0
This commit is contained in:
parent
98c80402bc
commit
aeda2ef58c
|
|
@ -25,7 +25,7 @@ class Mesh_complex_3_in_triangulation_3;
|
||||||
template<class Tr, bool c3t3_loader_failed>
|
template<class Tr, bool c3t3_loader_failed>
|
||||||
bool build_triangulation_from_file(std::istream& is,
|
bool build_triangulation_from_file(std::istream& is,
|
||||||
Tr& tr,
|
Tr& tr,
|
||||||
bool prevent_domain_0);
|
bool replace_domain_0);
|
||||||
|
|
||||||
template<class Tr, bool c3t3_loader_failed>
|
template<class Tr, bool c3t3_loader_failed>
|
||||||
bool build_triangulation_from_file(std::istream& is,
|
bool build_triangulation_from_file(std::istream& is,
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ bool build_finite_cells(Tr& tr,
|
||||||
std::vector<std::pair<typename Tr::Cell_handle, int> > >& incident_cells_map,
|
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 std::map<std::array<int,3>, typename Tr::Cell::Surface_patch_index>& border_facets,
|
||||||
const bool verbose,
|
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
|
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 =
|
typename Tr::Geom_traits::Construct_point_3 cp =
|
||||||
tr.geom_traits().construct_point_3_object();
|
tr.geom_traits().construct_point_3_object();
|
||||||
)
|
)
|
||||||
int max_domain = -1;
|
int max_domain = 0;
|
||||||
if(!prevent_domain_0)
|
if(replace_domain_0)
|
||||||
{
|
{
|
||||||
for(std::size_t i=0; i<finite_cells.size(); ++i)
|
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]);
|
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->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(!replace_domain_0){
|
||||||
if(prevent_domain_0){
|
|
||||||
CGAL_precondition(tet[4] > 0);
|
CGAL_precondition(tet[4] > 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c->set_subdomain_index(max_domain+1); // the cell's info keeps the reference of the tetrahedron
|
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
|
// assign cells to vertices
|
||||||
for(int j=0; j<4; ++j)
|
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,
|
const std::map<std::array<int,3>, typename Tr::Cell::Surface_patch_index>& border_facets,
|
||||||
std::vector<typename Tr::Vertex_handle>& vertex_handle_vector,
|
std::vector<typename Tr::Vertex_handle>& vertex_handle_vector,
|
||||||
const bool verbose = false,
|
const bool verbose = false,
|
||||||
bool prevent_domain_0 = true)
|
bool replace_domain_0 = false)
|
||||||
{
|
{
|
||||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||||
typedef typename Tr::Cell_handle Cell_handle;
|
typedef typename Tr::Cell_handle Cell_handle;
|
||||||
|
|
@ -379,7 +377,7 @@ bool build_triangulation(Tr& tr,
|
||||||
if (!finite_cells.empty())
|
if (!finite_cells.empty())
|
||||||
{
|
{
|
||||||
if(!build_finite_cells<Tr>(tr, finite_cells, vertex_handle_vector, incident_cells_map,
|
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;
|
return false;
|
||||||
if(!build_infinite_cells<Tr>(tr, incident_cells_map, verbose))
|
if(!build_infinite_cells<Tr>(tr, incident_cells_map, verbose))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -404,7 +402,7 @@ bool build_triangulation(Tr& tr,
|
||||||
template<class Tr, bool c3t3_loader_failed>
|
template<class Tr, bool c3t3_loader_failed>
|
||||||
bool build_triangulation_from_file(std::istream& is,
|
bool build_triangulation_from_file(std::istream& is,
|
||||||
Tr& tr,
|
Tr& tr,
|
||||||
bool prevent_domain_0)
|
bool replace_domain_0)
|
||||||
{
|
{
|
||||||
typedef typename Tr::Point Point_3;
|
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);
|
std::vector<typename Tr::Vertex_handle> vertices(points.size() + 1);
|
||||||
bool is_well_built = build_triangulation<Tr, c3t3_loader_failed>(tr,
|
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;
|
return is_well_built;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -501,7 +499,7 @@ template<class Tr, bool c3t3_loader_failed>
|
||||||
bool build_triangulation_from_file(std::istream& is,
|
bool build_triangulation_from_file(std::istream& is,
|
||||||
Tr& tr)
|
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
|
} // namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ Polyhedron_demo_c3t3_binary_io_plugin::load(
|
||||||
item->setName(fileinfo.baseName());
|
item->setName(fileinfo.baseName());
|
||||||
item->set_valid(false);
|
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();
|
item->c3t3().rescan_after_load_of_triangulation();
|
||||||
for( C3t3::Triangulation::Finite_cells_iterator
|
for( C3t3::Triangulation::Finite_cells_iterator
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue