From bff8c75f63e40f4b65a8aa8912e7ecd626f953e1 Mon Sep 17 00:00:00 2001 From: heister Date: Mon, 25 Feb 2013 23:16:09 +0000 Subject: [PATCH] Parallel sparse matrices now also require the use of compress(VectorOperation) like vectors do. Old functions are now deprecated. git-svn-id: https://svn.dealii.org/trunk@28561 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 6 ++++++ deal.II/examples/step-32/step-32.cc | 9 ++++----- deal.II/examples/step-40/step-40.cc | 2 +- .../include/deal.II/lac/block_matrix_base.h | 16 ++++++++++++++-- .../include/deal.II/lac/petsc_matrix_base.h | 9 +++++++-- .../deal.II/lac/trilinos_sparse_matrix.h | 19 ++++++++++++++++--- deal.II/source/lac/petsc_matrix_base.cc | 8 ++++++++ 7 files changed, 56 insertions(+), 13 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 90e499d8f7..866406c2b7 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -163,6 +163,12 @@ never working correctly and it is not used.
    +
  1. Changed: parallel sparse matrices now also require the use of +compress(VectorOperation) like vectors do. See the glossary for details. +Old functions are now deprecated. +
    +(Timo Heister, 2013/02/25) +
  2. New: step-49 demonstrates advanced techniques for mesh creation and manipulation.
    diff --git a/deal.II/examples/step-32/step-32.cc b/deal.II/examples/step-32/step-32.cc index e67bc9f1d8..2430c9ea74 100644 --- a/deal.II/examples/step-32/step-32.cc +++ b/deal.II/examples/step-32/step-32.cc @@ -2235,7 +2235,7 @@ namespace Step32 Assembly::CopyData:: StokesPreconditioner (stokes_fe)); - stokes_preconditioner_matrix.compress(); + stokes_preconditioner_matrix.compress(VectorOperation::add); } @@ -2432,7 +2432,7 @@ namespace Step32 Assembly::CopyData:: StokesSystem (stokes_fe)); - stokes_matrix.compress(); + stokes_matrix.compress(VectorOperation::add); stokes_rhs.compress(VectorOperation::add); rebuild_stokes_matrix = false; @@ -2542,8 +2542,8 @@ namespace Step32 Assembly::CopyData:: TemperatureMatrix (temperature_fe)); - temperature_mass_matrix.compress(); - temperature_stiffness_matrix.compress(); + temperature_mass_matrix.compress(VectorOperation::add); + temperature_stiffness_matrix.compress(VectorOperation::add); rebuild_temperature_matrices = false; rebuild_temperature_preconditioner = true; @@ -2785,7 +2785,6 @@ namespace Step32 temperature_matrix.copy_from (temperature_mass_matrix); temperature_matrix.add (time_step, temperature_stiffness_matrix); } - temperature_matrix.compress(); if (rebuild_temperature_preconditioner == true) { diff --git a/deal.II/examples/step-40/step-40.cc b/deal.II/examples/step-40/step-40.cc index 54e26fdc92..5c2ce3bbee 100644 --- a/deal.II/examples/step-40/step-40.cc +++ b/deal.II/examples/step-40/step-40.cc @@ -391,7 +391,7 @@ namespace Step40 system_rhs); } - system_matrix.compress (); + system_matrix.compress (VectorOperation::add); system_rhs.compress (VectorOperation::add); } diff --git a/deal.II/include/deal.II/lac/block_matrix_base.h b/deal.II/include/deal.II/lac/block_matrix_base.h index c81fabf3ab..62ef9d1bb3 100644 --- a/deal.II/include/deal.II/lac/block_matrix_base.h +++ b/deal.II/include/deal.II/lac/block_matrix_base.h @@ -762,8 +762,12 @@ public: * distributed objects" for more * information. */ - void compress (::dealii::VectorOperation::values operation - =::dealii::VectorOperation::unknown); + void compress (::dealii::VectorOperation::values operation); + + /** + * @deprecated: use compress() with VectorOperation instead. + */ + void compress () DEAL_II_DEPRECATED; /** * Multiply the entire matrix by a @@ -2359,6 +2363,14 @@ BlockMatrixBase::compress (::dealii::VectorOperation::values operati block(r,c).compress (operation); } +template +inline +void +BlockMatrixBase::compress () +{ + compress(::dealii::VectorOperation::unknown); +} + template diff --git a/deal.II/include/deal.II/lac/petsc_matrix_base.h b/deal.II/include/deal.II/lac/petsc_matrix_base.h index a62cec2600..9abcafd6d2 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_base.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_base.h @@ -672,8 +672,13 @@ namespace PETScWrappers * for more information. * more information. */ - void compress (::dealii::VectorOperation::values operation - =::dealii::VectorOperation::unknown); + void compress (::dealii::VectorOperation::values operation); + + /** + * @deprecated: use compress() with VectorOperation instead. + */ + void compress () DEAL_II_DEPRECATED; + /** * Return the value of the entry * (i,j). This may be an diff --git a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h index 688c21eae3..13cfcae00a 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -1375,8 +1375,12 @@ namespace TrilinosWrappers * See @ref GlossCompress "Compressing distributed objects" * for more information. */ - void compress (::dealii::VectorOperation::values operation - =::dealii::VectorOperation::unknown); + void compress (::dealii::VectorOperation::values operation); + + /** + * @deprecated: use compress() with VectorOperation instead. + */ + void compress () DEAL_II_DEPRECATED; /** * Set the element (i,j) @@ -3047,12 +3051,21 @@ namespace TrilinosWrappers + inline + void + SparseMatrix::compress () + { + compress(::dealii::VectorOperation::unknown); + } + + + inline SparseMatrix & SparseMatrix::operator = (const double d) { Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - compress (); + compress (::dealii::VectorOperation::unknown); // TODO: why do we do this? Should we not check for is_compressed? const int ierr = matrix->PutScalar(d); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index f41fbd9f21..50962f17f4 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -263,6 +263,14 @@ namespace PETScWrappers + void + MatrixBase::compress () + { + compress(::dealii::VectorOperation::unknown); + } + + + unsigned int MatrixBase::m () const { -- 2.39.5