// Then generate a constraints object with just this one constraint. First
// clear all previous content (which might reside there from the previous
- // computation on a once coarser grid), then add this one line
+ // computation on a once coarser grid), then add this one constraint,
// constraining the <code>first_boundary_dof</code> to the sum of other
// boundary DoFs each with weight -1. Finally, close the constraints
// object, i.e. do some internal bookkeeping on it for faster processing
// of what is to come later:
mean_value_constraints.clear();
- mean_value_constraints.add_line(first_boundary_dof);
+ std::vector<std::pair<types::global_dof_index, double>> rhs;
for (const types::global_dof_index i : boundary_dofs)
if (i != first_boundary_dof)
- mean_value_constraints.add_entry(first_boundary_dof, i, -1);
+ rhs.emplace_back(i, -1.);
+ mean_value_constraints.add_constraint(first_boundary_dof, rhs);
mean_value_constraints.close();
// Next task is to generate a sparsity pattern. This is indeed a tricky
0)
{
active_set.add_index(dof_index);
- constraints.add_line(dof_index);
- constraints.set_inhomogeneity(dof_index, obstacle_value);
+ constraints.add_constraint(dof_index, {}, obstacle_value);
solution(dof_index) = obstacle_value;
cell->face(f)->get_dof_indices (local_face_dof_indices, 0);
for (unsigned int i=0; i<local_face_dof_indices.size(); ++i)
if (stokes_fe.face_system_to_component_index(i).first < dim)
- constraints.add_line (local_face_dof_indices[i]);
+ constraints.add_constraint (local_face_dof_indices[i], {}, 0.);
}
}
@endcode
-The call <code>constraints.add_line(t)</code> tells the
-AffineConstraints to start a new constraint for degree of freedom
-<code>t</code> of the form $x_t=\sum_{l=0}^{N-1} c_{tl} x_l +
-b_t$. Typically, one would then proceed to set individual coefficients
-$c_{tl}$ to nonzero values (using AffineConstraints::add_entry) or set
-$b_t$ to something nonzero (using
-AffineConstraints::set_inhomogeneity); doing nothing as above, funny as
-it looks, simply leaves the constraint to be $x_t=0$, which is exactly
+The last line calls
+AffineConstraints::add_constraint() and adds the constraint
+<i>x<sub>local_face_dof_indices[i]</sub>=0</i>, which is exactly
what we need in the current context. The call to
-FiniteElement::face_system_to_component_index makes sure that we only set
+FiniteElement::face_system_to_component_index() makes sure that we only set
boundary values to zero for velocity but not pressure components.
Note that there are cases where this may yield incorrect results:
++i)
if (stokes_fe.face_system_to_component_index(i).first <
dim)
- constraints.add_line(local_face_dof_indices[i]);
+ constraints.add_constraint(local_face_dof_indices[i],
+ {},
+ 0.);
}
}
}