From d6e2d808c4c2387f65f9d0de3431cb574d72da70 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 6 May 2025 14:04:39 +0200 Subject: Confused about the descriptors --- c++/write_vtk.hpp | 12 ++++++------ tests/vtk_write.cpp | 10 +++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/c++/write_vtk.hpp b/c++/write_vtk.hpp index 3e417f8..fec4ea5 100644 --- a/c++/write_vtk.hpp +++ b/c++/write_vtk.hpp @@ -19,7 +19,7 @@ struct lbm_vtk_writer { template struct lbm_vtk_writer...>> { - saw::error_or apply(){ + static saw::error_or apply(){ return saw::make_void(); } }; @@ -34,14 +34,14 @@ struct lbm_vtk_writer> { template struct lbm_vtk_writer...>>> { template - saw::error_or write_i_iterate_d(std::ostream& vtk_file, const saw::data...>>>& field, saw::data>& index){ + static 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::ostream& vtk_file, const saw::data...>>>& field){ + static 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::ostream& vtk_file, const saw::data...>>>& field){ + static 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,7 +72,7 @@ struct lbm_vtk_writer apply(std::ostream& vtk_file, + static saw::error_or apply(std::ostream& vtk_file, const saw::data...>>>& field){ vtk_file @@ -120,7 +120,7 @@ struct lbm_vtk_writer -saw::error_or write_vtk(const std::string_view file_name, const saw::data& field){ +saw::error_or write_vtk_file(const std::string_view file_name, const saw::data& field){ std::string vtk_file_name{file_name}; std::ofstream vtk_file{vtk_file_name}; diff --git a/tests/vtk_write.cpp b/tests/vtk_write.cpp index e12c33e..0fcc169 100644 --- a/tests/vtk_write.cpp +++ b/tests/vtk_write.cpp @@ -3,6 +3,7 @@ #include #include "../c++/write_vtk.hpp" +#include namespace { namespace sch { @@ -33,7 +34,14 @@ using CellStruct = Struct< SAW_TEST("VTK Write test example"){ using namespace kel; - write_vtk(); + // write_vtk(); + + std::stringstream sstream; + + saw::data>> cells; + + auto eov = lbm::impl::lbm_vtk_writer>>::apply(sstream, cells); + SAW_EXPECT(eov.is_value(), "vtk writer failed to write"); // using Type = typename parameter_pack_type::type; } -- cgit v1.2.3