Skip to content

Commit 8c875e5

Browse files
committed
1 parent 44d64f2 commit 8c875e5

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/Base/CoordSys.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ void init_CoordSys(py::module& m)
1414

1515
py::class_<CoordSys> coord_sys(m, "CoordSys");
1616

17-
py::enum_<CoordSys::CoordType>(coord_sys, "CoordType")
17+
py::native_enum<CoordSys::CoordType>(coord_sys, "CoordType", "enum.Enum")
1818
.value("undef", CoordSys::CoordType::undef)
1919
.value("cartesian", CoordSys::CoordType::cartesian)
2020
.value("RZ", CoordSys::CoordType::RZ)
2121
.value("SPHERICAL", CoordSys::CoordType::SPHERICAL)
22-
.export_values();
22+
.export_values()
23+
.finalize()
24+
;
2325

2426
coord_sys.def("__repr__",
2527
[](const CoordSys&) {

src/Base/IndexType.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ void init_IndexType(py::module &m) {
2929

3030
py::class_< IndexType > index_type(m, "IndexType");
3131

32-
py::enum_<IndexType::CellIndex>(index_type, "CellIndex")
32+
py::native_enum<IndexType::CellIndex>(index_type, "CellIndex", "enum.Enum")
3333
.value("CELL", IndexType::CellIndex::CELL)
3434
.value("NODE", IndexType::CellIndex::NODE)
35-
.export_values();
35+
.export_values()
36+
.finalize()
37+
;
3638

3739
index_type.def("__repr__",
3840
[](py::object& obj) {

src/pyAMReX.H

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <pybind11/pybind11.h>
1212
#include <pybind11/functional.h>
1313
#include <pybind11/iostream.h>
14+
#include <pybind11/native_enum.h>
1415
#include <pybind11/numpy.h>
1516
#include <pybind11/operators.h>
1617
#include <pybind11/stl.h>

0 commit comments

Comments
 (0)