18 const std::filesystem::path& file,
19 const std::string& position_attr_name)
23 if (file.extension().empty()) {
24 assert(!position_attr_name.empty());
25 std::array<bool, 4> out = {{
false,
false,
false,
false}};
29 ParaviewWriter writer(file, position_attr_name, mesh, out[0], out[1], out[2], out[3]);
31 }
else if (file.extension() ==
".hdf5") {
34 throw std::runtime_error(std::string(
"Unknown file type: ") + file.string());
39 const std::filesystem::path& file,
43 output(mesh, file, attr_name);
59 if (opts.
type ==
".vtu") {
62 std::string name = std::visit([](
const auto& v) -> std::string{
63 using T = std::decay_t<decltype(v)>;
64 if constexpr(std::is_same_v<T,std::string>) {
66 }
else if constexpr(std::is_same_v<T,wmtk::attribute::MeshAttributeHandle>) {
70 std::array<bool, 4> out = {{
false,
false,
false,
false}};
76 }
else if (opts.
type ==
".hdf5") {
79 throw std::runtime_error(
80 fmt::format(
"Unable to write file [{}] of extension [{}]",
92 std::ofstream ofs(path);
void serialize(MeshWriter &writer, const Mesh *local_root=nullptr) const
int64_t top_cell_dimension() const
std::string get_attribute_name(const TypedAttributeHandle< T > &handle) const
auto as() const -> const held_handle_type< held_type_from_primitive< T >()> &
std::unique_ptr< nlohmann::json > get_names_json() const
void output_hdf5(const Mesh &mesh, const std::filesystem::path &file)
Write the mesh to file.
void output(const Mesh &mesh, const std::filesystem::path &file, const std::string &position_attr_name)
Write the mesh to file.
spdlog::logger & logger()
Retrieves the current logger.
std::filesystem::path file
std::optional< std::filesystem::path > mesh_name_path
std::variant< wmtk::attribute::MeshAttributeHandle, std::string > position_attribute