[Getfem-commits] [getfem-commits] master updated (6377557 -> 358e912)
renard pushed a change to branch master. from 6377557 Perform temporary dof enumeration only for mesh_fem variables that need to be unreduced adds f1286cd changing default cpp standard to 14 adds 1e3f003 no more getfem_boost adds fd7dc6e 1) no more thread static pointer from boost, using thread_static qualifier instead 2) removing "register" keyword, as it's considered deprecated adds b709d37 replacing boost with STL or standard language features whenever possible adds 64d2ccc simplified const box_index * comparison adds b28f8f6 std::toupper now takes one argument new 358e912 further delete BOOST dependency Summary of changes: configure.ac | 39 + contrib/aposteriori/Makefile.am| 2 +- contrib/bimaterial_crack_test/Makefile.am | 2 +- contrib/crack_plate/Makefile.am| 2 +- contrib/delaminated_crack/Makefile.am | 2 +- contrib/icare/Makefile.am | 2 +- contrib/level_set_contact/Makefile.am | 2 +- contrib/mixed_elastostatic/Makefile.am | 2 +- contrib/opt_assembly/Makefile.am | 2 +- contrib/static_contact_gears/Makefile.am | 2 +- contrib/xfem_contact/Makefile.am | 2 +- contrib/xfem_stab_unilat_contact/Makefile.am | 2 +- src/Makefile.am| 2 - src/bgeot_geometric_trans.cc | 10 +-- src/getfem/bgeot_config.h | 7 -- src/getfem/bgeot_kdtree.h | 6 +- src/getfem/bgeot_rtree.h | 50 +++ src/getfem/bgeot_tensor.h | 8 +- src/getfem/dal_basic.h | 28 +++ src/getfem/dal_static_stored_objects.h | 11 +-- src/getfem/getfem_context.h| 10 +-- src/getfem/getfem_mesh_fem_level_set.h | 5 +- src/getfem/getfem_omp.h| 30 +-- src/getfem/getfem_partial_mesh_fem.h | 5 +- src/getfem_boost/noncopyable.hpp | 45 -- src/getfem_boost/workaround.hpp| 77 - src/getfem_fem.cc | 98 +++--- ...fem_generic_assembly_functions_and_operators.cc | 15 +--- src/getfem_import.cc | 3 +- src/getfem_integration.cc | 24 +++--- src/getfem_linearized_plates.cc| 4 +- src/getfem_mat_elem.cc | 8 +- src/gmm/gmm_domain_decomp.h| 6 +- tests/Makefile.am | 2 +- 34 files changed, 140 insertions(+), 375 deletions(-) delete mode 100644 src/getfem_boost/noncopyable.hpp delete mode 100644 src/getfem_boost/workaround.hpp
[Getfem-commits] [getfem-commits] branch upgrade_to_cpp14_consolidated deleted (was b28f8f6)
renard pushed a change to branch upgrade_to_cpp14_consolidated. was b28f8f6 std::toupper now takes one argument The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[Getfem-commits] (no subject)
branch: upgrade_to_cpp14_consolidated commit fd7dc6e95054fef8908e2c06f97ab2022ee023ba Author: aa Date: Thu Apr 4 15:58:23 2019 +0200 1) no more thread static pointer from boost, using thread_static qualifier instead 2) removing "register" keyword, as it's considered deprecated --- src/bgeot_geometric_trans.cc | 10 +-- src/getfem/bgeot_tensor.h | 8 +- src/getfem/dal_basic.h | 28 +++ src/getfem/getfem_omp.h| 30 +-- src/getfem_fem.cc | 98 +++--- ...fem_generic_assembly_functions_and_operators.cc | 15 +--- src/getfem_integration.cc | 24 +++--- src/getfem_linearized_plates.cc| 4 +- src/getfem_mat_elem.cc | 8 +- src/gmm/gmm_domain_decomp.h| 6 +- 10 files changed, 96 insertions(+), 135 deletions(-) diff --git a/src/bgeot_geometric_trans.cc b/src/bgeot_geometric_trans.cc index 0b1cc6a..97a127b 100644 --- a/src/bgeot_geometric_trans.cc +++ b/src/bgeot_geometric_trans.cc @@ -29,22 +29,22 @@ namespace bgeot { std::vector& __aux1(){ -DEFINE_STATIC_THREAD_LOCAL(std::vector, v); +THREAD_SAFE_STATIC std::vector v; return v; } std::vector& __aux2(){ -DEFINE_STATIC_THREAD_LOCAL(std::vector, v); +THREAD_SAFE_STATIC std::vector v; return v; } std::vector& __aux3(){ -DEFINE_STATIC_THREAD_LOCAL(std::vector, v); +THREAD_SAFE_STATIC std::vector v; return v; } std::vector& __ipvt_aux(){ -DEFINE_STATIC_THREAD_LOCAL(std::vector, vi); +THREAD_SAFE_STATIC std::vector vi; return vi; } @@ -279,7 +279,7 @@ namespace bgeot { auto itpc_j = pc.begin() + j*P, itG_b = G.begin(); for (size_type i = 0; i < N; ++i, ++itG_b) { auto itG = itG_b, itpc = itpc_j; - register scalar_type a = *(itG) * (*itpc); + scalar_type a = *(itG) * (*itpc); for (size_type k = 1; k < P; ++k) { itG += N; a += *(itG) * (*++itpc); } *itK++ = a; diff --git a/src/getfem/bgeot_tensor.h b/src/getfem/bgeot_tensor.h index 7979157..ebf2671 100644 --- a/src/getfem/bgeot_tensor.h +++ b/src/getfem/bgeot_tensor.h @@ -336,8 +336,8 @@ namespace bgeot { /* reduction du tenseur t par son indice ni et la matrice */ /* transposee de m.*/ -DEFINE_STATIC_THREAD_LOCAL(std::vector, tmp); -DEFINE_STATIC_THREAD_LOCAL(multi_index, mi); +THREAD_SAFE_STATIC std::vector tmp; +THREAD_SAFE_STATIC multi_index mi; mi = t.sizes(); size_type dimt = mi[ni], dim = m.nrows(); @@ -403,8 +403,8 @@ namespace bgeot { template void tensor::mat_reduction (const tensor , const gmm::dense_matrix , int ni) { /* reduction du tenseur t par son indice ni et la matrice m. */ -DEFINE_STATIC_THREAD_LOCAL(std::vector, tmp); -DEFINE_STATIC_THREAD_LOCAL(multi_index, mi); +THREAD_SAFE_STATIC std::vector tmp; +THREAD_SAFE_STATIC multi_index mi; mi = t.sizes(); size_type dimt = mi[ni], dim = m.ncols(); diff --git a/src/getfem/dal_basic.h b/src/getfem/dal_basic.h index 878b996..f3acbd5 100644 --- a/src/getfem/dal_basic.h +++ b/src/getfem/dal_basic.h @@ -282,7 +282,7 @@ namespace dal /* * */ - /* Menbers functions*/ + /* Member functions */ /* * */ @@ -313,9 +313,9 @@ namespace dal typename pointer_array::iterator ite = it+ ((last_ind + DNAMPKS__) >> pks); while (it != ite) { *it = std::unique_ptr(new T[DNAMPKS__+1]);// std::make_unique(DNAMPKS__+1); - register pointer p = it->get(); ++it; - register pointer pe = p + (DNAMPKS__+1); - register const_pointer pa = (ita++)->get(); + pointer p = it->get(); ++it; + pointer pe = p + (DNAMPKS__+1); + const_pointer pa = (ita++)->get(); while (p != pe) *p++ = *pa++; } return *this; @@ -324,9 +324,8 @@ namespace dal template typename dynamic_array::const_reference dynamic_array::operator [](size_type ii) const { -DEFINE_STATIC_THREAD_LOCAL_INITIALIZED(std::shared_ptr,pf,NULL); -if (pf.get() == NULL) { pf = std::make_shared(); } -return (ii>pks])[ii__] : *pf; +THREAD_SAFE_STATIC T f; +return (ii>pks])[ii__] : f; } template typename dynamic_array::reference @@ -336,13 +335,14 @@ namespace dal last_accessed = ii + 1; if (ii >= last_ind) { - if ((ii >> (pks+ppks)) > 0) { - while ((ii >> (pks+ppks)) > 0) ppks++; - array.resize(m_ppks = (size_type(1) << ppks)); m_ppks--; -
[Getfem-commits] (no subject)
branch: upgrade_to_cpp14_consolidated commit b28f8f6fe45d7dd88b033af77e4b1025eec73441 Author: aa Date: Thu Apr 4 16:01:21 2019 +0200 std::toupper now takes one argument --- src/getfem_import.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/getfem_import.cc b/src/getfem_import.cc index ef0fe73..d423f0d 100644 --- a/src/getfem_import.cc +++ b/src/getfem_import.cc @@ -788,8 +788,7 @@ namespace getfem { type_name = line.substr(pos, pos2-pos); bool only_digits = (type_name.find_first_not_of("0123456789") == std::string::npos); -const std::locale loc; -for (auto&& c : type_name) c = std::toupper(c, loc); +for (auto&& c : type_name) c = std::toupper(c); if (elt_types.size() < itype+1) elt_types.resize(itype+1);
[Getfem-commits] (no subject)
branch: upgrade_to_cpp14_consolidated commit b709d375233d7b99c270819df6b0bd7b6feaa3f6 Author: aa Date: Thu Apr 4 16:00:17 2019 +0200 replacing boost with STL or standard language features whenever possible --- src/getfem/bgeot_config.h | 7 --- src/getfem/bgeot_kdtree.h | 6 +- src/getfem/dal_static_stored_objects.h | 11 ++- src/getfem/getfem_context.h| 10 ++ src/getfem/getfem_mesh_fem_level_set.h | 5 - src/getfem/getfem_partial_mesh_fem.h | 5 - 6 files changed, 17 insertions(+), 27 deletions(-) diff --git a/src/getfem/bgeot_config.h b/src/getfem/bgeot_config.h index 66a367b..ad951fa 100644 --- a/src/getfem/bgeot_config.h +++ b/src/getfem/bgeot_config.h @@ -50,13 +50,6 @@ #include "gmm/gmm_kernel.h" #include "gmm/gmm_dense_lu.h" -#ifdef GETFEM_HAVE_BOOST -# include -# include -#else -# include -#endif - #ifdef GETFEM_HAVE_QDLIB // # define NO_INLINE # ifdef GETFEM_QDLIB_USE_QUAD diff --git a/src/getfem/bgeot_kdtree.h b/src/getfem/bgeot_kdtree.h index 81c00e9..e347e5a 100644 --- a/src/getfem/bgeot_kdtree.h +++ b/src/getfem/bgeot_kdtree.h @@ -100,12 +100,16 @@ namespace bgeot { } @endcode */ - class kdtree : public boost::noncopyable { + class kdtree { dim_type N; /* dimension of points */ std::unique_ptr tree; kdtree_tab_type pts; public: kdtree() : N(0) {} + +kdtree(const kdtree&) = delete; +kdtree = (const kdtree&) = delete; + /// reset the tree, remove all points void clear() { clear_tree(); pts = kdtree_tab_type(); N = 0; } void reserve(size_type n) { pts.reserve(n); } diff --git a/src/getfem/dal_static_stored_objects.h b/src/getfem/dal_static_stored_objects.h index be8ca7e..16814b1 100644 --- a/src/getfem/dal_static_stored_objects.h +++ b/src/getfem/dal_static_stored_objects.h @@ -77,14 +77,7 @@ std::shared_ptr are used. #include "getfem/getfem_arch_config.h" -#ifdef GETFEM_HAS_OPENMP - #include - typedef boost::atomic_bool atomic_bool; - typedef boost::atomic atomic_int; -#else - typedef int atomic_int; - typedef bool atomic_bool; -#endif +#include #define DAL_STORED_OBJECT_DEBUG 0 @@ -298,7 +291,7 @@ namespace dal { /** Pointer to an object with the dependencies */ struct enr_static_stored_object { pstatic_stored_object p; -atomic_bool valid; +std::atomic_bool valid; const permanence perm; std::set dependent_object; std::set dependencies; diff --git a/src/getfem/getfem_context.h b/src/getfem/getfem_context.h index e24f4e5..e82017b 100644 --- a/src/getfem/getfem_context.h +++ b/src/getfem/getfem_context.h @@ -41,13 +41,7 @@ #include "getfem_omp.h" #include -#ifdef GETFEM_HAS_OPENMP - #include - typedef boost::atomic_bool atomic_bool; -#else - typedef bool atomic_bool; -#endif - +#include namespace getfem { /**Deal with interdependencies of objects. @@ -89,7 +83,7 @@ namespace getfem { protected : enum context_state { CONTEXT_NORMAL, CONTEXT_CHANGED, CONTEXT_INVALID }; mutable context_state state; -mutable atomic_bool touched; +mutable std::atomic_bool touched; mutable std::vector dependencies; mutable std::vector dependent; typedef std::vector::iterator iterator_list; diff --git a/src/getfem/getfem_mesh_fem_level_set.h b/src/getfem/getfem_mesh_fem_level_set.h index 81cb4b8..e0e853c 100644 --- a/src/getfem/getfem_mesh_fem_level_set.h +++ b/src/getfem/getfem_mesh_fem_level_set.h @@ -45,7 +45,7 @@ namespace getfem { - class mesh_fem_level_set : public mesh_fem, public boost::noncopyable { + class mesh_fem_level_set : public mesh_fem { protected : const mesh_level_set const mesh_fem @@ -72,6 +72,9 @@ namespace getfem { mesh_fem_level_set(const mesh_level_set , const mesh_fem ); +mesh_fem_level_set(const mesh_fem_level_set&) = delete; +mesh_fem_level_set& operator = (const mesh_fem_level_set&) = delete; + ~mesh_fem_level_set() { clear_build_methods(); } }; diff --git a/src/getfem/getfem_partial_mesh_fem.h b/src/getfem/getfem_partial_mesh_fem.h index 3ce3411..68230b8 100644 --- a/src/getfem/getfem_partial_mesh_fem.h +++ b/src/getfem/getfem_partial_mesh_fem.h @@ -52,7 +52,7 @@ namespace getfem { a subclass of mesh_fem which allows to eliminate a number of dof of the original mesh_fem. */ - class partial_mesh_fem : public mesh_fem, public boost::noncopyable { + class partial_mesh_fem : public mesh_fem { protected : const mesh_fem mutable bool is_adapted; @@ -152,6 +152,9 @@ namespace getfem { partial_mesh_fem(const mesh_fem ); partial_mesh_fem(const mesh_fem *mef); +partial_mesh_fem(const partial_mesh_fem&) = delete; +partial_mesh_fem& operator = (const partial_mesh_fem&) = delete; + }; typedef std::shared_ptr ppartial_mesh_fem;
[Getfem-commits] (no subject)
branch: upgrade_to_cpp14_consolidated commit 64d2cccbbd2debe0c21e9c849fa543d4b29bfd8c Author: aa Date: Thu Apr 4 16:00:56 2019 +0200 simplified const box_index * comparison --- src/getfem/bgeot_rtree.h | 50 +++- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/src/getfem/bgeot_rtree.h b/src/getfem/bgeot_rtree.h index baf7eb2..d26f5f8 100644 --- a/src/getfem/bgeot_rtree.h +++ b/src/getfem/bgeot_rtree.h @@ -48,42 +48,10 @@ namespace bgeot { base_node min, max; }; - /** Wraps "const box_index *" but overloads - * comparison operators based on id and not - * addresses. This ensures deterministic ordering in sets. - */ - struct box_index_ptr { -box_index_ptr(const box_index *p) - : p_{p} -{} - -box_index_ptr(const box_index_ptr&) = default; - -bool operator < (const box_index_ptr ) const { - return p_->id < bptr.p_->id; -} - -bool operator == (const box_index_ptr ) const { - return p_->id == bptr.p_->id; -} - -bool operator != (const box_index_ptr ) const { - return !(*this == bptr); + struct box_index_compare { +bool operator()(const box_index *plhs, const box_index *prhs) const { + return plhs->id < prhs->id; } - -operator const box_index *() const { - return p_; -} - -const box_index * operator->() const { - return p_; -} - -const box_index& operator*() const { - return *p_; -} - -const box_index *p_; }; struct rtree_elt_base { @@ -101,11 +69,15 @@ namespace bgeot { * This is not a dynamic structure. Once a query has been made on the * tree, new boxes should not be added. */ - class rtree : public boost::noncopyable { + class rtree { public: -typedef std::deque box_cont; -typedef std::vector pbox_cont; -typedef std::set pbox_set; +using box_cont = std::deque ; +using pbox_cont = std::vector; +using pbox_set = std::set; + +rtree() = default; +rtree(const rtree&) = delete; +rtree& operator = (const rtree&) = delete; void add_box(base_node min, base_node max, size_type id=size_type(-1)) { box_index bi; bi.min = min; bi.max = max;
[Getfem-commits] (no subject)
branch: making_var_description_copyable commit b8be815bd553d6443b1c0de10aa2ef38117aff1c Author: aa Date: Thu Apr 4 15:42:10 2019 +0200 changing constness to allow var_description copying --- src/getfem/getfem_models.h | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/getfem/getfem_models.h b/src/getfem/getfem_models.h index 35c8351..8f9d05c 100644 --- a/src/getfem/getfem_models.h +++ b/src/getfem/getfem_models.h @@ -146,28 +146,28 @@ namespace getfem { struct var_description { - const bool is_variable; // This is a variable or a parameter. + bool is_variable; // This is a variable or a parameter. bool is_disabled; // For a variable, to be solved or not - const bool is_complex;// The variable is complex numbers + bool is_complex;// The variable is complex numbers bool is_affine_dependent; // The variable depends in an affine way // to another variable. - const bool is_fem_dofs; // The variable is the dofs of a fem + 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. ptime_scheme ptsc;// For optional time integration scheme - const var_description_filter filter; // Version of an optional filter + var_description_filter filter; // Version of an optional filter // on the dofs - const size_type filter_region; // Optional region for the filter - const std::string filter_var; // Optional variable name for the filter - const mesh_im *filter_mim; // Optional integration method for the filter + size_type filter_region; // Optional region for the filter + std::string filter_var; // Optional variable name for the filter + mesh_im const *filter_mim; // Optional integration method for the filter // fem or im_data description of the variable - const mesh_fem *mf;// Main fem of the variable. + mesh_fem const *mf;// Main fem of the variable. ppartial_mesh_fem partial_mf; // Filter with respect to mf. - const im_data *imd;// im data description + im_data const *imd;// im data description bgeot::multi_index qdims; // For data having a qdim != of the fem // (dim per dof for dof data) @@ -191,12 +191,12 @@ namespace getfem { // dependent variables var_description(bool is_var = false, bool is_compl = false, - const mesh_fem *mf_ = 0, const im_data *imd_ = 0, + mesh_fem const *mf_ = 0, im_data const *imd_ = 0, size_type n_it = 1, var_description_filter filter_ = VDESCRFILTER_NO, size_type filter_reg = size_type(-1), const std::string _var_ = std::string(""), - const mesh_im *filter_mim_ = 0) + mesh_im const *filter_mim_ = 0) : is_variable(is_var), is_disabled(false), is_complex(is_compl), is_affine_dependent(false), is_fem_dofs(mf_ != 0),