diff --git a/Box/Main.cpp b/Box/Main.cpp index bf435b2a055f9ea252ad178bcc29b8d9b252135d..14d9189d9225f1cd840257c4c673e1b17a61e9df 100644 --- a/Box/Main.cpp +++ b/Box/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.38 2004-04-19 07:42:23 geuzaine Exp $ +// $Id: Main.cpp,v 1.39 2004-05-07 18:42:48 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -106,6 +106,8 @@ int main(int argc, char *argv[]) M.PhysicalGroups = NULL; M.Partitions = NULL; M.Metric = NULL; + M.BGM.bgm = NULL; + M.Grid.init = 0; signal(SIGINT, Signal); signal(SIGSEGV, Signal); diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index 317a4dfea321cc27b23fcdf4f4b5011b47d4677b..c8ce8847b596f06b87d77c579586ee95c23688ac 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.63 2004-04-21 23:33:21 geuzaine Exp $ +// $Id: Main.cpp,v 1.64 2004-05-07 18:42:48 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -93,6 +93,8 @@ int main(int argc, char *argv[]) M.PhysicalGroups = NULL; M.Partitions = NULL; M.Metric = NULL; + M.BGM.bgm = NULL; + M.Grid.init = 0; // Configuration files and command line options diff --git a/Makefile b/Makefile index 0ab3907861a27dd2712da9b59ff7e78ec4646853..aaec4a134a5d91ab5315af54f11cbe55ff9dc03d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.339 2004-05-01 15:54:39 geuzaine Exp $ +# $Id: Makefile,v 1.340 2004-05-07 18:42:48 geuzaine Exp $ # # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle # @@ -23,7 +23,7 @@ include variables GMSH_MAJOR_VERSION = 1 GMSH_MINOR_VERSION = 52 -GMSH_PATCH_VERSION = 0 +GMSH_PATCH_VERSION = 1 GMSH_EXTRA_VERSION = "-cvs" GMSH_VERSION = ${GMSH_MAJOR_VERSION}.${GMSH_MINOR_VERSION}.${GMSH_PATCH_VERSION}${GMSH_EXTRA_VERSION} diff --git a/Mesh/2D_Bricks.cpp b/Mesh/2D_Bricks.cpp index d5bc69ec2d3fec26d620e5502ce6a86f1c697c36..886832166acf02e49a7fee94b0d126137cb0c719 100644 --- a/Mesh/2D_Bricks.cpp +++ b/Mesh/2D_Bricks.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Bricks.cpp,v 1.12 2004-02-07 01:40:20 geuzaine Exp $ +// $Id: 2D_Bricks.cpp,v 1.13 2004-05-07 18:42:48 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -27,8 +27,8 @@ static double XmaxGrid, YmaxGrid, XminGrid, YminGrid, ZmaxGrid, ZminGrid; static double XminBox, XmaxBox, YminBox, YmaxBox, ZminBox, ZmaxBox; static int Nx = 0, Ny = 0, Nz = 0; -static List_T *GridList; -static DocRecord *MyMesh; +static List_T *GridList = NULL; +static DocRecord *MyMesh = NULL; extern PointRecord *gPointArray; @@ -84,7 +84,6 @@ void Invert_MappingLists(List_T * List1, List_T * List2) } List_Delete(TmpList); - } int InWhichBrick(double X, double Y, double Z) @@ -147,12 +146,16 @@ void InitBricks(DocRecord * MESH) MyMesh = MESH; + if(!MyMesh) return; + Nx = (int)sqrt((double)MESH->numTriangles) + 1; Ny = Nx; Nz = 1; ZminGrid = 0.; ZmaxGrid = 1.; + if(GridList) + List_Delete(GridList); GridList = List_Create(Nx * Ny * Nz, 1, sizeof(struct Map)); InvList = List_Create(MESH->numTriangles, 1, sizeof(struct Map)); diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp index 997c9aad2b728669b20ff62f0d7683a7e8d20689..3d67ffbbd14ab63c1a268b10dce49c8a1b8030f1 100644 --- a/Mesh/2D_Mesh.cpp +++ b/Mesh/2D_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Mesh.cpp,v 1.54 2004-04-18 03:36:07 geuzaine Exp $ +// $Id: 2D_Mesh.cpp,v 1.55 2004-05-07 18:42:48 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -34,9 +34,9 @@ extern Context_T CTX; PointRecord *gPointArray; DocRecord *BGMESH, *FGMESH; -int is_3D = 0; double LC2D; +static int is_3D = 0; static Surface *THESURFACE, *THESUPPORT; void ProjetteSurface(void *a, void *b) @@ -302,13 +302,13 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, Conversion(doc); remove_all_dlist(doc->numPoints, doc->points); - if(!is_3D || CTX.mesh.constrained_bgmesh) { + if(!is_3D || CTX.mesh.constrained_bgmesh) BGMESH = doc; - InitBricks(BGMESH); - } else BGMESH = NULL; + InitBricks(BGMESH); + /* elimination des triangles exterieurs + verification de l'existence des edges (coherence) */ diff --git a/Mesh/3D_BGMesh.cpp b/Mesh/3D_BGMesh.cpp index 99bf5d07bb48951d29a769b7cea87ea32f294553..c559a2ced9b34762d694f87badcedea7f4ac9fdf 100644 --- a/Mesh/3D_BGMesh.cpp +++ b/Mesh/3D_BGMesh.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_BGMesh.cpp,v 1.25 2004-02-07 01:40:21 geuzaine Exp $ +// $Id: 3D_BGMesh.cpp,v 1.26 2004-05-07 18:42:48 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -30,9 +30,6 @@ extern Mesh *THEM; extern Context_T CTX; -static Mesh m; -static double XX, YY, ZZ, D, LL; - void ExportLcFieldOnVolume(Mesh * M) { List_T *l = Tree2List(M->Volumes); @@ -87,6 +84,8 @@ void ExportLcFieldOnSurfaces(Mesh * M) fclose(f); } +static double XX, YY, ZZ, D, LL; + void findcloser(void *a, void *b) { Vertex *v; @@ -99,22 +98,24 @@ void findcloser(void *a, void *b) } } +static Mesh *TMPM = NULL; + void LCBGM(double X, double Y, double Z, double *l) { - if(Pt_In_Volume(X, Y, Z, &m, l, .01)); - else if(Pt_In_Volume(X, Y, Z, &m, l, .02)); - else if(Pt_In_Volume(X, Y, Z, &m, l, .07)); - else if(Pt_In_Volume(X, Y, Z, &m, l, .1)); - else if(Pt_In_Volume(X, Y, Z, &m, l, .2)); - else if(Pt_In_Volume(X, Y, Z, &m, l, .8)); - else if(Pt_In_Volume(X, Y, Z, &m, l, 20.)); + if(Pt_In_Volume(X, Y, Z, TMPM, l, .01)); + else if(Pt_In_Volume(X, Y, Z, TMPM, l, .02)); + else if(Pt_In_Volume(X, Y, Z, TMPM, l, .07)); + else if(Pt_In_Volume(X, Y, Z, TMPM, l, .1)); + else if(Pt_In_Volume(X, Y, Z, TMPM, l, .2)); + else if(Pt_In_Volume(X, Y, Z, TMPM, l, .8)); + else if(Pt_In_Volume(X, Y, Z, TMPM, l, 20.)); else { XX = X; YY = Y; ZZ = Z; D = 1.e24; LL = 1; - Tree_Action(m.Vertices, findcloser); + Tree_Action(TMPM->Vertices, findcloser); *l = LL; } } @@ -149,31 +150,37 @@ double Lc_XYZ(double X, double Y, double Z, Mesh * m) return CTX.mesh.lc_factor * l; } -static Tree_T *Pts; - static void AIG(void *a, void *b) { Simplex *s = *(Simplex **) a; - AddSimplexInGrid(&m, s, BOITE); + AddSimplexInGrid(TMPM, s, BOITE); } int BGMWithView(Post_View * ErrView) { - static Vertex *VertexUp, *v, V, *ver[4]; + Vertex *VertexUp, *v, V, *ver[4]; + Tree_T *Pts; int i, j, k, nb; double *X, *Y, *Z, *Val; Simplex *si; - VertexUp = Create_Vertex(-1, 0., 0., 1., 1., -1.0); - Pts = Tree_Create(sizeof(Vertex *), comparePosition); + if(TMPM){ + Tree_Action(TMPM->Vertices, Free_Vertex); + Tree_Action(TMPM->Simplexes, Free_Simplex); + Tree_Delete(TMPM->Vertices); + Tree_Delete(TMPM->Simplexes); + delete TMPM; + } - m.BGM.Typ = ONFILE; + Pts = Tree_Create(sizeof(Vertex *), comparePosition); + VertexUp = Create_Vertex(-1, 0., 0., 1., 1., -1.0); - m.Vertices = Tree_Create(sizeof(Vertex *), compareVertex); - m.Simplexes = Tree_Create(sizeof(Simplex *), compareSimplex); + TMPM = new Mesh; + TMPM->BGM.Typ = ONFILE; + TMPM->Vertices = Tree_Create(sizeof(Vertex *), compareVertex); + TMPM->Simplexes = Tree_Create(sizeof(Simplex *), compareSimplex); Create_BgMesh(ONFILE, .2, THEM); - k = 1; if(ErrView->NbST) { nb = List_Nbr(ErrView->ST) / ErrView->NbST; @@ -194,12 +201,12 @@ int BGMWithView(Post_View * ErrView) else { v = Create_Vertex(k++, X[j], Y[j], Z[j], Val[j], -1.0); ver[j] = v; - Tree_Add(m.Vertices, &v); + Tree_Add(TMPM->Vertices, &v); Tree_Add(Pts, &v); } } si = Create_Simplex(ver[0], ver[1], ver[2], VertexUp); - Tree_Add(m.Simplexes, &si); + Tree_Add(TMPM->Simplexes, &si); } } @@ -222,37 +229,39 @@ int BGMWithView(Post_View * ErrView) else { v = Create_Vertex(k++, X[j], Y[j], Z[j], Val[j], -1.0); ver[j] = v; - Tree_Add(m.Vertices, &v); + Tree_Add(TMPM->Vertices, &v); Tree_Add(Pts, &v); } } si = Create_Simplex(ver[0], ver[1], ver[2], ver[3]); - Tree_Add(m.Simplexes, &si); + Tree_Add(TMPM->Simplexes, &si); } } - m.Grid.init = 0; - m.Grid.Nx = 10; - m.Grid.Ny = 10; - m.Grid.Nz = 10; - Tree_Action(m.Vertices, findminmax); - getminmax(&m.Grid.min.X, &m.Grid.min.Y, &m.Grid.min.Z, - &m.Grid.max.X, &m.Grid.max.Y, &m.Grid.max.Z); - - if(m.Grid.max.Z == m.Grid.min.Z) { - m.Grid.Nz = 1; - Tree_Add(m.Vertices, &VertexUp); - Tree_Action(m.Vertices, findminmax); - getminmax(&m.Grid.min.X, &m.Grid.min.Y, &m.Grid.min.Z, - &m.Grid.max.X, &m.Grid.max.Y, &m.Grid.max.Z); + TMPM->Grid.init = 0; + TMPM->Grid.Nx = 10; + TMPM->Grid.Ny = 10; + TMPM->Grid.Nz = 10; + Tree_Action(TMPM->Vertices, findminmax); + getminmax(&TMPM->Grid.min.X, &TMPM->Grid.min.Y, &TMPM->Grid.min.Z, + &TMPM->Grid.max.X, &TMPM->Grid.max.Y, &TMPM->Grid.max.Z); + + if(TMPM->Grid.max.Z == TMPM->Grid.min.Z) { + TMPM->Grid.Nz = 1; + Tree_Add(TMPM->Vertices, &VertexUp); + Tree_Action(TMPM->Vertices, findminmax); + getminmax(&TMPM->Grid.min.X, &TMPM->Grid.min.Y, &TMPM->Grid.min.Z, + &TMPM->Grid.max.X, &TMPM->Grid.max.Y, &TMPM->Grid.max.Z); } - Tree_Action(m.Simplexes, AIG); + Tree_Action(TMPM->Simplexes, AIG); + + Tree_Delete(Pts); Msg(INFO, "Background mesh loaded (%d nodes, %d elements)", - Tree_Nbr(m.Vertices), Tree_Nbr(m.Simplexes)); + Tree_Nbr(TMPM->Vertices), Tree_Nbr(TMPM->Simplexes)); - return (1); + return 1; } diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index b84c3c8194744a3048c8a797d534fa12120def26..7872a9d55ee44e7cc8e974b7e98ccbf9a2cc18bc 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -1,4 +1,4 @@ -// $Id: Generator.cpp,v 1.51 2004-04-18 21:47:29 geuzaine Exp $ +// $Id: Generator.cpp,v 1.52 2004-05-07 18:42:48 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -218,9 +218,13 @@ void Init_Mesh(Mesh * M) List_Action(M->Partitions, Free_MeshPartition); List_Delete(M->Partitions); - if(M->Metric) { + if(M->Metric) delete M->Metric; - } + + List_Delete(M->BGM.bgm); + + if(M->Grid.init) + List_Delete(M->Grid.Bricks); M->Vertices = Tree_Create(sizeof(Vertex *), compareVertex); M->Simplexes = Tree_Create(sizeof(Simplex *), compareSimplex); @@ -234,6 +238,7 @@ void Init_Mesh(Mesh * M) M->Partitions = List_Create(5, 5, sizeof(MeshPartition *)); M->Metric = new GMSHMetric; M->BGM.bgm = NULL; + M->Grid.init = 0; M->status = 0; diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h index 83e155d8d86978dd69689a4d78f30aa507e94f3f..c733fe9addbf0f4ee7add4bc3100bc3dae3448c9 100644 --- a/Mesh/Mesh.h +++ b/Mesh/Mesh.h @@ -349,7 +349,6 @@ typedef struct _Mesh Mesh; typedef struct{ int Typ; double lc; - struct _Mesh *m; List_T *bgm; }LcField; diff --git a/Numeric/Numeric.cpp b/Numeric/Numeric.cpp index e9e3bd7d2ffc94bd4609e95e522af7a75c9f1f12..e9ef2ac750e6fc68b9a4ffa1c0341754ccc233ae 100644 --- a/Numeric/Numeric.cpp +++ b/Numeric/Numeric.cpp @@ -1,4 +1,4 @@ -// $Id: Numeric.cpp,v 1.14 2004-04-22 09:35:01 remacle Exp $ +// $Id: Numeric.cpp,v 1.15 2004-05-07 18:42:49 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -130,7 +130,7 @@ int sys2x2(double mat[2][2], double b[2], double res[2]) // TOLERANCE ! WARNING WARNING if(norm == 0.0 || fabs(det) / norm < 1.e-12) { if(norm) - Msg(WARNING, "Assuming 2x2 matrix is singular (det/norm == %g)", + Msg(INFO, "Assuming 2x2 matrix is singular (det/norm == %g)", fabs(det) / norm); res[0] = res[1] = 0.0; return 0; @@ -194,7 +194,7 @@ int sys3x3_with_tol(double mat[3][3], double b[3], double res[3], double *det) // TOLERANCE ! WARNING WARNING if(norm == 0.0 || fabs(*det) / norm < 1.e-12) { if(norm) - Msg(DEBUG, "Assuming 3x3 matrix is singular (det/norm == %g)", + Msg(INFO, "Assuming 3x3 matrix is singular (det/norm == %g)", fabs(*det) / norm); res[0] = res[1] = res[2] = 0.0; return 0; diff --git a/doc/VERSIONS b/doc/VERSIONS index 15a51099bf8e8a8844e3b88d2801b0870899e4f5..049af9b9b9bef2d6b5eaff17a9b0490a0ee8e363 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,4 +1,6 @@ -$Id: VERSIONS,v 1.199 2004-04-26 20:12:30 geuzaine Exp $ +$Id: VERSIONS,v 1.200 2004-05-07 18:42:49 geuzaine Exp $ + +New since 1.52: background mesh fixes; New in 1.52: new raster ("bitmap") PostScript/EPS/PDF output formats; new Plugin(Extract) to extract a given component from a