From 4e6750e2fe509e4b188c640b82f92ebc67d33b0c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 6 Dec 2011 07:20:27 +0000 Subject: [PATCH] better rebuildTree --- Fltk/onelabWindow.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/Fltk/onelabWindow.cpp b/Fltk/onelabWindow.cpp index 34fe85e002..c8988cce8b 100644 --- a/Fltk/onelabWindow.cpp +++ b/Fltk/onelabWindow.cpp @@ -342,12 +342,11 @@ static void initializeLoop(std::string level) } } } - if(changed){ - // force this to make sure that we remesh, even if a mesh exists - // and we did not actually change a Gmsh parameter + + // force this to make sure that we remesh, even if a mesh exists and + // we did not actually change a Gmsh parameter + if(changed) onelab::server::instance()->setChanged(true, "Gmsh"); - FlGui::instance()->onelab->rebuildTree(); - } } static bool incrementLoop(std::string level) @@ -389,9 +388,6 @@ static bool incrementLoop(std::string level) if(loop && !recompute) // end of this loop level initializeLoop(level); - if(loop) - FlGui::instance()->onelab->rebuildTree(); - return recompute; } @@ -400,14 +396,22 @@ static void initializeLoop() initializeLoop("1"); initializeLoop("2"); initializeLoop("3"); + + if(onelab::server::instance()->getChanged()) + FlGui::instance()->onelab->rebuildTree(); } static bool incrementLoop() { - if(incrementLoop("3")) return true; - else if(incrementLoop("2")) return true; - else if(incrementLoop("1")) return true; - return false; + bool ret = false; + if(incrementLoop("3")) ret = true; + else if(incrementLoop("2")) ret = true; + else if(incrementLoop("1")) ret = true; + + if(onelab::server::instance()->getChanged()) + FlGui::instance()->onelab->rebuildTree(); + + return ret; } void onelab_cb(Fl_Widget *w, void *data) @@ -474,6 +478,7 @@ void onelab_cb(Fl_Widget *w, void *data) geometry_reload_cb(0, 0); if(FlGui::instance()->onelab->meshAuto()){ mesh_3d_cb(0, 0); + // FIXME: check if meshing succeeded CreateOutputFile(mshFileName, CTX::instance()->mesh.fileFormat); } } @@ -481,6 +486,7 @@ void onelab_cb(Fl_Widget *w, void *data) // mesh+save if the mesh file does not exist if(FlGui::instance()->onelab->meshAuto()){ mesh_3d_cb(0, 0); + // FIXME: check if meshing succeeded CreateOutputFile(mshFileName, CTX::instance()->mesh.fileFormat); } } @@ -512,12 +518,13 @@ void onelab_cb(Fl_Widget *w, void *data) } } + FlGui::instance()->onelab->rebuildTree(); + printf("Gmsh ONELAB db:\n%s\n", onelab::server::instance()->toChar().c_str()); } while(action == "compute" && incrementLoop()); FlGui::instance()->onelab->activate(); - FlGui::instance()->onelab->rebuildTree(); FlGui::instance()->onelab->show(); } -- GitLab