]> https://gitweb.dealii.org/ - dealii.git/commitdiff
FiniteElementData<dim>::face_to_equivalent_cell_index
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 28 Mar 2006 23:16:47 +0000 (23:16 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 28 Mar 2006 23:16:47 +0000 (23:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@12735 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/fe_base.h

index 741319374469d912a9d2f36353c6b5f49058bc92..421d62bca7f91dd889403d435eeac6ee5c910823 100644 (file)
@@ -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<dofs_per_face; ++i)
+                                     *  if (fe.is_primitive(fe.face_to_equivalent_cell_index(i)))
+                                     *   ... do whatever
+                                     * @endcode
+                                     */
+    unsigned int face_to_equivalent_cell_index (const unsigned int index) const;
     
                                     /**
                                      * Comparison operator.
@@ -497,5 +528,80 @@ FiniteElementData<dim>::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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.