From 8a3c33e0f49be28472b9e793f65d025543f7a749 Mon Sep 17 00:00:00 2001
From: Felix Schindler <felix.schindler@wwu.de>
Date: Tue, 27 Aug 2019 13:44:36 +0200
Subject: [PATCH] [local.fe] add check and not to FlatTop

---
 dune/gdt/local/finite-elements/default.hh | 2 +-
 dune/gdt/local/finite-elements/flattop.hh | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dune/gdt/local/finite-elements/default.hh b/dune/gdt/local/finite-elements/default.hh
index afcc6eabd..f84c836d9 100644
--- a/dune/gdt/local/finite-elements/default.hh
+++ b/dune/gdt/local/finite-elements/default.hh
@@ -180,7 +180,7 @@ public:
     // TODO: Double checked locking pattern is not thread-safe without memory barriers.
     if (fes_.count(key) == 0) {
       // the FE needs to be created, we need to lock
-      std::lock_guard<std::mutex> DXTC_UNUSED(guard)(mutex_);
+      std::lock_guard<std::mutex> DXTC_UNUSED(guard){mutex_};
       // and to check again if someone else created the FE while we were waiting to acquire the lock
       if (fes_.count(key) == 0)
         fes_[key] = factory_(geometry_type, order);
diff --git a/dune/gdt/local/finite-elements/flattop.hh b/dune/gdt/local/finite-elements/flattop.hh
index 8d7723d54..da54091a0 100644
--- a/dune/gdt/local/finite-elements/flattop.hh
+++ b/dune/gdt/local/finite-elements/flattop.hh
@@ -24,6 +24,9 @@ namespace GDT {
 
 
 /**
+ * Inspired by [Brenner, Davis, Sung, 2014, A partition of unity method for the displacement obstacle problem of clamped
+ *              Kirchhoff plates], section 2
+ *
  * \sa LocalFlatTop2dCubeFiniteElement
  * \sa LocalFlatTopFiniteElementFactory
  */
@@ -41,6 +44,9 @@ public:
   LocalFlatTop2dCubeFiniteElementBasis(const double& overlap = 0.5)
     : geometry_type_(Dune::GeometryTypes::cube(2))
   {
+    DUNE_THROW_IF(
+        !(overlap > 0.), Exceptions::finite_element_error, "Overlap has to be in (0, 1], is " << overlap << "!");
+    DUNE_THROW_IF(overlap > 1., Exceptions::finite_element_error, "Overlap has to be in (0, 1], is " << overlap << "!");
     // we cannot let L_ and R_ be members and define phi_L_ and phi_R_ in the ctor initializer list, as they will
     // copy/reference broken/empty/default L_ and R_
     const auto L_ = (1. - overlap) / 2.;
-- 
GitLab