Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features
Chronological Thread
- From: Michel Audette <>
- To:
- Subject: Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features
- Date: Fri, 10 Jun 2011 17:20:31 -0400
Hi Laurent,
I'm seeing the following error, with a number of different choices for mesh size...
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: sq_d > 0
File: /usr/local/include/CGAL/Mesh_3/Protect_edges_sizing_field.h
Line: 416
Aborted
I've been using the following code... See below. So far, I'm trying to get a result with constant tet size, even though the surface mesh size has edges varying between about 10 and 40mm.
Is this a bug related to the new boundary faithfulness implementation or a consequence of a mismatched size objective?
Best wishes,
Michel
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkUnstructuredGrid.h"
#include "vtkSmartPointer.h"
#include "vtkUnstructuredGridWriter.h"
#ifndef CGAL_USE_VTK
# define CGAL_USE_VTK
#endif
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/make_mesh_3.h>
#include <CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h>
//#include <CGAL/refine_mesh_3.h>
// IO
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Implicit_mesh_domain_3.h>
#include <CGAL/Mesh_domain_with_polyline_features_3.h>
#include <CGAL/make_mesh_3.h>
// Kernel
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
// Domain
typedef K::FT FT;
typedef K::Point_3 Point;
typedef FT (Function)(const Point&);
// Polyline
typedef std::vector<Point> Polyline;
typedef std::list<Polyline> Polylines;
// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
//typedef CGAL::Mesh_domain_with_polyline_features_3<K> Mesh_domain_polylines;
// Triangulation
typedef CGAL::Mesh_triangulation_3< Mesh_domain >::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<
Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;
// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
// To avoid verbose function and named parameters call
using namespace CGAL::parameters;
int main( int argc, char ** argv )
{
// Verify the number of parameters in the command line
if( argc < 3)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputSurfaceFile.off outputTetFile.vtk " << std::endl;
return EXIT_FAILURE;
}
// Create input polyhedron
Polyhedron polyhedron;
std::ifstream input(argv[1]);
input >> polyhedron;
// Create domain
Mesh_domain domain(argv[1]);
// Get sharp features
// Create edge that we want to preserve
Polylines polylines (1);
Polyline& polyline = polylines.front();
//std::size_t np = polyhedron.sizeof_points();
Polyhedron::Point_iterator itr_p;
int i=0;
for(itr_p= polyhedron.points_begin(); itr_p!= polyhedron.points_end(); itr_p++ )
{
Point p = (*itr_p);
polyline.push_back(p);
std::cout << " pushback points i " << i++ << " p " << p << "\n";
}
polyline.push_back(polyline.front()); // close the line
// Insert edge in domain
domain.add_features(polylines.begin(), polylines.end());
// Mesh criteria
Mesh_criteria criteria(edge_size = 20.0,
facet_angle = 10, facet_size = 200, /*facet_distance = 25,*/
/*cell_radius_edge_ratio = 3,*/ cell_size = 8000);
// Mesh generation
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
vtkSmartPointer<vtkUnstructuredGrid>
outputUnstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
CGAL::output_c3t3_to_vtk_unstructured_grid(c3t3, outputUnstructuredGrid);
outputUnstructuredGrid->Squeeze();
vtkSmartPointer<vtkUnstructuredGridWriter> writer =
vtkSmartPointer<vtkUnstructuredGridWriter>::New();
writer->SetInput(outputUnstructuredGrid);
writer->SetFileName(argv[2]);
writer->Write();
return 0;
}
On Fri, Jun 10, 2011 at 1:16 PM, Michel Audette <> wrote:
> Hi Laurent,
>
> thanks for your prompt and descriptive response. I think that I've
> been lazy about tracking this one down. My apologies.
>
> Best wishes,
>
> Michel
>
>
> On Fri, Jun 10, 2011 at 1:10 PM, Laurent Rineau (GeometryFactory)
> <> wrote:
>> On vendredi 10 juin 2011 18:53:57 Michel Audette wrote:
>>> Dear CGAL developers,
>>>
>
>>
>> Dear Michel,
>>
>> In the documentation of of the class template
>> Polyhedral_mesh_domain_with_features_3 (see [1]), used in the fandisk example,
>> you can see the function
>>
>> domain.detect_features()
>>
>> But that class template also derives from the class template
>> Mesh_domain_with_polyline_features_3 (see [2]), and that means you can also
>> do:
>>
>> domain.add_features(polylines.begin(), polylines.end());
>>
>> like it is done in the implicit function example. I think that is what you
>> want. For a polyhedron domain, detect_features() is just a shortcut that
>> computes a set of polylines by detecting sharp edges of the polyhedron, and
>> then passes that set of polylines to add_feature(...).
>>
>> [1] http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Mesh_3_ref/Class_Polyhedral_mesh_domain_with_features_3.html
>> [2] http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Mesh_3_ref/Class_Mesh_domain_with_polyline_features_3.html
>>
>>> PS: I think that the output to vtk is working. I was able to visualize
>>> a result with Paraview.
>>
>> Great!
>>
>> --
>> Laurent Rineau, PhD
>> R&D Engineer at GeometryFactory http://www.geometryfactory.com/
>> Release Manager of the CGAL Project http://www.cgal.org/
>>
>> --
>> You are currently subscribed to cgal-discuss.
>> To unsubscribe or access the archives, go to
>> https://lists-sop.inria.fr/wws/info/cgal-discuss
>>
>>
>
>
>
> --
> Michel Audette, Ph.D.
> R & D Engineer,
> Kitware Inc.,
> Chapel Hill, N.C.
>
--
Michel Audette, Ph.D.
R & D Engineer,
Kitware Inc.,
Chapel Hill, N.C.
- [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/10/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Laurent Rineau (GeometryFactory), 06/10/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/10/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/10/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/12/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Laurent Rineau (GeometryFactory), 06/14/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/14/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/14/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Laurent Rineau (GeometryFactory), 06/15/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Laurent Rineau (GeometryFactory), 06/15/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/15/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/14/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/14/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/10/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Michel Audette, 06/10/2011
- Re: [cgal-discuss] meshing with hard feature boundary: using all edges as features, Laurent Rineau (GeometryFactory), 06/10/2011
Archive powered by MHonArc 2.6.16.