diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp index ee37940fd33a99a15417d07084e8e7feaf680992..935d53311e70cc2aea5a216c20441befa798810f 100644 --- a/Common/GmshMessage.cpp +++ b/Common/GmshMessage.cpp @@ -742,7 +742,7 @@ bool Msg::UseOnelab() } void Msg::SetOnelabNumber(std::string name, double val, bool visible, - bool persistent, bool readOnly) + bool persistent, bool readOnly, bool neverChanged) { #if defined(HAVE_ONELAB) if(_onelabClient){ @@ -756,13 +756,14 @@ void Msg::SetOnelabNumber(std::string name, double val, bool visible, numbers[0].setVisible(visible); if(persistent) numbers[0].setAttribute("Persistent", "1"); numbers[0].setReadOnly(readOnly); + numbers[0].setNeverChanged(neverChanged); _onelabClient->set(numbers[0]); } #endif } void Msg::SetOnelabString(std::string name, std::string val, bool visible, - bool persistent, bool readOnly) + bool persistent, bool readOnly, bool neverChanged) { #if defined(HAVE_ONELAB) if(_onelabClient){ @@ -776,6 +777,7 @@ void Msg::SetOnelabString(std::string name, std::string val, bool visible, strings[0].setVisible(visible); if(persistent) strings[0].setAttribute("Persistent", "1"); strings[0].setReadOnly(readOnly); + strings[0].setNeverChanged(neverChanged); _onelabClient->set(strings[0]); } #endif diff --git a/Common/GmshMessage.h b/Common/GmshMessage.h index 3f5550c2e484e7dde07c9603d29ffc3f7b6a0259..4f13a6dc245b54bdecd41dbe93f60ad2c82f3b75 100644 --- a/Common/GmshMessage.h +++ b/Common/GmshMessage.h @@ -117,9 +117,11 @@ class Msg { static void FinalizeOnelab(); static bool UseOnelab(); static void SetOnelabNumber(std::string name, double val, bool visible=true, - bool persistent=false, bool readOnly=false); + bool persistent=false, bool readOnly=false, + bool neverChanged=false); static void SetOnelabString(std::string name, std::string val, bool visible=true, - bool persistent=false, bool readOnly=false); + bool persistent=false, bool readOnly=false, + bool neverChanged=false); static double GetOnelabNumber(std::string name, double defaultValue=0., bool errorIfMissing=false); static std::string GetOnelabString(std::string name, const std::string &defaultValue="", diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index bec1b6d8ac8e599cea7bd5c031e6814ac1cc3640..5726a2c7fc31f520694083bb7645f6abf0dea8d3 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -291,7 +291,8 @@ static int defineSolver(const std::string &name) return NUM_SOLVERS - 1; } -int MergeFile(const std::string &fileName, bool warnIfMissing, bool setBoundingBox) +int MergeFile(const std::string &fileName, bool warnIfMissing, bool setBoundingBox, + bool importPhysicalsInOnelab) { // added 'b' for pure Windows programs, since some of these files // contain binary data @@ -508,7 +509,7 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setBoundingB CTX::instance()->geom.draw = 1; CTX::instance()->mesh.changed = ENT_ALL; - Msg::ImportPhysicalGroupsInOnelab(); + if(importPhysicalsInOnelab) Msg::ImportPhysicalGroupsInOnelab(); #if defined(HAVE_FLTK) && defined(HAVE_POST) if(FlGui::available()){ @@ -575,7 +576,10 @@ int MergePostProcessingFile(const std::string &fileName, int showViews, GModel *m = new GModel(); GModel::setCurrent(m); } - int ret = MergeFile(fileName, warnIfMissing, old->bounds().empty() ? true : false); + // FIXME: disabled onelab physical group import for now, as the number of + // groups in mesh-bases post-pro files can be different from the # in the + // model, which will trigger setChanged(Gmsh), leading undesirable remeshing + int ret = MergeFile(fileName, warnIfMissing, old->bounds().empty() ? true : false, false); GModel::setCurrent(old); old->setVisibility(1); diff --git a/Common/OpenFile.h b/Common/OpenFile.h index 4a4ada89798e1d928009fb2529f3c89d259e4c8f..2d4908d655737c2617f0b43ea7d241d65e57b08e 100644 --- a/Common/OpenFile.h +++ b/Common/OpenFile.h @@ -13,7 +13,7 @@ void ParseString(const std::string &str, bool inCurrentModelDir=false); void OpenProject(const std::string &filename); void OpenProjectMacFinder(const char *fileName); int MergeFile(const std::string &fileName, bool warnIfMissing=false, - bool setBoundingBox=true); + bool setBoundingBox=true, bool importPhysicalsInOnelab=true); int MergePostProcessingFile(const std::string &fileName, int showViews=2, bool showLastStep=false, bool warnIfMissing=false); void ClearProject(); diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index b7f751eaeb2c909f12e8d78a32da6787bbf431fc..c3bbcf902223147ed2603fa2e5ed768893761950 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -122,7 +122,7 @@ void GModel::setFileName(std::string fileName) { _fileName = fileName; _fileNames.insert(fileName); - Msg::SetOnelabString("Gmsh/Model name", fileName, false, false, true); + Msg::SetOnelabString("Gmsh/Model name", fileName, false, false, true, true); Msg::SetWindowTitle(fileName); }