From 358e54447b5cb29faaedf70a2ff7a1a80da32c4e Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 12 Nov 2001 10:26:34 +0000 Subject: [PATCH] ReplaceAll -> separe en 3 --- Geo/CAD.cpp | 45 ++++++++++++++++++++++++++++++--------------- Geo/CAD.h | 1 - Parser/Gmsh.tab.cpp | 4 ++-- Parser/Gmsh.y | 4 ++-- Parser/Gmsh.yy.cpp | 4 ++-- 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp index 1a1160ce98..86e152bfd7 100644 --- a/Geo/CAD.cpp +++ b/Geo/CAD.cpp @@ -1,4 +1,4 @@ -// $Id: CAD.cpp,v 1.35 2001-11-12 08:21:17 geuzaine Exp $ +// $Id: CAD.cpp,v 1.36 2001-11-12 10:26:33 geuzaine Exp $ #include "Gmsh.h" #include "Numeric.h" @@ -1318,17 +1318,12 @@ void MaxNumSurface(void *a, void *b){ THEM->MaxSurfaceNum = MAX(THEM->MaxSurfaceNum,s->Num); } -void Coherence_PS(void){ - ReplaceAllDuplicates (THEM); -} - -void ReplaceAllDuplicates ( Mesh *m ){ +void ReplaceDuplicatePoints (Mesh *m){ List_T *All; Tree_T *allNonDulpicatedPoints; Vertex *v; - Curve *c,*c2; + Curve *c; Surface *s; - Volume *vol; int i,j,start,end; List_T *points2delete = List_Create(100,100,sizeof(Vertex*)); @@ -1347,7 +1342,7 @@ void ReplaceAllDuplicates ( Mesh *m ){ else{ Tree_Suppress(m->Points,&v); Tree_Suppress(m->Vertices,&v); - // List_Add(points2delete,&v); + // List_Add(points2delete,&v); } } @@ -1392,6 +1387,19 @@ void ReplaceAllDuplicates ( Mesh *m ){ List_Delete(All); + for(int k = 0; k < List_Nbr(points2delete);k++){ + List_Read(points2delete,i,&v); + Free_Vertex(&v,0); + } + +} + +void ReplaceDuplicateCurves (Mesh *m){ + List_T *All; + Curve *c,*c2; + Surface *s; + int i,j,start,end; + /* Create unique curves */ All = Tree2List(m->Curves); @@ -1445,6 +1453,14 @@ void ReplaceAllDuplicates ( Mesh *m ){ } } +} + +void ReplaceDuplicateSurfaces (Mesh *m){ + List_T *All; + Surface *s; + Volume *vol; + int i,j,start,end; + /* Create unique surfaces */ start = List_Nbr(All); @@ -1485,13 +1501,12 @@ void ReplaceAllDuplicates ( Mesh *m ){ } } - for(int k = 0; k < List_Nbr(points2delete);k++) - { - List_Read(points2delete,i,&v); - Free_Vertex(&v,0); - } - +} +void ReplaceAllDuplicates (Mesh *m){ + ReplaceDuplicatePoints(m); + ReplaceDuplicateCurves(m); + ReplaceDuplicateSurfaces(m); } /* NEW CAD FUNCTIONS */ diff --git a/Geo/CAD.h b/Geo/CAD.h index 81bd3be58a..5978d69991 100644 --- a/Geo/CAD.h +++ b/Geo/CAD.h @@ -42,7 +42,6 @@ void Extrude_ProtudeSurface(int type, int is, int NewVolume, ExtrudeParams *e); void ProtudeXYZ ( double &x, double &y, double &z, ExtrudeParams *e); void ReplaceAllDuplicates ( Mesh *m ); -void Coherence_PS(void); bool IntersectAllSegmentsTogether(void); void ModifyLcPoint(int ip, double lc); diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index c49877a863..d094f07cd5 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -177,7 +177,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.123 2001-11-12 08:21:17 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.124 2001-11-12 10:26:33 geuzaine Exp $ #include <stdarg.h> #ifndef _NOPLUGIN @@ -5349,7 +5349,7 @@ case 257: case 258: #line 2114 "Gmsh.y" { - Coherence_PS(); + ReplaceAllDuplicates(THEM); ; break;} case 259: diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index 1a8335e6c0..a491fa66d7 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,6 +1,6 @@ %{ -// $Id: Gmsh.y,v 1.108 2001-11-12 08:21:18 geuzaine Exp $ +// $Id: Gmsh.y,v 1.109 2001-11-12 10:26:33 geuzaine Exp $ #include <stdarg.h> #ifndef _NOPLUGIN @@ -2112,7 +2112,7 @@ Transfini : Coherence : tCoherence tEND { - Coherence_PS(); + ReplaceAllDuplicates(THEM); } | tIntersect tEND { diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index 9d591f8621..12ddd7d6be 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -2,7 +2,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.123 2001-11-12 08:21:18 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.124 2001-11-12 10:26:34 geuzaine Exp $ */ #define FLEX_SCANNER @@ -1000,7 +1000,7 @@ char *yytext; #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.123 2001-11-12 08:21:18 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.124 2001-11-12 10:26:34 geuzaine Exp $ #include <stdio.h> #include <stdlib.h> -- GitLab