From: Wolfgang Bangerth Date: Fri, 9 Aug 2013 22:37:31 +0000 (+0000) Subject: Move FiniteElementData::face_to_cell_index to FiniteElement. The function needs to... X-Git-Tag: v8.1.0~1103 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73e27d0d14b50949c70dde5dbea70484a7d71071;p=dealii.git Move FiniteElementData::face_to_cell_index to FiniteElement. The function needs to be virtual, following my changes yesterday, and it would be the only virtual function of this base class. Thus, it doesn't fit into the "data" part of this class if its implementation can be and will be overloaded. Also remove FiniteElementData::face_to_equivalent_cell_index: this function had been deprecated a while back already. git-svn-id: https://svn.dealii.org/trunk@30271 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index c1c4818f43..ad91e1e985 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -23,7 +23,11 @@ modifications to application programs. We apologize for the inconvenience this causes.

-
    +
      Removed: The member function face_to_equivalent_cell_index() in +FiniteElementData has been removed. It had been deprecated a while +back already. Please use FiniteElement::face_to_cell_index() instead. +
      +(Wolfgang Bangerth, 2013/08/09)
    diff --git a/deal.II/include/deal.II/fe/fe.h b/deal.II/include/deal.II/fe/fe.h index 8d52d8c943..31fb8c8cb7 100644 --- a/deal.II/include/deal.II/fe/fe.h +++ b/deal.II/include/deal.II/fe/fe.h @@ -924,6 +924,65 @@ public: std::pair face_system_to_component_index (const unsigned int index) const; + /** + * Given an index in the natural ordering of indices on a face, return the + * index of the same degree of freedom on the cell. + * + * To explain the concept, consider the case where we would like to know + * whether a degree of freedom on a face, for example as part of an FESystem + * element, is primitive. Unfortunately, the + * is_primitive() function in the FiniteElement class takes a cell index, so + * we would need to find the cell index of the shape function that + * corresponds to the present face index. This function does that. + * + * Code implementing this would then look like this: + * @code + * for (i=0; i::conforms (const Conformity space) const } - -template <> -inline -unsigned int -FiniteElementData<1>:: -face_to_equivalent_cell_index (const unsigned int index) const -{ - Assert (index < dofs_per_face, - ExcIndexRange (index, 0, dofs_per_face)); - return index; -} - - - -template <> -inline -unsigned int -FiniteElementData<2>:: -face_to_equivalent_cell_index (const unsigned int index) const -{ - Assert (index < dofs_per_face, - ExcIndexRange (index, 0, dofs_per_face)); - - // on face 0, the vertices are 0 and 2 - if (index < this->dofs_per_vertex) - return index; - else if (index < 2*this->dofs_per_vertex) - return index + this->dofs_per_vertex; - else - // this is a dof on line 0, so on the cell there are now 4 vertices - // instead of only 2 ahead of this one - return index + 2*this->dofs_per_vertex; -} - - - - -template <> -inline -unsigned int -FiniteElementData<3>:: -face_to_equivalent_cell_index (const unsigned int index) const -{ - // this case is just way too complicated. fall back to face_to_cell_index - return face_to_cell_index(index, 0, true); -} - #endif // DOXYGEN diff --git a/deal.II/source/fe/fe.cc b/deal.II/source/fe/fe.cc index cdb97b5104..f5332eb778 100644 --- a/deal.II/source/fe/fe.cc +++ b/deal.II/source/fe/fe.cc @@ -544,6 +544,68 @@ block_mask (const ComponentMask &component_mask) const +template +unsigned int +FiniteElement:: +face_to_cell_index (const unsigned int face_index, + const unsigned int face, + const bool face_orientation, + const bool face_flip, + const bool face_rotation) const +{ + Assert (face_index < this->dofs_per_face, + ExcIndexRange(face_index, 0, this->dofs_per_face)); + Assert (face < GeometryInfo::faces_per_cell, + ExcIndexRange(face, 0, GeometryInfo::faces_per_cell)); + + // see the function's documentation for an explanation of this + // assertion -- in essence, derived classes have to implement + // an overloaded version of this function if we are to use any + // other than standard orientation + if ((face_orientation != true) || (face_flip != false) || (face_rotation != false)) + Assert ((this->dofs_per_line <= 1) && (this->dofs_per_quad <= 1), + ExcMessage ("The function in this base class can not handle this case. " + "Rather, the derived class you are using must provide " + "an overloaded version but apparently hasn't done so. See " + "the documentation of this function for more information.")); + + // DoF on a vertex + if (face_index < this->first_face_line_index) + { + // Vertex number on the face + const unsigned int face_vertex = face_index / this->dofs_per_vertex; + return face_index % this->dofs_per_vertex + + GeometryInfo::face_to_cell_vertices(face, face_vertex, + face_orientation, + face_flip, + face_rotation) + * this->dofs_per_vertex; + } + // Else, DoF on a line? + if (face_index < this->first_face_quad_index) + { + // Ignore vertex dofs + const unsigned int index = face_index - this->first_face_line_index; + // Line number on the face + const unsigned int face_line = index / this->dofs_per_line; + return this->first_line_index + index % this->dofs_per_line + + GeometryInfo::face_to_cell_lines(face, face_line, + face_orientation, + face_flip, + face_rotation) + * this->dofs_per_line; + } + // Else, DoF is on a quad + + // Ignore vertex and line dofs + const unsigned int index = face_index - this->first_face_quad_index; + return this->first_quad_index + index + + face * this->dofs_per_quad; +} + + + + template unsigned int FiniteElement::adjust_quad_dof_index_for_face_orientation (const unsigned int index, diff --git a/deal.II/source/fe/fe_data.cc b/deal.II/source/fe/fe_data.cc index 3fec91c5a9..894e3c3f18 100644 --- a/deal.II/source/fe/fe_data.cc +++ b/deal.II/source/fe/fe_data.cc @@ -99,65 +99,6 @@ bool FiniteElementData::operator== (const FiniteElementData &f) const (conforming_space == f.conforming_space)); } -template -unsigned int -FiniteElementData:: -face_to_cell_index (const unsigned int face_index, - const unsigned int face, - const bool face_orientation, - const bool face_flip, - const bool face_rotation) const -{ - Assert (face_index < this->dofs_per_face, - ExcIndexRange(face_index, 0, this->dofs_per_face)); - Assert (face < GeometryInfo::faces_per_cell, - ExcIndexRange(face, 0, GeometryInfo::faces_per_cell)); - - // see the function's documentation for an explanation of this - // assertion -- in essence, derived classes have to implement - // an overloaded version of this function if we are to use any - // other than standard orientation - if ((face_orientation != true) || (face_flip != false) || (face_rotation != false)) - Assert ((this->dofs_per_line <= 1) && (this->dofs_per_quad <= 1), - ExcMessage ("The function in this base class can not handle this case. " - "Rather, the derived class you are using must provide " - "an overloaded version but apparently hasn't done so. See " - "the documentation of this function for more information.")); - - // DoF on a vertex - if (face_index < this->first_face_line_index) - { - // Vertex number on the face - const unsigned int face_vertex = face_index / this->dofs_per_vertex; - return face_index % this->dofs_per_vertex - + GeometryInfo::face_to_cell_vertices(face, face_vertex, - face_orientation, - face_flip, - face_rotation) - * this->dofs_per_vertex; - } - // Else, DoF on a line? - if (face_index < this->first_face_quad_index) - { - // Ignore vertex dofs - const unsigned int index = face_index - this->first_face_line_index; - // Line number on the face - const unsigned int face_line = index / this->dofs_per_line; - return this->first_line_index + index % this->dofs_per_line - + GeometryInfo::face_to_cell_lines(face, face_line, - face_orientation, - face_flip, - face_rotation) - * this->dofs_per_line; - } - // Else, DoF is on a quad - - // Ignore vertex and line dofs - const unsigned int index = face_index - this->first_face_quad_index; - return this->first_quad_index + index - + face * this->dofs_per_quad; -} - template class FiniteElementData<1>; template class FiniteElementData<2>;