include/deal.II/multigrid/mg_transfer.h

00001 //---------------------------------------------------------------------------
00002 //    @f$Id: mg_transfer.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 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_transfer_h
00013 #define __deal2__mg_transfer_h
00014 
00015 #include <deal.II/base/config.h>
00016 
00017 #include <deal.II/lac/block_vector.h>
00018 #include <deal.II/lac/constraint_matrix.h>
00019 #ifdef DEAL_PREFER_MATRIX_EZ
00020 #  include <deal.II/lac/sparse_matrix_ez.h>
00021 #  include <deal.II/lac/block_sparse_matrix_ez.h>
00022 #else
00023 #  include <deal.II/lac/sparsity_pattern.h>
00024 #  include <deal.II/lac/block_sparsity_pattern.h>
00025 #endif
00026 #include <deal.II/lac/vector_memory.h>
00027 
00028 #include <deal.II/multigrid/mg_base.h>
00029 #include <deal.II/multigrid/mg_constrained_dofs.h>
00030 #include <deal.II/base/mg_level_object.h>
00031 
00032 
00033 
00034 #include <deal.II/dofs/dof_handler.h>
00035 
00036 #include <deal.II/base/std_cxx1x/shared_ptr.h>
00037 
00038 
00039 DEAL_II_NAMESPACE_OPEN
00040 
00041 
00042 template <int dim, int spacedim> class MGDoFHandler;
00043 
00044 /*
00045  * MGTransferBase is defined in mg_base.h
00046  */
00047 
00050 
00063 template <class VECTOR>
00064 class MGTransferPrebuilt : public MGTransferBase<VECTOR>
00065 {
00066   public:
00074     MGTransferPrebuilt ();
00078     MGTransferPrebuilt (const ConstraintMatrix& constraints,
00079         const MGConstrainedDoFs& mg_constrained_dofs);
00083     virtual ~MGTransferPrebuilt ();
00088     template <int dim, int spacedim>
00089     void build_matrices (const MGDoFHandler<dim,spacedim> &mg_dof);
00090 
00091     virtual void prolongate (const unsigned int    to_level,
00092                              VECTOR       &dst,
00093                              const VECTOR &src) const;
00094 
00095     virtual void restrict_and_add (const unsigned int    from_level,
00096                                    VECTOR       &dst,
00097                                    const VECTOR &src) const;
00098 
00105     template <int dim, class InVector, int spacedim>
00106     void
00107     copy_to_mg (const MGDoFHandler<dim,spacedim>& mg_dof,
00108                 MGLevelObject<VECTOR>& dst,
00109                 const InVector& src) const;
00110 
00123     template <int dim, class OutVector, int spacedim>
00124     void
00125     copy_from_mg (const MGDoFHandler<dim,spacedim>& mg_dof,
00126                   OutVector& dst,
00127                   const MGLevelObject<VECTOR> &src) const;
00128 
00137     template <int dim, class OutVector, int spacedim>
00138     void
00139     copy_from_mg_add (const MGDoFHandler<dim,spacedim>& mg_dof,
00140                       OutVector& dst,
00141                       const MGLevelObject<VECTOR>& src) const;
00142 
00173     void
00174     set_component_to_block_map (const std::vector<unsigned int> &map);
00175 
00180     DeclException0(ExcNoProlongation);
00181 
00186     DeclException0(ExcMatricesNotBuilt);
00187 
00191     std::size_t memory_consumption () const;
00192 
00193 
00194   private:
00195 
00199     std::vector<unsigned int> sizes;
00200 
00205     std::vector<std_cxx1x::shared_ptr<SparsityPattern> >   prolongation_sparsities;
00206 
00215     std::vector<std_cxx1x::shared_ptr<SparseMatrix<double> > > prolongation_matrices;
00216 
00223     std::vector<std::vector<std::pair<unsigned int, unsigned int> > >
00224       copy_indices;
00225 
00232     std::vector<unsigned int> component_to_block_map;
00233 
00239     std::vector<std::vector<bool> > interface_dofs;
00244     SmartPointer<const ConstraintMatrix, MGTransferPrebuilt<VECTOR> > constraints;
00250     SmartPointer<const MGConstrainedDoFs, MGTransferPrebuilt<VECTOR> > mg_constrained_dofs;
00251 };
00252 
00253 
00257 DEAL_II_NAMESPACE_CLOSE
00258 
00259 #endif
00260 
 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