From d1a63450ea5bf6e70c31c406e38fd730124f902d Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Fri, 6 Jun 2008 15:42:15 +0000 Subject: [PATCH] use MonotoneMGStep instead of ContactMMGStep [[Imported from SVN: r2385]] --- staticrod.cc | 42 +++++++++++++++++++++--------------------- staticrod2.cc | 42 +++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/staticrod.cc b/staticrod.cc index 37b4fd81..d706f549 100644 --- a/staticrod.cc +++ b/staticrod.cc @@ -8,16 +8,15 @@ #include <dune/istl/io.hh> #include <dune/ag-common/boundarypatch.hh> - -#include "src/planarrodassembler.hh" #include <dune/ag-common/projectedblockgsstep.hh> -#include "../contact/src/contactmmgstep.hh" - +#include <dune/ag-common/mmgstep.hh> #include <dune/ag-common/iterativesolver.hh> - #include <dune/ag-common/geomestimator.hh> #include <dune/ag-common/energynorm.hh> +#include <dune/ag-common/contactobsrestrict.hh> + #include "src/rodwriter.hh" +#include "src/planarrodassembler.hh" // Number of degrees of freedom: @@ -189,27 +188,28 @@ int main (int argc, char *argv[]) try ProjectedBlockGSStep<MatrixType, VectorType> presmoother; ProjectedBlockGSStep<MatrixType, VectorType> postsmoother; - ContactMMGStep<MatrixType, VectorType> contactMMGStep(maxlevel+1); + MonotoneMGStep<MatrixType, VectorType> multigridStep(maxlevel+1); - contactMMGStep.setMGType(mu, nu1, nu2); - contactMMGStep.dirichletNodes_ = &dirichletNodes; - contactMMGStep.basesolver_ = &baseSolver; - contactMMGStep.presmoother_ = &presmoother; - contactMMGStep.postsmoother_ = &postsmoother; - contactMMGStep.hasObstacle_ = &hasObstacle; - contactMMGStep.obstacles_ = &trustRegionObstacles; + multigridStep.setMGType(mu, nu1, nu2); + multigridStep.dirichletNodes_ = &dirichletNodes; + multigridStep.basesolver_ = &baseSolver; + multigridStep.presmoother_ = &presmoother; + multigridStep.postsmoother_ = &postsmoother; + multigridStep.hasObstacle_ = &hasObstacle; + multigridStep.obstacles_ = &trustRegionObstacles; + multigridStep.obstacleRestrictor_ = new ContactObsRestriction<VectorType>; // Create the transfer operators - contactMMGStep.mgTransfer_.resize(maxlevel); - for (int i=0; i<contactMMGStep.mgTransfer_.size(); i++){ + multigridStep.mgTransfer_.resize(maxlevel); + for (int i=0; i<multigridStep.mgTransfer_.size(); i++){ TruncatedMGTransfer<VectorType>* newTransferOp = new TruncatedMGTransfer<VectorType>; newTransferOp->setup(rod,i,i+1); - contactMMGStep.mgTransfer_[i] = newTransferOp; + multigridStep.mgTransfer_[i] = newTransferOp; } - EnergyNorm<MatrixType, VectorType> energyNorm(contactMMGStep); + EnergyNorm<MatrixType, VectorType> energyNorm(multigridStep); - IterativeSolver<VectorType> solver(&contactMMGStep, + IterativeSolver<VectorType> solver(&multigridStep, numIt, tolerance, &energyNorm, @@ -263,20 +263,20 @@ int main (int argc, char *argv[]) try //std::cout << "rhs: " << std::endl << rhs << std::endl; //std::cout << "Trust Region obstacles:" << std::endl; - //std::cout << (*contactMMGStep.obstacles_)[maxlevel] << std::endl; + //std::cout << (*multigridStep.obstacles_)[maxlevel] << std::endl; //solver.iterationStep_->setProblem(hessianMatrix, corr, rhs); DUNE_THROW(NotImplemented,"IterationStep::setProblem, Matrix uebergeben"); solver.preprocess(); - contactMMGStep.preprocess(); + multigridStep.preprocess(); // ///////////////////////////// // Solve ! // ///////////////////////////// solver.solve(); - corr = contactMMGStep.getSol(); + corr = multigridStep.getSol(); //std::cout << "Correction: \n" << corr << std::endl; diff --git a/staticrod2.cc b/staticrod2.cc index d6dab90c..688ebf3f 100644 --- a/staticrod2.cc +++ b/staticrod2.cc @@ -11,11 +11,11 @@ #include <dune/ag-common/boundarypatch.hh> #include <dune/ag-common/projectedblockgsstep.hh> -#include "../contact/src/contactmmgstep.hh" +#include <dune/ag-common/mmgstep.hh> #include <dune/ag-common/iterativesolver.hh> - #include <dune/ag-common/geomestimator.hh> #include <dune/ag-common/energynorm.hh> +#include <dune/ag-common/contactobsrestrict.hh> #include "src/rodwriter.hh" #include "src/planarrodassembler.hh" @@ -121,22 +121,22 @@ int main (int argc, char *argv[]) try ProjectedBlockGSStep<MatrixType, VectorType> presmoother; ProjectedBlockGSStep<MatrixType, VectorType> postsmoother; - ContactMMGStep<MatrixType, VectorType> contactMMGStep(1); - - contactMMGStep.setMGType(mu, nu1, nu2); - contactMMGStep.dirichletNodes_ = &dirichletNodes; - contactMMGStep.basesolver_ = &baseSolver; - contactMMGStep.presmoother_ = &presmoother; - contactMMGStep.postsmoother_ = &postsmoother; - contactMMGStep.hasObstacle_ = &hasObstacle; - contactMMGStep.obstacles_ = &trustRegionObstacles; - contactMMGStep.verbosity_ = Solver::QUIET; + MonotoneMGStep<MatrixType, VectorType> multigridStep(1); + multigridStep.setMGType(mu, nu1, nu2); + multigridStep.dirichletNodes_ = &dirichletNodes; + multigridStep.basesolver_ = &baseSolver; + multigridStep.presmoother_ = &presmoother; + multigridStep.postsmoother_ = &postsmoother; + multigridStep.hasObstacle_ = &hasObstacle; + multigridStep.obstacles_ = &trustRegionObstacles; + multigridStep.verbosity_ = Solver::QUIET; + multigridStep.obstacleRestrictor_ = new ContactObsRestriction<VectorType>; - EnergyNorm<MatrixType, VectorType> energyNorm(contactMMGStep); + EnergyNorm<MatrixType, VectorType> energyNorm(multigridStep); - IterativeSolver<VectorType> solver(&contactMMGStep, + IterativeSolver<VectorType> solver(&multigridStep, numIt, tolerance, &energyNorm, @@ -226,15 +226,15 @@ int main (int argc, char *argv[]) try // //////////////////////////////////// // Create the transfer operators // //////////////////////////////////// - for (int k=0; k<contactMMGStep.mgTransfer_.size(); k++) - delete(contactMMGStep.mgTransfer_[k]); + for (int k=0; k<multigridStep.mgTransfer_.size(); k++) + delete(multigridStep.mgTransfer_[k]); - contactMMGStep.mgTransfer_.resize(toplevel); + multigridStep.mgTransfer_.resize(toplevel); - for (int i=0; i<contactMMGStep.mgTransfer_.size(); i++){ + for (int i=0; i<multigridStep.mgTransfer_.size(); i++){ TruncatedMGTransfer<VectorType>* newTransferOp = new TruncatedMGTransfer<VectorType>; newTransferOp->setup(grid,i,i+1); - contactMMGStep.mgTransfer_[i] = newTransferOp; + multigridStep.mgTransfer_[i] = newTransferOp; } // ///////////////////////////////////////////////////// @@ -265,7 +265,7 @@ int main (int argc, char *argv[]) try solver.preprocess(); - contactMMGStep.preprocess(); + multigridStep.preprocess(); // ///////////////////////////// @@ -273,7 +273,7 @@ int main (int argc, char *argv[]) try // ///////////////////////////// solver.solve(); - corr = contactMMGStep.getSol(); + corr = multigridStep.getSol(); printf("infinity norm of the correction: %g\n", corr.infinity_norm()); if (corr.infinity_norm() < 1e-5) { -- GitLab