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: Fix compilation


From: Konstantinos Poulios
Subject: [Getfem-commits] [getfem-commits] branch master updated: Fix compilation warnings
Date: Tue, 17 Oct 2023 07:12:48 -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 31278f3d Fix compilation warnings
31278f3d is described below

commit 31278f3da69321a5619eb9085654d1af10a8a1d3
Author: Konstantinos Poulios <logari81@gmail.com>
AuthorDate: Tue Oct 17 13:12:37 2023 +0200

    Fix compilation warnings
---
 contrib/crack_plate/crack_bilaplacian.h   |  2 +-
 contrib/crack_plate/crack_mindlin.cc      |  2 +-
 src/getfem/bgeot_geometric_trans.h        |  4 +--
 src/getfem_contact_and_friction_common.cc | 16 +++++----
 src/getfem_nonlinear_elasticity.cc        |  5 ++-
 tests/test_mesh.cc                        | 60 ++++++++++++++++---------------
 tests/test_small_vector.cc                | 10 +++---
 7 files changed, 54 insertions(+), 45 deletions(-)

diff --git a/contrib/crack_plate/crack_bilaplacian.h 
b/contrib/crack_plate/crack_bilaplacian.h
index 40b08ba9..12c9acf4 100644
--- a/contrib/crack_plate/crack_bilaplacian.h
+++ b/contrib/crack_plate/crack_bilaplacian.h
@@ -264,7 +264,7 @@ void calcul_von_mises(const getfem::mesh_fem &mf_u, const 
VEC1 &U,
   getfem::compute_gradient(mf_u, mf_vm, U, DU);
   
   gmm::resize(VM, mf_vm.nb_dof());
-  scalar_type vm_min, vm_max;
+  scalar_type vm_min=0, vm_max=0;
   for (size_type i=0; i < mf_vm.nb_dof(); ++i) {
     VM[i] = 0;
     scalar_type sdiag = 0.;
diff --git a/contrib/crack_plate/crack_mindlin.cc 
b/contrib/crack_plate/crack_mindlin.cc
index ff8056e0..ffbff658 100644
--- a/contrib/crack_plate/crack_mindlin.cc
+++ b/contrib/crack_plate/crack_mindlin.cc
@@ -938,7 +938,7 @@ void calcul_von_mises(const getfem::mesh_fem &mf_u, const 
VEC1 &U,
   getfem::compute_gradient(mf_u, mf_vm, U, DU);
   
   gmm::resize(VM, mf_vm.nb_dof());
-  scalar_type vm_min, vm_max;
+  scalar_type vm_min=0, vm_max=0;
   for (size_type i=0; i < mf_vm.nb_dof(); ++i) {
     VM[i] = 0;
     scalar_type sdiag = 0.;
diff --git a/src/getfem/bgeot_geometric_trans.h 
b/src/getfem/bgeot_geometric_trans.h
index edbd4f06..d5ef5590 100644
--- a/src/getfem/bgeot_geometric_trans.h
+++ b/src/getfem/bgeot_geometric_trans.h
@@ -419,7 +419,7 @@ namespace bgeot {
     pgeotrans_precomp pgp_;
     pstored_point_tab pspt_; /** if pgp != 0, it is the same as pgp's one */
     size_type ii_;           /** index of current point in the pgp */
-    mutable scalar_type J_, J__; /** Jacobian */
+    mutable scalar_type J_=0, J__=0; /** Jacobian */
     mutable base_matrix PC, B_factors;
     mutable base_vector aux1, aux2;
     mutable std::vector<long> ipvt;
@@ -519,7 +519,7 @@ namespace bgeot {
                                    const base_node& xref__,
                                    const base_matrix& G__)
       : xref_(xref__), G_(&G__), pgt_(pgt__), pgp_(0), pspt_(0),
-      ii_(size_type(-1)),have_J_(false), have_B_(false), have_B3_(false),
+      ii_(size_type(-1)), have_J_(false), have_B_(false), have_B3_(false),
       have_B32_(false), have_K_(false), have_cv_center_(false) {}
   };
 
diff --git a/src/getfem_contact_and_friction_common.cc 
b/src/getfem_contact_and_friction_common.cc
index e1597969..b9a1291d 100644
--- a/src/getfem_contact_and_friction_common.cc
+++ b/src/getfem_contact_and_friction_common.cc
@@ -1031,10 +1031,10 @@ namespace getfem {
         if (!ref_conf)
           slice_vector_on_basic_dof_of_element(mfu, disp_of_boundary(ib),
                                                cv, coeff);
-
         m.points_of_convex(cv, G);
-
-        const base_node &x0 = pf_s->ref_convex(cv)->points_of_face(iff)[0];
+        // face_pts is of type bgeot::convex<...>::ref_convex_pt_ct
+        const auto face_pts = pf_s->ref_convex(cv)->points_of_face(iff);
+        const base_node &x0 = face_pts[0];
         fem_interpolation_context ctx(pgt, pf_s, x0, G, cv, iff);
 
         const base_small_vector &n0 = pf_s->ref_convex(cv)->normals()[iff];
@@ -1733,8 +1733,9 @@ namespace getfem {
         //
 
         m_y.points_of_convex(cv_y, G_y);
-        const base_node &Y0
-          = pfu_y->ref_convex(cv_y)->points_of_face(face_y)[0];
+        // face_pts is of type bgeot::convex<...>::ref_convex_pt_ct
+        const auto face_pts = pfu_y->ref_convex(cv_y)->points_of_face(face_y);
+        const base_node &Y0 = face_pts[0];
         fem_interpolation_context ctx_y(pgt_y, pfu_y, Y0, G_y, cv_y, face_y);
         
         const base_small_vector &NY0
@@ -2162,8 +2163,9 @@ namespace getfem {
         // Classical projection for y by quasi Newton algorithm
         //
         bgeot::vectors_to_base_matrix(G_y, m_y.points_of_convex(cv_y));
-        const base_node &Y0
-          = pfu_y->ref_convex(cv_y)->points_of_face(face_y)[0];
+        // face_pts is of type bgeot::convex<...>::ref_convex_pt_ct
+        const auto face_pts = pfu_y->ref_convex(cv_y)->points_of_face(face_y);
+        const base_node &Y0 = face_pts[0];
         fem_interpolation_context ctx_y(pgt_y, pfu_y, Y0, G_y, cv_y, face_y);
         
         const base_small_vector &NY0
diff --git a/src/getfem_nonlinear_elasticity.cc 
b/src/getfem_nonlinear_elasticity.cc
index 10cbc5dd..e2f4d775 100644
--- a/src/getfem_nonlinear_elasticity.cc
+++ b/src/getfem_nonlinear_elasticity.cc
@@ -255,7 +255,10 @@ namespace getfem {
         j1_c(false), j2_c(false), di1_c(false), di2_c(false), di3_c(false),
         dj1_c(false), dj2_c(false), ddi1_c(false), ddi2_c(false),
         ddi3_c(false), ddj1_c(false), ddj2_c(false)
-      { N = gmm::mat_nrows(E); }
+    {
+      N = gmm::mat_nrows(E);
+      i1_=i2_=i3_=j1_=j2_=0.;
+    }
 
   };
 
diff --git a/tests/test_mesh.cc b/tests/test_mesh.cc
index cde62f5f..24994019 100644
--- a/tests/test_mesh.cc
+++ b/tests/test_mesh.cc
@@ -54,14 +54,16 @@ void test_conforming(getfem::mesh &m) {
   getfem::outer_faces_of_mesh(m, border_faces);
   size_type nb_faces = 0;
   for (getfem::mr_visitor i(border_faces); !i.finished(); ++i, nb_faces++) {
+    getfem::mesh::ref_mesh_face_pt_ct
+      face_pts = m.points_of_face_of_convex(i.cv(), i.f());
     for (size_type ip = 0; ip < dim; ++ip) {
       bool onbound = false;
-      const POINT &pt = m.points_of_face_of_convex(i.cv(), i.f())[ip];
+      const POINT &pt = face_pts[ip];
       for (size_type nc = 0; nc < dim; ++nc)
-       if (gmm::abs(pt[nc]) < 1E-10 || gmm::abs(pt[nc] - 1.0) < 1E-10)
-         onbound = true;
+        if (gmm::abs(pt[nc]) < 1E-10 || gmm::abs(pt[nc] - 1.0) < 1E-10)
+          onbound = true;
       if (!onbound)
-       GMM_ASSERT1(false, "Mesh is not conforming " << pt);
+        GMM_ASSERT1(false, "Mesh is not conforming " << pt);
     }
   }
   cout << "nb faces of mesh of dim " << dim << " : " << nb_faces << endl;
@@ -112,7 +114,7 @@ void test_mesh_matching(size_type dim) {
   
 
   getfem::parallelepiped_regular_simplex_mesh(m, bgeot::dim_type(dim), pt1, 
vects.begin(),
-                                             iref.begin());
+                                              iref.begin());
 
   test_conforming(m);
 }
@@ -280,7 +282,7 @@ void test_convex_quality(getfem::scalar_type dx, 
getfem::scalar_type dy) {
   for (size_type i=0; i < 10; ++i) {    
     size_type cv = m.add_triangle_by_points(A,B,C);
     cout << "Q=" << m.convex_quality_estimate(cv) << "\t"
-        << "R=" << m.convex_radius_estimate(cv) << endl;
+         << "R=" << m.convex_radius_estimate(cv) << endl;
     A[0] += dx; A[1] += dy;
   }
 }
@@ -338,7 +340,7 @@ void test_convex_ref() {
 //  }
 //
 //  basic_mesh_point_comparator2(unsigned dim_ = 3, double e = double(10000)
-//                            *gmm::default_tol(double()))
+//                               *gmm::default_tol(double()))
 //    : eps(e), v(dim_) {
 //    gmm::fill_random(v);
 //    gmm::scale(v, 1.0/gmm::vect_norm2(v));
@@ -372,8 +374,8 @@ void test_mesh_building(int dim, int Nsubdiv) {
 //   cout << "Time to insert points in structure with random component: "
 //        << gmm::uclock_sec() - exectime << endl;
 //   GMM_ASSERT1(pttab2.card() == m.nb_points(),
-//           "Problem in identifying points " << pttab2.card()
-//           << " : " << m.nb_points());
+//               "Problem in identifying points " << pttab2.card()
+//               << " : " << m.nb_points());
   
 
 //   // Test on the new structure
@@ -388,8 +390,8 @@ void test_mesh_building(int dim, int Nsubdiv) {
 //   cout << "Time to insert points in new structure: "
 //        << gmm::uclock_sec() - exectime << endl;
 //   GMM_ASSERT1(pttab3.card() == m.nb_points(),
-//           "Problem in identifying points " << pttab3.card()
-//           << " : " << m.nb_points());
+//               "Problem in identifying points " << pttab3.card()
+//               << " : " << m.nb_points());
   
 
 
@@ -406,22 +408,22 @@ void test_mesh_building(int dim, int Nsubdiv) {
 //       T0.push_back(m.points_of_convex(ic)[jp]);
 
 //       if (T0.size() >= 4) {
-//     size_type i = 0;
-//     for (; i < 30; ++i)
-//       if (trees[i].nb_points() == 0) break;
-
-//     // cout << "building tree " << i << endl;
-       
-//     for (size_type j = 0; j < 4; ++j)
-//       trees[i].add_point(T0[j]);
-//     T0.resize(0);
-
-//     for (size_type j = 0; j < i; ++j) {
-//       for (size_type k = 0; k < trees[j].nb_points(); ++k)
-//         trees[i].add_point(trees[j].points()[k].n);
-//       trees[j].clear();
-//     }
-//     trees[i].points_in_box(ipts, base_node(dim), base_node(dim));
+//         size_type i = 0;
+//         for (; i < 30; ++i)
+//           if (trees[i].nb_points() == 0) break;
+
+//         // cout << "building tree " << i << endl;
+        
+//         for (size_type j = 0; j < 4; ++j)
+//           trees[i].add_point(T0[j]);
+//         T0.resize(0);
+
+//         for (size_type j = 0; j < i; ++j) {
+//           for (size_type k = 0; k < trees[j].nb_points(); ++k)
+//             trees[i].add_point(trees[j].points()[k].n);
+//           trees[j].clear();
+//         }
+//         trees[i].points_in_box(ipts, base_node(dim), base_node(dim));
 //       }
       
 
@@ -438,7 +440,7 @@ void test_mesh_building(int dim, int Nsubdiv) {
   cout << "nb points = " << m.nb_points()
        << "nb dof = " << mf1.nb_dof() <<  endl;
   GMM_ASSERT1(m.nb_points() == mf1.nb_dof(),
-             "Problem in identifying dofs");
+              "Problem in identifying dofs");
 
   // shake a little bit the mesh
   getfem::mesh::PT_TAB &pts = m.points();
@@ -450,7 +452,7 @@ void test_mesh_building(int dim, int Nsubdiv) {
   cout << "nb points = " << m.nb_points()
        << "nb dof = " << mf2.nb_dof() <<  endl;
   GMM_ASSERT1(m.nb_points() == mf2.nb_dof(),
-             "Problem in identifying dofs");
+              "Problem in identifying dofs");
 
 }
 
diff --git a/tests/test_small_vector.cc b/tests/test_small_vector.cc
index 7abf61a3..cf5289a0 100644
--- a/tests/test_small_vector.cc
+++ b/tests/test_small_vector.cc
@@ -29,6 +29,7 @@
 #endif
 #include <valarray>
 #include <unistd.h>
+#include <random>
 #include "getfem/bgeot_small_vector.h"
 #include "getfem/getfem_mesh.h"
 
@@ -575,7 +576,7 @@ namespace getfem {
     for (size_type i=0; i < N; ++i) {
       std::vector<V> w, z;
       w = vv;
-      std::random_shuffle(vv.begin(), vv.end());
+      std::shuffle(vv.begin(), vv.end(), std::mt19937());
       z = w;
     }
     cout << " copies : " << c.toc().cpu() << " sec\n";
@@ -601,7 +602,8 @@ namespace getfem {
 //     }
     gmm::lexicographical_less<V, gmm::approx_less<typename V::value_type> > 
comp;
     c.init().tic();
-    init(vv); std::random_shuffle(vv.begin(), vv.end());
+    init(vv);
+    std::shuffle(vv.begin(), vv.end(), std::mt19937());
     for (size_type i=0; i < N*4; ++i) {
       size_type cnt = 0;
       for (size_type j=vv.size()-1; j > 0; --j) {
@@ -615,7 +617,7 @@ namespace getfem {
     cout << "mesh<base_node> : empty size = " << m.memsize() << "\n";
     init(vv);
     c.init().tic();
-    std::random_shuffle(vv.begin(), vv.end());
+    std::shuffle(vv.begin(), vv.end(), std::mt19937());
     for (size_type i=0; i < N; ++i) {
       m.clear();
       for (size_type j=0; j < vv.size(); ++j) {
@@ -633,7 +635,7 @@ namespace getfem {
     for (size_type j=0; j < w.size(); ++j) {
       w[j] = MICRO_VEC::alloc.allocate(3);
     }
-    std::random_shuffle(w.begin(), w.end());
+    std::shuffle(w.begin(), w.end(), std::mt19937());
     for (size_type j=0; j < w.size(); ++j) {
       MICRO_VEC::alloc.deallocate(w[j]);
     }



reply via email to

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