mirror of https://github.com/CGAL/cgal
add surface_only() as a named parameter to make_mesh_3()
to completely skip the "refine_cells" part of Mesh_3
This commit is contained in:
parent
299a89f212
commit
3a94fcb68a
|
|
@ -54,7 +54,7 @@ int main()
|
|||
facet_distance(0.001));
|
||||
|
||||
// Mesh generation
|
||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, params::no_perturb().no_exude());
|
||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, params::surface_only());
|
||||
|
||||
// Output the facets of the c3t3 to an OFF file. The facets will not be
|
||||
// oriented.
|
||||
|
|
|
|||
|
|
@ -234,7 +234,8 @@ public:
|
|||
}
|
||||
|
||||
/// Launch mesh refinement
|
||||
double refine_mesh(std::string dump_after_refine_surface_prefix = "");
|
||||
double refine_mesh(std::string dump_after_refine_surface_prefix = "",
|
||||
const bool surface_only = false);
|
||||
|
||||
/// Debug
|
||||
std::string debug_info() const;
|
||||
|
|
@ -417,7 +418,7 @@ Mesher_3<C3T3,MC,MD>::Mesher_3(C3T3& c3t3,
|
|||
template<class C3T3, class MC, class MD>
|
||||
double
|
||||
Mesher_3<C3T3,MC,MD>::
|
||||
refine_mesh(std::string dump_after_refine_surface_prefix)
|
||||
refine_mesh(std::string dump_after_refine_surface_prefix, const bool surface_only)
|
||||
{
|
||||
CGAL::Real_timer timer;
|
||||
timer.start();
|
||||
|
|
@ -481,7 +482,12 @@ refine_mesh(std::string dump_after_refine_surface_prefix)
|
|||
|
||||
dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix);
|
||||
|
||||
if(!forced_stop())
|
||||
if(surface_only)
|
||||
{
|
||||
for(auto cit = r_tr.finite_cells_begin(); cit != r_tr.finite_cells_end(); ++cit)
|
||||
r_c3t3_.remove_from_complex(cit);
|
||||
}
|
||||
else if(!forced_stop())
|
||||
{
|
||||
// Then scan volume and refine it
|
||||
CGAL_MESH_3_TASK_BEGIN(scan_cells_task_handle);
|
||||
|
|
@ -575,42 +581,49 @@ refine_mesh(std::string dump_after_refine_surface_prefix)
|
|||
|
||||
facets_visitor_.activate();
|
||||
|
||||
std::cerr << "Start volume scan...";
|
||||
CGAL_MESH_3_TASK_BEGIN(scan_cells_task_handle);
|
||||
cells_mesher_.scan_triangulation();
|
||||
CGAL_MESH_3_TASK_END(scan_cells_task_handle);
|
||||
refinement_stage = REFINE_ALL;
|
||||
std::cerr << "end scan. [Bad tets:" << cells_mesher_.size() << "]";
|
||||
std::cerr << std::endl << std::endl;
|
||||
elapsed_time += timer.time();
|
||||
dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix);
|
||||
timer.stop(); timer.reset(); timer.start();
|
||||
|
||||
std::cerr << "Refining...\n";
|
||||
std::cerr << "Legend of the following line: "
|
||||
<< "(#vertices,#steps," << cells_mesher_.debug_info_header()
|
||||
<< ")\n";
|
||||
std::cerr << "(" << r_tr.number_of_vertices() << ","
|
||||
<< nbsteps << "," << cells_mesher_.debug_info() << ")";
|
||||
|
||||
CGAL_MESH_3_TASK_BEGIN(refine_volume_mesh_task_handle);
|
||||
while ( ! cells_mesher_.is_algorithm_done() &&
|
||||
! forced_stop() )
|
||||
if(surface_only)
|
||||
{
|
||||
cells_mesher_.one_step(cells_visitor_);
|
||||
std::cerr
|
||||
<< boost::format("\r \r"
|
||||
"(%1%,%2%,%3%) (%|4$.1f| vertices/s)")
|
||||
% r_tr.number_of_vertices()
|
||||
% nbsteps % cells_mesher_.debug_info()
|
||||
% (nbsteps / timer.time());
|
||||
++nbsteps;
|
||||
for(auto cit = r_tr.finite_cells_begin(); cit != r_tr.finite_cells_end(); ++cit)
|
||||
r_c3t3_.remove_from_complex(cit);
|
||||
}
|
||||
CGAL_MESH_3_TASK_END(refine_volume_mesh_task_handle);
|
||||
std::cerr << std::endl;
|
||||
else
|
||||
{
|
||||
std::cerr << "Start volume scan...";
|
||||
CGAL_MESH_3_TASK_BEGIN(scan_cells_task_handle);
|
||||
cells_mesher_.scan_triangulation();
|
||||
CGAL_MESH_3_TASK_END(scan_cells_task_handle);
|
||||
refinement_stage = REFINE_ALL;
|
||||
std::cerr << "end scan. [Bad tets:" << cells_mesher_.size() << "]";
|
||||
std::cerr << std::endl << std::endl;
|
||||
elapsed_time += timer.time();
|
||||
dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix);
|
||||
timer.stop(); timer.reset(); timer.start();
|
||||
|
||||
std::cerr << "Total refining volume time: " << timer.time() << "s" << std::endl;
|
||||
std::cerr << "Total refining time: " << timer.time()+elapsed_time << "s" << std::endl;
|
||||
std::cerr << "Refining...\n";
|
||||
std::cerr << "Legend of the following line: "
|
||||
<< "(#vertices,#steps," << cells_mesher_.debug_info_header()
|
||||
<< ")\n";
|
||||
std::cerr << "(" << r_tr.number_of_vertices() << ","
|
||||
<< nbsteps << "," << cells_mesher_.debug_info() << ")";
|
||||
|
||||
CGAL_MESH_3_TASK_BEGIN(refine_volume_mesh_task_handle);
|
||||
while ( ! cells_mesher_.is_algorithm_done() &&
|
||||
! forced_stop() )
|
||||
{
|
||||
cells_mesher_.one_step(cells_visitor_);
|
||||
std::cerr
|
||||
<< boost::format("\r \r"
|
||||
"(%1%,%2%,%3%) (%|4$.1f| vertices/s)")
|
||||
% r_tr.number_of_vertices()
|
||||
% nbsteps % cells_mesher_.debug_info()
|
||||
% (nbsteps / timer.time());
|
||||
++nbsteps;
|
||||
}
|
||||
CGAL_MESH_3_TASK_END(refine_volume_mesh_task_handle);
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Total refining volume time: " << timer.time() << "s" << std::endl;
|
||||
}
|
||||
std::cerr << "Total refining time: " << timer.time() + elapsed_time << "s" << std::endl;
|
||||
std::cerr << std::endl;
|
||||
|
||||
CGAL_postcondition(r_tr.is_valid());
|
||||
|
|
|
|||
|
|
@ -355,7 +355,8 @@ void refine_mesh_3_impl(C3T3& c3t3,
|
|||
, mesh_options.pointer_to_stop_atomic_boolean
|
||||
#endif
|
||||
);
|
||||
double refine_time = mesher.refine_mesh(mesh_options.dump_after_refine_surface_prefix);
|
||||
double refine_time = mesher.refine_mesh(mesh_options.dump_after_refine_surface_prefix,
|
||||
mesh_options.surface_only);
|
||||
c3t3.clear_manifold_info();
|
||||
|
||||
dump_c3t3(c3t3, mesh_options.dump_after_refine_prefix);
|
||||
|
|
@ -387,7 +388,7 @@ void refine_mesh_3_impl(C3T3& c3t3,
|
|||
}
|
||||
|
||||
// Perturbation
|
||||
if ( perturb )
|
||||
if ( perturb && !mesh_options.surface_only )
|
||||
{
|
||||
double perturb_time_limit = refine_time;
|
||||
|
||||
|
|
@ -403,7 +404,7 @@ void refine_mesh_3_impl(C3T3& c3t3,
|
|||
}
|
||||
|
||||
// Exudation
|
||||
if ( exude )
|
||||
if ( exude && !mesh_options.surface_only )
|
||||
{
|
||||
double exude_time_limit = refine_time;
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ struct Mesh_3_options {
|
|||
, dump_after_exude_prefix()
|
||||
, number_of_initial_points(-1)
|
||||
, nonlinear_growth_of_balls(nonlinear)
|
||||
, surface_only(false)
|
||||
, maximal_number_of_vertices(0)
|
||||
, pointer_to_error_code(0)
|
||||
#ifndef CGAL_NO_ATOMIC
|
||||
|
|
@ -157,6 +158,7 @@ struct Mesh_3_options {
|
|||
std::string dump_after_exude_prefix;
|
||||
int number_of_initial_points;
|
||||
bool nonlinear_growth_of_balls;
|
||||
bool surface_only;
|
||||
std::size_t maximal_number_of_vertices;
|
||||
Mesh_error_code* pointer_to_error_code;
|
||||
#ifndef CGAL_NO_ATOMIC
|
||||
|
|
|
|||
|
|
@ -368,3 +368,16 @@ features(const MeshDomain& /*domain*/)
|
|||
typedef Named_function_parameters<::CGAL::parameters::internal::Features_options, ::CGAL::internal_np::features_option_param_t, CGAL_NP_BASE> Param;
|
||||
return CGAL_NP_BUILD(Param,Generator()());
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
// Surface only (replacing Surface_mesher)
|
||||
// -----------------------------------
|
||||
inline Named_function_parameters<::CGAL::parameters::internal::Mesh_3_options, ::CGAL::internal_np::mesh_param_t, CGAL_NP_BASE>
|
||||
surface_only()
|
||||
{
|
||||
typedef Named_function_parameters<::CGAL::parameters::internal::Mesh_3_options, ::CGAL::internal_np::mesh_param_t, CGAL_NP_BASE> Param;
|
||||
::CGAL::parameters::internal::Mesh_3_options options;
|
||||
|
||||
options.surface_only = true;
|
||||
return CGAL_NP_BUILD(Param, options);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue