[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] r5403 - in /trunk/getfem/src: getfem/getfem_models.h ge
From: |
Yves . Renard |
Subject: |
[Getfem-commits] r5403 - in /trunk/getfem/src: getfem/getfem_models.h getfem_models.cc |
Date: |
Tue, 11 Oct 2016 18:59:44 -0000 |
Author: renard
Date: Tue Oct 11 20:59:43 2016
New Revision: 5403
URL: http://svn.gna.org/viewcvs/getfem?rev=5403&view=rev
Log:
adding access to versionned variables with Version1 suffix
Modified:
trunk/getfem/src/getfem/getfem_models.h
trunk/getfem/src/getfem_models.cc
Modified: trunk/getfem/src/getfem/getfem_models.h
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_models.h?rev=5403&r1=5402&r2=5403&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_models.h (original)
+++ trunk/getfem/src/getfem/getfem_models.h Tue Oct 11 20:59:43 2016
@@ -129,6 +129,7 @@
if (!(v.compare(0, 3, "Dot")) && (v[3] == '_' || v[4] == '_')) {
v = v.substr((v[3] == '_') ? 4 : 5);
}
+ if (!(v.compare(0, 9, "Version1_"))) v = v.substr(9);
return v;
}
@@ -558,8 +559,12 @@
void enable_variable(const std::string &name);
/** Says if a name corresponds to a declared variable. */
- bool variable_exists(const std::string &name) const
- { return variables.count(name) > 0; }
+ bool variable_exists(const std::string &name) const {
+ if (!(name.compare(0, 9, "Version1_")))
+ return variables.count(name.substr(9)) > 0;
+ else
+ return variables.count(name) > 0;
+ }
bool is_disabled_variable(const std::string &name) const;
Modified: trunk/getfem/src/getfem_models.cc
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_models.cc?rev=5403&r1=5402&r2=5403&view=diff
==============================================================================
--- trunk/getfem/src/getfem_models.cc (original)
+++ trunk/getfem/src/getfem_models.cc Tue Oct 11 20:59:43 2016
@@ -244,6 +244,7 @@
}
bool model::is_disabled_variable(const std::string &name) const {
+ if (!(name.compare(0, 9, "Version1_"))) return false;
VAR_SET::const_iterator it = find_variable(name);
if (!(it->second.is_variable)) return false;
if (it->second.is_affine_dependent)
@@ -252,6 +253,7 @@
}
bool model::is_data(const std::string &name) const {
+ if (!(name.compare(0, 9, "Version1_"))) return true;
VAR_SET::const_iterator it = find_variable(name);
if (it->second.is_affine_dependent)
it = variables.find(it->second.org_name);
@@ -259,11 +261,13 @@
}
bool model::is_true_data(const std::string &name) const {
+ if (!(name.compare(0, 9, "Version1_"))) return true;
VAR_SET::const_iterator it = find_variable(name);
return (!(it->second.is_variable));
}
bool model::is_affine_dependent_variable(const std::string &name) const {
+ if (!(name.compare(0, 9, "Version1_"))) return false;
VAR_SET::const_iterator it = find_variable(name);
return (it->second.is_affine_dependent);
}
@@ -292,13 +296,21 @@
}
bool model::is_im_data(const std::string &name) const {
- VAR_SET::const_iterator it = find_variable(name);
+ VAR_SET::const_iterator it;
+ if (!(name.compare(0, 9, "Version1_")))
+ it = find_variable(name.substr(9));
+ else
+ it = find_variable(name);
return (it->second.pim_data != 0);
}
const im_data *
model::pim_data_of_variable(const std::string &name) const {
- VAR_SET::const_iterator it = find_variable(name);
+ VAR_SET::const_iterator it;
+ if (!(name.compare(0, 9, "Version1_")))
+ it = find_variable(name.substr(9));
+ else
+ it = find_variable(name);
return it->second.pim_data;
}
@@ -3008,7 +3020,13 @@
model::real_variable(const std::string &name, size_type niter) const {
GMM_ASSERT1(!complex_version, "This model is a complex one");
context_check();
- VAR_SET::iterator it = variables.find(name);
+ VAR_SET::iterator it;
+ if (!(name.compare(0, 9, "Version1_"))) {
+ it = variables.find(name.substr(9)); niter = 1;
+ } else {
+ it = variables.find(name);
+ }
+
GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
if (act_size_to_be_done && it->second.is_fem_dofs) {
if (it->second.filter != VDESCRFILTER_NO)
@@ -3018,8 +3036,7 @@
}
if (niter == size_type(-1)) niter = it->second.default_iter;
GMM_ASSERT1(it->second.n_iter + it->second.n_temp_iter > niter,
- "Invalid iteration number "
- << niter << " for " << name);
+ "Invalid iteration number " << niter << " for " << name);
return it->second.real_value[niter];
}
@@ -3027,7 +3044,12 @@
model::complex_variable(const std::string &name, size_type niter) const {
GMM_ASSERT1(complex_version, "This model is a real one");
context_check();
- VAR_SET::iterator it = variables.find(name);
+ VAR_SET::iterator it;
+ if (!(name.compare(0, 9, "Version1_"))) {
+ it = variables.find(name.substr(9)); niter = 1;
+ } else {
+ it = variables.find(name);
+ }
GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
if (act_size_to_be_done && it->second.is_fem_dofs) {
if (it->second.filter != VDESCRFILTER_NO)
@@ -3046,7 +3068,12 @@
model::set_real_variable(const std::string &name, size_type niter) const {
GMM_ASSERT1(!complex_version, "This model is a complex one");
context_check();
- VAR_SET::iterator it = variables.find(name);
+ VAR_SET::iterator it;
+ if (!(name.compare(0, 9, "Version1_"))) {
+ it = variables.find(name.substr(9)); niter = 1;
+ } else {
+ it = variables.find(name);
+ }
GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
if (act_size_to_be_done && it->second.is_fem_dofs) {
if (it->second.filter != VDESCRFILTER_NO)
@@ -3066,7 +3093,12 @@
model::set_complex_variable(const std::string &name, size_type niter) const {
GMM_ASSERT1(complex_version, "This model is a real one");
context_check();
- VAR_SET::iterator it = variables.find(name);
+ VAR_SET::iterator it;
+ if (!(name.compare(0, 9, "Version1_"))) {
+ it = variables.find(name.substr(9)); niter = 1;
+ } else {
+ it = variables.find(name);
+ }
GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
if (act_size_to_be_done && it->second.is_fem_dofs) {
if (it->second.filter != VDESCRFILTER_NO)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] r5403 - in /trunk/getfem/src: getfem/getfem_models.h getfem_models.cc,
Yves . Renard <=