diff --git a/MeshLib/IO/XDMF/MeshPropertyDataType.h b/MeshLib/IO/XDMF/MeshPropertyDataType.h index ddfe135dd226a31e055b18fd0bd2db8d1e852224..bee2efdf5044743b12ac5f5eb274a38f60dc3c9a 100644 --- a/MeshLib/IO/XDMF/MeshPropertyDataType.h +++ b/MeshLib/IO/XDMF/MeshPropertyDataType.h @@ -27,4 +27,14 @@ enum class MeshPropertyDataType char_native, uchar, enum_length +}; + + +// See https://www.xdmf.org/index.php/XDMF_Model_and_Format - only relevant of +// TopologyType(s) added, structure is open to be extended with GridType(s) +// and ItemType(s). +enum class ParentDataType +{ + Polyvertex=0, + Mixed, }; \ No newline at end of file diff --git a/MeshLib/IO/XDMF/XdmfData.cpp b/MeshLib/IO/XDMF/XdmfData.cpp index c3473970a25e299f20f0ee8ea44d306f11583fcf..d1aa37793ee7a19219a3edf1987ccd9336d27e54 100644 --- a/MeshLib/IO/XDMF/XdmfData.cpp +++ b/MeshLib/IO/XDMF/XdmfData.cpp @@ -24,7 +24,8 @@ XdmfData::XdmfData(std::size_t const size_partitioned_dim, std::string const& name, std::optional<MeshLib::MeshItemType> const attribute_center, unsigned int const index, - unsigned int const n_files) + unsigned int const n_files, + std::optional<ParentDataType> const parent_data_type) : starts( [&size_tuple]() { @@ -52,7 +53,8 @@ XdmfData::XdmfData(std::size_t const size_partitioned_dim, data_type(mesh_property_data_type), name(name), attribute_center(attribute_center), - index(index) + index(index), + parent_data_type(parent_data_type) { auto partition_info = getPartitionInfo(size_partitioned_dim, n_files); // TODO (tm) XdmfLib does not support 64 bit data types so far diff --git a/MeshLib/IO/XDMF/XdmfData.h b/MeshLib/IO/XDMF/XdmfData.h index b44a59e4dade28f82a8233e6ce0a8ed236201ec1..273d0d4a44bb6505fafc9d9663b0c6fa7c096c9c 100644 --- a/MeshLib/IO/XDMF/XdmfData.h +++ b/MeshLib/IO/XDMF/XdmfData.h @@ -48,13 +48,15 @@ struct XdmfData final * Geometry, 3=Topology, 4>=Attribute * @param n_files specifies the number of files. If greater than 1 it groups * the data of each process to n_files - * + * @param parent_data_type specifies the type of the parent structure + * (e.g. Topology, DataItem, Grid) */ XdmfData(std::size_t size_partitioned_dim, std::size_t size_tuple, MeshPropertyDataType mesh_property_data_type, std::string const& name, std::optional<MeshLib::MeshItemType> attribute_center, - unsigned int const index, unsigned int n_files); + unsigned int const index, unsigned int n_files, + std::optional<ParentDataType> parent_data_type); // a hyperslab is defined by starts and strides see // https://xdmf.org/index.php/XDMF_Model_and_Format#HyperSlab std::vector<XdmfDimType> starts; @@ -64,6 +66,7 @@ struct XdmfData final std::string name; std::optional<MeshLib::MeshItemType> attribute_center; unsigned int index; + std::optional<ParentDataType> parent_data_type; }; } // namespace MeshLib::IO diff --git a/MeshLib/IO/XDMF/writeXdmf.cpp b/MeshLib/IO/XDMF/writeXdmf.cpp index c1b1bed1815749db3ad09ef50f3ac5e1571d5577..ce0a490ad041c1f5a49c23169c11865dea558d35 100644 --- a/MeshLib/IO/XDMF/writeXdmf.cpp +++ b/MeshLib/IO/XDMF/writeXdmf.cpp @@ -205,7 +205,8 @@ std::function<std::string(std::vector<double>)> write_xdmf( { return fmt::format( fmt::runtime("\n\t<Topology Dimensions=\"{dimensions}\" " - "Type=\"Mixed\">{dataitem}\n\t</Topology>"), + "Type={topology_type}>{dataitem}\n\t</Topology>"), + "topology_type"_a = "Mixed", "dataitem"_a = dataitem_transform(topology), "dimensions"_a = fmt::join(topology.global_block_dims, " ")); };