/*!@addtogroup mg */
/*@{*/
-/**
- * Implementation of the multigrid method. The implementation supports both
- * continuous and discontinuous elements and follows the procedure described in
- * the @ref mg_paper "multigrid paper by Janssen and Kanschat".
- *
- * The function which starts a multigrid cycle on the finest level is cycle().
- * Depending on the cycle type chosen with the constructor (see enum Cycle),
- * this function triggers one of the cycles level_v_step() or level_step(),
- * where the latter one can do different types of cycles.
- *
- * Using this class, it is expected that the right hand side has been
- * converted from a vector living on the locally finest level to a multilevel
- * vector. This is a nontrivial operation, usually initiated automatically by
- * the class PreconditionMG and performed by the classes derived from
- * MGTransferBase.
- *
- * @note The interface of this class is still very clumsy. In particular, you
- * will have to set up quite a few auxiliary objects before you can use it.
- * Unfortunately, it seems that this can be avoided only be restricting the
- * flexibility of this class in an unacceptable way.
- *
- * @author Guido Kanschat, 1999 - 2005
- */
-template <typename VectorType>
-class Multigrid : public Subscriptor
+namespace mg
{
-public:
/**
- * List of implemented cycle types.
- */
- enum Cycle
- {
- /// The V-cycle
- v_cycle,
- /// The W-cycle
- w_cycle,
- /// The F-cycle
- f_cycle
- };
-
- /**
- * A structure that has boost::signal objects for a number of actions that
- * happen for the typical usage of this class.
+ * A structure containing boost::signal objects for optional processing in multigrid solvers.
*
- * For documentation on signals, see
- * http://www.boost.org/doc/libs/release/libs/signals2 .
+ * Each of these signals is called twice, once before and once after
+ * the action is performed. The two function calls differ in the
+ * boolean argument @p before, which is true the first time and
+ * false the second.
*/
struct Signals
{
/**
- * This signal is triggered before (@p start is true) and after (@p start is
+ * This signal is triggered before (@p before is true) and after (@p before is
* false) the call to MGTransfer::copy_to_mg which transfers the vector
* given to it to a multi-level vector.
*/
- boost::signals2::signal<void (const bool start)> transfer_to_mg;
+ boost::signals2::signal<void (const bool before)> transfer_to_mg;
/**
- * This signal is triggered before (@p start is true) and after (@p start is
+ * This signal is triggered before (@p before is true) and after (@p before is
* false) the call to MGTransfer::copy_from_mg which transfers the
* multi-level vector given to it to a normal vector.
*/
- boost::signals2::signal<void (const bool start)> transfer_to_global;
+ boost::signals2::signal<void (const bool before)> transfer_to_global;
/**
- * This signal is triggered before (@p start is true) and after (@p start is
+ * This signal is triggered before (@p before is true) and after (@p before is
* false) the call to the coarse solver on @p level.
*/
- boost::signals2::signal<void (const bool start, const unsigned int level)> coarse_solve;
+ boost::signals2::signal<void (const bool before, const unsigned int level)> coarse_solve;
/**
- * This signal is triggered before (@p start is true) and after (@p start is
+ * This signal is triggered before (@p before is true) and after (@p before is
* false) the call to MGTransfer::restrict_and_add() which restricts a
* vector from @p level to the next coarser one (@p level - 1).
*/
- boost::signals2::signal<void (const bool start, const unsigned int level)> transfer_down_to;
+ boost::signals2::signal<void (const bool before, const unsigned int level)> restriction;
/**
- * This signal is triggered before (@p start is true) and after (@p start is
+ * This signal is triggered before (@p before is true) and after (@p before is
* false) the call to MGTransfer::prolongate() which prolongs a vector to
* @p level from the next coarser one (@p level - 1).
*/
- boost::signals2::signal<void (const bool start, const unsigned int level)> transfer_up_to;
+ boost::signals2::signal<void (const bool before, const unsigned int level)> prolongation;
/**
- * This signal is triggered before (@p start is true) and after (@p start is
+ * This signal is triggered before (@p before is true) and after (@p before is
* false) the call to a pre-smoothing step via MGPreSmoother::apply() on
* @p level.
*/
- boost::signals2::signal<void (const bool start, const unsigned int level)> pre_smoother_step;
+ boost::signals2::signal<void (const bool before, const unsigned int level)> pre_smoother_step;
/**
- * This signal is triggered before (@p start is true) and after (@p start is
+ * This signal is triggered before (@p before is true) and after (@p before is
* false) the call to a post-smoothing step via MGPostSmoother::apply() on
* @p level.
*/
- boost::signals2::signal<void (const bool start, const unsigned int level)> post_smoother_step;
+ boost::signals2::signal<void (const bool before, const unsigned int level)> post_smoother_step;
+ };
+}
+
+/**
+ * Implementation of the multigrid method. The implementation supports both
+ * continuous and discontinuous elements and follows the procedure described in
+ * the @ref mg_paper "multigrid paper by Janssen and Kanschat".
+ *
+ * The function which starts a multigrid cycle on the finest level is cycle().
+ * Depending on the cycle type chosen with the constructor (see enum Cycle),
+ * this function triggers one of the cycles level_v_step() or level_step(),
+ * where the latter one can do different types of cycles.
+ *
+ * Using this class, it is expected that the right hand side has been
+ * converted from a vector living on the locally finest level to a multilevel
+ * vector. This is a nontrivial operation, usually initiated automatically by
+ * the class PreconditionMG and performed by the classes derived from
+ * MGTransferBase.
+ *
+ * @note The interface of this class is still very clumsy. In particular, you
+ * will have to set up quite a few auxiliary objects before you can use it.
+ * Unfortunately, it seems that this can be avoided only be restricting the
+ * flexibility of this class in an unacceptable way.
+ *
+ * @author Guido Kanschat, 1999 - 2005
+ */
+template <typename VectorType>
+class Multigrid : public Subscriptor
+{
+public:
+ /**
+ * List of implemented cycle types.
+ */
+ enum Cycle
+ {
+ /// The V-cycle
+ v_cycle,
+ /// The W-cycle
+ w_cycle,
+ /// The F-cycle
+ f_cycle
};
typedef VectorType vector_type;
void set_cycle(Cycle);
/**
+ * @deprecated Debug output will go away. Use signals instead.
+ *
* Set the debug level. Higher values will create more debugging output
* during the multigrid cycles.
*/
+ DEAL_II_DEPRECATED
void set_debug (const unsigned int);
/**
- * Connect a function to Signals::coarse_solve.
+ * Connect a function to mg::Signals::coarse_solve.
*/
boost::signals2::connection
connect_coarse_solve(const std::function<void (const bool, const unsigned int)> &slot);
/**
- * Connect a function to Signals::transfer_down_to.
+ * Connect a function to mg::Signals::restriction.
*/
boost::signals2::connection
- connect_transfer_down_to(const std::function<void (const bool, const unsigned int)> &slot);
+ connect_restriction(const std::function<void (const bool, const unsigned int)> &slot);
/**
- * Connect a function to Signals::transfer_up_to.
+ * Connect a function to mg::Signals::prolongation.
*/
boost::signals2::connection
- connect_transfer_up_to(const std::function<void (const bool, const unsigned int)> &slot);
+ connect_prolongation(const std::function<void (const bool, const unsigned int)> &slot);
/**
- * Connect a function to Signals::pre_smoother_step.
+ * Connect a function to mg::Signals::pre_smoother_step.
*/
boost::signals2::connection
connect_pre_smoother_step(const std::function<void (const bool, const unsigned int)> &slot);
/**
- * Connect a function to Signals::post_smoother_step.
+ * Connect a function to mg::Signals::post_smoother_step.
*/
boost::signals2::connection
connect_post_smoother_step(const std::function<void (const bool, const unsigned int)> &slot);
/**
* Signals for the various actions that the Multigrid algorithm uses.
*/
- Signals signals;
+ mg::Signals signals;
/**
* The V-cycle multigrid method. <tt>level</tt> is the level the function
MPI_Comm get_mpi_communicator() const;
/**
- * Connect a function to Signals::transfer_to_mg.
+ * Connect a function to mg::Signals::transfer_to_mg.
*/
boost::signals2::connection
connect_transfer_to_mg(const std::function<void (bool)> &slot);
/**
- * Connect a function to Signals::transfer_to_global.
+ * Connect a function to mg::Signals::transfer_to_global.
*/
boost::signals2::connection
connect_transfer_to_global(const std::function<void (bool)> &slot);
/**
* Signals used by this object
*/
- typename Multigrid<VectorType>::Signals signals;
+ mg::Signals signals;
};
/*@}*/
OtherVectorType &dst,
const OtherVectorType &src,
const bool uses_dof_handler_vector,
- const typename dealii::Multigrid<VectorType>::Signals &signals, int)
+ const typename dealii::mg::Signals &signals, int)
{
signals.transfer_to_mg(true);
if (uses_dof_handler_vector)
OtherVectorType &dst,
const OtherVectorType &src,
const bool uses_dof_handler_vector,
- const typename dealii::Multigrid<VectorType>::Signals &signals, ...)
+ const typename dealii::mg::Signals &signals, ...)
{
(void) uses_dof_handler_vector;
Assert (!uses_dof_handler_vector, ExcInternalError());
OtherVectorType &dst,
const OtherVectorType &src,
const bool uses_dof_handler_vector,
- const typename dealii::Multigrid<VectorType>::Signals &signals, int)
+ const typename dealii::mg::Signals &signals, int)
{
- signals.transfer_to_mg(0, true);
+ signals.transfer_to_mg(true);
if (uses_dof_handler_vector)
transfer.copy_to_mg(dof_handler_vector,
multigrid.defect,
transfer.copy_to_mg(*dof_handler_vector[0],
multigrid.defect,
src);
- signals.transfer_to_mg(0, false);
+ signals.transfer_to_mg(false);
multigrid.cycle();
- signals.transfer_to_global(0, true);
+ signals.transfer_to_global(true);
if (uses_dof_handler_vector)
transfer.copy_from_mg_add(dof_handler_vector,
dst,
transfer.copy_from_mg_add(*dof_handler_vector[0],
dst,
multigrid.solution);
- signals.transfer_to_global(0, false);
+ signals.transfer_to_global(false);
}
template <int dim, typename VectorType, class TRANSFER, typename OtherVectorType>
OtherVectorType &dst,
const OtherVectorType &src,
const bool uses_dof_handler_vector,
- const typename dealii::Multigrid<VectorType>::Signals &signals, ...)
+ const typename dealii::mg::Signals &signals, ...)
{
(void) uses_dof_handler_vector;
Assert (!uses_dof_handler_vector, ExcInternalError());
DEAL::transfer_to_mg finished
DEAL::pre_smoother_step started on level 2
DEAL::pre_smoother_step finished on level 2
-DEAL::transfer_down_to started on level 2
-DEAL::transfer_down_to finished on level 2
+DEAL::restriction started on level 2
+DEAL::restriction finished on level 2
DEAL::pre_smoother_step started on level 1
DEAL::pre_smoother_step finished on level 1
-DEAL::transfer_down_to started on level 1
-DEAL::transfer_down_to finished on level 1
+DEAL::restriction started on level 1
+DEAL::restriction finished on level 1
DEAL::coarse_solve started on level 0
DEAL::coarse_solve finished on level 0
-DEAL::transfer_up_to started on level 1
-DEAL::transfer_up_to finished on level 1
+DEAL::prolongation started on level 1
+DEAL::prolongation finished on level 1
DEAL::post_smoother_step started on level 1
DEAL::post_smoother_step finished on level 1
-DEAL::transfer_up_to started on level 2
-DEAL::transfer_up_to finished on level 2
+DEAL::prolongation started on level 2
+DEAL::prolongation finished on level 2
DEAL::post_smoother_step started on level 2
DEAL::post_smoother_step finished on level 2
DEAL::transfer_to_global started
DEAL::transfer_to_mg finished
DEAL::pre_smoother_step started on level 2
DEAL::pre_smoother_step finished on level 2
-DEAL::transfer_down_to started on level 2
-DEAL::transfer_down_to finished on level 2
+DEAL::restriction started on level 2
+DEAL::restriction finished on level 2
DEAL::pre_smoother_step started on level 1
DEAL::pre_smoother_step finished on level 1
-DEAL::transfer_down_to started on level 1
-DEAL::transfer_down_to finished on level 1
+DEAL::restriction started on level 1
+DEAL::restriction finished on level 1
DEAL::coarse_solve started on level 0
DEAL::coarse_solve finished on level 0
-DEAL::transfer_up_to started on level 1
-DEAL::transfer_up_to finished on level 1
+DEAL::prolongation started on level 1
+DEAL::prolongation finished on level 1
DEAL::post_smoother_step started on level 1
DEAL::post_smoother_step finished on level 1
-DEAL::transfer_up_to started on level 2
-DEAL::transfer_up_to finished on level 2
+DEAL::prolongation started on level 2
+DEAL::prolongation finished on level 2
DEAL::post_smoother_step started on level 2
DEAL::post_smoother_step finished on level 2
DEAL::transfer_to_global started
DEAL::transfer_to_mg finished
DEAL::pre_smoother_step started on level 2
DEAL::pre_smoother_step finished on level 2
-DEAL::transfer_down_to started on level 2
-DEAL::transfer_down_to finished on level 2
+DEAL::restriction started on level 2
+DEAL::restriction finished on level 2
DEAL::pre_smoother_step started on level 1
DEAL::pre_smoother_step finished on level 1
-DEAL::transfer_down_to started on level 1
-DEAL::transfer_down_to finished on level 1
+DEAL::restriction started on level 1
+DEAL::restriction finished on level 1
DEAL::coarse_solve started on level 0
DEAL::coarse_solve finished on level 0
-DEAL::transfer_up_to started on level 1
-DEAL::transfer_up_to finished on level 1
+DEAL::prolongation started on level 1
+DEAL::prolongation finished on level 1
DEAL::post_smoother_step started on level 1
DEAL::post_smoother_step finished on level 1
-DEAL::transfer_up_to started on level 2
-DEAL::transfer_up_to finished on level 2
+DEAL::prolongation started on level 2
+DEAL::prolongation finished on level 2
DEAL::post_smoother_step started on level 2
DEAL::post_smoother_step finished on level 2
DEAL::transfer_to_global started