getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] (no subject)


From: Konstantinos Poulios
Subject: [Getfem-commits] (no subject)
Date: Fri, 22 Feb 2019 07:32:13 -0500 (EST)

branch: master
commit 290b60480e25c83403d6c52ba44d68bb7f914283
Author: Konstantinos Poulios <address@hidden>
Date:   Fri Feb 22 13:32:06 2019 +0100

    Interface simplification
---
 src/getfem/getfem_models.h |  5 +----
 src/getfem_models.cc       | 21 ++++++++-------------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/getfem/getfem_models.h b/src/getfem/getfem_models.h
index 9beffd0..31c0023 100644
--- a/src/getfem/getfem_models.h
+++ b/src/getfem/getfem_models.h
@@ -507,14 +507,11 @@ namespace getfem {
       active_bricks.add(ib);
     }
 
-    /** Set is_disable of a variable (and its attached mutlipliers). */
-    inline void set_is_disabled_of_variable(const std::string &name, bool 
flag);
-
     /** Disable a variable (and its attached mutlipliers). */
     void disable_variable(const std::string &name);
 
     /** Enable a variable (and its attached mutlipliers). */
-    void enable_variable(const std::string &name);
+    void enable_variable(const std::string &name, bool enabled=true);
 
     /** States if a name corresponds to a declared variable. */
     bool variable_exists(const std::string &name) const;
diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index efd65e0..19bb092 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -860,32 +860,27 @@ namespace getfem {
     add_dependency(mf);
   }
 
-  inline void model::set_is_disabled_of_variable(const std::string &name,
-                                                 bool flag) {
+  void model::disable_variable(const std::string &name) {
+    enable_variable(name, false);
+  }
+
+  void model::enable_variable(const std::string &name, bool enabled) {
     VAR_SET::iterator it = variables.find(name);
     GMM_ASSERT1(it != variables.end(), "Undefined variable " << name);
-    it->second.is_disabled = flag;
+    it->second.is_disabled = !enabled;
     for (auto &&v : variables) {
       if (((v.second.filter & VDESCRFILTER_INFSUP) ||
            (v.second.filter & VDESCRFILTER_CTERM))
           && name.compare(v.second.filter_var) == 0) {
-        v.second.is_disabled = flag;
+        v.second.is_disabled = !enabled;
       }
       if (v.second.is_variable && v.second.is_affine_dependent
           && name.compare(v.second.org_name) == 0)
-        v.second.is_disabled = flag;
+        v.second.is_disabled = !enabled;
     }
     if (!act_size_to_be_done) resize_global_system();
   }
 
-  void model::disable_variable(const std::string &name) {
-    set_is_disabled_of_variable(name, true);
-  }
-
-  void model::enable_variable(const std::string &name) {
-    set_is_disabled_of_variable(name, false);
-  }
-
   bool model::variable_exists(const std::string &name) const {
     return variables.count(no_old_prefix_name(name)) > 0;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]