Skip to content
Snippets Groups Projects
Commit f3f10a77 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better remeshing logic (trying to use existing initial mesh if it exists)

parent aa2c2bbb
No related branches found
No related tags found
No related merge requests found
...@@ -342,8 +342,12 @@ static void initializeLoop(std::string level) ...@@ -342,8 +342,12 @@ static void initializeLoop(std::string level)
} }
} }
} }
if(changed) if(changed){
// force this to make sure that we remesh, even if a mesh exists
// and we did not actually change a Gmsh parameter
onelab::server::instance()->setChanged(true, "Gmsh");
FlGui::instance()->onelab->rebuildTree(); FlGui::instance()->onelab->rebuildTree();
}
} }
static bool incrementLoop(std::string level) static bool incrementLoop(std::string level)
...@@ -355,6 +359,9 @@ static bool incrementLoop(std::string level) ...@@ -355,6 +359,9 @@ static bool incrementLoop(std::string level)
if(numbers[i].getAttribute("loop") == level){ if(numbers[i].getAttribute("loop") == level){
loop = true; loop = true;
if(numbers[i].getChoices().size() > 1){ if(numbers[i].getChoices().size() > 1){
// FIXME should store loopVariable attribute in the parameter
// -- the following test will loop forever if 2 values are
// identical in the list of choices
std::vector<double> choices(numbers[i].getChoices()); std::vector<double> choices(numbers[i].getChoices());
for(unsigned int j = 0; j < choices.size() - 1; j++){ for(unsigned int j = 0; j < choices.size() - 1; j++){
if(numbers[i].getValue() == choices[j]){ if(numbers[i].getValue() == choices[j]){
...@@ -440,7 +447,14 @@ void onelab_cb(Fl_Widget *w, void *data) ...@@ -440,7 +447,14 @@ void onelab_cb(Fl_Widget *w, void *data)
if(it != onelab::server::instance()->lastClient()){ if(it != onelab::server::instance()->lastClient()){
onelab::client *c = it->second; onelab::client *c = it->second;
std::string mshFileName = getMshFileName(c); std::string mshFileName = getMshFileName(c);
static std::string modelName = GModel::current()->getName(); static std::string modelName = "";
if(modelName.empty()){
// first pass is special to prevent model reload, as well as
// remeshing if a mesh file already exists on disk
modelName = GModel::current()->getName();
if(!StatFile(mshFileName))
onelab::server::instance()->setChanged(false, "Gmsh");
}
if(action == "check"){ if(action == "check"){
if(onelab::server::instance()->getChanged("Gmsh") || if(onelab::server::instance()->getChanged("Gmsh") ||
modelName != GModel::current()->getName()){ modelName != GModel::current()->getName()){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment