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 432549d52f3b6777805c28d550c960ce8a1f2a5e..8859ec027d3babc3ae1d60edeae99fd6387b24e2 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 4c73b8910f3d4c228bddcadbea9a3666bc82c12a..171110ef46d0cac318ae87bd2fac026517fc0002 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