]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Unify (a bit tediously) two more sets of functions into common templates.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 28 Dec 2008 03:48:24 +0000 (03:48 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 28 Dec 2008 03:48:24 +0000 (03:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@18034 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_accessor.h
deal.II/deal.II/include/grid/tria_accessor.templates.h

index d749a309deac0ec73b6a5b2cd89d4cd9461d9722..df4bd31579e54799dccf6d82f95c388918f52ded 100644 (file)
@@ -1564,6 +1564,28 @@ class TriaAccessor<0, dim, spacedim> : public TriaAccessorBase<0,dim, spacedim>
        Assert (false, ExcInternalError());
       }
 
+                                    /**
+                                     * Constructor. Should never be
+                                     * called and thus produces an
+                                     * error.
+                                     */
+    template <int structdim2, int dim2, int spacedim2>
+    TriaAccessor (const TriaAccessor<structdim2,dim2,spacedim2> &)
+      {
+       Assert (false, ExcInternalError());
+      }
+
+                                    /**
+                                     * Constructor. Should never be
+                                     * called and thus produces an
+                                     * error.
+                                     */
+    template <int structdim2, int dim2, int spacedim2>
+    TriaAccessor (const InvalidAccessor<structdim2,dim2,spacedim2> &)
+      {
+       Assert (false, ExcInternalError());
+      }
+    
                                     /**
                                      * Boundary indicator of this
                                      * object.
index 83b1dd6fc9d0ed7c1c4de87a5f5fe5035f378e8c..e74cc05a7686ae3e1df4498ae5c14814c9c06967 100644 (file)
@@ -1922,98 +1922,54 @@ CellAccessor (const CellAccessor &cell_accessor)
 
 
 
-template <>
-inline
-TriaIterator<TriaAccessor<0, 1, 1> >
-CellAccessor<1,1>::face (const unsigned int) const 
-{
-  Assert (false, ExcImpossibleInDim(1));
-  return TriaIterator<TriaAccessor<0, 1, 1> >();
-}
-
-
-
-template <>
-inline
-TriaIterator<TriaAccessor<0, 1, 2> >
-CellAccessor<1,2>::face (const unsigned int) const 
-{
-  Assert (false, ExcImpossibleInDim(1));
-  return TriaIterator<TriaAccessor<0, 1, 2> >();
-}
-
-
-template <>
-inline
-Triangulation<2,2>::face_iterator
-CellAccessor<2,2>::face (const unsigned int i) const 
-{
-  return this->line(i);
-}
-
-template <>
-inline
-Triangulation<2,3>::face_iterator
-CellAccessor<2,3>::face (const unsigned int i) const 
-{
-  return this->line(i);
-}
-
-
-
-template <>
+template <int dim, int spacedim>
 inline
-Triangulation<3>::face_iterator
-CellAccessor<3,3>::face (const unsigned int i) const 
+TriaIterator<TriaAccessor<dim-1, dim, spacedim> >
+CellAccessor<dim,spacedim>::face (const unsigned int i) const 
 {
-  return this->quad(i);
-}
-
+  switch (dim)
+    {
+      case 1:
+      {
+       Assert (false, ExcImpossibleInDim(1));
+       return TriaIterator<InvalidAccessor<dim-1,dim,spacedim> >();
+      }
 
+      case 2:
+           return this->line(i);
 
-template <>
-inline
-unsigned int
-CellAccessor<1,1>::face_index (const unsigned int) const 
-{
-  Assert (false, ExcImpossibleInDim(1));
-  return numbers::invalid_unsigned_int;
-}
+      case 3:
+           return this->quad(i);
 
-template <>
-inline
-unsigned int
-CellAccessor<1,2>::face_index (const unsigned int) const 
-{
-  Assert (false, ExcImpossibleInDim(1));
-  return numbers::invalid_unsigned_int;
+      default:
+           return TriaIterator<TriaAccessor<dim-1,dim,dim> >();
+    }
 }
 
-template <>
-inline
-unsigned int
-CellAccessor<2,2>::face_index (const unsigned int i) const 
-{
-  return this->line_index(i);
-}
 
 
-template <>
+template <int dim, int spacedim>
 inline
 unsigned int
-CellAccessor<2,3>::face_index (const unsigned int i) const 
+CellAccessor<dim,spacedim>::face_index (const unsigned int i) const 
 {
-  return this->line_index(i);
-}
-
-
+  switch (dim)
+    {
+      case 1:
+      {
+       Assert (false, ExcImpossibleInDim(1));
+       return numbers::invalid_unsigned_int;
+      }
 
-template <>
-inline
-unsigned int
-CellAccessor<3,3>::face_index (const unsigned int i) const 
-{
-  return this->quad_index(i);
+      case 2:
+           return this->line_index(i);
+           
+      case 3:
+           return this->quad_index(i);
+           
+      default:
+           return numbers::invalid_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.