getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] [getfem-commits] branch master updated: White space, ty


From: Konstantinos Poulios
Subject: [Getfem-commits] [getfem-commits] branch master updated: White space, typos and coding style
Date: Sun, 18 Dec 2022 18:47:24 -0500

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 c6b5391e White space, typos and coding style
c6b5391e is described below

commit c6b5391e8914baf6cb11e165fda2e6d88cb4208c
Author: Konstantinos Poulios <logari81@gmail.com>
AuthorDate: Mon Dec 19 00:47:14 2022 +0100

    White space, typos and coding style
---
 interface/src/gf_mesh_fem.cc           | 94 +++++++++++++++++-----------------
 src/getfem/dal_static_stored_objects.h |  2 +-
 src/getfem/getfem_global_function.h    |  2 +-
 src/getfem_context.cc                  | 79 ++++++++++++++--------------
 src/gmm/gmm_blas_interface.h           |  2 +-
 5 files changed, 90 insertions(+), 89 deletions(-)

diff --git a/interface/src/gf_mesh_fem.cc b/interface/src/gf_mesh_fem.cc
index 4fd49809..7cc1b6a0 100644
--- a/interface/src/gf_mesh_fem.cc
+++ b/interface/src/gf_mesh_fem.cc
@@ -41,10 +41,10 @@ using namespace getfemint;
 struct sub_gf_mf : virtual public dal::static_stored_object {
   int arg_in_min, arg_in_max, arg_out_min, arg_out_max;
   virtual void run(getfemint::mexargs_in& in,
-                  getfemint::mexargs_out& out,
-                  const getfem::mesh *mm,
-                  std::shared_ptr<getfem::mesh_fem> &mmf,
-                  unsigned q_dim) = 0;
+                   getfemint::mexargs_out& out,
+                   const getfem::mesh *mm,
+                   std::shared_ptr<getfem::mesh_fem> &mmf,
+                   unsigned q_dim) = 0;
 };
 
 typedef std::shared_ptr<sub_gf_mf> psub_command;
@@ -53,19 +53,19 @@ typedef std::shared_ptr<sub_gf_mf> psub_command;
 template <typename T> static inline void dummy_func(T &) {}
 
 #define sub_command(name, arginmin, arginmax, argoutmin, argoutmax, code) { \
-    struct subc : public sub_gf_mf {                                   \
-      virtual void run(getfemint::mexargs_in& in,                      \
-                      getfemint::mexargs_out& out,                     \
-                      const getfem::mesh *mm,                          \
-                      std::shared_ptr<getfem::mesh_fem> &mmf,          \
-                      unsigned q_dim)                                  \
-      { dummy_func(in); dummy_func(out); dummy_func(mm);               \
-       dummy_func(q_dim); code }                                       \
-    };                                                                 \
-    psub_command psubc = std::make_shared<subc>();                     \
-    psubc->arg_in_min = arginmin; psubc->arg_in_max = arginmax;                
\
-    psubc->arg_out_min = argoutmin; psubc->arg_out_max = argoutmax;    \
-    subc_tab[cmd_normalize(name)] = psubc;                             \
+    struct subc : public sub_gf_mf {                                        \
+      virtual void run(getfemint::mexargs_in& in,                           \
+                       getfemint::mexargs_out& out,                         \
+                       const getfem::mesh *mm,                              \
+                       std::shared_ptr<getfem::mesh_fem> &mmf,              \
+                       unsigned q_dim)                                      \
+      { dummy_func(in); dummy_func(out); dummy_func(mm);                    \
+        dummy_func(q_dim); code }                                           \
+    };                                                                      \
+    psub_command psubc = std::make_shared<subc>();                          \
+    psubc->arg_in_min = arginmin;   psubc->arg_in_max = arginmax;           \
+    psubc->arg_out_min = argoutmin; psubc->arg_out_max = argoutmax;         \
+    subc_tab[cmd_normalize(name)] = psubc;                                  \
   }
 
 /*@INIT MF = ('.mesh', @tmesh m[, @int Qdim1=1[, @int Qdim2=1, ...]])
@@ -78,7 +78,7 @@ template <typename T> static inline void dummy_func(T &) {}
   Returns the handle of the created object. @*/
 
 void gf_mesh_fem(getfemint::mexargs_in& m_in,
-                getfemint::mexargs_out& m_out) {
+                 getfemint::mexargs_out& m_out) {
   typedef std::map<std::string, psub_command > SUBC_TAB;
   static SUBC_TAB subc_tab;
 
@@ -94,15 +94,15 @@ void gf_mesh_fem(getfemint::mexargs_in& m_in,
       ("load", 1, 2, 0, 1,
        std::string fname = in.pop().to_string();
        if (in.remaining())  {
-        mm = extract_mesh_object(in.pop());
-        mmf = std::make_shared<getfem::mesh_fem>(*mm, q_dim);
+         mm = extract_mesh_object(in.pop());
+         mmf = std::make_shared<getfem::mesh_fem>(*mm, q_dim);
        } else {
-        auto m = std::make_shared<getfem::mesh>();
-        m->read_from_file(fname);
-        store_mesh_object(m);
-        mm = m.get();
-        mmf = std::make_shared<getfem::mesh_fem>(*mm, q_dim);
-        workspace().add_hidden_object(store_meshfem_object(mmf), m);
+         auto m = std::make_shared<getfem::mesh>();
+         m->read_from_file(fname);
+         store_mesh_object(m);
+         mm = m.get();
+         mmf = std::make_shared<getfem::mesh_fem>(*mm, q_dim);
+         workspace().add_hidden_object(store_meshfem_object(mmf), m);
        }
        mmf->read_from_file(fname);
        );
@@ -115,16 +115,16 @@ void gf_mesh_fem(getfemint::mexargs_in& m_in,
       ("from string", 1, 2, 0, 1,
        std::stringstream ss(in.pop().to_string());
        if (in.remaining()) {
-        mm = extract_mesh_object(in.pop());
-        mmf = std::make_shared<getfem::mesh_fem>(*mm, q_dim);
+         mm = extract_mesh_object(in.pop());
+         mmf = std::make_shared<getfem::mesh_fem>(*mm, q_dim);
 
        } else {
-        auto m = std::make_shared<getfem::mesh>();
-        m->read_from_file(ss);
-        store_mesh_object(m);
-        mm = m.get();
-        mmf = std::make_shared<getfem::mesh_fem>(*mm, q_dim);
-        workspace().add_hidden_object(store_meshfem_object(mmf), m);
+         auto m = std::make_shared<getfem::mesh>();
+         m->read_from_file(ss);
+         store_mesh_object(m);
+         mm = m.get();
+         mmf = std::make_shared<getfem::mesh_fem>(*mm, q_dim);
+         workspace().add_hidden_object(store_meshfem_object(mmf), m);
        }
        mmf->read_from_file(ss);
        );
@@ -152,14 +152,14 @@ void gf_mesh_fem(getfemint::mexargs_in& m_in,
        std::vector<const getfem::mesh_fem*> mftab;
        std::shared_ptr<getfem::mesh_fem_sum> msum;
        while (in.remaining()) {
-        getfem::mesh_fem *gfimf = to_meshfem_object(in.pop());
-        if (mmf.get() == 0) {
-          mm = &gfimf->linked_mesh();
-          msum = std::make_shared<getfem::mesh_fem_sum>(*mm);
-          mmf = msum; store_meshfem_object(mmf);
-        }
-        workspace().set_dependence(mmf.get(), gfimf);
-        mftab.push_back(gfimf);
+         getfem::mesh_fem *gfimf = to_meshfem_object(in.pop());
+         if (mmf.get() == 0) {
+           mm = &gfimf->linked_mesh();
+           msum = std::make_shared<getfem::mesh_fem_sum>(*mm);
+           mmf = msum; store_meshfem_object(mmf);
+         }
+         workspace().set_dependence(mmf.get(), gfimf);
+         mftab.push_back(gfimf);
        }
        msum->set_mesh_fems(mftab);
        msum->adapt();
@@ -211,12 +211,12 @@ void gf_mesh_fem(getfemint::mexargs_in& m_in,
        auto pls = to_levelset_object(in.pop());
        mexargs_in in_gf(1, &in.pop().arg, true);
        if (in.remaining() && in.front().is_integer())
-        q_dim = in.pop().to_integer(1,256);
+         q_dim = in.pop().to_integer(1,256);
 
        std::vector<getfem::pglobal_function> vfunc(size_type(in_gf.narg()));
        for (size_type i = 0; i < vfunc.size(); ++i) {
-        getfem::pxy_function s = to_global_function_object(in_gf.pop());
-        vfunc[i] = getfem::global_function_on_level_set(*pls, s);
+         getfem::pxy_function s = to_global_function_object(in_gf.pop());
+         vfunc[i] = getfem::global_function_on_level_set(*pls, s);
        }
 
        auto mfgf = std::make_shared<getfem::mesh_fem_global_function>(*mm);
@@ -262,8 +262,8 @@ void gf_mesh_fem(getfemint::mexargs_in& m_in,
     SUBC_TAB::iterator it = subc_tab.find(cmd);
     if (it != subc_tab.end()) {
       check_cmd(cmd, it->first.c_str(), m_in, m_out, it->second->arg_in_min,
-               it->second->arg_in_max, it->second->arg_out_min,
-               it->second->arg_out_max);
+                it->second->arg_in_max, it->second->arg_out_min,
+                it->second->arg_out_max);
       it->second->run(m_in, m_out, mm, mmf, q_dim);
     }
     else bad_cmd(init_cmd);
diff --git a/src/getfem/dal_static_stored_objects.h 
b/src/getfem/dal_static_stored_objects.h
index 1eaeff5e..8f921cf8 100644
--- a/src/getfem/dal_static_stored_objects.h
+++ b/src/getfem/dal_static_stored_objects.h
@@ -88,7 +88,7 @@ namespace dal {
 // Little tool for debug : detects the deleted static stored objects for
 // which the destructor is not called (i.e. a shared pointer is still stored
 // somewhere. Not thread safe.
-// Rule : Each potential stored object should called
+// Rule : Each potential stored object should call
 // DAL_STORED_OBJECT_DEBUG_CREATED(this, "name") in the constructor and
 // DAL_STORED_OBJECT_DEBUG_DESTROYED(this) in the destructor.
   class static_stored_object;
diff --git a/src/getfem/getfem_global_function.h 
b/src/getfem/getfem_global_function.h
index 9d18a8c2..45ddd562 100644
--- a/src/getfem/getfem_global_function.h
+++ b/src/getfem/getfem_global_function.h
@@ -88,7 +88,7 @@ namespace getfem {
     virtual void hess(const base_node &pt, base_matrix&) const = 0;
 
     global_function_simple(dim_type dim__) : global_function(dim__)
-    { DAL_STORED_OBJECT_DEBUG_CREATED(this, "Global function simple");}
+    { DAL_STORED_OBJECT_DEBUG_CREATED(this, "Global function simple"); }
     virtual ~global_function_simple()
     { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Global function simple"); }
   };
diff --git a/src/getfem_context.cc b/src/getfem_context.cc
index 0c838431..dc98e60c 100644
--- a/src/getfem_context.cc
+++ b/src/getfem_context.cc
@@ -25,16 +25,16 @@
 
 namespace getfem {
 
-  context_dependencies::context_dependencies(const context_dependencies& cd) : 
-    state(cd.state),
-    touched(static_cast<bool>(cd.touched)),
-    dependencies(cd.dependencies),
-    dependent(cd.dependent),
-    locks_( )
+  context_dependencies::context_dependencies(const context_dependencies &cd)
+    : state(cd.state),
+      touched(static_cast<bool>(cd.touched)),
+      dependencies(cd.dependencies),
+      dependent(cd.dependent),
+      locks_( )
   {}
 
-  context_dependencies& context_dependencies::operator=(const 
context_dependencies& cd)
-  {
+  context_dependencies&
+  context_dependencies::operator=(const context_dependencies &cd) {
     state = cd.state;
     touched = static_cast<bool>(cd.touched);
     dependencies = cd.dependencies;
@@ -47,8 +47,13 @@ namespace getfem {
     getfem::local_guard lock = locks_.get_lock();
     size_type s = dependent.size();
     iterator_list it1 = dependent.begin(), it2 = it1, ite = dependent.end();
-    for (; it1 != ite; ++it1)
-      { *it2 = *it1; if (*it2 != &cd) ++it2; else --s; }
+    for (; it1 != ite; ++it1) {
+      *it2 = *it1;
+      if (*it2 != &cd)
+        ++it2;
+      else
+        --s;
+    }
     dependent.resize(s);
   }
   
@@ -57,16 +62,20 @@ namespace getfem {
     getfem::local_guard lock = locks_.get_lock();
     size_type s = dependencies.size();
     iterator_list it1=dependencies.begin(), it2=it1, ite=dependencies.end();
-    for (; it1 != ite; ++it1)
-      { *it2 = *it1; if (*it2 != &cd) ++it2; else --s; }
+    for (; it1 != ite; ++it1) {
+      *it2 = *it1;
+      if (*it2 != &cd)
+        ++it2;
+      else
+        --s;
+    }
     dependencies.resize(s);
   }
 
   void context_dependencies::invalid_context() const {
-    if (state != CONTEXT_INVALID) 
-    {
-      iterator_list it = dependent.begin(), ite = dependent.end();
-      for (; it != ite; ++it) (*it)->invalid_context();
+    if (state != CONTEXT_INVALID) {
+      for (auto &it : dependent)
+        it->invalid_context();
       getfem::local_guard lock = locks_.get_lock();
       state = CONTEXT_INVALID;
     }
@@ -76,23 +85,19 @@ namespace getfem {
     cd.context_check(); cd.touched = false;
     {
       getfem::local_guard lock = locks_.get_lock();
-      iterator_list it = dependencies.begin(), ite = dependencies.end();
-      for (; it != ite; ++it) if ((*it) == &cd) return;
+      for (auto &it : dependencies)
+        if (it == &cd) return;
       dependencies.push_back(&cd);
     }
     getfem::local_guard lock = cd.locks_.get_lock();
     cd.dependent.push_back(this);
   }
   
-  bool context_dependencies::go_check() const 
-  {
-    if (state == CONTEXT_CHANGED) 
-    {
-      iterator_list it = dependencies.begin(), ite = dependencies.end();
-      for (; it != ite; ++it) 
-      {
-        (*it)->context_check(); 
-        (*it)->touched = false;
+  bool context_dependencies::go_check() const {
+    if (state == CONTEXT_CHANGED) {
+      for (auto &it : dependencies) {
+        it->context_check(); 
+        it->touched = false;
       }
       getfem::local_guard lock = locks_.get_lock();
       state = CONTEXT_NORMAL;
@@ -103,28 +108,24 @@ namespace getfem {
     return false;
   }
   
-  void context_dependencies::touch() const 
-  {
-    if (!touched) 
-    {
-      iterator_list it = dependent.begin(), ite = dependent.end();
-      for (; it != ite; ++it) (*it)->change_context();
+  void context_dependencies::touch() const {
+    if (!touched) {
+      for (auto &it : dependent)
+        it->change_context();
       touched = true;
     }
   }
 
   void context_dependencies::clear_dependencies() {
-    iterator_list it = dependencies.begin(), ite = dependencies.end();
-    for (; it != ite; ++it) (*it)->sup_dependent_(*this);
+    for (auto &it : dependencies)
+      it->sup_dependent_(*this);
     dependencies.clear();
   }
  
   context_dependencies::~context_dependencies() {
     invalid_context();
-    iterator_list it = dependencies.begin(), ite = dependencies.end();
-    for (; it != ite; ++it) (*it)->sup_dependent_(*this);
-    it = dependent.begin(), ite = dependent.end();
-    for (; it != ite; ++it) (*it)->sup_dependency_(*this);
+    for (auto &it : dependencies) it->sup_dependent_(*this);
+    for (auto &it : dependent)    it->sup_dependency_(*this);
   }
   
 }
diff --git a/src/gmm/gmm_blas_interface.h b/src/gmm/gmm_blas_interface.h
index c724a3b4..df5d7158 100644
--- a/src/gmm/gmm_blas_interface.h
+++ b/src/gmm/gmm_blas_interface.h
@@ -57,7 +57,7 @@ namespace gmm {
 #else // By default BLAS_INT will just be int in C
   #define BLAS_INT int
 #endif
-  
+
   /* ********************************************************************* */
   /* Operations interfaced for T = float, double, std::complex<float>      */
   /*    or std::complex<double> :                                          */



reply via email to

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