From: Wolfgang Bangerth Date: Thu, 6 Jul 2017 19:38:11 +0000 (-0600) Subject: Simplify logic a bit. X-Git-Tag: v9.0.0-rc1~1427^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f73e497830cf559bc703729e873b1268529e88cc;p=dealii.git Simplify logic a bit. In particular, do not follow an if-statement that tests '!=null_ptr' by one that tests '==null_ptr' since this is almost impossible to understand at a short glance. --- diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index cea077c60b..f4d3a20b26 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -699,19 +699,13 @@ initialize(const Triangulation &t, faces = nullptr; number_cache.n_global_dofs = 0; - // decide whether we need a - // sequential or a parallel - // distributed policy - if (dynamic_cast*> - (&t) - != nullptr) + // decide whether we need a sequential or a parallel distributed policy + if (dynamic_cast*> (&t) != nullptr) policy.reset (new internal::DoFHandler::Policy::ParallelShared >(*this)); - else if (dynamic_cast*> - (&t) - == nullptr) - policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); - else + else if (dynamic_cast*> (&t) != nullptr) policy.reset (new internal::DoFHandler::Policy::ParallelDistributed(*this)); + else + policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); distribute_dofs(fe); } diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index abe9c915bd..344c71a31c 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -1095,17 +1095,15 @@ namespace hp "this class does not currently support this.")); // decide whether we need a sequential or a parallel distributed policy -// if (dynamic_cast*> -// (&tria) -// != nullptr) -// policy.reset (new internal::DoFHandler::Policy::ParallelShared(*this)); -// else if (dynamic_cast*> -// (&tria) -// == nullptr) - policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); -// else -// policy.reset (new internal::DoFHandler::Policy::ParallelDistributed(*this)); - + if (dynamic_cast*> (&*this->tria) != nullptr) + policy.reset (new internal::DoFHandler::Policy::ParallelShared >(*this)); + else if (dynamic_cast*> (&*this->tria) != nullptr) + //policy.reset (new internal::DoFHandler::Policy::ParallelDistributed(*this)); + { + Assert (false, ExcNotImplemented()); + } + else + policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); create_active_fe_table (); @@ -1588,10 +1586,6 @@ namespace hp ///////////////////////////////// - Assert ((dynamic_cast*> - (&this->get_triangulation()) - == nullptr), - ExcNotImplemented()); Assert ((dynamic_cast*> (&this->get_triangulation()) == nullptr),