From 9d4b5ea1647b7ce8b15c77f101480f3d5c1c2fd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de>
Date: Sun, 15 Apr 2018 11:56:59 +0200
Subject: [PATCH] [boxinterfaceparams] add assertion

---
 dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh b/dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh
index 7a1905049f..62c56fdd82 100644
--- a/dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh
+++ b/dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh
@@ -73,6 +73,7 @@ public:
             DUNE_THROW(Dune::InvalidStateException, "Determination of the interface material parameters with "
                                                     "this class only makes sense when using the box method!");
 
+        isUpdated_ = true;
         isOnMaterialInterface_.resize(fvGridGeometry.numDofs(), false);
         dofParams_.resize(fvGridGeometry.numDofs(), nullptr);
         for (const auto& element : elements(fvGridGeometry.gridView()))
@@ -106,14 +107,15 @@ public:
     //! Return if this scv is connected to a material interface
     template<class Scv>
     bool isOnMaterialInterface(const Scv& scv) const
-    { return isOnMaterialInterface_[scv.dofIndex()]; }
+    { assert(isUpdated_); return isOnMaterialInterface_[scv.dofIndex()]; }
 
     //! Return the material parameters associated with the dof
     template<class Scv>
     const MaterialLawParams& getDofParams(const Scv& scv) const
-    { return *(dofParams_[scv.dofIndex()]); }
+    { assert(isUpdated_); return *(dofParams_[scv.dofIndex()]); }
 
 private:
+    bool isUpdated_{false};
     std::vector<bool> isOnMaterialInterface_;
     std::vector<const MaterialLawParams*> dofParams_;
 };
-- 
GitLab