@@ -31,42 +31,50 @@ using namespace openPMD;
3131
3232void init_Dataset (py::module &m)
3333{
34- py::class_<Dataset>(m, " Dataset" )
34+ auto pyDataset =
35+ py::class_<Dataset>(m, " Dataset" )
36+ .def (
37+ py::init<Datatype, Extent>(),
38+ py::arg (" dtype" ),
39+ py::arg (" extent" ))
40+ .def (py::init<Extent>(), py::arg (" extent" ))
41+ .def (
42+ py::init ([](py::dtype dt, Extent e) {
43+ auto const d = dtype_from_numpy (dt);
44+ return new Dataset{d, e};
45+ }),
46+ py::arg (" dtype" ),
47+ py::arg (" extent" ))
48+ .def (
49+ py::init<Datatype, Extent, std::string>(),
50+ py::arg (" dtype" ),
51+ py::arg (" extent" ),
52+ py::arg (" options" ))
53+ .def (
54+ py::init ([](py::dtype dt, Extent e, std::string options) {
55+ auto const d = dtype_from_numpy (dt);
56+ return new Dataset{d, e, std::move (options)};
57+ }),
58+ py::arg (" dtype" ),
59+ py::arg (" extent" ),
60+ py::arg (" options" ))
3561
36- .def (py::init<Datatype, Extent>(), py::arg (" dtype" ), py::arg (" extent" ))
37- .def (py::init<Extent>(), py::arg (" extent" ))
38- .def (
39- py::init ([](py::dtype dt, Extent e) {
40- auto const d = dtype_from_numpy (dt);
41- return new Dataset{d, e};
42- }),
43- py::arg (" dtype" ),
44- py::arg (" extent" ))
45- .def (
46- py::init<Datatype, Extent, std::string>(),
47- py::arg (" dtype" ),
48- py::arg (" extent" ),
49- py::arg (" options" ))
50- .def (
51- py::init ([](py::dtype dt, Extent e, std::string options) {
52- auto const d = dtype_from_numpy (dt);
53- return new Dataset{d, e, std::move (options)};
54- }),
55- py::arg (" dtype" ),
56- py::arg (" extent" ),
57- py::arg (" options" ))
62+ .def (
63+ " __repr__" ,
64+ [](const Dataset &d) {
65+ return " <openPMD.Dataset of rank '" +
66+ std::to_string (d.rank ) + " '>" ;
67+ })
5868
59- .def (
60- " __repr__" ,
61- [](const Dataset &d) {
62- return " <openPMD.Dataset of rank '" + std::to_string (d.rank ) +
63- " '>" ;
64- })
65-
66- .def_readonly (" extent" , &Dataset::extent)
67- .def (" extend" , &Dataset::extend)
68- .def_readonly (" rank" , &Dataset::rank)
69- .def_property_readonly (
70- " dtype" , [](const Dataset &d) { return dtype_to_numpy (d.dtype ); })
71- .def_readwrite (" options" , &Dataset::options);
69+ .def_property_readonly (
70+ " joined_dimension" , &Dataset::joinedDimension)
71+ .def_readonly (" extent" , &Dataset::extent)
72+ .def (" extend" , &Dataset::extend)
73+ .def_readonly (" rank" , &Dataset::rank)
74+ .def_property_readonly (
75+ " dtype" ,
76+ [](const Dataset &d) { return dtype_to_numpy (d.dtype ); })
77+ .def_readwrite (" options" , &Dataset::options);
78+ pyDataset.attr (" JOINED_DIMENSION" ) =
79+ py::int_ (uint64_t (Dataset::JOINED_DIMENSION));
7280}
0 commit comments