Skip to content
Snippets Groups Projects
Commit c70d714a authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

workaround for Read_Mesh limitation when reading discrete closed
curves (missing last vertex due to List_Insert...)
parent ed177454
No related branches found
No related tags found
No related merge requests found
// $Id: GeoUtils.cpp,v 1.8 2006-01-06 00:34:24 geuzaine Exp $ // $Id: GeoUtils.cpp,v 1.9 2006-03-29 01:45:13 geuzaine Exp $
// //
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// //
...@@ -41,8 +41,22 @@ void sortEdgesInLoop(int num, List_T *edges) ...@@ -41,8 +41,22 @@ void sortEdgesInLoop(int num, List_T *edges)
for(int i = 0; i < nbEdges; i++) { for(int i = 0; i < nbEdges; i++) {
int j; int j;
List_Read(edges, i, &j); List_Read(edges, i, &j);
if((c = FindCurve(j, THEM))) if((c = FindCurve(j, THEM))){
List_Add(temp, &c); List_Add(temp, &c);
// FIXME: if the loop is composed of a single curve and if the
// curve is already discretized, we check if the first vertex
// and the last vertex are the same. If not, we assume that they
// should, and we add the missing end vertex. (This situation
// can arise due to a limitation in Read_Mesh, where we do a
// List_Insert() to add the vertices in discrete curves--so that
// we never get the last vertex for single, closed curves.)
if(nbEdges == 1 && List_Nbr(c->Vertices) && c->Typ == MSH_SEGM_DISCRETE){
Vertex *first = *(Vertex**)List_Pointer(c->Vertices, 0);
Vertex *last = *(Vertex**)List_Pointer(c->Vertices, List_Nbr(c->Vertices) - 1);
if(first != last)
List_Add(c->Vertices, &first);
}
}
else else
Msg(GERROR, "Unknown curve %d in line loop %d", j, num); Msg(GERROR, "Unknown curve %d in line loop %d", j, num);
} }
......
// $Id: Read_Mesh.cpp,v 1.101 2006-03-24 21:37:14 geuzaine Exp $ // $Id: Read_Mesh.cpp,v 1.102 2006-03-29 01:45:13 geuzaine Exp $
// //
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// //
...@@ -432,7 +432,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp) ...@@ -432,7 +432,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp)
else{ else{
// this can be quite slow if there are many nodes on the curve... // this can be quite slow if there are many nodes on the curve...
for(i = 0; i < Nbr_Nodes; i++) for(i = 0; i < Nbr_Nodes; i++)
List_Insert(c->Vertices, &vertsp[i], fcmp_int); List_Insert(c->Vertices, &vertsp[i], compareVertex);
} }
break; break;
case TRI1: case TRI1:
......
$Id: TODO,v 1.4 2006-03-25 14:34:27 geuzaine Exp $ $Id: TODO,v 1.5 2006-03-29 01:45:13 geuzaine Exp $
******************************************************************** ********************************************************************
...@@ -6,13 +6,6 @@ add support for off-screen rendering using OSMesa ...@@ -6,13 +6,6 @@ add support for off-screen rendering using OSMesa
******************************************************************** ********************************************************************
if we try to mesh a surface from a single discrete curve mesh read
from a .msh file we get a "non contour" error in Mesh_2D (since we
List_Insert the vertices in c->Vertices, thus never having
last==first)
********************************************************************
add a min_recursion option for adaptve views (to force at least a add a min_recursion option for adaptve views (to force at least a
certain number of subdivisions) certain number of subdivisions)
......
...@@ -232,7 +232,7 @@ thumbnail"></a> ...@@ -232,7 +232,7 @@ thumbnail"></a>
(P. Geuzaine). (P. Geuzaine).
<li>Log-periodic antenna in the demo files: <li>Log-periodic antenna in the demo files:
<a href="/gmsh/gallery/antenna.gif">pict1</a>. <a href="/gmsh/gallery/antenna.gif">pict1</a>.
<li>Breads: <li>Braids:
<a href="/gmsh/gallery/tresse1.gif">pict1</a>, <a href="/gmsh/gallery/tresse1.gif">pict1</a>,
<a href="/gmsh/gallery/tresse2.gif">pict2</a> <a href="/gmsh/gallery/tresse2.gif">pict2</a>
(D. Colignon). (D. Colignon).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment