From: Baerbel Jannsen Date: Wed, 25 Aug 2010 17:24:53 +0000 (+0000) Subject: pass a MGConstraints instead of the boundary_indices only in X-Git-Tag: v8.0.0~5685 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02fac19ec95d0eb75f063711f3ae870aeb640144;p=dealii.git pass a MGConstraints instead of the boundary_indices only in build_matrices git-svn-id: https://svn.dealii.org/trunk@21713 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/multigrid/mg_transfer.h b/deal.II/deal.II/include/multigrid/mg_transfer.h index 7db0779cc5..5ec3cf99ae 100644 --- a/deal.II/deal.II/include/multigrid/mg_transfer.h +++ b/deal.II/deal.II/include/multigrid/mg_transfer.h @@ -27,6 +27,7 @@ #include #include +#include #include @@ -87,9 +88,7 @@ class MGTransferPrebuilt : public MGTransferBase */ template void build_matrices (const MGDoFHandler &mg_dof, - const std::vector >&boundary_indices - = std::vector >() - ); + const MGConstraints& mg_constraints); virtual void prolongate (const unsigned int to_level, VECTOR &dst, diff --git a/deal.II/deal.II/source/multigrid/mg_transfer_prebuilt.cc b/deal.II/deal.II/source/multigrid/mg_transfer_prebuilt.cc index abcf291e51..b170691295 100644 --- a/deal.II/deal.II/source/multigrid/mg_transfer_prebuilt.cc +++ b/deal.II/deal.II/source/multigrid/mg_transfer_prebuilt.cc @@ -155,9 +155,8 @@ MGTransferPrebuilt::copy_to_mg ( template template void MGTransferPrebuilt::build_matrices ( - const MGDoFHandler &mg_dof, - const std::vector > &boundary_indices - ) + const MGDoFHandler &mg_dof, + const MGConstraints &mg_constraints) { const unsigned int n_levels = mg_dof.get_tria().n_levels(); const unsigned int dofs_per_cell = mg_dof.get_fe().dofs_per_cell; @@ -287,12 +286,12 @@ void MGTransferPrebuilt::build_matrices ( // impose boundary conditions // but only in the column of // the prolongation matrix - if (boundary_indices.size() != 0) + if (mg_constraints.get_boundary_indices().size() != 0) { std::vector constrain_indices; for (int level=n_levels-2; level>=0; --level) { - if (boundary_indices[level].size() == 0) + if (mg_constraints.get_boundary_indices()[level].size() == 0) continue; // need to delete all the columns in the @@ -302,8 +301,9 @@ void MGTransferPrebuilt::build_matrices ( // need to filter away. constrain_indices.resize (0); constrain_indices.resize (prolongation_matrices[level]->n(), 0); - std::set::const_iterator dof = boundary_indices[level].begin(), - endd = boundary_indices[level].end(); + std::set::const_iterator dof + = mg_constraints.get_boundary_indices()[level].begin(), + endd = mg_constraints.get_boundary_indices()[level].end(); for (; dof != endd; ++dof) constrain_indices[*dof] = 1; @@ -332,10 +332,6 @@ void MGTransferPrebuilt::build_matrices ( // the std::vector > that // only contains the active dofs on the // levels. - interface_dofs.resize(mg_dof.get_tria().n_levels()); - for(unsigned int l=0; l temp_copy_indices; @@ -366,7 +362,7 @@ void MGTransferPrebuilt::build_matrices ( for (unsigned int i=0; i::build_matrices ( template void MGTransferPrebuilt >::build_matrices (const MGDoFHandler &mg_dof, - const std::vector >&boundary_indices); + const MGConstraints& mg_constraints); template void MGTransferPrebuilt >::build_matrices (const MGDoFHandler &mg_dof, - const std::vector >&boundary_indices); + const MGConstraints& mg_constraints); template void MGTransferPrebuilt >::build_matrices (const MGDoFHandler &mg_dof, - const std::vector >&boundary_indices); + const MGConstraints& mg_constraints); template void MGTransferPrebuilt >::build_matrices (const MGDoFHandler &mg_dof, - const std::vector >&boundary_indices); + const MGConstraints& mg_constraints); template void MGTransferPrebuilt >::copy_to_mg ( diff --git a/deal.II/examples/step-16/step-16.cc b/deal.II/examples/step-16/step-16.cc index 78d5f2fdbe..383d8a3fea 100644 --- a/deal.II/examples/step-16/step-16.cc +++ b/deal.II/examples/step-16/step-16.cc @@ -767,8 +767,11 @@ void LaplaceProblem::solve () MGTransferPrebuilt > mg_transfer(hanging_node_constraints); // Now the prolongation matrix has to be built. // This matrix needs to take the boundary values on - // each level into account. - mg_transfer.build_matrices(mg_dof_handler, mg_constraints.get_boundary_indices()); + // each level into account and needs to know about + // the indices at the refinement egdes. The + // MGConstraints knows about that so + // pass it as an argument. + mg_transfer.build_matrices(mg_dof_handler, mg_constraints); FullMatrix coarse_matrix; coarse_matrix.copy_from (mg_matrices[0]);