From a54b40a31042f2069c2b15417bd7b5c9a9d673ca Mon Sep 17 00:00:00 2001 From: heister Date: Sun, 2 Jun 2013 21:00:24 +0000 Subject: [PATCH] disallow get_dof_indices() and a few others for nonactive cells git-svn-id: https://svn.dealii.org/trunk@29728 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 7 ++ deal.II/include/deal.II/dofs/dof_accessor.h | 38 ++------- .../deal.II/dofs/dof_accessor.templates.h | 81 ++++--------------- 3 files changed, 31 insertions(+), 95 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index fa981c6d96..f8e3cf0f7d 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -25,6 +25,13 @@ inconvenience this causes.
    +
  1. 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. +
    +(Timo Heister, 2013/06/02) +
  2. 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 diff --git a/deal.II/include/deal.II/dofs/dof_accessor.h b/deal.II/include/deal.II/dofs/dof_accessor.h index fd605cb43c..cd438a8fc6 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.h @@ -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 &dof_indices) const; diff --git a/deal.II/include/deal.II/dofs/dof_accessor.templates.h b/deal.II/include/deal.II/dofs/dof_accessor.templates.h index 3ec680e342..259eccedac 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -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::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::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::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::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::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::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::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::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::get_dof_indices (std::vector &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); -- 2.39.5