Skip to content

Commit

Permalink
Periodic_3_mesh_3: Avoid Making Copies (CGAL#8639)
Browse files Browse the repository at this point in the history
## Summary of Changes

Turn several copies into `const&` to avoid allocation of data members of
traits object with multiprecision coordinates. In release mode the gain
is around 10%..

To address the timeouts in the testsuite in Debug mode, I also changed
cell size and approximation error.

## Release Management

* Affected package(s): Periodic_triangulation_3_mesh_3
* License and copyright ownership: unchanged
  • Loading branch information
sloriot authored Dec 10, 2024
2 parents c9b7c3b + e977578 commit 166681a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Mesh_3/include/CGAL/Mesh_3/min_dihedral_angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ minimum_dihedral_angle(
const typename K::Point_3& p1,
const typename K::Point_3& p2,
const typename K::Point_3& p3,
K k = K())
const K& k = K())
{
typedef typename K::FT FT;

Expand Down Expand Up @@ -84,7 +84,7 @@ minimum_dihedral_angle(
const typename K::Point_3& p1,
const typename K::Point_3& p2,
const typename K::Point_3& p3,
K k = K())
const K& k = K())
{
typedef typename K::FT FT;

Expand Down Expand Up @@ -139,7 +139,7 @@ minimum_dihedral_angle(

template <typename K>
typename K::FT
minimum_dihedral_angle(const typename K::Tetrahedron_3& t, K k = K() )
minimum_dihedral_angle(const typename K::Tetrahedron_3& t , const K& k = K())
{
return minimum_dihedral_angle(t[0],t[1],t[2],t[3],k);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,19 @@ C3t3 make_mesh(const Labeling_function& labeling_function, const Iso_cuboid& can
{
Periodic_mesh_domain domain(labeling_function, canonical_cube);

#ifdef CGAL_NDEBUG
Periodic_mesh_criteria criteria(facet_angle = 30.,
facet_size = 0.03 * 2 /*domain's edge length*/,
facet_distance = 0.03 * 2 /*domain's edge length*/,
cell_radius_edge_ratio = 2.,
cell_size = 0.05);
#else
Periodic_mesh_criteria criteria(facet_angle = 30.,
facet_size = 0.1 * 2 /*domain's edge length*/,
facet_distance = 0.1 * 2 /*domain's edge length*/,
cell_radius_edge_ratio = 2.,
cell_size = 0.1);
#endif

return CGAL::make_periodic_3_mesh_3<C3t3>(domain, criteria);
}
Expand Down Expand Up @@ -313,7 +321,6 @@ int main(int, char**)
std::cout << std::endl;
}
}

std::cout << "EXIT SUCCESS" << std::endl;
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ class Periodic_3_regular_triangulation_3
typedef CGAL::Periodic_3_regular_triangulation_remove_traits_3< Gt > P3removeT;
typedef CGAL::Regular_triangulation_3< P3removeT > Euclidean_triangulation;
typedef Vertex_remover< Euclidean_triangulation > Remover;
P3removeT remove_traits(domain());
P3removeT remove_traits(geom_traits());
Euclidean_triangulation tmp(remove_traits);
Remover remover(this, tmp);
Conflict_tester ct(this);
Expand Down Expand Up @@ -576,7 +576,7 @@ class Periodic_3_regular_triangulation_3
typedef CGAL::Regular_triangulation_3< P3removeT > Euclidean_triangulation;
typedef Vertex_remover< Euclidean_triangulation > Remover;

P3removeT remove_traits(domain());
P3removeT remove_traits(geom_traits());
Euclidean_triangulation tmp(remove_traits);
Remover remover(this, tmp);
Cover_manager cover_manager(*this);
Expand Down

0 comments on commit 166681a

Please sign in to comment.