]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Specialize FE_Q_Hierarchical::has_support_on_face for 1d to avoid annoying compiler...
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Aug 2005 13:07:15 +0000 (13:07 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Aug 2005 13:07:15 +0000 (13:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@11257 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/fe/fe_q_hierarchical.cc

index 3068b5c4aad58a0961cd8a16362cb10fb5bedbdb..0c0a459d90c012f1dbdcb79f63339c73f0fd8881 100644 (file)
@@ -766,19 +766,16 @@ FE_Q_Hierarchical<1>::face_fe_q_hierarchical_to_hierarchic_numbering (const unsi
   return std::vector<unsigned int> ();
 }
 
-#endif
-
-
 
-template <int dim>
+template <>
 bool
-FE_Q_Hierarchical<dim>::has_support_on_face (const unsigned int shape_index,
-                                            const unsigned int face_index) const
+FE_Q_Hierarchical<1>::has_support_on_face (const unsigned int shape_index,
+                                          const unsigned int face_index) const
 {
   Assert (shape_index < this->dofs_per_cell,
          ExcIndexRange (shape_index, 0, this->dofs_per_cell));
-  Assert (face_index < GeometryInfo<dim>::faces_per_cell,
-         ExcIndexRange (face_index, 0, GeometryInfo<dim>::faces_per_cell));
+  Assert (face_index < GeometryInfo<1>::faces_per_cell,
+         ExcIndexRange (face_index, 0, GeometryInfo<1>::faces_per_cell));
 
 
                                   // in 1d, things are simple. since
@@ -787,89 +784,97 @@ FE_Q_Hierarchical<dim>::has_support_on_face (const unsigned int shape_index,
                                   // class, the first is on vertex 0
                                   // (==face 0 in some sense), the
                                   // second on face 1:
-  if (dim==1)
-    return (((shape_index == 0) && (face_index == 0)) ||
-           ((shape_index == 1) && (face_index == 1)));
-  else
-                                    // more dimensions
+  return (((shape_index == 0) && (face_index == 0)) ||
+         ((shape_index == 1) && (face_index == 1)));
+}
+
+#endif
+
+
+template <int dim>
+bool
+FE_Q_Hierarchical<dim>::has_support_on_face (const unsigned int shape_index,
+                                            const unsigned int face_index) const
+{
+  Assert (shape_index < this->dofs_per_cell,
+         ExcIndexRange (shape_index, 0, this->dofs_per_cell));
+  Assert (face_index < GeometryInfo<dim>::faces_per_cell,
+         ExcIndexRange (face_index, 0, GeometryInfo<dim>::faces_per_cell));
+
+                                  // first, special-case interior
+                                  // shape functions, since they
+                                  // have no support no-where on
+                                  // the boundary
+  if (((dim==2) && (shape_index>=this->first_quad_index))
+      ||
+      ((dim==3) && (shape_index>=this->first_hex_index)))
+    return false;
+  
+                                  // let's see whether this is a
+                                  // vertex
+  if (shape_index < this->first_line_index) 
     {
-                                       // first, special-case interior
-                                       // shape functions, since they
-                                       // have no support no-where on
-                                       // the boundary
-      if (((dim==2) && (shape_index>=this->first_quad_index))
-          ||
-          ((dim==3) && (shape_index>=this->first_hex_index)))
-        return false;
-                                       
-                                       // let's see whether this is a
-                                       // vertex
-      if (shape_index < this->first_line_index) 
-        {
-                                           // for Q elements, there is
-                                           // one dof per vertex, so
-                                           // shape_index==vertex_number. check
-                                           // whether this vertex is
-                                           // on the given face
-          const unsigned int vertex_no = shape_index;
-          Assert (vertex_no < GeometryInfo<dim>::vertices_per_cell,
-                  ExcInternalError());
-         for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_face; ++i)
-           if (GeometryInfo<dim>::face_to_cell_vertices(face_index,i) == vertex_no)
-             return true;
-         return false;
-        }
-      else if (shape_index < this->first_quad_index)
-                                         // ok, dof is on a line
-        {
-          const unsigned int line_index
-            = (shape_index - this->first_line_index) / this->dofs_per_line;
-          Assert (line_index < GeometryInfo<dim>::lines_per_cell,
-                  ExcInternalError());
-
-         for (unsigned int i=0; i<GeometryInfo<dim>::lines_per_face; ++i)
-           if (GeometryInfo<dim>::face_to_cell_lines(face_index,i) == line_index)
-             return true;
-         return false;
-        }
-      else if (shape_index < this->first_hex_index)
-                                         // dof is on a quad
-        {
-          const unsigned int quad_index 
-            = (shape_index - this->first_quad_index) / this->dofs_per_quad;
-          Assert (static_cast<signed int>(quad_index) <
-                  static_cast<signed int>(GeometryInfo<dim>::quads_per_cell),
-                  ExcInternalError());
-          
-                                           // in 2d, cell bubble are
-                                           // zero on all faces. but
-                                           // we have treated this
-                                           // case above already
-          Assert (dim != 2, ExcInternalError());
-
-                                           // in 3d,
-                                           // quad_index=face_index
-          if (dim == 3)
-            return (quad_index == face_index);
-          else
-            Assert (false, ExcNotImplemented());
-        }
+                                      // for Q elements, there is one
+                                      // dof per vertex, so
+                                      // shape_index==vertex_number. check
+                                      // whether this vertex is on
+                                      // the given face
+      const unsigned int vertex_no = shape_index;
+      Assert (vertex_no < GeometryInfo<dim>::vertices_per_cell,
+             ExcInternalError());
+      for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_face; ++i)
+       if (GeometryInfo<dim>::face_to_cell_vertices(face_index,i) == vertex_no)
+         return true;
+      return false;
+    }
+  else if (shape_index < this->first_quad_index)
+                                    // ok, dof is on a line
+    {
+      const unsigned int line_index
+       = (shape_index - this->first_line_index) / this->dofs_per_line;
+      Assert (line_index < GeometryInfo<dim>::lines_per_cell,
+             ExcInternalError());
+      
+      for (unsigned int i=0; i<GeometryInfo<dim>::lines_per_face; ++i)
+       if (GeometryInfo<dim>::face_to_cell_lines(face_index,i) == line_index)
+         return true;
+      return false;
+    }
+  else if (shape_index < this->first_hex_index)
+                                    // dof is on a quad
+    {
+      const unsigned int quad_index 
+       = (shape_index - this->first_quad_index) / this->dofs_per_quad;
+      Assert (static_cast<signed int>(quad_index) <
+             static_cast<signed int>(GeometryInfo<dim>::quads_per_cell),
+             ExcInternalError());
+      
+                                      // in 2d, cell bubble are zero
+                                      // on all faces. but we have
+                                      // treated this case above
+                                      // already
+      Assert (dim != 2, ExcInternalError());
+      
+                                      // in 3d,
+                                      // quad_index=face_index
+      if (dim == 3)
+       return (quad_index == face_index);
       else
-                                         // dof on hex
-        {
-                                           // can only happen in 3d,
-                                           // but this case has
-                                           // already been covered
-                                           // above
-          Assert (false, ExcNotImplemented());
-          return false;
-        };
-    };
+            Assert (false, ExcNotImplemented());
+    }
+  else
+                                    // dof on hex
+    {
+                                      // can only happen in 3d, but
+                                      // this case has already been
+                                      // covered above
+      Assert (false, ExcNotImplemented());
+      return false;
+    }
 
                                    // we should not have gotten here
   Assert (false, ExcInternalError());
   return false;
-
 }
 
 

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.