diff --git a/Box/Main.cpp b/Box/Main.cpp index a2eea209d1446ab2aa7649ee04c9b9508f35bc4a..b149c4a071741136be0831bd7de3dd77c53bacd7 100644 --- a/Box/Main.cpp +++ b/Box/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.48 2005-04-04 18:19:49 geuzaine Exp $ +// $Id: Main.cpp,v 1.49 2005-05-21 04:55:59 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -91,19 +91,7 @@ int main(int argc, char *argv[]) if(argc < 2) Info(0, argv[0]); - M.Vertices = NULL; - M.Simplexes = NULL; - M.Points = NULL; - M.Curves = NULL; - M.SurfaceLoops = NULL; - M.EdgeLoops = NULL; - M.Surfaces = NULL; - M.Volumes = NULL; - M.PhysicalGroups = NULL; - M.Partitions = NULL; - M.Metric = NULL; - M.BGM.bgm = NULL; - M.Grid.init = 0; + Init_Mesh0(&M); signal(SIGINT, Signal); signal(SIGSEGV, Signal); diff --git a/Common/Options.cpp b/Common/Options.cpp index a1141ab70020f361092370435d9b2858ed3e261d..6801433afe9275c2aef836659d80e2ac21c85ec2 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.242 2005-04-28 14:53:12 geuzaine Exp $ +// $Id: Options.cpp,v 1.243 2005-05-21 04:55:59 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -4095,6 +4095,7 @@ double opt_mesh_points(OPT_ARGS_NUM) double opt_mesh_lines(OPT_ARGS_NUM) { if(action & GMSH_SET) { + if(CTX.mesh.lines != val) CTX.mesh.changed = 1; CTX.mesh.lines = (int)val; } #if defined(HAVE_FLTK) diff --git a/Common/VertexArray.cpp b/Common/VertexArray.cpp index 3a42d4ab1a83d17e33d983786cfde868cdbbe8c4..bf906f66c3bb583964bc88e722b0a2aa9230964f 100644 --- a/Common/VertexArray.cpp +++ b/Common/VertexArray.cpp @@ -1,4 +1,4 @@ -// $Id: VertexArray.cpp,v 1.5 2005-05-21 01:10:46 geuzaine Exp $ +// $Id: VertexArray.cpp,v 1.6 2005-05-21 04:55:59 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -27,8 +27,8 @@ VertexArray::VertexArray(int numNodesPerElement, int numElements) { type = numNodesPerElement; - if(type != 2 && type != 3 && type != 4){ - Msg(GERROR, "Vertex arrays should only contain lines, triangles or quadrangles"); + if(type < 1 || type > 4){ + Msg(GERROR, "Vertex arrays not done for %d-node element", type); type = 3; } num = fill = 0; diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index 0edb2d55d23741d79d65b0c61bfba2752d5f7d2b..2998a7ffe98b48221b3faaaa3189e49d7b34a439 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.77 2005-04-19 16:03:10 remacle Exp $ +// $Id: Main.cpp,v 1.78 2005-05-21 04:55:59 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -72,22 +72,8 @@ int main(int argc, char *argv[]) Init_Options(0); // Initialize the static Mesh - - M.bds = 0; - M.bds_mesh = 0; - M.Vertices = NULL; - M.Simplexes = NULL; - M.Points = NULL; - M.Curves = NULL; - M.SurfaceLoops = NULL; - M.EdgeLoops = NULL; - M.Surfaces = NULL; - M.Volumes = NULL; - M.PhysicalGroups = NULL; - M.Partitions = NULL; - M.Metric = NULL; - M.BGM.bgm = NULL; - M.Grid.init = 0; + + Init_Mesh0(&M); // Generate automatic documentation (before getting user-defined options) diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index abafe8d1c8d49025e1f3a571dcf1ff602da498f2..57680a211a6d62c72f669c0bdbe62d45ca7c626f 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.126 2005-05-21 01:10:47 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.127 2005-05-21 04:55:59 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -239,13 +239,17 @@ void Draw_Mesh(Mesh * M) glEnable((GLenum)(GL_CLIP_PLANE0 + i)); else glDisable((GLenum)(GL_CLIP_PLANE0 + i)); - + + // Dimension 3 + if(M->status >= 3 && (CTX.mesh.volumes_faces || CTX.mesh.volumes_edges || CTX.mesh.volumes_num || CTX.mesh.points_per_element || (CTX.mesh.use_cut_plane && CTX.mesh.cut_plane_as_surface && (CTX.mesh.surfaces_edges || CTX.mesh.surfaces_faces)))) { Tree_Action(M->Volumes, Draw_Mesh_Volume); } + + // Dimension 2 if(M->status >= 2 && (CTX.mesh.surfaces_faces || CTX.mesh.surfaces_edges || CTX.mesh.surfaces_num || CTX.mesh.points_per_element || @@ -255,15 +259,22 @@ void Draw_Mesh(Mesh * M) Tree_Action(M->Volumes, Draw_Mesh_Extruded_Surfaces); } + // Dimension 1 + if(M->status >= 1 && (CTX.mesh.lines || CTX.mesh.lines_num || CTX.mesh.points_per_element || CTX.mesh.tangents)) { Tree_Action(M->Curves, Draw_Mesh_Curve); } + + // Dimension 0 if(M->status >= 0 && !CTX.mesh.points_per_element && (CTX.mesh.points || CTX.mesh.points_num)) { Tree_Action(M->Vertices, Draw_Mesh_Point); } + + // Done! + CTX.mesh.changed = 0; for(int i = 0; i < 6; i++) @@ -466,10 +477,13 @@ void Draw_Mesh_Point(int num, double x, double y, double z, int degree, int visi if(!(visible & VIS_MESH)) return; + unsigned int col; if(degree == 2) - glColor4ubv((GLubyte *) & CTX.color.mesh.vertex_deg2); + col = CTX.color.mesh.vertex_deg2; else - glColor4ubv((GLubyte *) & CTX.color.mesh.vertex); + col = CTX.color.mesh.vertex; + + glColor4ubv((GLubyte *) & col); if(CTX.mesh.points) { if(CTX.mesh.point_type) { @@ -745,7 +759,11 @@ void Draw_Mesh_Array(VertexArray *va, int faces, int edges) glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); - if(va->type == 2){ + if(va->type == 1){ + glDisableClientState(GL_NORMAL_ARRAY); + glDrawArrays(GL_POINTS, 0, va->type * va->num); + } + else if(va->type == 2){ glDisableClientState(GL_NORMAL_ARRAY); glDrawArrays(GL_LINES, 0, va->type * va->num); } diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index b693c6bf9e6779f228c296e0d482427bb8a6e5cb..2c75047b2078e7a300b442fc6dbf4dc920b4b75c 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -1,4 +1,4 @@ -// $Id: Generator.cpp,v 1.64 2005-04-19 16:03:10 remacle Exp $ +// $Id: Generator.cpp,v 1.65 2005-05-21 04:55:59 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -302,6 +302,24 @@ void Maillage_Dimension_3(Mesh * M) M->timing[2] = t2 - t1; } +void Init_Mesh0(Mesh * M) +{ + M->bds = 0; + M->bds_mesh = 0; + M->Vertices = NULL; + M->Simplexes = NULL; + M->Points = NULL; + M->Curves = NULL; + M->SurfaceLoops = NULL; + M->EdgeLoops = NULL; + M->Surfaces = NULL; + M->Volumes = NULL; + M->PhysicalGroups = NULL; + M->Partitions = NULL; + M->Metric = NULL; + M->BGM.bgm = NULL; + M->Grid.init = 0; +} void Init_Mesh(Mesh * M) { @@ -314,13 +332,14 @@ void Init_Mesh(Mesh * M) M->MaxSurfaceLoopNum = 0; M->MaxVolumeNum = 0; M->MaxPhysicalNum = 0; - if (M->bds)delete M->bds; - M->bds = 0; Element::TotalNumber = 0; ExitExtrude(); + if(M->bds) delete M->bds; + M->bds = 0; + Tree_Action(M->Vertices, Free_Vertex); Tree_Delete(M->Vertices); @@ -335,10 +354,10 @@ void Init_Mesh(Mesh * M) Tree_Action(M->Curves, Free_Curve); Tree_Delete(M->Curves); - Tree_Action (M->SurfaceLoops, Free_SurfaceLoop); + Tree_Action(M->SurfaceLoops, Free_SurfaceLoop); Tree_Delete(M->SurfaceLoops); - Tree_Action (M->EdgeLoops, Free_EdgeLoop); + Tree_Action(M->EdgeLoops, Free_EdgeLoop); Tree_Delete(M->EdgeLoops); Tree_Action(M->Surfaces, Free_Surface); diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h index 027816b18a2d5517c6237a6e9b4f1ba9cefb5fe2..1b4ea14247763627b1d1b52ac0dd5f0278906e08 100644 --- a/Mesh/Mesh.h +++ b/Mesh/Mesh.h @@ -440,6 +440,7 @@ struct Map{ void mai3d(Mesh *M, int Asked); +void Init_Mesh0(Mesh *M); void Init_Mesh(Mesh *M); void Create_BgMesh(int i, double d, Mesh *m); void Print_Geo(Mesh *M, char *c, int discrete_curve=0, int discrete_surface=0); diff --git a/Plugin/StructuralSolver.cpp b/Plugin/StructuralSolver.cpp index 8d2fda795a1ae44a23599f4a1288876c7f49bcba..a6beb2f52a04216146a1df156d81bf7b4e7ff163 100644 --- a/Plugin/StructuralSolver.cpp +++ b/Plugin/StructuralSolver.cpp @@ -31,19 +31,8 @@ Structural_BeamSection:: Structural_BeamSection( const char *direct, std::string : name (_name) { Mesh *kk = THEM; - m.Vertices = NULL; - m.Simplexes = NULL; - m.Points = NULL; - m.Curves = NULL; - m.SurfaceLoops = NULL; - m.EdgeLoops = NULL; - m.Surfaces = NULL; - m.Volumes = NULL; - m.PhysicalGroups = NULL; - m.Partitions = NULL; - m.Metric = NULL; - m.BGM.bgm = NULL; - m.Grid.init = 0; + + Init_Mesh0(&m); Init_Mesh(&m); // THEM=&m;