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: Tue, 1 Aug 2017 17:01:59 -0400 (EDT)

branch: devel-logari81
commit 816c2c08ab16e24fa7b65c3b91db24eef02ec5f8
Author: Konstantinos Poulios <address@hidden>
Date:   Tue Aug 1 23:01:44 2017 +0200

    code simplifications and clean up
---
 src/getfem_assembling_tensors.cc       | 35 +++++++++++++++----------------
 src/getfem_generic_assembly.cc         |  2 +-
 src/getfem_mesh_fem_global_function.cc |  2 +-
 src/getfem_models.cc                   | 38 ++++++++++++++--------------------
 src/getfem_omp.cc                      |  3 +--
 5 files changed, 35 insertions(+), 45 deletions(-)

diff --git a/src/getfem_assembling_tensors.cc b/src/getfem_assembling_tensors.cc
index 9c28557..a58704d 100644
--- a/src/getfem_assembling_tensors.cc
+++ b/src/getfem_assembling_tensors.cc
@@ -1719,26 +1719,25 @@ namespace getfem {
       cerr << mftab[k]->nb_basic_dof_of_element(cv) << " "; cerr << "\n";
       */
 
-      for (size_type i=0; i < atn_tensors.size(); ++i) {
-        atn_tensors[i]->init_required_shape();
-      }
-      for (size_type i=0; i < outvars.size(); ++i) {
-        outvars[i]->update_childs_required_shape();
-      }
-      for (size_type i=atn_tensors.size()-1; i!=size_type(-1); --i) {
+      for (auto &&t : atn_tensors)
+        t->init_required_shape();
+
+      for (auto &&v : outvars)
+        v->update_childs_required_shape();
+
+      for (size_type i=atn_tensors.size()-1; i!=size_type(-1); --i)
         atn_tensors[i]->update_childs_required_shape();
-      }
-      for (size_type i=0; i < atn_tensors.size(); ++i) {
-        atn_tensors[i]->reinit();
-      }
-      for (size_type i=0; i < outvars.size(); ++i) {
-        outvars[i]->reinit();
-      }
+
+      for (auto &&t : atn_tensors)
+        t->reinit();
+
+      for (auto &&v : outvars)
+        v->reinit();
     }
-    for (size_type i=0; i < atn_tensors.size(); ++i)
-      atn_tensors[i]->exec(cv,face);
-    for (size_type i=0; i < outvars.size(); ++i)
-      outvars[i]->exec(cv, face);
+    for (auto &&t : atn_tensors)
+      t->exec(cv,face);
+    for (auto &&v : outvars)
+      v->exec(cv, face);
   }
 
   struct cv_fem_compare {
diff --git a/src/getfem_generic_assembly.cc b/src/getfem_generic_assembly.cc
index 8e11456..1f51175 100644
--- a/src/getfem_generic_assembly.cc
+++ b/src/getfem_generic_assembly.cc
@@ -13766,7 +13766,7 @@ namespace getfem {
       GMM_ASSERT1(f == short_type(-1), "No support for interpolation on faces"
                                        " for a stored_mesh_slice yet.");
       size_type ic = sl.convex_pos(cv);
-      mesh_slicer::cs_nodes_ct nodes = sl.nodes(ic);
+      const mesh_slicer::cs_nodes_ct &nodes = sl.nodes(ic);
       std::vector<base_node> pt_tab(nodes.size());
       for (size_type i=0; i < nodes.size(); ++i) {
         pt_tab[i] = nodes[i].pt_ref;
diff --git a/src/getfem_mesh_fem_global_function.cc 
b/src/getfem_mesh_fem_global_function.cc
index 19335dd..5667b7e 100644
--- a/src/getfem_mesh_fem_global_function.cc
+++ b/src/getfem_mesh_fem_global_function.cc
@@ -1,7 +1,7 @@
 /*===========================================================================
 
  Copyright (C) 2004-2017 Yves Renard
- Copyright (C) 2016      Konstantinos Poulios
+ Copyright (C) 2016-2017 Konstantinos Poulios
 
  This file is a part of GetFEM++
 
diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index 6aca69a..978d938 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -2738,17 +2738,13 @@ namespace getfem {
         std::vector<size_type> dof_indices;
         std::vector<complex_type> dof_pr_values;
         std::vector<complex_type> dof_go_values;
-        std::map<std::string, complex_dof_constraints_var>::const_iterator it;
-
-        for (it = complex_dof_constraints.begin();
-             it != complex_dof_constraints.end(); ++it) {
-          const gmm::sub_interval &I = interval_of_variable(it->first);
-          const model_complex_plain_vector &V = complex_variable(it->first);
-          complex_dof_constraints_var::const_iterator itv;
-          for (itv = it->second.begin(); itv != it->second.end(); ++itv) {
-            dof_indices.push_back(itv->first + I.first());
-            dof_go_values.push_back(itv->second);
-            dof_pr_values.push_back(V[itv->first]);
+        for (const auto &keyval : complex_dof_constraints) {
+          const gmm::sub_interval &I = interval_of_variable(keyval.first);
+          const model_complex_plain_vector &V = complex_variable(keyval.first);
+          for (const auto &val : keyval.second) {
+            dof_indices.push_back(val.first + I.first());
+            dof_go_values.push_back(val.second);
+            dof_pr_values.push_back(V[val.first]);
           }
         }
 
@@ -2793,17 +2789,13 @@ namespace getfem {
         std::vector<size_type> dof_indices;
         std::vector<scalar_type> dof_pr_values;
         std::vector<scalar_type> dof_go_values;
-        std::map<std::string, real_dof_constraints_var>::const_iterator it;
-
-        for (it = real_dof_constraints.begin();
-             it != real_dof_constraints.end(); ++it) {
-          const gmm::sub_interval &I = interval_of_variable(it->first);
-          const model_real_plain_vector &V = real_variable(it->first);
-          real_dof_constraints_var::const_iterator itv;
-          for (itv = it->second.begin(); itv != it->second.end(); ++itv) {
-            dof_indices.push_back(itv->first + I.first());
-            dof_go_values.push_back(itv->second);
-            dof_pr_values.push_back(V[itv->first]);
+        for (const auto &keyval : real_dof_constraints) {
+          const gmm::sub_interval &I = interval_of_variable(keyval.first);
+          const model_real_plain_vector &V = real_variable(keyval.first);
+          for (const auto &val : keyval.second) {
+            dof_indices.push_back(val.first + I.first());
+            dof_go_values.push_back(val.second);
+            dof_pr_values.push_back(V[val.first]);
           }
         }
 
@@ -4829,7 +4821,7 @@ model_complex_plain_vector &
 
           if (mf_data) {
             GMM_ASSERT1(mf_data == &mf_u, "Sorry, for this brick, the data has"
-                        " to be define on the same f.e.m. than the unknown");
+                        " to be defined on the same f.e.m. as the unknown");
           } else {
             s = gmm::vect_size(*A);
             GMM_ASSERT1(mf_u.get_qdim() == s, ": bad format of "
diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index 8dea739..3bb9b65 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -20,8 +20,7 @@
 ===========================================================================*/
 
 #include "getfem/getfem_omp.h"
-#include "getfem/getfem_omp.h"
-#include "getfem/getfem_level_set_contact.h"
+#include "getfem/getfem_mesh.h"
 
 namespace getfem{
 



reply via email to

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