From 3ee0cea0b47346d9af4418166549a030b9293093 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 19 Nov 2013 16:40:27 +0000 Subject: [PATCH] rework r31702 git-svn-id: https://svn.dealii.org/trunk@31711 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/dofs/dof_handler.h | 32 +++++++++++++++++-- .../include/deal.II/dofs/dof_handler_policy.h | 22 ------------- deal.II/source/dofs/dof_handler_policy.cc | 17 +--------- 3 files changed, 30 insertions(+), 41 deletions(-) diff --git a/deal.II/include/deal.II/dofs/dof_handler.h b/deal.II/include/deal.II/dofs/dof_handler.h index a6a1d88142..aa3ac71149 100644 --- a/deal.II/include/deal.II/dofs/dof_handler.h +++ b/deal.II/include/deal.II/dofs/dof_handler.h @@ -1248,6 +1248,32 @@ DoFHandler::block_info () const } +namespace internal +{ + /** + * returns a string representing the dynamic type of the given argument. This is + * basically the same what typeid(...).name() does, but it turns out this is broken + * on Intel 13+. + */ + template + std::string policy_to_string(const dealii::internal::DoFHandler::Policy::PolicyBase & policy) + { + std::string policy_name; + if (dynamic_cast*>(&policy)) + policy_name = "Policy::Sequential<"; + else + if (dynamic_cast*>(&policy)) + policy_name = "Policy::ParallelDistributed<"; + else + AssertThrow(false, ExcNotImplemented()); + policy_name += Utilities::int_to_string(dim)+ + ","+Utilities::int_to_string(spacedim)+">"; + return policy_name; + } + +} + + template template void DoFHandler::save (Archive &ar, @@ -1264,7 +1290,7 @@ void DoFHandler::save (Archive &ar, // identifies the FE and the policy unsigned int n_cells = tria->n_cells(); std::string fe_name = selected_fe->get_name(); - std::string policy_name = policy->to_string(); + std::string policy_name = internal::policy_to_string(*policy); ar &n_cells &fe_name &policy_name; } @@ -1305,9 +1331,9 @@ void DoFHandler::load (Archive &ar, AssertThrow (fe_name == selected_fe->get_name(), ExcMessage ("The finite element associated with this DoFHandler does not match " "the one that was associated with the DoFHandler previously stored.")); - AssertThrow (policy_name == policy->to_string(), + AssertThrow (policy_name == internal::policy_to_string(*policy), ExcMessage (std::string ("The policy currently associated with this DoFHandler (") - + policy->to_string() + + internal::policy_to_string(*policy) +std::string(") does not match the one that was associated with the " "DoFHandler previously stored (") + policy_name diff --git a/deal.II/include/deal.II/dofs/dof_handler_policy.h b/deal.II/include/deal.II/dofs/dof_handler_policy.h index 39a07a544f..42eecf8afa 100644 --- a/deal.II/include/deal.II/dofs/dof_handler_policy.h +++ b/deal.II/include/deal.II/dofs/dof_handler_policy.h @@ -64,13 +64,6 @@ namespace internal */ virtual ~PolicyBase (); - /** - * Convert type of policy to a string. This is used as a - * workaround in serialization because the intel compiler can - * not handle typeid correctly. - */ - virtual std::string to_string () const = 0; - /** * Distribute degrees of freedom on * the object given as last argument. @@ -115,14 +108,6 @@ namespace internal virtual NumberCache distribute_dofs (dealii::DoFHandler &dof_handler) const; - - /** - * Convert type of policy to a string. This is used as a - * workaround in serialization because the intel compiler can - * not handle typeid correctly. - */ - virtual std::string to_string () const; - /** * Distribute multigrid DoFs. @@ -162,13 +147,6 @@ namespace internal NumberCache distribute_dofs (dealii::DoFHandler &dof_handler) const; - /** - * Convert type of policy to a string. This is used as a - * workaround in serialization because the intel compiler can - * not handle typeid correctly. - */ - virtual std::string to_string () const; - /** * Distribute multigrid DoFs. */ diff --git a/deal.II/source/dofs/dof_handler_policy.cc b/deal.II/source/dofs/dof_handler_policy.cc index 4e8a60fc77..3db4b2104a 100644 --- a/deal.II/source/dofs/dof_handler_policy.cc +++ b/deal.II/source/dofs/dof_handler_policy.cc @@ -866,16 +866,8 @@ namespace internal PolicyBase::~PolicyBase () {} - /* --------------------- class Sequential ---------------- */ - - template - std::string - Sequential::to_string () const - { - return "Policy::Sequential<"+Utilities::int_to_string(dim)+ - ","+Utilities::int_to_string(spacedim)+">"; - } + /* --------------------- class Sequential ---------------- */ template @@ -1934,13 +1926,6 @@ namespace internal #endif // DEAL_II_WITH_P4EST - template - std::string - ParallelDistributed::to_string () const - { - return "Policy::ParallelDistributed<"+Utilities::int_to_string(dim)+ - ","+Utilities::int_to_string(spacedim)+">"; - } template -- 2.39.5