16 #ifndef dealii__multigrid_h 17 #define dealii__multigrid_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/subscriptor.h> 22 #include <deal.II/base/smartpointer.h> 23 #include <deal.II/dofs/dof_handler.h> 24 #include <deal.II/lac/sparse_matrix.h> 25 #include <deal.II/lac/vector.h> 26 #include <deal.II/multigrid/mg_base.h> 27 #include <deal.II/base/mg_level_object.h> 28 #include <deal.II/distributed/tria.h> 32 DEAL_II_NAMESPACE_OPEN
64 template <
typename VectorType>
81 typedef VectorType vector_type;
82 typedef const VectorType const_vector_type;
215 bool relative =
false);
345 template<
int dim,
class OtherVectorType,
class TRANSFER>
friend class PreconditionMG;
361 template<
int dim,
typename VectorType,
class TRANSFER>
384 template<
class OtherVectorType>
385 void vmult (OtherVectorType &dst,
386 const OtherVectorType &src)
const;
392 template<
class OtherVectorType>
394 const OtherVectorType &src)
const;
401 template<
class OtherVectorType>
402 void Tvmult (OtherVectorType &dst,
403 const OtherVectorType &src)
const;
410 template<
class OtherVectorType>
412 const OtherVectorType &src)
const;
452 template <
typename VectorType>
460 const unsigned int min_level,
461 const unsigned int max_level,
466 matrix(&matrix, typeid(*this).name()),
467 coarse(&coarse, typeid(*this).name()),
468 transfer(&transfer, typeid(*this).name()),
469 pre_smooth(&pre_smooth, typeid(*this).name()),
470 post_smooth(&post_smooth, typeid(*this).name()),
471 edge_down(0, typeid(*this).name()),
472 edge_up(0, typeid(*this).name()),
475 const unsigned int dof_handler_max_level
478 maxlevel = dof_handler_max_level;
480 maxlevel = max_level;
482 reinit(minlevel, maxlevel);
487 template <
typename VectorType>
493 const unsigned int min_level,
494 const unsigned int max_level,
498 matrix(&matrix, typeid(*this).name()),
499 coarse(&coarse, typeid(*this).name()),
500 transfer(&transfer, typeid(*this).name()),
501 pre_smooth(&pre_smooth, typeid(*this).name()),
502 post_smooth(&post_smooth, typeid(*this).name()),
503 edge_out(0, typeid(*this).name()),
504 edge_in(0, typeid(*this).name()),
505 edge_down(0, typeid(*this).name()),
506 edge_up(0, typeid(*this).name()),
510 maxlevel = matrix.get_maxlevel();
512 maxlevel = max_level;
513 reinit(min_level, maxlevel);
518 template <
typename VectorType>
528 template <
typename VectorType>
540 template<
int dim,
typename VectorType,
class TRANSFER>
544 const TRANSFER &transfer)
546 dof_handler(&dof_handler),
551 template<
int dim,
typename VectorType,
class TRANSFER>
558 template<
int dim,
typename VectorType,
class TRANSFER>
559 template<
class OtherVectorType>
562 (OtherVectorType &dst,
563 const OtherVectorType &src)
const 565 transfer->copy_to_mg(*dof_handler,
570 transfer->copy_from_mg(*dof_handler,
572 multigrid->solution);
576 template<
int dim,
typename VectorType,
class TRANSFER>
580 return dof_handler->locally_owned_dofs();
584 template<
int dim,
typename VectorType,
class TRANSFER>
588 return dof_handler->locally_owned_dofs();
592 template<
int dim,
typename VectorType,
class TRANSFER>
605 template<
int dim,
typename VectorType,
class TRANSFER>
606 template<
class OtherVectorType>
609 (OtherVectorType &dst,
610 const OtherVectorType &src)
const 612 transfer->copy_to_mg(*dof_handler,
616 transfer->copy_from_mg_add(*dof_handler,
618 multigrid->solution);
622 template<
int dim,
typename VectorType,
class TRANSFER>
623 template<
class OtherVectorType>
627 const OtherVectorType &)
const 633 template<
int dim,
typename VectorType,
class TRANSFER>
634 template<
class OtherVectorType>
638 const OtherVectorType &)
const 645 DEAL_II_NAMESPACE_CLOSE
SmartPointer< const MGMatrixBase< VectorType >, Multigrid< VectorType > > matrix
SmartPointer< const TRANSFER, PreconditionMG< dim, VectorType, TRANSFER > > transfer
IndexSet locally_owned_domain_indices() const
static const unsigned int invalid_unsigned_int
SmartPointer< const MGMatrixBase< VectorType > > edge_in
void vmult(OtherVectorType &dst, const OtherVectorType &src) const
MPI_Comm get_mpi_communicator() const
void set_edge_matrices(const MGMatrixBase< VectorType > &edge_out, const MGMatrixBase< VectorType > &edge_in)
unsigned int get_maxlevel() const
void set_maxlevel(const unsigned int)
MGLevelObject< VectorType > t
SmartPointer< const MGCoarseGridBase< VectorType >, Multigrid< VectorType > > coarse
SmartPointer< const MGMatrixBase< VectorType >, Multigrid< VectorType > > edge_up
void set_debug(const unsigned int)
void level_v_step(const unsigned int level)
SmartPointer< const MGSmootherBase< VectorType >, Multigrid< VectorType > > post_smooth
IndexSet locally_owned_range_indices() const
#define Assert(cond, exc)
virtual MPI_Comm get_communicator() const
void Tvmult(OtherVectorType &dst, const OtherVectorType &src) const
SmartPointer< Multigrid< VectorType >, PreconditionMG< dim, VectorType, TRANSFER > > multigrid
unsigned int get_minlevel() const
SmartPointer< const MGMatrixBase< VectorType > > edge_out
void vmult_add(OtherVectorType &dst, const OtherVectorType &src) const
SmartPointer< const MGTransferBase< VectorType >, Multigrid< VectorType > > transfer
void set_minlevel(const unsigned int level, bool relative=false)
void set_edge_flux_matrices(const MGMatrixBase< VectorType > &edge_down, const MGMatrixBase< VectorType > &edge_up)
SmartPointer< const DoFHandler< dim >, PreconditionMG< dim, VectorType, TRANSFER > > dof_handler
void Tvmult_add(OtherVectorType &dst, const OtherVectorType &src) const
MGLevelObject< VectorType > solution
Multigrid(const DoFHandler< dim > &mg_dof_handler, const MGMatrixBase< VectorType > &matrix, const MGCoarseGridBase< VectorType > &coarse, const MGTransferBase< VectorType > &transfer, const MGSmootherBase< VectorType > &pre_smooth, const MGSmootherBase< VectorType > &post_smooth, const unsigned int minlevel=0, const unsigned int maxlevel=numbers::invalid_unsigned_int, Cycle cycle=v_cycle) 1
void level_step(const unsigned int level, Cycle cycle)
virtual unsigned int n_global_levels() const
SmartPointer< const MGSmootherBase< VectorType >, Multigrid< VectorType > > pre_smooth
static ::ExceptionBase & ExcNotImplemented()
const Triangulation< dim, spacedim > & get_triangulation() const
SmartPointer< const MGMatrixBase< VectorType >, Multigrid< VectorType > > edge_down
MGLevelObject< VectorType > defect2
MGLevelObject< VectorType > defect
PreconditionMG(const DoFHandler< dim > &dof_handler, Multigrid< VectorType > &mg, const TRANSFER &transfer)
static ::ExceptionBase & ExcInternalError()
Triangulation< dim, spacedim > & get_triangulation()
void reinit(const unsigned int minlevel, const unsigned int maxlevel)