]> https://gitweb.dealii.org/ - dealii.git/commitdiff
disallow get_dof_indices() and a few others for nonactive cells
authorTimo Heister <timo.heister@gmail.com>
Sun, 2 Jun 2013 21:00:24 +0000 (21:00 +0000)
committerTimo Heister <timo.heister@gmail.com>
Sun, 2 Jun 2013 21:00:24 +0000 (21:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@29728 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/dofs/dof_accessor.h
deal.II/include/deal.II/dofs/dof_accessor.templates.h

index fa981c6d967f5f192027aed938a8f1d7693ef07c..f8e3cf0f7d728483159b1adaf9a95ab276195071 100644 (file)
@@ -25,6 +25,13 @@ inconvenience this causes.
 
 <ol>
 
+<li> Removed: it was possible to call get_dof_indices(), get_dof_values(),
+set_dof_values(), and distribute_local_to_global() for cells that were not
+active, if the finite element only had DoFs on vertices (i.e. Q1). This is
+no longer allowed.
+<br>
+(Timo Heister, 2013/06/02)
+
 <li> Changed: Internal structures of ExceptionBase are now thread safe. The
 Assert macro does not print an exception to deallog any more prior to
 throwing if deal_II_exceptions::abort_on_exception==false. Removed: A
index fd605cb43c31012559fa00932153339ebcc440be..cd438a8fc6b5084813e39b71b1d033a8478fa012 100644 (file)
@@ -372,21 +372,12 @@ public:
    * ordering: dofs on vertex 0, dofs on vertex 1, etc, dofs on line
    * 0, dofs on line 1, etc, dofs on quad 0, etc.
    *
+   * The cells needs to be an active cell (and not artificial in a
+   * parallel distributed computation).
+   *
    * The vector has to have the right size before being passed to this
    * function.
    *
-   * @note The behavior descibed below for non-active cells will
-   * be removed in a future release. It is not very intuitive and its
-   * use is limited to FE_Q elements of degree 1.
-   *
-   * This function is most often used on active objects (edges, faces,
-   * cells). It can be used on non-active objects as well
-   * (i.e. objects that have children), but only if the finite element
-   * under consideration has degrees of freedom exclusively on
-   * vertices. Otherwise, the function doesn't make much sense, since
-   * for example inactive edges do not have degrees of freedom
-   * associated with them at all.
-   *
    * The last argument denotes the finite element index. For the
    * standard ::DoFHandler class, this value must be equal to its
    * default value since that class only supports the same finite
@@ -1085,26 +1076,13 @@ public:
    * dofs on line 0, dofs on line 1, etc,
    * dofs on quad 0, etc.
    *
+   * The cells needs to be an active cell (and not artificial in a
+   * parallel distributed computation).
+   *
    * The vector has to have the
    * right size before being passed
    * to this function.
    *
-   * This function is most often
-   * used on active objects (edges,
-   * faces, cells). It can be used
-   * on non-active objects as well
-   * (i.e. objects that have
-   * children), but only if the
-   * finite element under
-   * consideration has degrees of
-   * freedom exclusively on
-   * vertices. Otherwise, the
-   * function doesn't make much
-   * sense, since for example
-   * inactive edges do not have
-   * degrees of freedom associated
-   * with them at all.
-   *
    * The last argument denotes the
    * finite element index. For the
    * standard ::DoFHandler class,
@@ -2107,11 +2085,9 @@ public:
    * function overwrites the one in
    * the base class.
    *
-   * This is a function which requires that the cell be active.
+   * This is a function which requires that the cell is active.
    *
    * Also see get_active_or_mg_dof_indices().
-   *
-   * @deprecated Currently, this function can also be called for non-active cells, if all degrees of freedom of the FiniteElement are located in vertices. This functionality will vanish in a future release.
    */
   void get_dof_indices (std::vector<unsigned int> &dof_indices) const;
 
index 3ec680e3428f700ce7ea05720bae831da65c7e35..259eccedac8eb790e4536c2af563718e4fe0c314 100644 (file)
@@ -2738,14 +2738,8 @@ namespace internal
       {
         AssertDimension (dof_indices.size(), accessor.get_fe().dofs_per_cell);
 
-        // check as in documentation that
-        // cell is either active, or dofs
-        // are only in vertices
-        Assert (!accessor.has_children()
-                ||
-                (accessor.get_fe().dofs_per_cell ==
-                 accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell),
-                ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+        Assert (!accessor.has_children(),
+                ExcMessage ("Cell must be active."));
 
         unsigned int *cache = &accessor.dof_handler->levels[accessor.level()]
                               ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell];
@@ -2800,14 +2794,8 @@ namespace internal
         Assert (values.size() == accessor.get_dof_handler().n_dofs(),
                 typename BaseClass::ExcVectorDoesNotMatch());
 
-        // check as in documentation that
-        // cell is either active, or dofs
-        // are only in vertices
-        Assert (!accessor.has_children()
-                ||
-                (accessor.get_fe().dofs_per_cell ==
-                 accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell),
-                ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+        Assert (!accessor.has_children(),
+                ExcMessage ("Cell must be active."));
 
         unsigned int *cache = &accessor.dof_handler->levels[accessor.level()]
                               ->cell_dof_indices_cache[accessor.present_index *
@@ -2873,14 +2861,8 @@ namespace internal
         Assert (values.size() == accessor.get_dof_handler().n_dofs(),
                 typename BaseClass::ExcVectorDoesNotMatch());
 
-        // check as in documentation that
-        // cell is either active, or dofs
-        // are only in vertices
-        Assert (!accessor.has_children()
-                ||
-                (accessor.get_fe().dofs_per_cell ==
-                 accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell),
-                ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+        Assert (!accessor.has_children(),
+                ExcMessage ("Cell must be active."));
 
         unsigned int *cache = &accessor.dof_handler->levels[accessor.level()]
                               ->cell_dof_indices_cache[accessor.present_index *
@@ -2939,14 +2921,8 @@ namespace internal
         Assert (values.size() == accessor.get_dof_handler().n_dofs(),
                 typename BaseClass::ExcVectorDoesNotMatch());
 
-        // check as in documentation that
-        // cell is either active, or dofs
-        // are only in vertices
-        Assert (!accessor.has_children()
-                ||
-                (accessor.get_fe().dofs_per_cell ==
-                 accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell),
-                ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+        Assert (!accessor.has_children(),
+                ExcMessage ("Cell must be active."));
 
         unsigned int *cache = &accessor.dof_handler->levels[accessor.level()]
                               ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell];
@@ -3073,14 +3049,8 @@ namespace internal
         Assert (accessor.dof_handler->n_dofs() == global_destination.size(),
                 typename BaseClass::ExcVectorDoesNotMatch());
 
-        // check as in documentation that
-        // cell is either active, or dofs
-        // are only in vertices
-        Assert (!accessor.has_children()
-                ||
-                (accessor.get_fe().dofs_per_cell ==
-                 accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell),
-                ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+        Assert (!accessor.has_children(),
+                ExcMessage ("Cell must be active"));
 
         const unsigned int n_dofs = local_source_end - local_source_begin;
 
@@ -3144,14 +3114,8 @@ namespace internal
         Assert (accessor.dof_handler->n_dofs() == global_destination.size(),
                 typename BaseClass::ExcVectorDoesNotMatch());
 
-        // check as in documentation that
-        // cell is either active, or dofs
-        // are only in vertices
-        Assert (!accessor.has_children()
-                ||
-                (accessor.get_fe().dofs_per_cell ==
-                 accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell),
-                ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+        Assert (!accessor.has_children(),
+                ExcMessage ("Cell must be active."));
 
         const unsigned int n_dofs = local_source_end - local_source_begin;
 
@@ -3220,14 +3184,8 @@ namespace internal
         Assert (accessor.dof_handler->n_dofs() == global_destination.n(),
                 typename BaseClass::ExcMatrixDoesNotMatch());
 
-        // check as in documentation that
-        // cell is either active, or dofs
-        // are only in vertices
-        Assert (!accessor.has_children()
-                ||
-                (accessor.get_fe().dofs_per_cell ==
-                 accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell),
-                ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+        Assert (!accessor.has_children(),
+                ExcMessage ("Cell must be active."));
 
         const unsigned int n_dofs = local_source.m();
 
@@ -3305,14 +3263,8 @@ namespace internal
         Assert (accessor.dof_handler->n_dofs() == global_vector.size(),
                 typename BaseClass::ExcVectorDoesNotMatch());
 
-        // check as in documentation that
-        // cell is either active, or dofs
-        // are only in vertices
-        Assert (!accessor.has_children()
-                ||
-                (accessor.get_fe().dofs_per_cell ==
-                 accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell),
-                ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
+        Assert (!accessor.has_children(),
+                ExcMessage ("Cell must be active."));
 
         const unsigned int n_dofs = accessor.get_fe().dofs_per_cell;
         unsigned int *dofs = &accessor.dof_handler->levels[accessor.level()]
@@ -3531,6 +3483,7 @@ inline
 void
 DoFCellAccessor<DH,lda>::get_dof_indices (std::vector<unsigned int> &dof_indices) const
 {
+  Assert (this->active(), ExcMessage ("get_dof_indices() only works on active cells."));
   Assert (this->is_artificial() == false,
           ExcMessage ("Can't ask for DoF indices on artificial cells."));
   AssertDimension (dof_indices.size(), this->get_fe().dofs_per_cell);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.