From: bangerth Date: Fri, 24 Jan 2014 15:33:23 +0000 (+0000) Subject: Disallow calling DoFAccessor::set_active_fe_index on non-active cells. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bec743c2ab88494f0e1035bf38e8c064c5da47d0;p=dealii-svn.git Disallow calling DoFAccessor::set_active_fe_index on non-active cells. git-svn-id: https://svn.dealii.org/trunk@32297 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index b7c9966883..4a94777bb0 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -84,6 +84,19 @@ inconvenience this causes.

Specific improvements

    +
  1. Changed: It was possible to call DoFAccessor::set_active_fe_index() + on non-active cells. However, this made no sense: Since degrees of + freedoms only exist on active cells + for hp::DoFHandler (i.e., there is currently no implementation + of multilevel hp::DoFHandler objects), it does not make sense + to assign active FE indices to non-active cells since they + do not have finite element spaces associated with them without + having any degrees of freedom. Consequently, this function will + now produce an exception when called on non-active cells. +
    + (Wolfgang Bangerth, 2014/01/24) +
  2. +
  3. Fixed: SparsityPattern::max_entries_per_row() forgot to consider the last row of the matrix and consequently sometimes returned wrong values. This is now fixed. diff --git a/deal.II/include/deal.II/dofs/dof_accessor.h b/deal.II/include/deal.II/dofs/dof_accessor.h index 12c1313156..d5c9cc46ee 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.h @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998 - 2013 by the deal.II authors +// Copyright (C) 1998 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -1665,13 +1665,26 @@ public: get_fe () const; /** - * Returns the index inside the hp::FECollection of the - * FiniteElement used for this cell. + * Returns the index inside the hp::FECollection of the + * FiniteElement used for this cell. This function is + * only useful if the DoF handler object associated with + * the current cell is an hp::DoFHandler. */ unsigned int active_fe_index () const; /** - * Sets the index of the FiniteElement used for this cell. + * Sets the index of the FiniteElement used for this cell. This + * determines which element in an hp::FECollection to use. This function is + * only useful if the DoF handler object associated with + * the current cell is an hp::DoFHandler. + * + * @note Since degrees of freedoms only exist on active cells + * for hp::DoFHandler (i.e., there is currently no implementation + * of multilevel hp::DoFHandler objects), it does not make sense + * to assign active FE indices to non-active cells since they + * do not have finite element spaces associated with them without + * having any degrees of freedom. Consequently, this function will + * produce an exception when called on non-active cells. */ void set_active_fe_index (const unsigned int i); /** 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 2c9af2dcc0..d5a4ea6584 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -3459,6 +3459,10 @@ inline void DoFCellAccessor::set_active_fe_index (const unsigned int i) { + Assert (this->has_children() == false, + ExcMessage ("You can not set the active_fe_index on a cell that has " + "children because no degrees of freedom will be assigned " + "to this cell.")); dealii::internal::DoFCellAccessor::Implementation::set_active_fe_index (*this, i); }