Wildmeshing Toolkit
Loading...
Searching...
No Matches
TetVTUWriter.hpp
1#pragma once
2
3#include <wmtk/TetMesh.h>
4#include <filesystem>
5#include <functional>
6#include <map>
7#include <wmtk/Types.hpp>
8
9namespace wmtk::io {
10
12{
13private:
14 using Tuple = typename TetMesh::Tuple;
15
16public:
29 TetVTUWriter(const TetMesh& mesh);
30
38 void add_vertex_positions(const std::function<VectorXd(const size_t)>& f);
39
54 const std::string& name,
55 const std::function<VectorXd(const size_t)>& f);
62 const std::string& name,
63 const std::function<VectorXd(const size_t)>& f);
64
71 const std::string& name,
72 const std::function<VectorXd(const size_t)>& f);
73
79 void add_tet_attribute(const std::string& name, const std::function<VectorXd(const size_t)>& f);
80
86 bool write_tets(const std::filesystem::path& filename);
87
93 bool write_triangles(const std::filesystem::path& filename);
94
100 bool write_edges(const std::filesystem::path& filename);
101
102private:
103 const TetMesh& m_mesh;
104
105 MatrixXd m_V; // vertex positions
106 MatrixXi m_E; // edge - vids
107 MatrixXi m_F; // face - vids
108 MatrixXi m_T; // tet - vids
109
110 std::map<std::string, MatrixXd> m_V_attributes;
111 std::map<std::string, MatrixXd> m_E_attributes;
112 std::map<std::string, MatrixXd> m_F_attributes;
113 std::map<std::string, MatrixXd> m_T_attributes;
114};
115
116} // namespace wmtk::io
a Tuple refers to a global vid and a global tet id, and a local edge id and local face id
Definition TetMesh.h:49
Definition TetMesh.h:24
Definition TetVTUWriter.hpp:12
bool write_edges(const std::filesystem::path &filename)
Write the edge mesh with edge and vertex attributes.
Definition TetVTUWriter.cpp:171
void add_tet_attribute(const std::string &name, const std::function< VectorXd(const size_t)> &f)
Add tet attribute.
Definition TetVTUWriter.cpp:125
void add_vertex_positions(const std::function< VectorXd(const size_t)> &f)
Add vertex positions.
Definition TetVTUWriter.cpp:58
bool write_tets(const std::filesystem::path &filename)
Write the tet mesh with tet and vertex attributes.
Definition TetVTUWriter.cpp:143
bool write_triangles(const std::filesystem::path &filename)
Write the triangle mesh with triangle and vertex attributes.
Definition TetVTUWriter.cpp:157
void add_edge_attribute(const std::string &name, const std::function< VectorXd(const size_t)> &f)
Add edge attribute.
Definition TetVTUWriter.cpp:89
void add_vertex_attribute(const std::string &name, const std::function< VectorXd(const size_t)> &f)
Add vertex attribute.
Definition TetVTUWriter.cpp:71
void add_triangle_attribute(const std::string &name, const std::function< VectorXd(const size_t)> &f)
Add triangle attribute.
Definition TetVTUWriter.cpp:107