include/deal.II/multigrid/mg_tools.h

00001 //---------------------------------------------------------------------------
00002 //    @f$Id: mg_tools.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011, 2012 by the deal.II authors
00005 //
00006 //    This file is subject to QPL and may not be  distributed
00007 //    without copyright and license information. Please refer
00008 //    to the file deal.II/doc/license.html for the  text  and
00009 //    further information on this license.
00010 //
00011 //---------------------------------------------------------------------------
00012 #ifndef __deal2__mg_tools_h
00013 #define __deal2__mg_tools_h
00014 
00015 #include <deal.II/base/config.h>
00016 #include <deal.II/base/index_set.h>
00017 #include <deal.II/dofs/dof_tools.h>
00018 #include <deal.II/multigrid/mg_dof_handler.h>
00019 
00020 #include <vector>
00021 #include <set>
00022 
00023 
00024 DEAL_II_NAMESPACE_OPEN
00025 
00026 template <class Object> class MGLevelObject;
00027 template <int dim, int spacedim> class MGDoFHandler;
00028 template <typename number> class Vector;
00029 template <typename number> class SparseMatrix;
00030 template <typename number> class BlockVector;
00031 template <typename number> class BlockSparseMatrix;
00032 template <typename number> class FullMatrix;
00033 template <typename number> class BlockSparseMatrix;
00034 
00035 /* !@addtogroup mg */
00036 /* @{ */
00037 
00048 namespace MGTools
00049 {
00054   template <int dim, int spacedim>
00055   void
00056   compute_row_length_vector(const MGDoFHandler<dim,spacedim>& dofs,
00057                             const unsigned int level,
00058                             std::vector<unsigned int>& row_lengths,
00059                             const DoFTools::Coupling flux_couplings = DoFTools::none);
00060 
00067   template <int dim, int spacedim>
00068   void
00069   compute_row_length_vector(const MGDoFHandler<dim,spacedim>& dofs,
00070                             const unsigned int level,
00071                             std::vector<unsigned int>& row_lengths,
00072                             const Table<2,DoFTools::Coupling>& couplings,
00073                             const Table<2,DoFTools::Coupling>& flux_couplings);
00074 
00089   template <int dim, class SparsityPattern, int spacedim>
00090   void
00091   make_sparsity_pattern (const MGDoFHandler<dim,spacedim> &dof_handler,
00092                          SparsityPattern         &sparsity,
00093                          const unsigned int       level);
00094 
00101   template <int dim, class SparsityPattern, int spacedim>
00102   void
00103   make_flux_sparsity_pattern (const MGDoFHandler<dim,spacedim> &dof_handler,
00104                               SparsityPattern         &sparsity,
00105                               const unsigned int       level);
00106 
00117   template <int dim, class SparsityPattern, int spacedim>
00118   void
00119   make_flux_sparsity_pattern_edge (const MGDoFHandler<dim,spacedim> &dof_handler,
00120                                    SparsityPattern         &sparsity,
00121                                    const unsigned int       level);
00139   template <int dim, class SparsityPattern, int spacedim>
00140   void
00141   make_flux_sparsity_pattern (const MGDoFHandler<dim,spacedim> &dof,
00142                               SparsityPattern       &sparsity,
00143                               const unsigned int level,
00144                               const Table<2,DoFTools::Coupling> &int_mask,
00145                               const Table<2,DoFTools::Coupling> &flux_mask);
00146 
00159   template <int dim, class SparsityPattern, int spacedim>
00160   void
00161   make_flux_sparsity_pattern_edge (const MGDoFHandler<dim,spacedim> &dof_handler,
00162                                    SparsityPattern         &sparsity,
00163                                    const unsigned int       level,
00164                                    const Table<2,DoFTools::Coupling> &flux_mask);
00165 
00176   template <int dim, int spacedim>
00177   void
00178   count_dofs_per_block (const MGDoFHandler<dim,spacedim> &mg_dof,
00179                         std::vector<std::vector<unsigned int> > &result,
00180                         std::vector<unsigned int> target_block = std::vector<unsigned int>());
00181 
00192   template <int dim, int spacedim>
00193   void
00194   count_dofs_per_component (const MGDoFHandler<dim,spacedim> &mg_dof,
00195                             std::vector<std::vector<unsigned int> > &result,
00196                             const bool only_once = false,
00197                             std::vector<unsigned int> target_component = std::vector<unsigned int>());
00198 
00204   template <int dim, int spacedim>
00205   void
00206   count_dofs_per_component (const MGDoFHandler<dim,spacedim> &mg_dof,
00207                             std::vector<std::vector<unsigned int> > &result,
00208                             std::vector<unsigned int> target_component);
00209 
00232   template <int dim, int spacedim>
00233   void
00234   make_boundary_list (const MGDoFHandler<dim,spacedim>      &mg_dof,
00235                       const typename FunctionMap<dim>::type &function_map,
00236                       std::vector<std::set<unsigned int> >  &boundary_indices,
00237                       const std::vector<bool>               &component_mask = std::vector<bool>());
00238 
00244   template <int dim, int spacedim>
00245   void
00246   make_boundary_list (const MGDoFHandler<dim,spacedim>      &mg_dof,
00247                       const typename FunctionMap<dim>::type &function_map,
00248                       std::vector<IndexSet>                 &boundary_indices,
00249                       const std::vector<bool>               &component_mask = std::vector<bool>());
00250 
00255   template <typename number>
00256   void
00257   apply_boundary_values (const std::set<unsigned int> &boundary_dofs,
00258                          SparseMatrix<number>& matrix,
00259                          const bool preserve_symmetry,
00260                               const bool ignore_zeros = false);
00261 
00262   template <typename number>
00263   void
00264   apply_boundary_values (const std::set<unsigned int>& boundary_dofs,
00265                          BlockSparseMatrix<number>& matrix,
00266                          const bool preserve_symmetry);
00267 
00268 
00286   template <int dim, int spacedim>
00287   void
00288   extract_inner_interface_dofs (const MGDoFHandler<dim,spacedim> &mg_dof_handler,
00289                                 std::vector<std::vector<bool> >  &interface_dofs,
00290                                 std::vector<std::vector<bool> >  &boundary_interface_dofs);
00291 
00296   template <int dim, int spacedim>
00297   void
00298   extract_inner_interface_dofs (const MGDoFHandler<dim,spacedim> &mg_dof_handler,
00299                                 std::vector<std::vector<bool> >  &interface_dofs);
00300 
00301   template <int dim, int spacedim>
00302   void
00303   extract_non_interface_dofs (const MGDoFHandler<dim,spacedim> &mg_dof_handler,
00304                                 std::vector<std::set<unsigned int> >  &non_interface_dofs);
00305 }
00306 
00307 /* @} */
00308 
00309 DEAL_II_NAMESPACE_CLOSE
00310 
00311 #endif
00312 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Tue May 22 2012 12:06:17 by doxygen 1.7.3