]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
find out which function is non-zero on a face
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 Dec 2001 07:35:53 +0000 (07:35 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 Dec 2001 07:35:53 +0000 (07:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@5321 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/fe.h
deal.II/deal.II/include/fe/fe_dgq.h
deal.II/deal.II/include/fe/fe_q.h
deal.II/deal.II/include/fe/fe_system.h
deal.II/deal.II/source/fe/fe_dgq.cc
deal.II/deal.II/source/fe/fe_q.cc
deal.II/deal.II/source/fe/fe_system.cc

index 224ad33bc1eb4f1bd052d9e5cfccab20f3833aad..84312afbbb4276f83308fe5f78af6175b29a6b38 100644 (file)
@@ -102,6 +102,18 @@ class FiniteElement : public FiniteElementBase<dim>
                                      */
     virtual const FiniteElement<dim> & base_element (const unsigned int index) const = 0;
 
+                                    /**
+                                     * Check for non-zero values on a face.
+                                     *
+                                     * This function returns
+                                     * @p{true}, if the shape
+                                     * function @p{shape_index} has
+                                     * non-zero values on the face
+                                     * @p{face_index}.
+                                     */
+    virtual bool has_support_on_face (const unsigned int shape_index,
+                                     const unsigned int face_index) const = 0;
+    
                                     /**
                                      * Determine an estimate for the
                                      * memory consumption (in bytes)
index a1643fca7c56953e05093a5d9813e5230c315a86..268fe7bfc483850e0d5f93694c3dafb082b1b904 100644 (file)
@@ -104,6 +104,22 @@ class FE_DGQ : public FiniteElement<dim>
                                      */
     virtual const FiniteElement<dim> & base_element (const unsigned int index) const;
     
+                                    /**
+                                     * Check for non-zero values on a face.
+                                     *
+                                     * This function returns
+                                     * @p{true}, if the shape
+                                     * function @p{shape_index} has
+                                     * non-zero values on the face
+                                     * @p{face_index}.
+                                     *
+                                     * Implementation of the
+                                     * interface in
+                                     * @ref{FiniteElement}
+                                     */
+    virtual bool has_support_on_face (const unsigned int shape_index,
+                                     const unsigned int face_index) const;
+
                                     /**
                                      * Determine an estimate for the
                                      * memory consumption (in bytes)
index 4fddd9ca733921afad84c6d04d49c2aec0347ff4..ad19d21db3672cef4c3d9f6d0c76ab58e715d0fb 100644 (file)
@@ -309,6 +309,22 @@ class FE_Q : public FiniteElement<dim>
                                      */
     virtual const FiniteElement<dim> & base_element (const unsigned int index) const;
     
+                                    /**
+                                     * Check for non-zero values on a face.
+                                     *
+                                     * This function returns
+                                     * @p{true}, if the shape
+                                     * function @p{shape_index} has
+                                     * non-zero values on the face
+                                     * @p{face_index}.
+                                     *
+                                     * Implementation of the
+                                     * interface in
+                                     * @ref{FiniteElement}
+                                     */
+    virtual bool has_support_on_face (const unsigned int shape_index,
+                                     const unsigned int face_index) const;
+
                                     /**
                                      * Determine an estimate for the
                                      * memory consumption (in bytes)
index 36cd73799a068db8dc864ec131db6acb567ca7e7..6f3413f5faca92543f06f9b0df02f7e6e0f635e1 100644 (file)
@@ -217,6 +217,22 @@ class FESystem : public FiniteElement<dim>
                                      */
     virtual const FiniteElement<dim> & base_element (const unsigned int index) const;
     
+                                    /**
+                                     * Check for non-zero values on a face.
+                                     *
+                                     * This function returns
+                                     * @p{true}, if the shape
+                                     * function @p{shape_index} has
+                                     * non-zero values on the face
+                                     * @p{face_index}.
+                                     *
+                                     * Implementation of the
+                                     * interface in
+                                     * @ref{FiniteElement}
+                                     */
+    virtual bool has_support_on_face (const unsigned int shape_index,
+                                     const unsigned int face_index) const;
+
                                     /**
                                      * Determine an estimate for the
                                      * memory consumption (in bytes)
index 77b6340ab73ce3fb8b61d9977796984cb3193345..f27602159a2da41abc2a87e17bcfff5c1ec976ab 100644 (file)
@@ -583,6 +583,86 @@ FE_DGQ<dim>::base_element (const unsigned int index) const
 
 
 
+template <int dim>
+bool
+FE_DGQ<dim>::has_support_on_face (unsigned int shape_index,
+                                 const unsigned int face_index) const
+{
+  if (dim==1)
+    return true;
+  const unsigned int cell_start = (dim==2)
+                                 ? first_quad_index
+                                 : first_hex_index;
+  const unsigned int face_start = (dim==2)
+                                 ? first_line_index
+                                 : first_quad_index;
+  
+                                  // Interior degrees of
+                                  // freedom correspond to
+                                  // shape functions with
+                                  // support inside the cell.
+  if (shape_index >= cell_start)
+    return false;
+                                  // Shape functions are sorted
+                                  // by face. If we dived by
+                                  // the number of shapes per
+                                  // face, the result must be
+                                  // equal to the face index.
+  if (shape_index >= face_start)
+    {
+      shape_index -= first_line_index;
+      shape_index /=  dofs_per_face;
+      return (shape_index == face_index);
+    }
+                                  // Only degrees of freedom on
+                                  // a vertex are left.
+  shape_index /=  dofs_per_vertex;
+                                  // Use a table to figure out
+                                  // which face is neighbor to
+                                  // which vertex.
+  switch (100*dim+10*face_index+shape_index)
+    {
+      case 200:
+      case 230:
+      case 201:
+      case 211:
+      case 212:
+      case 222:
+      case 223:
+      case 233:
+      case 300:
+      case 320:
+      case 350:
+      case 301:
+      case 321:
+      case 331:
+      case 302:
+      case 332:
+      case 342:
+      case 303:
+      case 343:
+      case 353:
+      case 314:
+      case 324:
+      case 354:
+      case 315:
+      case 325:
+      case 335:
+      case 316:
+      case 336:
+      case 346:
+      case 317:
+      case 347:
+      case 357:
+       return true;
+      default:
+       return false;
+    }
+  return true;
+}
+
+
+
 template <int dim>
 unsigned int
 FE_DGQ<dim>::memory_consumption () const
index 8de210c4665bfef7cca9fd51690f73d1ec4e22a6..60b473c4499541a0ab0471adaeb7c39bf7e7f197 100644 (file)
@@ -1210,6 +1210,86 @@ FE_Q<dim>::base_element (const unsigned int index) const
 
 
 
+template <int dim>
+bool
+FE_Q<dim>::has_support_on_face (unsigned int shape_index,
+                                 const unsigned int face_index) const
+{
+  if (dim==1)
+    return true;
+  const unsigned int cell_start = (dim==2)
+                                 ? first_quad_index
+                                 : first_hex_index;
+  const unsigned int face_start = (dim==2)
+                                 ? first_line_index
+                                 : first_quad_index;
+  
+                                  // Interior degrees of
+                                  // freedom correspond to
+                                  // shape functions with
+                                  // support inside the cell.
+  if (shape_index >= cell_start)
+    return false;
+                                  // Shape functions are sorted
+                                  // by face. If we dived by
+                                  // the number of shapes per
+                                  // face, the result must be
+                                  // equal to the face index.
+  if (shape_index >= face_start)
+    {
+      shape_index -= first_line_index;
+      shape_index /=  dofs_per_face;
+      return (shape_index == face_index);
+    }
+                                  // Only degrees of freedom on
+                                  // a vertex are left.
+  shape_index /=  dofs_per_vertex;
+                                  // Use a table to figure out
+                                  // which face is neighbor to
+                                  // which vertex.
+  switch (100*dim+10*face_index+shape_index)
+    {
+      case 200:
+      case 230:
+      case 201:
+      case 211:
+      case 212:
+      case 222:
+      case 223:
+      case 233:
+      case 300:
+      case 320:
+      case 350:
+      case 301:
+      case 321:
+      case 331:
+      case 302:
+      case 332:
+      case 342:
+      case 303:
+      case 343:
+      case 353:
+      case 314:
+      case 324:
+      case 354:
+      case 315:
+      case 325:
+      case 335:
+      case 316:
+      case 336:
+      case 346:
+      case 317:
+      case 347:
+      case 357:
+       return true;
+      default:
+       return false;
+    }
+  return true;
+}
+
+
+
 template <int dim>
 unsigned int
 FE_Q<dim>::memory_consumption () const
index 3e69faa4b7a705ad3c282476582b3d57f4966ef5..82ad6d2a919aed7a2e62f242c7fd3fdac7131d6f 100644 (file)
@@ -1438,6 +1438,20 @@ FESystem<dim>::n_base_elements () const
 };
 
 
+template <int dim>
+bool
+FESystem<dim>::has_support_on_face (const unsigned int shape_index,
+                                   const unsigned int face_index) const
+{
+  const pair<unsigned int, unsigned int> component
+    = system_to_component_index(shape_index);
+  const unsigned int base = component_to_base(component.first);
+  return base_element(base).has_support_on_face(component.second,
+                                               face_index);
+}
+
+
+
 
 template <int dim>
 unsigned int

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.