From c6efb5f0eab77965961ea682a5f0eead2c2d8b91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Mon, 19 Apr 2021 18:07:20 +0200
Subject: [PATCH] Add DiscreteFunctionP0::fill utility

---
 src/scheme/DiscreteFunctionP0.hpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/scheme/DiscreteFunctionP0.hpp b/src/scheme/DiscreteFunctionP0.hpp
index d41d98db9..a6ffc4cdd 100644
--- a/src/scheme/DiscreteFunctionP0.hpp
+++ b/src/scheme/DiscreteFunctionP0.hpp
@@ -50,6 +50,14 @@ class DiscreteFunctionP0 : public IDiscreteFunction
     return m_discrete_function_descriptor;
   }
 
+  PUGS_INLINE
+  void
+  fill(const DataType& data) const noexcept
+  {
+    static_assert(not std::is_const_v<DataType>, "Cannot modify ItemValue of const");
+    m_cell_values.fill(data);
+  }
+
   PUGS_FORCEINLINE
   DataType&
   operator[](const CellId cell_id) const noexcept(NO_ASSERT)
-- 
GitLab