mirror of https://github.com/CGAL/cgal
Indentation fixes
This commit is contained in:
parent
bd52dc631a
commit
d30b5c1a7f
|
|
@ -29,11 +29,9 @@
|
|||
#include <map>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace SMDS_3 {
|
||||
|
||||
namespace CGAL
|
||||
{
|
||||
namespace SMDS_3
|
||||
{
|
||||
template<typename Vh>
|
||||
std::array<Vh, 3> make_ordered_vertex_array(const Vh vh0, const Vh vh1, const Vh vh2)
|
||||
{
|
||||
|
|
@ -123,11 +121,10 @@ bool build_finite_cells(Tr& tr,
|
|||
bool success = true;
|
||||
|
||||
CGAL_assertion_code(
|
||||
typename Tr::Geom_traits::Construct_point_3 cp =
|
||||
tr.geom_traits().construct_point_3_object();
|
||||
typename Tr::Geom_traits::Orientation_3 orientation =
|
||||
tr.geom_traits().orientation_3_object();
|
||||
typename Tr::Geom_traits::Construct_point_3 cp = tr.geom_traits().construct_point_3_object();
|
||||
typename Tr::Geom_traits::Orientation_3 orientation = tr.geom_traits().orientation_3_object();
|
||||
)
|
||||
|
||||
typename SubdomainsRange::value_type max_domain = 0;
|
||||
if(replace_domain_0)
|
||||
{
|
||||
|
|
@ -137,6 +134,7 @@ bool build_finite_cells(Tr& tr,
|
|||
max_domain = subdomains[i];
|
||||
}
|
||||
}
|
||||
|
||||
// build the finite cells
|
||||
for(std::size_t i=0; i<finite_cells.size(); ++i)
|
||||
{
|
||||
|
|
@ -154,15 +152,12 @@ bool build_finite_cells(Tr& tr,
|
|||
|
||||
// this assertion also tests for degeneracy
|
||||
CGAL_assertion(orientation(cp(tr.point(vs[0])), cp(tr.point(vs[1])),
|
||||
cp(tr.point(vs[2])), cp(tr.point(vs[3])))
|
||||
== POSITIVE);
|
||||
cp(tr.point(vs[2])), cp(tr.point(vs[3]))) == POSITIVE);
|
||||
|
||||
Cell_handle c = tr.tds().create_cell(vs[0], vs[1], vs[2], vs[3]);
|
||||
c->set_subdomain_index(subdomains[i]); // the cell's info keeps the reference of the tetrahedron
|
||||
if(replace_domain_0 && subdomains[i] == 0)
|
||||
{
|
||||
c->set_subdomain_index(max_domain+1); // the cell's info keeps the reference of the tetrahedron
|
||||
}
|
||||
|
||||
// assign cells to vertices
|
||||
for(int j=0; j<4; ++j)
|
||||
|
|
@ -174,15 +169,17 @@ bool build_finite_cells(Tr& tr,
|
|||
// build the map used for adjacency later
|
||||
for(int j=0; j<4; ++j)
|
||||
{
|
||||
if(!CGAL::SMDS_3::add_facet_to_incident_cells_map<Tr>(c, j, incident_cells_map, verbose, false))
|
||||
// do not allow non-manifold in the finite cells case
|
||||
if(!CGAL::SMDS_3::add_facet_to_incident_cells_map<Tr>(c, j, incident_cells_map, verbose, false))
|
||||
success = false;
|
||||
|
||||
if(border_facets.size() != 0)
|
||||
{
|
||||
std::array<int,3> facet;
|
||||
facet[0] = tet[(j+1) % 4];
|
||||
facet[1] = tet[(j+2) % 4];
|
||||
facet[2] = tet[(j+3) % 4];
|
||||
|
||||
// find the circular permutation that puts the smallest index in the first place.
|
||||
int n0 = (std::min)((std::min)(facet[0], facet[1]), facet[2]);
|
||||
int k = 0;
|
||||
|
|
@ -193,7 +190,8 @@ bool build_finite_cells(Tr& tr,
|
|||
f[1]=facet[(1+k)%3];
|
||||
f[2]=facet[(2+k)%3];
|
||||
++k;
|
||||
} while(f[0] != n0);
|
||||
}
|
||||
while(f[0] != n0);
|
||||
|
||||
typename FacetPatchMap::const_iterator it = border_facets.find(f);
|
||||
if(it != border_facets.end())
|
||||
|
|
@ -215,6 +213,7 @@ bool build_finite_cells(Tr& tr,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
@ -232,6 +231,7 @@ bool add_infinite_facets_to_incident_cells_map(typename Tr::Cell_handle c,
|
|||
bool b2 = CGAL::SMDS_3::add_facet_to_incident_cells_map<Tr>(c, l, incident_cells_map, verbose, allow_non_manifold);
|
||||
l = (inf_vert_pos + 3) % 4;
|
||||
bool b3 = CGAL::SMDS_3::add_facet_to_incident_cells_map<Tr>(c, l, incident_cells_map, verbose, allow_non_manifold);
|
||||
|
||||
return b1 && b2 && b3;
|
||||
}
|
||||
|
||||
|
|
@ -260,13 +260,14 @@ bool build_infinite_cells(Tr& tr,
|
|||
{
|
||||
if(it->second.size() == 2) // facet already has both its incident cells
|
||||
continue;
|
||||
|
||||
CGAL_assertion(it->second.size() == 1);
|
||||
|
||||
Cell_handle c = it->second[0].first;
|
||||
int i = it->second[0].second;
|
||||
|
||||
Cell_handle opp_c;
|
||||
// the infinite cell that we are creating needs to be well oriented...
|
||||
Cell_handle opp_c;
|
||||
if(i == 0 || i == 2)
|
||||
opp_c = tr.tds().create_cell(tr.infinite_vertex(),
|
||||
c->vertex((i + 2) % 4),
|
||||
|
|
@ -309,6 +310,7 @@ bool build_infinite_cells(Tr& tr,
|
|||
facets[vs]++;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto fp : facets)
|
||||
{
|
||||
if (fp.second != 2)
|
||||
|
|
@ -326,12 +328,14 @@ bool build_infinite_cells(Tr& tr,
|
|||
|
||||
// add the facets to the incident cells map
|
||||
for (const Cell_handle& c : infinite_cells)
|
||||
{
|
||||
if(!CGAL::SMDS_3::add_infinite_facets_to_incident_cells_map<Tr>(c,
|
||||
0,
|
||||
incident_cells_map,
|
||||
verbose,
|
||||
allow_non_manifold))
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
@ -400,6 +404,7 @@ bool build_triangulation_impl(Tr& tr,
|
|||
{
|
||||
if (verbose)
|
||||
std::cout << "build_triangulation_impl()..." << std::endl;
|
||||
|
||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||
typedef typename Tr::Cell_handle Cell_handle;
|
||||
typedef std::array<Vertex_handle, 3> Facet_vvv;
|
||||
|
|
@ -408,48 +413,49 @@ bool build_triangulation_impl(Tr& tr,
|
|||
typedef std::pair<Cell_handle, int> Incident_cell;
|
||||
typedef boost::unordered_map<Facet_vvv, std::vector<Incident_cell> > Incident_cells_map;
|
||||
|
||||
bool success = true;
|
||||
|
||||
Incident_cells_map incident_cells_map;
|
||||
vertex_handle_vector.resize(points.size() + 1); // id to vertex_handle
|
||||
//index 0 is for infinite vertex
|
||||
// 1 to n for points in `points`
|
||||
|
||||
CGAL_precondition(!points.empty());
|
||||
|
||||
if(finite_cells.empty())
|
||||
{
|
||||
std::cout << "WARNING: No finite cells were provided. Only the points will be loaded."<<std::endl;
|
||||
}
|
||||
bool success = true;
|
||||
Incident_cells_map incident_cells_map;
|
||||
|
||||
tr.tds().clear(); // not tr.clear() since it calls tr.init() which we don't want
|
||||
// id to vertex_handle
|
||||
// index 0 is for infinite vertex; 1 to n for points in `points`
|
||||
vertex_handle_vector.resize(points.size() + 1);
|
||||
|
||||
if(finite_cells.empty())
|
||||
std::cout << "WARNING: No finite cells were provided. Only the points will be loaded." << std::endl;
|
||||
|
||||
tr.tds().clear(); // not tr.clear() since it calls tr.init(), which we don't want
|
||||
|
||||
build_vertices<Tr>(tr, points, vertex_handle_vector);
|
||||
for(Vertex_handle vh : vertex_handle_vector)
|
||||
{
|
||||
vh->set_dimension(-1);
|
||||
}
|
||||
|
||||
if (!finite_cells.empty())
|
||||
{
|
||||
if (!CGAL::SMDS_3::build_finite_cells<Tr>(tr, finite_cells, subdomains, vertex_handle_vector, incident_cells_map,
|
||||
border_facets, verbose, replace_domain_0))
|
||||
if (!CGAL::SMDS_3::build_finite_cells<Tr>(tr, finite_cells, subdomains, vertex_handle_vector,
|
||||
incident_cells_map, border_facets, verbose, replace_domain_0))
|
||||
{
|
||||
if (verbose) std::cout << "build_finite_cells went wrong" << std::endl;
|
||||
if (verbose)
|
||||
std::cout << "build_finite_cells went wrong" << std::endl;
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
std::cout << "build finite cells done" << std::endl;
|
||||
if (!CGAL::SMDS_3::build_infinite_cells<Tr>(tr, incident_cells_map, verbose, allow_non_manifold))
|
||||
{
|
||||
if(verbose) std::cout << "build_infinite_cells went wrong" << std::endl;
|
||||
if(verbose)
|
||||
std::cout << "build_infinite_cells went wrong" << std::endl;
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
std::cout << "build infinite cells done" << std::endl;
|
||||
tr.tds().set_dimension(3);
|
||||
|
||||
if (!CGAL::SMDS_3::assign_neighbors<Tr>(tr, incident_cells_map, allow_non_manifold))
|
||||
{
|
||||
if(verbose) std::cout << "assign_neighbors went wrong" << std::endl;
|
||||
if(verbose)
|
||||
std::cout << "assign_neighbors went wrong" << std::endl;
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
|
|
@ -460,6 +466,7 @@ bool build_triangulation_impl(Tr& tr,
|
|||
std::cout << tr.number_of_cells() << " cells" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if(verbose)
|
||||
std::cout << tr.number_of_vertices() << " vertices" << std::endl;
|
||||
|
||||
|
|
@ -571,7 +578,9 @@ bool build_triangulation_from_file(std::istream& is,
|
|||
{
|
||||
is >> word;
|
||||
if (word == "End")
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (word == "CGAL::Mesh_complex_3_in_triangulation_3")
|
||||
{
|
||||
dont_replace_domain_0 = true;//with CGAL meshes, domain 0 should be kept
|
||||
|
|
@ -579,6 +588,7 @@ bool build_triangulation_from_file(std::istream& is,
|
|||
}
|
||||
//else skip other comments
|
||||
}
|
||||
|
||||
if(word == "Vertices")
|
||||
{
|
||||
is >> nv;
|
||||
|
|
@ -644,12 +654,13 @@ bool build_triangulation_from_file(std::istream& is,
|
|||
|
||||
if(finite_cells.empty())
|
||||
return false;
|
||||
|
||||
CGAL_assertion(finite_cells.size() == subdomains.size());
|
||||
|
||||
return build_triangulation_with_subdomains_range(tr,
|
||||
points, finite_cells, subdomains, border_facets,
|
||||
verbose,
|
||||
replace_domain_0 && !dont_replace_domain_0,
|
||||
replace_domain_0 && !is_CGAL_mesh,
|
||||
allow_non_manifold);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue