From 7bd80e498c0461a5b8e9402220c61f136af3f3bd Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 30 May 2000 16:32:00 +0000 Subject: [PATCH] Take over corrected fix from 1.15. git-svn-id: https://svn.dealii.org/branches/Branch-3-0@2979 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/source/sparsity_pattern.cc | 67 +++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/deal.II/lac/source/sparsity_pattern.cc b/deal.II/lac/source/sparsity_pattern.cc index 024561dd67..012a1d73d6 100644 --- a/deal.II/lac/source/sparsity_pattern.cc +++ b/deal.II/lac/source/sparsity_pattern.cc @@ -31,6 +31,7 @@ SparsityPattern::SparsityPattern () : }; + SparsityPattern::SparsityPattern (const SparsityPattern &s) : Subscriptor(), max_dim(0), @@ -47,6 +48,7 @@ SparsityPattern::SparsityPattern (const SparsityPattern &s) : }; + SparsityPattern::SparsityPattern (const unsigned int m, const unsigned int n, const unsigned int max_per_row) @@ -59,6 +61,7 @@ SparsityPattern::SparsityPattern (const unsigned int m, }; + SparsityPattern::SparsityPattern (const unsigned int m, const unsigned int n, const vector &row_lengths) @@ -71,6 +74,7 @@ SparsityPattern::SparsityPattern (const unsigned int m, }; + SparsityPattern::SparsityPattern (const unsigned int n, const unsigned int max_per_row) : max_dim(0), @@ -82,6 +86,7 @@ SparsityPattern::SparsityPattern (const unsigned int n, }; + SparsityPattern::SparsityPattern (const unsigned int m, const vector &row_lengths) : max_dim(0), @@ -93,6 +98,7 @@ SparsityPattern::SparsityPattern (const unsigned int m, }; + SparsityPattern::SparsityPattern (const SparsityPattern &original, const unsigned int max_per_row, const unsigned int extra_off_diagonals) @@ -193,6 +199,7 @@ SparsityPattern::operator = (const SparsityPattern &s) Assert (rowstart == 0, ExcInvalidConstructorCall()); Assert (colnums == 0, ExcInvalidConstructorCall()); + Assert (rows == 0, ExcInvalidConstructorCall()); Assert (cols == 0, ExcInvalidConstructorCall()); @@ -200,6 +207,7 @@ SparsityPattern::operator = (const SparsityPattern &s) }; + void SparsityPattern::reinit (const unsigned int m, const unsigned int n, @@ -217,6 +225,7 @@ SparsityPattern::reinit (const unsigned int m, const unsigned int n, const vector &row_lengths) { + Assert (((m==0) && (n==0)) || (*max_element(row_lengths.begin(), row_lengths.end()) > 0), ExcInvalidNumber(*max_element(row_lengths.begin(), row_lengths.end()))); Assert (row_lengths.size() == m, ExcInvalidNumber (m)); @@ -229,6 +238,7 @@ SparsityPattern::reinit (const unsigned int m, { if (rowstart) delete[] rowstart; if (colnums) delete[] colnums; + rowstart = 0; colnums = 0; max_vec_len = max_dim = rows = cols = 0; @@ -316,6 +326,7 @@ SparsityPattern::compress () unsigned int *new_colnums = new unsigned int[nonzero_elements]; + // reserve temporary storage to // store the entries of one row vector tmp_entries (max_row_length); @@ -399,7 +410,8 @@ SparsityPattern::compress () bool -SparsityPattern::empty () const { +SparsityPattern::empty () const +{ // let's try to be on the safe side of // life by using multiple possibilities in // the check for emptiness... (sorry for @@ -430,6 +442,7 @@ SparsityPattern::max_entries_per_row () const // called, we can get the maximum // number of elements per row using // the stored value + if (!compressed) return max_row_length; @@ -488,6 +501,7 @@ SparsityPattern::operator () (const unsigned int i, } + void SparsityPattern::add (const unsigned int i, const unsigned int j) @@ -510,6 +524,7 @@ SparsityPattern::add (const unsigned int i, }; }; + // if we came thus far, something went // wrong: there was not enough space // in this line @@ -531,7 +546,7 @@ SparsityPattern::print_gnuplot (ostream &out) const // is x-y, that is we have to // exchange the order of // output - out << static_cast(colnums[j]) << " " << -i << endl; + out << colnums[j] << " " << -static_cast(i) << endl; AssertThrow (out, ExcIO()); } @@ -553,6 +568,54 @@ SparsityPattern::bandwidth () const // leave if at the end of // the entries of this line break; + return b; }; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.39.5