]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Changed Policy methods to recieve NumberCache by reference
authordenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Mar 2014 21:13:07 +0000 (21:13 +0000)
committerdenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Mar 2014 21:13:07 +0000 (21:13 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32694 0785d39b-7218-0410-832d-ea1e28bc413d

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

index f588ba63f8f2c325f1ec57d492c4cf2767d7fb24..102687b0dd0e43480f83b1c3b7b49390eaa2c6d0 100644 (file)
@@ -70,8 +70,9 @@ namespace internal
          * the object given as last argument.
          */
         virtual
-        NumberCache
-        distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler) const = 0;
+        void
+        distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler,
+                                NumberCache &number_cache) const = 0;
 
         /**
          * Distribute the multigrid dofs on each level
@@ -86,9 +87,10 @@ namespace internal
          * specified by the first argument.
          */
         virtual
-        NumberCache
+        void
         renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
-                       dealii::DoFHandler<dim,spacedim> &dof_handler) const = 0;
+                       dealii::DoFHandler<dim,spacedim> &dof_handler,
+                       NumberCache & number_cache) const = 0;
       };
 
 
@@ -107,8 +109,9 @@ namespace internal
          * the object given as last argument.
          */
         virtual
-        NumberCache
-        distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler) const;
+        void
+        distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler,
+                                NumberCache &number_cache) const;
 
         /**
          * Distribute multigrid DoFs.
@@ -123,9 +126,10 @@ namespace internal
          * specified by the first argument.
          */
         virtual
-        NumberCache
+        void
         renumber_dofs (const std::vector<types::global_dof_index>  &new_numbers,
-                       dealii::DoFHandler<dim,spacedim> &dof_handler) const;
+                       dealii::DoFHandler<dim,spacedim> &dof_handler,
+                       NumberCache & number_cache) const;
       };
 
       template <int dim, int spacedim>
@@ -133,8 +137,9 @@ namespace internal
       {
       public:
          virtual
-         NumberCache
-         distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler) const;
+         void
+         distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler,
+                                  NumberCache & number_cache) const;
 
          virtual
          void
@@ -142,9 +147,10 @@ namespace internal
                              std::vector<NumberCache> &number_caches) const;
 
          virtual
-         NumberCache
+         void
          renumber_dofs (const std::vector<types::global_dof_index>  &new_numbers,
-                        dealii::DoFHandler<dim,spacedim> &dof_handler) const;
+                        dealii::DoFHandler<dim,spacedim> &dof_handler,
+                        NumberCache & number_cache) const;
       };
 
 
@@ -164,8 +170,9 @@ namespace internal
          * the object given as last argument.
          */
         virtual
-        NumberCache
-        distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler) const;
+        void
+        distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler,
+                                NumberCache &number_cache) const;
 
         /**
          * Distribute multigrid DoFs.
@@ -180,9 +187,10 @@ namespace internal
          * specified by the first argument.
          */
         virtual
-        NumberCache
+        void
         renumber_dofs (const std::vector<types::global_dof_index>  &new_numbers,
-                       dealii::DoFHandler<dim,spacedim> &dof_handler) const;
+                       dealii::DoFHandler<dim,spacedim> &dof_handler,
+                       NumberCache &number_cache) const;
       };
     }
   }
index 32cd024bffd754464782409eef5abc939a86c698..5d1bd08b2194b8ab20501615b286f8f1e20a4250 100644 (file)
@@ -1172,7 +1172,7 @@ void DoFHandler<dim,spacedim>::distribute_dofs (const FiniteElement<dim,spacedim
   internal::DoFHandler::Implementation::reserve_space (*this);
 
   // hand things off to the policy
-  number_cache = policy->distribute_dofs (*this);
+  policy->distribute_dofs (*this,number_cache);
 
   //since get_subdomain_association querry n_dofs()
   //the need to re-work locally_owned_dofs outside of policy class
@@ -1290,7 +1290,7 @@ DoFHandler<dim,spacedim>::renumber_dofs (const std::vector<types::global_dof_ind
               ExcMessage ("New DoF index is not less than the total number of dofs."));
 #endif
 
-  number_cache = policy->renumber_dofs (new_numbers, *this);
+  policy->renumber_dofs (new_numbers, *this,number_cache);
 }
 
 
index eb755a5758c076f4725b83d7149252a3d8ed32d6..bdb1d57b509fddc7a15273feb5b96701e104a9ce 100644 (file)
@@ -870,9 +870,10 @@ namespace internal
 
 
       template <int dim, int spacedim>
-      NumberCache
+      void
       Sequential<dim,spacedim>::
-      distribute_dofs (DoFHandler<dim,spacedim> &dof_handler) const
+      distribute_dofs (DoFHandler<dim,spacedim> &dof_handler,
+                          NumberCache & number_cache ) const
       {
         const types::global_dof_index n_dofs =
           Implementation::distribute_dofs (0,
@@ -881,7 +882,6 @@ namespace internal
 
         // now set the elements of the
         // number cache appropriately
-        NumberCache number_cache;
         number_cache.n_global_dofs        = n_dofs;
         number_cache.n_locally_owned_dofs = number_cache.n_global_dofs;
 
@@ -898,7 +898,6 @@ namespace internal
         number_cache.locally_owned_dofs_per_processor
           = std::vector<IndexSet> (1,
                                    number_cache.locally_owned_dofs);
-        return number_cache;
       }
 
 
@@ -929,10 +928,11 @@ namespace internal
       }
 
       template <int dim, int spacedim>
-      NumberCache
+      void
       Sequential<dim,spacedim>::
       renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
-                     dealii::DoFHandler<dim,spacedim> &dof_handler) const
+                     dealii::DoFHandler<dim,spacedim> &dof_handler,
+                     NumberCache &number_cache) const
       {
         Implementation::renumber_dofs (new_numbers, IndexSet(0),
                                        dof_handler, true);
@@ -943,7 +943,6 @@ namespace internal
         // have to set the elements
         // of the structure
         // appropriately anyway
-        NumberCache number_cache;
         number_cache.n_global_dofs        = dof_handler.n_dofs();
         number_cache.n_locally_owned_dofs = number_cache.n_global_dofs;
 
@@ -960,17 +959,16 @@ namespace internal
         number_cache.locally_owned_dofs_per_processor
           = std::vector<IndexSet> (1,
                                    number_cache.locally_owned_dofs);
-        return number_cache;
       }
 
       /* --------------------- class ParallelSequential ---------------- */
       template <int dim, int spacedim>
-      NumberCache
+      void
       ParallelShared<dim,spacedim>::
-      distribute_dofs (DoFHandler<dim,spacedim> &dof_handler) const
+      distribute_dofs (DoFHandler<dim,spacedim> &dof_handler,
+                          NumberCache & number_cache) const
       {
-         NumberCache number_cache = Sequential<dim,spacedim>::distribute_dofs (dof_handler);
-         return number_cache;
+         Sequential<dim,spacedim>::distribute_dofs (dof_handler,number_cache);
       }
 
       template <int dim, int spacedim>
@@ -984,15 +982,15 @@ namespace internal
       }
 
       template <int dim, int spacedim>
-      NumberCache
+      void
       ParallelShared<dim,spacedim>::
       renumber_dofs (const std::vector<types::global_dof_index> &new_numbers,
-                     dealii::DoFHandler<dim,spacedim> &dof_handler) const
+                     dealii::DoFHandler<dim,spacedim> &dof_handler,
+                     NumberCache &number_cache) const
       {
-         NumberCache number_cache = Sequential<dim,spacedim>::renumber_dofs (new_numbers,dof_handler);
+         Sequential<dim,spacedim>::renumber_dofs (new_numbers,dof_handler,number_cache);
          //correct number_cache:
          number_cache.locally_owned_dofs = dealii::DoFTools::locally_owned_dofs_with_subdomain(dof_handler,dof_handler.get_tria().locally_owned_subdomain() );
-         return number_cache;
       }
 
       /* --------------------- class ParallelDistributed ---------------- */
@@ -1958,11 +1956,11 @@ namespace internal
 
 
       template <int dim, int spacedim>
-      NumberCache
+      void
       ParallelDistributed<dim, spacedim>::
-      distribute_dofs (DoFHandler<dim,spacedim> &dof_handler) const
+      distribute_dofs (DoFHandler<dim,spacedim> &dof_handler,
+                          NumberCache &number_cache) const
       {
-        NumberCache number_cache;
 
 #ifndef DEAL_II_WITH_P4EST
         (void)dof_handler;
@@ -2174,7 +2172,6 @@ namespace internal
 #endif // DEBUG
 #endif // DEAL_II_WITH_P4EST
 
-        return number_cache;
       }
 
 
@@ -2425,15 +2422,15 @@ namespace internal
 
 
       template <int dim, int spacedim>
-      NumberCache
+      void
       ParallelDistributed<dim, spacedim>::
       renumber_dofs (const std::vector<dealii::types::global_dof_index> &new_numbers,
-                     dealii::DoFHandler<dim,spacedim> &dof_handler) const
+                     dealii::DoFHandler<dim,spacedim> &dof_handler,
+                     NumberCache &number_cache) const
       {
         Assert (new_numbers.size() == dof_handler.locally_owned_dofs().n_elements(),
                 ExcInternalError());
 
-        NumberCache number_cache;
 
 #ifndef DEAL_II_WITH_P4EST
         Assert (false, ExcNotImplemented());
@@ -2677,7 +2674,6 @@ namespace internal
         }
 #endif
 
-        return number_cache;
       }
     }
   }

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.