BREAKING CHANGE: Replace symmetry type with enum#586
Conversation
- Replaced `class SymmetryType_class` with `enum SymmetryType` - Removed `struct __sym` (I mention here becuase C++ doesn't have name mangling like Python. Removing this structure indeed breaks the interface.) - Removed singaleton instance `SymType`
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #586 +/- ##
=======================================
Coverage 22.17% 22.17%
=======================================
Files 211 211
Lines 51053 51044 -9
Branches 19010 19006 -4
=======================================
Hits 11319 11319
+ Misses 37969 37960 -9
Partials 1765 1765 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I believe the original design intention was to allow for easy switching between Python and C++. For instance, if the Python code uses If we change If we decide to use |
|
eventually you will want to make this something more general, so that you can add new symmetries later, ideally as an extension that doesn't require modifying existing code. |
|
I agree with @ianmccul . For now, yes. Let's do enum |
| py::enum_<__sym::__stype>(m, "SymType") | ||
| .value("Z", __sym::__stype::Z) | ||
| .value("U", __sym::__stype::U) | ||
| py::enum_<SymmetryType>(m, "SymType") |
There was a problem hiding this comment.
I think we should use "SymmetryType" here rather than "SymType".
There was a problem hiding this comment.
That will break the Python API. I can make SymType deprecated now, but it will not be removed until version 2.x.
|
I suggest that in the future we can consider replacing |
|
Is this PR good to merge? |
|
I agree this PR is good to merge. @IvanaGyro , what do you think? |
|
I thought to merge this PR after changing We can merge this PR now and add the new Python API in the future. |
Changes
class SymmetryType_classwithenum SymmetryTypestruct __sym(I mention here because C++ doesn't have name mangling like Python. Removing this structure indeed breaks the interface.)SymTypeFollowing Steps
I am going to remove the dependency of boost in the Symmetry class. There are two options:
class U1Symmetryandclass ZnSymmetryintoclass Symmetryand used switch-like syntax to delegate the member functionsstd::variantto directly hold the instance ofclass U1Symmetryandclass ZnSymmetryinSymmetry.