From 0bc08887af4a8753a43ea94cd41c7471e078365c Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 7 May 2014 16:37:41 +0000
Subject: [PATCH] Solver.AutoMesh = 2 will not try to be clever on startup, and
 always remesh when the DB has changed

---
 Common/DefaultOptions.h | 3 ++-
 Common/onelabUtils.cpp  | 4 ++--
 Common/onelabUtils.h    | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 4fd4a7b80f..59594c3e8f 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1210,7 +1210,8 @@ StringXNumber SolverOptions_Number[] = {
   { F|O, "AutoSaveDatabase" , opt_solver_auto_save_database , 0. ,
     "Automatically save database after each computation" },
   { F|O, "AutoMesh" , opt_solver_auto_mesh , 1. ,
-    "Automatically mesh if necesssary" },
+    "Automatically mesh if necesssary (0: never remesh; 1: on startup, use existing "
+    "mesh on disk if available; 2: always remesh)" },
   { F|O, "AutoMergeFile" , opt_solver_auto_merge_file , 1. ,
     "Automatically merge result files" },
   { F|O, "AutoShowViews" , opt_solver_auto_show_views , 2. ,
diff --git a/Common/onelabUtils.cpp b/Common/onelabUtils.cpp
index 8b45848dfe..346b2cace1 100644
--- a/Common/onelabUtils.cpp
+++ b/Common/onelabUtils.cpp
@@ -291,7 +291,7 @@ namespace onelabUtils {
   void setFirstComputationFlag(bool val){ _firstComputation = val; }
   bool getFirstComputationFlag(){ return _firstComputation; }
 
-  bool runGmshClient(const std::string &action, bool meshAuto)
+  bool runGmshClient(const std::string &action, int meshAuto)
   {
     bool redraw = false;
 
@@ -330,7 +330,7 @@ namespace onelabUtils {
         modelName = GModel::current()->getName();
         redraw = true;
         OpenProject(GModel::current()->getFileName(), false);
-        if(getFirstComputationFlag() && !StatFile(mshFileName)){
+        if(getFirstComputationFlag() && !StatFile(mshFileName) && meshAuto != 2){
           Msg::Info("Skipping mesh generation: assuming '%s' is up-to-date",
                     mshFileName.c_str());
         }
diff --git a/Common/onelabUtils.h b/Common/onelabUtils.h
index 5ddc9c7979..9f77c34646 100644
--- a/Common/onelabUtils.h
+++ b/Common/onelabUtils.h
@@ -19,7 +19,7 @@ namespace onelabUtils {
   bool incrementLoop(const std::string &level);
   std::vector<double> getRange(onelab::number &p);
   bool updateGraph(const std::string &graphNum);
-  bool runGmshClient(const std::string &action, bool meshAuto);
+  bool runGmshClient(const std::string &action, int meshAuto);
   bool getFirstComputationFlag();
   void setFirstComputationFlag(bool val);
 
-- 
GitLab