diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 1e6e50512fa5b93e2b552df39180d645885d638c..48dadea507ed4cadfab91edaafc231684aecc205 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -195,8 +195,8 @@ int ParseFile(std::string fileName, bool close, bool warnIfMissing) gmsh_yyviewindex = old_yyviewindex; #if defined(HAVE_FLTK) && defined(HAVE_POST) - if(FlGui::available() && numViewsBefore != (int)PView::list.size()) - FlGui::instance()->updateViews(); + if(FlGui::available()) + FlGui::instance()->updateViews(numViewsBefore != (int)PView::list.size()); #endif return 1; @@ -383,8 +383,8 @@ int MergeFile(std::string fileName, bool warnIfMissing) CTX::instance()->mesh.changed = ENT_ALL; #if defined(HAVE_FLTK) && defined(HAVE_POST) - if(FlGui::available() && numViewsBefore != (int)PView::list.size()) - FlGui::instance()->updateViews(); + if(FlGui::available()) + FlGui::instance()->updateViews(numViewsBefore != (int)PView::list.size()); #endif if(!status) Msg::Error("Error loading '%s'", fileName.c_str()); diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index 75d623b51355a66debb6ce16c994a79612005717..9a509bf2fd8a6e73482a7a2d888f54b130349eeb 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -654,17 +654,19 @@ void FlGui::setGraphicTitle(std::string title) } } -void FlGui::updateViews() +void FlGui::updateViews(bool numberOfViewsHasChanged) { for(unsigned int i = 0; i < graph.size(); i++) graph[i]->checkAnimButtons(); - if(menu->module->value() == 3) - menu->setContext(menu_post, 0); - options->resetBrowser(); - options->resetExternalViewList(); - fields->loadFieldViewList(); - plugins->resetViewBrowser(); - clipping->resetBrowser(); + if(numberOfViewsHasChanged){ + if(menu->module->value() == 3) + menu->setContext(menu_post, 0); + options->resetBrowser(); + options->resetExternalViewList(); + fields->loadFieldViewList(); + plugins->resetViewBrowser(); + clipping->resetBrowser(); + } } void FlGui::updateFields() diff --git a/Fltk/FlGui.h b/Fltk/FlGui.h index fa061f86abf5ef75b6ec10f90872a8b63ad27bc8..7da10e33a28d88e2d7ac54833b26d432063b122c 100644 --- a/Fltk/FlGui.h +++ b/Fltk/FlGui.h @@ -89,7 +89,7 @@ class FlGui{ // set the title of the graphic windows void setGraphicTitle(std::string title); // update the GUI when views get added or deleted - void updateViews(); + void updateViews(bool numberOfViewsHasChanged=true); // update the GUI when fields change void updateFields(); // reset the visibility window diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index fa931cccb88508635e6aabc4dd9f1e5f7053d700..a2642fb3dfbf0ba97ef82506080a940f8a0c318a 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -230,10 +230,20 @@ void status_play_manual(int time, int step) if(busy) return; busy = true; if(time) { - for(unsigned int i = 0; i < PView::list.size(); i++) - if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_timestep(i, GMSH_SET | GMSH_GUI, - opt_view_timestep(i, GMSH_GET, 0) + step); + for(unsigned int i = 0; i < PView::list.size(); i++){ + if(opt_view_visible(i, GMSH_GET, 0)){ + // skip any empty steps (useful when merging only some steps) + int newStep = (int)opt_view_timestep(i, GMSH_GET, 0) + step; + int totalSteps = (int)opt_view_nb_timestep(i, GMSH_GET, 0); + while(newStep < totalSteps){ + if(PView::list[i]->getData()->hasTimeStep(newStep)) + break; + else + newStep += step; + } + opt_view_timestep(i, GMSH_SET | GMSH_GUI, newStep); + } + } } else { // hide all views except view_in_cycle if(step > 0) { diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp index f96075937a5d1380cf732f261a021ca3588f5c50..43301490468304dea988bf82d74a84505f5ef859 100644 --- a/Fltk/solverWindow.cpp +++ b/Fltk/solverWindow.cpp @@ -226,8 +226,7 @@ void ConnectionManager::run(std::string args) { int n = PView::list.size(); PView::fillVertexArray(this, length, message, swap); - if(n != (int)PView::list.size()) - FlGui::instance()->updateViews(); + FlGui::instance()->updateViews(n != (int)PView::list.size()); drawContext::global()->draw(); } break; diff --git a/Solver/dgDofContainer.cpp b/Solver/dgDofContainer.cpp index 2b99c79fff2ba2e82e8836819c12f66874d00805..271b347ad601bb767e480453369f2b8a46646092 100644 --- a/Solver/dgDofContainer.cpp +++ b/Solver/dgDofContainer.cpp @@ -315,7 +315,7 @@ void dgDofContainer::exportMsh(const std::string name) fprintf(f,"1\n"); fprintf(f,"%d\n", _mshStep); // should print actual time here fprintf(f,"%d\n", Msg::GetCommSize() > 1 ? 4 : 3); - fprintf(f,"%d\n 1\n %d\n", 0/*_mshStep*/, COUNT); + fprintf(f,"%d\n 1\n %d\n", _mshStep, COUNT); if(Msg::GetCommSize() > 1) fprintf(f,"%d\n", Msg::GetCommRank()); for (int i=0;i < _groups.getNbElementGroups() ;i++){ dgGroupOfElements *group = _groups.getElementGroup(i);