From aa196c9fe2759b7279c65116702fd1a0ff9a12ad Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 23 Mar 2007 08:44:41 +0000 Subject: [PATCH] - changed '-convert' syntax to process multiple files at once - added lateral entities in list returned by extrusion commands --- Common/CommandLine.cpp | 25 +++-- Geo/Geo.cpp | 132 ++++++++++++++---------- Mesh/meshGRegionDelaunayInsertion.cpp | 7 +- benchmarks/3d/piece_explicit_volume.geo | 3 +- doc/TODO | 7 +- doc/VERSIONS | 5 +- doc/gmsh.1 | 6 +- doc/texinfo/command_line.texi | 4 +- 8 files changed, 106 insertions(+), 83 deletions(-) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index afab1b5a77..95143df728 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -1,4 +1,4 @@ -// $Id: CommandLine.cpp,v 1.96 2007-03-13 16:11:42 remacle Exp $ +// $Id: CommandLine.cpp,v 1.97 2007-03-23 08:44:41 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -115,7 +115,7 @@ void Print_Usage(char *name){ Msg(DIRECT, " -nopopup Don't popup dialog windows in scripts"); Msg(DIRECT, " -string \"string\" Parse option string at startup"); Msg(DIRECT, " -option file Parse option file at startup"); - Msg(DIRECT, " -convert file file Convert views and meshes into latest file formats, then exit"); + Msg(DIRECT, " -convert files Convert files into latest binary formats, then exit"); Msg(DIRECT, " -version Show version number"); Msg(DIRECT, " -info Show detailed version information"); Msg(DIRECT, " -help Show this message"); @@ -284,21 +284,24 @@ void Get_Options(int argc, char *argv[]) i++; CTX.terminal = 1; CTX.batch = 1; - if(argv[i] && argv[i + 1]) { + while(i < argc) { + char filename[256]; + sprintf(filename, "%s_new", argv[i]); + int numviews_old = List_Nbr(CTX.post.list); OpenProject(argv[i]); - // convert post-processing views to latest (binary) format - for(int j = 0; j < List_Nbr(CTX.post.list); j++) - WriteView(*(Post_View **) List_Pointer(CTX.post.list, j), - argv[i + 1], 1, j ? 1 : 0); - // convert any mesh to the latest format + // convert post-processing views to latest binary format + for(int j = numviews_old; j < List_Nbr(CTX.post.list); j++){ + Post_View *v = *(Post_View **)List_Pointer(CTX.post.list, j); + WriteView(v, filename, 1, (j == numviews_old) ? 0 : 1); + } + // convert mesh to latest binary format if(GMODEL->getMeshStatus() > 0){ CTX.mesh.msh_file_version = 2.0; CTX.mesh.msh_binary = 1; - CreateOutputFile(argv[i + 1], FORMAT_MSH); + CreateOutputFile(filename, FORMAT_MSH); } + i++; } - else - fprintf(stderr, "Usage: %s -convert file file\n", argv[0]); exit(1); } else if(!strcmp(argv[i] + 1, "tol")) { diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index a29c9743cd..bafe9c87ec 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -1,4 +1,4 @@ -// $Id: Geo.cpp,v 1.86 2007-03-11 20:18:58 geuzaine Exp $ +// $Id: Geo.cpp,v 1.87 2007-03-23 08:44:41 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -2323,7 +2323,7 @@ void ExtrudeShape(int extrude_type, int shape_type, int shape_num, double A0, double A1, double A2, double X0, double X1, double X2, double alpha, ExtrudeParams *e, - List_T *out) + List_T *list_out) { Shape shape; shape.Type = shape_type; @@ -2335,35 +2335,36 @@ void ExtrudeShape(int extrude_type, int shape_type, int shape_num, A0, A1, A2, X0, X1, X2, alpha, e, - out); + list_out); List_Delete(tmp); } -void ExtrudeShapes(int type, List_T *in, +void ExtrudeShapes(int type, List_T *list_in, double T0, double T1, double T2, double A0, double A1, double A2, double X0, double X1, double X2, double alpha, ExtrudeParams *e, - List_T *out) + List_T *list_out) { - Shape O, TheShape; - Curve *pc, *prc; - Surface *ps; - Volume *pv; - - for(int i = 0; i < List_Nbr(in); i++){ - List_Read(in, i, &O); - switch(O.Type){ + for(int i = 0; i < List_Nbr(list_in); i++){ + Shape shape; + List_Read(list_in, i, &shape); + switch(shape.Type){ case MSH_POINT: - TheShape.Num = Extrude_ProtudePoint(type, O.Num, T0, T1, T2, - A0, A1, A2, X0, X1, X2, alpha, - &pc, &prc, 1, e); - TheShape.Type = MSH_POINT; - List_Add(out, &TheShape); - if(pc){ - TheShape.Num = pc->Num; - TheShape.Type = pc->Typ; - List_Add(out, &TheShape); + { + Curve *pc = 0, *prc = 0; + Shape top; + top.Num = Extrude_ProtudePoint(type, shape.Num, T0, T1, T2, + A0, A1, A2, X0, X1, X2, alpha, + &pc, &prc, 1, e); + top.Type = MSH_POINT; + List_Add(list_out, &top); + if(pc){ + Shape body; + body.Num = pc->Num; + body.Type = pc->Typ; + List_Add(list_out, &body); + } } break; case MSH_SEGM_LINE: @@ -2376,49 +2377,67 @@ void ExtrudeShapes(int type, List_T *in, case MSH_SEGM_ELLI_INV: case MSH_SEGM_NURBS: case MSH_SEGM_PARAMETRIC: - TheShape.Num = Extrude_ProtudeCurve(type, O.Num, T0, T1, T2, - A0, A1, A2, X0, X1, X2, alpha, - &ps, 1, e); - pc = FindCurve(TheShape.Num); - if(!pc){ - //Msg(WARNING, "Unknown curve %d", TheShape.Num); - TheShape.Type = 0; - } - else{ - TheShape.Type = pc->Typ; - } - List_Add(out, &TheShape); - if(ps){ - TheShape.Num = ps->Num; - TheShape.Type = ps->Typ; - List_Add(out, &TheShape); + { + Surface *ps = 0; + Shape top; + top.Num = Extrude_ProtudeCurve(type, shape.Num, T0, T1, T2, + A0, A1, A2, X0, X1, X2, alpha, + &ps, 1, e); + Curve *pc = FindCurve(top.Num); + top.Type = pc ? pc->Typ : 0; + List_Add(list_out, &top); + if(ps){ + Shape body; + body.Num = ps->Num; + body.Type = ps->Typ; + List_Add(list_out, &body); + for(int j = 0; j < List_Nbr(ps->Generatrices); j++){ + Curve *c; + List_Read(ps->Generatrices, j, &c); + if(abs(c->Num) != shape.Num && abs(c->Num) != top.Num){ + Shape side; + side.Num = c->Num; + side.Type = c->Typ; + List_Add(list_out, &side); + } + } + } } break; case MSH_SURF_REGL: case MSH_SURF_TRIC: case MSH_SURF_PLAN: case MSH_SURF_DISCRETE: - TheShape.Num = Extrude_ProtudeSurface(type, O.Num, T0, T1, T2, - A0, A1, A2, X0, X1, X2, alpha, - &pv, e); - ps = FindSurface(TheShape.Num); - if(!ps){ - //Msg(WARNING, "Unknown surface %d", TheShape.Num); - TheShape.Type = 0; - } - else{ - TheShape.Type = ps->Typ; - } - List_Add(out, &TheShape); - if(pv){ - TheShape.Num = pv->Num; - TheShape.Type = pv->Typ; - List_Add(out, &TheShape); + { + Volume *pv = 0; + Shape top; + top.Num = Extrude_ProtudeSurface(type, shape.Num, T0, T1, T2, + A0, A1, A2, X0, X1, X2, alpha, + &pv, e); + Surface *ps = FindSurface(top.Num); + top.Type = ps ? ps->Typ : 0; + List_Add(list_out, &top); + if(pv){ + Shape body; + body.Num = pv->Num; + body.Type = pv->Typ; + List_Add(list_out, &body); + for(int j = 0; j < List_Nbr(pv->Surfaces); j++){ + Surface *s; + List_Read(pv->Surfaces, j, &s); + if(abs(s->Num) != shape.Num && abs(s->Num) != top.Num){ + Shape side; + side.Num = s->Num; + side.Type = s->Typ; + List_Add(list_out, &side); + } + } + } } break; default: - Msg(GERROR, "Impossible to extrude entity %d (of type %d)", O.Num, - O.Type); + Msg(GERROR, "Impossible to extrude entity %d (of type %d)", + shape.Num, shape.Type); break; } } @@ -2628,7 +2647,6 @@ void ReplaceDuplicatePoints() Tree_Delete(allNonDuplicatedPoints); List_Delete(points2delete); - } void ReplaceDuplicateCurves() diff --git a/Mesh/meshGRegionDelaunayInsertion.cpp b/Mesh/meshGRegionDelaunayInsertion.cpp index 6399148ead..843fb7e6e5 100644 --- a/Mesh/meshGRegionDelaunayInsertion.cpp +++ b/Mesh/meshGRegionDelaunayInsertion.cpp @@ -1,4 +1,4 @@ -// $Id: meshGRegionDelaunayInsertion.cpp,v 1.16 2007-02-14 11:07:02 geuzaine Exp $ +// $Id: meshGRegionDelaunayInsertion.cpp,v 1.17 2007-03-23 08:44:41 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -477,6 +477,11 @@ void insertVerticesInRegion (GRegion *gr) while (1) { + if (allTets.empty() ){ + Msg(GERROR, "No tetrahedra in region %d", gr->tag()); + break; + } + MTet4 *worst = *allTets.begin(); if (worst->isDeleted()) diff --git a/benchmarks/3d/piece_explicit_volume.geo b/benchmarks/3d/piece_explicit_volume.geo index 65f1db321a..4cfabb8edc 100644 --- a/benchmarks/3d/piece_explicit_volume.geo +++ b/benchmarks/3d/piece_explicit_volume.geo @@ -86,5 +86,6 @@ Extrude Surface {47, {0,0,-0.2}}; Delete { Volume{1:4}; } -Surface Loop(373) = {288,135,-49,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255,259,263,267,271,-355,-343,-347,-351,-372,-359,78,82,-363,-367,86,90,-371,329,317,321,325,330,301,305,309,313}; +Surface Loop(373) = {288,135,49,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255,259,263,267,271,313,301,305,309,330,317,321,325,329,351,355,343,347,372,359,363,367,371,86,90,78,82}; Volume(374) = {373}; + diff --git a/doc/TODO b/doc/TODO index 3df8873061..28d68affa5 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,4 +1,4 @@ -$Id: TODO,v 1.54 2007-03-13 09:25:50 geuzaine Exp $ +$Id: TODO,v 1.55 2007-03-23 08:44:41 geuzaine Exp $ ******************************************************************** @@ -91,11 +91,6 @@ points ******************************************************************** -add "lateral" curves (for Extrude Line) and surfaces (for Extrude -Surface) in the return list for extrusions - -******************************************************************** - add Mesh>Edit>Change orientation>Lines & Surfaces ******************************************************************** diff --git a/doc/VERSIONS b/doc/VERSIONS index 39d0167d93..6c69e92ca6 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,4 +1,4 @@ -$Id: VERSIONS,v 1.381 2007-03-11 20:19:06 geuzaine Exp $ +$Id: VERSIONS,v 1.382 2007-03-23 08:44:41 geuzaine Exp $ new since 2.0: volumes can now be defined from external CAD surfaces; Delaunay/Tetgen algorithm is now used by default when available; @@ -6,7 +6,8 @@ re-added support for Plot3D structured mesh format; added ability to export external CAD models as GEO files (this only works for the limited set of geometrical primitives available in the GEO language, of course--so trying to convert e.g. a trimmed NURBS from a STEP file -into a GEO file will fail); fixed various bugs. +into a GEO file will fail); "lateral" entities are now added at the +end of the list returned by extrusion commands; fixed various bugs. 2.0 (February 5, 2007): new geometry and mesh databases, with support for STEP and IGES import via OpenCascade; complete rewrite of geometry diff --git a/doc/gmsh.1 b/doc/gmsh.1 index 0e0c0f1dfd..bdfe0c011b 100644 --- a/doc/gmsh.1 +++ b/doc/gmsh.1 @@ -1,4 +1,4 @@ -.\" $Id: gmsh.1,v 1.79 2007-03-11 20:19:06 geuzaine Exp $ +.\" $Id: gmsh.1,v 1.80 2007-03-23 08:44:41 geuzaine Exp $ .TH Gmsh 1 "09 March 2006" "Gmsh 2.0" "Gmsh Manual Pages" .UC 4 .\" ******************************************************************** @@ -128,8 +128,8 @@ parse option string at startup. .B \-option file parse option file at startup. .TP 4 -.B \-convert file file -perform batch conversion of views and meshes into latest file formats. +.B \-convert files +Convert files into latest binary formats, then exit. .TP 4 .B \-version show version number. diff --git a/doc/texinfo/command_line.texi b/doc/texinfo/command_line.texi index 3d8b1c8496..a638438d03 100644 --- a/doc/texinfo/command_line.texi +++ b/doc/texinfo/command_line.texi @@ -91,8 +91,8 @@ Don't popup dialog windows in scripts Parse option string at startup @item -option file Parse option file at startup -@item -convert file file -Convert views and meshes into latest file formats, then exit +@item -convert files +Convert files into latest binary formats, then exit @item -version Show version number @item -info -- GitLab