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 <map>
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
|
|
||||||
|
namespace CGAL {
|
||||||
|
namespace SMDS_3 {
|
||||||
|
|
||||||
namespace CGAL
|
|
||||||
{
|
|
||||||
namespace SMDS_3
|
|
||||||
{
|
|
||||||
template<typename Vh>
|
template<typename Vh>
|
||||||
std::array<Vh, 3> make_ordered_vertex_array(const Vh vh0, const Vh vh1, const Vh vh2)
|
std::array<Vh, 3> make_ordered_vertex_array(const Vh vh0, const Vh vh1, const Vh vh2)
|
||||||
{
|
{
|
||||||
|
|
@ -64,7 +62,7 @@ void build_vertices(Tr& tr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Tr>
|
template <class Tr>
|
||||||
bool add_facet_to_incident_cells_map(const typename Tr::Cell_handle c, int i,
|
bool add_facet_to_incident_cells_map(const typename Tr::Cell_handle c, int i,
|
||||||
boost::unordered_map<std::array<typename Tr::Vertex_handle, 3>,
|
boost::unordered_map<std::array<typename Tr::Vertex_handle, 3>,
|
||||||
std::vector<std::pair<typename Tr::Cell_handle, int> > >& incident_cells_map,
|
std::vector<std::pair<typename Tr::Cell_handle, int> > >& incident_cells_map,
|
||||||
|
|
@ -105,7 +103,7 @@ bool add_facet_to_incident_cells_map(const typename Tr::Cell_handle c, int i,
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Tr, typename CellRange, typename SubdomainsRange, typename FacetPatchMap>
|
template <class Tr, typename CellRange, typename SubdomainsRange, typename FacetPatchMap>
|
||||||
bool build_finite_cells(Tr& tr,
|
bool build_finite_cells(Tr& tr,
|
||||||
const CellRange& finite_cells,
|
const CellRange& finite_cells,
|
||||||
const SubdomainsRange& subdomains,
|
const SubdomainsRange& subdomains,
|
||||||
|
|
@ -123,11 +121,10 @@ bool build_finite_cells(Tr& tr,
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
CGAL_assertion_code(
|
CGAL_assertion_code(
|
||||||
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();
|
typename Tr::Geom_traits::Orientation_3 orientation = tr.geom_traits().orientation_3_object();
|
||||||
typename Tr::Geom_traits::Orientation_3 orientation =
|
|
||||||
tr.geom_traits().orientation_3_object();
|
|
||||||
)
|
)
|
||||||
|
|
||||||
typename SubdomainsRange::value_type max_domain = 0;
|
typename SubdomainsRange::value_type max_domain = 0;
|
||||||
if(replace_domain_0)
|
if(replace_domain_0)
|
||||||
{
|
{
|
||||||
|
|
@ -137,6 +134,7 @@ bool build_finite_cells(Tr& tr,
|
||||||
max_domain = subdomains[i];
|
max_domain = subdomains[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// build the finite cells
|
// build the finite cells
|
||||||
for(std::size_t i=0; i<finite_cells.size(); ++i)
|
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
|
// this assertion also tests for degeneracy
|
||||||
CGAL_assertion(orientation(cp(tr.point(vs[0])), cp(tr.point(vs[1])),
|
CGAL_assertion(orientation(cp(tr.point(vs[0])), cp(tr.point(vs[1])),
|
||||||
cp(tr.point(vs[2])), cp(tr.point(vs[3])))
|
cp(tr.point(vs[2])), cp(tr.point(vs[3]))) == POSITIVE);
|
||||||
== POSITIVE);
|
|
||||||
|
|
||||||
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(subdomains[i]); // the cell's info keeps the reference of the tetrahedron
|
c->set_subdomain_index(subdomains[i]); // the cell's info keeps the reference of the tetrahedron
|
||||||
if(replace_domain_0 && subdomains[i] == 0)
|
if(replace_domain_0 && subdomains[i] == 0)
|
||||||
{
|
|
||||||
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
|
||||||
}
|
|
||||||
|
|
||||||
// assign cells to vertices
|
// assign cells to vertices
|
||||||
for(int j=0; j<4; ++j)
|
for(int j=0; j<4; ++j)
|
||||||
|
|
@ -174,18 +169,20 @@ bool build_finite_cells(Tr& tr,
|
||||||
// build the map used for adjacency later
|
// build the map used for adjacency later
|
||||||
for(int j=0; j<4; ++j)
|
for(int j=0; j<4; ++j)
|
||||||
{
|
{
|
||||||
|
// 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))
|
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
|
|
||||||
success = false;
|
success = false;
|
||||||
|
|
||||||
if(border_facets.size() != 0)
|
if(border_facets.size() != 0)
|
||||||
{
|
{
|
||||||
std::array<int,3> facet;
|
std::array<int,3> facet;
|
||||||
facet[0]=tet[(j+1) % 4];
|
facet[0] = tet[(j+1) % 4];
|
||||||
facet[1]=tet[(j+2) % 4];
|
facet[1] = tet[(j+2) % 4];
|
||||||
facet[2]=tet[(j+3) % 4];
|
facet[2] = tet[(j+3) % 4];
|
||||||
//find the circular permutation that puts the smallest index in the first place.
|
|
||||||
|
// 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 n0 = (std::min)((std::min)(facet[0], facet[1]), facet[2]);
|
||||||
int k=0;
|
int k = 0;
|
||||||
std::array<int,3> f;
|
std::array<int,3> f;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -193,7 +190,8 @@ bool build_finite_cells(Tr& tr,
|
||||||
f[1]=facet[(1+k)%3];
|
f[1]=facet[(1+k)%3];
|
||||||
f[2]=facet[(2+k)%3];
|
f[2]=facet[(2+k)%3];
|
||||||
++k;
|
++k;
|
||||||
} while(f[0] != n0);
|
}
|
||||||
|
while(f[0] != n0);
|
||||||
|
|
||||||
typename FacetPatchMap::const_iterator it = border_facets.find(f);
|
typename FacetPatchMap::const_iterator it = border_facets.find(f);
|
||||||
if(it != border_facets.end())
|
if(it != border_facets.end())
|
||||||
|
|
@ -215,6 +213,7 @@ bool build_finite_cells(Tr& tr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
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);
|
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;
|
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);
|
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;
|
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
|
if(it->second.size() == 2) // facet already has both its incident cells
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CGAL_assertion(it->second.size() == 1);
|
CGAL_assertion(it->second.size() == 1);
|
||||||
|
|
||||||
Cell_handle c = it->second[0].first;
|
Cell_handle c = it->second[0].first;
|
||||||
int i = it->second[0].second;
|
int i = it->second[0].second;
|
||||||
|
|
||||||
Cell_handle opp_c;
|
|
||||||
// the infinite cell that we are creating needs to be well oriented...
|
// the infinite cell that we are creating needs to be well oriented...
|
||||||
|
Cell_handle opp_c;
|
||||||
if(i == 0 || i == 2)
|
if(i == 0 || i == 2)
|
||||||
opp_c = tr.tds().create_cell(tr.infinite_vertex(),
|
opp_c = tr.tds().create_cell(tr.infinite_vertex(),
|
||||||
c->vertex((i + 2) % 4),
|
c->vertex((i + 2) % 4),
|
||||||
|
|
@ -309,6 +310,7 @@ bool build_infinite_cells(Tr& tr,
|
||||||
facets[vs]++;
|
facets[vs]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto fp : facets)
|
for (auto fp : facets)
|
||||||
{
|
{
|
||||||
if (fp.second != 2)
|
if (fp.second != 2)
|
||||||
|
|
@ -326,12 +328,14 @@ bool build_infinite_cells(Tr& tr,
|
||||||
|
|
||||||
// add the facets to the incident cells map
|
// add the facets to the incident cells map
|
||||||
for (const Cell_handle& c : infinite_cells)
|
for (const Cell_handle& c : infinite_cells)
|
||||||
|
{
|
||||||
if(!CGAL::SMDS_3::add_infinite_facets_to_incident_cells_map<Tr>(c,
|
if(!CGAL::SMDS_3::add_infinite_facets_to_incident_cells_map<Tr>(c,
|
||||||
0,
|
0,
|
||||||
incident_cells_map,
|
incident_cells_map,
|
||||||
verbose,
|
verbose,
|
||||||
allow_non_manifold))
|
allow_non_manifold))
|
||||||
success = false;
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
@ -400,6 +404,7 @@ bool build_triangulation_impl(Tr& tr,
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
std::cout << "build_triangulation_impl()..." << std::endl;
|
std::cout << "build_triangulation_impl()..." << std::endl;
|
||||||
|
|
||||||
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;
|
||||||
typedef std::array<Vertex_handle, 3> Facet_vvv;
|
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 std::pair<Cell_handle, int> Incident_cell;
|
||||||
typedef boost::unordered_map<Facet_vvv, std::vector<Incident_cell> > Incident_cells_map;
|
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());
|
CGAL_precondition(!points.empty());
|
||||||
|
|
||||||
if(finite_cells.empty())
|
bool success = true;
|
||||||
{
|
Incident_cells_map incident_cells_map;
|
||||||
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
|
// 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);
|
build_vertices<Tr>(tr, points, vertex_handle_vector);
|
||||||
for(Vertex_handle vh : vertex_handle_vector)
|
for(Vertex_handle vh : vertex_handle_vector)
|
||||||
{
|
|
||||||
vh->set_dimension(-1);
|
vh->set_dimension(-1);
|
||||||
}
|
|
||||||
if (!finite_cells.empty())
|
if (!finite_cells.empty())
|
||||||
{
|
{
|
||||||
if (!CGAL::SMDS_3::build_finite_cells<Tr>(tr, finite_cells, subdomains, vertex_handle_vector, incident_cells_map,
|
if (!CGAL::SMDS_3::build_finite_cells<Tr>(tr, finite_cells, subdomains, vertex_handle_vector,
|
||||||
border_facets, verbose, replace_domain_0))
|
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;
|
success = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << "build finite cells done" << std::endl;
|
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 (!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;
|
success = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << "build infinite cells done" << std::endl;
|
std::cout << "build infinite cells done" << std::endl;
|
||||||
tr.tds().set_dimension(3);
|
tr.tds().set_dimension(3);
|
||||||
|
|
||||||
if (!CGAL::SMDS_3::assign_neighbors<Tr>(tr, incident_cells_map, allow_non_manifold))
|
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;
|
success = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -460,6 +466,7 @@ bool build_triangulation_impl(Tr& tr,
|
||||||
std::cout << tr.number_of_cells() << " cells" << std::endl;
|
std::cout << tr.number_of_cells() << " cells" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(verbose)
|
if(verbose)
|
||||||
std::cout << tr.number_of_vertices() << " vertices" << std::endl;
|
std::cout << tr.number_of_vertices() << " vertices" << std::endl;
|
||||||
|
|
||||||
|
|
@ -571,7 +578,9 @@ bool build_triangulation_from_file(std::istream& is,
|
||||||
{
|
{
|
||||||
is >> word;
|
is >> word;
|
||||||
if (word == "End")
|
if (word == "End")
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else if (word == "CGAL::Mesh_complex_3_in_triangulation_3")
|
else if (word == "CGAL::Mesh_complex_3_in_triangulation_3")
|
||||||
{
|
{
|
||||||
dont_replace_domain_0 = true;//with CGAL meshes, domain 0 should be kept
|
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
|
//else skip other comments
|
||||||
}
|
}
|
||||||
|
|
||||||
if(word == "Vertices")
|
if(word == "Vertices")
|
||||||
{
|
{
|
||||||
is >> nv;
|
is >> nv;
|
||||||
|
|
@ -644,12 +654,13 @@ bool build_triangulation_from_file(std::istream& is,
|
||||||
|
|
||||||
if(finite_cells.empty())
|
if(finite_cells.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CGAL_assertion(finite_cells.size() == subdomains.size());
|
CGAL_assertion(finite_cells.size() == subdomains.size());
|
||||||
|
|
||||||
return build_triangulation_with_subdomains_range(tr,
|
return build_triangulation_with_subdomains_range(tr,
|
||||||
points, finite_cells, subdomains, border_facets,
|
points, finite_cells, subdomains, border_facets,
|
||||||
verbose,
|
verbose,
|
||||||
replace_domain_0 && !dont_replace_domain_0,
|
replace_domain_0 && !is_CGAL_mesh,
|
||||||
allow_non_manifold);
|
allow_non_manifold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue