using scalar_type = typename LA::MPI::BlockVector::value_type;
- AffineConstraints<scalar_type> cm;
+ AffineConstraints<scalar_type> cm(complete_index_set(v.size()),
+ complete_index_set(v.size()));
cm.add_line(0);
cm.add_entry(0, 1, 3.0);
cm.close();
ExcInternalError());
using scalar_type = typename LA::MPI::BlockVector::value_type;
- AffineConstraints<scalar_type> cm;
+ AffineConstraints<scalar_type> cm(local_active,
+ complete_index_set(local_active.size()));
cm.add_line(1);
cm.add_entry(1, 2, 3.0);
cm.close();
LinearAlgebra::distributed::Vector<double> new_solution(
dof_handler.locally_owned_dofs(), locally_relevant_dofs, MPI_COMM_WORLD);
- AffineConstraints<double> affine_constraints;
+ AffineConstraints<double> affine_constraints(
+ dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler));
DoFTools::make_hanging_node_constraints(dof_handler, affine_constraints);
affine_constraints.close();
dof_handler.distribute_dofs(fe);
constraints.clear();
+ constraints.reinit(dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler));
std::map<unsigned int, double> boundary_values;
VectorTools::interpolate_boundary_values(dof_handler,
0,
dof_handler.distribute_dofs(fe);
constraints.clear();
+ constraints.reinit(dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler));
std::map<unsigned int, double> boundary_values;
VectorTools::interpolate_boundary_values(dof_handler,
0,
std::unique_ptr<DoFHandler<dim>> dof1(make_dof_handler(*tria, fe1));
std::unique_ptr<DoFHandler<dim>> dof2(make_dof_handler(*tria, fe2));
- AffineConstraints<double> cm1;
- DoFTools::make_hanging_node_constraints(*dof1, cm1);
- cm1.close();
- AffineConstraints<double> cm2;
- DoFTools::make_hanging_node_constraints(*dof2, cm2);
- cm2.close();
const IndexSet &locally_owned_dofs1 = dof1->locally_owned_dofs();
const IndexSet locally_relevant_dofs1 =
const IndexSet locally_relevant_dofs2 =
DoFTools::extract_locally_relevant_dofs(*dof2);
+ AffineConstraints<PetscScalar> cm1(locally_owned_dofs1,
+ locally_relevant_dofs1);
+ DoFTools::make_hanging_node_constraints(*dof1, cm1);
+ cm1.close();
+ AffineConstraints<PetscScalar> cm2(locally_owned_dofs2,
+ locally_relevant_dofs2);
+ DoFTools::make_hanging_node_constraints(*dof2, cm2);
+ cm2.close();
+
+
VectorType in_ghosted =
build_ghosted<VectorType>(locally_owned_dofs1, locally_relevant_dofs1);
VectorType in_distributed =
std::unique_ptr<DoFHandler<dim>> dof1(make_dof_handler(*tria, fe1));
std::unique_ptr<DoFHandler<dim>> dof2(make_dof_handler(*tria, fe2));
- AffineConstraints<double> cm1;
- DoFTools::make_hanging_node_constraints(*dof1, cm1);
- cm1.close();
- AffineConstraints<double> cm2;
- DoFTools::make_hanging_node_constraints(*dof2, cm2);
- cm2.close();
const IndexSet &locally_owned_dofs1 = dof1->locally_owned_dofs();
const IndexSet locally_relevant_dofs1 =
const IndexSet locally_relevant_dofs2 =
DoFTools::extract_locally_relevant_dofs(*dof2);
+ AffineConstraints<double> cm1(locally_owned_dofs1, locally_relevant_dofs1);
+ DoFTools::make_hanging_node_constraints(*dof1, cm1);
+ cm1.close();
+ AffineConstraints<double> cm2(locally_owned_dofs2, locally_relevant_dofs2);
+ DoFTools::make_hanging_node_constraints(*dof2, cm2);
+ cm2.close();
+
VectorType in_ghosted =
build_ghosted<VectorType>(locally_owned_dofs1, locally_relevant_dofs1);
VectorType out_ghosted =
VectorTools::interpolate(dof_handler, CheckFunction<dim>(), interpolated);
// then also apply constraints
- AffineConstraints<double> hanging_node_constraints;
+ const IndexSet relevant_set =
+ DoFTools::extract_locally_relevant_dofs(dof_handler);
+ AffineConstraints<double> hanging_node_constraints(
+ dof_handler.locally_owned_dofs(), relevant_set);
DoFTools::make_hanging_node_constraints(dof_handler,
hanging_node_constraints);
hanging_node_constraints.close();
hanging_node_constraints.distribute(interpolated);
// extract a vector that has ghost elements
- const IndexSet relevant_set =
- DoFTools::extract_locally_relevant_dofs(dof_handler);
TrilinosWrappers::MPI::Vector x_rel(relevant_set, MPI_COMM_WORLD);
x_rel = interpolated;
dofh1.distribute_dofs(fe);
dofh2.distribute_dofs(fe);
- AffineConstraints<PetscScalar> cm1;
- cm1.close();
- AffineConstraints<PetscScalar> cm2;
- cm2.close();
-
const IndexSet &dof1_locally_owned_dofs = dofh1.locally_owned_dofs();
const IndexSet &dof2_locally_owned_dofs = dofh2.locally_owned_dofs();
const IndexSet dof1_locally_relevant_dofs =
const IndexSet dof2_locally_relevant_dofs =
DoFTools::extract_locally_relevant_dofs(dofh2);
+ AffineConstraints<PetscScalar> cm1(dof1_locally_owned_dofs,
+ dof1_locally_relevant_dofs);
+ cm1.close();
+ AffineConstraints<PetscScalar> cm2(dof2_locally_owned_dofs,
+ dof2_locally_relevant_dofs);
+ cm2.close();
+
PETScWrappers::MPI::Vector u1(dof1_locally_owned_dofs,
dof1_locally_relevant_dofs,
system_rhs.reinit(mg_dof_handler.locally_owned_dofs(), MPI_COMM_WORLD);
constraints.clear();
+ constraints.reinit(mg_dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(mg_dof_handler));
DoFTools::make_hanging_node_constraints(mg_dof_handler, constraints);
std::map<types::boundary_id, const Function<dim> *> dirichlet_boundary;
system_rhs.reinit(mg_dof_handler.locally_owned_dofs(), MPI_COMM_WORLD);
constraints.clear();
+ constraints.reinit(mg_dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(mg_dof_handler));
DoFTools::make_hanging_node_constraints(mg_dof_handler, constraints);
std::map<types::boundary_id, const Function<dim> *> dirichlet_boundary;
// Apply hanging node constraints on that vector
constraints_euler.clear();
+ constraints_euler.reinit(dof_euler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(
+ dof_euler));
DoFTools::make_hanging_node_constraints(dof_euler, constraints_euler);
constraints_euler.close();
constraints_euler.distribute(euler_positions);
FunctionParser<dim> function(dim == 2 ? "y;-x;x*x+y*y" :
"y;-x;0;x*x+y*y+z*z");
- AffineConstraints<double> constraints;
+ AffineConstraints<double> constraints(dof_handler.locally_owned_dofs(),
+ locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
constraints.close();
VectorTools::project(
DoFHandler<dim> dof_handler_coarse(tria);
dof_handler_coarse.distribute_dofs(fe_coarse);
- AffineConstraints<Number> constraint_coarse;
+ AffineConstraints<Number> constraint_coarse(
+ dof_handler_coarse.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
+
+ AffineConstraints<Number> constraint_fine(
+ dof_handler_fine.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
+
DoFTools::make_hanging_node_constraints(dof_handler_coarse,
constraint_coarse);
constraint_coarse.close();
- AffineConstraints<Number> constraint_fine;
DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
constraint_fine.close();
dof_handler_fine.distribute_dofs(fe_collection);
dof_handler_coarse.distribute_dofs(fe_collection);
- AffineConstraints<Number> constraint_coarse;
+ AffineConstraints<Number> constraint_coarse(
+ dof_handler_coarse.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
+
+ AffineConstraints<Number> constraint_fine(
+ dof_handler_fine.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
+
DoFTools::make_hanging_node_constraints(dof_handler_coarse,
constraint_coarse);
constraint_coarse.close();
- AffineConstraints<Number> constraint_fine;
DoFTools::make_hanging_node_constraints(dof_handler_fine,
constraint_fine);
constraint_fine.close();
DoFHandler<dim> dof_handler_coarse(tria);
dof_handler_coarse.distribute_dofs(FESystem<dim>(fe_coarse, dim));
- AffineConstraints<Number> constraint_coarse;
+ AffineConstraints<Number> constraint_coarse(
+ dof_handler_coarse.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
+
+ AffineConstraints<Number> constraint_fine(
+ dof_handler_fine.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
+
DoFTools::make_hanging_node_constraints(dof_handler_coarse,
constraint_coarse);
constraint_coarse.close();
- AffineConstraints<Number> constraint_fine;
DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
constraint_fine.close();
DoFHandler<dim> dof_handler_coarse(tria_coarse);
dof_handler_coarse.distribute_dofs(fe_coarse);
- AffineConstraints<Number> constraint_coarse;
+ AffineConstraints<Number> constraint_coarse(
+ dof_handler_coarse.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
+
+ AffineConstraints<Number> constraint_fine(
+ dof_handler_fine.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
+
DoFTools::make_hanging_node_constraints(dof_handler_coarse,
constraint_coarse);
constraint_coarse.close();
- AffineConstraints<Number> constraint_fine;
DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
constraint_fine.close();
dof_handler_coarse.distribute_dofs(fe_coarse);
dof_handler_coarse.distribute_mg_dofs();
- AffineConstraints<Number> constraint_coarse;
+ AffineConstraints<Number> constraint_coarse(
+ dof_handler_coarse.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
constraint_coarse.close();
- AffineConstraints<Number> constraint_fine;
+ AffineConstraints<Number> constraint_fine(
+ dof_handler_fine.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
constraint_fine.close();
// setup transfer operator
DoFHandler<dim> dof_handler_coarse(tria);
dof_handler_coarse.distribute_dofs(fe_coarse);
- AffineConstraints<Number> constraint_coarse;
+ AffineConstraints<Number> constraint_coarse(
+ dof_handler_coarse.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
constraint_coarse.close();
- AffineConstraints<Number> constraint_fine;
+ AffineConstraints<Number> constraint_fine(
+ dof_handler_fine.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
constraint_fine.close();
// setup transfer operator
const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
const unsigned int mg_level_coarse = numbers::invalid_unsigned_int)
{
- AffineConstraints<Number> constraint_fine;
+ AffineConstraints<Number> constraint_fine(
+ dof_handler_fine.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
constraint_fine.close();
const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
const unsigned int mg_level_coarse = numbers::invalid_unsigned_int)
{
- AffineConstraints<Number> constraint_fine;
+ AffineConstraints<Number> constraint_fine(
+ dof_handler_fine.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
constraint_fine.close();
FunctionParser<dim> function(dim == 2 ? "y;-x;x*x+y*y" :
"y;-x;0;x*x+y*y+z*z");
- AffineConstraints<double> constraints;
+ AffineConstraints<double> constraints(dof_handler.locally_owned_dofs(),
+ locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
constraints.close();
VectorTools::project(
const LinearAlgebra::distributed::Vector<double> &solution_other,
const Mapping<dim> &mapping_other)
{
- AffineConstraints<double> constraints;
+ AffineConstraints<double> constraints(
+ dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler));
{
std::map<types::global_dof_index, Point<dim>> support_points;
const DoFHandler<dim> &dof_handler)
{
const std::vector<const DoFHandler<dim> *> dof_handlers = {&dof_handler};
- const AffineConstraints<double> dummy;
+ const AffineConstraints<double> dummy(
+ dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler));
const std::vector<const AffineConstraints<double> *> constraints = {&dummy};
#ifdef HEX
const std::vector<Quadrature<1>> quadratures = {QGauss<1>(n_q_points_1d),
euler_operator.project(ExactSolution<dim>(time), reference);
#else
- AffineConstraints<double> dummy;
+ AffineConstraints<double> dummy(
+ dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler));
dummy.close();
VectorTools::project(mapping,
dof_handler,
#ifdef HEX
euler_operator.project(ExactSolution<dim>(time), solution);
#else
- AffineConstraints<double> dummy;
+ AffineConstraints<double> dummy(dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(
+ dof_handler));
dummy.close();
VectorTools::project(mapping,
dof_handler,
dof_handler.distribute_dofs(fe);
constraints.clear();
+ constraints.reinit(dof_handler.locally_owned_dofs(),
+ DoFTools::extract_locally_relevant_dofs(dof_handler));
std::map<unsigned int, double> boundary_values;
VectorTools::interpolate_boundary_values(dof_handler,
0,