From: Wolfgang Bangerth Date: Tue, 28 Mar 2006 23:16:47 +0000 (+0000) Subject: FiniteElementData::face_to_equivalent_cell_index X-Git-Tag: v8.0.0~11977 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb38266de4a602b47a773a8e666e3bbe58db2702;p=dealii.git FiniteElementData::face_to_equivalent_cell_index git-svn-id: https://svn.dealii.org/trunk@12735 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/fe/fe_base.h b/deal.II/deal.II/include/fe/fe_base.h index 7413193744..421d62bca7 100644 --- a/deal.II/deal.II/include/fe/fe_base.h +++ b/deal.II/deal.II/include/fe/fe_base.h @@ -394,6 +394,37 @@ class FiniteElementData * for. */ bool conforms (const Conformity) const; + + /** + * Given an index in the natural + * ordering of indices on a face, + * return the index of an + * equivalent 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 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 (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_vertex)); + 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_vertex)); + return (index < (GeometryInfo<2>::vertices_per_face * + this->dofs_per_vertex) + ? + index + : + GeometryInfo<2>::vertices_per_cell * + this->dofs_per_vertex + + (index - + GeometryInfo<2>::vertices_per_face * + this->dofs_per_vertex)); +} + + + + +template <> +inline +unsigned int +FiniteElementData<3>:: +face_to_equivalent_cell_index (const unsigned int index) const +{ + Assert (index < dofs_per_face, + ExcIndexRange (index, 0, dofs_per_vertex)); + return (index < (GeometryInfo<3>::vertices_per_face * + this->dofs_per_vertex) + ? + index + : + (index < (GeometryInfo<3>::vertices_per_face * + this->dofs_per_vertex + + + GeometryInfo<3>::lines_per_face * + this->dofs_per_line) + ? + GeometryInfo<3>::vertices_per_cell * + this->dofs_per_vertex + + (index - + GeometryInfo<3>::vertices_per_face * + this->dofs_per_vertex) + : + GeometryInfo<3>::vertices_per_cell * + this->dofs_per_vertex + + GeometryInfo<3>::lines_per_cell * + this->dofs_per_line + + (index - + GeometryInfo<3>::vertices_per_face * + this->dofs_per_vertex + - + GeometryInfo<3>::lines_per_face * + this->dofs_per_line))); +} + + + #endif