From 973a152be3777ddc6c5e9a5b403833eb91445624 Mon Sep 17 00:00:00 2001
From: "Jayesh Badwaik (FZ Juelich)" <j.badwaik@fz-juelich.de>
Date: Mon, 5 Jun 2023 21:59:50 +0200
Subject: [PATCH] - more fixes

---
 src/cpp/include/zell/io/vtk/ugrid/scalar_data.hpp  | 3 +++
 src/cpp/include/zell/io/vtk/ugrid/scalar_value.hpp | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/src/cpp/include/zell/io/vtk/ugrid/scalar_data.hpp b/src/cpp/include/zell/io/vtk/ugrid/scalar_data.hpp
index 432549d..8859ec0 100644
--- a/src/cpp/include/zell/io/vtk/ugrid/scalar_data.hpp
+++ b/src/cpp/include/zell/io/vtk/ugrid/scalar_data.hpp
@@ -114,6 +114,9 @@ scalar_data<F, Alloc>::scalar_data(
   value_array_(nelement, alloc),
   field_array_(nelement * ncomponent, alloc)
 {
+  for (std::size_t i = 0; i < nelement; ++i) {
+    value_array_[i] = value_type(ncomponent, &field_array_[i * ncomponent]);
+  }
 }
 
 template <typename F, typename Alloc>
diff --git a/src/cpp/include/zell/io/vtk/ugrid/scalar_value.hpp b/src/cpp/include/zell/io/vtk/ugrid/scalar_value.hpp
index 4c73b89..171110e 100644
--- a/src/cpp/include/zell/io/vtk/ugrid/scalar_value.hpp
+++ b/src/cpp/include/zell/io/vtk/ugrid/scalar_value.hpp
@@ -56,6 +56,12 @@ private:
   field_type* begin_;
   field_type* end_;
 };
+
+template <typename F>
+scalar_value<F>::scalar_value(std::size_t ncomp, field_type* begin)
+: begin_{begin}, end_{begin + ncomp}
+{
+}
 } // namespace zell::io::vtk::ugrid
 
 #endif // ZELL_IO_VTK_UGRID_SCALAR_VALUE_HPP
-- 
GitLab