* are then flagged #true#, while all
* others are set to #false#.
*
- * The size of #select# shall equal
- * the number of components in the
- * finite element used by #dof#.
+ * The size of #component_select#
+ * shall equal the number of
+ * components in the finite
+ * element used by #dof#.
*/
template <int dim>
static void
- extract_dofs(const DoFHandler<dim> &dof_handler,
- const vector<bool> &select,
- vector<bool> &selected_dofs);
+ extract_dofs (const DoFHandler<dim> &dof_handler,
+ const vector<bool> &component_select,
+ vector<bool> &selected_dofs);
/**
- * Do the same thing as #extract_dofs#
- * for one level of a multi-grid DoF
- * numbering.
+ * Do the same thing as
+ * #extract_dofs# for one level
+ * of a multi-grid DoF numbering.
*/
template <int dim>
static void
- extract_level_dofs(const unsigned int level,
- const MGDoFHandler<dim> &dof,
- const vector<bool> &select,
- vector<bool> &selected_dofs);
+ extract_level_dofs (const unsigned int level,
+ const MGDoFHandler<dim> &dof,
+ const vector<bool> &select,
+ vector<bool> &selected_dofs);
+ /**
+ * Extract all degrees of freedom
+ * which are at the boundary and
+ * belong to specified components
+ * of the solution. The function
+ * returns its results in the
+ * last parameter which contains
+ * #true# is a degree of freedom
+ * is at the boundary and belongs
+ * to one of the selected
+ * components, and #false#
+ * otherwise.
+ *
+ * The size of #component_select#
+ * shall equal the number of
+ * components in the finite
+ * element used by #dof#.
+ */
+ template <int dim>
+ static void
+ extract_boundary_dofs (const DoFHandler<dim> &dof_handler,
+ const vector<bool> &component_select,
+ vector<bool> &selected_dofs);
+
/**
* This function can be used when
* different variables shall be
+#if deal_II_dimension != 1
+
+template <int dim>
+void
+DoFTools::extract_boundary_dofs (const DoFHandler<dim> &dof_handler,
+ const vector<bool> &component_select,
+ vector<bool> &selected_dofs)
+{
+ Assert (component_select.size() == dof_handler.get_fe().n_components(),
+ ExcWrongSize (component_select.size(),
+ dof_handler.get_fe().n_components()));
+
+ selected_dofs.resize (dof_handler.n_dofs(), false);
+ vector<unsigned int> face_dof_indices (dof_handler.get_fe().dofs_per_face);
+ for (DoFHandler<dim>::active_cell_iterator cell=dof_handler.begin_active();
+ cell!=dof_handler.end(); ++cell)
+ for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
+ if (cell->at_boundary(face))
+ {
+ cell->face(face)->get_dof_indices (face_dof_indices);
+ for (unsigned int i=0; i<dof_handler.get_fe().dofs_per_face; ++i)
+ if (component_select[dof_handler.get_fe().
+ face_system_to_component_index(i).first] == true)
+ selected_dofs[face_dof_indices[i]] = true;
+ };
+};
+
+
+#else
+
+template <>
+void
+DoFTools::extract_boundary_dofs (const DoFHandler<1> &dof_handler,
+ const vector<bool> &component_select,
+ vector<bool> &selected_dofs)
+{
+ Assert (component_select.size() == dof_handler.get_fe().n_components(),
+ ExcWrongSize (component_select.size(),
+ dof_handler.get_fe().n_components()));
+
+ selected_dofs.resize (dof_handler.n_dofs(), false);
+
+ Assert (dof_handler.get_fe().dofs_per_face == dof_handler.get_fe().dofs_per_vertex,
+ ExcInternalError());
+
+ // loop over coarse grid cells
+ for (DoFHandler<1>::cell_iterator cell=dof_handler.begin(0);
+ cell!=dof_handler.end(0); ++cell)
+ {
+ // check left-most vertex
+ if (cell->neighbor(0) == dof_handler.end())
+ for (unsigned int i=0; i<dof_handler.get_fe().dofs_per_face; ++i)
+ if (component_select[dof_handler.get_fe().
+ face_system_to_component_index(i).first] == true)
+ selected_dofs[cell->vertex_dof_index(0,i)] = true;
+ // check right-most vertex
+ if (cell->neighbor(1) == dof_handler.end())
+ for (unsigned int i=0; i<dof_handler.get_fe().dofs_per_face; ++i)
+ if (component_select[dof_handler.get_fe().
+ face_system_to_component_index(i).first] == true)
+ selected_dofs[cell->vertex_dof_index(1,i)] = true;
+ };
+};
+
+
+#endif
+
+
template <int dim>
void
const vector<bool>& local_select,
vector<bool>& selected_dofs);
+#if deal_II_dimension != 1
+template
+void
+DoFTools::extract_boundary_dofs (const DoFHandler<deal_II_dimension> &,
+ const vector<bool> &,
+ vector<bool> &);
+#endif
template
void
estimates the norm of the gradient on each cell from finite
difference approximations.
+ <li> New: <code class="member">DoFTools::extract_boundary_dofs</code>
+ finds all degrees of freedom which are at the boundary and belong to
+ specified components.
+
<li> New: <code class="member">DoFTools::compute_intergrid_constraints</code>
allows to use different discretization grids for different variables.
</ol>