]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Change row_length type integers back to unsigned int, make related notes in documentation
authorKainan Wang <kennan.wong@gmail.com>
Fri, 19 Apr 2013 23:04:59 +0000 (23:04 +0000)
committerKainan Wang <kennan.wong@gmail.com>
Fri, 19 Apr 2013 23:04:59 +0000 (23:04 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29346 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/doxygen/headers/global_dof_index.h
deal.II/include/deal.II/lac/block_list.h
deal.II/include/deal.II/lac/block_sparsity_pattern.h
deal.II/include/deal.II/lac/sparse_matrix.templates.h
deal.II/include/deal.II/lac/sparsity_pattern.h
deal.II/include/deal.II/matrix_free/dof_info.templates.h
deal.II/source/dofs/dof_tools.cc
deal.II/source/lac/block_sparsity_pattern.cc
deal.II/source/lac/chunk_sparsity_pattern.cc
deal.II/source/lac/sparsity_pattern.cc

index fc6ae6c03ad5f10061acff146b5f54f69974a9dd..f01770a05017003fe84d1364b5a9afd4059cd760 100644 (file)
  * <dt class="glossary">@anchor GlobalDoFIndexSparseMatrix
  * <b>SparseMatrix</b></dt>
  * <dd>
- * The size SparseMatrix can be arbitrary large therefore,
- * types::global_do_index is used.
+ * The size of SparseMatrix can be arbitrary large therefore,
+ * types::global_do_index is used. However, even for a large complex problem we
+ * can solve now, there is no reason for the number of non-zero entries in a 
+ * sparse matrix to go over four billions. Thus, we still use unsigned int
+ * for, e.g., row_lengths in the object.
+ *
+ * 
  */
index bd67329c0adb54c24b001df29867e0ec39184b83..0a5d40b90534efab34049c29bad88b67ea0fc195 100644 (file)
@@ -296,7 +296,7 @@ inline
 void
 BlockList::create_sparsity_pattern(SparsityPattern &sparsity, size_type n) const
 {
-  std::vector<size_type> sizes(size());
+  std::vector<unsigned int> sizes(size());
   for (size_type b=0; b<size(); ++b)
     sizes[b] = block_size(b);
 
index 2de9afd2d9e496fc9ba6246e0eb69b835dc84964..d520376d1757613c9242d9bafdf2777a3a8b6ad6 100644 (file)
@@ -540,7 +540,7 @@ public:
    */
   void reinit (const BlockIndices &row_indices,
                const BlockIndices &col_indices,
-               const std::vector<std::vector<size_type> > &row_lengths);
+               const std::vector<std::vector<unsigned int> > &row_lengths);
 
 
   /**
@@ -968,7 +968,7 @@ public:
    * the @p index th entry in row @p row.
    */
   size_type column_number (const size_type row,
-                           const size_type index) const;
+                           const unsigned int index) const;
 
   /**
    * Allow the use of the reinit
@@ -1341,7 +1341,7 @@ BlockSparsityPatternBase<SparsityPatternBase>::n_block_rows () const
 inline
 BlockCompressedSimpleSparsityPattern::size_type
 BlockCompressedSimpleSparsityPattern::column_number (const size_type row,
-                                                     const size_type index) const
+                                                     const unsigned int index) const
 {
   // .first= ith block, .second = jth row in that block
   const std::pair<size_type ,size_type >
@@ -1350,9 +1350,9 @@ BlockCompressedSimpleSparsityPattern::column_number (const size_type row,
   Assert(index<row_length(row), ExcIndexRange(index, 0, row_length(row)));
 
   size_type c = 0;
-  for (size_type b=0; b<columns; ++b)
+  for (unsigned int b=0; b<columns; ++b)
     {
-      size_type rowlen = sub_objects[row_index.first][b]->row_length (row_index.second);
+      unsigned int rowlen = sub_objects[row_index.first][b]->row_length (row_index.second);
       if (index<c+rowlen)
         return c+sub_objects[row_index.first][b]->column_number(row_index.second, index-c);
       c += rowlen;
index 2e87e2eb340f1ec443990b408e9aa64c42873e80..cc5a68d4d342c8438720afc513687635bee70de4 100644 (file)
@@ -1010,7 +1010,7 @@ SparseMatrix<number>::mmult (SparseMatrix<numberC>       &C,
   // create an array that caches some
   // elements that are going to be written
   // into the new matrix.
-  size_type max_n_cols_B = 0;
+  unsigned int max_n_cols_B = 0;
   for (size_type i=0; i<B.m(); ++i)
     max_n_cols_B = std::max (max_n_cols_B, sp_B.row_length(i));
   std::vector<numberC> new_entries(max_n_cols_B);
@@ -1140,7 +1140,7 @@ SparseMatrix<number>::Tmmult (SparseMatrix<numberC>       &C,
   // create an array that caches some
   // elements that are going to be written
   // into the new matrix.
-  size_type max_n_cols_B = 0;
+  unsigned int max_n_cols_B = 0;
   for (size_type i=0; i<B.m(); ++i)
     max_n_cols_B = std::max (max_n_cols_B, sp_B.row_length(i));
   std::vector<numberC> new_entries(max_n_cols_B);
index aad75b9c4682fd6453215ecd278e5850091cf556..381e87250828f075f9d75ae277cee7083a7a6f4b 100644 (file)
@@ -436,7 +436,7 @@ public:
    */
   SparsityPattern (const size_type m,
                    const size_type n,
-                   const size_type max_per_row,
+                   const unsigned int max_per_row,
                    const bool optimize_diagonal) DEAL_II_DEPRECATED;
 
   /**
@@ -448,7 +448,7 @@ public:
    */
   SparsityPattern (const size_type m,
                    const size_type n,
-                   const size_type max_per_row);
+                   const unsigned int max_per_row);
 
   /**
    * Initialize a rectangular matrix.
@@ -464,7 +464,7 @@ public:
    */
   SparsityPattern (const size_type               m,
                    const size_type               n,
-                   const std::vector<size_type> &row_lengths,
+                   const std::vector<unsigned int> &row_lengths,
                    const bool optimize_diagonal) DEAL_II_DEPRECATED;
 
   /**
@@ -477,7 +477,7 @@ public:
    */
   SparsityPattern (const size_type               m,
                    const size_type               n,
-                   const std::vector<size_type> &row_lengths);
+                   const std::vector<unsigned int> &row_lengths);
 
   /**
    * Initialize a quadratic matrix of dimension <tt>n</tt> with at most
@@ -488,7 +488,7 @@ public:
    * numbers separately.
    */
   SparsityPattern (const size_type n,
-                   const size_type max_per_row);
+                   const unsigned int max_per_row);
 
   /**
    * Initialize a quadratic matrix.
@@ -502,7 +502,7 @@ public:
    *   it is ignored.
    */
   SparsityPattern (const size_type               m,
-                   const std::vector<size_type> &row_lengths,
+                   const std::vector<unsigned int> &row_lengths,
                    const bool optimize_diagonal) DEAL_II_DEPRECATED;
 
   /**
@@ -513,7 +513,7 @@ public:
    * vector must have one entry for each row.
    */
   SparsityPattern (const size_type               m,
-                   const std::vector<size_type> &row_lengths);
+                   const std::vector<unsigned int> &row_lengths);
 
   /**
    * Make a copy with extra off-diagonals.
@@ -538,7 +538,7 @@ public:
    * compressed after this function finishes.
    */
   SparsityPattern (const SparsityPattern  &original,
-                   const size_type        max_per_row,
+                   const unsigned int        max_per_row,
                    const size_type        extra_off_diagonals);
 
   /**
@@ -566,7 +566,7 @@ public:
    */
   void reinit (const size_type m,
                const size_type n,
-               const size_type max_per_row,
+               const unsigned int max_per_row,
                const bool optimize_diagonal) DEAL_II_DEPRECATED;
 
   /**
@@ -579,7 +579,7 @@ public:
    */
   void reinit (const size_type m,
                const size_type n,
-               const size_type max_per_row);
+               const unsigned int max_per_row);
 
   /**
    * Reallocate memory for a matrix of size <tt>m x n</tt>. The number of
@@ -600,7 +600,7 @@ public:
    */
   void reinit (const size_type               m,
                const size_type               n,
-               const std::vector<size_type> &row_lengths,
+               const std::vector<unsigned int> &row_lengths,
                const bool optimize_diagonal) DEAL_II_DEPRECATED;
 
   /**
@@ -619,7 +619,7 @@ public:
    */
   void reinit (const size_type               m,
                const size_type               n,
-               const std::vector<size_type> &row_lengths);
+               const std::vector<unsigned int> &row_lengths);
 
   /**
    * Same as above, but with a VectorSlice argument instead.
@@ -629,7 +629,7 @@ public:
    */
   void reinit (const size_type                                   m,
                const size_type                                   n,
-               const VectorSlice<const std::vector<size_type> > &row_lengths,
+               const VectorSlice<const std::vector<unsigned int> > &row_lengths,
                const bool optimize_diagonal) DEAL_II_DEPRECATED;
 
   /**
@@ -637,7 +637,7 @@ public:
    */
   void reinit (const size_type                                   m,
                const size_type                                   n,
-               const VectorSlice<const std::vector<size_type> > &row_lengths);
+               const VectorSlice<const std::vector<unsigned int> > &row_lengths);
 
   /**
    * This function compresses the sparsity structure that this object
@@ -1028,7 +1028,7 @@ public:
   /**
    * Number of entries in a specific row.
    */
-  size_type row_length (const size_type row) const;
+  unsigned int row_length (const size_type row) const;
 
   /**
    * Determine whether the matrix uses the special convention for quadratic
@@ -1131,7 +1131,7 @@ public:
    * <tt>column_number(row,i+1)</tt>.
    */
   size_type column_number (const size_type row,
-                           const size_type index) const;
+                           const unsigned int index) const;
 
 
 // @}
@@ -1367,7 +1367,7 @@ private:
    * reinit versions are called. Its value is more or less meaningless after
    * compress() has been called.
    */
-  size_type max_row_length;
+  unsigned int max_row_length;
 
   /**
    * Array which hold for each row which is the first element in #colnums
@@ -1766,7 +1766,7 @@ SparsityPattern::get_column_numbers () const
 
 
 inline
-SparsityPattern::size_type 
+unsigned int
 SparsityPattern::row_length (const size_type row) const
 {
   Assert(row<rows, ExcIndexRangeType<size_type>(row,0,rows));
@@ -1778,10 +1778,10 @@ SparsityPattern::row_length (const size_type row) const
 inline
 SparsityPattern::size_type 
 SparsityPattern::column_number (const size_type row,
-                                const size_type index) const
+                                const unsigned int index) const
 {
   Assert(row<rows, ExcIndexRangeType<size_type>(row,0,rows));
-  Assert(index<row_length(row), ExcIndexRangeType<size_type>(index,0,row_length(row)));
+  Assert(index<row_length(row), ExcIndexRange(index,0,row_length(row)));
 
   return colnums[rowstart[row]+index];
 }
@@ -1928,7 +1928,7 @@ SparsityPattern::copy_from (const size_type       n_rows,
   // is not yet present. as we have to call compress anyway later on, don't
   // bother to check whether that diagonal entry is in a certain row or not
   const bool is_square = (n_rows == n_cols);
-  std::vector<size_type> row_lengths;
+  std::vector<unsigned int> row_lengths;
   row_lengths.reserve(n_rows);
   for (ForwardIterator i=begin; i!=end; ++i)
     row_lengths.push_back (std::distance (i->begin(), i->end())
index ebb8577a2053e152bd3d5f5b39b4cc22ba2615fd..77a15a8d0bdc17905a38b3586b3cc0c82562d09a 100644 (file)
@@ -1702,10 +1702,10 @@ not_connect:
                                     task_info.n_blocks : size_info.n_active_cells;
 
       // first determine row lengths
-      std::vector<types::global_dof_index> row_lengths(n_rows);
+      std::vector<unsigned int> row_lengths(n_rows);
       unsigned int cell_start = 0, mcell_start = 0;
       std::vector<types::global_dof_index> scratch;
-      for (types::global_dof_index block = 0; block < n_blocks; ++block)
+      for (unsigned int block = 0; block < n_blocks; ++block)
         {
           // if we have the blocking variant (used in the coloring scheme), we
           // want to build a graph with the blocks with interaction with
index cecdc058a4c494d1d5928211373c9ca820244d96..11cca60f9eccc56ecf5b02256f5e71c3eb9e9d3f 100644 (file)
@@ -5830,7 +5830,7 @@ namespace DoFTools
                                              numbers::invalid_unsigned_int);
 
     // Estimate for the number of dofs at this point
-    std::vector<types::global_dof_index> vertex_dof_count(dof_handler.get_tria().n_vertices(), 0);
+    std::vector<unsigned int> vertex_dof_count(dof_handler.get_tria().n_vertices(), 0);
 
     // Identify all vertices active on this level and remember some data
     // about them
index 6560f604860c421668e928aba1eafed023c5f0bb..3df0ecb92ce0b940236c3b916e163b065219446a 100644 (file)
@@ -359,7 +359,7 @@ void
 BlockSparsityPattern::reinit(
   const BlockIndices &rows,
   const BlockIndices &cols,
-  const std::vector<std::vector<size_type> > &row_lengths)
+  const std::vector<std::vector<unsigned int> > &row_lengths)
 {
   AssertDimension (row_lengths.size(), cols.size());
 
@@ -375,7 +375,7 @@ BlockSparsityPattern::reinit(
                             cols.block_size(j), row_lengths[j][0]);
         else
           {
-            VectorSlice<const std::vector<size_type > >
+            VectorSlice<const std::vector<unsigned int> >
             block_rows(row_lengths[j], start, length);
             block(i,j).reinit(rows.block_size(i),
                               cols.block_size(j),
index 79a3aaabe6c3d9c90cd19edfa703104207b6c7ec..2c5a9442be69b1965875a29dd783c6506536dd9e 100644 (file)
@@ -222,7 +222,7 @@ ChunkSparsityPattern::reinit (
   // row zero at columns {0,2} and for row
   // one at {4,6} --> we'll need 4 chunks for
   // the first chunk row!) :
-  std::vector<size_type> chunk_row_lengths (m_chunks, 0);
+  std::vector<unsigned int> chunk_row_lengths (m_chunks, 0);
   for (size_type i=0; i<m; ++i)
     chunk_row_lengths[i/chunk_size] += row_lengths[i];
 
index 9875a7d1ba0f9a2ebc3c7420f10b524ac40b7ab7..27656dedf1d8ac9ac89fcab178b328e4cad02886 100644 (file)
@@ -72,7 +72,7 @@ SparsityPattern::SparsityPattern (const SparsityPattern &s)
 
 SparsityPattern::SparsityPattern (const size_type m,
                                   const size_type n,
-                                  const size_type max_per_row,
+                                  const unsigned int max_per_row,
                                   const bool)
   :
   max_dim(0),
@@ -89,7 +89,7 @@ SparsityPattern::SparsityPattern (const size_type m,
 
 SparsityPattern::SparsityPattern (const size_type m,
                                   const size_type n,
-                                  const size_type max_per_row)
+                                  const unsigned int max_per_row)
   :
   max_dim(0),
   max_vec_len(0),
@@ -105,7 +105,7 @@ SparsityPattern::SparsityPattern (const size_type m,
 
 SparsityPattern::SparsityPattern (const size_type m,
                                   const size_type n,
-                                  const std::vector<size_type> &row_lengths,
+                                  const std::vector<unsigned int> &row_lengths,
                                   const bool)
   :
   max_dim(0),
@@ -120,7 +120,7 @@ SparsityPattern::SparsityPattern (const size_type m,
 
 SparsityPattern::SparsityPattern (const size_type m,
                                   const size_type n,
-                                  const std::vector<size_type> &row_lengths)
+                                  const std::vector<unsigned int> &row_lengths)
   :
   max_dim(0),
   max_vec_len(0),
@@ -134,7 +134,7 @@ SparsityPattern::SparsityPattern (const size_type m,
 
 
 SparsityPattern::SparsityPattern (const size_type n,
-                                  const size_type max_per_row)
+                                  const unsigned int max_per_row)
   :
   max_dim(0),
   max_vec_len(0),
@@ -147,7 +147,7 @@ SparsityPattern::SparsityPattern (const size_type n,
 
 
 SparsityPattern::SparsityPattern (const size_type               m,
-                                  const std::vector<size_type> &row_lengths,
+                                  const std::vector<unsigned int> &row_lengths,
                                   const bool)
   :
   max_dim(0),
@@ -160,7 +160,7 @@ SparsityPattern::SparsityPattern (const size_type               m,
 
 
 SparsityPattern::SparsityPattern (const size_type               m,
-                                  const std::vector<size_type> &row_lengths)
+                                  const std::vector<unsigned int> &row_lengths)
   :
   max_dim(0),
   max_vec_len(0),
@@ -173,7 +173,7 @@ SparsityPattern::SparsityPattern (const size_type               m,
 
 
 SparsityPattern::SparsityPattern (const SparsityPattern &original,
-                                  const size_type        max_per_row,
+                                  const unsigned int        max_per_row,
                                   const size_type        extra_off_diagonals)
   :
   max_dim(0),
@@ -303,12 +303,12 @@ SparsityPattern::operator = (const SparsityPattern &s)
 void
 SparsityPattern::reinit (const size_type m,
                          const size_type n,
-                         const size_type max_per_row,
+                         const unsigned int max_per_row,
                          const bool)
 {
   // simply map this function to the
   // other @p{reinit} function
-  const std::vector<size_type> row_lengths (m, max_per_row);
+  const std::vector<unsigned int> row_lengths (m, max_per_row);
   reinit (m, n, row_lengths);
 }
 
@@ -317,11 +317,11 @@ SparsityPattern::reinit (const size_type m,
 void
 SparsityPattern::reinit (const size_type m,
                          const size_type n,
-                         const size_type max_per_row)
+                         const unsigned int max_per_row)
 {
   // simply map this function to the
   // other @p{reinit} function
-  const std::vector<size_type> row_lengths (m, max_per_row);
+  const std::vector<unsigned int> row_lengths (m, max_per_row);
   reinit (m, n, row_lengths);
 }
 
@@ -330,7 +330,7 @@ SparsityPattern::reinit (const size_type m,
 void
 SparsityPattern::reinit (const size_type m,
                          const size_type n,
-                         const VectorSlice<const std::vector<size_type> > &row_lengths,
+                         const VectorSlice<const std::vector<unsigned int> > &row_lengths,
                          const bool)
 {
   reinit (m, n, row_lengths);
@@ -341,7 +341,7 @@ SparsityPattern::reinit (const size_type m,
 void
 SparsityPattern::reinit (const size_type m,
                          const size_type n,
-                         const VectorSlice<const std::vector<size_type> > &row_lengths)
+                         const VectorSlice<const std::vector<unsigned int> > &row_lengths)
 {
   AssertDimension (row_lengths.size(), m);
 
@@ -381,11 +381,12 @@ SparsityPattern::reinit (const size_type m,
   // note that the number of elements
   // per row is bounded by the number
   // of columns
+  //
   std::size_t vec_len = 0;
   for (size_type i=0; i<m; ++i)
-    vec_len += std::min((store_diagonal_first_in_row ?
-                         std::max(row_lengths[i], static_cast<size_type> (1U)) :
-                         row_lengths[i]),
+    vec_len += std::min(static_cast<size_type>(store_diagonal_first_in_row ?
+                                              std::max(row_lengths[i], 1U) :
+                                              row_lengths[i]),
                         n);
 
   // sometimes, no entries are
@@ -410,8 +411,8 @@ SparsityPattern::reinit (const size_type m,
 
   max_row_length = (row_lengths.size() == 0 ?
                     0 :
-                    std::min (*std::max_element(row_lengths.begin(),
-                                                row_lengths.end()),
+                    std::min (static_cast<size_type>(*std::max_element(row_lengths.begin(),
+                                                                      row_lengths.end())),
                               n));
 
   if (store_diagonal_first_in_row && (max_row_length==0) && (m!=0))
@@ -462,8 +463,9 @@ SparsityPattern::reinit (const size_type m,
   for (size_type i=1; i<=rows; ++i)
     rowstart[i] = rowstart[i-1] +
                   (store_diagonal_first_in_row ?
-                   std::max(std::min(row_lengths[i-1],n),static_cast<size_type> (1U)) :
-                   std::min(row_lengths[i-1],n));
+                   std::max(std::min(static_cast<size_type>(row_lengths[i-1]),n),
+                           static_cast<size_type> (1U)) :
+                   std::min(static_cast<size_type>(row_lengths[i-1]),n));
   Assert ((rowstart[rows]==vec_len)
           ||
           ((vec_len == 1) && (rowstart[rows] == 0)),
@@ -637,7 +639,7 @@ SparsityPattern::copy_from (const CSP &csp)
   // diagonal entry is in a certain
   // row or not
   const bool do_diag_optimize = (csp.n_rows() == csp.n_cols());
-  std::vector<size_type> row_lengths (csp.n_rows());
+  std::vector<unsigned int> row_lengths (csp.n_rows());
   for (size_type i=0; i<csp.n_rows(); ++i)
     {
       row_lengths[i] = csp.row_length(i);
@@ -693,7 +695,7 @@ void SparsityPattern::copy_from (const FullMatrix<number> &matrix)
   // also have to allocate memory for the
   // diagonal entry, unless we have already
   // counted it
-  std::vector<size_type> entries_per_row (matrix.m(), 0);
+  std::vector<unsigned int> entries_per_row (matrix.m(), 0);
   for (size_type row=0; row<matrix.m(); ++row)
     {
       for (size_type col=0; col<matrix.n(); ++col)
@@ -723,7 +725,7 @@ void SparsityPattern::copy_from (const FullMatrix<number> &matrix)
 void
 SparsityPattern::reinit (const size_type               m,
                          const size_type               n,
-                         const std::vector<size_type> &row_lengths,
+                         const std::vector<unsigned int> &row_lengths,
                          const bool)
 {
   reinit(m, n, make_slice(row_lengths));
@@ -734,7 +736,7 @@ SparsityPattern::reinit (const size_type               m,
 void
 SparsityPattern::reinit (const size_type               m,
                          const size_type               n,
-                         const std::vector<size_type> &row_lengths)
+                         const std::vector<unsigned int> &row_lengths)
 {
   reinit(m, n, make_slice(row_lengths));
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.