getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] r5414 - /trunk/getfem/src/getfem_models.cc


From: andriy . andreykiv
Subject: [Getfem-commits] r5414 - /trunk/getfem/src/getfem_models.cc
Date: Wed, 12 Oct 2016 16:47:27 -0000

Author: andrico
Date: Wed Oct 12 18:47:26 2016
New Revision: 5414

URL: http://svn.gna.org/viewcvs/getfem?rev=5414&view=rev
Log:
another fix for "Old_" prefix parsing in getfem::model

Modified:
    trunk/getfem/src/getfem_models.cc

Modified: trunk/getfem/src/getfem_models.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_models.cc?rev=5414&r1=5413&r2=5414&view=diff
==============================================================================
--- trunk/getfem/src/getfem_models.cc   (original)
+++ trunk/getfem/src/getfem_models.cc   Wed Oct 12 18:47:26 2016
@@ -238,9 +238,8 @@
 
   model::VAR_SET::const_iterator
   model::find_variable(const std::string &name) const {
-    auto it = variables.find(name);
-    if (it == end(variables) && !name.compare(0, 4, "Old_")) it = 
variables.find(name.substr(4));
-    GMM_ASSERT1(it != end(variables), "Undefined variable " << name);
+    VAR_SET::const_iterator it = variables.find(name);
+    GMM_ASSERT1(it != variables.end(), "Undefined variable " << name);
     return it;
   }
 
@@ -2954,19 +2953,31 @@
 
   const mesh_fem &
   model::mesh_fem_of_variable(const std::string &name) const {
-    VAR_SET::const_iterator it = find_variable(name);
+   VAR_SET::const_iterator it;
+   if (!(name.compare(0, 4, "Old_")))
+      it = find_variable(name.substr(4));
+    else
+      it = find_variable(name);
     return it->second.associated_mf();
   }
 
   const mesh_fem *
   model::pmesh_fem_of_variable(const std::string &name) const {
-    VAR_SET::const_iterator it = find_variable(name);
+   VAR_SET::const_iterator it;
+   if (!(name.compare(0, 4, "Old_")))
+      it = find_variable(name.substr(4));
+    else
+      it = find_variable(name);
     return it->second.passociated_mf();
   }
 
   bgeot::multi_index
   model::qdims_of_variable(const std::string &name) const {
-    VAR_SET::const_iterator it = find_variable(name);
+   VAR_SET::const_iterator it;
+   if (!(name.compare(0, 4, "Old_")))
+      it = find_variable(name.substr(4));
+    else
+      it = find_variable(name);
     const mesh_fem *mf = it->second.passociated_mf();
     const im_data *imd = it->second.pim_data;
     size_type n = it->second.qdim();
@@ -2996,7 +3007,11 @@
   }
 
   size_type model::qdim_of_variable(const std::string &name) const {
-    VAR_SET::const_iterator it = find_variable(name);
+   VAR_SET::const_iterator it;
+   if (!(name.compare(0, 4, "Old_")))
+      it = find_variable(name.substr(4));
+    else
+      it = find_variable(name);
     const mesh_fem *mf = it->second.passociated_mf();
     const im_data *imd = it->second.pim_data;
     size_type n = it->second.qdim();




reply via email to

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