From 6055052e1e7c7f8800aecd7b1b8a4650f7c6dee3 Mon Sep 17 00:00:00 2001 From: Bianca Giovanardi Date: Sun, 11 Jan 2026 15:36:28 +0100 Subject: [PATCH] io/summit: add possibility to include element type in {summit} mesh --- lib/mito/io/summit/MeshSummitWriter.h | 11 ++++++++--- lib/mito/io/summit/writer.h | 5 +++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/mito/io/summit/MeshSummitWriter.h b/lib/mito/io/summit/MeshSummitWriter.h index a4a0b3f96..c11016324 100644 --- a/lib/mito/io/summit/MeshSummitWriter.h +++ b/lib/mito/io/summit/MeshSummitWriter.h @@ -33,11 +33,13 @@ namespace mito::io { public: // constructor MeshSummitWriter( - std::string filename, const mesh_type & mesh, const coord_system_type & coord_system) : + std::string filename, const mesh_type & mesh, const coord_system_type & coord_system, + std::string element_type) : Writer(filename), _mesh(mesh), _coord_system(coord_system), - _points() + _points(), + _element_type(element_type) { // index assigned to each point (start counting from 1, summit mesh convention) auto index = 1; @@ -93,7 +95,7 @@ namespace mito::io { outfile << _points.at(node->point()) << " "; } // TOFIX: material label is always 1 for now - outfile << 1 << std::endl; + outfile << 1 << " " << _element_type << std::endl; } // close the file @@ -112,6 +114,9 @@ namespace mito::io { // a collection of points in the mesh points_type _points; + + // the type of element + std::string _element_type; }; } // namespace mito::io diff --git a/lib/mito/io/summit/writer.h b/lib/mito/io/summit/writer.h index ae5d04e3d..a5a3a3149 100644 --- a/lib/mito/io/summit/writer.h +++ b/lib/mito/io/summit/writer.h @@ -13,10 +13,11 @@ namespace mito::io::summit { requires(utilities::same_dim_c) auto writer( std::string filename, const mito::mesh::mesh_t & mesh, - const geometry::coordinate_system_t & coordinate_system) -> void + const geometry::coordinate_system_t & coordinate_system, + std::string element_type = "") -> void { // create a writer - auto mesh_writer = mesh_writer_t(filename, mesh, coordinate_system); + auto mesh_writer = mesh_writer_t(filename, mesh, coordinate_system, element_type); // write return mesh_writer.write(); }