From: denis.davydov Date: Fri, 21 Mar 2014 18:42:53 +0000 (+0000) Subject: fixed a bug of calling get_subdomain_association before DoFHandler is initialized. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df7d011a23c8b84b0b3019f409e4e7185df8beef;p=dealii-svn.git fixed a bug of calling get_subdomain_association before DoFHandler is initialized. git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32682 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/dofs/dof_handler.cc b/deal.II/source/dofs/dof_handler.cc index a87e4fcb04..32cd024bff 100644 --- a/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/source/dofs/dof_handler.cc @@ -810,6 +810,11 @@ DoFHandler::initialize( // decide whether we need a // sequential or a parallel // distributed policy + if (dynamic_cast*> + (&t) + != 0) + policy.reset (new internal::DoFHandler::Policy::ParallelShared()); + else if (dynamic_cast*> (&t) == 0) @@ -1169,6 +1174,10 @@ void DoFHandler::distribute_dofs (const FiniteElementdistribute_dofs (*this); + //since get_subdomain_association querry n_dofs() + //the need to re-work locally_owned_dofs outside of policy class + if (dynamic_cast*>(&*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 diff --git a/deal.II/source/dofs/dof_handler_policy.cc b/deal.II/source/dofs/dof_handler_policy.cc index da667b0400..eb755a5758 100644 --- a/deal.II/source/dofs/dof_handler_policy.cc +++ b/deal.II/source/dofs/dof_handler_policy.cc @@ -970,8 +970,6 @@ namespace internal distribute_dofs (DoFHandler &dof_handler) const { NumberCache number_cache = Sequential::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; } diff --git a/deal.II/source/dofs/dof_tools.cc b/deal.II/source/dofs/dof_tools.cc index a2ac1ad4b6..e949c226a5 100644 --- a/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/source/dofs/dof_tools.cc @@ -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);