From e26a1622da39c289e52e1724dee3315375eb5018 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Sun, 7 May 2023 21:45:41 +0200 Subject: [PATCH] merge ranges.pyx + array.pyx -> base.pyx --- .gitignore | 1 + cnorxz/base/array.pyx | 11 ----------- cnorxz/base/{ranges.pyx => base.pyx} | 18 ++++++++++++++++++ setup.py | 3 +-- 4 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 cnorxz/base/array.pyx rename cnorxz/base/{ranges.pyx => base.pyx} (77%) diff --git a/.gitignore b/.gitignore index 02b2268..9a6e97e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build/ cnorxz.egg-info/ *.so +*.cpp diff --git a/cnorxz/base/array.pyx b/cnorxz/base/array.pyx deleted file mode 100644 index 733a2e0..0000000 --- a/cnorxz/base/array.pyx +++ /dev/null @@ -1,11 +0,0 @@ - -from libcpp.memory cimport shared_ptr, make_shared, dynamic_pointer_cast -from array cimport cpp_CArrayBase - -cdef class Array: - cdef shared_ptr[cpp_CArrayBase[double]] cpp_array - - def size(self): - return self.cpp_array.get().size() - - diff --git a/cnorxz/base/ranges.pyx b/cnorxz/base/base.pyx similarity index 77% rename from cnorxz/base/ranges.pyx rename to cnorxz/base/base.pyx index 0b681f7..06719ef 100644 --- a/cnorxz/base/ranges.pyx +++ b/cnorxz/base/base.pyx @@ -2,6 +2,12 @@ from libcpp.memory cimport shared_ptr, make_shared, dynamic_pointer_cast from range cimport cpp_RangeBase from range_factory cimport cpp_RangeFactoryBase, cpp_CRangeFactory +from array cimport cpp_CArrayBase + + +## ============ +## Range +## ============ cdef class Range: cdef shared_ptr[cpp_RangeBase] cpp_range @@ -29,4 +35,16 @@ cdef class RangeFactory: r = Range() r.cpp_range = self.cpp_rfactory.get().create() return r + + +## =========== +## Array +## =========== + +cdef class Array: + cdef shared_ptr[cpp_CArrayBase[double]] cpp_array + + def size(self): + return self.cpp_array.get().size() + diff --git a/setup.py b/setup.py index 64b0179..f77a2ff 100644 --- a/setup.py +++ b/setup.py @@ -58,8 +58,7 @@ if __name__ == "__main__": setuptools.Extension( name = libname + ".base", sources = [ - "cnorxz/base/ranges.pyx", - #"cnorxz/base/array.pyx", + "cnorxz/base/base.pyx", ], **default_extension_args )