]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make member variables of the levels objects private.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 30 Aug 2013 12:30:40 +0000 (12:30 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 30 Aug 2013 12:30:40 +0000 (12:30 +0000)
git-svn-id: https://svn.dealii.org/trunk@30536 0785d39b-7218-0410-832d-ea1e28bc413d

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

index ef26c645c611c640054a61760b685808383e8375..3b17b0fa522dba789041d8ce72011d1d6567ba38 100644 (file)
@@ -2979,12 +2979,9 @@ namespace internal
       {
         Assert (static_cast<unsigned int>(accessor.level()) < accessor.dof_handler->levels.size(),
                 ExcMessage ("DoFHandler not initialized"));
-        Assert (static_cast<std::vector<unsigned int>::size_type>(accessor.present_index) <
-                accessor.dof_handler->levels[accessor.level()]->active_fe_indices.size (),
-                ExcIndexRange (accessor.present_index, 0,
-                               accessor.dof_handler->levels[accessor.level()]->active_fe_indices.size ()));
+
         return accessor.dof_handler->levels[accessor.level()]
-               ->active_fe_indices[accessor.present_index];
+         ->active_fe_index(accessor.present_index);
       }
 
 
@@ -3022,12 +3019,9 @@ namespace internal
         Assert (static_cast<unsigned int>(accessor.level()) <
                 accessor.dof_handler->levels.size(),
                 ExcMessage ("DoFHandler not initialized"));
-        Assert (static_cast<std::vector<unsigned int>::size_type>(accessor.present_index) <
-                accessor.dof_handler->levels[accessor.level()]->active_fe_indices.size (),
-                ExcIndexRange (accessor.present_index, 0,
-                               accessor.dof_handler->levels[accessor.level()]->active_fe_indices.size ()));
+
         accessor.dof_handler->levels[accessor.level()]
-        ->active_fe_indices[accessor.present_index] = i;
+         ->set_active_fe_index (accessor.present_index, i);
       }
 
 
index 3f6cf53f1779c7e6fb5614bfd29f2a55e55787b0..29d328a8bcadd1969941c1d6b9a130e076e1b76c 100644 (file)
 
 DEAL_II_NAMESPACE_OPEN
 
+namespace hp
+{
+  template <int, int> class DoFHandler;
+}
+
+
+namespace internal
+{
+  namespace hp
+  {
+    namespace DoFHandler
+    {
+      struct Implementation;
+    }
+  }
+}
+
+
 namespace internal
 {
   namespace hp
@@ -41,7 +59,7 @@ namespace internal
     template <int dim>
     class DoFLevel
     {
-    public:
+    private:
       /**
        *  Indices specifying the finite
        *  element of hp::FECollection to use
@@ -76,6 +94,8 @@ namespace internal
        */
       std::vector<types::global_dof_index> dofs;
 
+    public:
+
       /**
        * Set the global index of
        * the @p local_index-th
@@ -136,7 +156,7 @@ namespace internal
 
       /**
        * Return the fe_index of the
-       * n-th active finite element
+       * active finite element
        * on this object.
        */
       unsigned int
@@ -152,12 +172,28 @@ namespace internal
       fe_index_is_active (const unsigned int               obj_index,
                           const unsigned int               fe_index) const;
 
+      /**
+       * Set the fe_index of the
+       * active finite element
+       * on this object.
+       */
+      void
+      set_active_fe_index (const unsigned int obj_index,
+                          const unsigned int fe_index);
+
       /**
        * Determine an estimate for the
        * memory consumption (in bytes)
        * of this object.
        */
       std::size_t memory_consumption () const;
+
+      /**
+       * Make hp::DoFHandler and its auxiliary class a friend since it
+       * is the class that needs to create these data structures.
+       */
+      template <int, int> friend class dealii::hp::DoFHandler;
+      friend class dealii::internal::hp::DoFHandler::Implementation;
     };
 
 
@@ -263,6 +299,28 @@ namespace internal
       return (fe_index == active_fe_indices[obj_index]);
     }
 
+
+    template <int dim>
+    inline
+    void
+    DoFLevel<dim>::
+    set_active_fe_index (const unsigned int obj_index,
+                        const unsigned int fe_index)
+    {
+      Assert (obj_index < dof_offsets.size(),
+              ExcIndexRange (obj_index, 0, dof_offsets.size()));
+
+      // make sure we are on an
+      // object for which DoFs have
+      // been allocated at all
+      Assert (dof_offsets[obj_index] != numbers::invalid_dof_index,
+              ExcMessage ("You are trying to access degree of freedom "
+                          "information for an object on which no such "
+                          "information is available"));
+
+      active_fe_indices[obj_index] = fe_index;
+    }
+
   } // namespace hp
 
 } // namespace internal
index 5881e47859582048f39e0b6a0323e4b74b8d3d23..2096c95a4fb8c1f26a520c61d31f3d629cbbea83 100644 (file)
@@ -542,7 +542,8 @@ namespace internal
             std::vector<std::vector<unsigned int> >
             active_fe_backup(dof_handler.levels.size ());
             for (unsigned int level = 0; level<dof_handler.levels.size (); ++level)
-              std::swap (dof_handler.levels[level]->active_fe_indices, active_fe_backup[level]);
+              std::swap (dof_handler.levels[level]->active_fe_indices,
+                        active_fe_backup[level]);
 
             // delete all levels and set them up
             // newly, since vectors are

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.