]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix a stupid problem that prevented compilation and that was introduced in my last...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 28 Apr 2006 19:08:54 +0000 (19:08 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 28 Apr 2006 19:08:54 +0000 (19:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@12936 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_accessor.templates.h
deal.II/deal.II/include/dofs/hp_dof_handler.h
deal.II/deal.II/include/dofs/hp_dof_levels.h
deal.II/deal.II/source/dofs/hp_dof_levels.cc

index df56233c56a78feab7408836e0c369328825d09e..6bcd68b5fc2b9a1f1f0adb5047ab016465e0ba4c 100644 (file)
@@ -965,24 +965,10 @@ DoFObjectAccessor<1,hp::DoFHandler<1> >::vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int fe_index) const
 {
-  Assert (fe_index != hp::DoFHandler<1>::default_fe_index,
-         ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
-  Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
-          ExcMessage ("hp::DoFHandler not initialized"));
-
-  Assert (this->dof_handler != 0, DoFAccessor<hp::DoFHandler<1> >::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<hp::DoFHandler<1> >::ExcInvalidObject());
-  Assert (vertex<2, ExcIndexRange (i,0,2));
-  Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
-         ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
-
-  const unsigned int starting_offset
-    = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
-  
   return internal::hp::DoFLevel<0>::
-    get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+    get_hp_vertex_dof_index (*this->dof_handler,
+                             this->vertex_index(vertex),
                              fe_index,
-                             &this->dof_handler->vertex_dofs[starting_offset],
                              i);
 }
 
@@ -995,24 +981,10 @@ DoFObjectAccessor<1,hp::DoFHandler<2> >::vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int fe_index) const
 {
-  Assert (fe_index != hp::DoFHandler<2>::default_fe_index,
-         ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
-  Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
-          ExcMessage ("hp::DoFHandler not initialized"));
-
-  Assert (this->dof_handler != 0, DoFAccessor<hp::DoFHandler<2> >::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<hp::DoFHandler<2> >::ExcInvalidObject());
-  Assert (vertex<2, ExcIndexRange (i,0,2));
-  Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
-         ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
-
-  const unsigned int starting_offset
-    = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
-  
   return internal::hp::DoFLevel<0>::
-    get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+    get_hp_vertex_dof_index (*this->dof_handler,
+                             this->vertex_index(vertex),
                              fe_index,
-                             &this->dof_handler->vertex_dofs[starting_offset],
                              i);
 }
 
@@ -1024,24 +996,10 @@ DoFObjectAccessor<1,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int fe_index) const
 {
-  Assert (fe_index != hp::DoFHandler<3>::default_fe_index,
-         ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
-  Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
-          ExcMessage ("hp::DoFHandler not initialized"));
-
-  Assert (this->dof_handler != 0, DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
-  Assert (vertex<2, ExcIndexRange (i,0,2));
-  Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
-         ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
-
-  const unsigned int starting_offset
-    = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
-  
   return internal::hp::DoFLevel<0>::
-    get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+    get_hp_vertex_dof_index (*this->dof_handler,
+                             this->vertex_index(vertex),
                              fe_index,
-                             &this->dof_handler->vertex_dofs[starting_offset],
                              i);
 }
 
@@ -1053,25 +1011,10 @@ DoFObjectAccessor<2,hp::DoFHandler<2> >::vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int fe_index) const
 {
-  Assert (fe_index != hp::DoFHandler<2>::default_fe_index,
-         ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
-  Assert (this->dof_handler != 0,
-         DoFAccessor<hp::DoFHandler<2> >::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0,
-         DoFAccessor<hp::DoFHandler<2> >::ExcInvalidObject());
-  Assert (vertex<4, ExcIndexRange (i,0,4));
-  Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
-         ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
-  Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
-          ExcMessage ("hp::DoFHandler not initialized"));
-
-  const unsigned int starting_offset
-    = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
-  
   return internal::hp::DoFLevel<0>::
-    get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+    get_hp_vertex_dof_index (*this->dof_handler,
+                             this->vertex_index(vertex),
                              fe_index,
-                             &this->dof_handler->vertex_dofs[starting_offset],
                              i);
 }
 
@@ -1084,25 +1027,10 @@ DoFObjectAccessor<2,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int fe_index) const
 {
-  Assert (fe_index != hp::DoFHandler<3>::default_fe_index,
-         ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
-  Assert (this->dof_handler != 0,
-         DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0,
-         DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
-  Assert (vertex<4, ExcIndexRange (i,0,4));
-  Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
-         ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
-  Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
-          ExcMessage ("hp::DoFHandler not initialized"));
-
-  const unsigned int starting_offset
-    = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
-  
   return internal::hp::DoFLevel<0>::
-    get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+    get_hp_vertex_dof_index (*this->dof_handler,
+                             this->vertex_index(vertex),
                              fe_index,
-                             &this->dof_handler->vertex_dofs[starting_offset],
                              i);
 }
 
@@ -1115,25 +1043,10 @@ DoFObjectAccessor<3,hp::DoFHandler<3> >::vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int fe_index) const
 {
-  Assert (fe_index != hp::DoFHandler<3>::default_fe_index,
-         ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
-  Assert (this->dof_handler != 0,
-         DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0,
-         DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
-  Assert (vertex<4, ExcIndexRange (i,0,4));
-  Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
-         ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
-  Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
-          ExcMessage ("hp::DoFHandler not initialized"));
-
-  const unsigned int starting_offset
-    = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
-  
   return internal::hp::DoFLevel<0>::
-    get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+    get_hp_vertex_dof_index (*this->dof_handler,
+                             this->vertex_index(vertex),
                              fe_index,
-                             &this->dof_handler->vertex_dofs[starting_offset],
                              i);
 }
 
index c9facc4c5127f146e8eb2bf47331acaa3c6ccc3d..19c42f9e83ae393c4647250260b12bff5b36c79d 100644 (file)
@@ -32,6 +32,10 @@ namespace internal
   namespace hp
   {
     template <int> class DoFLevel;
+    template <> class DoFLevel<0>;
+    template <> class DoFLevel<1>;
+    template <> class DoFLevel<2>;
+    template <> class DoFLevel<3>;
   }
 }
 
@@ -1071,6 +1075,15 @@ namespace hp
                                         * Make accessor objects friends.
                                         */
       template <class DH> friend class ::DoFCellAccessor;
+
+                                       /**
+                                        * Likewise for DoFLevel<0>
+                                        * objects since they need to
+                                        * access the vertex dofs in
+                                        * the functions that set and
+                                        * retrieve vertex dof indices.
+                                        */
+      template <int> friend class internal::hp::DoFLevel;
   };
 
 
index fdc3da243ba62f8b3bdf2d880639274f8d25caa4..db47306c485d577f5ad3d2e22169aa11ca14e7dd 100644 (file)
@@ -88,20 +88,20 @@ namespace internal
 
         template <int dim>
         static
-        unsigned int
-        get_hp_vertex_dof_index (const ::hp::FECollection<dim> &fe,
+        void
+        set_hp_vertex_dof_index (::hp::DoFHandler<dim> &dof_handler,
+                                 const unsigned int           vertex_index,
                                  const unsigned int           fe_index,
-                                 const unsigned int          *start_of_list,
-                                 const unsigned int           local_index);
+                                 const unsigned int           local_index,
+                                 const unsigned int           global_index);
 
         template <int dim>
         static
-        void
-        set_hp_vertex_dof_index (const ::hp::FECollection<dim> &fe,
+        unsigned int
+        get_hp_vertex_dof_index (const ::hp::DoFHandler<dim> &dof_handler,
+                                 const unsigned int           vertex_index,
                                  const unsigned int           fe_index,
-                                 const unsigned int          *start_of_list,
-                                 const unsigned int           local_index,
-                                 const unsigned int           global_index);
+                                 const unsigned int           local_index);
     };
 
 
index e6b32b4ef6371efb01b4e7b75dbeb4a6f0ee5ba8..c47a5dd720ef726c6fdcb76e70d553addc4f8f4e 100644 (file)
@@ -14,6 +14,8 @@
 
 #include <base/memory_consumption.h>
 #include <dofs/hp_dof_levels.h>
+#include <dofs/hp_dof_handler.h>
+#include <fe/fe_collection.h>
 
 
 namespace internal
@@ -47,33 +49,29 @@ namespace internal
               MemoryConsumption::memory_consumption (dof_hex_index_offset));
     }
 
-    template <int dim>
-    void
-    DoFLevel<0>::
-    set_hp_vertex_dof_index (const ::hp::FECollection<dim> &fe,
-                             const unsigned int           fe_index,
-                             const unsigned int          *start_of_list,
-                             const unsigned int           local_index,
-                             const unsigned int           global_index)
-    {
-      Assert (fe_index != hp::DoFHandler<dim>::default_fe_index,
-              ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
-      abort ();
-    }
 
 
+    
     template <int dim>
     unsigned int
     DoFLevel<0>::
-    get_hp_vertex_dof_index (const ::hp::FECollection<dim> &fe,
+    get_hp_vertex_dof_index (const ::hp::DoFHandler<dim> &dof_handler,
+                             const unsigned int           vertex_index,
                              const unsigned int           fe_index,
-                             const unsigned int          *start_of_list,
                              const unsigned int           local_index)
     {
-      Assert (fe_index != hp::DoFHandler<dim>::default_fe_index,
-              ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
-      Assert (local_index < fe[fe_index].dofs_per_vertex,
-              ExcIndexRange(local_index, 0, fe[fe_index].dofs_per_vertex));
+      Assert (fe_index != ::hp::DoFHandler<dim>::default_fe_index,
+              ExcMessage ("You need to specify a FE index when working "
+                          "with hp DoFHandlers"));
+      Assert (&dof_handler != 0,
+              ExcMessage ("No DoFHandler is specified for this iterator"));
+      Assert (&dof_handler.get_fe() != 0,
+              ExcMessage ("No finite element collection is associated with "
+                          "this DoFHandler"));
+      Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_vertex,
+              ExcIndexRange(local_index, 0,
+                            dof_handler.get_fe()[fe_index].dofs_per_vertex));
+
                                        // hop along the list of index
                                        // sets until we find the one
                                        // with the correct fe_index, and
@@ -81,7 +79,10 @@ namespace internal
                                        // part. trigger an exception if
                                        // we can't find a set for this
                                        // particular fe_index
-      const unsigned int *pointer = start_of_list;
+      const unsigned int starting_offset
+        = dof_handler.vertex_dofs_offsets[vertex_index];
+      const unsigned int *pointer
+        = &dof_handler.vertex_dofs[starting_offset];
       while (true)
         {
           Assert (*pointer != deal_II_numbers::invalid_unsigned_int,
@@ -89,27 +90,76 @@ namespace internal
           if (*pointer == fe_index)
             return *(pointer + 1 + local_index);
           else
-            pointer += fe[*pointer].dofs_per_vertex;
+            pointer += dof_handler.get_fe()[*pointer].dofs_per_vertex;
         }
     }  
 
 
-// explicit instantiations
-    template
+
+    template <int dim>
     void
     DoFLevel<0>::
-    set_hp_vertex_dof_index (const ::hp::FECollection<deal_II_dimension> &fe,
+    set_hp_vertex_dof_index (::hp::DoFHandler<dim> &dof_handler,
+                             const unsigned int           vertex_index,
                              const unsigned int           fe_index,
-                             const unsigned int          *start_of_list,
                              const unsigned int           local_index,
-                             const unsigned int           global_index);
+                             const unsigned int           global_index)
+    {
+      Assert (fe_index != ::hp::DoFHandler<dim>::default_fe_index,
+              ExcMessage ("You need to specify a FE index when working "
+                          "with hp DoFHandlers"));
+      Assert (&dof_handler != 0,
+              ExcMessage ("No DoFHandler is specified for this iterator"));
+      Assert (&dof_handler.get_fe() != 0,
+              ExcMessage ("No finite element collection is associated with "
+                          "this DoFHandler"));
+      Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_vertex,
+              ExcIndexRange(local_index, 0,
+                            dof_handler.get_fe()[fe_index].dofs_per_vertex));
+
+                                       // hop along the list of index
+                                       // sets until we find the one
+                                       // with the correct fe_index, and
+                                       // then poke into that
+                                       // part. trigger an exception if
+                                       // we can't find a set for this
+                                       // particular fe_index
+      const unsigned int starting_offset
+        = dof_handler.vertex_dofs_offsets[vertex_index];
+      unsigned int *pointer
+        = &dof_handler.vertex_dofs[starting_offset];
+      while (true)
+        {
+          Assert (*pointer != deal_II_numbers::invalid_unsigned_int,
+                  ExcInternalError());
+          if (*pointer == fe_index)
+            {
+              *(pointer + 1 + local_index) = global_index;
+              return;
+            }
+          else
+            pointer += dof_handler.get_fe()[*pointer].dofs_per_vertex;
+        }
+    }  
+
     
+
+// explicit instantiations
     template
     unsigned int
     DoFLevel<0>::
-    get_hp_vertex_dof_index (const ::hp::FECollection<deal_II_dimension> &fe,
+    get_hp_vertex_dof_index (const ::hp::DoFHandler<deal_II_dimension> &dof_handler,
+                             const unsigned int           vertex_index,
                              const unsigned int           fe_index,
-                             const unsigned int          *start_of_list,
                              const unsigned int           local_index);
+    
+    template
+    void
+    DoFLevel<0>::
+    set_hp_vertex_dof_index (::hp::DoFHandler<deal_II_dimension> &dof_handler,
+                             const unsigned int           vertex_index,
+                             const unsigned int           fe_index,
+                             const unsigned int           local_index,
+                             const unsigned int           global_index);
   }
 }

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.