From 130b1c8ca1af485f50144cad6de48a462ae5da5e Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Fri, 12 Sep 2014 11:57:17 +0000 Subject: [PATCH] Don't rely on a non-standard dune-solvers extension to set the matrix of a transfer operator dune-solvers actually does provide a way to set these matrices directly. I simply didn't find it until recently. [[Imported from SVN: r9885]] --- dune/gfe/riemanniantrsolver.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dune/gfe/riemanniantrsolver.cc b/dune/gfe/riemanniantrsolver.cc index 3ef37109..96734e07 100644 --- a/dune/gfe/riemanniantrsolver.cc +++ b/dune/gfe/riemanniantrsolver.cc @@ -187,8 +187,9 @@ setup(const GridType& grid, typedef typename TruncatedCompressedMGTransfer<CorrectionType>::TransferOperatorType TransferOperatorType; MatrixCommunicator<GUIndex, TransferOperatorType, LeafP1GUIndex> matrixComm(*guIndex_, p1Index, 0); - mmgStep->mgTransfer_.back() = new PKtoP1MGTransfer<CorrectionType> - (Dune::make_shared<TransferOperatorType>(matrixComm.reduceCopy(topTransferOp->getMatrix()))); + mmgStep->mgTransfer_.back() = new PKtoP1MGTransfer<CorrectionType>; + Dune::shared_ptr<TransferOperatorType> topTransferOperator = Dune::make_shared<TransferOperatorType>(matrixComm.reduceCopy(topTransferOp->getMatrix())); + dynamic_cast<PKtoP1MGTransfer<CorrectionType>*>(mmgStep->mgTransfer_.back())->setMatrix(topTransferOperator); for (int i=0; i<mmgStep->mgTransfer_.size()-1; i++){ // Construct the local multigrid transfer matrix @@ -204,8 +205,9 @@ setup(const GridType& grid, typedef typename TruncatedCompressedMGTransfer<CorrectionType>::TransferOperatorType TransferOperatorType; MatrixCommunicator<LevelGUIndex, TransferOperatorType> matrixComm(fineGUIndex, coarseGUIndex, 0); - mmgStep->mgTransfer_[i] = new TruncatedCompressedMGTransfer<CorrectionType> - (Dune::make_shared<TransferOperatorType>(matrixComm.reduceCopy(newTransferOp->getMatrix()))); + mmgStep->mgTransfer_[i] = new TruncatedCompressedMGTransfer<CorrectionType>; + Dune::shared_ptr<TransferOperatorType> transferOperatorMatrix = Dune::make_shared<TransferOperatorType>(matrixComm.reduceCopy(newTransferOp->getMatrix())); + dynamic_cast<TruncatedCompressedMGTransfer<CorrectionType>*>(mmgStep->mgTransfer_[i])->setMatrix(transferOperatorMatrix); } } -- GitLab