this->signals.pre_smoother_step(false, level);
// compute residual on level, which includes the (CG) edge matrix
+ this->signals.residual_step(true, level);
matrix->vmult(level, t[level], solution[level]);
if (edge_out != nullptr)
{
edge_down->vmult(level, t[level - 1], solution[level]);
defect[level - 1] -= t[level - 1];
}
+ this->signals.residual_step(false, level);
this->signals.restriction(true, level);
transfer->restrict_and_add(level, defect[level - 1], t[level]);
transfer->prolongate_and_add(level, solution[level], solution[level - 1]);
this->signals.prolongation(false, level);
+ this->signals.edge_prolongation(true, level);
// get in contribution from edge matrices to the defect
if (edge_in != nullptr)
{
edge_up->Tvmult(level, t[level], solution[level - 1]);
defect[level] -= t[level];
}
+ this->signals.edge_prolongation(false, level);
// post-smoothing
this->signals.post_smoother_step(true, level);
this->signals.pre_smoother_step(false, level);
// compute residual on level, which includes the (CG) edge matrix
+ this->signals.residual_step(true, level);
matrix->vmult(level, t[level], solution[level]);
if (edge_out != nullptr)
edge_out->vmult_add(level, t[level], solution[level]);
edge_down->vmult(level, defect2[level - 1], solution[level]);
else
defect2[level - 1] = typename VectorType::value_type(0.);
+ this->signals.residual_step(false, level);
this->signals.restriction(true, level);
transfer->restrict_and_add(level, defect2[level - 1], t[level]);
this->signals.prolongation(true, level);
transfer->prolongate(level, t[level], solution[level - 1]);
this->signals.prolongation(false, level);
+
+ this->signals.edge_prolongation(true, level);
solution[level] += t[level];
// get in contribution from edge matrices to the defect
edge_up->Tvmult(level, t[level], solution[level - 1]);
defect2[level] -= t[level];
}
+ this->signals.edge_prolongation(false, level);
// post-smoothing
this->signals.post_smoother_step(true, level);
}
+
+template <typename VectorType>
+boost::signals2::connection
+Multigrid<VectorType>::connect_residual_step(
+ const std::function<void(const bool, const unsigned int)> &slot)
+{
+ return this->signals.post_smoother_step.connect(slot);
+}
+
+
+
+template <typename VectorType>
+boost::signals2::connection
+Multigrid<VectorType>::connect_edge_prolongation(
+ const std::function<void(const bool, const unsigned int)> &slot)
+{
+ return this->signals.edge_prolongation.connect(slot);
+}
+
+
DEAL_II_NAMESPACE_CLOSE
#endif
}
};
+ auto print_residual_step = [](const bool start, const unsigned int level) {
+ if (start)
+ {
+ deallog << "Residual step level " << level << std::endl;
+ }
+ };
+
+ auto print_edge_prolongation = [](const bool start,
+ const unsigned int level) {
+ if (start)
+ {
+ deallog << "Edge prol. level " << level << std::endl;
+ }
+ };
+
const auto coarse_connection = mg1.connect_coarse_solve(print_coarse_solve);
const auto restriction_connection =
mg1.connect_restriction(print_restriction);
mg1.connect_pre_smoother_step(print_pre_smoother_step);
const auto post_smoother_connection =
mg1.connect_post_smoother_step(print_post_smoother_step);
+ const auto residual_step_connection =
+ mg1.connect_residual_step(print_residual_step);
+ const auto edge_prolongation_connection =
+ mg1.connect_residual_step(print_edge_prolongation);
mg1.cycle();
deallog << std::endl;
prolongation_connection.disconnect();
pre_smoother_connection.disconnect();
post_smoother_connection.disconnect();
+ residual_step_connection.disconnect();
+ edge_prolongation_connection.disconnect();
}
{
}
};
+ auto print_residual_step_w = [](const bool start,
+ const unsigned int level) {
+ if (start)
+ {
+ deallog << "W-cycle Res. step level " << level << std::endl;
+ }
+ };
+
+ auto print_edge_prolongation_w = [](const bool start,
+ const unsigned int level) {
+ if (start)
+ {
+ deallog << "W-cycle Edge pro. level " << level << std::endl;
+ }
+ };
+
const auto coarse_connection =
mg1.connect_coarse_solve(print_coarse_solve_w);
const auto restriction_connection =
mg1.connect_pre_smoother_step(print_pre_smoother_step_w);
const auto post_smoother_connection =
mg1.connect_post_smoother_step(print_post_smoother_step_w);
+ const auto residual_step_connection =
+ mg1.connect_residual_step(print_residual_step_w);
+ const auto edge_prolongation_connection =
+ mg1.connect_residual_step(print_edge_prolongation_w);
mg1.set_cycle(Multigrid<VectorType>::w_cycle);
mg1.cycle();
prolongation_connection.disconnect();
pre_smoother_connection.disconnect();
post_smoother_connection.disconnect();
+ residual_step_connection.disconnect();
+ edge_prolongation_connection.disconnect();
}
{
}
};
+ auto print_residual_step_f = [](const bool start,
+ const unsigned int level) {
+ if (start)
+ {
+ deallog << "F-cycle Res. step level " << level << std::endl;
+ }
+ };
+
+ auto print_edge_prolongation_f = [](const bool start,
+ const unsigned int level) {
+ if (start)
+ {
+ deallog << "F-cycle Edge pro. level " << level << std::endl;
+ }
+ };
+
mg1.connect_coarse_solve(print_coarse_solve_f);
mg1.connect_restriction(print_restriction_f);
mg1.connect_prolongation(print_prolongation_f);
mg1.connect_pre_smoother_step(print_pre_smoother_step_f);
mg1.connect_post_smoother_step(print_post_smoother_step_f);
+ mg1.connect_residual_step(print_residual_step_f);
+ mg1.connect_residual_step(print_edge_prolongation_f);
mg1.set_cycle(Multigrid<VectorType>::f_cycle);
mg1.cycle();
DEAL::Smoothing on level 1
DEAL::Solution norm 0
DEAL::V-cycle leaving level 1
+DEAL::Residual step level 1
+DEAL::Edge prol. level 1
DEAL::Prolongate norm 0
DEAL::V-cycle Defect norm 0
DEAL::Smoothing on level 2
DEAL::Solution norm 0
DEAL::V-cycle leaving level 2
+DEAL::Residual step level 2
+DEAL::Edge prol. level 2
DEAL::Prolongate norm 0
DEAL::V-cycle Defect norm 0
DEAL::Smoothing on level 3
DEAL::Solution norm 0
DEAL::V-cycle leaving level 3
+DEAL::Residual step level 3
+DEAL::Edge prol. level 3
DEAL::Prolongate norm 0
DEAL::V-cycle Defect norm 0
DEAL::Smoothing on level 4
DEAL::Solution norm 0
DEAL::V-cycle leaving level 4
+DEAL::Residual step level 4
+DEAL::Edge prol. level 4
DEAL::
DEAL::W-cycle entering level 4
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 1
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 1
+DEAL::W-cycle Res. step level 1
+DEAL::W-cycle Edge pro. level 1
DEAL::W-cycle entering level 1
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 1
DEAL::W-cycle smoothing level 1
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 1
+DEAL::W-cycle Res. step level 1
+DEAL::W-cycle Edge pro. level 1
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 2
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 2
+DEAL::W-cycle Res. step level 2
+DEAL::W-cycle Edge pro. level 2
DEAL::W-cycle entering level 2
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 2
DEAL::W-cycle smoothing level 1
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 1
+DEAL::W-cycle Res. step level 1
+DEAL::W-cycle Edge pro. level 1
DEAL::W-cycle entering level 1
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 1
DEAL::W-cycle smoothing level 1
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 1
+DEAL::W-cycle Res. step level 1
+DEAL::W-cycle Edge pro. level 1
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 2
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 2
+DEAL::W-cycle Res. step level 2
+DEAL::W-cycle Edge pro. level 2
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 3
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 3
+DEAL::W-cycle Res. step level 3
+DEAL::W-cycle Edge pro. level 3
DEAL::W-cycle entering level 3
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 3
DEAL::W-cycle smoothing level 1
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 1
+DEAL::W-cycle Res. step level 1
+DEAL::W-cycle Edge pro. level 1
DEAL::W-cycle entering level 1
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 1
DEAL::W-cycle smoothing level 1
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 1
+DEAL::W-cycle Res. step level 1
+DEAL::W-cycle Edge pro. level 1
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 2
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 2
+DEAL::W-cycle Res. step level 2
+DEAL::W-cycle Edge pro. level 2
DEAL::W-cycle entering level 2
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 2
DEAL::W-cycle smoothing level 1
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 1
+DEAL::W-cycle Res. step level 1
+DEAL::W-cycle Edge pro. level 1
DEAL::W-cycle entering level 1
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 1
DEAL::W-cycle smoothing level 1
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 1
+DEAL::W-cycle Res. step level 1
+DEAL::W-cycle Edge pro. level 1
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 2
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 2
+DEAL::W-cycle Res. step level 2
+DEAL::W-cycle Edge pro. level 2
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 3
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 3
+DEAL::W-cycle Res. step level 3
+DEAL::W-cycle Edge pro. level 3
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 4
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 4
+DEAL::W-cycle Res. step level 4
+DEAL::W-cycle Edge pro. level 4
DEAL::
DEAL::F-cycle entering level 4
DEAL::F-cycle defect norm 0
DEAL::F-cycle smoothing level 1
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 1
+DEAL::F-cycle Res. step level 1
+DEAL::F-cycle Edge pro. level 1
DEAL::F-cycle entering level 1
DEAL::F-cycle defect norm 0
DEAL::F-cycle smoothing level 1
DEAL::F-cycle smoothing level 1
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 1
+DEAL::F-cycle Res. step level 1
+DEAL::F-cycle Edge pro. level 1
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 2
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 2
+DEAL::F-cycle Res. step level 2
+DEAL::F-cycle Edge pro. level 2
DEAL::F-cycle entering level 2
DEAL::F-cycle defect norm 0
DEAL::F-cycle smoothing level 2
DEAL::F-cycle smoothing level 1
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 1
+DEAL::F-cycle Res. step level 1
+DEAL::F-cycle Edge pro. level 1
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 2
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 2
+DEAL::F-cycle Res. step level 2
+DEAL::F-cycle Edge pro. level 2
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 3
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 3
+DEAL::F-cycle Res. step level 3
+DEAL::F-cycle Edge pro. level 3
DEAL::F-cycle entering level 3
DEAL::F-cycle defect norm 0
DEAL::F-cycle smoothing level 3
DEAL::F-cycle smoothing level 1
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 1
+DEAL::F-cycle Res. step level 1
+DEAL::F-cycle Edge pro. level 1
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 2
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 2
+DEAL::F-cycle Res. step level 2
+DEAL::F-cycle Edge pro. level 2
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 3
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 3
+DEAL::F-cycle Res. step level 3
+DEAL::F-cycle Edge pro. level 3
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 4
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 4
+DEAL::F-cycle Res. step level 4
+DEAL::F-cycle Edge pro. level 4
DEAL::V-cycle entering level 5
DEAL::V-cycle Defect norm 0
DEAL::Smoothing on level 5
DEAL::Smoothing on level 3
DEAL::Solution norm 0
DEAL::V-cycle leaving level 3
+DEAL::Residual step level 3
+DEAL::Edge prol. level 3
DEAL::Prolongate norm 0
DEAL::V-cycle Defect norm 0
DEAL::Smoothing on level 4
DEAL::Solution norm 0
DEAL::V-cycle leaving level 4
+DEAL::Residual step level 4
+DEAL::Edge prol. level 4
DEAL::Prolongate norm 0
DEAL::V-cycle Defect norm 0
DEAL::Smoothing on level 5
DEAL::Solution norm 0
DEAL::V-cycle leaving level 5
+DEAL::Residual step level 5
+DEAL::Edge prol. level 5
DEAL::
DEAL::W-cycle entering level 5
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 3
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 3
+DEAL::W-cycle Res. step level 3
+DEAL::W-cycle Edge pro. level 3
DEAL::W-cycle entering level 3
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 3
DEAL::W-cycle smoothing level 3
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 3
+DEAL::W-cycle Res. step level 3
+DEAL::W-cycle Edge pro. level 3
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 4
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 4
+DEAL::W-cycle Res. step level 4
+DEAL::W-cycle Edge pro. level 4
DEAL::W-cycle entering level 4
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 4
DEAL::W-cycle smoothing level 3
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 3
+DEAL::W-cycle Res. step level 3
+DEAL::W-cycle Edge pro. level 3
DEAL::W-cycle entering level 3
DEAL::W-cycle defect norm 0
DEAL::W-cycle smoothing level 3
DEAL::W-cycle smoothing level 3
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 3
+DEAL::W-cycle Res. step level 3
+DEAL::W-cycle Edge pro. level 3
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 4
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 4
+DEAL::W-cycle Res. step level 4
+DEAL::W-cycle Edge pro. level 4
DEAL::W-cycle Defect norm 0
DEAL::W-cycle smoothing level 5
DEAL::W-cycle solution norm 0
DEAL::W-cycle leaving level 5
+DEAL::W-cycle Res. step level 5
+DEAL::W-cycle Edge pro. level 5
DEAL::
DEAL::F-cycle entering level 5
DEAL::F-cycle defect norm 0
DEAL::F-cycle smoothing level 3
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 3
+DEAL::F-cycle Res. step level 3
+DEAL::F-cycle Edge pro. level 3
DEAL::F-cycle entering level 3
DEAL::F-cycle defect norm 0
DEAL::F-cycle smoothing level 3
DEAL::F-cycle smoothing level 3
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 3
+DEAL::F-cycle Res. step level 3
+DEAL::F-cycle Edge pro. level 3
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 4
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 4
+DEAL::F-cycle Res. step level 4
+DEAL::F-cycle Edge pro. level 4
DEAL::F-cycle entering level 4
DEAL::F-cycle defect norm 0
DEAL::F-cycle smoothing level 4
DEAL::F-cycle smoothing level 3
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 3
+DEAL::F-cycle Res. step level 3
+DEAL::F-cycle Edge pro. level 3
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 4
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 4
+DEAL::F-cycle Res. step level 4
+DEAL::F-cycle Edge pro. level 4
DEAL::F-cycle Defect norm 0
DEAL::F-cycle smoothing level 5
DEAL::F-cycle solution norm 0
DEAL::F-cycle leaving level 5
+DEAL::F-cycle Res. step level 5
+DEAL::F-cycle Edge pro. level 5