From 177413363996a542aedde7e7895eea946a521bb1 Mon Sep 17 00:00:00 2001 From: Baerbel Jannsen Date: Mon, 22 Mar 2010 15:07:17 +0000 Subject: [PATCH] added a clear function to mg_smoother and some bugs fixed git-svn-id: https://svn.dealii.org/trunk@20878 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/multigrid/mg_smoother.h | 6 ++++++ .../deal.II/include/multigrid/mg_transfer.templates.h | 1 + .../multigrid/mg_transfer_component.templates.h | 5 ++++- deal.II/deal.II/include/multigrid/multigrid.h | 11 ++++++----- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_smoother.h b/deal.II/deal.II/include/multigrid/mg_smoother.h index e28f7cd486..5d9743a492 100644 --- a/deal.II/deal.II/include/multigrid/mg_smoother.h +++ b/deal.II/deal.II/include/multigrid/mg_smoother.h @@ -163,6 +163,7 @@ class MGSmootherIdentity : public MGSmootherBase virtual void smooth (const unsigned int level, VECTOR& u, const VECTOR& rhs) const; + virtual void clear (); }; @@ -525,6 +526,11 @@ MGSmootherIdentity::smooth ( const VECTOR&) const {} +template +inline void +MGSmootherIdentity::clear () +{} + //--------------------------------------------------------------------------- template diff --git a/deal.II/deal.II/include/multigrid/mg_transfer.templates.h b/deal.II/deal.II/include/multigrid/mg_transfer.templates.h index 0aad386f8b..5e82091662 100644 --- a/deal.II/deal.II/include/multigrid/mg_transfer.templates.h +++ b/deal.II/deal.II/include/multigrid/mg_transfer.templates.h @@ -50,6 +50,7 @@ MGTransferPrebuilt::copy_from_mg( for (unsigned int level=0;level >::const_iterator IT; + for (IT i= copy_indices[level].begin(); i != copy_indices[level].end();++i) dst(i->first) = src[level](i->second); diff --git a/deal.II/deal.II/include/multigrid/mg_transfer_component.templates.h b/deal.II/deal.II/include/multigrid/mg_transfer_component.templates.h index a8abc20625..2902b33e99 100644 --- a/deal.II/deal.II/include/multigrid/mg_transfer_component.templates.h +++ b/deal.II/deal.II/include/multigrid/mg_transfer_component.templates.h @@ -68,7 +68,9 @@ MGTransferSelect::copy_from_mg ( BlockVector& dst, const MGLevelObject >& src) const { - do_copy_from_mg (mg_dof_handler, dst, src); + dst = 0; + do_copy_from_mg (mg_dof_handler, + dst.block(target_component[selected_component]), src); if (constraints != 0) constraints->condense(dst); } @@ -83,6 +85,7 @@ MGTransferSelect::copy_from_mg ( Vector& dst, const MGLevelObject >& src) const { + dst = 0; do_copy_from_mg (mg_dof_handler, dst, src); if (constraints != 0) { diff --git a/deal.II/deal.II/include/multigrid/multigrid.h b/deal.II/deal.II/include/multigrid/multigrid.h index fbcccdce6b..9ffeddc4b0 100644 --- a/deal.II/deal.II/include/multigrid/multigrid.h +++ b/deal.II/deal.II/include/multigrid/multigrid.h @@ -664,7 +664,7 @@ PreconditionMG::vmult ( VECTOR2& dst, const VECTOR2& src) const { -#ifdef baerbel_mg_test +#ifdef BAERBEL_MG_TEST const unsigned int min_l = multigrid->solution.get_minlevel(); const unsigned int max_l = multigrid->solution.get_maxlevel(); deallog << "PreconditionMG in " << src.l2_norm() << std::endl; @@ -672,22 +672,22 @@ PreconditionMG::vmult ( transfer->copy_to_mg(*mg_dof_handler, multigrid->defect, src); -#ifdef baerbel_mg_test +#ifdef BAERBEL_MG_TEST for(unsigned int l=min_l; ldefect[l].l2_norm() << std::endl; #endif multigrid->cycle(); -#ifdef baerbel_mg_test +#ifdef BAERBEL_MG_TEST for(unsigned int l=min_l; lsolution[l].l2_norm() << std::endl; #endif transfer->copy_from_mg(*mg_dof_handler, dst, multigrid->solution); -#ifdef baerbel_mg_test +#ifdef BAERBEL_MG_TEST deallog << "PreconditionMG out " << dst.l2_norm() << std::endl; -#endif + /* DataOut data_out; data_out.attach_dof_handler (*mg_dof_handler); @@ -704,6 +704,7 @@ PreconditionMG::vmult ( std::ofstream output (filename.str().c_str()); data_out.write_gnuplot (output); */ +#endif } -- 2.39.5