diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp index bb7b2a76fc247b7cff299e79d9a3e8698a911e34..bd7f9b6a65dbb9253d7b90f29b6d43758e7f6ba1 100644 --- a/Geo/CAD.cpp +++ b/Geo/CAD.cpp @@ -1,4 +1,4 @@ -// $Id: CAD.cpp,v 1.16 2001-01-17 21:26:24 remacle Exp $ +// $Id: CAD.cpp,v 1.17 2001-02-23 00:07:51 remacle Exp $ #include "Gmsh.h" #include "Geo.h" @@ -116,7 +116,7 @@ int NEWPOINT(void){ return MAXPOINT+1; } -Vertex *FindVertex(int inum, Mesh *M){ +Vertex *FindPoint(int inum, Mesh *M){ Vertex C,*pc; pc = &C; pc->Num = inum; @@ -126,6 +126,16 @@ Vertex *FindVertex(int inum, Mesh *M){ return NULL; } +Vertex *FindVertex(int inum, Mesh *M){ + Vertex C,*pc; + pc = &C; + pc->Num = inum; + if(Tree_Query(M->Vertices,&pc)){ + return pc; + } + return NULL; +} + Curve *FindCurve(int inum, Mesh *M){ @@ -1382,12 +1392,12 @@ void ReplaceAllDuplicates ( Mesh *m ){ /* NEW CAD FUNCTIONS */ void ModifyLcPoint(int ip, double lc){ - Vertex *v = FindVertex(ip,THEM); + Vertex *v = FindPoint(ip,THEM); if(v)v->lc = lc; } void ApplicationOnPoint(int ip,double matrix[4][4]){ - Vertex *v = FindVertex(ip,THEM); + Vertex *v = FindPoint(ip,THEM); if(v)ApplyTransformationToPoint ( matrix, v ); } @@ -1485,7 +1495,7 @@ void CopyShape(int Type, int Num, int *New){ switch(Type){ case MSH_POINT: - if(!(v = FindVertex(Num,THEM))) + if(!(v = FindPoint(Num,THEM))) Msg(FATAL, "Unknown Vertex %d", Num); newv = DuplicateVertex(v); *New = newv->Num; @@ -1516,7 +1526,7 @@ void CopyShape(int Type, int Num, int *New){ } void DeletePoint(int ip){ - Vertex *v = FindVertex(ip,THEM); + Vertex *v = FindPoint(ip,THEM); if(!v) return; List_T *Curves = Tree2List(THEM->Curves); for(int i=0;i<List_Nbr(Curves);i++){ diff --git a/Geo/CAD.h b/Geo/CAD.h index a8885c56e3b3afb378e121fc10c17be08bc52344..05ec3e9bf48f18b719624a23c110fe832db7e12f 100644 --- a/Geo/CAD.h +++ b/Geo/CAD.h @@ -6,6 +6,7 @@ int NEWREG(void); int NEWPOINT(void); +Vertex *FindPoint(int inum, Mesh *M); Vertex *FindVertex(int inum, Mesh *M); Curve *FindCurve(int inum, Mesh *M); Surface *FindSurface(int inum, Mesh *M); diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index d12e08d59cf624ffddb1d48882ee8469038fc7fe..7952f33ab38742e3d63d390baf3e4c04e38514e9 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.15 2001-01-29 08:43:44 geuzaine Exp $ +// $Id: Geom.cpp,v 1.16 2001-02-23 00:07:51 remacle Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -104,14 +104,29 @@ void Draw_Curve (void *a, void *b){ N = List_Nbr(c->Control_Points); else N = 50; - - glBegin(GL_LINE_STRIP); - for(i=0;i<N;i++){ - v = InterpolateCurve(c,(double)i/(double)(N-1),0); - glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z); - } - glEnd(); - + if(c->Typ == MSH_SEGM_DISCRETE) + { + Simplex *s; + List_T *temp = Tree2List(c->Simplexes); + for(i=0;i<List_Nbr(temp);i++) + { + List_Read(temp,i,&s); + glBegin(GL_LINE_STRIP); + glVertex3d(s->V[0]->Pos.X,s->V[0]->Pos.Y,s->V[0]->Pos.Z); + glVertex3d(s->V[1]->Pos.X,s->V[1]->Pos.Y,s->V[1]->Pos.Z); + glEnd(); + } + List_Delete(temp); + } + else + { + glBegin(GL_LINE_STRIP); + for(i=0;i<N;i++){ + v = InterpolateCurve(c,(double)i/(double)(N-1),0); + glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z); + } + glEnd(); + } } if(CTX.geom.lines_num){ @@ -831,9 +846,9 @@ void HighlightEntity(Vertex *v,Curve *c, Surface *s, int permanent){ if(permanent) c->ipar[3] = 1; if(CTX.geom.highlight) Draw_Curve(&c,NULL); - List_Read(c->Control_Points,0,&v1); - List_Read(c->Control_Points,List_Nbr(c->Control_Points)-1,&v2); - Msg(STATUS1N,"Curve %d {%d->%d}",c->Num,v1->Num,v2->Num); + // List_Read(c->Control_Points,0,&v1); + // List_Read(c->Control_Points,List_Nbr(c->Control_Points)-1,&v2); + Msg(STATUS1N,"Curve %d {%d->%d}",c->Num,c->beg->Num,c->end->Num); } else if(s){ if(permanent && s->Mat == 1) return; diff --git a/Makefile b/Makefile index ef8ffb51e4fab84189f5e342ae02a7abe1f12b56..610dcb351c2bf18f09e89b63ea0bb5bb5c9ec3b5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.67 2001-02-21 11:19:29 geuzaine Exp $ +# $Id: Makefile,v 1.68 2001-02-23 00:07:51 remacle Exp $ # ---------------------------------------------------------------------- # Makefile for Gmsh # ---------------------------------------------------------------------- @@ -434,7 +434,7 @@ fltk_dec: tag fltk_compile_little_endian fltk_link_opengl strip_bin compress_bin fltk_solaris_scorec : tag fltk_compile_solaris_scorec fltk_link_solaris_scorec strip_bin -fltk_linux_scorec : tag fltk_compile_linux_scorec fltk_link_linux_scorec strip_bin +fltk_linux_scorec : fltk_compile_linux_scorec fltk_link_linux_scorec strip_bin fltk_sgi: tag fltk_compile_sgi fltk_link_sgi strip_bin compress_bin diff --git a/Mesh/2D_Elliptic.cpp b/Mesh/2D_Elliptic.cpp index 8c6454f6d3c358ade0af662cf2d31bf572f33191..1ffa0bc688f79930567c4b0ded88d2f965167241 100644 --- a/Mesh/2D_Elliptic.cpp +++ b/Mesh/2D_Elliptic.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Elliptic.cpp,v 1.4 2001-01-08 08:05:44 geuzaine Exp $ +// $Id: 2D_Elliptic.cpp,v 1.5 2001-02-23 00:07:51 remacle Exp $ #include "Gmsh.h" #include "Const.h" @@ -30,13 +30,13 @@ int MeshEllipticSurface (Surface * sur){ List_Read (sur->s.Generatrices, i, &GG[i]); } - if (!(S[0] = FindVertex (sur->ipar[0], THEM))) + if (!(S[0] = FindPoint (sur->ipar[0], THEM))) return 0; - if (!(S[1] = FindVertex (sur->ipar[1], THEM))) + if (!(S[1] = FindPoint (sur->ipar[1], THEM))) return 0; - if (!(S[2] = FindVertex (sur->ipar[2], THEM))) + if (!(S[2] = FindPoint (sur->ipar[2], THEM))) return 0; - if (!(S[3] = FindVertex (sur->ipar[3], THEM))) + if (!(S[3] = FindPoint (sur->ipar[3], THEM))) return 0; N1 = N2 = N3 = N4 = 0; /*Remplissure de la premiere cuvee de merde */ diff --git a/Mesh/2D_Mesh_Aniso.cpp b/Mesh/2D_Mesh_Aniso.cpp index a43679c837092b7ec8d57d7567e15651186f0cde..bc64f08e97d3453a99dd3f08a59f41734c17e992 100644 --- a/Mesh/2D_Mesh_Aniso.cpp +++ b/Mesh/2D_Mesh_Aniso.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Mesh_Aniso.cpp,v 1.12 2001-02-17 22:08:58 geuzaine Exp $ +// $Id: 2D_Mesh_Aniso.cpp,v 1.13 2001-02-23 00:07:51 remacle Exp $ /* Jean-Francois Remacle @@ -334,19 +334,9 @@ void Recover_Edge (Surface * s, Edge * e, EdgesContainer & Edges){ /*On swappe */ } -Vertex * FindVertex2 (int inum, Mesh * M){ - Vertex C, *pc; - pc = &C; - pc->Num = inum; - if (Tree_Query (M->Vertices, &pc)){ - return pc; - } - return NULL; -} - void constraint_the_edge (int isurf, int iv1, int iv2){ - Vertex *v1 = FindVertex2 (iv1, THEM); - Vertex *v2 = FindVertex2 (iv2, THEM); + Vertex *v1 = FindVertex (iv1, THEM); + Vertex *v2 = FindVertex (iv2, THEM); Surface *s = FindSurface (isurf, THEM); Edge e; diff --git a/Mesh/Create.cpp b/Mesh/Create.cpp index 764b5269378edd044625c942767f295d6b2ffc0d..fa112c809c2d1b85dbda6fe68f049283f3f2aa13 100644 --- a/Mesh/Create.cpp +++ b/Mesh/Create.cpp @@ -1,4 +1,4 @@ -// $Id: Create.cpp,v 1.9 2001-02-21 07:30:09 geuzaine Exp $ +// $Id: Create.cpp,v 1.10 2001-02-23 00:07:51 remacle Exp $ #include "Gmsh.h" #include "Const.h" @@ -471,7 +471,7 @@ Curve *Create_Curve (int Num, int Typ, int Order, List_T * Liste, pC->Control_Points = List_Create (List_Nbr (Liste), 1, sizeof (Vertex *)); for (j = 0; j < List_Nbr (Liste); j++){ List_Read (Liste, j, &iPnt); - if ((v = FindVertex (iPnt, THEM))) + if ((v = FindPoint (iPnt, THEM))) List_Add (pC->Control_Points, &v); else Msg(FATAL, "Unknown Control Point %d in Curve %d", iPnt, pC->Num); @@ -488,7 +488,7 @@ Curve *Create_Curve (int Num, int Typ, int Order, List_T * Liste, List_Read (pC->Control_Points, List_Nbr (pC->Control_Points) - 1, &pC->end); } else { - if ((v = FindVertex (p1, THEM))){ + if ((v = FindPoint (p1, THEM))){ pC->beg = v; Msg(INFO, "Curve %d First Control Point %d ", pC->Num, v->Num); } @@ -496,7 +496,7 @@ Curve *Create_Curve (int Num, int Typ, int Order, List_T * Liste, List_Read (pC->Control_Points, 0, &pC->beg); Msg(FATAL, "Unknown Control Point %d in Curve %d", p1, pC->Num); } - if ((v = FindVertex (p2, THEM))){ + if ((v = FindPoint (p2, THEM))){ pC->end = v; Msg(INFO, "Curve %d First Control Point %d ", pC->Num, v->Num); } diff --git a/Mesh/Makefile b/Mesh/Makefile index 179d2ff4bcc9651a176ebb7d37d09cd0a079452b..c62dfe4c786242ea76c8b81adbc901f5f63ce178 100644 --- a/Mesh/Makefile +++ b/Mesh/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.15 2001-02-18 18:04:03 geuzaine Exp $ +# $Id: Makefile,v 1.16 2001-02-23 00:07:51 remacle Exp $ # # Makefile for "libMesh.a" # @@ -50,6 +50,7 @@ SRC = 1D_Mesh.cpp \ Print_Mesh.cpp \ Read_Mesh.cpp \ STL.cpp \ + SMS.cpp \ SwapEdge.cpp \ Numeric.cpp \ Metric.cpp \ diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h index 5f6fa4bcd779245309f73503d1bcfbad5e9ea5a6..47d1f48c9ae02db00ad252c4a470ce34e95acbab 100644 --- a/Mesh/Mesh.h +++ b/Mesh/Mesh.h @@ -18,6 +18,7 @@ #define FORMAT_AUTO 10 #define FORMAT_PPM 11 #define FORMAT_YUV 12 +#define FORMAT_SMS 14 #define CONV_VALUE 0.8 diff --git a/Mesh/Read_Mesh.cpp b/Mesh/Read_Mesh.cpp index dc04bd458ca8d17bd7806d4c7fc7b333fd78e64e..fa9d577419f4f3ac6815f340f2d875c01de88d9c 100644 --- a/Mesh/Read_Mesh.cpp +++ b/Mesh/Read_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Read_Mesh.cpp,v 1.8 2001-01-17 21:26:24 remacle Exp $ +// $Id: Read_Mesh.cpp,v 1.9 2001-02-23 00:07:51 remacle Exp $ #include "Gmsh.h" #include "Geo.h" @@ -217,11 +217,13 @@ void Read_Mesh_MSH (Mesh *M, FILE *File_GEO){ /* ------------------------------------------------------------------------ */ /* R e a d _ M e s h */ /* ------------------------------------------------------------------------ */ +void Read_Mesh_SMS (Mesh *m, FILE *File_GEO); void Read_Mesh (Mesh *M, FILE *File_GEO, int type){ switch(type){ case FORMAT_MSH : Read_Mesh_MSH(M,File_GEO); break; + case FORMAT_SMS : Read_Mesh_SMS(M,File_GEO); break; default : Msg(WARNING, "Unkown Mesh File Format to Read"); break; } diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 63badeade6bbb96f93a0a0b5b02768bda901dac0..c8d600059f959b6a9cc45e86e89f01a40f71aa28 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -169,7 +169,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.74 2001-02-20 18:32:58 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.75 2001-02-23 00:07:51 remacle Exp $ #include <stdarg.h> @@ -3828,7 +3828,7 @@ case 154: for(int i=0;i<List_Nbr(yyvsp[-9].l);i++){ List_Read(yyvsp[-9].l,i,&p); ip = (int)p; - v = FindVertex(ip,THEM); + v = FindPoint(ip,THEM); if(!v) vyyerror("Unkown Point %d", ip); else{ @@ -3844,7 +3844,7 @@ case 155: { for(i=0;i<List_Nbr(yyvsp[-3].l);i++){ List_Read(yyvsp[-3].l,i,&d); - Vertex *v = FindVertex((int)d,THEM); + Vertex *v = FindPoint((int)d,THEM); if(!v) vyyerror("Unkown Point %d", (int)d); else diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index ac0254a05e69968319cc22b2a650a73b20df3086..8728ad0cbb2fdb2930d5109da1e1fef6c5a5aa6e 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,6 +1,6 @@ %{ -// $Id: Gmsh.y,v 1.66 2001-02-20 18:32:58 geuzaine Exp $ +// $Id: Gmsh.y,v 1.67 2001-02-23 00:07:51 remacle Exp $ #include <stdarg.h> @@ -1034,7 +1034,7 @@ Shape : for(int i=0;i<List_Nbr($3);i++){ List_Read($3,i,&p); ip = (int)p; - v = FindVertex(ip,THEM); + v = FindPoint(ip,THEM); if(!v) vyyerror("Unkown Point %d", ip); else{ @@ -1048,7 +1048,7 @@ Shape : { for(i=0;i<List_Nbr($3);i++){ List_Read($3,i,&d); - Vertex *v = FindVertex((int)d,THEM); + Vertex *v = FindPoint((int)d,THEM); if(!v) vyyerror("Unkown Point %d", (int)d); else diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index 23acca4083328ab0031dea8aa544ab71e8a198c4..ea43aa0eb60959297235d7fb1fe0314642c9dcd6 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.74 2001-02-20 18:32:58 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.75 2001-02-23 00:07:51 remacle Exp $ */ #define FLEX_SCANNER @@ -978,7 +978,7 @@ char *yytext; #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.74 2001-02-20 18:32:58 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.75 2001-02-23 00:07:51 remacle Exp $ #include <stdio.h> #include <stdlib.h> diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index 0b10ba47f8749476ca6d2d93dd91730a54e2dfb9..6ed53dabf612e966f81d01f4468aae212cdac769 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.7 2001-02-20 18:32:58 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.8 2001-02-23 00:07:51 remacle Exp $ #include "Gmsh.h" #include "Const.h" #include "Context.h" @@ -49,6 +49,12 @@ void ParseFile(char *f){ if(THEM->status < 0) mai3d(THEM, 0); Read_Mesh(THEM, yyin, FORMAT_MSH); } + else if(!strncmp(String, "sms", 3)) + { + + if(THEM->status < 0) mai3d(THEM, 0); + Read_Mesh(THEM, yyin, FORMAT_SMS); + } else if(!strncmp(String, "$PostFormat", 11) || !strncmp(String, "$View", 5)){ Read_View(yyin, yyname);