From 6990d8ed88a3df7c89d576947fb563e62405f202 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de>
Date: Thu, 28 Sep 2023 14:17:03 +0200
Subject: [PATCH] [timeloop] allow periodic or manual checkpoints exclusively

---
 dumux/common/timeloop.hh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dumux/common/timeloop.hh b/dumux/common/timeloop.hh
index efcbbd4693..cfcce2cb47 100644
--- a/dumux/common/timeloop.hh
+++ b/dumux/common/timeloop.hh
@@ -499,6 +499,9 @@ public:
      */
     void setPeriodicCheckPoint(Scalar interval, Scalar offset = 0.0)
     {
+        if (!checkPoints_.empty())
+            DUNE_THROW(Dune::NotImplemented, "Cannot use periodic check points while manually inserted ones are still pending.");
+
         using std::signbit;
         if (signbit(interval))
             DUNE_THROW(Dune::InvalidStateException, "Interval has to be positive!");
@@ -574,6 +577,9 @@ public:
     template<class ForwardIterator>
     void setCheckPoint(ForwardIterator first, ForwardIterator last)
     {
+        if (periodicCheckPoints_)
+            DUNE_THROW(Dune::NotImplemented, "Checkpoints cannot be manually inserted when using periodic ones.");
+
         // set the check points
         for (; first != last; ++first)
             setCheckPoint_(*first);
-- 
GitLab