changeset 166:40ae9e5dfb93

Use the uBLAS for an estimation of the nnz elements for excess.
author gedeone-octave <marcovass89@hotmail.it>
date Sat, 05 Oct 2013 22:27:03 +0100
parents 3ae8a7398f43
children 3895c8d4c066
files src/assemble.cc src/assemble_system.cc
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/assemble.cc	Sat Oct 05 22:25:52 2013 +0100
+++ b/src/assemble.cc	Sat Oct 05 22:27:03 2013 +0100
@@ -76,6 +76,7 @@
                     {
                       std::cout << "Assembling Matrix from the bilinear form..."
                         << std::endl;
+                      dolfin::parameters["linear_algebra_backend"] = "uBLAS";
                       dolfin::Matrix A;
                       dolfin::assemble (A, a);
 
@@ -96,11 +97,14 @@
                             error ("assemble: unknown argument type");
                         }
 
+//                    It provides an estimation for excess of nnz elements
+                      boost::tuples::tuple<const std::size_t*, const std::size_t*, const double*, int> aa = A.data ();
+                      int nnz = aa.get<3> ();
                       std::size_t nr = A.size (0), nc = A.size (1);
                       std::vector<double> data_tmp;
                       std::vector<std::size_t> cidx_tmp;
 
-                      octave_idx_type dims = A.size (0), nz = 0, ii = 0;
+                      octave_idx_type dims = nnz, nz = 0, ii = 0;
                       ColumnVector ridx (dims), cidx (dims), data (dims);
 
                       for (std::size_t i = 0; i < nr; ++i)
--- a/src/assemble_system.cc	Sat Oct 05 22:25:52 2013 +0100
+++ b/src/assemble_system.cc	Sat Oct 05 22:27:03 2013 +0100
@@ -100,13 +100,17 @@
                             error ("assemble_system: unknown argument type");
                         }
 
+//                    It provides an estimation for excess of nnz elements
+                      boost::tuples::tuple<const std::size_t*, const std::size_t*, const double*, int> aa = A.data ();
+                      int nnz = aa.get<3> ();
+
                       std::cout << "Assembling Matrix from the bilinear form..."
                         << std::endl;
                       std::size_t nr = A.size (0), nc = A.size (1);
                       std::vector<double> data_tmp;
                       std::vector<std::size_t> cidx_tmp;
 
-                      octave_idx_type dims = A.size (0), nz = 0, ii = 0;
+                      octave_idx_type dims = nnz, nz = 0, ii = 0;
                       ColumnVector ridx (dims), cidx (dims), data (dims);
 
                       for (std::size_t i = 0; i < nr; ++i)
@@ -206,13 +210,17 @@
                             error ("assemble_system: unknown argument type");
                         }
 
+//                    It provides an estimation for excess of nnz elements
+                      boost::tuples::tuple<const std::size_t*, const std::size_t*, const double*, int> aa = A.data ();
+                      int nnz = aa.get<3> ();
+
                       std::cout << "Assembling Matrix from the bilinear form..."
                         << std::endl;
                       std::size_t nr = A.size (0), nc = A.size (1);
                       std::vector<double> data_tmp;
                       std::vector<std::size_t> cidx_tmp;
 
-                      octave_idx_type dims = A.size (0), nz = 0, ii = 0;
+                      octave_idx_type dims = nnz, nz = 0, ii = 0;
                       ColumnVector ridx (dims), cidx (dims), data (dims);
 
                       for (std::size_t i = 0; i < nr; ++i)