From aca807f1113262abfd4d93502ceb6925bf7c7253 Mon Sep 17 00:00:00 2001 From: guido Date: Mon, 29 Oct 2001 09:47:59 +0000 Subject: [PATCH] scaling of blocks implemented git-svn-id: https://svn.dealii.org/trunk@5172 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_matrix_array.h | 50 +++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/deal.II/lac/include/lac/block_matrix_array.h b/deal.II/lac/include/lac/block_matrix_array.h index 8ad7c822c1..cde75f9ffb 100644 --- a/deal.II/lac/include/lac/block_matrix_array.h +++ b/deal.II/lac/include/lac/block_matrix_array.h @@ -228,18 +228,31 @@ BlockMatrixArray::vmult_add (BlockVector& dst, Assert (src.n_blocks() == block_cols, ExcDimensionMismatch(src.n_blocks(), block_cols)); + static Vector aux; + typename vector::const_iterator m = entries.begin(); typename vector::const_iterator end = entries.end(); for (; m != end ; ++m) { - Assert (m->prefix==1., ExcNotImplemented()); - if (m->transpose) - m->matrix->Tvmult_add(dst.block(m->row), + if (m->prefix==1.) + { + if (m->transpose) + m->matrix->Tvmult_add(dst.block(m->row), + src.block(m->col)); + else + m->matrix->vmult_add(dst.block(m->row), + src.block(m->col)); + } else { + aux.reinit(dst.block(m->row)); + if (m->transpose) + m->matrix->Tvmult(aux, src.block(m->col)); - else - m->matrix->vmult_add(dst.block(m->row), + else + m->matrix->vmult(aux, src.block(m->col)); + dst.block(m->row).add (m->prefix, aux); + } } } @@ -275,15 +288,28 @@ BlockMatrixArray::Tvmult_add (BlockVector& dst, typename vector::const_iterator m = entries.begin(); typename vector::const_iterator end = entries.end(); + static Vector aux; + for (; m != end ; ++m) { - Assert (m->prefix==1., ExcNotImplemented()); - if (m->transpose) - m->matrix->vmult_add(dst.block(m->col), - src.block(m->row)); - else - m->matrix->Tvmult_add(dst.block(m->col), - src.block(m->row)); + if (m->prefix==1.) + { + if (m->transpose) + m->matrix->vmult_add(dst.block(m->row), + src.block(m->col)); + else + m->matrix->Tvmult_add(dst.block(m->row), + src.block(m->col)); + } else { + aux.reinit(dst.block(m->row)); + if (m->transpose) + m->matrix->vmult(aux, + src.block(m->col)); + else + m->matrix->Tvmult(aux, + src.block(m->col)); + dst.block(m->row).add (m->prefix, aux); + } } } -- 2.39.5