CopyData & copy_data);
void assemble_system_and_multigrid();
- std::unique_ptr<MGSmoother<Vector<double>>> create_smoother();
+ void setup_smoother();
void solve();
void refine_grid();
mg::Matrix<Vector<double>> mg_interface_matrix_in;
mg::Matrix<Vector<double>> mg_interface_matrix_out;
+ using SmootherType =
+ RelaxationBlock<SparseMatrix<double>, double, Vector<double>>;
+ using SmootherAdditionalDataType = SmootherType::AdditionalData;
+ std::unique_ptr<MGSmoother<Vector<double>>> mg_smoother;
+
+ MGLevelObject<SmootherAdditionalDataType> smoother_data;
MGConstrainedDoFs mg_constrained_dofs;
template <int dim>
- std::unique_ptr<MGSmoother<Vector<double>>>
- AdvectionProblem<dim>::create_smoother()
+ void AdvectionProblem<dim>::setup_smoother()
{
if (settings.smoother_type == "SOR")
{
Smoother::AdditionalData(fe.degree == 1 ? 1.0 :
0.62));
smoother->set_steps(2);
- return smoother;
+ mg_smoother = std::move(smoother);
}
else if (settings.smoother_type == "Jacobi")
{
Smoother::AdditionalData(fe.degree == 1 ? 0.6667 :
0.47));
smoother->set_steps(4);
- return smoother;
+ mg_smoother = std::move(smoother);
}
else if (settings.smoother_type == "block SOR")
{
using Smoother =
RelaxationBlockSOR<SparseMatrix<double>, double, Vector<double>>;
- // TODO: try and remove static
- static MGLevelObject<typename Smoother::AdditionalData> smoother_data;
smoother_data.resize(0, triangulation.n_levels() - 1);
for (unsigned int level = 0; level < triangulation.n_levels(); ++level)
Vector<double>>>();
smoother->initialize(mg_matrices, smoother_data);
smoother->set_steps(1);
- return smoother;
+ mg_smoother = std::move(smoother);
}
else if (settings.smoother_type == "block Jacobi")
{
using Smoother =
RelaxationBlockJacobi<SparseMatrix<double>, double, Vector<double>>;
- // TODO: try and remove static
- static MGLevelObject<typename Smoother::AdditionalData> smoother_data;
smoother_data.resize(0, triangulation.n_levels() - 1);
for (unsigned int level = 0; level < triangulation.n_levels(); ++level)
Vector<double>>>();
smoother->initialize(mg_matrices, smoother_data);
smoother->set_steps(2);
- return smoother;
+ mg_smoother = std::move(smoother);
}
else
AssertThrow(false, ExcNotImplemented());
MGCoarseGridHouseholder<double, Vector<double>> coarse_grid_solver;
coarse_grid_solver.initialize(coarse_matrix);
- const std::unique_ptr<MGSmoother<Vector<double>>> mg_smoother =
- create_smoother();
+ setup_smoother();
mg_matrix.initialize(mg_matrices);
mg_interface_matrix_in.initialize(mg_interface_in);
<< " in " << time.last_wall_time() << " seconds " << std::endl;
constraints.distribute(solution);
+
+ mg_smoother.release();
}