]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Also move the functions that deal with vertex dofs to the accessor implementation...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 10 Dec 2008 17:36:06 +0000 (17:36 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 10 Dec 2008 17:36:06 +0000 (17:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@17907 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_accessor.templates.h
deal.II/deal.II/include/dofs/dof_handler.h
deal.II/deal.II/include/hp/dof_handler.h
deal.II/deal.II/source/hp/dof_handler.cc

index f6d41b6fd67397fc083b20a009fdc0e1641832ef..dd6b9458145b118eb577a5d8539fc3b9907c7f1d 100644 (file)
@@ -172,36 +172,6 @@ DoFAccessor<structdim,DH>::child (const unsigned int i) const
 
 
 
-template <int structdim, class DH>
-inline
-unsigned int
-DoFAccessor<structdim, DH>::vertex_dof_index (const unsigned int vertex,
-                                             const unsigned int i,
-                                             const unsigned int fe_index) const
-{
-  return this->dof_handler->get_vertex_dof_index (this->vertex_index(vertex),
-                                                 fe_index,
-                                                 i);
-}
-
-
-
-template <int structdim, class DH>
-inline
-void
-DoFAccessor<structdim, DH>::set_vertex_dof_index (const unsigned int vertex,
-                                                 const unsigned int i,
-                                                 const unsigned int index,
-                                                 const unsigned int fe_index) const
-{
-  this->dof_handler->set_vertex_dof_index (this->vertex_index(vertex),
-                                          fe_index,
-                                          i,
-                                          index);
-}
-
-
-
 namespace internal
 {
   namespace DoFAccessor
@@ -1089,6 +1059,344 @@ namespace internal
                                                                             obj_index,
                                                                             n);
          }
+
+                                        /**
+                                         * Set the @p local_index-th
+                                         * degree of freedom
+                                         * corresponding to the finite
+                                         * element specified by @p
+                                         * fe_index on the vertex with
+                                         * global number @p
+                                         * vertex_index to @p
+                                         * global_index.
+                                         */
+       template <int dim, int spacedim>
+       static
+       void
+       set_vertex_dof_index (dealii::DoFHandler<dim,spacedim> &dof_handler,
+                             const unsigned int vertex_index,
+                             const unsigned int fe_index,
+                             const unsigned int local_index,
+                             const unsigned int global_index)
+         {
+           Assert ((fe_index == dealii::DoFHandler<dim,spacedim>::default_fe_index),
+                   ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects"));
+           Assert (dof_handler.selected_fe != 0,
+                   ExcMessage ("No finite element collection is associated with "
+                               "this DoFHandler"));
+           Assert (local_index < dof_handler.selected_fe->dofs_per_vertex,
+                   ExcIndexRange(local_index, 0,
+                                 dof_handler.selected_fe->dofs_per_vertex));
+
+           dof_handler.vertex_dofs[vertex_index *
+                                   dof_handler.selected_fe->dofs_per_vertex
+                                   + local_index]
+             = global_index;
+         }
+
+
+       template <int dim, int spacedim>
+       static
+       void
+       set_vertex_dof_index (dealii::hp::DoFHandler<dim,spacedim> &dof_handler,
+                             const unsigned int vertex_index,
+                             const unsigned int fe_index,
+                             const unsigned int local_index,
+                             const unsigned int global_index)
+         {
+           Assert ( (fe_index != dealii::hp::DoFHandler<dim,spacedim>::default_fe_index),
+                    ExcMessage ("You need to specify a FE index when working "
+                                "with hp DoFHandlers"));
+           Assert (dof_handler.finite_elements != 0,
+                   ExcMessage ("No finite element collection is associated with "
+                               "this DoFHandler"));
+           Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex,
+                   ExcIndexRange(local_index, 0,
+                                 (*dof_handler.finite_elements)[fe_index].dofs_per_vertex));
+           Assert (fe_index < dof_handler.finite_elements->size(),
+                   ExcInternalError());
+           Assert (dof_handler.vertex_dofs_offsets[vertex_index] !=
+                   numbers::invalid_unsigned_int,
+                   ExcMessage ("This vertex is unused and has no DoFs associated with it"));
+
+                                            // 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 <= &dof_handler.vertex_dofs.back(), ExcInternalError());
+
+               const unsigned int this_fe_index = *pointer;
+       
+               Assert (this_fe_index != numbers::invalid_unsigned_int,
+                       ExcInternalError());
+               Assert (this_fe_index < dof_handler.finite_elements->size(),
+                       ExcInternalError());
+
+               if (this_fe_index == fe_index)
+                 {
+                   *(pointer + 1 + local_index) = global_index;
+                   return;
+                 }
+               else
+                 pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1;
+             }
+         }
+       
+       
+                                        /**
+                                         * Get the @p local_index-th
+                                         * degree of freedom
+                                         * corresponding to the finite
+                                         * element specified by @p
+                                         * fe_index on the vertex with
+                                         * global number @p
+                                         * vertex_index to @p
+                                         * global_index.
+                                         */
+
+       template <int dim, int spacedim>
+       static
+       unsigned int
+       get_vertex_dof_index (const dealii::DoFHandler<dim,spacedim> &dof_handler,
+                             const unsigned int vertex_index,
+                             const unsigned int fe_index,
+                             const unsigned int local_index)
+         {
+           Assert ((fe_index == dealii::DoFHandler<dim,spacedim>::default_fe_index),
+                   ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects"));
+           Assert (dof_handler.selected_fe != 0,
+                   ExcMessage ("No finite element collection is associated with "
+                               "this DoFHandler"));
+           Assert (local_index < dof_handler.selected_fe->dofs_per_vertex,
+                   ExcIndexRange(local_index, 0,
+                                 dof_handler.selected_fe->dofs_per_vertex));
+
+           return
+             dof_handler.vertex_dofs[vertex_index *
+                                     dof_handler.selected_fe->dofs_per_vertex
+                                     + local_index];
+         }  
+
+
+       template<int dim, int spacedim>
+       static
+       unsigned int
+       get_vertex_dof_index (const dealii::hp::DoFHandler<dim,spacedim> &dof_handler,
+                             const unsigned int vertex_index,
+                             const unsigned int fe_index,
+                             const unsigned int local_index)
+         {
+           Assert ( (fe_index != dealii::hp::DoFHandler<dim,spacedim>::default_fe_index),
+                    ExcMessage ("You need to specify a FE index when working "
+                                "with hp DoFHandlers"));
+           Assert (dof_handler.finite_elements != 0,
+                   ExcMessage ("No finite element collection is associated with "
+                               "this DoFHandler"));
+           Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex,
+                   ExcIndexRange(local_index, 0,
+                                 (*dof_handler.finite_elements)[fe_index].dofs_per_vertex));
+           Assert (vertex_index < dof_handler.vertex_dofs_offsets.size(),
+                   ExcIndexRange (vertex_index, 0,
+                                  dof_handler.vertex_dofs_offsets.size()));
+           Assert (dof_handler.vertex_dofs_offsets[vertex_index] !=
+                   numbers::invalid_unsigned_int,
+                   ExcMessage ("This vertex is unused and has no DoFs associated with it"));
+
+                                            // 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];
+           const unsigned int *pointer        = &dof_handler.vertex_dofs[starting_offset];
+           while (true)
+             {
+               Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError());
+
+               const unsigned int this_fe_index = *pointer;
+       
+               Assert (this_fe_index != numbers::invalid_unsigned_int,
+                       ExcInternalError());
+               Assert (this_fe_index < dof_handler.finite_elements->size(),
+                       ExcInternalError());
+
+               if (this_fe_index == fe_index)
+                 return *(pointer + 1 + local_index);
+               else
+                 pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1;
+             }
+         }
+
+
+                                        /**
+                                         * Return the number of
+                                         * different finite elements
+                                         * that are active on a given
+                                         * vertex.
+                                         */
+       template<int dim, int spacedim>
+       static
+       unsigned int
+       n_active_vertex_fe_indices (const dealii::hp::DoFHandler<dim,spacedim> &dof_handler,
+                                   const unsigned int vertex_index)
+         {
+           Assert (dof_handler.finite_elements != 0,
+                   ExcMessage ("No finite element collection is associated with "
+                               "this DoFHandler"));
+
+                                            // if this vertex is unused, return 0
+           if (dof_handler.vertex_dofs_offsets[vertex_index] == numbers::invalid_unsigned_int)
+             return 0;
+
+                                            // hop along the list of index
+                                            // sets and count the number of
+                                            // hops
+           const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index];
+           const unsigned int *pointer        = &dof_handler.vertex_dofs[starting_offset];
+
+           Assert (*pointer != numbers::invalid_unsigned_int,
+                   ExcInternalError());
+    
+           unsigned int counter = 0;
+           while (true)
+             {
+               Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError());
+
+               const unsigned int this_fe_index = *pointer;
+       
+               if (this_fe_index == numbers::invalid_unsigned_int)
+                 return counter;
+               else
+                 {
+                   pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1;
+                   ++counter;
+                 }
+             }
+         }
+
+
+
+                                        /**
+                                         * Return the fe index of the
+                                         * n-th finite element active
+                                         * on a given vertex.
+                                         */
+       template<int dim, int spacedim>
+       static
+       unsigned int
+       nth_active_vertex_fe_index (const dealii::hp::DoFHandler<dim,spacedim> &dof_handler,
+                                   const unsigned int vertex_index,
+                                   const unsigned int n)
+         {
+           Assert (dof_handler.finite_elements != 0,
+                   ExcMessage ("No finite element collection is associated with "
+                               "this DoFHandler"));
+           Assert (n < n_active_vertex_fe_indices(dof_handler, vertex_index),
+                   ExcIndexRange (n, 0, n_active_vertex_fe_indices(dof_handler,
+                                                                   vertex_index)));
+                                            // make sure we don't ask on
+                                            // unused vertices
+           Assert (dof_handler.vertex_dofs_offsets[vertex_index] !=
+                   numbers::invalid_unsigned_int,
+                   ExcInternalError());
+
+                                            // hop along the list of index
+                                            // sets and count the number of
+                                            // hops
+           const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index];
+           const unsigned int *pointer        = &dof_handler.vertex_dofs[starting_offset];
+
+           Assert (*pointer != numbers::invalid_unsigned_int,
+                   ExcInternalError());
+    
+           unsigned int counter = 0;
+           while (true)
+             {
+               Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError());
+
+               const unsigned int this_fe_index = *pointer;
+       
+               Assert (this_fe_index < dof_handler.finite_elements->size(),
+                       ExcInternalError());
+
+               if (counter == n)
+                 return this_fe_index;
+
+               Assert (this_fe_index != numbers::invalid_unsigned_int,
+                       ExcInternalError());
+       
+               pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1;
+               ++counter;      
+             }
+         }
+  
+
+
+                                        /**
+                                         * Return whether a particular
+                                         * finite element index is
+                                         * active on the specified
+                                         * vertex.
+                                         */
+       template<int dim, int spacedim>
+       static
+       bool
+       fe_is_active_on_vertex (const dealii::hp::DoFHandler<dim,spacedim> &dof_handler,
+                               const unsigned int vertex_index,
+                               const unsigned int fe_index)
+         {
+           Assert ( (fe_index != dealii::hp::DoFHandler<dim,spacedim>::default_fe_index),
+                    ExcMessage ("You need to specify a FE index when working "
+                                "with hp DoFHandlers"));
+           Assert (dof_handler.finite_elements != 0,
+                   ExcMessage ("No finite element collection is associated with "
+                               "this DoFHandler"));
+           Assert (fe_index < dof_handler.finite_elements->size(),
+                   ExcInternalError());
+
+                                            // make sure we don't ask on
+                                            // unused vertices
+           Assert (dof_handler.vertex_dofs_offsets[vertex_index] !=
+                   numbers::invalid_unsigned_int,
+                   ExcInternalError());
+
+                                            // hop along the list of index
+                                            // sets and see whether we find
+                                            // the given index
+           const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index];
+           const unsigned int *pointer        = &dof_handler.vertex_dofs[starting_offset];
+
+           Assert (*pointer != numbers::invalid_unsigned_int,
+                   ExcInternalError());
+    
+           while (true)
+             {
+               Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError());
+
+               const unsigned int this_fe_index = *pointer;
+       
+               Assert (this_fe_index < dof_handler.finite_elements->size(),
+                       ExcInternalError());
+
+               if (this_fe_index == numbers::invalid_unsigned_int)
+                 return false;
+               else
+                 if (this_fe_index == fe_index)
+                   return true;
+                 else
+                   pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1;
+             }
+         }
+  
     };
   }
 }
@@ -1181,6 +1489,44 @@ DoFAccessor<dim,DH>::fe_index_is_active (const unsigned int fe_index) const
 
 
 
+template <int structdim, class DH>
+inline
+unsigned int
+DoFAccessor<structdim, DH>::vertex_dof_index (const unsigned int vertex,
+                                             const unsigned int i,
+                                             const unsigned int fe_index) const
+{
+  return
+    internal::DoFAccessor::Implementation::get_vertex_dof_index
+    (*this->dof_handler,
+     this->vertex_index(vertex),
+     fe_index,
+     i);
+}
+
+
+
+template <int structdim, class DH>
+inline
+void
+DoFAccessor<structdim, DH>::set_vertex_dof_index (const unsigned int vertex,
+                                                 const unsigned int i,
+                                                 const unsigned int index,
+                                                 const unsigned int fe_index) const
+{
+  internal::DoFAccessor::Implementation::set_vertex_dof_index
+    (*this->dof_handler,
+     this->vertex_index(vertex),
+     fe_index,
+     i,
+     index);
+}
+
+
+
+
+
+
 namespace internal
 {
   namespace DoFAccessor
index f3c0eb0faa018f0ffd9c74ab8fa9e7c4824f5f72..20fe30e31dd38fb235c2046ebb35a9ef53327091 100644 (file)
@@ -1049,77 +1049,6 @@ class DoFHandler  :  public Subscriptor
                                      * Free all used memory.
                                      */
     void clear_space ();
-
-                                    /**
-                                     * Set the @p local_index-th
-                                     * degree of freedom
-                                     * corresponding to the finite
-                                     * element specified by @p
-                                     * fe_index on the vertex with
-                                     * global number @p
-                                     * vertex_index to @p
-                                     * global_index.
-                                     *
-                                     * This function is needed by
-                                     * DoFAccessor::set_vertex_dof_index
-                                     * when distributing degrees of
-                                     * freedom on a mesh.
-                                     *
-                                     * Since here we are dealing
-                                     * with a non-hp finite element
-                                     * DoF handler, the only
-                                     * reasonable choice for
-                                     * fe_index is
-                                     * default_fe_index. All other
-                                     * values will be ignored. The
-                                     * parameter to this function
-                                     * exists nevertheless to make
-                                     * sure that the accessor
-                                     * classes can be templatized
-                                     * on the type of the DoF
-                                     * handler.
-                                     */
-    void
-    set_vertex_dof_index (const unsigned int vertex_index,
-                         const unsigned int fe_index,
-                         const unsigned int local_index,
-                         const unsigned int global_index);
-
-                                    /**
-                                     * Get the @p local_index-th
-                                     * degree of freedom
-                                     * corresponding to the finite
-                                     * element specified by @p
-                                     * fe_index on the vertex with
-                                     * global number @p
-                                     * vertex_index to @p
-                                     * global_index.
-                                     *
-                                     * This function is needed by
-                                     * DoFAccessor::vertex_dof_index,
-                                     * which in turn is called for
-                                     * example when doing things
-                                     * like
-                                     * <code>cell-@>get_dof_indices()</code>.
-                                     *
-                                     * Since here we are dealing
-                                     * with a non-hp finite element
-                                     * DoF handler, the only
-                                     * reasonable choice for
-                                     * fe_index is
-                                     * default_fe_index. All other
-                                     * values will be ignored. The
-                                     * parameter to this function
-                                     * exists nevertheless to make
-                                     * sure that the accessor
-                                     * classes can be templatized
-                                     * on the type of the DoF
-                                     * handler.
-                                     */
-    unsigned int
-    get_vertex_dof_index (const unsigned int vertex_index,
-                         const unsigned int fe_index,
-                         const unsigned int local_index) const;
            
                                     /**
                                      * Space to store the DoF numbers
@@ -1128,7 +1057,7 @@ class DoFHandler  :  public Subscriptor
                                      * <tt>levels[]</tt> tree of the
                                      * Triangulation objects.
                                      */
-    std::vector<internal::DoFHandler::DoFLevel<dim>*>    levels;
+    std::vector<internal::DoFHandler::DoFLevel<dim>*> levels;
 
                                     /**
                                      * Space to store DoF numbers of
@@ -1138,7 +1067,7 @@ class DoFHandler  :  public Subscriptor
                                      * hierarchically, but in a flat
                                      * array.
                                      */
-    internal::DoFHandler::DoFFaces<dim> * faces;
+    internal::DoFHandler::DoFFaces<dim> *faces;
 
                                     /**
                                      * Store the number of dofs
@@ -1209,50 +1138,6 @@ DoFHandler<dim,spacedim>::get_tria () const
 
 
 
-template <int dim, int spacedim>
-inline
-unsigned int
-DoFHandler<dim,spacedim>::
-get_vertex_dof_index (const unsigned int vertex_index,
-                     const unsigned int fe_index,
-                     const unsigned int local_index) const
-{
-  Assert ((fe_index == DoFHandler<dim,spacedim>::default_fe_index),
-         ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects"));
-  Assert (selected_fe != 0,
-         ExcMessage ("No finite element collection is associated with "
-                     "this DoFHandler"));
-  Assert (local_index < selected_fe->dofs_per_vertex,
-         ExcIndexRange(local_index, 0,
-                       selected_fe->dofs_per_vertex));
-
-  return vertex_dofs[vertex_index * selected_fe->dofs_per_vertex + local_index];
-}  
-
-
-
-template <int dim, int spacedim>
-inline
-void
-DoFHandler<dim,spacedim>::
-set_vertex_dof_index (const unsigned int vertex_index,
-                     const unsigned int fe_index,
-                     const unsigned int local_index,
-                     const unsigned int global_index)
-{
-  Assert ((fe_index == DoFHandler<dim,spacedim>::default_fe_index),
-         ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects"));
-  Assert (selected_fe != 0,
-         ExcMessage ("No finite element collection is associated with "
-                     "this DoFHandler"));
-  Assert (local_index < selected_fe->dofs_per_vertex,
-         ExcIndexRange(local_index, 0,
-                       selected_fe->dofs_per_vertex));
-
-  vertex_dofs[vertex_index * selected_fe->dofs_per_vertex + local_index] = global_index;
-}
-
-
 
 #endif // DOXYGEN
 
index 593282ed3da41172b581690031a5fe3d78320e3c..7636d273797e5719b84e953ead6e5bb3d6b1ce4d 100644 (file)
@@ -998,77 +998,6 @@ namespace hp
       virtual void pre_refinement_notification (const Triangulation<dim,spacedim> &tria);
       virtual void post_refinement_notification (const Triangulation<dim,spacedim> &tria);
 
-                                      /**
-                                       * Set the @p local_index-th
-                                       * degree of freedom
-                                       * corresponding to the finite
-                                       * element specified by @p
-                                       * fe_index on the vertex with
-                                       * global number @p
-                                       * vertex_index to @p
-                                       * global_index.
-                                       *
-                                       * This function is needed by
-                                       * DoFAccessor::set_vertex_dof_index
-                                       * when distributing degrees of
-                                       * freedom on a mesh.
-                                       */
-      void
-      set_vertex_dof_index (const unsigned int vertex_index,
-                           const unsigned int fe_index,
-                           const unsigned int local_index,
-                           const unsigned int global_index);
-
-                                      /**
-                                       * Get the @p local_index-th
-                                       * degree of freedom
-                                       * corresponding to the finite
-                                       * element specified by @p
-                                       * fe_index on the vertex with
-                                       * global number @p
-                                       * vertex_index to @p
-                                       * global_index.
-                                       *
-                                       * This function is needed by
-                                       * DoFAccessor::vertex_dof_index,
-                                       * which in turn is called for
-                                       * example when doing things
-                                       * like
-                                       * <code>cell-@>get_dof_indices()</code>.
-                                       */
-      unsigned int
-      get_vertex_dof_index (const unsigned int vertex_index,
-                           const unsigned int fe_index,
-                           const unsigned int local_index) const;
-
-                                      /**
-                                       * Return the number of
-                                       * different finite elements
-                                       * that are active on a given
-                                       * vertex.
-                                       */
-      unsigned int
-      n_active_vertex_fe_indices (const unsigned int vertex_index) const;
-
-                                      /**
-                                       * Return the fe index of the
-                                       * n-th finite element active
-                                       * on a given vertex.
-                                       */
-      unsigned int
-      nth_active_vertex_fe_index (const unsigned int vertex_index,
-                                 const unsigned int n) const;
-      
-                                      /**
-                                       * Return whether a particular
-                                       * finite element index is
-                                       * active on the specified
-                                       * vertex.
-                                       */
-      bool
-      fe_is_active_on_vertex (const unsigned int vertex_index,
-                             const unsigned int fe_index) const;      
-      
                                       /**
                                        * Compute identities between
                                        * DoFs located on
@@ -1174,8 +1103,8 @@ namespace hp
                                        *
                                        * Access to this field is
                                        * generally through the
-                                       * get_vertex_dof_index() and
-                                       * set_vertex_dof_index()
+                                       * DoFAccessor::get_vertex_dof_index() and
+                                       * DoFAccessor::set_vertex_dof_index()
                                        * functions, encapsulating the
                                        * actual data format used to
                                        * the present class.
@@ -1197,8 +1126,8 @@ namespace hp
                                        *
                                        * Access to this field is
                                        * generally through the
-                                       * get_vertex_dof_index() and
-                                       * set_vertex_dof_index()
+                                       * Accessor::get_vertex_dof_index() and
+                                       * Accessor::set_vertex_dof_index()
                                        * functions, encapsulating the
                                        * actual data format used to
                                        * the present class.
@@ -1285,256 +1214,6 @@ namespace hp
 
 
 
-  template<int dim, int spacedim>
-  inline
-  unsigned int
-  DoFHandler<dim,spacedim>::
-  get_vertex_dof_index (const unsigned int vertex_index,
-                       const unsigned int fe_index,
-                       const unsigned int local_index) const
-  {
-    Assert ( (fe_index != dealii::hp::DoFHandler<dim,spacedim>::default_fe_index),
-           ExcMessage ("You need to specify a FE index when working "
-                       "with hp DoFHandlers"));
-    Assert (finite_elements != 0,
-           ExcMessage ("No finite element collection is associated with "
-                       "this DoFHandler"));
-    Assert (local_index < (*finite_elements)[fe_index].dofs_per_vertex,
-           ExcIndexRange(local_index, 0,
-                         (*finite_elements)[fe_index].dofs_per_vertex));
-    Assert (vertex_index < vertex_dofs_offsets.size(),
-           ExcIndexRange (vertex_index, 0, vertex_dofs_offsets.size()));
-    Assert (vertex_dofs_offsets[vertex_index] !=
-           numbers::invalid_unsigned_int,
-           ExcMessage ("This vertex is unused and has no DoFs associated with it"));
-
-                                    // 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 = vertex_dofs_offsets[vertex_index];
-    const unsigned int *pointer        = &vertex_dofs[starting_offset];
-    while (true)
-      {
-       Assert (pointer <= &vertex_dofs.back(), ExcInternalError());
-
-       const unsigned int this_fe_index = *pointer;
-       
-       Assert (this_fe_index != numbers::invalid_unsigned_int,
-               ExcInternalError());
-       Assert (this_fe_index < finite_elements->size(),
-               ExcInternalError());
-
-       if (this_fe_index == fe_index)
-         return *(pointer + 1 + local_index);
-       else
-         pointer += (*finite_elements)[this_fe_index].dofs_per_vertex + 1;
-      }
-  }  
-
-
-
-  template <int dim, int spacedim>
-  inline
-  void
-  DoFHandler<dim,spacedim>::
-  set_vertex_dof_index (const unsigned int vertex_index,
-                       const unsigned int fe_index,
-                       const unsigned int local_index,
-                       const unsigned int global_index)
-  {
-    Assert ( (fe_index != dealii::hp::DoFHandler<dim,spacedim>::default_fe_index),
-           ExcMessage ("You need to specify a FE index when working "
-                       "with hp DoFHandlers"));
-    Assert (finite_elements != 0,
-           ExcMessage ("No finite element collection is associated with "
-                       "this DoFHandler"));
-    Assert (local_index < (*finite_elements)[fe_index].dofs_per_vertex,
-           ExcIndexRange(local_index, 0,
-                         (*finite_elements)[fe_index].dofs_per_vertex));
-    Assert (fe_index < finite_elements->size(),
-           ExcInternalError());
-    Assert (vertex_dofs_offsets[vertex_index] !=
-           numbers::invalid_unsigned_int,
-           ExcMessage ("This vertex is unused and has no DoFs associated with it"));
-
-                                    // 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 = vertex_dofs_offsets[vertex_index];
-    unsigned int *pointer              = &vertex_dofs[starting_offset];
-    while (true)
-      {
-       Assert (pointer <= &vertex_dofs.back(), ExcInternalError());
-
-       const unsigned int this_fe_index = *pointer;
-       
-       Assert (this_fe_index != numbers::invalid_unsigned_int,
-               ExcInternalError());
-       Assert (this_fe_index < finite_elements->size(),
-               ExcInternalError());
-
-       if (this_fe_index == fe_index)
-         {
-           *(pointer + 1 + local_index) = global_index;
-           return;
-         }
-       else
-         pointer += (*finite_elements)[this_fe_index].dofs_per_vertex + 1;
-      }
-  }  
-
-
-
-  template<int dim, int spacedim>
-  inline
-  unsigned int
-  DoFHandler<dim,spacedim>::
-  n_active_vertex_fe_indices (const unsigned int vertex_index) const
-  {
-    Assert (finite_elements != 0,
-           ExcMessage ("No finite element collection is associated with "
-                       "this DoFHandler"));
-
-                                    // if this vertex is unused, return 0
-    if (vertex_dofs_offsets[vertex_index] == numbers::invalid_unsigned_int)
-      return 0;
-
-                                    // hop along the list of index
-                                    // sets and count the number of
-                                    // hops
-    const unsigned int starting_offset = vertex_dofs_offsets[vertex_index];
-    const unsigned int *pointer        = &vertex_dofs[starting_offset];
-
-    Assert (*pointer != numbers::invalid_unsigned_int,
-           ExcInternalError());
-    
-    unsigned int counter = 0;
-    while (true)
-      {
-       Assert (pointer <= &vertex_dofs.back(), ExcInternalError());
-
-       const unsigned int this_fe_index = *pointer;
-       
-       if (this_fe_index == numbers::invalid_unsigned_int)
-         return counter;
-       else
-         {
-           pointer += (*finite_elements)[this_fe_index].dofs_per_vertex + 1;
-           ++counter;
-         }
-      }
-  }
-
-
-
-  template<int dim, int spacedim>
-  inline
-  unsigned int
-  DoFHandler<dim,spacedim>::
-  nth_active_vertex_fe_index (const unsigned int vertex_index,
-                             const unsigned int n) const
-  {
-    Assert (finite_elements != 0,
-           ExcMessage ("No finite element collection is associated with "
-                       "this DoFHandler"));
-    Assert (n < n_active_vertex_fe_indices(vertex_index),
-           ExcIndexRange (n, 0, n_active_vertex_fe_indices(vertex_index)));
-                                    // make sure we don't ask on
-                                    // unused vertices
-    Assert (vertex_dofs_offsets[vertex_index] !=
-           numbers::invalid_unsigned_int,
-           ExcInternalError());
-
-                                    // hop along the list of index
-                                    // sets and count the number of
-                                    // hops
-    const unsigned int starting_offset = vertex_dofs_offsets[vertex_index];
-    const unsigned int *pointer        = &vertex_dofs[starting_offset];
-
-    Assert (*pointer != numbers::invalid_unsigned_int,
-           ExcInternalError());
-    
-    unsigned int counter = 0;
-    while (true)
-      {
-       Assert (pointer <= &vertex_dofs.back(), ExcInternalError());
-
-       const unsigned int this_fe_index = *pointer;
-       
-       Assert (this_fe_index < finite_elements->size(),
-               ExcInternalError());
-
-       if (counter == n)
-         return this_fe_index;
-
-       Assert (this_fe_index != numbers::invalid_unsigned_int,
-               ExcInternalError());
-       
-       pointer += (*finite_elements)[this_fe_index].dofs_per_vertex + 1;
-       ++counter;      
-      }
-  }
-  
-
-
-  template<int dim, int spacedim>
-  inline
-  bool
-  DoFHandler<dim,spacedim>::
-  fe_is_active_on_vertex (const unsigned int vertex_index,
-                         const unsigned int fe_index) const
-  {
-    Assert ( (fe_index != dealii::hp::DoFHandler<dim,spacedim>::default_fe_index),
-           ExcMessage ("You need to specify a FE index when working "
-                       "with hp DoFHandlers"));
-    Assert (finite_elements != 0,
-           ExcMessage ("No finite element collection is associated with "
-                       "this DoFHandler"));
-    Assert (fe_index < finite_elements->size(),
-           ExcInternalError());
-
-                                    // make sure we don't ask on
-                                    // unused vertices
-    Assert (vertex_dofs_offsets[vertex_index] !=
-           numbers::invalid_unsigned_int,
-           ExcInternalError());
-
-                                    // hop along the list of index
-                                    // sets and see whether we find
-                                    // the given index
-    const unsigned int starting_offset = vertex_dofs_offsets[vertex_index];
-    const unsigned int *pointer        = &vertex_dofs[starting_offset];
-
-    Assert (*pointer != numbers::invalid_unsigned_int,
-           ExcInternalError());
-    
-    while (true)
-      {
-       Assert (pointer <= &vertex_dofs.back(), ExcInternalError());
-
-       const unsigned int this_fe_index = *pointer;
-       
-       Assert (this_fe_index < finite_elements->size(),
-               ExcInternalError());
-
-       if (this_fe_index == numbers::invalid_unsigned_int)
-         return false;
-       else
-         if (this_fe_index == fe_index)
-           return true;
-         else
-           pointer += (*finite_elements)[this_fe_index].dofs_per_vertex + 1;
-      }
-  }
-  
   
 #endif
     
index 6c4e4850a615eb79c6612e073726e58a4c78e109..3ef24bc51f68e03e39146eb0b7e7d48b6a28de4d 100644 (file)
@@ -2959,11 +2959,14 @@ namespace hp
         ++vertex_index)
       {
        const unsigned int n_active_fe_indices
-         = n_active_vertex_fe_indices (vertex_index);
+         = internal::DoFAccessor::Implementation::
+         n_active_vertex_fe_indices (*this, vertex_index);
        if (n_active_fe_indices > 1)
          {
            const unsigned int
-             first_fe_index = nth_active_vertex_fe_index (vertex_index, 0);
+             first_fe_index
+             = internal::DoFAccessor::Implementation::
+             nth_active_vertex_fe_index (*this, vertex_index, 0);
 
                                             // loop over all the
                                             // other FEs with which
@@ -2973,7 +2976,9 @@ namespace hp
            for (unsigned int f=1; f<n_active_fe_indices; ++f)
              {
                const unsigned int
-                 other_fe_index = nth_active_vertex_fe_index (vertex_index, f);
+                 other_fe_index
+                 = internal::DoFAccessor::Implementation::
+                 nth_active_vertex_fe_index (*this, vertex_index, f);
 
                                                 // make sure the
                                                 // entry in the
@@ -3013,13 +3018,17 @@ namespace hp
                for (unsigned int i=0; i<identities.size(); ++i)
                  {
                    const unsigned int lower_dof_index
-                     = get_vertex_dof_index (vertex_index,
-                                             first_fe_index,
-                                             identities[i].first);
+                     = internal::DoFAccessor::Implementation::
+                     get_vertex_dof_index (*this,
+                                           vertex_index,
+                                           first_fe_index,
+                                           identities[i].first);
                    const unsigned int higher_dof_index
-                     = get_vertex_dof_index (vertex_index,
-                                             other_fe_index,
-                                             identities[i].second);
+                     = internal::DoFAccessor::Implementation::
+                     get_vertex_dof_index (*this,
+                                           vertex_index,
+                                           other_fe_index,
+                                           identities[i].second);
 
                    Assert ((new_dof_indices[higher_dof_index] ==
                             numbers::invalid_unsigned_int)
@@ -3547,20 +3556,30 @@ namespace hp
         ++vertex_index)
       {
        const unsigned int n_active_fe_indices
-         = n_active_vertex_fe_indices (vertex_index);
+         = internal::DoFAccessor::Implementation::
+         n_active_vertex_fe_indices (*this, vertex_index);
 
        for (unsigned int f=0; f<n_active_fe_indices; ++f)
          {
            const unsigned int fe_index
-             = nth_active_vertex_fe_index (vertex_index, f);
+             = internal::DoFAccessor::Implementation::
+             nth_active_vertex_fe_index (*this, vertex_index, f);
 
            for (unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_vertex; ++d)
-             set_vertex_dof_index (vertex_index,
-                                   fe_index,
-                                   d,
-                                   new_numbers[get_vertex_dof_index(vertex_index,
-                                                                    fe_index,
-                                                                    d)]);
+             {
+               const unsigned int vertex_dof_index
+                 = internal::DoFAccessor::Implementation::
+                 get_vertex_dof_index(*this,
+                                      vertex_index,
+                                      fe_index,
+                                      d);
+               internal::DoFAccessor::Implementation::
+                 set_vertex_dof_index (*this,
+                                       vertex_index,
+                                       fe_index,
+                                       d,
+                                       new_numbers[vertex_dof_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.