From 180c409d0576e6089eecdfbe4fb94106df73207b Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 8 May 2000 11:28:42 +0000 Subject: [PATCH] Extend block matrices. git-svn-id: https://svn.dealii.org/trunk@2824 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_sparse_matrix.h | 29 ++++++++- deal.II/lac/include/lac/block_vector.h | 59 +------------------ deal.II/lac/source/block_vector.cc | 21 +++++++ 3 files changed, 50 insertions(+), 59 deletions(-) create mode 100644 deal.II/lac/source/block_vector.cc diff --git a/deal.II/lac/include/lac/block_sparse_matrix.h b/deal.II/lac/include/lac/block_sparse_matrix.h index 0172d13705..8f8e15c53f 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.h @@ -326,7 +326,17 @@ class BlockSparseMatrix : public Subscriptor * be square for this operation. */ template - somenumber matrix_norm_square (const BlockVector &v) const; + somenumber + matrix_norm_square (const BlockVector &v) const; + + /** + * Compute the matrix scalar + * product $\left(u,Mv\right)$. + */ + template + somenumber + matrix_scalar_product (const BlockVector &u, + const BlockVector &v) const; /** * Return a (constant) reference @@ -673,6 +683,23 @@ matrix_norm_square (const BlockVector &v) const +template +template +somenumber +BlockSparseMatrix:: +matrix_scalar_product (const BlockVector &u, + const BlockVector &v) const +{ + somenumber result = 0; + for (unsigned int row=0; row const BlockSparsityPattern & BlockSparseMatrix::get_sparsity_pattern () const diff --git a/deal.II/lac/include/lac/block_vector.h b/deal.II/lac/include/lac/block_vector.h index d7e55fd8fe..238a7bc9f1 100644 --- a/deal.II/lac/include/lac/block_vector.h +++ b/deal.II/lac/include/lac/block_vector.h @@ -31,7 +31,7 @@ * can do, plus the access to a single #Vector# inside the * #BlockVector# by #block(i)#. * - * @author Guido Kanschat, 1999 + * @author Guido Kanschat, 1999; Wolfgang Bangerth, 2000 */ template class BlockVector @@ -225,35 +225,6 @@ class BlockVector */ bool all_zero () const; -// See above. -// /** -// * Make the #Vector# class a bit like the -// * #vector<># class of the C++ standard -// * library by returning iterators to -// * the start and end of the elements of this -// * vector. -// */ -// iterator begin (); - -// /** -// * Return constant iterator to the start of -// * the vectors. -// */ -// const_iterator begin () const; - -// /** -// * Return an iterator pointing to the -// * element past the end of the array. -// */ -// iterator end (); - -// /** -// * Return a constant iterator pointing to -// * the element past the end of the array. -// */ -// const_iterator end () const; - - /** * @name 2: Data-Access */ @@ -479,34 +450,6 @@ unsigned int BlockVector::size () const } -// template -// inline -// BlockVector::iterator BlockVector::begin () { -// return &val[0]; -// }; - - -// template -// inline -// BlockVector::const_iterator BlockVector::begin () const { -// return &val[0]; -// }; - - -// template -// inline -// BlockVector::iterator BlockVector::end () { -// return &val[dim]; -// }; - - -// template -// inline -// BlockVector::const_iterator BlockVector::end () const { -// return &val[dim]; -// }; - - template inline Number BlockVector::operator() (const unsigned int i) const diff --git a/deal.II/lac/source/block_vector.cc b/deal.II/lac/source/block_vector.cc new file mode 100644 index 0000000000..bdfe9dc054 --- /dev/null +++ b/deal.II/lac/source/block_vector.cc @@ -0,0 +1,21 @@ +//---------------------------- block_vector.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2000 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- block_vector.cc --------------------------- + +#include + +// explicit instantiations +template class BlockVector<2,double>; +template class BlockVector<3,double>; + +template class BlockVector<2,float>; +template class BlockVector<3,float>; -- 2.39.5