From: kanschat Date: Tue, 18 Sep 2007 22:37:55 +0000 (+0000) Subject: overload new_pointer_matrix_base to choose between PointerMatrix and PointerMatrixAux... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecbf36ea8d4ab147d8cc9f561e723d2a7d17280b;p=dealii-svn.git overload new_pointer_matrix_base to choose between PointerMatrix and PointerMatrixAux automatically git-svn-id: https://svn.dealii.org/trunk@15220 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/pointer_matrix.h b/deal.II/lac/include/lac/pointer_matrix.h index b792ccb703..382b255699 100644 --- a/deal.II/lac/include/lac/pointer_matrix.h +++ b/deal.II/lac/include/lac/pointer_matrix.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -500,22 +500,167 @@ class PointerMatrixVector : public PointerMatrixBase > /** * This function helps you creating a PointerMatrixBase object if you * do not want to provide the full template arguments of - * PointerMatrix. + * PointerMatrix or PointerMatrixAux. + * + * Note that this function by default creates a PointerMatrixAux, + * emulating the functions vmult_add and Tvmult_add, + * using an auxiliary vector. It is overloaded for the library matrix + * classes implementing these functions themselves. If you have such a + * class, you should overload the function in order to save memory and + * time. * * The result is a PointerMatrixBase* pointing to matrix. The * VECTOR argument is a dummy just used to determine the * template arguments. * * @relates PointerMatrixBase + * @relates PointerMatrixAux */ -template +template inline PointerMatrixBase* new_pointer_matrix_base(MATRIX& matrix, const VECTOR&) { - return new PointerMatrix(&matrix); + return new PointerMatrixAux(0, &matrix); +} + +class IdentityMatrix; +template class FullMatrix; +template class LAPACKFullMatrix; +template class SparseMatrix; +template class BlockSparseMatrix; +template class SparseMatrixEZ; +template class BlockSparseMatrixEZ; +template class BlockMatrixArray; +template class TridiagonalMatrix; + +/** + * Specialized version for IdentityMatrix. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase >* +new_pointer_matrix_base(IdentityMatrix& matrix, const Vector&) +{ + return new PointerMatrix >(&matrix); +} + + +/** + * Specialized version for FullMatrix. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase >* +new_pointer_matrix_base(FullMatrix& matrix, const Vector&) +{ + return new PointerMatrix, Vector >(&matrix); } + +/** + * Specialized version for LAPACKFullMatrix. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase >* +new_pointer_matrix_base(LAPACKFullMatrix& matrix, const Vector&) +{ + return new PointerMatrix, Vector >(&matrix); +} + + +/** + * Specialized version for SparseMatrix. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase >* +new_pointer_matrix_base(SparseMatrix& matrix, const Vector&) +{ + return new PointerMatrix, Vector >(&matrix); +} + + +/** + * Specialized version for BlockSparseMatrix. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase* +new_pointer_matrix_base(BlockSparseMatrix& matrix, const VECTOR&) +{ + return new PointerMatrix, VECTOR>(&matrix); +} + + +/** + * Specialized version for SparseMatrixEZ. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase >* +new_pointer_matrix_base(SparseMatrixEZ& matrix, const Vector&) +{ + return new PointerMatrix, Vector >(&matrix); +} + + +/** + * Specialized version for BlockSparseMatrixEZ. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase* +new_pointer_matrix_base(BlockSparseMatrixEZ& matrix, const VECTOR&) +{ + return new PointerMatrix, VECTOR>(&matrix); +} + + +/** + * Specialized version for BlockMatrixArray. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase >* +new_pointer_matrix_base(BlockMatrixArray& matrix, const BlockVector&) +{ + return new PointerMatrix, BlockVector >(&matrix); +} + + +/** + * Specialized version for TridiagonalMatrix. + * + * @relates PointerMatrixBase + * @relates PointerMatrix + */ +template +PointerMatrixBase >* +new_pointer_matrix_base(TridiagonalMatrix& matrix, const Vector&) +{ + return new PointerMatrix, Vector >(&matrix); +} + + + /*@}*/ //---------------------------------------------------------------------------