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

[boundaryinfo.normalbased] add reflecting boundaries

parent 92f41eb1
No related branches found
No related tags found
No related merge requests found
...@@ -98,6 +98,30 @@ public: ...@@ -98,6 +98,30 @@ public:
} }
} // NormalBased(...) } // NormalBased(...)
NormalBasedBoundaryInfo(const std::vector<WorldType> dirichlet_normals,
const std::vector<WorldType> neumann_normals,
const std::vector<WorldType> reflecting_normals,
const DomainFieldType tol = 1e-10)
: NormalBasedBoundaryInfo(true, dirichlet_normals, neumann_normals, tol)
{
reflecting_normals_ = reflecting_normals;
// normalize
for (auto& normal : reflecting_normals_)
normal /= normal.two_norm();
// sanity checks
for (auto& dirichletNormal : dirichlet_normals_) {
if (contains(dirichletNormal, reflecting_normals_))
DUNE_THROW(Common::Exceptions::wrong_input_given,
"Given normals are too close for given tolerance '" << tol << "'!");
}
for (auto& neumannNormal : neumann_normals_) {
if (contains(neumannNormal, reflecting_normals_))
DUNE_THROW(Common::Exceptions::wrong_input_given,
"Given normals are too close for given tolerance '" << tol << "'!");
}
} // NormalBased(...)
virtual const BoundaryType& type(const IntersectionType& intersection) const override final virtual const BoundaryType& type(const IntersectionType& intersection) const override final
{ {
if (!intersection.boundary()) if (!intersection.boundary())
...@@ -107,6 +131,8 @@ public: ...@@ -107,6 +131,8 @@ public:
return dirichlet_boundary_; return dirichlet_boundary_;
else if (contains(outerNormal, neumann_normals_)) else if (contains(outerNormal, neumann_normals_))
return neumann_boundary_; return neumann_boundary_;
else if (contains(outerNormal, reflecting_normals_))
return reflecting_boundary_;
else else
return dirichlet_boundary_; return dirichlet_boundary_;
} // ... type(...) } // ... type(...)
...@@ -142,10 +168,12 @@ protected: ...@@ -142,10 +168,12 @@ protected:
const bool default_to_dirichlet_; const bool default_to_dirichlet_;
std::vector<WorldType> dirichlet_normals_; std::vector<WorldType> dirichlet_normals_;
std::vector<WorldType> neumann_normals_; std::vector<WorldType> neumann_normals_;
std::vector<WorldType> reflecting_normals_;
const DomainFieldType tol_; const DomainFieldType tol_;
static constexpr NoBoundary no_boundary_{}; static constexpr NoBoundary no_boundary_{};
static constexpr DirichletBoundary dirichlet_boundary_{}; static constexpr DirichletBoundary dirichlet_boundary_{};
static constexpr NeumannBoundary neumann_boundary_{}; static constexpr NeumannBoundary neumann_boundary_{};
static constexpr ReflectingBoundary reflecting_boundary_{};
}; // 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)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
...@@ -157,6 +185,8 @@ template <class I> ...@@ -157,6 +185,8 @@ template <class I>
constexpr DirichletBoundary NormalBasedBoundaryInfo<I>::dirichlet_boundary_; constexpr DirichletBoundary NormalBasedBoundaryInfo<I>::dirichlet_boundary_;
template <class I> template <class I>
constexpr NeumannBoundary NormalBasedBoundaryInfo<I>::neumann_boundary_; constexpr NeumannBoundary NormalBasedBoundaryInfo<I>::neumann_boundary_;
template <class I>
constexpr ReflectingBoundary NormalBasedBoundaryInfo<I>::reflecting_boundary_;
template <class I> template <class I>
......
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