From 9079b697e54b70265a400600499411abac953527 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 7 Aug 2014 13:07:45 +0200 Subject: [PATCH] Fix instantiation issue with FlatManifold properly This commit reverts the quick fix in commit 982b0683. This commit closes #56 The issue why we encountered unresolved references to dealii::FlatManifold<3, 2>::FlatManifold(dealii::Point<2, double>, double) etc. was due to boilerplate instantiations of Triangulation::get_manifold for cases with spacedim < dim (in order to make TriaAccessor happy). This commit fixes the issue by using a nullptr-dereference in order to return an invalid object - the specific code throws an error message before that and should actually not be reachable at all. --- source/grid/manifold.inst.in | 2 ++ source/grid/tria.cc | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/source/grid/manifold.inst.in b/source/grid/manifold.inst.in index a611e2c510..164e479df2 100644 --- a/source/grid/manifold.inst.in +++ b/source/grid/manifold.inst.in @@ -18,12 +18,14 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { +#if deal_II_dimension <= deal_II_space_dimension template class Manifold; template class FlatManifold; template class ManifoldChart; template class ManifoldChart; template class ManifoldChart; +#endif } diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 8169c5952a..ff37b0787e 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -13292,22 +13292,31 @@ Triangulation::remove_refinement_listener (RefinementListener &li template <> const Manifold<2,1> & Triangulation<2, 1>::get_manifold(const types::manifold_id) const { Assert(false, ExcImpossibleInDim(1)); - static FlatManifold<2,1> flat; - return flat; + // We cannot simply create a temporary Manifold<2,1> because it is not + // instantiated and would lead to unresolved symbols. Given the fact that + // this function should be unreachable anyaway, just dereference a + // nullptr: + return *static_cast*>(0); } template <> const Manifold<3,1> & Triangulation<3, 1>::get_manifold(const types::manifold_id) const { Assert(false, ExcImpossibleInDim(1)); - static FlatManifold<3,1> flat; - return flat; + // We cannot simply create a temporary Manifold<2,1> because it is not + // instantiated and would lead to unresolved symbols. Given the fact that + // this function should be unreachable anyaway, just dereference a + // nullptr: + return *static_cast*>(0); } template <> const Manifold<3,2> & Triangulation<3, 2>::get_manifold(const types::manifold_id) const { Assert(false, ExcImpossibleInDim(2)); - static FlatManifold<3,2> flat; - return flat; + // We cannot simply create a temporary Manifold<2,1> because it is not + // instantiated and would lead to unresolved symbols. Given the fact that + // this function should be unreachable anyaway, just dereference a + // nullptr: + return *static_cast*>(0); } // explicit instantiations -- 2.39.5