From fb38266de4a602b47a773a8e666e3bbe58db2702 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 28 Mar 2006 23:16:47 +0000 Subject: [PATCH] FiniteElementData::face_to_equivalent_cell_index git-svn-id: https://svn.dealii.org/trunk@12735 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_base.h | 106 +++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) 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 -- 2.39.5