From 5e945363ed67d13d01ae9d4512c0bb12dcbd5889 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 20 Jul 2008 21:25:27 +0000 Subject: [PATCH] - set default verbosity to 4 (-v 3 will ewmove the statu msg that can slow things down when you have many many surfaces) - fix out of bound acces in transfinite callback when selecting > 100 entities --- Common/DefaultOptions.h | 2 +- Common/Message.cpp | 4 ++-- Common/OpenFile.cpp | 4 ++-- Fltk/Callbacks.cpp | 43 ++++++++++++++++++------------------ benchmarks/misc/bgmesh3d.geo | 19 ++++++---------- 5 files changed, 33 insertions(+), 39 deletions(-) diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 6c1ae54057..2c51f1716c 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -784,7 +784,7 @@ StringXNumber GeneralOptions_Number[] = { { F|O, "VectorType" , opt_general_vector_type , 4 , "Default vector display type (for normals, etc.)" }, - { F|O, "Verbosity" , opt_general_verbosity , 3. , + { F|O, "Verbosity" , opt_general_verbosity , 4. , "Level of information printed during processing (0=no information)" }, { F|S, "VisibilityPositionX" , opt_general_visibility_position0 , 650. , "Horizontal position (in pixels) of the upper left corner of the visibility window" }, diff --git a/Common/Message.cpp b/Common/Message.cpp index 173a33bef1..0e782aa017 100644 --- a/Common/Message.cpp +++ b/Common/Message.cpp @@ -26,7 +26,7 @@ extern Context_T CTX; int Message::_commRank = 0; int Message::_commSize = 1; -int Message::_verbosity = 3; +int Message::_verbosity = 4; int Message::_progressMeterStep = 10; int Message::_progressMeterCurrent = 0; std::map<std::string, double> Message::_timers; @@ -289,7 +289,7 @@ void Message::Direct(int level, const char *fmt, ...) void Message::StatusBar(int num, bool log, const char *fmt, ...) { - if(_commRank || _verbosity < 3) return; + if(_commRank || _verbosity < 4) return; if(num < 1 || num > 3) return; char str[1024]; diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 548d4900e9..61ee997bfc 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -314,14 +314,14 @@ int MergeFile(const char *name, int warn_if_missing) else if(!strcmp(ext, ".mesh") || !strcmp(ext, ".MESH")){ status = m->readMESH(name); } -#if !defined(HAVE_NO_POST) else if(!strcmp(ext, ".med") || !strcmp(ext, ".MED") || !strcmp(ext, ".mmed") || !strcmp(ext, ".MMED") || !strcmp(ext, ".rmed") || !strcmp(ext, ".RMED")){ status = GModel::readMED(name); +#if !defined(HAVE_NO_POST) if(status > 1) status = PView::readMED(name); - } #endif + } else if(!strcmp(ext, ".bdf") || !strcmp(ext, ".BDF") || !strcmp(ext, ".nas") || !strcmp(ext, ".NAS")){ status = m->readBDF(name); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 46392a0e36..88608ef0b0 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -3782,8 +3782,8 @@ static void _add_transfinite(int dim) std::vector<GFace*> faces; std::vector<GRegion*> regions; std::vector<MElement*> elements; + std::vector<int> p; char ib; - int p[100]; opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); switch (dim) { @@ -3793,11 +3793,10 @@ static void _add_transfinite(int dim) } Draw(); - int n = 0; while(1) { switch (dim) { case 1: - if(n == 0) + if(p.empty()) Msg::StatusBar(3, false, "Select lines\n" "[Press 'e' to end selection or 'q' to abort]"); else @@ -3820,22 +3819,22 @@ static void _add_transfinite(int dim) if(ib == 'e') { if(dim == 1) { - if(n > 0) - add_trsfline(n, p, CTX.filename, + if(p.size()) + add_trsfline(p.size(), &p[0], CTX.filename, WID->context_mesh_choice[0]->text(), WID->context_mesh_input[2]->value(), WID->context_mesh_input[1]->value()); } ZeroHighlight(); Draw(); - n = 0; + p.clear(); } if(ib == 'u') { if(dim == 1) { - if(n > 0){ - ZeroHighlightEntityNum(0, p[n-1], 0, 0); + if(p.size()){ + ZeroHighlightEntityNum(0, p.back(), 0, 0); Draw(); - n--; + p.pop_back(); } } } @@ -3852,7 +3851,7 @@ static void _add_transfinite(int dim) case 1: for(unsigned int i = 0; i < edges.size(); i++){ HighlightEntity(edges[i]); - p[n++] = edges[i]->tag(); + p.push_back(edges[i]->tag()); } Draw(); break; @@ -3861,15 +3860,15 @@ static void _add_transfinite(int dim) if(dim == 2){ HighlightEntity(faces[0]); Draw(); - p[n++] = faces[0]->tag(); + p.push_back(faces[0]->tag()); } else{ HighlightEntity(regions[0]); Draw(); - p[n++] = regions[0]->tag(); + p.push_back(regions[0]->tag()); } while(1) { - if(n == 1) + if(p.size() == 1) Msg::StatusBar(3, false, "Select (ordered) boundary points\n" "[Press 'e' to end selection or 'q' to abort]"); else @@ -3879,13 +3878,13 @@ static void _add_transfinite(int dim) if(ib == 'l') { HighlightEntity(vertices[0]); Draw(); - p[n++] = vertices[0]->tag(); + p.push_back(vertices[0]->tag()); } if(ib == 'u') { - if(n > 1){ - ZeroHighlightEntityNum(p[n-1], 0, 0, 0); + if(p.size() > 1){ + ZeroHighlightEntityNum(p.back(), 0, 0, 0); Draw(); - n--; + p.pop_back(); } } if(ib == 'r') { @@ -3894,22 +3893,22 @@ static void _add_transfinite(int dim) if(ib == 'e') { switch (dim) { case 2: - if(n == 3 + 1 || n == 4 + 1) - add_trsfsurf(n, p, CTX.filename, + if(p.size() == 3 + 1 || p.size() == 4 + 1) + add_trsfsurf(p.size(), &p[0], CTX.filename, WID->context_mesh_choice[1]->text()); else Msg::Error("Wrong number of points for transfinite surface"); break; case 3: - if(n == 6 + 1 || n == 8 + 1) - add_trsfvol(n, p, CTX.filename); + if(p.size() == 6 + 1 || p.size() == 8 + 1) + add_trsfvol(p.size(), &p[0], CTX.filename); else Msg::Error("Wrong number of points for transfinite volume"); break; } ZeroHighlight(); Draw(); - n = 0; + p.clear(); break; } if(ib == 'q') { diff --git a/benchmarks/misc/bgmesh3d.geo b/benchmarks/misc/bgmesh3d.geo index 9cb272c4be..802ae273ef 100644 --- a/benchmarks/misc/bgmesh3d.geo +++ b/benchmarks/misc/bgmesh3d.geo @@ -1,10 +1,5 @@ - -// This shows that background meshes in 3D don't actually work: -// The mesh is refined close to the surfaces, but not in the middle of -// the volume... - // cube geometry -lc = 0.1; +lc = 1; Point(1) = {0.0,0.0,0.0,lc}; Point(2) = {1,0.0,0.0,lc}; Point(3) = {1,1,0.0,lc}; @@ -15,15 +10,15 @@ Line(3) = {2,1}; Line(4) = {1,4}; Line Loop(5) = {2,3,4,1}; Plane Surface(6) = {5}; -a[] = Extrude {0,0.0,0.5} { Surface{6}; }; -a[] = Extrude {0,0.0,0.5} { Surface{a[0]}; }; +Extrude {0,0.0,1} { Surface{6}; } // background mesh built by hand -h=0.1; -For x In {0:1-h:h} -For y In {0:1-h:h} -For z In {0:1-h:h} +eps=1.e-6; +h=0.1+eps; +For x In {0:1-eps:h} +For y In {0:1-eps:h} +For z In {0:1-eps:h} View "bgm" { SH(x,y,z, x+h,y,z, x+h,y+h,z, x,y+h,z, x,y,z+h, x+h,y,z+h, x+h,y+h,z+h, x,y+h,z+h) {1,1,1,1,1,1,1,1}; -- GitLab