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

small fixes so we can mix discrete curves with regular curves and mesh
mixed surfaces
parent 533189a7
No related branches found
No related tags found
No related merge requests found
// $Id: GeoUtils.cpp,v 1.10 2006-03-29 14:33:51 geuzaine Exp $ // $Id: GeoUtils.cpp,v 1.11 2006-04-16 02:42:23 geuzaine Exp $
// //
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// //
...@@ -50,7 +50,7 @@ void sortEdgesInLoop(int num, List_T *edges) ...@@ -50,7 +50,7 @@ void sortEdgesInLoop(int num, List_T *edges)
// can arise due to a limitation in Read_Mesh, where we do a // can arise due to a limitation in Read_Mesh, where we do a
// List_Insert() to add the vertices in discrete curves--so that // List_Insert() to add the vertices in discrete curves--so that
// we never get the last vertex for single, closed curves.) // we never get the last vertex for single, closed curves.)
if(nbEdges == 1 && List_Nbr(c->Vertices) && c->Typ == MSH_SEGM_DISCRETE){ if(c->Typ == MSH_SEGM_DISCRETE && nbEdges == 1 && List_Nbr(c->Vertices)){
Vertex *first = *(Vertex**)List_Pointer(c->Vertices, 0); Vertex *first = *(Vertex**)List_Pointer(c->Vertices, 0);
Vertex *last = *(Vertex**)List_Pointer(c->Vertices, List_Nbr(c->Vertices) - 1); Vertex *last = *(Vertex**)List_Pointer(c->Vertices, List_Nbr(c->Vertices) - 1);
if(first != last){ if(first != last){
...@@ -58,12 +58,20 @@ void sortEdgesInLoop(int num, List_T *edges) ...@@ -58,12 +58,20 @@ void sortEdgesInLoop(int num, List_T *edges)
List_Add(c->Vertices, &first); List_Add(c->Vertices, &first);
} }
} }
// setting end points for discrete curves
if(c->Typ == MSH_SEGM_DISCRETE && !c->beg && !c->end && List_Nbr(c->Vertices)){
Vertex *first = *(Vertex**)List_Pointer(c->Vertices, 0);
Vertex *last = *(Vertex**)List_Pointer(c->Vertices, List_Nbr(c->Vertices) - 1);
c->beg = FindPoint(first->Num, THEM);
c->end = FindPoint(last->Num, THEM);
}
} }
else else
Msg(GERROR, "Unknown curve %d in line loop %d", j, num); Msg(GERROR, "Unknown curve %d in line loop %d", j, num);
} }
List_Reset(edges); List_Reset(edges);
int j = 0, k = 0; int j = 0, k = 0;
c0 = c1 = *(Curve **) List_Pointer(temp, 0); c0 = c1 = *(Curve **) List_Pointer(temp, 0);
List_Add(edges, &c1->Num); List_Add(edges, &c1->Num);
......
// $Id: 2D_Mesh.cpp,v 1.81 2006-01-29 22:53:41 geuzaine Exp $ // $Id: 2D_Mesh.cpp,v 1.82 2006-04-16 02:42:23 geuzaine Exp $
// //
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// //
...@@ -109,6 +109,10 @@ int Calcule_Contours(Surface * s) ...@@ -109,6 +109,10 @@ int Calcule_Contours(Surface * s)
l = List_Create(10, 10, sizeof(Vertex *)); l = List_Create(10, 10, sizeof(Vertex *));
for(i = 0; i < List_Nbr(s->Generatrices); i++) { for(i = 0; i < List_Nbr(s->Generatrices); i++) {
List_Read(s->Generatrices, i, &c); List_Read(s->Generatrices, i, &c);
if(!List_Nbr(c->Vertices)) {
Msg(GERROR, "Curve %d has no mesh", c->Num);
return 0;
}
if(!List_Nbr(l)) { if(!List_Nbr(l)) {
List_Read(c->Vertices, 0, &first); List_Read(c->Vertices, 0, &first);
} }
......
Merge "1d_with_points.msh";
//Merge "1d_without_points.msh";
Delete Physicals;
Status 0; // to force remeshing of non-discrete curves
cl=0.0999;
//Point(1) = {0, 0, 0, cl};
Point(2) = {0, 1, 0, cl};
Point(3) = {1, 1, 0, cl};
//Point(4) = {1, 0, 0, cl};
Line(1)={1,2};
Line(2)={2,3};
Line(3)={3,4};
Line Loop(1) = {1,2,3,4};
Plane Surface(1) = {1};
$NOD
3
1 0 0 0
4 1 0 0
5 0.5 0 0
$ENDNOD
$ELM
4
1 15 1 1 1 1
4 15 4 4 1 4
10 1 4 4 2 4 5
11 1 4 4 2 5 1
$ENDELM
$NOD
3
1 0 0 0
4 1 0 0
5 0.5 0 0
$ENDNOD
$ELM
2
10 1 4 4 2 4 5
11 1 4 4 2 5 1
$ENDELM
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment