Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 2D Mesh generation and triangles at boundaries.

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 2D Mesh generation and triangles at boundaries.


Chronological Thread 
  • From: José <>
  • To:
  • Subject: Re: [cgal-discuss] 2D Mesh generation and triangles at boundaries.
  • Date: Tue, 15 Dec 2009 01:34:52 -0800 (PST)


Hi Panagiotis,

Thanks for your reply.

The problem I see is that the size criterion is constant for the whole
domain. Am I wrong? To solve this I create a first triangulation using the
bigger size that I can use delta_x.

Vertex_handle va = cdt.insert(Point(x_ini,y_ini));
Vertex_handle vb = cdt.insert(Point(x_out,y_ini));
Vertex_handle vc = cdt.insert(Point(x_out,y_out));
Vertex_handle vd = cdt.insert(Point(x_ini,y_out));

cdt.insert_constraint(va, vb);
cdt.insert_constraint(vb, vc);
cdt.insert_constraint(vc, vd);
cdt.insert_constraint(vd, va);

CGAL::refine_Delaunay_mesh_2(cdt, Criteria(0.125,delta_x));

Then I do an iterative process until the size of every triangle is as
desired. I include all the vertex in a list (PuntosATriangular),

std::list <Point> PuntosATriangular;
for (CDT::Vertex_iterator vit=cdt.vertices_begin();
vit!=cdt.vertices_end();vit++){
PuntosATriangular.push_front(vit->point());
counter2++;
}

I compute the size of every triangle and compare it with the required size
for this triangle (the size of the triangle depends on the triangle’s
location). When the triangle is bigger than required, I include the centroid
of the triangle to the list (PuntosATriangular) , insert the list into cdt
and refine the mesh,

CGAL::refine_Delaunay_mesh_2(cdt,Criteria(0.125,delta_x));

After your email I have defined typedef CGAL::Delaunay_mesher_2<CDT,
Criteria> Mesher; and replaced

CGAL::refine_Delaunay_mesh_2(cdt, Criteria(0.125,delta_x));

By

mesher.set_criteria(Criteria(0.125,delta_x));
mesher.refine_mesh();

Thanks again.

José.


Panagiotis Foteinos wrote:
>
> A (huge) correction regarding the size of the triangles: since you want
> your
> algorithm to terminate, you should only insert the circumcenter of big
> triangles. However, this circumcenter may lie outside your domain (the so
> called encroachment); therefore, you have to split some boundary segments
> too (at their midpoint).
>
> A much easier way is to use CGAL's Mesher, and define your own size
> criterion. Sorry for my mistake...
>
>
> On Tue, Dec 15, 2009 at 3:23 AM, Panagiotis Foteinos
> <>wrote:
>
>> Since nobody has replied to you yet, I feel compelled to write to you...
>> :)
>>
>> The most common way of splitting triangles you do not want is by
>> inserting
>> their circumcenter. For your purposes, however, any point inside the
>> circumdisk of a bad triangle would do the trick.
>>
>> I did not understand what you are doing exactly with this list of points
>> you are saying... Are you using your own list? If yes, you shouldn't:
>> CGAL
>> has its own flexible data structures. By traversing these structures, you
>> are able to extract the vertices, edges, or triangles of the
>> triangulation.
>>
>> When it comes to the boundaries: if you do not use interior constrained
>> segments, then make the input segments of the boundaries (that are
>> initially
>> known, this is your domain) constrained. CGAL offers an easy way to
>> identify
>> which edge is constrained or not, while you are traversing the triangles
>> of
>> the triangulation (for printing the mesh out). If you use interior
>> constrained segments, a common way to identify the boundary edges is by
>> employing flooding techniques (again you will mark the input segments as
>> constrained). You may want to add "Colors" in this case, which will
>> denote
>> which edge is on the boundary or not.
>>
>> The manual has everything you need...
>>
>> Regards,
>> Panagiotis
>>
>>
>> On Fri, Dec 11, 2009 at 10:58 AM, José
>> <>
>> wrote:
>>
>>>
>>> Hi,
>>>
>>> I have just started to use CGAL for mesh generation in my Computational
>>> Fluid Dynamics (CFD) case. I need to generate a triangular mesh for a
>>> depth
>>> integrated equation, so the size of the triangles depends on the local
>>> depth. To solve this problem I generate a initial mesh
>>> (Constrained_Delaunay_triangulation_2) using big triangles and I include
>>> all
>>> the vertex of the triangulation into a list of points. Then I check the
>>> size
>>> of each triangle and when the size is bigger than required, I include
>>> the
>>> centroid of the triangle to the list and generate a new triangulation
>>> using
>>> the points in the list. I continue this iterative process until the
>>> sizes
>>> of
>>> all triangles fit the requirement. Can anyone suggest a better method to
>>> do
>>> so?
>>>
>>> Once the mesh is generated I have to write into a file the nodes and
>>> faces
>>> of the triangulation which I have already solved. I have to write also
>>> the
>>> segments of the triangles that are at the boundaries. The case I'm
>>> working
>>> on is quite easy (rectangular domain) and I have solved it using the
>>> line_walk method applied to the 4 lines defining my domain. I am afraid
>>> that
>>> this won't work with a more complicate domain... :) Does anyone knows a
>>> more
>>> general method?
>>>
>>> Thanks a lot!!!
>>>
>>> José.
>>>
>>> --
>>> View this message in context:
>>> http://n4.nabble.com/2D-Mesh-generation-and-triangles-at-boundaries-tp961174p961174.html
>>> Sent from the cgal-discuss mailing list archive at Nabble.com.
>>>
>>> --
>>> You are currently subscribed to cgal-discuss.
>>> To unsubscribe or access the archives, go to
>>> https://lists-sop.inria.fr/wws/info/cgal-discuss
>>>
>>>
>>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>
>

--
View this message in context:
http://n4.nabble.com/2D-Mesh-generation-and-triangles-at-boundaries-tp961174p964151.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page