From 72e24b3c2076a6485eeb1984b32550be3aef232d Mon Sep 17 00:00:00 2001 From: guido Date: Fri, 1 Jul 2005 11:56:06 +0000 Subject: [PATCH] another bug in SparsityPattern::block_read / block_write removed Functions are tested now git-svn-id: https://svn.dealii.org/trunk@11031 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/source/sparsity_pattern.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/deal.II/lac/source/sparsity_pattern.cc b/deal.II/lac/source/sparsity_pattern.cc index 842183200c..1918111286 100644 --- a/deal.II/lac/source/sparsity_pattern.cc +++ b/deal.II/lac/source/sparsity_pattern.cc @@ -882,7 +882,7 @@ SparsityPattern::block_write (std::ostream &out) const << diagonal_optimized << "]["; // then write out real data out.write (reinterpret_cast(&rowstart[0]), - reinterpret_cast(&rowstart[max_dim]) + reinterpret_cast(&rowstart[max_dim+1]) - reinterpret_cast(&rowstart[0])); out << "]["; out.write (reinterpret_cast(&colnums[0]), @@ -919,15 +919,17 @@ SparsityPattern::block_read (std::istream &in) AssertThrow (c == '[', ExcIO()); // reallocate space - delete[] rowstart; + if (rowstart) + delete[] rowstart; + if (colnums) delete[] colnums; - rowstart = new unsigned int[max_dim]; + rowstart = new unsigned int[max_dim+1]; colnums = new unsigned int[max_vec_len]; // then read data in.read (reinterpret_cast(&rowstart[0]), - reinterpret_cast(&rowstart[max_dim]) + reinterpret_cast(&rowstart[max_dim+1]) - reinterpret_cast(&rowstart[0])); in >> c; AssertThrow (c == ']', ExcIO()); -- 2.39.5