From 59866e26d45c0bbe6e5a8574216321fa3c18de8a Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 30 Mar 2017 23:52:28 +0100 Subject: [PATCH] don't need "forceDestroy" anymore: synchronize takes care of business --- Geo/GeoStringInterface.cpp | 35 +++++++++++++++-------------------- Geo/GeoStringInterface.h | 7 +++---- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/Geo/GeoStringInterface.cpp b/Geo/GeoStringInterface.cpp index 123df5ecd0..223c4e3069 100644 --- a/Geo/GeoStringInterface.cpp +++ b/Geo/GeoStringInterface.cpp @@ -26,7 +26,7 @@ #include "onelab.h" #endif -void add_infile(const std::string &text, const std::string &fileName, bool forceDestroy) +void add_infile(const std::string &text, const std::string &fileName) { Msg::Debug("Adding `%s' to file `%s'", text.c_str(), fileName.c_str()); std::vector<std::string> split = SplitFileName(fileName); @@ -97,11 +97,6 @@ void add_infile(const std::string &text, const std::string &fileName, bool force gmshclose(gmsh_yyin); gmsh_yyin = gmsh_yyin_old; - if(forceDestroy){ - // we need to start from scratch (e.g. if the command just parsed - // could have deleted some entities) - GModel::current()->destroy(); - } GModel::current()->getGEOInternals()->synchronize(GModel::current()); if(GModel::current()->getOCCInternals()) GModel::current()->getOCCInternals()->synchronize(GModel::current()); @@ -159,11 +154,6 @@ void add_infile(const std::string &text, const std::string &fileName, bool force } } -void coherence(const std::string &fileName) -{ - add_infile("Coherence;", fileName, true); -} - static std::string list2string(List_T *list) { std::ostringstream sstream; @@ -176,13 +166,6 @@ static std::string list2string(List_T *list) return sstream.str(); } -void delet(List_T *list, const std::string &fileName, const std::string &what) -{ - std::ostringstream sstream; - sstream << "Delete {\n " << what << "{" << list2string(list) << "};\n}"; - add_infile(sstream.str(), fileName, true); -} - void add_charlength(List_T *list, const std::string &fileName, const std::string &lc) { std::ostringstream sstream; @@ -254,7 +237,7 @@ void add_embedded(const std::string &what, std::vector<int> &l, sstream << l[i]; } sstream << "} In Surface{" << l[0] << "};"; - add_infile(sstream.str(), fileName, true); + add_infile(sstream.str(), fileName); } void add_param(const std::string &par, const std::string &value, @@ -628,7 +611,7 @@ void split_edge(int edge_id, List_T *vertices, const std::string &fileName) { std::ostringstream sstream; sstream << "Split Line(" << edge_id << ") {" << list2string(vertices) << "};"; - add_infile(sstream.str(), fileName, true); + add_infile(sstream.str(), fileName); } void apply_boolean(const std::string &fileName, const std::string &op, @@ -655,3 +638,15 @@ void apply_boolean(const std::string &fileName, const std::string &op, sstream << "Delete; }"; add_infile(sstream.str(), fileName); } + +void coherence(const std::string &fileName) +{ + add_infile("Coherence;", fileName); +} + +void delet(List_T *list, const std::string &fileName, const std::string &what) +{ + std::ostringstream sstream; + sstream << "Delete {\n " << what << "{" << list2string(list) << "};\n}"; + add_infile(sstream.str(), fileName); +} diff --git a/Geo/GeoStringInterface.h b/Geo/GeoStringInterface.h index 435d7aac1f..c0db042bff 100644 --- a/Geo/GeoStringInterface.h +++ b/Geo/GeoStringInterface.h @@ -12,10 +12,7 @@ class GEntity; -void coherence(const std::string &fileName); -void delet(List_T *list, const std::string &fileName, const std::string &what); -void add_infile(const std::string &text, const std::string &fileName, - bool deleted_something=false); +void add_infile(const std::string &text, const std::string &fileName); void add_charlength(List_T *list, const std::string &fileName, const std::string &lc); void add_recosurf(List_T *list, const std::string &fileName); void add_trsfline(std::vector<int> &l, const std::string &fileName, @@ -105,5 +102,7 @@ void split_edge(int edge_id, List_T *vertices, const std::string &fileName); void apply_boolean(const std::string &fileName, const std::string &op, const std::vector<GEntity*> &object, const std::vector<GEntity*> &tool); +void coherence(const std::string &fileName); +void delet(List_T *list, const std::string &fileName, const std::string &what); #endif -- GitLab