Skip to content
Snippets Groups Projects
Commit da288356 authored by Tobias Leibner's avatar Tobias Leibner
Browse files

[grid.boundaryinfo.normalbased] fix compilation failure, add global instances

parent 53f38705
No related branches found
No related tags found
No related merge requests found
...@@ -163,13 +163,13 @@ public: ...@@ -163,13 +163,13 @@ public:
if (XT::Common::FloatCmp::eq(existing_normal, normalized_normal, tol_)) if (XT::Common::FloatCmp::eq(existing_normal, normalized_normal, tol_))
DUNE_THROW(InvalidStateException, "Given normals are too close for given tolerance '" << tol_ << "'!"); DUNE_THROW(InvalidStateException, "Given normals are too close for given tolerance '" << tol_ << "'!");
} }
normal_to_type_map_.emplace(normal, std::move(boundary_type)); normal_to_type_map_.emplace(normal, std::shared_ptr<BoundaryType>(std::move(boundary_type)));
} // ... void register_new_normal(...) } // ... void register_new_normal(...)
const BoundaryType& type(const IntersectionType& intersection) const override final const BoundaryType& type(const IntersectionType& intersection) const override final
{ {
if (!intersection.boundary()) if (!intersection.boundary())
return no_boundary_; return no_boundary;
const WorldType outer_normal = intersection.centerUnitOuterNormal(); const WorldType outer_normal = intersection.centerUnitOuterNormal();
for (const auto& normal_and_type_pair : normal_to_type_map_) { for (const auto& normal_and_type_pair : normal_to_type_map_) {
const auto& normal = normal_and_type_pair.first; const auto& normal = normal_and_type_pair.first;
...@@ -183,7 +183,6 @@ public: ...@@ -183,7 +183,6 @@ public:
private: private:
const DomainFieldType tol_; const DomainFieldType tol_;
const std::unique_ptr<BoundaryType> default_boundary_type_; const std::unique_ptr<BoundaryType> default_boundary_type_;
const NoBoundary no_boundary_;
std::unordered_map<WorldType, std::shared_ptr<BoundaryType>> normal_to_type_map_; std::unordered_map<WorldType, std::shared_ptr<BoundaryType>> normal_to_type_map_;
}; // class NormalBasedBoundaryInfo }; // class NormalBasedBoundaryInfo
#if (defined(BOOST_CLANG) && BOOST_CLANG) || (defined(BOOST_GCC) && BOOST_GCC) #if (defined(BOOST_CLANG) && BOOST_CLANG) || (defined(BOOST_GCC) && BOOST_GCC)
......
...@@ -196,7 +196,7 @@ public: ...@@ -196,7 +196,7 @@ public:
#endif #endif
static BoundaryType* make_boundary_type(const std::string& id) static inline BoundaryType* make_boundary_type(const std::string& id)
{ {
if (id == NoBoundary().id()) if (id == NoBoundary().id())
return new NoBoundary(); return new NoBoundary();
...@@ -227,6 +227,12 @@ static BoundaryType* make_boundary_type(const std::string& id) ...@@ -227,6 +227,12 @@ static BoundaryType* make_boundary_type(const std::string& id)
} // ... make_boundary_type(...) } // ... make_boundary_type(...)
static constexpr AbsorbingBoundary absorbing_boundary{};
static constexpr DirichletBoundary dirichlet_boundary{};
static constexpr NoBoundary no_boundary{};
static constexpr ReflectingBoundary reflecting_boundary{};
} // namespace Grid } // namespace Grid
} // namespace XT } // namespace XT
} // namespace Dune } // namespace Dune
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment