diff --git a/Common/Context.h b/Common/Context.h index 0071dd9b4af19a05c7a581a80a595f403ab5754c..709017a86976b8c3f1b89f06e3abd9eea6da8ef6 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -145,7 +145,7 @@ public : return val; } int oldxtrude, oldxtrude_recombine, check_duplicates; - int allow_degenerated_extrude; + int allow_degenerated_extrude, save_all; } mesh; // post processing options diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 0f8cb7772bedfc260519f6d552acc5ea1b68d177..4c51ca1f0e741dab62f674b672b05822b6d0d382 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -393,6 +393,8 @@ StringXNumber MeshOptions_Number[] = { "Fourth clip plane equation coefficient ('D' in equation 'AX+BY+CZ+D=0')" }, { F, "AllowDegeneratedExtrude" , opt_mesh_allow_degenerated_extrude , 0. , "Allow the generation of degenerated hexahedra or prisms during extrusion" }, + { F, "SaveAll" , opt_mesh_save_all , 0. , + "Ignore Physical definitions and save all elements" }, { 0, NULL , NULL , 0. , NULL } } ; diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp index ab63703f9dbe2cf99bc86333a78808bf9d131993..01e0fd6bde8d75f930dbbc64a8ebc143880082f7 100644 --- a/Common/GetOptions.cpp +++ b/Common/GetOptions.cpp @@ -1,4 +1,4 @@ -// $Id: GetOptions.cpp,v 1.39 2001-09-01 15:19:05 geuzaine Exp $ +// $Id: GetOptions.cpp,v 1.40 2001-09-05 19:14:05 geuzaine Exp $ #include <unistd.h> #include "Gmsh.h" @@ -35,6 +35,7 @@ void Print_Usage(char *name){ Msg(DIRECT, " -0 parse input files, output flattened geometry, and exit"); Msg(DIRECT, "Mesh options:"); Msg(DIRECT, " -1, -2, -3 perform batch 1D, 2D and 3D mesh generation"); + Msg(DIRECT, " -saveall save all elements (discard physical group definitions)"); Msg(DIRECT, " -o file specify mesh output file name"); Msg(DIRECT, " -format msh|unv|gref set output mesh format (default: msh)"); Msg(DIRECT, " -algo iso|tri|aniso select 2D mesh algorithm (default: iso)"); @@ -142,6 +143,9 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { else if(!strcmp(argv[i]+1, "3")){ CTX.batch = 3; i++; } + else if(!strcmp(argv[i]+1, "saveall")){ + CTX.mesh.save_all = 1; i++; + } else if(!strcmp(argv[i]+1, "extrude")){ //old extrusion mesh generator CTX.mesh.oldxtrude = 1; i++; } diff --git a/Common/Options.cpp b/Common/Options.cpp index be0cc57ea225fb3ed61b42868ae6378f521c1375..7c76f908759303752a3ad3abbf6e9fabfb5bc61a 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.45 2001-09-01 15:19:05 geuzaine Exp $ +// $Id: Options.cpp,v 1.46 2001-09-05 19:14:05 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -1470,6 +1470,11 @@ double opt_mesh_allow_degenerated_extrude(OPT_ARGS_NUM){ CTX.mesh.allow_degenerated_extrude = (int)val; return CTX.mesh.allow_degenerated_extrude; } +double opt_mesh_save_all(OPT_ARGS_NUM){ + if(action & GMSH_SET) + CTX.mesh.save_all = (int)val; + return CTX.mesh.save_all; +} double opt_mesh_color_scheme(OPT_ARGS_NUM){ if(action & GMSH_SET){ CTX.mesh.color_scheme = (int)val; diff --git a/Common/Options.h b/Common/Options.h index d9fff827770358b32c89dd6745a6d96088183421..1060c79389f9c72256088d2eccfd9f97070ae478 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -181,6 +181,7 @@ double opt_mesh_cut_planeb(OPT_ARGS_NUM); double opt_mesh_cut_planec(OPT_ARGS_NUM); double opt_mesh_cut_planed(OPT_ARGS_NUM); double opt_mesh_allow_degenerated_extrude(OPT_ARGS_NUM); +double opt_mesh_save_all(OPT_ARGS_NUM); double opt_mesh_color_scheme(OPT_ARGS_NUM); double opt_mesh_color_carousel(OPT_ARGS_NUM); double opt_solver_getdp_popupmessages(OPT_ARGS_NUM); diff --git a/Mesh/2D_InitMesh.cpp b/Mesh/2D_InitMesh.cpp index 81e053c6f06bc8773653631abb5bacdf39ee3ae6..dc7daf358bb9900eef4265730317c091a980b48a 100644 --- a/Mesh/2D_InitMesh.cpp +++ b/Mesh/2D_InitMesh.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_InitMesh.cpp,v 1.10 2001-09-05 09:06:36 geuzaine Exp $ +// $Id: 2D_InitMesh.cpp,v 1.11 2001-09-05 19:14:05 geuzaine Exp $ /* @@ -76,7 +76,7 @@ typedef struct { void makepermut (int numpoints){ int i, ip ; - permut = (int *) Malloc (numpoints * sizeof (int)); + permut = (int *) Malloc (numpoints * sizeof (int)); //Memory leak! this is never freed... for ( i=0 ; i<numpoints ; i++ ){ ip = gPointArray[i].permu; permut[ip] = i; @@ -189,7 +189,7 @@ void SwapED ( void *data , void *dummy){ else if(Stagnant)Counter++; if(!e->Liste[0] || !e->Liste[1]){ - Msg(GERROR, "Initial mesh is wrong. Try new isotropic algorithm."); + Msg(GERROR, "Initial mesh is wrong. Try the new isotropic algorithm."); return; } diff --git a/Mesh/Print_Mesh.cpp b/Mesh/Print_Mesh.cpp index b3138d821b7af3be9ea8c478bc78e5f98596d2b6..b576ea2cc60c9179a82c049f7c056915543a4c84 100644 --- a/Mesh/Print_Mesh.cpp +++ b/Mesh/Print_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Print_Mesh.cpp,v 1.27 2001-08-28 20:40:21 geuzaine Exp $ +// $Id: Print_Mesh.cpp,v 1.28 2001-09-05 19:14:05 geuzaine Exp $ #include "Gmsh.h" #include "Numeric.h" @@ -31,9 +31,8 @@ extern Context_T CTX ; #define POINT 15 static FILE *mshfile; -static int MSH_NODE_NUM; static int MSH_VOL_NUM, MSH_SUR_NUM, MSH_LIN_NUM; -static int MSH_ELEMENT_NUM, MSH_ADD; +static int MSH_NODE_NUM, MSH_ELEMENT_NUM, MSH_3D, MSH_ADD; static int MSH_PHYSICAL_NUM, MSH_PHYSICAL_ORI; void print_msh_node (void *a, void *b){ @@ -117,7 +116,7 @@ void add_msh_simplex (void *a, void *b){ } else{ nbn = 4; - if (!MSH_VOL_NUM){ + if (!MSH_3D){ if ((*S)->VSUP){ type = QUADRANGLE_2; nbs = 5; @@ -143,7 +142,9 @@ void add_msh_simplex (void *a, void *b){ } fprintf (mshfile, "%d %d %d %d %d", - MSH_ELEMENT_NUM++, type,MSH_PHYSICAL_NUM,(*S)->iEnt, nbn + nbs); + MSH_ELEMENT_NUM++, type, + MSH_PHYSICAL_NUM ? MSH_PHYSICAL_NUM : (*S)->iEnt, (*S)->iEnt, + nbn + nbs); if (MSH_PHYSICAL_ORI > 0){ for (i = 0; i < nbn; i++) @@ -184,7 +185,9 @@ void add_msh_hexahedron (void *a, void *b){ type = HEXAHEDRON; fprintf (mshfile, "%d %d %d %d %d", - MSH_ELEMENT_NUM++, type, MSH_PHYSICAL_NUM, (*H)->iEnt, nbn + nbs); + MSH_ELEMENT_NUM++, type, + MSH_PHYSICAL_NUM ? MSH_PHYSICAL_NUM : (*H)->iEnt, (*H)->iEnt, + nbn + nbs); for (i = 0; i < nbn; i++) fprintf (mshfile, " %d", (*H)->V[i]->Num); @@ -218,7 +221,9 @@ void add_msh_prism (void *a, void *b){ } fprintf (mshfile, "%d %d %d %d %d", - MSH_ELEMENT_NUM++, type, MSH_PHYSICAL_NUM, (*P)->iEnt, nbn + nbs); + MSH_ELEMENT_NUM++, type, + MSH_PHYSICAL_NUM ? MSH_PHYSICAL_NUM : (*P)->iEnt, (*P)->iEnt, + nbn + nbs); for (i = 0; i < nbn; i++) fprintf (mshfile, " %d", (*P)->V[i]->Num); @@ -252,7 +257,9 @@ void add_msh_pyramid (void *a, void *b){ } fprintf (mshfile, "%d %d %d %d %d", - MSH_ELEMENT_NUM++, type, MSH_PHYSICAL_NUM, (*P)->iEnt, nbn + nbs); + MSH_ELEMENT_NUM++, type, + MSH_PHYSICAL_NUM ? MSH_PHYSICAL_NUM : (*P)->iEnt, (*P)->iEnt, + nbn + nbs); for (i = 0; i < nbn; i++) fprintf (mshfile, " %d", (*P)->V[i]->Num); @@ -270,7 +277,8 @@ void add_msh_point (Vertex * V){ } fprintf (mshfile, "%d %d %d %d 1 %d\n", - MSH_ELEMENT_NUM++, POINT, MSH_PHYSICAL_NUM, V->Num, V->Num); + MSH_ELEMENT_NUM++, POINT, + MSH_PHYSICAL_NUM ? MSH_PHYSICAL_NUM : V->Num, V->Num, V->Num); } void add_msh_elements (Mesh * M){ @@ -287,6 +295,7 @@ void add_msh_elements (Mesh * M){ for (i = 0; i < List_Nbr (M->PhysicalGroups); i++){ List_Read (M->PhysicalGroups, i, &p); MSH_PHYSICAL_NUM = p->Num; + MSH_3D = 0; MSH_VOL_NUM = MSH_SUR_NUM = MSH_LIN_NUM = 0; switch (p->Typ){ @@ -355,6 +364,7 @@ void add_msh_elements (Mesh * M){ List_Read (ListVolumes, k, &pV); for (j = 0; j < List_Nbr (p->Entities); j++){ List_Read (p->Entities, j, &Num); + MSH_3D = 1; MSH_VOL_NUM = abs (Num); MSH_PHYSICAL_ORI = sign (Num); Tree_Action (pV->Simplexes, add_msh_simplex); @@ -374,19 +384,73 @@ void add_msh_elements (Mesh * M){ } +void add_all_msh_curves (void *a, void *b){ + Curve *c = *(Curve**)a; + MSH_PHYSICAL_ORI = sign(c->Num); + Tree_Action (c->Simplexes, add_msh_simplex); +} + +void add_all_msh_surfaces (void *a, void *b){ + Surface *s = *(Surface**)a; + MSH_PHYSICAL_ORI = sign(s->Num); + Tree_Action (s->Simplexes, add_msh_simplex); +} + +void add_all_msh_simpsurf (void *a, void *b){ + Volume *v = *(Volume**)a; + MSH_PHYSICAL_ORI = sign(v->Num); + Tree_Action (v->Simp_Surf, add_msh_simplex); +} + +void add_all_msh_volumes (void *a, void *b){ + Volume *v = *(Volume**)a; + MSH_PHYSICAL_ORI = sign(v->Num); + Tree_Action (v->Simplexes, add_msh_simplex); + Tree_Action (v->Hexahedra, add_msh_hexahedron); + Tree_Action (v->Prisms, add_msh_prism); + Tree_Action (v->Pyramids, add_msh_pyramid); +} + +void add_all_msh_elements (Mesh * M){ + MSH_PHYSICAL_NUM = 0; + MSH_LIN_NUM = MSH_SUR_NUM = MSH_VOL_NUM = 0; + MSH_3D = 0; + + if(CTX.mesh.oldxtrude){ + Tree_Action(M->Volumes, add_all_msh_simpsurf); + } + else{ + Tree_Action(M->Curves, add_all_msh_curves); + Tree_Action(M->Surfaces, add_all_msh_surfaces); + } + + MSH_3D = 1; + Tree_Action(M->Volumes, add_all_msh_volumes); +} + void process_msh_elements (Mesh * M){ MSH_ADD = 0; MSH_ELEMENT_NUM = 1; - add_msh_elements (M); + + if(!List_Nbr(M->PhysicalGroups) || CTX.mesh.save_all){ + Msg (INFO, "Saving all elements (discarding physical groups)"); + add_all_msh_elements (M); + } + else + add_msh_elements (M); + fprintf (mshfile, "$ELM\n"); fprintf (mshfile, "%d\n", MSH_ELEMENT_NUM - 1); if (MSH_ELEMENT_NUM == 1) - Msg (WARNING, "No elements (did you forget to define physical entities?)"); + Msg (WARNING, "No elements to save"); MSH_ADD = 1; MSH_ELEMENT_NUM = 1; - add_msh_elements (M); + if(!List_Nbr(M->PhysicalGroups) || CTX.mesh.save_all) + add_all_msh_elements (M); + else + add_msh_elements (M); fprintf (mshfile, "$ENDELM\n"); } diff --git a/doc/FAQ b/doc/FAQ index 141573ba64354d0f80964d521425035652948ecb..00863ffa7e3f991c77cc3371ec11078bcb532e54 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -1,8 +1,5 @@ -GMSH FREQUENTLY ASKED QUESTIONS - -($Id: FAQ,v 1.3 2001-09-05 12:22:38 geuzaine Exp $) - +GMSH FREQUENTLY ASKED QUESTIONS ($Date: 2001-09-05 19:14:05 $) 1. GENERAL ========== @@ -22,11 +19,9 @@ Nothing ;-) 1.3) Where can I find more information? -<http://www.geuz.org/gmsh/> is the primary site to obtain information about -Gmsh. You will e.g. find a searchable archive of the Gmsh mailing list. -Please: Before posting to the list, read this FAQ and the available -documentation. This way you help people focus on topics that have not yet -been resolved. +<http://www.geuz.org/gmsh/> is the primary site to obtain information +about Gmsh. You will for example find a searchable archive of the Gmsh +mailing list (<gmsh@geuz.org>) on this site. 2. INSTALLATION @@ -39,7 +34,9 @@ Sun OS, IBM AIX, SGI IRIX, HP-UX. 2.2) Are there additional requirements to run Gmsh? -You must have OpenGL (or Mesa) libraries installed on your system. +For Unix versions only: you should have the OpenGL libraries installed +on your system, and in the path of the library loader. A free +replacement for OpenGL can be found at <http://www.mesa3d.org>. 3. GENERAL PROBLEMS @@ -52,8 +49,8 @@ your system. If not, install them. 3.2) Gmsh does not work under HP-UX. -The HP version is reported not to work with native OpenGL. You should -install Mesa instead. +The HP version is reported not to work with HP's native OpenGL. You +should install Mesa instead. 3.3) Gmsh keeps re-displaying its graphics when other windows partially hide the graphical window. @@ -74,39 +71,51 @@ Not yet. 5.1) What should I do when the 2D unstructured algorithm fails? -Try the new algorithm: +Try the new (isotropic) algorithm: - on the command line: gmsh -algo tri - in the interface: Options->Mesh->Algorithm->Isotropic (Triangle) - in input files: Mesh.Algorithm = 3 -The old 2D algorithm will disappear once all the features of the old one are -integrated, so please don't send bug reports for the old algorithm anymore. +The old 2D algorithm will disappear once all its features are +integrated in the new one, so please don't send bug reports on the +old algorithm anymore. 5.2) What should I do when the 3D unstructured algorithm fails? The 3D algorithm is still very experimental. Try to change some -characteristic lengths in your input file to generate meshes that suit the -geometrical details better. +characteristic lengths in your input file to generate meshes that +better suit the geometrical details of your structure. -5.3) I changed the characteristic lenghts, but the 3D algorithm still does +5.3) I changed the characteristic lengths, but the 3D algorithm still does not work. What should I do? Buy a professional mesh generator ;-) 5.4) The quality of the elements generated by the 3D algorithm is very bad. -Yes, this is normal. At the time of this writing, we do not post-process the -delaunay mesh, so that some badly shaped tetrahedra will likely subsist in -any unstructured 3D mesh. This will be fixed in the future. +Yes, this is normal(!). At the time of this writing, we do not +post-process the 3D Delaunay mesh, so that some (<0.1%) badly shaped +tetrahedra will likely subsist in any unstructured 3D mesh. This will +be fixed in the future. 5.5) Non-recombined 3D extruded meshes sometimes fail. -The swapping algorithm is not very clever at the moment. Try to change the -surface mesh a bit. +The swapping algorithm is not very clever at the moment. Try to change +the surface mesh a bit, or recombine your mesh to generate prisms or +hexahedra. 6. SOLVER PROBLEMS ================== +6.1) On Windows, Gmsh does not seem to find the solver +executable. What's wrong? + +- the shell executable 'sh.exe' has to be in your path +- the solver executable 'getdp.exe' has to be in the same directory as +'sh.exe', unless you configure sh accordingly +- if an absolute path is given to locate getdp.exe, it should begin +with /cygwin/. + 7. POST-PROCESSING PROBLEMS =========================== diff --git a/doc/VERSIONS b/doc/VERSIONS index 3bcb0276075f92ec17a61fedab21780ccabfa1e2..537c70439690722ec7f2c5e259160867fa0b1c47 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,9 +1,11 @@ -$Id: VERSIONS,v 1.68 2001-09-05 09:35:29 geuzaine Exp $ +$Id: VERSIONS,v 1.69 2001-09-05 19:14:05 geuzaine Exp $ New in 1.26: Enhanced 2D anisotropic mesh generator (metric -intersections); fixed (yet another) bug in 3D initial mesh; -alternative syntax for built-in functions (for GetDP compatibility); -draw line elements; +intersections); fixed small bug in 3D initial mesh; added alternative +syntax for built-in functions (for GetDP compatibility); added line +element display; Gmsh now saves all the elements in the mesh if no +physical groups are defined (or if the option Mesh.SaveAll, or the +command line option -saveall, is selected); New in 1.25: Fixed bug with mixed recombined/non-recombined extruded meshes; Linux versions are now build with no optimization, due to bugs diff --git a/tutorial/t1.geo b/tutorial/t1.geo index 818d1276494e846858a51897104412746b15e308..0578f4c9f00bf60ce1da85917052031ff2c6a02b 100644 --- a/tutorial/t1.geo +++ b/tutorial/t1.geo @@ -97,10 +97,8 @@ Physical Surface(100) = {6} ; // lines 1, 2 and 4 will be saved in the output file with the region // number 10; and all the triangular elements resulting from the // discretization of surface 6 will be given the region number 100. - -// It is important to notice that only those elements which belong to -// physical groups will be saved in the output file if the file format -// is the msh format (the native mesh file format for Gmsh). For a -// description of the mesh and post-processing formats, see the -// FORMATS file. - +// +// If no physical groups are defined, all the elements in the mesh are +// directly saved with their default orientation and with a region +// number equal to their elementary region number. For a description +// of the mesh and post-processing formats, see the FORMATS file.