From 9dd26827f51785663d8d071d4703b2d05e0a910d Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 4 Jan 2010 14:52:36 +0000 Subject: [PATCH] Add a function. git-svn-id: https://svn.dealii.org/trunk@20279 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/multigrid/mg_tools.h | 10 ++- .../deal.II/source/multigrid/mg_dof_tools.cc | 85 ++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_tools.h b/deal.II/deal.II/include/multigrid/mg_tools.h index 046decf5da..c97ec97b87 100644 --- a/deal.II/deal.II/include/multigrid/mg_tools.h +++ b/deal.II/deal.II/include/multigrid/mg_tools.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2005, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 2005, 2006, 2007, 2008, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -389,6 +389,14 @@ class MGTools const std::vector &selected, const std::vector &target_component, std::vector >& cached_sizes); + + + template + static + void + extract_inner_interface_dofs (const MGDoFHandler &mg_dof_handler, + std::vector > &interface_dofs, + std::vector > &boundary_interface_dofs); }; /*@}*/ diff --git a/deal.II/deal.II/source/multigrid/mg_dof_tools.cc b/deal.II/deal.II/source/multigrid/mg_dof_tools.cc index 22c40f93ed..7263edb938 100644 --- a/deal.II/deal.II/source/multigrid/mg_dof_tools.cc +++ b/deal.II/deal.II/source/multigrid/mg_dof_tools.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -1518,6 +1518,80 @@ MGTools::reinit_vector_by_blocks ( } + +template +void +MGTools:: +extract_inner_interface_dofs (const MGDoFHandler &mg_dof_handler, + std::vector > &interface_dofs, + std::vector > &boundary_interface_dofs) +{ + const FiniteElement &fe = mg_dof_handler.get_fe(); + + const unsigned int dofs_per_cell = fe.dofs_per_cell; + const unsigned int dofs_per_face = fe.dofs_per_face; + + std::vector local_dof_indices (dofs_per_cell); + std::vector face_dof_indices (dofs_per_face); + + std::vector cell_dofs(dofs_per_cell, false); + std::vector boundary_cell_dofs(dofs_per_cell, false); + + typename MGDoFHandler::cell_iterator cell = mg_dof_handler.begin(), + endc = mg_dof_handler.end(); + + for (; cell!=endc; ++cell) + { + bool has_coarser_neighbor = false; + + std::fill (cell_dofs.begin(), cell_dofs.end(), false); + std::fill (boundary_cell_dofs.begin(), boundary_cell_dofs.end(), false); + + for (unsigned int face_nr=0; face_nr::faces_per_cell; ++face_nr) + { + const typename DoFHandler::face_iterator face = cell->face(face_nr); + if (!face->at_boundary()) + { + //interior face + const typename MGDoFHandler::cell_iterator + neighbor = cell->neighbor(face_nr); + + // Do refinement face + // from the coarse side + if (neighbor->level() < cell->level()) + { + for (unsigned int j=0; j::faces_per_cell; ++face_nr) + if(cell->at_boundary(face_nr)) + for(unsigned int j=0; jlevel(); + cell->get_mg_dof_indices (local_dof_indices); + + for(unsigned int i=0; i >&, const std::vector&); +#if deal_II_dimension > 1 +template +void +MGTools:: +extract_inner_interface_dofs (const MGDoFHandler &mg_dof_handler, + std::vector > &interface_dofs, + std::vector > &boundary_interface_dofs); +#endif + DEAL_II_NAMESPACE_CLOSE -- 2.39.5