This commit is contained in:
froejdh_e
2025-04-10 16:50:04 +02:00
parent 53a90e197e
commit 113f34cc98
6 changed files with 144 additions and 5 deletions

View File

@ -80,11 +80,12 @@ void define_cluster_vector(py::module &m, const std::string &typestr) {
self.push_back(cluster);
})
// implement push_back
.def_property_readonly("size", &ClusterVector<ClusterType>::size)
.def("item_size", &ClusterVector<ClusterType>::item_size)
.def_property_readonly("fmt",
[typestr]() { return fmt_format<ClusterType>; })
[typestr](ClusterVector<ClusterType> &self) { return fmt_format<ClusterType>; })
.def_property_readonly("cluster_size_x",
&ClusterVector<ClusterType>::cluster_size_x)

View File

@ -74,10 +74,10 @@ template <typename T, uint8_t ClusterSizeX, uint8_t ClusterSizeY,
struct fmt_format_trait<Cluster<T, ClusterSizeX, ClusterSizeY, CoordType>> {
static std::string value() {
return fmt::format("T{{{}:x;{}:y;{}:data;}}",
return fmt::format("T{{{}:x:{}:y:{}:data:}}",
py::format_descriptor<CoordType>::format(),
py::format_descriptor<CoordType>::format(),
fmt::format("{}{}", ClusterSizeX * ClusterSizeY,
fmt::format("({},{}){}", ClusterSizeX, ClusterSizeY,
py::format_descriptor<T>::format()));
}
};