/usr/include/deal.II/lac/block_matrix.h is in libdeal.ii-dev 6.3.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | //---------------------------------------------------------------------------
// $Id: block_matrix.h 20934 2010-04-02 13:09:20Z bangerth $
// Version: $Name$
//
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 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.
//
//---------------------------------------------------------------------------
#ifndef __deal2__block_matrix_h
#define __deal2__block_matrix_h
#include <base/config.h>
#include <base/exceptions.h>
#include <base/smartpointer.h>
#include <lac/block_vector.h>
DEAL_II_NAMESPACE_OPEN
/*! @addtogroup Matrix2
*@{
*/
/**
* A matrix with several copies of the same block on the diagonal.
*
* This matrix implements an @p m by @p m block matrix. Each
* diagonal block consists of the same (non-block) matrix, while
* off-diagonal blocks are void.
*
* One special application is a one by one block matrix, allowing to
* apply the @p vmult of the original matrix (or preconditioner) to a
* block vector.
*
* @see @ref GlossBlockLA "Block (linear algebra)"
* @author Guido Kanschat, 2000
*/
template <class MATRIX>
class BlockDiagonalMatrix : public Subscriptor
{
public:
/**
* Constructor for an @p n_blocks
* by @p n_blocks matrix with
* diagonal blocks @p M.
*/
BlockDiagonalMatrix (const MATRIX &M,
const unsigned int n_blocks);
/**
* Matrix-vector-multiplication.
*/
template <typename number1, typename number2>
void vmult (BlockVector<number1>& dst,
const BlockVector<number2>& src) const;
/**
* Transposed matrix-vector-multiplication.
*/
template <typename number1, typename number2>
void Tvmult (BlockVector<number1>& dst,
const BlockVector<number2>& src) const;
private:
/**
* Number of blocks.
*/
unsigned int num_blocks;
/**
* Diagonal entry.
*/
SmartPointer<const MATRIX,BlockDiagonalMatrix<MATRIX> > matrix;
};
/*@}*/
//---------------------------------------------------------------------------
template <class MATRIX>
BlockDiagonalMatrix<MATRIX>::BlockDiagonalMatrix (const MATRIX& M,
const unsigned int num_blocks)
:
num_blocks (num_blocks),
matrix(&M)
{}
template <class MATRIX>
template <typename number1, typename number2>
void
BlockDiagonalMatrix<MATRIX>::vmult (BlockVector<number1>& dst,
const BlockVector<number2>& src) const
{
Assert (dst.n_blocks()==num_blocks,
ExcDimensionMismatch(dst.n_blocks(),num_blocks));
Assert (src.n_blocks()==num_blocks,
ExcDimensionMismatch(src.n_blocks(),num_blocks));
for (unsigned int i=0;i<num_blocks;++i)
matrix->vmult (dst.block(i), src.block(i));
}
template <class MATRIX>
template <typename number1, typename number2>
void
BlockDiagonalMatrix<MATRIX>::Tvmult (BlockVector<number1>& dst,
const BlockVector<number2>& src) const
{
Assert (dst.n_blocks()==num_blocks,
ExcDimensionMismatch(dst.n_blocks(),num_blocks));
Assert (src.n_blocks()==num_blocks,
ExcDimensionMismatch(src.n_blocks(),num_blocks));
for (unsigned int i=0;i<num_blocks;++i)
matrix->Tvmult (dst.block(i), src.block(i));
}
DEAL_II_NAMESPACE_CLOSE
#endif
|