2#include <wmtk/TetMesh.h>
4#include <wmtk/io/tagged_mesh_data.hpp>
6namespace wmtk::components::topological_offset {
7template <
typename Mesh>
8void collect_memory_output(
10 io::ComponentIO& context,
11 io::OutputKeys keys = io::default_output_keys())
14 if constexpr (!std::is_base_of_v<TetMesh, Mesh>) keys[
"mesh_surf.vtu"] =
"";
16 mesh.write_vtu(
"mesh", &raw);
22 raw.erase(
"mesh_stencil.vtu");
23 if constexpr (std::is_base_of_v<TetMesh, Mesh>) io::compact_slot_outputs(mesh, raw);
24 context.result.first = io::named_outputs(std::move(raw), keys);
25 auto& data = context.result.first.at(
"mesh");
26 if constexpr (std::is_base_of_v<TetMesh, Mesh>) {
30 CellType::Tetrahedron,
32 [&](
const auto& t) ->
const auto& { return mesh.m_tet_attribute[t.tid(mesh)].tag; });
33 io::collect_face_tags(mesh, context.result.first, mesh.m_face_tag_names);
40 [&](
const auto& t) ->
const auto& { return mesh.m_face_attribute[t.fid(mesh)].tags; });
42 if (mesh.m_offset_params.save_offset_correspondence) {
43 const auto ids = data.vertex_attributes.at(
"vid").integers();
44 DataMatrix<int64_t> correspondence(data.V.rows(), 1);
45 for (Eigen::Index i = 0; i < ids.rows(); ++i)
46 correspondence(i, 0) = mesh.m_vertex_extra[ids(i, 0)].m_corr_input_vid;
47 data.vertex_attributes[
"corr_input_vid"].values = std::move(correspondence);
48 data.vertex_attributes[
"vid"].values = ids;
50 if (mesh.m_has_envelope) {
51 context.result.first[
"envelope"] = io::geometry_data(
54 std::is_base_of_v<TetMesh, Mesh> ? CellType::Triangle : CellType::Edge);