// Copyright (c) 2004-2009 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Laurent RINEAU, Stephane Tayeb #ifndef CGAL_MESH_CELL_CRITERIA_3_H #define CGAL_MESH_CELL_CRITERIA_3_H #include #include #include #include # include #include namespace CGAL { template > class Mesh_cell_criteria_3 { public: typedef Visitor_ Visitor; typedef typename Visitor::Cell_quality Cell_quality; typedef typename Visitor::Is_cell_bad Is_cell_bad; typedef Mesh_3::Abstract_criterion Abstract_criterion; private: typedef Mesh_3::Criteria Criteria; typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Geom_traits::FT FT; typedef Mesh_cell_criteria_3 Self; public: /** * @brief Constructor * @param radius_edge_bound the radius-edge bound * @param radius_bound the radius bound (tet sizing) */ Mesh_cell_criteria_3(const FT& radius_edge_bound, const FT& radius_bound, const FT& min_radius_bound = 0.) { if (FT(0) != min_radius_bound) init_min_radius(min_radius_bound); if ( FT(0) != radius_bound ) init_radius(radius_bound); if ( FT(0) != radius_edge_bound ) init_radius_edge(radius_edge_bound); } // Nb: SFINAE to avoid wrong matches with built-in numerical types // as int. template Mesh_cell_criteria_3(const FT& radius_edge_bound, const Sizing_field& radius_bound, const FT& min_radius_bound = 0., std::enable_if_t< Mesh_3::Is_mesh_domain_field_3::value >* = 0 ) { if (FT(0) != min_radius_bound) init_min_radius(min_radius_bound); init_radius(radius_bound); if ( FT(0) != radius_edge_bound ) init_radius_edge(radius_edge_bound); } /// Destructor ~Mesh_cell_criteria_3() { } /** * @brief returns whether the cell `cell` is bad or not. * @param tr the triangulation within which `cell` lives * @param cell the cell */ Is_cell_bad operator()(const Tr& tr, const Cell_handle& cell) const { return criteria_(tr, cell); } void add(Abstract_criterion* criterion) { criteria_.add(criterion); } private: void init_radius_edge(const FT& radius_edge_bound) { typedef Mesh_3::Cell_radius_edge_criterion Radius_edge_criterion; criteria_.add(new Radius_edge_criterion(radius_edge_bound)); } void init_radius(const FT& radius_bound) { typedef Mesh_3::Cell_uniform_size_criterion Radius_criterion; criteria_.add(new Radius_criterion(radius_bound)); } template < typename Sizing_field> void init_radius(const Sizing_field& radius_bound) { typedef Mesh_3::Cell_variable_size_criterion Radius_criterion; criteria_.add(new Radius_criterion(radius_bound)); } void init_min_radius(const FT& min_radius_bound) { typedef Mesh_3::Cell_uniform_size_criterion Radius_criterion; criteria_.add(new Radius_criterion(min_radius_bound, true/*lower bound*/)); } private: Criteria criteria_; }; // end class Mesh_cell_criteria_3 } // end namespace CGAL #endif // CGAL_MESH_CELL_CRITERIA_3_H