diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fluid_buffer.cc | 4 | ||||
-rw-r--r-- | src/fluid_buffer.h | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/fluid_buffer.cc b/src/fluid_buffer.cc index 1f40d2f..9291fdd 100644 --- a/src/fluid_buffer.cc +++ b/src/fluid_buffer.cc @@ -32,7 +32,9 @@ Velocity& FluidBuffer::velocity(Vector<std::size_t> pos) { return velocity(pos[0], pos[1]); } -void FluidBuffer::writeAsVTK(const std::string& path) { +void FluidBuffer::writeAsVTK(const std::filesystem::path& path) { + std::filesystem::create_directories(path.parent_path()); + std::ofstream fout; fout.open(path.c_str()); diff --git a/src/fluid_buffer.h b/src/fluid_buffer.h index 72518bb..b0e0936 100644 --- a/src/fluid_buffer.h +++ b/src/fluid_buffer.h @@ -2,6 +2,7 @@ #include <memory> #include <string> +#include <filesystem> #include "vector.h" @@ -28,5 +29,5 @@ public: Velocity& velocity(std::size_t x, std::size_t y); Velocity& velocity(Vector<std::size_t> pos); - void writeAsVTK(const std::string& path); + void writeAsVTK(const std::filesystem::path& path); }; |