From c921c91a07574704c2c3dffa65ad1ac5e1ea6856 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 7 Mar 2006 05:41:07 +0000 Subject: [PATCH] Work around a possible problem with the ordering of constructor calls to ::StaticMappingQ1 and hp::StaticMappingQ1. git-svn-id: https://svn.dealii.org/trunk@12546 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/fe/mapping_collection.h | 24 +++++++++++++++++-- .../deal.II/source/fe/mapping_collection.cc | 8 ++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/deal.II/deal.II/include/fe/mapping_collection.h b/deal.II/deal.II/include/fe/mapping_collection.h index 2a3da26b74..e1bc9eda17 100644 --- a/deal.II/deal.II/include/fe/mapping_collection.h +++ b/deal.II/deal.II/include/fe/mapping_collection.h @@ -134,12 +134,32 @@ namespace hp /** * In order to avoid creation of static MappingQ1 objects at several * places in the library (in particular in backward compatibility - * functions), we define a static MappingQ1 objects once and for all - * places where it is needed. + * functions), we define a static collection of mappings with a single + * MappingQ1 mapping object once and for all places where it is + * needed. */ template struct StaticMappingQ1 { + private: + /** + * A static MappingQ1 + * object. We can't use the one + * in ::StaticMappingQ1 since + * we can't make sure that the + * constructor for that object + * is run before the + * constructor for the present + * static object. + */ + static MappingQ1 mapping_q1; + + public: + /** + * The publicly available + * static Q1 mapping collection + * object. + */ static MappingCollection mapping_collection; }; diff --git a/deal.II/deal.II/source/fe/mapping_collection.cc b/deal.II/deal.II/source/fe/mapping_collection.cc index f001b536dd..8f0a99dc27 100644 --- a/deal.II/deal.II/source/fe/mapping_collection.cc +++ b/deal.II/deal.II/source/fe/mapping_collection.cc @@ -76,10 +76,16 @@ namespace hp //--------------------------------------------------------------------------- + + template + MappingQ1 + StaticMappingQ1::mapping_q1; + + template MappingCollection StaticMappingQ1::mapping_collection - = MappingCollection(::StaticMappingQ1::mapping); + = MappingCollection(mapping_q1); // explicit instantiations template class MappingCollection; -- 2.39.5