From 055a6f0c462b0f177538b52ee06b868b332dc7fd Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 16 Dec 2006 13:58:24 +0000 Subject: [PATCH] change the logic in GenerateMesh(): - never reload the model file--we don't need this trick anymore! - always only generate the mesh we are asked to generate (pressing "1D" should *always* mesh the edges; pressing "2D" should only mesh the surfaces, unless there is no 1D mesh). This makes the behavour much more predictable when changing mesh attributes interactively. --- Mesh/Generator.cpp | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 6ee6df3b9f..f2cb5e7b21 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -1,4 +1,4 @@ -// $Id: Generator.cpp,v 1.108 2006-11-27 22:22:16 geuzaine Exp $ +// $Id: Generator.cpp,v 1.109 2006-12-16 13:58:24 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -22,7 +22,6 @@ #include "Gmsh.h" #include "Numeric.h" #include "Context.h" -#include "OpenFile.h" #include "Views.h" #include "OS.h" #include "meshGEdge.h" @@ -241,41 +240,32 @@ void GenerateMesh(int ask) Msg(INFO, "I'm busy! Ask me that later..."); return; } + CTX.threads_lock = 1; int old = GMODEL->getMeshStatus(); - // Re-read data - if((ask > old && ask >= 0 && old < 0) || (ask < old)) - OpenProblem(CTX.filename); - - CTX.threads_lock = 1; - // Change any high order elements back into first order ones Degre1(); // 1D mesh - if((ask > old && ask > 0 && old < 1) || (ask < old && ask > 0)) { + if(ask == 1 || (ask > 1 && old < 1)) { Msg(STATUS1, "Meshing 1D..."); - if(GMODEL->getMeshStatus() > 1){ - OpenProblem(CTX.filename); - } + std::for_each(GMODEL->firstFace(), GMODEL->lastFace(), deMeshGFace()); + std::for_each(GMODEL->firstRegion(), GMODEL->lastRegion(), deMeshGRegion()); Mesh1D(); Msg(INFO, "Mesh 1D complete (%g s)", CTX.mesh_timer[0]); } // 2D mesh - if((ask > old && ask > 1 && old < 2) || (ask < old && ask > 1)) { + if(ask == 2 || (ask > 2 && old < 2)) { Msg(STATUS1, "Meshing 2D..."); - if(GMODEL->getMeshStatus() > 2) { - OpenProblem(CTX.filename); - Mesh1D(); - } + std::for_each(GMODEL->firstRegion(), GMODEL->lastRegion(), deMeshGRegion()); Mesh2D(); Msg(INFO, "Mesh 2D complete (%g s)", CTX.mesh_timer[1]); } // 3D mesh - if((ask > old && ask > 2 && old < 3) || (ask < old && ask > 2)) { + if(ask == 3) { Msg(STATUS1, "Meshing 3D..."); Mesh3D(); Msg(INFO, "Mesh 3D complete (%g s)", CTX.mesh_timer[2]); -- GitLab