From a3012ad404fed6fce55073f952fdb67879a6d167 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 22 Jun 2004 19:16:17 +0000 Subject: [PATCH] Templatize apply_boundary_values for BlockMatrices git-svn-id: https://svn.dealii.org/trunk@9458 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/numerics/matrices.h | 7 ++-- .../numerics/matrices.all_dimensions.cc | 34 ++++++++++++++----- deal.II/doc/news/c-5.0.html | 8 +++++ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/deal.II/deal.II/include/numerics/matrices.h b/deal.II/deal.II/include/numerics/matrices.h index 5534a448b6..b484fb4098 100644 --- a/deal.II/deal.II/include/numerics/matrices.h +++ b/deal.II/deal.II/include/numerics/matrices.h @@ -781,11 +781,12 @@ class MatrixTools : public MatrixCreator * local_apply_boundary_values() * function. */ + template static void apply_boundary_values (const std::map &boundary_values, - BlockSparseMatrix &matrix, - BlockVector &solution, - BlockVector &right_hand_side, + BlockSparseMatrix &matrix, + BlockVector &solution, + BlockVector &right_hand_side, const bool eliminate_columns = true); /** diff --git a/deal.II/deal.II/source/numerics/matrices.all_dimensions.cc b/deal.II/deal.II/source/numerics/matrices.all_dimensions.cc index ef786a0040..282428e736 100644 --- a/deal.II/deal.II/source/numerics/matrices.all_dimensions.cc +++ b/deal.II/deal.II/source/numerics/matrices.all_dimensions.cc @@ -194,11 +194,12 @@ MatrixTools::apply_boundary_values (const std::map &boundar +template void MatrixTools::apply_boundary_values (const std::map &boundary_values, - BlockSparseMatrix &matrix, - BlockVector &solution, - BlockVector &right_hand_side, + BlockSparseMatrix &matrix, + BlockVector &solution, + BlockVector &right_hand_side, const bool preserve_symmetry) { const unsigned int blocks = matrix.n_block_rows(); @@ -219,7 +220,7 @@ MatrixTools::apply_boundary_values (const std::map &boundar right_hand_side.get_block_indices (), ExcBlocksDontMatch ()); - for (unsigned int i=0;i &boundar // the first nonzero diagonal // element of the matrix, or 1 if // there is no such thing - double first_nonzero_diagonal_entry = 0; + number first_nonzero_diagonal_entry = 0; for (unsigned int diag_block=0; diag_block &boundar first_nonzero_diagonal_entry = matrix.block(diag_block,diag_block).diag_element(i); break; - }; + } // check whether we have found // something in the present // block if (first_nonzero_diagonal_entry != 0) break; - }; + } // nothing found on all diagonal // blocks? if so, use 1.0 instead if (first_nonzero_diagonal_entry == 0) @@ -337,7 +338,7 @@ MatrixTools::apply_boundary_values (const std::map &boundar // // store the new rhs entry to make // the gauss step more efficient - double new_rhs; + number new_rhs; if (matrix.block(block_index.first, block_index.first) .diag_element(block_index.second) != 0.0) new_rhs = dof->second * @@ -368,7 +369,7 @@ MatrixTools::apply_boundary_values (const std::map &boundar // store the only nonzero entry // of this line for the Gauss // elimination step - const double diagonal_entry + const number diagonal_entry = matrix.block(block_index.first,block_index.first) .diag_element(block_index.second); @@ -777,3 +778,18 @@ MatrixTools::apply_boundary_values (const std::map & Vector &solution, Vector &right_hand_side, const bool preserve_symmetry); + +template +void +MatrixTools::apply_boundary_values (const std::map &boundary_values, + BlockSparseMatrix &matrix, + BlockVector &solution, + BlockVector &right_hand_side, + const bool preserve_symmetry); +template +void +MatrixTools::apply_boundary_values (const std::map &boundary_values, + BlockSparseMatrix &matrix, + BlockVector &solution, + BlockVector &right_hand_side, + const bool preserve_symmetry); diff --git a/deal.II/doc/news/c-5.0.html b/deal.II/doc/news/c-5.0.html index 7135bd3354..bc4824cc0f 100644 --- a/deal.II/doc/news/c-5.0.html +++ b/deal.II/doc/news/c-5.0.html @@ -219,6 +219,14 @@ inconvenience this causes.

deal.II

    +
  1. + New: The MatrixTools::apply_boundary_values + that works on block matrices and vectors is now templatized over the + number type, i.e. it also works for float matrices and vectors. +
    + (WB 2004/06/22) +

    +
  2. New: The new FEValuesBase::get_cell function returns the current cell, i.e. the latest cell the -- 2.39.5