Skip to content
Snippets Groups Projects
Commit ae0a4d1d authored by Jonathan Youett's avatar Jonathan Youett
Browse files

The critical bitfield is now a member of the truncated transferoperators.

parent ea9bc6a3
Branches
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ preprocess() ...@@ -32,7 +32,7 @@ preprocess()
} }
for (size_t i=0; i<this->mgTransfer_.size(); i++) for (size_t i=0; i<this->mgTransfer_.size(); i++)
dynamic_cast<TruncatedMGTransfer<VectorType>*>(this->mgTransfer_[i])->recompute_ = hasObstacleHierarchy_[i]; dynamic_cast<TruncatedMGTransfer<VectorType>*>(this->mgTransfer_[i])->setRecomputeBitField(hasObstacleHierarchy_[i]);
// ///////////////////////////////////////////// // /////////////////////////////////////////////
// Set up base solver // Set up base solver
...@@ -66,7 +66,7 @@ preprocess() ...@@ -66,7 +66,7 @@ preprocess()
#endif #endif
} else { } else {
DUNE_THROW(SolverError, "You can't use " << typeid(*this->basesolver_).name() DUNE_THROW(SolverError, "You can't use " << typeid(*this->basesolver_).name()
<< " as a base solver for contact problems!"); << " as a base solver for obstacle problems!");
} }
} }
...@@ -157,7 +157,7 @@ void MonotoneMGStep<MatrixType, VectorType>::iterate() ...@@ -157,7 +157,7 @@ void MonotoneMGStep<MatrixType, VectorType>::iterate()
for (int i=0; i<this->nu1_; i++) for (int i=0; i<this->nu1_; i++)
presmoother->iterate(); presmoother->iterate();
// First, a backup of the obstacles for postsmoothing // First, a backup of the obstacles for postsmoothing
std::vector<BoxConstraint<field_type,dim> > obstacleBackup = *obstacles[level]; std::vector<BoxConstraint<field_type,dim> > obstacleBackup = *obstacles[level];
...@@ -182,11 +182,12 @@ void MonotoneMGStep<MatrixType, VectorType>::iterate() ...@@ -182,11 +182,12 @@ void MonotoneMGStep<MatrixType, VectorType>::iterate()
} }
} }
// Set bitfield of nodes that will be truncated
dynamic_cast<TruncatedMGTransfer<VectorType>*>(this->mgTransfer_[level-1])->setCriticalBitField(&critical);
// Restrict stiffness matrix // Restrict stiffness matrix
dynamic_cast<TruncatedMGTransfer<VectorType>*>(this->mgTransfer_[level-1]) this->mgTransfer_[level-1]->galerkinRestrict(*(mat[level]), *(const_cast<MatrixType*>(mat[level-1].get())));
->galerkinRestrict(*(mat[level]), *(const_cast<MatrixType*>(mat[level-1].get())), critical);
// Restrict obstacles // Restrict obstacles
obstacleRestrictor_->restrict(*obstacles[level], *obstacles[level-1], obstacleRestrictor_->restrict(*obstacles[level], *obstacles[level-1],
...@@ -201,7 +202,7 @@ void MonotoneMGStep<MatrixType, VectorType>::iterate() ...@@ -201,7 +202,7 @@ void MonotoneMGStep<MatrixType, VectorType>::iterate()
mat[level]->mmv(*x[level], fineResidual); mat[level]->mmv(*x[level], fineResidual);
// restrict residual // restrict residual
dynamic_cast<TruncatedMGTransfer<VectorType>*>(this->mgTransfer_[level-1])->restrict(fineResidual, rhs[level-1], critical); this->mgTransfer_[level-1]->restrict(fineResidual, rhs[level-1]);
// Choose all zeros as the initial correction // Choose all zeros as the initial correction
*x[level-1] = 0; *x[level-1] = 0;
...@@ -220,9 +221,13 @@ void MonotoneMGStep<MatrixType, VectorType>::iterate() ...@@ -220,9 +221,13 @@ void MonotoneMGStep<MatrixType, VectorType>::iterate()
// add correction to the presmoothed solution // add correction to the presmoothed solution
VectorType tmp; VectorType tmp;
dynamic_cast<TruncatedMGTransfer<VectorType>*>(this->mgTransfer_[level-1])->prolong(*x[level-1], tmp, critical); this->mgTransfer_[level-1]->prolong(*x[level-1], tmp);
*x[level] += tmp; *x[level] += tmp;
// Remove pointer to the temporary critical bitfield
// this avoids a memory problem when the same mmg step is reused
dynamic_cast<TruncatedMGTransfer<VectorType>*>(this->mgTransfer_[level-1])->setCriticalBitField(nullptr);
// restore the true (non-defect) obstacles // restore the true (non-defect) obstacles
*obstacles[level] = obstacleBackup; *obstacles[level] = obstacleBackup;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment