]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
types::global_dof_index
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 10 Aug 2012 08:39:21 +0000 (08:39 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 10 Aug 2012 08:39:21 +0000 (08:39 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_3@25855 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/dofs/dof_handler_policy.h
deal.II/source/dofs/dof_handler_policy.cc

index 65c90440169a3a1f43d31ee70390185918079bc9..fc589648e395d544ee9e1f945f3274dc32b19313 100644 (file)
@@ -65,7 +65,7 @@ namespace internal
                                             */
           virtual
           NumberCache
-          distribute_dofs (const unsigned int        offset,
+          distribute_dofs (const types::global_dof_index offset,
                            dealii::DoFHandler<dim,spacedim> &dof_handler) const = 0;
 
                                            /**
@@ -74,7 +74,7 @@ namespace internal
                                             */
           virtual
           NumberCache
-          renumber_dofs (const std::vector<unsigned int>  &new_numbers,
+          renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
                          dealii::DoFHandler<dim,spacedim> &dof_handler) const = 0;
       };
 
@@ -95,7 +95,7 @@ namespace internal
                                             */
           virtual
           NumberCache
-          distribute_dofs (const unsigned int        offset,
+          distribute_dofs (const types::global_dof_index        offset,
                            dealii::DoFHandler<dim,spacedim> &dof_handler) const;
 
                                            /**
@@ -104,7 +104,7 @@ namespace internal
                                             */
           virtual
           NumberCache
-          renumber_dofs (const std::vector<unsigned int>  &new_numbers,
+          renumber_dofs (const std::vector<types::global_dof_index>  &new_numbers,
                          dealii::DoFHandler<dim,spacedim> &dof_handler) const;
       };
 
@@ -126,7 +126,7 @@ namespace internal
                                             */
           virtual
           NumberCache
-          distribute_dofs (const unsigned int        offset,
+          distribute_dofs (const types::global_dof_index        offset,
                            dealii::DoFHandler<dim,spacedim> &dof_handler) const;
 
                                            /**
@@ -135,7 +135,7 @@ namespace internal
                                             */
           virtual
           NumberCache
-          renumber_dofs (const std::vector<unsigned int>  &new_numbers,
+          renumber_dofs (const std::vector<types::global_dof_index>  &new_numbers,
                          dealii::DoFHandler<dim,spacedim> &dof_handler) const;
       };
     }
index 241199d8918c8039b9c7fa2feaca6ba28e5860d8..f9577f28007f7cabb175afe91c3882e7375503e0 100644 (file)
@@ -58,10 +58,10 @@ namespace internal
                                             */
           template <int spacedim>
           static
-          unsigned int
+          types::global_dof_index
           distribute_dofs_on_cell (const DoFHandler<1,spacedim> &dof_handler,
                                    const typename DoFHandler<1,spacedim>::active_cell_iterator &cell,
-                                   unsigned int          next_free_dof)
+                                   types::global_dof_index next_free_dof)
             {
 
                                                // distribute dofs of vertices
@@ -102,10 +102,10 @@ namespace internal
 
           template <int spacedim>
           static
-          unsigned int
+         types::global_dof_index
           distribute_dofs_on_cell (const DoFHandler<2,spacedim> &dof_handler,
                                    const typename DoFHandler<2,spacedim>::active_cell_iterator &cell,
-                                   unsigned int          next_free_dof)
+                                   types::global_dof_index next_free_dof)
             {
               if (dof_handler.get_fe().dofs_per_vertex > 0)
                                                  // number dofs on vertices
@@ -149,10 +149,10 @@ namespace internal
 
           template <int spacedim>
           static
-          unsigned int
+         types::global_dof_index
           distribute_dofs_on_cell (const DoFHandler<3,spacedim> &dof_handler,
                                    const typename DoFHandler<3,spacedim>::active_cell_iterator &cell,
-                                   unsigned int          next_free_dof)
+                                   types::global_dof_index next_free_dof)
             {
               if (dof_handler.get_fe().dofs_per_vertex > 0)
                                                  // number dofs on vertices
@@ -219,13 +219,12 @@ namespace internal
                                             * the corresponding
                                             * argument is not equal to
                                             * types::invalid_subdomain_id. Return
-                                            * the total number of dofs
-                                            * returned.
+                                            * the next free dof index.
                                             */
           template <int dim, int spacedim>
           static
-          unsigned int
-          distribute_dofs (const unsigned int        offset,
+         types::global_dof_index 
+          distribute_dofs (const types::global_dof_index offset,
                            const types::subdomain_id_t subdomain_id,
                            DoFHandler<dim,spacedim> &dof_handler)
             {
@@ -245,7 +244,7 @@ namespace internal
               tria.save_user_flags(user_flags);
               const_cast<dealii::Triangulation<dim,spacedim> &>(tria).clear_user_flags ();
 
-              unsigned int next_free_dof = offset;
+              types::global_dof_index next_free_dof = offset;
               typename DoFHandler<dim,spacedim>::active_cell_iterator
                 cell = dof_handler.begin_active(),
                 endc = dof_handler.end();
@@ -293,7 +292,7 @@ namespace internal
           template <int spacedim>
           static
           void
-          renumber_dofs (const std::vector<unsigned int> &new_numbers,
+          renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
                          const IndexSet &,
                          DoFHandler<1,spacedim>          &dof_handler,
                          const bool check_validity)
@@ -308,7 +307,7 @@ namespace internal
                                                // numbers may be invalid_dof_index,
                                                // namely when the appropriate
                                                // vertex/line/etc is unused
-              for (std::vector<unsigned int>::iterator
+              for (std::vector<types::global_dof_index>::iterator
                      i=dof_handler.vertex_dofs.begin();
                    i!=dof_handler.vertex_dofs.end(); ++i)
                 if (*i != DoFHandler<1,spacedim>::invalid_dof_index)
@@ -325,7 +324,7 @@ namespace internal
                           ExcInternalError ());
 
               for (unsigned int level=0; level<dof_handler.levels.size(); ++level)
-                for (std::vector<unsigned int>::iterator
+                for (std::vector<types::global_dof_index>::iterator
                        i=dof_handler.levels[level]->lines.dofs.begin();
                      i!=dof_handler.levels[level]->lines.dofs.end(); ++i)
                   if (*i != DoFHandler<1,spacedim>::invalid_dof_index)
@@ -345,9 +344,9 @@ namespace internal
           template <int spacedim>
           static
           void
-          renumber_dofs (const std::vector<unsigned int> &new_numbers,
+          renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
                          const IndexSet &indices,
-                         DoFHandler<2,spacedim>          &dof_handler,
+                         DoFHandler<2,spacedim> &dof_handler,
                          const bool check_validity)
             {
                                                // note that we can not use cell
@@ -360,7 +359,7 @@ namespace internal
                                                // numbers may be invalid_dof_index,
                                                // namely when the appropriate
                                                // vertex/line/etc is unused
-              for (std::vector<unsigned int>::iterator
+              for (std::vector<types::global_dof_index>::iterator
                      i=dof_handler.vertex_dofs.begin();
                    i!=dof_handler.vertex_dofs.end(); ++i)
                 if (*i != DoFHandler<2,spacedim>::invalid_dof_index)
@@ -377,7 +376,7 @@ namespace internal
                           == false,
                           ExcInternalError ());
 
-              for (std::vector<unsigned int>::iterator
+              for (std::vector<types::global_dof_index>::iterator
                      i=dof_handler.faces->lines.dofs.begin();
                    i!=dof_handler.faces->lines.dofs.end(); ++i)
                 if (*i != DoFHandler<2,spacedim>::invalid_dof_index)
@@ -387,7 +386,7 @@ namespace internal
 
               for (unsigned int level=0; level<dof_handler.levels.size(); ++level)
                 {
-                  for (std::vector<unsigned int>::iterator
+                  for (std::vector<types::global_dof_index>::iterator
                          i=dof_handler.levels[level]->quads.dofs.begin();
                        i!=dof_handler.levels[level]->quads.dofs.end(); ++i)
                     if (*i != DoFHandler<2,spacedim>::invalid_dof_index)
@@ -409,7 +408,7 @@ namespace internal
           template <int spacedim>
           static
           void
-          renumber_dofs (const std::vector<unsigned int> &new_numbers,
+          renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
                          const IndexSet &indices,
                          DoFHandler<3,spacedim>          &dof_handler,
                          const bool check_validity)
@@ -424,7 +423,7 @@ namespace internal
                                                // numbers may be invalid_dof_index,
                                                // namely when the appropriate
                                                // vertex/line/etc is unused
-              for (std::vector<unsigned int>::iterator
+              for (std::vector<types::global_dof_index>::iterator
                      i=dof_handler.vertex_dofs.begin();
                    i!=dof_handler.vertex_dofs.end(); ++i)
                 if (*i != DoFHandler<3,spacedim>::invalid_dof_index)
@@ -441,14 +440,14 @@ namespace internal
                           == false,
                           ExcInternalError ());
 
-              for (std::vector<unsigned int>::iterator
+              for (std::vector<types::global_dof_index>::iterator
                      i=dof_handler.faces->lines.dofs.begin();
                    i!=dof_handler.faces->lines.dofs.end(); ++i)
                 if (*i != DoFHandler<3,spacedim>::invalid_dof_index)
                   *i = ((indices.n_elements() == 0) ?
                         new_numbers[*i] :
                         new_numbers[indices.index_within_set(*i)]);
-              for (std::vector<unsigned int>::iterator
+              for (std::vector<types::global_dof_index>::iterator
                      i=dof_handler.faces->quads.dofs.begin();
                    i!=dof_handler.faces->quads.dofs.end(); ++i)
                 if (*i != DoFHandler<3,spacedim>::invalid_dof_index)
@@ -458,7 +457,7 @@ namespace internal
 
               for (unsigned int level=0; level<dof_handler.levels.size(); ++level)
                 {
-                  for (std::vector<unsigned int>::iterator
+                  for (std::vector<types::global_dof_index>::iterator
                          i=dof_handler.levels[level]->hexes.dofs.begin();
                        i!=dof_handler.levels[level]->hexes.dofs.end(); ++i)
                     if (*i != DoFHandler<3,spacedim>::invalid_dof_index)
@@ -492,10 +491,10 @@ namespace internal
       template <int dim, int spacedim>
       NumberCache
       Sequential<dim,spacedim>::
-      distribute_dofs (const unsigned int        offset,
+      distribute_dofs (const types::global_dof_index offset,
                        DoFHandler<dim,spacedim> &dof_handler) const
       {
-        const unsigned int n_dofs =
+        const types::global_dof_index n_dofs =
           Implementation::distribute_dofs (offset,
                                            types::invalid_subdomain_id,
                                            dof_handler);
@@ -527,7 +526,7 @@ namespace internal
       template <int dim, int spacedim>
       NumberCache
       Sequential<dim,spacedim>::
-      renumber_dofs (const std::vector<unsigned int>  &new_numbers,
+      renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
                      dealii::DoFHandler<dim,spacedim> &dof_handler) const
       {
         Implementation::renumber_dofs (new_numbers, IndexSet(0),
@@ -584,7 +583,7 @@ namespace internal
             {
                 std::vector<unsigned int> tree_index;
                 std::vector<typename dealii::internal::p4est::types<dim>::quadrant> quadrants;
-                std::vector<unsigned int> dofs;
+                std::vector<types::global_dof_index> dofs;
 
                 unsigned int bytes_for_buffer () const
                   {
@@ -592,7 +591,7 @@ namespace internal
                             tree_index.size() * sizeof(unsigned int) +
                             quadrants.size() * sizeof(typename dealii::internal::p4est
                                                       ::types<dim>::quadrant) +
-                            dofs.size() * sizeof(unsigned int));
+                            dofs.size() * sizeof(types::global_dof_index));
                   }
 
                 void pack_data (std::vector<char> &buffer) const
@@ -619,8 +618,8 @@ namespace internal
 
                     std::memcpy(ptr,
                                 &dofs[0],
-                                dofs.size() * sizeof(unsigned int));
-                    ptr += dofs.size() * sizeof(unsigned int);
+                                dofs.size() * sizeof(types::global_dof_index));
+                    ptr += dofs.size() * sizeof(types::global_dof_index);
 
                     Assert (ptr == &buffer[0]+buffer.size(),
                             ExcInternalError());
@@ -694,7 +693,7 @@ namespace internal
                                                    // this cell's dof_indices
                                                    // need to be sent to
                                                    // someone
-                  std::vector<unsigned int>
+                  std::vector<types::global_dof_index>
                     local_dof_indices (dealii_cell->get_fe().dofs_per_cell);
                   dealii_cell->get_dof_indices (local_dof_indices);
 
@@ -737,7 +736,7 @@ namespace internal
           const typename dealii::internal::p4est::types<dim>::quadrant &p4est_cell,
           const typename DoFHandler<dim,spacedim>::cell_iterator &dealii_cell,
           const typename dealii::internal::p4est::types<dim>::quadrant &quadrant,
-          unsigned int * dofs)
+          types::global_dof_index * dofs)
         {
           if (internal::p4est::quadrant_is_equal<dim>(p4est_cell, quadrant))
             {
@@ -745,7 +744,7 @@ namespace internal
               Assert(dealii_cell->is_ghost(), ExcInternalError());
 
                                                // update dof indices of cell
-              std::vector<unsigned int>
+              std::vector<types::global_dof_index>
                 dof_indices (dealii_cell->get_fe().dofs_per_cell);
               dealii_cell->update_cell_dof_indices_cache();
               dealii_cell->get_dof_indices(dof_indices);
@@ -914,7 +913,7 @@ namespace internal
                                            // that are going to send stuff to us
           std::set<dealii::types::subdomain_id_t> senders;
           {
-            std::vector<unsigned int> local_dof_indices;
+            std::vector<types::global_dof_index> local_dof_indices;
             typename DoFHandler<dim,spacedim>::active_cell_iterator
               cell, endc = dof_handler.end();
 
@@ -962,13 +961,13 @@ namespace internal
               memcpy(&cells, ptr, sizeof(unsigned int));
               ptr+=sizeof(unsigned int);
 
-                                               //reinterpret too evil?
+                                               //TODO: reinterpret too evil?
               unsigned int * treeindex=reinterpret_cast<unsigned int*>(ptr);
               ptr+=cells*sizeof(unsigned int);
               typename dealii::internal::p4est::types<dim>::quadrant * quadrant
                 =reinterpret_cast<typename dealii::internal::p4est::types<dim>::quadrant *>(ptr);
               ptr+=cells*sizeof(typename dealii::internal::p4est::types<dim>::quadrant);
-              unsigned int * dofs=reinterpret_cast<unsigned int*>(ptr);
+              types::global_dof_index * dofs=reinterpret_cast<types::global_dof_index*>(ptr);
 
               for (unsigned int c=0;c<cells;++c, dofs+=1+dofs[0])
                 {
@@ -1049,7 +1048,7 @@ namespace internal
       template <int dim, int spacedim>
       NumberCache
       ParallelDistributed<dim, spacedim>::
-      distribute_dofs (const unsigned int        offset,
+      distribute_dofs (const types::global_dof_index offset,
                        DoFHandler<dim,spacedim> &dof_handler) const
       {
         Assert(offset==0, ExcNotImplemented());
@@ -1072,19 +1071,19 @@ namespace internal
 
                                          //* 1. distribute on own
                                          //* subdomain
-        const unsigned int n_initial_local_dofs =
+        const types::global_dof_index n_initial_local_dofs =
           Implementation::distribute_dofs (0, tr->locally_owned_subdomain(),
                                            dof_handler);
 
                                          //* 2. iterate over ghostcells and
                                          //kill dofs that are not owned
                                          //by us
-        std::vector<unsigned int> renumbering(n_initial_local_dofs);
+        std::vector<types::global_dof_index> renumbering(n_initial_local_dofs);
         for (unsigned int i=0; i<renumbering.size(); ++i)
           renumbering[i] = i;
 
         {
-          std::vector<unsigned int> local_dof_indices;
+          std::vector<types::global_dof_index> local_dof_indices;
 
           typename DoFHandler<dim,spacedim>::active_cell_iterator
             cell = dof_handler.begin_active(),
@@ -1118,7 +1117,7 @@ namespace internal
 
                                          // make indices consecutive
         number_cache.n_locally_owned_dofs = 0;
-        for (std::vector<unsigned int>::iterator it=renumbering.begin();
+        for (std::vector<types::global_dof_index>::iterator it=renumbering.begin();
              it!=renumbering.end(); ++it)
           if (*it != DoFHandler<dim,spacedim>::invalid_dof_index)
             *it = number_cache.n_locally_owned_dofs++;
@@ -1133,14 +1132,14 @@ namespace internal
                         1, MPI_UNSIGNED,
                         tr->get_communicator());
 
-        const unsigned int
+        const types::global_dof_index
           shift = std::accumulate (number_cache
                                    .n_locally_owned_dofs_per_processor.begin(),
                                    number_cache
                                    .n_locally_owned_dofs_per_processor.begin()
                                    + tr->locally_owned_subdomain(),
                                    0);
-        for (std::vector<unsigned int>::iterator it=renumbering.begin();
+        for (std::vector<types::global_dof_index>::iterator it=renumbering.begin();
              it!=renumbering.end(); ++it)
           if (*it != DoFHandler<dim,spacedim>::invalid_dof_index)
             (*it) += shift;
@@ -1171,7 +1170,7 @@ namespace internal
                                          // fill global_dof_indexsets
         number_cache.locally_owned_dofs_per_processor.resize(n_cpus);
         {
-          unsigned int lshift = 0;
+          types::global_dof_index lshift = 0;
           for (unsigned int i=0;i<n_cpus;++i)
             {
               number_cache.locally_owned_dofs_per_processor[i]
@@ -1251,7 +1250,7 @@ namespace internal
 #ifdef DEBUG
                                          //check that we are really done
         {
-          std::vector<unsigned int> local_dof_indices;
+          std::vector<types::global_dof_index> local_dof_indices;
           typename DoFHandler<dim,spacedim>::active_cell_iterator
             cell, endc = dof_handler.end();
 
@@ -1287,7 +1286,7 @@ namespace internal
       template <int dim, int spacedim>
       NumberCache
       ParallelDistributed<dim, spacedim>::
-      renumber_dofs (const std::vector<unsigned int> &new_numbers,
+      renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
                      dealii::DoFHandler<dim,spacedim> &dof_handler) const
       {
         Assert (new_numbers.size() == dof_handler.locally_owned_dofs().n_elements(),
@@ -1312,9 +1311,9 @@ namespace internal
         number_cache.locally_owned_dofs = IndexSet (dof_handler.n_dofs());
         if (dof_handler.locally_owned_dofs().n_elements()>0)
         {
-          std::vector<unsigned int>::const_iterator it = new_numbers.begin();
+          std::vector<types::global_dof_index>::const_iterator it = new_numbers.begin();
           const unsigned int n_blocks = dof_handler.get_fe().n_blocks();
-          std::vector<std::pair<unsigned int,unsigned int> > block_indices(n_blocks);
+          std::vector<std::pair<types::global_dof_index,unsigned int> > block_indices(n_blocks);
           block_indices[0].first = *it++;
           block_indices[0].second = 1;
           unsigned int current_block = 0, n_filled_blocks = 1;
@@ -1397,7 +1396,7 @@ namespace internal
                                          // mark not locally active DoFs as
                                          // invalid
         {
-          std::vector<unsigned int> local_dof_indices;
+          std::vector<types::global_dof_index> local_dof_indices;
 
           typename DoFHandler<dim,spacedim>::active_cell_iterator
             cell = dof_handler.begin_active(),

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.