getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] r5428 - in /trunk/getfem: contrib/opt_assembly/opt_asse


From: Yves . Renard
Subject: [Getfem-commits] r5428 - in /trunk/getfem: contrib/opt_assembly/opt_assembly.cc src/bgeot_geometric_trans.cc src/getfem_mesh_region.cc
Date: Wed, 19 Oct 2016 19:18:34 -0000

Author: renard
Date: Wed Oct 19 21:18:33 2016
New Revision: 5428

URL: http://svn.gna.org/viewcvs/getfem?rev=5428&view=rev
Log:
mior optimization

Modified:
    trunk/getfem/contrib/opt_assembly/opt_assembly.cc
    trunk/getfem/src/bgeot_geometric_trans.cc
    trunk/getfem/src/getfem_mesh_region.cc

Modified: trunk/getfem/contrib/opt_assembly/opt_assembly.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/contrib/opt_assembly/opt_assembly.cc?rev=5428&r1=5427&r2=5428&view=diff
==============================================================================
--- trunk/getfem/contrib/opt_assembly/opt_assembly.cc   (original)
+++ trunk/getfem/contrib/opt_assembly/opt_assembly.cc   Wed Oct 19 21:18:33 2016
@@ -249,7 +249,7 @@
   chrono ch;
   
   bool all = false;
-  bool select = false;
+  bool select = true;
   int only_one = 4;
 
   if (all || only_one == 1) {
@@ -443,25 +443,25 @@
   // Laplacian            : 0.20 | 0.83 | 0.04 | 0.05 | 0.10 | 0.05 |
   // Homogeneous elas     : 0.34 | 1.88 | 0.08 | 0.13 | 0.10 | 0.11 |
   // Non-homogeneous elast: 0.40 | 2.26 | 0.09 | 0.16 | 0.10 | 0.14 |
-  // test_new_assembly(3, 36, 1);  // ndofu = 151959 ndofp =  50653 ndofchi = 
6553
+  test_new_assembly(3, 36, 1);  // ndofu = 151959 ndofp =  50653 ndofchi = 6553
   // Mass (scalar)        : 0.33 | 0.77 | 0.05 | 0.10 | 0.17 | 0.06 |
   // Mass (vector)        : 0.86 | 1.54 | 0.17 | 0.34 | 0.17 | 0.35 |
   // Laplacian            : 0.37 | 1.38 | 0.03 | 0.06 | 0.17 | 0.14 |
   // Homogeneous elas     : 0.98 | 4.58 | 0.26 | 0.34 | 0.17 | 0.47 |
   // Non-homogeneous elast: 1.05 | 6.72 | 0.26 | 0.34 | 0.17 | 0.54 |
-  // test_new_assembly(2, 200, 2); // ndofu = 321602 ndofp = 160801 ndofchi = 
1201
+  test_new_assembly(2, 200, 2); // ndofu = 321602 ndofp = 160801 ndofchi = 1201
   // Mass (scalar)        : 0.11 | 0.25 | 0.02 | 0.04 | 0.04 | 0.03 |
   // Mass (vector)        : 0.30 | 0.44 | 0.05 | 0.12 | 0.04 | 0.14 |
   // Laplacian            : 0.10 | 0.37 | 0.02 | 0.03 | 0.04 | 0.03 |
   // Homogeneous elas     : 0.28 | 1.28 | 0.06 | 0.10 | 0.04 | 0.14 |
   // Non-homogeneous elast: 0.34 | 2.40 | 0.07 | 0.11 | 0.04 | 0.19 |
-  // test_new_assembly(3, 18, 2);  // ndofu = 151959 ndofp =  50653 ndofchi = 
6553
+  test_new_assembly(3, 18, 2);  // ndofu = 151959 ndofp =  50653 ndofchi = 6553
   // Mass (scalar)        : 0.15 | 0.29 | 0.05 | 0.09 | 0.03 | 0.03 |
   // Mass (vector)        : 1.32 | 0.90 | 0.21 | 0.51 | 0.03 | 0.78 |
   // Laplacian            : 0.11 | 0.55 | 0.03 | 0.05 | 0.03 | 0.05 |
   // Homogeneous elas     : 1.73 | 3.47 | 0.59 | 0.76 | 0.03 | 0.94 |
   // Non-homogeneous elast: 1.80 | 9.25 | 0.59 | 0.76 | 0.03 | 1.01 |
-  // test_new_assembly(3, 9, 4);   // ndofu = 151959 ndofp =  50653 ndofchi = 
6553
+  test_new_assembly(3, 9, 4);   // ndofu = 151959 ndofp =  50653 ndofchi = 6553
   // Mass (scalar)        : 0.59 | 0.34 | 0.09 | 0.23 | 0.01 | 0.34 |
   // Mass (vector)        : 4.87 | 1.32 | 0.41 | 1.71 | 0.01 | 3.15 |
   // Laplacian            : 0.44 | 0.77 | 0.09 | 0.18 | 0.01 | 0.25 |

Modified: trunk/getfem/src/bgeot_geometric_trans.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/bgeot_geometric_trans.cc?rev=5428&r1=5427&r2=5428&view=diff
==============================================================================
--- trunk/getfem/src/bgeot_geometric_trans.cc   (original)
+++ trunk/getfem/src/bgeot_geometric_trans.cc   Wed Oct 19 21:18:33 2016
@@ -30,7 +30,23 @@
 
   void geometric_trans::compute_K_matrix
     (const base_matrix &G, const base_matrix &pc, base_matrix &K) const{
-    gmm::mult(G, pc, K);
+    // gmm::mult(G, pc, K);
+
+    // Faster than the lapack call on my config ...
+    size_type N=gmm::mat_nrows(G), P=gmm::mat_nrows(pc), Q=gmm::mat_ncols(pc);
+    if (N && P && Q) {
+      auto itK = K.begin();
+      
+      for (size_type i = 0; i < N; ++i)
+       for (size_type j = 0; j < Q; ++j) {
+         auto itG = G.begin() + j;
+         auto itpc = pc.begin() + i*P;
+         *itK = *(itG) * (*itpc++); itG += N;
+         for (size_type k = 1; k < P; ++k, itG += N)
+           *itK += *(itG) * (*itpc++);
+         ++itK;
+       }
+    }
   }
 
   const base_node& geotrans_interpolation_context::xref() const {

Modified: trunk/getfem/src/getfem_mesh_region.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_mesh_region.cc?rev=5428&r1=5427&r2=5428&view=diff
==============================================================================
--- trunk/getfem/src/getfem_mesh_region.cc      (original)
+++ trunk/getfem/src/getfem_mesh_region.cc      Wed Oct 19 21:18:33 2016
@@ -515,47 +515,60 @@
                 "of convexes or a set of faces, but not a mixed set");
   }
 
-  mesh_region::visitor::visitor(const mesh_region &s, const mesh &m, bool
+
+
+
 #if GETFEM_PARA_LEVEL > 1
-                               intersect_with_mpi
-#endif
-  ) :cv_(size_type(-1)), f_(short_type(-1)), finished_(false) 
+  
+  mesh_region::visitor::visitor(const mesh_region &s, const mesh &m,
+                               bool intersect_with_mpi) :
+    cv_(size_type(-1)), f_(short_type(-1)), finished_(false) 
   {
     if ((me_is_multithreaded_now() && s.partitioning_allowed)) {
       s.from_mesh(m);
       init(s);
     } else {
       if (s.id() == size_type(-1)) {
-#if GETFEM_PARA_LEVEL > 1
        if (intersect_with_mpi)
          init(m.get_mpi_region());
        else
          init(m.convex_index());
-#else
-       init(m.convex_index());
-#endif
       } else if (s.p.get())  {
-#if GETFEM_PARA_LEVEL > 1
        if (intersect_with_mpi)
          { mpi_rg = s; m.intersect_with_mpi_region(mpi_rg); init(mpi_rg); }
        else
          init(s);
-#else
-       init(s);
-#endif
       } else {
-#if GETFEM_PARA_LEVEL > 1
        if (intersect_with_mpi)
          init(m.get_mpi_sub_region(s.id()));
        else
          init(m.region(s.id()));
+      }
+    }
+  }
+
 #else
+  
+  mesh_region::visitor::visitor(const mesh_region &s, const mesh &m, bool)
+    :cv_(size_type(-1)), f_(short_type(-1)), finished_(false) 
+  {
+    if ((me_is_multithreaded_now() && s.partitioning_allowed)) {
+      s.from_mesh(m);
+      init(s);
+    } else {
+      if (s.id() == size_type(-1)) {
+       init(m.convex_index());
+      } else if (s.p.get())  {
+       init(s);
+      } else {
        init(m.region(s.id()));
+      }
+    }
+  }
+
 #endif
-      }
-    }
-  }
-
+
+  
   bool mesh_region::visitor::next() 
   {
     if (whole_mesh) {




reply via email to

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