From: Martin Kronbichler Date: Thu, 4 Feb 2010 15:13:00 +0000 (+0000) Subject: Set matrix size by std::size_t, not unsigned int, since on very large matrices with... X-Git-Tag: v8.0.0~6550 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f206f02f8e4ed8d63eec8910be9fcd469d5aa875;p=dealii.git Set matrix size by std::size_t, not unsigned int, since on very large matrices with more than four billion nonzeros we might end up in setting the wrong matrix size. git-svn-id: https://svn.dealii.org/trunk@20497 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index 4759efb28c..adeb294d95 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -797,7 +797,7 @@ class SparseMatrix : public virtual Subscriptor * of this object. See * MemoryConsumption. */ - unsigned int memory_consumption () const; + std::size_t memory_consumption () const; //@} /** @@ -2100,7 +2100,7 @@ class SparseMatrix : public virtual Subscriptor * object, using the reinit() * function. */ - unsigned int max_len; + std::size_t max_len; // make all other sparse matrices // friends diff --git a/deal.II/lac/include/lac/sparse_matrix.templates.h b/deal.II/lac/include/lac/sparse_matrix.templates.h index 204443ee5c..e2c70d60b9 100644 --- a/deal.II/lac/include/lac/sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/sparse_matrix.templates.h @@ -176,7 +176,7 @@ SparseMatrix::reinit (const SparsityPattern &sparsity) return; } - const unsigned int N = cols->n_nonzero_elements(); + const std::size_t N = cols->n_nonzero_elements(); if (N > max_len || max_len == 0) { if (val != 0) @@ -1885,10 +1885,10 @@ SparseMatrix::block_read (std::istream &in) template -unsigned int +std::size_t SparseMatrix::memory_consumption () const { - return sizeof(*this) + max_len*sizeof(number); + return max_len*static_cast(sizeof(number)) + sizeof(*this); }