]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
fixed a bug of calling get_subdomain_association before DoFHandler is initialized.
authordenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 21 Mar 2014 18:42:53 +0000 (18:42 +0000)
committerdenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 21 Mar 2014 18:42:53 +0000 (18:42 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32682 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/dofs/dof_handler.cc
deal.II/source/dofs/dof_handler_policy.cc
deal.II/source/dofs/dof_tools.cc

index a87e4fcb04866844335bc234822c50e5df2bbe60..32cd024bffd754464782409eef5abc939a86c698 100644 (file)
@@ -810,6 +810,11 @@ DoFHandler<dim,spacedim>::initialize(
   // decide whether we need a
   // sequential or a parallel
   // distributed policy
+  if (dynamic_cast<const parallel::shared::Triangulation< dim, spacedim>*>
+         (&t)
+         != 0)
+       policy.reset (new internal::DoFHandler::Policy::ParallelShared<dim,spacedim>());
+  else
   if (dynamic_cast<const parallel::distributed::Triangulation< dim, spacedim >*>
       (&t)
       == 0)
@@ -1169,6 +1174,10 @@ void DoFHandler<dim,spacedim>::distribute_dofs (const FiniteElement<dim,spacedim
   // hand things off to the policy
   number_cache = policy->distribute_dofs (*this);
 
+  //since get_subdomain_association querry n_dofs()
+  //the need to re-work locally_owned_dofs outside of policy class
+  if (dynamic_cast<const parallel::shared::Triangulation<dim,spacedim>*>(&*tria) == 0)
+         number_cache.locally_owned_dofs = dealii::DoFTools::locally_owned_dofs_with_subdomain(*this,(*this).get_tria().locally_owned_subdomain() );
   // initialize the block info object
   // only if this is a sequential
   // triangulation. it doesn't work
index da667b0400bc6f364c1e908334c3d6996e1ecfc1..eb755a5758c076f4725b83d7149252a3d8ed32d6 100644 (file)
@@ -970,8 +970,6 @@ namespace internal
       distribute_dofs (DoFHandler<dim,spacedim> &dof_handler) const
       {
          NumberCache number_cache = Sequential<dim,spacedim>::distribute_dofs (dof_handler);
-         //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;
       }
 
index a2ac1ad4b62bafec386469d6db47e0a8dcc0b13c..e949c226a5d497ab1c74a33151e4577c42db0b4c 100644 (file)
@@ -1115,6 +1115,9 @@ namespace DoFTools
            ExcDimensionMismatch(subdomain_association.size(),
                                 dof_handler.n_dofs()));
 
+    Assert(dof_handler.n_dofs() > 0,
+          ExcMessage("Number of DoF is not positive. "
+                             "This could happen when the function is called before NumberCache is written."));
     // preset all values by an invalid value
     std::fill_n (subdomain_association.begin(), dof_handler.n_dofs(),
                  numbers::invalid_subdomain_id);

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.