diff --git a/dune/solvers/transferoperators/truncatedcompressedmgtransfer.hh b/dune/solvers/transferoperators/truncatedcompressedmgtransfer.hh index 8fc17d5569dd84b1daa6ec0d8b08dd8e7a115ffa..f36cf33af64f8dc5a9d0f78b53a8cb62c4c6236a 100644 --- a/dune/solvers/transferoperators/truncatedcompressedmgtransfer.hh +++ b/dune/solvers/transferoperators/truncatedcompressedmgtransfer.hh @@ -5,6 +5,8 @@ #include <dune/common/fmatrix.hh> #include <dune/common/bitsetvector.hh> +#include <dune/solvers/operators/sumoperator.hh> + #include "truncatedmgtransfer.hh" #include "compressedmultigridtransfer.hh" @@ -38,7 +40,7 @@ class TruncatedCompressedMGTransfer : public: typedef typename CompressedMultigridTransfer<VectorType, BitVectorType, MatrixType>::TransferOperatorType TransferOperatorType; - + /** \brief Default constructor */ TruncatedCompressedMGTransfer() @@ -77,6 +79,67 @@ public: }; +template<class VectorType, class BitVectorType, class SparseMatrixType, class LowRankMatrixType> +class TruncatedCompressedMGTransfer<VectorType, BitVectorType, SumOperator<SparseMatrixType, LowRankMatrixType> > : + public CompressedMultigridTransfer<VectorType, BitVectorType, SparseMatrixType>, + public TruncatedMGTransfer<VectorType, BitVectorType, SparseMatrixType> +{ + + enum {blocksize = VectorType::block_type::dimension}; + + typedef typename VectorType::field_type field_type; + +public: + typedef SumOperator<SparseMatrixType,LowRankMatrixType> OperatorType; + typedef typename CompressedMultigridTransfer<VectorType, BitVectorType, SparseMatrixType>::TransferOperatorType TransferOperatorType; + + + /** \brief Default constructor */ + TruncatedCompressedMGTransfer() + {} + + /** \brief Restrict level fL of f and store the result in level cL of t + * + * \param critical Has to contain an entry for each degree of freedom. + * Those dofs with a set bit are treated as critical. + */ + void restrict(const VectorType& f, VectorType &t, const BitVectorType& critical) const; + + /** \brief Restriction of MultiGridTransfer*/ + using CompressedMultigridTransfer< VectorType, BitVectorType, SparseMatrixType >::restrict; + + /** \brief Prolong level cL of f and store the result in level fL of t + * + * \param critical Has to contain an entry for each degree of freedom. + * Those dofs with a set bit are treated as critical. + */ + void prolong(const VectorType& f, VectorType &t, const BitVectorType& critical) const; + + /** \brief Prolongation of MultiGridTransfer*/ + using CompressedMultigridTransfer< VectorType, BitVectorType, SparseMatrixType >::prolong; + + /** \brief Galerkin assemble a coarse stiffness matrix + * + * \param critical Has to contain an entry for each degree of freedom. + * Those dofs with a set bit are treated as critical. + */ + void galerkinRestrict(const OperatorType& fineMat, OperatorType& coarseMat, const BitVectorType& critical) const; + + /** \brief forward noncritical Galerkin restriction of sparse Matrix to CompressedMultiGridTransfer and do the rest here */ + void galerkinRestrict(const OperatorType& fineMat, OperatorType& coarseMat) const + { + CompressedMultigridTransfer< VectorType, BitVectorType, SparseMatrixType >::galerkinRestrict(fineMat.sparseMatrix(), coarseMat.sparseMatrix()); + + // \todo do the thing to the lowRankTerm + } + + /** \brief forward to baseclass */ + virtual void galerkinRestrictSetOccupation(const OperatorType& fineMat, OperatorType& coarseMat) const + { + CompressedMultigridTransfer<VectorType,BitVectorType,SparseMatrixType>::galerkinRestrictSetOccupation(fineMat.sparseMatrix(),coarseMat.sparseMatrix()); + } + +}; #include "truncatedcompressedmgtransfer.cc" #endif