From 4392406a1b737987e2e8cfaffd31fe37116a90b7 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 30 Apr 2025 20:21:03 +0200 Subject: wip vtk tests --- c++/write_vtk.hpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'c++') diff --git a/c++/write_vtk.hpp b/c++/write_vtk.hpp index 3a2bd68..3e417f8 100644 --- a/c++/write_vtk.hpp +++ b/c++/write_vtk.hpp @@ -26,7 +26,7 @@ struct lbm_vtk_writer...>> { template struct lbm_vtk_writer> { - static saw::error_or apply(std::ofstream& vtk_file, std::string_view name){ + static saw::error_or apply(std::ostream& vtk_file, std::string_view name){ vtk_file<<"VECTORS "<> { template struct lbm_vtk_writer...>>> { template - saw::error_or write_i_iterate_d(std::ofstream& vtk_file, const saw::data...>>>& field, saw::data>& index){ + saw::error_or write_i_iterate_d(std::ostream& vtk_file, const saw::data...>>>& field, saw::data>& index){ if constexpr (Dep == Desc::D){ } } template - saw::error_or write_i(std::ofstream& vtk_file, const saw::data...>>>& field){ + saw::error_or write_i(std::ostream& vtk_file, const saw::data...>>>& field){ auto meta = field.meta(); saw::data> index; @@ -59,7 +59,7 @@ struct lbm_vtk_writer - saw::error_or iterate_i(std::ofstream& vtk_file, const saw::data...>>>& field){ + saw::error_or iterate_i(std::ostream& vtk_file, const saw::data...>>>& field){ { auto eov = write_i(vtk_file, field); if(eov.is_error()){ @@ -72,8 +72,17 @@ struct lbm_vtk_writer apply(std::ofstream& vtk_file, + saw::error_or apply(std::ostream& vtk_file, const saw::data...>>>& field){ + + vtk_file + <<"# vtk DataFile Version 3.0\n" + <<"LBM File\n" + <<"ASCII\n" + <<"DATASET STRUCTURED POINTS\n" + <<"SPACING 1.0 1.0 1.0\n" + <<"ORIGIN 0.0 0.0 0.0\n" + ; auto meta = field.meta(); saw::data pd_size{1u}; @@ -120,15 +129,6 @@ saw::error_or write_vtk(const std::string_view file_name, const saw::data< return saw::make_error("Could not open file."); } - vtk_file - <<"# vtk DataFile Version 3.0\n" - <<"LBM File\n" - <<"ASCII\n" - <<"DATASET STRUCTURED POINTS\n" - <<"SPACING 1.0 1.0 1.0\n" - <<"ORIGIN 0.0 0.0 0.0\n" - ; - auto eov = impl::lbm_vtk_writer::apply(vtk_file, field); return eov; -- cgit v1.2.3