[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] [getfem-commits] branch master updated: Remove redundan
From: |
Konstantinos Poulios |
Subject: |
[Getfem-commits] [getfem-commits] branch master updated: Remove redundant state flag member from var_description classes |
Date: |
Mon, 16 Oct 2023 03:02:26 -0400 |
This is an automated email from the git hooks/post-receive script.
logari81 pushed a commit to branch master
in repository getfem.
The following commit(s) were added to refs/heads/master by this push:
new 35b4bf52 Remove redundant state flag member from var_description
classes
35b4bf52 is described below
commit 35b4bf52c75a3c977d5575793bb180d25b37a1ac
Author: Konstantinos Poulios <logari81@gmail.com>
AuthorDate: Mon Oct 16 09:01:55 2023 +0200
Remove redundant state flag member from var_description classes
---
src/getfem/getfem_generic_assembly.h | 3 +--
src/getfem/getfem_models.h | 6 ++---
src/getfem_generic_assembly_workspace.cc | 6 ++---
src/getfem_models.cc | 43 ++++++++++++++++----------------
4 files changed, 27 insertions(+), 31 deletions(-)
diff --git a/src/getfem/getfem_generic_assembly.h
b/src/getfem/getfem_generic_assembly.h
index 43d269de..1eb582eb 100644
--- a/src/getfem/getfem_generic_assembly.h
+++ b/src/getfem/getfem_generic_assembly.h
@@ -272,7 +272,6 @@ namespace getfem {
struct var_description {
const bool is_variable;
- const bool is_fem_dofs;
const mesh_fem *mf;
const im_data *imd;
gmm::sub_interval I;
@@ -291,7 +290,7 @@ namespace getfem {
var_description(bool is_var, const mesh_fem *mf_, const im_data *imd_,
gmm::sub_interval I_, const model_real_plain_vector *V_,
size_type Q, bool is_intern_=false)
- : is_variable(is_var), is_fem_dofs(mf_ != 0), mf(mf_), imd(imd_),
+ : is_variable(is_var), mf(mf_), imd(imd_),
I(I_), V(V_), qdims(1), is_internal(is_intern_)
{
GMM_ASSERT1(Q > 0, "Bad dimension");
diff --git a/src/getfem/getfem_models.h b/src/getfem/getfem_models.h
index 1c06b424..9bee4ce9 100644
--- a/src/getfem/getfem_models.h
+++ b/src/getfem/getfem_models.h
@@ -158,7 +158,6 @@ namespace getfem {
// to another variable.
bool is_internal; // An internal variable defined on integration
// points, condensed out of the global system.
- bool is_fem_dofs; // The variable is the dofs of a fem
size_type n_iter; // Number of versions of the variable stored.
size_type n_temp_iter; // Number of additional temporary versions
size_type default_iter; // default iteration number.
@@ -206,7 +205,6 @@ namespace getfem {
mesh_im const *filter_mim_ = 0)
: is_variable(is_var), is_disabled(false), is_complex(is_compl),
is_affine_dependent(false), is_internal(false),
- is_fem_dofs(mf_ != 0),
n_iter(std::max(size_type(1), n_it)), n_temp_iter(0),
default_iter(0), ptsc(0),
filter(filter_), filter_region(filter_reg), filter_var(filter_var_),
@@ -230,12 +228,12 @@ namespace getfem {
void clear_temporaries();
const mesh_fem &associated_mf() const {
- GMM_ASSERT1(is_fem_dofs, "This variable is not linked to a fem");
+ GMM_ASSERT1(mf, "This variable is not linked to a fem");
return (filter == VDESCRFILTER_NO) ? *mf : *partial_mf;
}
const mesh_fem *passociated_mf() const {
- if (is_fem_dofs)
+ if (mf)
return (filter == VDESCRFILTER_NO || partial_mf.get() == 0)
? mf : partial_mf.get();
return 0;
diff --git a/src/getfem_generic_assembly_workspace.cc
b/src/getfem_generic_assembly_workspace.cc
index fd3d6c75..9f652a9e 100644
--- a/src/getfem_generic_assembly_workspace.cc
+++ b/src/getfem_generic_assembly_workspace.cc
@@ -241,7 +241,7 @@ namespace getfem {
ga_workspace::associated_mf(const std::string &name) const {
VAR_SET::const_iterator it = variables.find(name);
if (it != variables.end())
- return it->second.is_fem_dofs ? it->second.mf : 0;
+ return it->second.mf;
if (md && md->variable_exists(name))
return md->pmesh_fem_of_variable(name);
if (parent_workspace && parent_workspace->variable_exists(name))
@@ -266,7 +266,7 @@ namespace getfem {
size_type ga_workspace::qdim(const std::string &name) const {
VAR_SET::const_iterator it = variables.find(name);
if (it != variables.end()) {
- const mesh_fem *mf = it->second.is_fem_dofs ? it->second.mf : 0;
+ const mesh_fem *mf = it->second.mf;
const im_data *imd = it->second.imd;
size_type n = it->second.qdim();
if (mf) {
@@ -289,7 +289,7 @@ namespace getfem {
ga_workspace::qdims(const std::string &name) const {
VAR_SET::const_iterator it = variables.find(name);
if (it != variables.end()) {
- const mesh_fem *mf = it->second.is_fem_dofs ? it->second.mf : 0;
+ const mesh_fem *mf = it->second.mf;
const im_data *imd = it->second.imd;
size_type n = it->second.qdim();
if (mf) {
diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index 3ae1927d..c56b02e7 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -73,10 +73,10 @@ namespace getfem {
clear_temporaries();
v_num_var_iter.resize(n_iter);
v_num_iter.resize(n_iter);
- size_type s = is_fem_dofs ? passociated_mf()->nb_dof()
- : (imd ? imd->nb_filtered_index()
- * imd->nb_tensor_elem()
- : 1);
+ size_type s = mf ? passociated_mf()->nb_dof()
+ : (imd ? imd->nb_filtered_index()
+ *imd->nb_tensor_elem()
+ : 1);
s *= qdim();
for (size_type i = 0; i < n_iter; ++i)
if (is_complex)
@@ -385,14 +385,14 @@ namespace getfem {
for (auto &&v : variables) {
const std::string &vname = v.first;
var_description &vdescr = v.second;
- if (vdescr.is_fem_dofs && !vdescr.is_affine_dependent) {
+ if (vdescr.mf && !vdescr.is_affine_dependent) {
if ((vdescr.filter & VDESCRFILTER_CTERM)
|| (vdescr.filter & VDESCRFILTER_INFSUP)) {
VAR_SET::iterator vfilt = variables.find(vdescr.filter_var);
GMM_ASSERT1(vfilt != variables.end(), "The primal variable of the"
" multiplier does not exist : " << vdescr.filter_var);
- GMM_ASSERT1(vfilt->second.is_fem_dofs, "The primal variable of "
- "the multiplier is not a fem variable");
+ GMM_ASSERT1(vfilt->second.mf, "The primal variable of the "
+ "multiplier should be a fem variable");
multipliers[vdescr.filter_var].push_back(vname);
if (vdescr.v_num < vdescr.mf->version_number() ||
vdescr.v_num < vfilt->second.mf->version_number()) {
@@ -428,7 +428,7 @@ namespace getfem {
for (auto &&v : variables) {
var_description &vdescr = v.second;
- if (vdescr.is_fem_dofs && !(vdescr.is_affine_dependent) &&
+ if (vdescr.mf && !(vdescr.is_affine_dependent) &&
((vdescr.filter & VDESCRFILTER_CTERM)
|| (vdescr.filter & VDESCRFILTER_INFSUP))) {
if (tobedone.count(vdescr.filter_var)) {
@@ -677,7 +677,7 @@ namespace getfem {
ost << std::setw(30) << std::left << v.first;
ost << std::setw(2) << std::right << vdescr.n_iter;
ost << ((vdescr.n_iter == 1) ? " copy " : " copies ");
- ost << (vdescr.is_fem_dofs ? "fem dependant " : "constant size ");
+ ost << (vdescr.mf ? "fem dependant " : "constant size ");
ost << std::setw(8) << std::right << vdescr.size();
if (is_complex()) ost << " complex";
ost << ((vdescr.size() > 1) ? " doubles." : " double.");
@@ -751,10 +751,10 @@ namespace getfem {
void model::resize_fixed_size_variable(const std::string &name,
const bgeot::multi_index &sizes) {
- GMM_ASSERT1(!(variables[name].is_fem_dofs),
+ GMM_ASSERT1(variables[name].mf == 0,
"Cannot explicitly resize a fem variable or data");
GMM_ASSERT1(variables[name].imd == 0,
- "Cannot explicitly resize an im data");
+ "Cannot explicitly resize an im variable or data");
variables[name].qdims = sizes;
variables[name].set_size();
}
@@ -969,8 +969,7 @@ namespace getfem {
if (bricks[ibb].mims[j] == mim) found = true;
}
for (const auto &v : variables) {
- if (v.second.is_fem_dofs &&
- (v.second.filter & VDESCRFILTER_INFSUP) &&
+ if (v.second.mf && (v.second.filter & VDESCRFILTER_INFSUP) &&
mim == v.second.filter_mim) found = true;
}
if (!found) sup_dependency(*mim);
@@ -997,12 +996,12 @@ namespace getfem {
VAR_SET::const_iterator it = find_variable(varname);
- if (it->second.is_fem_dofs) {
+ if (it->second.mf) {
const mesh_fem *mf = it->second.mf;
bool found = false;
for(VAR_SET::iterator it2 = variables.begin();
it2 != variables.end(); ++it2) {
- if (it != it2 && it2->second.is_fem_dofs && mf == it2->second.mf)
+ if (it != it2 && it2->second.mf && mf == it2->second.mf)
found = true;
}
if (!found) sup_dependency(*mf);
@@ -1016,7 +1015,7 @@ namespace getfem {
}
for (VAR_SET::iterator it2 = variables.begin();
it2 != variables.end(); ++it2) {
- if (it != it2 && it2->second.is_fem_dofs &&
+ if (it != it2 && it2->second.mf &&
(it2->second.filter & VDESCRFILTER_INFSUP) &&
mim == it2->second.filter_mim) found = true;
}
@@ -2963,7 +2962,7 @@ namespace getfem {
context_check();
auto it = variables.find(name);
GMM_ASSERT1(it != variables.end(), "Undefined variable " << name);
- if (act_size_to_be_done && it->second.is_fem_dofs) {
+ if (act_size_to_be_done && it->second.mf) {
if (it->second.filter != VDESCRFILTER_NO)
actualize_sizes();
else
@@ -2989,7 +2988,7 @@ namespace getfem {
context_check();
auto it = variables.find(name);
GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
- if (act_size_to_be_done && it->second.is_fem_dofs) {
+ if (act_size_to_be_done && it->second.mf) {
if (it->second.filter != VDESCRFILTER_NO)
actualize_sizes();
else
@@ -3017,7 +3016,7 @@ namespace getfem {
context_check();
auto it = variables.find(name);
GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
- if (act_size_to_be_done && it->second.is_fem_dofs) {
+ if (act_size_to_be_done && it->second.mf) {
if (it->second.filter != VDESCRFILTER_NO)
actualize_sizes();
else
@@ -3045,7 +3044,7 @@ namespace getfem {
context_check();
auto it = variables.find(name);
GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
- if (act_size_to_be_done && it->second.is_fem_dofs) {
+ if (act_size_to_be_done && it->second.mf) {
if (it->second.filter != VDESCRFILTER_NO)
actualize_sizes();
else
@@ -3067,7 +3066,7 @@ namespace getfem {
GMM_ASSERT1(it != variables.end(), "Undefined variable " << name);
GMM_ASSERT1(it->second.is_affine_dependent,
"Only for affine dependent variables");
- if (act_size_to_be_done && it->second.is_fem_dofs) {
+ if (act_size_to_be_done && it->second.mf) {
if (it->second.filter != VDESCRFILTER_NO)
actualize_sizes();
else
@@ -3083,7 +3082,7 @@ namespace getfem {
context_check();
VAR_SET::iterator it = variables.find(name);
GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
- if (act_size_to_be_done && it->second.is_fem_dofs) {
+ if (act_size_to_be_done && it->second.mf) {
if (it->second.filter != VDESCRFILTER_NO)
actualize_sizes();
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] [getfem-commits] branch master updated: Remove redundant state flag member from var_description classes,
Konstantinos Poulios <=