From 800ac1ee66930b7e9854bc9354b2cb6be7e8ba3b Mon Sep 17 00:00:00 2001 From: heister Date: Fri, 27 Sep 2013 12:48:12 +0000 Subject: [PATCH] fix crash in ConstraintMatrix constructor taking IndexSet (release mode only) git-svn-id: https://svn.dealii.org/trunk@30977 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 7 +++++++ deal.II/include/deal.II/lac/constraint_matrix.h | 7 ++++++- deal.II/source/lac/constraint_matrix.cc | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 50ee4dca19..28389d0e3b 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -85,6 +85,13 @@ inconvenience this causes.

Specific improvements

    +
  1. + Fixed: ConstraintMatrix would not compress() the IndexSet in the constructor + leading to crashes that only happen in release mode. This is now fixed. +
    + (Timo Heister, 2013/09/27) +
  2. +
  3. Fixed: PetscWrappers::MatrixBase::row_length() no longer worked after recent changes to PETSc (around PETSc release 3.4). This is now fixed. diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index 7d5ae2e78b..4bb240c83c 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.h @@ -1850,7 +1850,12 @@ ConstraintMatrix::ConstraintMatrix (const IndexSet &local_constraints) lines (), local_lines (local_constraints), sorted (false) -{} +{ + // make sure the IndexSet is compressed. Otherwise this can lead to crashes + // that are hard to find (only happen in release mode). + // see tests/mpi/constraint_matrix_crash_01 + local_lines.compress(); +} diff --git a/deal.II/source/lac/constraint_matrix.cc b/deal.II/source/lac/constraint_matrix.cc index 79f46bad9c..4c1a7e8fac 100644 --- a/deal.II/source/lac/constraint_matrix.cc +++ b/deal.II/source/lac/constraint_matrix.cc @@ -631,6 +631,12 @@ void ConstraintMatrix::clear () void ConstraintMatrix::reinit (const IndexSet &local_constraints) { local_lines = local_constraints; + + // make sure the IndexSet is compressed. Otherwise this can lead to crashes + // that are hard to find (only happen in release mode). + // see tests/mpi/constraint_matrix_crash_01 + local_lines.compress(); + clear(); } -- 2.39.5