Skip to content
Snippets Groups Projects
Commit 5edbdb2c authored by graeser's avatar graeser Committed by graeser
Browse files

Clean up code

Compute coarse grid matrices in one loop only. This makes
the code a tiny bit cleaner and implies that a
coarse matrix is completely setup before being
used to setup the next coarser matrix.

This allows to construct the coarse matrix occupation
pattern depending on the fine matrix entries.

[[Imported from SVN: r6119]]
parent e39c0fa8
No related branches found
No related tags found
No related merge requests found
......@@ -55,9 +55,10 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess()
DUNE_THROW(SolverError, "You have not supplied a multigrid restriction operator "
"for level " << i);
// The matrices for the linear correction problems
// /////////////////////////////////////////////////////
// Assemble the complete hierarchy of matrices
// /////////////////////////////////////////////////////
for (int i=this->numLevels_-2; i>=0; i--) {
// Delete coarse grid matrix if it exists already
if (this->mat_[i]) {
......@@ -66,21 +67,18 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess()
}
this->mat_[i] = new MatrixType;
// Compute which entries are present in the (sparse) coarse grid stiffness
// matrices.
this->mgTransfer_[i]->galerkinRestrictSetOccupation(*this->mat_[i+1], *(const_cast<MatrixType*>(this->mat_[i])));
// setup matrix
this->mgTransfer_[i]->galerkinRestrict(*this->mat_[i+1], *(const_cast<MatrixType*>(this->mat_[i])));
// Set solution vector sizes for the lower levels
GenericVector::resize(this->x_[i],*this->mat_[i]);
}
// /////////////////////////////////////////////////////
// Assemble the complete hierarchy of matrices
// /////////////////////////////////////////////////////
for (int i=this->mgTransfer_.size()-1; i>=0; i--)
this->mgTransfer_[i]->galerkinRestrict(*this->mat_[i+1], *(const_cast<MatrixType*>(this->mat_[i])));
// /////////////////////////////////////////////////////
// Setup dirichlet bitfields
// /////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment