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(); _______________________________________________ Getfem-commits mailing list Getfem-commits@gna.org https://mail.gna.org/listinfo/getfem-commits