mirror of https://github.com/CGAL/cgal
cleaning after 2 previous commits
This commit is contained in:
parent
385e770762
commit
1bbbc0aae2
|
|
@ -17,10 +17,19 @@
|
|||
#ifndef CGAL_TETRAHEDRAL_REMESHING_ADAPTIVE_SIZING_FIELD_H
|
||||
#define CGAL_TETRAHEDRAL_REMESHING_ADAPTIVE_SIZING_FIELD_H
|
||||
|
||||
#include <CGAL/license/Mesh_3.h>
|
||||
#include <CGAL/license/Tetrahedral_remeshing.h>
|
||||
|
||||
#include <CGAL/Tetrahedral_remeshing/Sizing_field.h>
|
||||
|
||||
#include <CGAL/Search_traits_3.h>
|
||||
#include <CGAL/Search_traits_adapter.h>
|
||||
#include <CGAL/Orthogonal_k_neighbor_search.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/iterator/zip_iterator.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace CGAL
|
||||
{
|
||||
|
|
@ -28,6 +37,7 @@ namespace Tetrahedral_remeshing
|
|||
{
|
||||
/**
|
||||
* @class Adaptive_remeshing_sizing_field
|
||||
* @tparam Tr a triangulation
|
||||
*/
|
||||
template <typename Tr>
|
||||
class Adaptive_remeshing_sizing_field
|
||||
|
|
@ -36,303 +46,211 @@ class Adaptive_remeshing_sizing_field
|
|||
// Types
|
||||
typedef typename Tr::Geom_traits GT;
|
||||
typedef typename Tr::Geom_traits::Point_3 Bare_point;
|
||||
typedef typename Tr::Point Weighted_point;
|
||||
typedef typename Tr::Point Tr_point;
|
||||
typedef typename GT::FT FT;
|
||||
|
||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||
typedef typename Tr::Cell_handle Cell_handle;
|
||||
|
||||
private:
|
||||
/// A cell that is used to accelerate location queries
|
||||
mutable Cell_handle last_cell_;
|
||||
using Point_and_size = boost::tuple<Bare_point, FT>;
|
||||
using Traits = CGAL::Search_traits_adapter<Point_and_size,
|
||||
CGAL::Nth_of_tuple_property_map<0, Point_and_size>,
|
||||
CGAL::Search_traits_3<GT> >;
|
||||
using K_neighbor_search = CGAL::Orthogonal_k_neighbor_search<Traits>;
|
||||
using Distance = typename K_neighbor_search::Distance;
|
||||
using Tree = typename K_neighbor_search::Tree;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Adaptive_remeshing_sizing_field(Tr& tr);
|
||||
|
||||
/**
|
||||
* Fills sizing field, using size associated to points in `tr_`
|
||||
*/
|
||||
void fill();
|
||||
|
||||
/**
|
||||
* Fills sizing field, using size associated to point in `value_map`
|
||||
* Constructor
|
||||
*/
|
||||
void fill(const std::map<Bare_point, FT>& value_map);
|
||||
Adaptive_remeshing_sizing_field(const Tr& tr)
|
||||
{
|
||||
build_kd_tree(tr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns size at point `p`.
|
||||
*/
|
||||
FT operator()(const Bare_point& p) const
|
||||
{ return this->operator()(p, this->get_last_cell()); }
|
||||
|
||||
/**
|
||||
* Returns size at point `p`, using `v` to accelerate `p` location
|
||||
* in triangulation
|
||||
*/
|
||||
FT operator()(const Bare_point& p, const Vertex_handle& v) const
|
||||
{ return this->operator()(p, v->cell()); }
|
||||
|
||||
/**
|
||||
* Returns size at point `p`.
|
||||
*/
|
||||
FT operator()(const Bare_point& p, const Cell_handle& c) const;
|
||||
|
||||
/**
|
||||
* Returns size at point `p`. Assumes that p is the centroid of c.
|
||||
*/
|
||||
FT operator()(const Bare_point& p, const std::pair<Cell_handle, bool>& c) const;
|
||||
|
||||
* Returns size at point `p`
|
||||
*/
|
||||
template <typename Index>
|
||||
FT operator()(const Bare_point& p, const int& dim, const Index& i) const
|
||||
{ return this->operator()(p); }
|
||||
|
||||
void set_triangulation(Tr& tr) { tr_ = tr; }
|
||||
|
||||
protected:
|
||||
Cell_handle get_last_cell() const
|
||||
{
|
||||
return last_cell_;
|
||||
}
|
||||
|
||||
void set_last_cell(Cell_handle c) const
|
||||
{
|
||||
last_cell_ = c;
|
||||
// Find nearest vertex
|
||||
Distance tr_dist;
|
||||
K_neighbor_search search(m_kd_tree, p, 1/*nb nearest neighbors*/);
|
||||
for (typename K_neighbor_search::iterator it = search.begin();
|
||||
it != search.end();
|
||||
it++)
|
||||
{
|
||||
const auto& pt_size = it->first;
|
||||
return CGAL::approximate_sqrt(boost::get<1>(pt_size));
|
||||
//std::cout << " d(q, nearest neighbor)= "
|
||||
// << tr_dist.inverse_of_transformed_distance(it->second) << " "
|
||||
// << boost::get<0>(it->first) << " " << boost::get<1>(it->first) << std::endl;
|
||||
}
|
||||
return FT(0);
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns size at point `p`, by interpolation into tetrahedron.
|
||||
*/
|
||||
FT interpolate_on_cell_vertices(const Bare_point& p,
|
||||
const Cell_handle& cell) const;
|
||||
* Fills sizing field, using size associated to points in `tr_`
|
||||
*/
|
||||
void build_kd_tree(const Tr& tr);
|
||||
|
||||
/**
|
||||
* Returns size at point `p`, by interpolation into facet (`cell` is assumed
|
||||
* to be an infinite cell).
|
||||
*/
|
||||
FT interpolate_on_facet_vertices(const Bare_point& p,
|
||||
const Cell_handle& cell) const;
|
||||
///**
|
||||
// * Returns size at point `p`, by interpolation into tetrahedron.
|
||||
// */
|
||||
//FT interpolate_on_cell_vertices(const Bare_point& p,
|
||||
// const Cell_handle& cell) const;
|
||||
|
||||
FT sq_circumradius_length(const Cell_handle& cell, const Vertex_handle& v) const;
|
||||
FT average_circumradius_length(const Vertex_handle& v) const;
|
||||
///**
|
||||
// * Returns size at point `p`, by interpolation into facet (`cell` is assumed
|
||||
// * to be an infinite cell).
|
||||
// */
|
||||
//FT interpolate_on_facet_vertices(const Bare_point& p,
|
||||
// const Cell_handle& cell) const;
|
||||
|
||||
FT sq_circumradius_length(const Cell_handle cell, const Vertex_handle v, const Tr& tr) const;
|
||||
FT average_circumradius_length(const Vertex_handle v, const Tr& tr) const;
|
||||
|
||||
private:
|
||||
/// The triangulation
|
||||
Tr& tr_;
|
||||
Tree m_kd_tree;
|
||||
};
|
||||
|
||||
|
||||
template <typename Tr>
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
Adaptive_remeshing_sizing_field(Tr& tr)
|
||||
: tr_(tr)
|
||||
{}
|
||||
|
||||
template <typename Tr>
|
||||
void
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
fill()
|
||||
build_kd_tree(const Tr& tr)
|
||||
{
|
||||
std::map<Bare_point, FT> value_map;
|
||||
auto cp = tr.geom_traits().construct_point_3_object();
|
||||
|
||||
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
|
||||
std::vector<Bare_point> points;
|
||||
std::vector<FT> sizes;
|
||||
|
||||
// Fill map with local size
|
||||
for (typename Tr::Finite_vertices_iterator vit = tr_.finite_vertices_begin();
|
||||
vit != tr_.finite_vertices_end();
|
||||
++vit)
|
||||
// Fill Kd tree with local size
|
||||
for (const Vertex_handle v : tr.finite_vertex_handles())
|
||||
{
|
||||
const Weighted_point& position = tr_.point(vit);
|
||||
value_map.insert(std::make_pair(cp(position), average_circumradius_length(vit)));
|
||||
const Tr_point& position = tr.point(v);
|
||||
points.push_back(cp(position));
|
||||
sizes.push_back(average_circumradius_length(v, tr));
|
||||
}
|
||||
|
||||
// do the filling
|
||||
fill(value_map);
|
||||
m_kd_tree.insert(boost::make_zip_iterator(boost::make_tuple(points.begin(), sizes.begin())),
|
||||
boost::make_zip_iterator(boost::make_tuple(points.end(), sizes.end())));
|
||||
}
|
||||
|
||||
template <typename Tr>
|
||||
void
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
fill(const std::map<Bare_point, FT>& value_map)
|
||||
{
|
||||
typedef typename Tr::Finite_vertices_iterator Fvi;
|
||||
|
||||
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
|
||||
|
||||
for ( Fvi vit = tr_.finite_vertices_begin(); vit != tr_.finite_vertices_end(); ++ vit )
|
||||
{
|
||||
const Weighted_point& position = tr_.point(vit);
|
||||
|
||||
typename std::map<Bare_point, FT>::const_iterator find_result =
|
||||
value_map.find(cp(position));
|
||||
|
||||
if ( find_result != value_map.end() )
|
||||
{
|
||||
vit->set_meshing_info(find_result->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_assertion(false);
|
||||
vit->set_meshing_info(FT(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//template <typename Tr>
|
||||
//typename Adaptive_remeshing_sizing_field<Tr>::FT
|
||||
//Adaptive_remeshing_sizing_field<Tr>::
|
||||
//interpolate_on_cell_vertices(const Bare_point& p, const Cell_handle& cell) const
|
||||
//{
|
||||
// typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
|
||||
// typename GT::Compute_volume_3 volume = tr_.geom_traits().compute_volume_3_object();
|
||||
//
|
||||
// // Interpolate value using tet vertices values
|
||||
// const FT& va = cell->vertex(0)->meshing_info();
|
||||
// const FT& vb = cell->vertex(1)->meshing_info();
|
||||
// const FT& vc = cell->vertex(2)->meshing_info();
|
||||
// const FT& vd = cell->vertex(3)->meshing_info();
|
||||
//
|
||||
// const Tr_point& wa = tr_.point(cell, 0);
|
||||
// const Tr_point& wb = tr_.point(cell, 1);
|
||||
// const Tr_point& wc = tr_.point(cell, 2);
|
||||
// const Tr_point& wd = tr_.point(cell, 3);
|
||||
// const Bare_point& a = cp(wa);
|
||||
// const Bare_point& b = cp(wb);
|
||||
// const Bare_point& c = cp(wc);
|
||||
// const Bare_point& d = cp(wd);
|
||||
//
|
||||
// const FT abcp = CGAL::abs(volume(a,b,c,p));
|
||||
// const FT abdp = CGAL::abs(volume(a,d,b,p));
|
||||
// const FT acdp = CGAL::abs(volume(a,c,d,p));
|
||||
// const FT bcdp = CGAL::abs(volume(b,d,c,p));
|
||||
//
|
||||
// // If volume is 0, then compute the average value
|
||||
// if ( is_zero(abcp+abdp+acdp+bcdp) )
|
||||
// return (va+vb+vc+vd) / 4.;
|
||||
//
|
||||
// return ( (abcp*vd + abdp*vc + acdp*vb + bcdp*va) / (abcp+abdp+acdp+bcdp) );
|
||||
//}
|
||||
//
|
||||
//
|
||||
//template <typename Tr>
|
||||
//typename Adaptive_remeshing_sizing_field<Tr>::FT
|
||||
//Adaptive_remeshing_sizing_field<Tr>::
|
||||
//interpolate_on_facet_vertices(const Bare_point& p, const Cell_handle& cell) const
|
||||
//{
|
||||
// typename GT::Compute_area_3 area = tr_.geom_traits().compute_area_3_object();
|
||||
//
|
||||
// typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
|
||||
// // Find infinite vertex and put it in k0
|
||||
// int k0 = 0;
|
||||
// int k1 = 1;
|
||||
// int k2 = 2;
|
||||
// int k3 = 3;
|
||||
//
|
||||
// if ( tr_.is_infinite(cell->vertex(1)) )
|
||||
// std::swap(k0,k1);
|
||||
// if ( tr_.is_infinite(cell->vertex(2)) )
|
||||
// std::swap(k0,k2);
|
||||
// if ( tr_.is_infinite(cell->vertex(3)) )
|
||||
// std::swap(k0,k3);
|
||||
//
|
||||
// // Interpolate value using tet vertices values
|
||||
// const FT& va = cell->vertex(k1)->meshing_info();
|
||||
// const FT& vb = cell->vertex(k2)->meshing_info();
|
||||
// const FT& vc = cell->vertex(k3)->meshing_info();
|
||||
//
|
||||
// const Tr_point& wa = tr_.point(cell, k1);
|
||||
// const Tr_point& wb = tr_.point(cell, k2);
|
||||
// const Tr_point& wc = tr_.point(cell, k3);
|
||||
// const Bare_point& a = cp(wa);
|
||||
// const Bare_point& b = cp(wb);
|
||||
// const Bare_point& c = cp(wc);
|
||||
//
|
||||
// const FT abp = area(a, b, p);
|
||||
// const FT acp = area(a, c, p);
|
||||
// const FT bcp = area(b, c, p);
|
||||
//
|
||||
// CGAL_assertion(abp >= 0);
|
||||
// CGAL_assertion(acp >= 0);
|
||||
// CGAL_assertion(bcp >= 0);
|
||||
//
|
||||
// // If area is 0, then compute the average value
|
||||
// if ( is_zero(abp+acp+bcp) )
|
||||
// return (va+vb+vc)/3.;
|
||||
//
|
||||
// return ( (abp*vc + acp*vb + bcp*va ) / (abp+acp+bcp) );
|
||||
//}
|
||||
|
||||
template <typename Tr>
|
||||
typename Adaptive_remeshing_sizing_field<Tr>::FT
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
operator()(const Bare_point& p, const Cell_handle& c) const
|
||||
sq_circumradius_length(const Cell_handle cell,
|
||||
const Vertex_handle v,
|
||||
const Tr& tr) const
|
||||
{
|
||||
typename GT::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object();
|
||||
auto cp = tr.geom_traits().construct_point_3_object();
|
||||
auto sq_distance = tr.geom_traits().compute_squared_distance_3_object();
|
||||
auto cc = tr.geom_traits().construct_circumcenter_3_object();
|
||||
|
||||
//use the inexact locate (much faster than locate) to get a hint
|
||||
//and then use locate to check whether p is really inside hint
|
||||
// if not, an exact locate will be performed
|
||||
Cell_handle hint = tr_.inexact_locate(cwp(p),c);
|
||||
const Cell_handle cell = tr_.locate(cwp(p), hint);
|
||||
|
||||
this->set_last_cell(cell);
|
||||
|
||||
if ( !tr_.is_infinite(cell) )
|
||||
return interpolate_on_cell_vertices(p, cell);
|
||||
else
|
||||
return interpolate_on_facet_vertices(p, cell);
|
||||
}
|
||||
|
||||
|
||||
template <typename Tr>
|
||||
typename Adaptive_remeshing_sizing_field<Tr>::FT
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
operator()(const Bare_point&, const std::pair<Cell_handle,bool>& c) const
|
||||
{
|
||||
// Assumes that p is the centroid of c
|
||||
const Cell_handle& cell = c.first;
|
||||
|
||||
// Interpolate value using tet vertices values
|
||||
const FT& va = cell->vertex(0)->meshing_info();
|
||||
const FT& vb = cell->vertex(1)->meshing_info();
|
||||
const FT& vc = cell->vertex(2)->meshing_info();
|
||||
const FT& vd = cell->vertex(3)->meshing_info();
|
||||
|
||||
return ( (va+vb+vc+vd)/4 );
|
||||
}
|
||||
|
||||
|
||||
template <typename Tr>
|
||||
typename Adaptive_remeshing_sizing_field<Tr>::FT
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
interpolate_on_cell_vertices(const Bare_point& p, const Cell_handle& cell) const
|
||||
{
|
||||
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
|
||||
typename GT::Compute_volume_3 volume = tr_.geom_traits().compute_volume_3_object();
|
||||
|
||||
// Interpolate value using tet vertices values
|
||||
const FT& va = cell->vertex(0)->meshing_info();
|
||||
const FT& vb = cell->vertex(1)->meshing_info();
|
||||
const FT& vc = cell->vertex(2)->meshing_info();
|
||||
const FT& vd = cell->vertex(3)->meshing_info();
|
||||
|
||||
const Weighted_point& wa = tr_.point(cell, 0);
|
||||
const Weighted_point& wb = tr_.point(cell, 1);
|
||||
const Weighted_point& wc = tr_.point(cell, 2);
|
||||
const Weighted_point& wd = tr_.point(cell, 3);
|
||||
const Bare_point& a = cp(wa);
|
||||
const Bare_point& b = cp(wb);
|
||||
const Bare_point& c = cp(wc);
|
||||
const Bare_point& d = cp(wd);
|
||||
|
||||
const FT abcp = CGAL::abs(volume(a,b,c,p));
|
||||
const FT abdp = CGAL::abs(volume(a,d,b,p));
|
||||
const FT acdp = CGAL::abs(volume(a,c,d,p));
|
||||
const FT bcdp = CGAL::abs(volume(b,d,c,p));
|
||||
|
||||
// If volume is 0, then compute the average value
|
||||
if ( is_zero(abcp+abdp+acdp+bcdp) )
|
||||
return (va+vb+vc+vd) / 4.;
|
||||
|
||||
return ( (abcp*vd + abdp*vc + acdp*vb + bcdp*va) / (abcp+abdp+acdp+bcdp) );
|
||||
}
|
||||
|
||||
|
||||
template <typename Tr>
|
||||
typename Adaptive_remeshing_sizing_field<Tr>::FT
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
interpolate_on_facet_vertices(const Bare_point& p, const Cell_handle& cell) const
|
||||
{
|
||||
typename GT::Compute_area_3 area = tr_.geom_traits().compute_area_3_object();
|
||||
|
||||
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
|
||||
// Find infinite vertex and put it in k0
|
||||
int k0 = 0;
|
||||
int k1 = 1;
|
||||
int k2 = 2;
|
||||
int k3 = 3;
|
||||
|
||||
if ( tr_.is_infinite(cell->vertex(1)) )
|
||||
std::swap(k0,k1);
|
||||
if ( tr_.is_infinite(cell->vertex(2)) )
|
||||
std::swap(k0,k2);
|
||||
if ( tr_.is_infinite(cell->vertex(3)) )
|
||||
std::swap(k0,k3);
|
||||
|
||||
// Interpolate value using tet vertices values
|
||||
const FT& va = cell->vertex(k1)->meshing_info();
|
||||
const FT& vb = cell->vertex(k2)->meshing_info();
|
||||
const FT& vc = cell->vertex(k3)->meshing_info();
|
||||
|
||||
const Weighted_point& wa = tr_.point(cell, k1);
|
||||
const Weighted_point& wb = tr_.point(cell, k2);
|
||||
const Weighted_point& wc = tr_.point(cell, k3);
|
||||
const Bare_point& a = cp(wa);
|
||||
const Bare_point& b = cp(wb);
|
||||
const Bare_point& c = cp(wc);
|
||||
|
||||
const FT abp = area(a, b, p);
|
||||
const FT acp = area(a, c, p);
|
||||
const FT bcp = area(b, c, p);
|
||||
|
||||
CGAL_assertion(abp >= 0);
|
||||
CGAL_assertion(acp >= 0);
|
||||
CGAL_assertion(bcp >= 0);
|
||||
|
||||
// If area is 0, then compute the average value
|
||||
if ( is_zero(abp+acp+bcp) )
|
||||
return (va+vb+vc)/3.;
|
||||
|
||||
return ( (abp*vc + acp*vb + bcp*va ) / (abp+acp+bcp) );
|
||||
}
|
||||
|
||||
template <typename Tr>
|
||||
typename Adaptive_remeshing_sizing_field<Tr>::FT
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
sq_circumradius_length(const Cell_handle& cell, const Vertex_handle& v) const
|
||||
{
|
||||
typename GT::Construct_point_3 cp
|
||||
= tr_.geom_traits().construct_point_3_object();
|
||||
typename GT::Compute_squared_distance_3 sq_distance
|
||||
= tr_.geom_traits().compute_squared_distance_3_object();
|
||||
typename GT::Construct_circumcenter_3 cc
|
||||
= tr_.geom_traits().construct_circumcenter_3_object();
|
||||
|
||||
const auto t = tr_.tetrahedron(cell);
|
||||
const auto t = tr.tetrahedron(cell);
|
||||
const Bare_point circumcenter = cc(t[0], t[1], t[2], t[3]);
|
||||
const Weighted_point& position = tr_.point(cell, cell->index(v));
|
||||
const Tr_point& position = tr.point(cell, cell->index(v));
|
||||
|
||||
return (sq_distance(cp(position), circumcenter));
|
||||
return sq_distance(cp(position), circumcenter);
|
||||
}
|
||||
|
||||
template <typename Tr>
|
||||
typename Adaptive_remeshing_sizing_field<Tr>::FT
|
||||
Adaptive_remeshing_sizing_field<Tr>::
|
||||
average_circumradius_length(const Vertex_handle& v) const
|
||||
average_circumradius_length(const Vertex_handle v, const Tr& tr) const
|
||||
{
|
||||
std::vector<Cell_handle> incident_cells;
|
||||
incident_cells.reserve(64);
|
||||
tr_.incident_cells(v, std::back_inserter(incident_cells));
|
||||
tr.incident_cells(v, std::back_inserter(incident_cells));
|
||||
|
||||
using SI = typename Tr::Triangulation_data_structure::Cell::Subdomain_index;
|
||||
|
||||
|
|
@ -343,7 +261,7 @@ average_circumradius_length(const Vertex_handle& v) const
|
|||
{
|
||||
if (c->subdomain_index() != SI())
|
||||
{
|
||||
sum_len += CGAL::approximate_sqrt(sq_circumradius_length(c, v));
|
||||
sum_len += CGAL::approximate_sqrt(sq_circumradius_length(c, v, tr));
|
||||
++nb;
|
||||
}
|
||||
}
|
||||
|
|
@ -358,9 +276,9 @@ average_circumradius_length(const Vertex_handle& v) const
|
|||
// Use outside cells to compute size of point
|
||||
for (Cell_handle c : incident_cells)
|
||||
{
|
||||
if (!tr_.is_infinite(c))
|
||||
if (!tr.is_infinite(c))
|
||||
{
|
||||
sum_len += CGAL::approximate_sqrt(sq_circumradius_length(c, v));
|
||||
sum_len += CGAL::approximate_sqrt(sq_circumradius_length(c, v, tr));
|
||||
++nb;
|
||||
}
|
||||
}
|
||||
|
|
@ -375,6 +293,4 @@ average_circumradius_length(const Vertex_handle& v) const
|
|||
|
||||
} //namespace CGAL
|
||||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif // CGAL_TETRAHEDRAL_REMESHING_ADAPTIVE_SIZING_FIELD_H
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
public:
|
||||
template<typename Index>
|
||||
FT operator()(const Point_3& p, const int dim, const Index& i) const = 0;
|
||||
FT operator()(const Point_3& p, const int dim, const Index& i) const;
|
||||
};
|
||||
|
||||
}//end namespace Tetrahedral_remeshing
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@
|
|||
#include <CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h>
|
||||
#include <CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h>
|
||||
|
||||
#include <CGAL/Tetrahedral_remeshing/Adaptive_remeshing_sizing_field.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace CGAL
|
||||
|
|
@ -75,21 +73,6 @@ struct All_cells_selected
|
|||
{} //nothing to do : subdomain indices are updated in remeshing};
|
||||
};
|
||||
|
||||
template<typename SF, typename Tr>
|
||||
struct Update_sizing_field
|
||||
{
|
||||
void operator()(SF&, Tr&) const {};
|
||||
};
|
||||
template<typename Tr>
|
||||
struct Update_sizing_field<CGAL::Tetrahedral_remeshing::Adaptive_remeshing_sizing_field<Tr>, Tr>
|
||||
{
|
||||
void operator()(CGAL::Tetrahedral_remeshing::Adaptive_remeshing_sizing_field<Tr>& sf, Tr& tr) const
|
||||
{
|
||||
sf.set_triangulation(tr);
|
||||
sf.fill();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Triangulation
|
||||
, typename SizingFunction
|
||||
, typename EdgeIsConstrainedMap
|
||||
|
|
@ -118,7 +101,7 @@ class Adaptive_remesher
|
|||
|
||||
private:
|
||||
C3t3 m_c3t3;
|
||||
SizingFunction& m_sizing;
|
||||
const SizingFunction& m_sizing;
|
||||
const bool m_protect_boundaries;
|
||||
CellSelector m_cell_selector;
|
||||
Visitor& m_visitor;
|
||||
|
|
@ -129,7 +112,7 @@ private:
|
|||
|
||||
public:
|
||||
Adaptive_remesher(Triangulation& tr
|
||||
, SizingFunction& sizing
|
||||
, const SizingFunction& sizing
|
||||
, const bool protect_boundaries
|
||||
, EdgeIsConstrainedMap ecmap
|
||||
, FacetIsConstrainedMap fcmap
|
||||
|
|
@ -158,7 +141,7 @@ public:
|
|||
}
|
||||
|
||||
Adaptive_remesher(C3t3& c3t3
|
||||
, SizingFunction& sizing
|
||||
, const SizingFunction& sizing
|
||||
, const bool protect_boundaries
|
||||
, EdgeIsConstrainedMap ecmap
|
||||
, FacetIsConstrainedMap fcmap
|
||||
|
|
@ -191,12 +174,6 @@ public:
|
|||
return m_c3t3_pbackup != NULL;
|
||||
}
|
||||
|
||||
void update_adaptive_mode()
|
||||
{
|
||||
Update_sizing_field<SizingFunction, Tr> update;
|
||||
update(m_sizing, tr());
|
||||
}
|
||||
|
||||
void split()
|
||||
{
|
||||
CGAL_assertion(check_vertex_dimensions());
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
|
||||
|
||||
#include <CGAL/Tetrahedral_remeshing/Uniform_sizing_field.h>
|
||||
#include <CGAL/Tetrahedral_remeshing/Adaptive_remeshing_sizing_field.h>
|
||||
#include <CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h>
|
||||
#include <CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h>
|
||||
|
||||
|
|
@ -164,7 +163,7 @@ template<typename Traits, typename TDS, typename SLDS,
|
|||
typename NamedParameters = parameters::Default_named_parameters>
|
||||
void tetrahedral_isotropic_remeshing(
|
||||
CGAL::Triangulation_3<Traits, TDS, SLDS>& tr,
|
||||
double target_edge_length,
|
||||
const double target_edge_length,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
typedef CGAL::Triangulation_3<Traits, TDS, SLDS> Triangulation;
|
||||
|
|
@ -181,7 +180,7 @@ template<typename Traits, typename TDS, typename SLDS,
|
|||
typename NamedParameters = parameters::Default_named_parameters>
|
||||
void tetrahedral_isotropic_remeshing(
|
||||
CGAL::Triangulation_3<Traits, TDS, SLDS>& tr,
|
||||
float target_edge_length,
|
||||
const float target_edge_length,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
typedef CGAL::Triangulation_3<Traits, TDS, SLDS> Triangulation;
|
||||
|
|
@ -199,7 +198,7 @@ template<typename Traits, typename TDS, typename SLDS,
|
|||
typename NamedParameters>
|
||||
void tetrahedral_isotropic_remeshing(
|
||||
CGAL::Triangulation_3<Traits, TDS, SLDS>& tr,
|
||||
SizingFunction& sizing,
|
||||
const SizingFunction& sizing,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
CGAL_assertion(tr.is_valid());
|
||||
|
|
@ -255,10 +254,6 @@ void tetrahedral_isotropic_remeshing(
|
|||
, cell_select
|
||||
, visitor);
|
||||
|
||||
bool adaptive = choose_parameter(get_parameter(np, internal_np::adaptive_sizing_field), false);
|
||||
if(adaptive)
|
||||
remesher.update_adaptive_mode();
|
||||
|
||||
#ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE
|
||||
std::cout << "done." << std::endl;
|
||||
#endif
|
||||
|
|
@ -333,7 +328,7 @@ template<typename Tr,
|
|||
typename NamedParameters = parameters::Default_named_parameters>
|
||||
void tetrahedral_isotropic_remeshing(
|
||||
CGAL::Mesh_complex_3_in_triangulation_3<Tr, CornerIndex, CurveIndex>& c3t3,
|
||||
double target_edge_length,
|
||||
const double target_edge_length,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
using P = typename Tr::Geom_traits::Point_3;
|
||||
|
|
@ -351,7 +346,7 @@ template<typename Tr,
|
|||
typename NamedParameters = parameters::Default_named_parameters>
|
||||
void tetrahedral_isotropic_remeshing(
|
||||
CGAL::Mesh_complex_3_in_triangulation_3<Tr, CornerIndex, CurveIndex>& c3t3,
|
||||
float target_edge_length,
|
||||
const float target_edge_length,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
using P = typename Tr::Geom_traits::Point_3;
|
||||
|
|
@ -370,7 +365,7 @@ template<typename Tr,
|
|||
typename NamedParameters = parameters::Default_named_parameters>
|
||||
void tetrahedral_isotropic_remeshing(
|
||||
CGAL::Mesh_complex_3_in_triangulation_3<Tr, CornerIndex, CurveIndex>& c3t3,
|
||||
SizingFunction& sizing,
|
||||
const SizingFunction& sizing,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
CGAL_assertion(c3t3.triangulation().tds().is_valid());
|
||||
|
|
@ -431,10 +426,6 @@ void tetrahedral_isotropic_remeshing(
|
|||
cell_select, "statistics_begin.txt");
|
||||
#endif
|
||||
|
||||
bool adaptive = choose_parameter(get_parameter(np, internal_np::adaptive_sizing_field), false);
|
||||
if (adaptive)
|
||||
remesher.update_adaptive_mode();
|
||||
|
||||
// perform remeshing
|
||||
std::size_t nb_extra_iterations = 3;
|
||||
remesher.remesh(max_it, nb_extra_iterations);
|
||||
|
|
@ -452,32 +443,6 @@ void tetrahedral_isotropic_remeshing(
|
|||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup PkgTetrahedralRemeshingRef
|
||||
* remeshes a tetrahedral mesh with an adaptive si
|
||||
*/
|
||||
template<typename Traits, typename TDS, typename SLDS,
|
||||
typename NamedParameters = parameters::Default_named_parameters>
|
||||
void tetrahedral_adaptive_remeshing(
|
||||
CGAL::Triangulation_3<Traits, TDS, SLDS>& tr,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
using Tr = CGAL::Triangulation_3<Traits, TDS, SLDS>;
|
||||
CGAL::Tetrahedral_remeshing::Adaptive_remeshing_sizing_field<Tr> sizing(tr);
|
||||
tetrahedral_isotropic_remeshing(tr, sizing, np.adaptive_sizing_field(true));
|
||||
}
|
||||
|
||||
template<typename Tr,
|
||||
typename CornerIndex, typename CurveIndex,
|
||||
typename NamedParameters = parameters::Default_named_parameters>
|
||||
void tetrahedral_adaptive_remeshing(
|
||||
CGAL::Mesh_complex_3_in_triangulation_3<Tr, CornerIndex, CurveIndex>& c3t3,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
CGAL::Tetrahedral_remeshing::Adaptive_remeshing_sizing_field<Tr> sizing(c3t3.triangulation());
|
||||
tetrahedral_isotropic_remeshing(c3t3, sizing, np.adaptive_sizing_field(true));
|
||||
}
|
||||
|
||||
}//end namespace CGAL
|
||||
|
||||
#endif //TETRAHEDRAL_REMESHING_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue