]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
made distribute_dofs() return NumberCache as it was originally
authordenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 27 Apr 2014 15:41:40 +0000 (15:41 +0000)
committerdenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 27 Apr 2014 15:41:40 +0000 (15:41 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32848 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 6747ecbbc201a637d57b80533194e42a8da125f2..9456dc491a9f0a8d283266906a0c302415a9c6ef 100644 (file)
@@ -71,9 +71,9 @@ namespace internal
          * the object given as last argument.
          */
         virtual
-        void
+        NumberCache
         distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler,
-                                NumberCache &number_cache) const = 0;
+                                NumberCache &number_cache_current) const = 0;
 
         /**
          * Distribute the multigrid dofs on each level
@@ -110,9 +110,9 @@ namespace internal
          * the object given as last argument.
          */
         virtual
-        void
+        NumberCache
         distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler,
-                                NumberCache &number_cache) const;
+                                NumberCache &number_cache_current) const;
 
         /**
          * Distribute multigrid DoFs.
@@ -154,9 +154,9 @@ namespace internal
            * number_cache.locally_owned_dofs are updated consistently.
            */
          virtual
-         void
+         NumberCache
          distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler,
-                                  NumberCache & number_cache) const;
+                                  NumberCache & number_cache_current) const;
 
          /**
           * This function is not yet implemented.
@@ -196,7 +196,7 @@ namespace internal
          * the object given as last argument.
          */
         virtual
-        void
+        NumberCache
         distribute_dofs (dealii::DoFHandler<dim,spacedim> &dof_handler,
                                 NumberCache &number_cache) const;
 
index 2b9cc1fb0d90551ade3eb8059513943a2736c93c..3198251d298405ef93b67be063addae3ff93240f 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
-  policy->distribute_dofs (*this,number_cache);
+  number_cache = policy->distribute_dofs (*this,number_cache);
 
   // initialize the block info object
   // only if this is a sequential
index c5370a0e5f961e5fc546a60d8dabd320aec579d1..c5d0aef91d740e195736dc809f296728e2f9b212 100644 (file)
@@ -870,10 +870,10 @@ namespace internal
 
 
       template <int dim, int spacedim>
-      void
+      NumberCache
       Sequential<dim,spacedim>::
       distribute_dofs (DoFHandler<dim,spacedim> &dof_handler,
-                          NumberCache & number_cache ) const
+                          NumberCache & number_cache_current ) const
       {
         const types::global_dof_index n_dofs =
           Implementation::distribute_dofs (0,
@@ -882,6 +882,7 @@ 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,6 +899,7 @@ namespace internal
         number_cache.locally_owned_dofs_per_processor
           = std::vector<IndexSet> (1,
                                    number_cache.locally_owned_dofs);
+        return number_cache;
       }
 
 
@@ -965,12 +967,14 @@ namespace internal
 
       /* --------------------- class ParallelSequential ---------------- */
       template <int dim, int spacedim>
-      void
+      NumberCache
       ParallelShared<dim,spacedim>::
       distribute_dofs (DoFHandler<dim,spacedim> &dof_handler,
-                          NumberCache & number_cache) const
+                          NumberCache & number_cache_current) const
       {
-         Sequential<dim,spacedim>::distribute_dofs (dof_handler,number_cache);
+         NumberCache number_cache = Sequential<dim,spacedim>::distribute_dofs (dof_handler,number_cache_current);
+         //update current number cache in DoFHandler
+         number_cache_current = number_cache;
          DoFRenumbering::subdomain_wise (dof_handler);
          const parallel::shared::Triangulation<dim,spacedim> *shared_tr = dynamic_cast<const parallel::shared::Triangulation<dim,spacedim>*>(&dof_handler.get_tria());
          const unsigned int n_mpi_processes =  Utilities::MPI::n_mpi_processes( shared_tr->get_communicator () );
@@ -978,6 +982,7 @@ namespace internal
          for (unsigned int i=0; i<n_mpi_processes; ++i)
                  number_cache.n_locally_owned_dofs_per_processor[i]  = DoFTools::count_dofs_with_subdomain_association (dof_handler, i);
          number_cache.locally_owned_dofs = dealii::DoFTools::locally_owned_dofs_with_subdomain(dof_handler,dof_handler.get_tria().locally_owned_subdomain() );
+         return number_cache;
       }
 
       template <int dim, int spacedim>
@@ -1968,11 +1973,12 @@ namespace internal
 
 
       template <int dim, int spacedim>
-      void
+      NumberCache
       ParallelDistributed<dim, spacedim>::
       distribute_dofs (DoFHandler<dim,spacedim> &dof_handler,
-                          NumberCache &number_cache) const
+                          NumberCache &number_cache_current) const
       {
+        NumberCache number_cache;
 
 #ifndef DEAL_II_WITH_P4EST
         (void)dof_handler;
@@ -2184,6 +2190,7 @@ namespace internal
 #endif // DEBUG
 #endif // DEAL_II_WITH_P4EST
 
+        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.