void
test(const unsigned int n_refinements,
const unsigned int fe_degree_fine,
- const bool do_simplex_mesh)
+ const bool do_simplex_mesh,
+ const bool ones_on_diagonal)
{
using VectorType = LinearAlgebra::distributed::Vector<Number>;
constraint.close();
// set up operator
- op.reinit(*mapping, dof_handler, *quad, constraint);
+ op.reinit(*mapping,
+ dof_handler,
+ *quad,
+ constraint,
+ numbers::invalid_unsigned_int,
+ ones_on_diagonal);
}
// set up transfer operator
deallog.precision(8);
- for (unsigned int n_refinements = 2; n_refinements <= 4; ++n_refinements)
- for (unsigned int degree = 1; degree <= 4; ++degree)
- test<2>(n_refinements, degree, false /*quadrilateral*/);
-
- for (unsigned int n_refinements = 2; n_refinements <= 4; ++n_refinements)
- for (unsigned int degree = 1; degree <= 2; ++degree)
- test<2>(n_refinements, degree, true /*triangle*/);
+ for (const auto ones_on_diagonal : {false, true})
+ {
+ for (unsigned int n_refinements = 2; n_refinements <= 4; ++n_refinements)
+ for (unsigned int degree = 1; degree <= 4; ++degree)
+ test<2>(n_refinements,
+ degree,
+ false /*quadrilateral*/,
+ ones_on_diagonal);
+
+ for (unsigned int n_refinements = 2; n_refinements <= 4; ++n_refinements)
+ for (unsigned int degree = 1; degree <= 2; ++degree)
+ test<2>(n_refinements, degree, true /*triangle*/, ones_on_diagonal);
+ }
}
DEAL:0::2 2 3 tri 3
DEAL:0::2 1 4 tri 3
DEAL:0::2 2 4 tri 3
+DEAL:0::2 1 2 quad 2
+DEAL:0::2 2 2 quad 3
+DEAL:0::2 3 2 quad 3
+DEAL:0::2 4 2 quad 3
+DEAL:0::2 1 3 quad 3
+DEAL:0::2 2 3 quad 3
+DEAL:0::2 3 3 quad 3
+DEAL:0::2 4 3 quad 3
+DEAL:0::2 1 4 quad 3
+DEAL:0::2 2 4 quad 3
+DEAL:0::2 3 4 quad 3
+DEAL:0::2 4 4 quad 3
+DEAL:0::2 1 2 tri 3
+DEAL:0::2 2 2 tri 3
+DEAL:0::2 1 3 tri 3
+DEAL:0::2 2 3 tri 3
+DEAL:0::2 1 4 tri 3
+DEAL:0::2 2 4 tri 3
test(const unsigned int n_refinements,
const unsigned int fe_degree_fine,
const bool do_simplex_mesh,
- const unsigned int mesh_type)
+ const unsigned int mesh_type,
+ const bool ones_on_diagonal)
{
using VectorType = LinearAlgebra::distributed::Vector<Number>;
constraint.close();
// set up operator
- op.reinit(*mapping, dof_handler, *quad, constraint);
+ op.reinit(*mapping,
+ dof_handler,
+ *quad,
+ constraint,
+ numbers::invalid_unsigned_int,
+ ones_on_diagonal);
}
// set up transfer operator
deallog.precision(8);
- for (unsigned int mesh_type = 0; mesh_type < 2; ++mesh_type)
- {
- for (unsigned int n_refinements = 2; n_refinements <= 4; ++n_refinements)
- for (unsigned int degree = 2; degree <= 4; ++degree)
- test<2>(n_refinements, degree, false /*quadrilateral*/, mesh_type);
-
- for (unsigned int n_refinements = 2; n_refinements <= 4; ++n_refinements)
- for (unsigned int degree = 2; degree <= 2; ++degree)
- test<2>(n_refinements, degree, true /*triangle*/, mesh_type);
- }
+ for (const auto ones_on_diagonal : {false, true})
+ for (unsigned int mesh_type = 0; mesh_type < 2; ++mesh_type)
+ {
+ for (unsigned int n_refinements = 2; n_refinements <= 4;
+ ++n_refinements)
+ for (unsigned int degree = 2; degree <= 4; ++degree)
+ test<2>(n_refinements,
+ degree,
+ false /*quadrilateral*/,
+ mesh_type,
+ ones_on_diagonal);
+
+
+ for (unsigned int n_refinements = 2; n_refinements <= 4;
+ ++n_refinements)
+ for (unsigned int degree = 2; degree <= 2; ++degree)
+ test<2>(n_refinements,
+ degree,
+ true /*triangle*/,
+ mesh_type,
+ ones_on_diagonal);
+ }
}
DEAL:0::2 2 4 tri 4
DEAL:0::Norm interpolated solution on level 0: 0.40718520
DEAL:0::Norm interpolated solution on level 1: 0.80533381
+DEAL:0::2 2 2 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.33877875
+DEAL:0::Norm interpolated solution on level 1: 0.66014529
+DEAL:0::2 3 2 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.33872299
+DEAL:0::Norm interpolated solution on level 1: 0.99016130
+DEAL:0::2 4 2 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.33877890
+DEAL:0::Norm interpolated solution on level 1: 0.66010393
+DEAL:0::Norm interpolated solution on level 2: 1.3201957
+DEAL:0::2 2 3 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.66459543
+DEAL:0::Norm interpolated solution on level 1: 1.3203627
+DEAL:0::2 3 3 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.66458798
+DEAL:0::Norm interpolated solution on level 1: 1.9805368
+DEAL:0::2 4 3 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.66459725
+DEAL:0::Norm interpolated solution on level 1: 1.3203574
+DEAL:0::Norm interpolated solution on level 2: 2.6407133
+DEAL:0::2 2 4 quad 3
+DEAL:0::Norm interpolated solution on level 0: 1.3225826
+DEAL:0::Norm interpolated solution on level 1: 2.6407347
+DEAL:0::2 3 4 quad 3
+DEAL:0::Norm interpolated solution on level 0: 1.3225816
+DEAL:0::Norm interpolated solution on level 1: 3.9611011
+DEAL:0::2 4 4 quad 3
+DEAL:0::Norm interpolated solution on level 0: 1.3225830
+DEAL:0::Norm interpolated solution on level 1: 2.6407340
+DEAL:0::Norm interpolated solution on level 2: 5.2814679
+DEAL:0::2 2 2 tri 3
+DEAL:0::Norm interpolated solution on level 0: 0.33806168
+DEAL:0::Norm interpolated solution on level 1: 0.66011744
+DEAL:0::2 2 3 tri 3
+DEAL:0::Norm interpolated solution on level 0: 0.66445481
+DEAL:0::Norm interpolated solution on level 1: 1.3203595
+DEAL:0::2 2 4 tri 3
+DEAL:0::Norm interpolated solution on level 0: 1.3225585
+DEAL:0::Norm interpolated solution on level 1: 2.6407344
+DEAL:0::2 2 2 quad 2
+DEAL:0::Norm interpolated solution on level 0: 0.13157424
+DEAL:0::Norm interpolated solution on level 1: 0.24449632
+DEAL:0::2 3 2 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.13144458
+DEAL:0::Norm interpolated solution on level 1: 0.35587970
+DEAL:0::2 4 2 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.13139421
+DEAL:0::Norm interpolated solution on level 1: 0.24404614
+DEAL:0::Norm interpolated solution on level 2: 0.46558561
+DEAL:0::2 2 3 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.23622379
+DEAL:0::Norm interpolated solution on level 1: 0.45479680
+DEAL:0::2 3 3 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.23657515
+DEAL:0::Norm interpolated solution on level 1: 0.66773399
+DEAL:0::2 4 3 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.23652211
+DEAL:0::Norm interpolated solution on level 1: 0.45456995
+DEAL:0::Norm interpolated solution on level 2: 0.87733284
+DEAL:0::2 2 4 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.43119420
+DEAL:0::Norm interpolated solution on level 1: 0.85199621
+DEAL:0::2 3 4 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.43119824
+DEAL:0::Norm interpolated solution on level 1: 1.2615628
+DEAL:0::2 4 4 quad 3
+DEAL:0::Norm interpolated solution on level 0: 0.43118187
+DEAL:0::Norm interpolated solution on level 1: 0.85199072
+DEAL:0::Norm interpolated solution on level 2: 1.6669458
+DEAL:0::2 2 2 tri 3
+DEAL:0::Norm interpolated solution on level 0: 0.13575160
+DEAL:0::Norm interpolated solution on level 1: 0.24280231
+DEAL:0::2 2 3 tri 3
+DEAL:0::Norm interpolated solution on level 0: 0.21915908
+DEAL:0::Norm interpolated solution on level 1: 0.41924192
+DEAL:0::2 2 4 tri 4
+DEAL:0::Norm interpolated solution on level 0: 0.40718520
+DEAL:0::Norm interpolated solution on level 1: 0.80533381
const DoFHandler<dim> &dof_handler,
const Quadrature<dim> &quad,
const AffineConstraints<number> &constraints,
- const unsigned int mg_level = numbers::invalid_unsigned_int)
+ const unsigned int mg_level = numbers::invalid_unsigned_int,
+ const bool ones_on_diagonal = false)
{
// Clear internal data structures (if operator is reused).
this->system_matrix.clear();
data.mg_level = mg_level;
matrix_free.reinit(mapping, dof_handler, constraints, quad, data);
+
+ constrained_indices.clear();
+
+ if (ones_on_diagonal)
+ for (auto i : this->matrix_free.get_constrained_dofs())
+ constrained_indices.push_back(i);
}
virtual types::global_dof_index
{
this->matrix_free.cell_loop(
&Operator::do_cell_integral_range, this, dst, src, true);
+
+ for (unsigned int i = 0; i < constrained_indices.size(); ++i)
+ dst.local_element(constrained_indices[i]) =
+ src.local_element(constrained_indices[i]);
}
void
AffineConstraints<number> constraints;
mutable TrilinosWrappers::SparseMatrix system_matrix;
+
+ std::vector<unsigned int> constrained_indices;
};
struct GMGParameters