/**
* Make a constraint matrix for the
* constraints that result from zero
- * boundary values. This function is used
+ * boundary values.
+ *
+ * This function constrains all
+ * degrees of freedom on the
+ * boundary. Optionally, you can
+ * add a component mask, which
+ * restricts this functionality
+ * to a subset of an FESystem.
+ *
+ * For non-@ref GlossPrimitive "primitive"
+ * shape functions, any degree of freedom
+ * is affected that belongs to a
+ * shape function where at least
+ * one of its nonzero components
+ * is affected.
+ *
+ * This function is used
* in step-36, for
* example.
*
++face_no)
{
const FiniteElement<dim,spacedim> &fe = cell->get_fe();
-
- // we can presently deal only with
- // primitive elements for boundary
- // values. make sure that all shape
- // functions that are non-zero for
- // the components we are interested
- // in, are in fact primitive
- for (unsigned int i=0; i<cell->get_fe().dofs_per_cell; ++i)
- {
- const std::vector<bool> &nonzero_component_array
- = cell->get_fe().get_nonzero_components (i);
- for (unsigned int c=0; c<n_components; ++c)
- if ((nonzero_component_array[c] == true)
- &&
- (component_mask[c] == true))
- Assert (cell->get_fe().is_primitive (i),
- ExcMessage ("This function can only deal with requested boundary "
- "values that correspond to primitive (scalar) base "
- "elements"));
- }
-
+
typename DH<dim,spacedim>::face_iterator face = cell->face(face_no);
if (face->boundary_indicator () == 0)
// face is of the right component
// that match the component
// signature.
for (unsigned int i=0; i<face_dofs.size(); ++i)
- if (component_mask[fe.face_system_to_component_index(i).first])
- zero_boundary_constraints.add_line (face_dofs[i]);
+ {
+ // Find out if a dof
+ // has a contribution
+ // in this component,
+ // and if so, add it
+ // to the list
+ const std::vector<bool> &nonzero_component_array
+ = cell->get_fe().get_nonzero_components (i);
+ bool nonzero = false;
+ for (unsigned int c=0; c<n_components; ++c)
+ if (nonzero_component_array[c] && component_mask[c])
+ {
+ nonzero = true;
+ break;
+ }
+
+ if (nonzero)
+ zero_boundary_constraints.add_line (face_dofs[i]);
+ }
}
}
}