From 816a5c458609f541efe0df4f083c47ab55aab329 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 20 Oct 2022 21:39:22 -0700 Subject: [PATCH 1/2] Helpers: to_numpy/cupy --- MANIFEST.in | 4 ++ src/Base/PODVector.cpp | 11 ++++ src/Particle/ArrayOfStructs.cpp | 12 ++++ src/amrex/Array4.py | 98 ++++++++++++++++++++++++++++++++ src/amrex/ArrayOfStructs.py | 91 ++++++++++++++++++++++++++++++ src/amrex/MultiFab.py | 94 +++++++++++++++++++++++++++++++ src/amrex/PODVector.py | 84 ++++++++++++++++++++++++++++ src/amrex/StructOfArrays.py | 99 +++++++++++++++++++++++++++++++++ src/amrex/space1d/__init__.py | 12 ++++ src/amrex/space2d/__init__.py | 12 ++++ src/amrex/space3d/__init__.py | 12 ++++ tests/test_aos.py | 2 +- tests/test_multifab.py | 26 +++++---- tests/test_particleContainer.py | 12 ++-- tests/test_podvector.py | 2 +- tests/test_soa.py | 6 +- 16 files changed, 554 insertions(+), 23 deletions(-) create mode 100644 src/amrex/Array4.py create mode 100644 src/amrex/ArrayOfStructs.py create mode 100644 src/amrex/MultiFab.py create mode 100644 src/amrex/PODVector.py create mode 100644 src/amrex/StructOfArrays.py diff --git a/MANIFEST.in b/MANIFEST.in index 0b0abb03..9a61a6d7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,10 @@ recursive-include cmake * recursive-include src * recursive-include tests * +# avoid accidentially copying compiled Python files +global-exclude */__pycache__/* +global-exclude *.pyc + # see .gitignore prune cmake-build* prune .spack-env* diff --git a/src/Base/PODVector.cpp b/src/Base/PODVector.cpp index a7daef0b..39c4925d 100644 --- a/src/Base/PODVector.cpp +++ b/src/Base/PODVector.cpp @@ -6,6 +6,7 @@ #include "pyAMReX.H" #include +#include #include @@ -72,6 +73,16 @@ void make_PODVector(py::module &m, std::string typestr, std::string allocstr) .def("resize", py::overload_cast(&PODVector_type::resize)) .def("reserve", &PODVector_type::reserve) .def("shrink_to_fit", &PODVector_type::shrink_to_fit) + .def("to_host", [](PODVector_type const & pv) { + PODVector> h_data(pv.size()); + //py::array_t h_data(pv.size()); + amrex::Gpu::copy(amrex::Gpu::deviceToHost, + pv.begin(), pv.end(), + h_data.begin() + //h_data.ptr() + ); + return h_data; + }) // front // back diff --git a/src/Particle/ArrayOfStructs.cpp b/src/Particle/ArrayOfStructs.cpp index 8ece653d..da616c35 100644 --- a/src/Particle/ArrayOfStructs.cpp +++ b/src/Particle/ArrayOfStructs.cpp @@ -135,6 +135,18 @@ void make_ArrayOfStructs(py::module &m, std::string allocstr) .def("test_sizes", [](){ }) .def("__setitem__", [](AOSType &aos, int const v, const ParticleType& p){ aos[v] = p; }) .def("__getitem__", [](AOSType &aos, int const v){ return aos[v]; }, py::return_value_policy::reference) + + .def("to_host", [](AOSType const & aos) { + ArrayOfStructs h_data; + h_data.resize(aos.size()); + //py::array_t h_data(aos.size()); + amrex::Gpu::copy(amrex::Gpu::deviceToHost, + aos.begin(), aos.end(), + h_data.begin() + //h_data.ptr() + ); + return h_data; + }) ; } diff --git a/src/amrex/Array4.py b/src/amrex/Array4.py new file mode 100644 index 00000000..5bc28448 --- /dev/null +++ b/src/amrex/Array4.py @@ -0,0 +1,98 @@ +""" +This file is part of pyAMReX + +Copyright 2023 AMReX community +Authors: Axel Huebl +License: BSD-3-Clause-LBNL +""" + + +def array4_to_numpy(self, copy=False, order="F"): + """ + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + """ + import numpy as np + + if order == "F": + return np.array(self, copy=copy).T + elif order == "C": + return np.array(self, copy=copy) + else: + raise ValueError("The order argument must be F or C.") + + +def array4_to_cupy(self, copy=False, order="F"): + """ + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + """ + import cupy as cp + + if order == "F": + return cp.array(self, copy=copy).T + elif order == "C": + return cp.array(self, copy=copy) + else: + raise ValueError("The order argument must be F or C.") + + +def register_Array4_extension(amr): + """Array4 helper methods""" + import inspect + import sys + + # register member functions for every Array4_* type + for _, Array4_type in inspect.getmembers( + sys.modules[amr.__name__], + lambda member: inspect.isclass(member) + and member.__module__ == amr.__name__ + and member.__name__.startswith("Array4_"), + ): + Array4_type.to_numpy = array4_to_numpy + Array4_type.to_cupy = array4_to_cupy diff --git a/src/amrex/ArrayOfStructs.py b/src/amrex/ArrayOfStructs.py new file mode 100644 index 00000000..ff2ed4fd --- /dev/null +++ b/src/amrex/ArrayOfStructs.py @@ -0,0 +1,91 @@ +""" +This file is part of pyAMReX + +Copyright 2023 AMReX community +Authors: Axel Huebl +License: BSD-3-Clause-LBNL +""" +from collections import namedtuple + + +def aos_to_numpy(self, copy=False): + """ + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + """ + import numpy as np + + if self.size() == 0: + raise ValueError("AoS is empty.") + + if copy: + # This supports a device-to-host copy. + # + # todo: validate of the to_host() returned object + # lifetime is always managed correctly by + # Python's GC - otherwise copy twice via copy=True + return np.array(self.to_host(), copy=False) + else: + return np.array(self, copy=False) + + +def aos_to_cupy(self, copy=False): + """ + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + """ + import cupy as cp + + SoA_cp = namedtuple(type(self).__name__ + "_cp", ["real", "int"]) + + soa_view = SoA_cp([], []) + + if self.size() == 0: + raise ValueError("AoS is empty.") + + return cp.array(self, copy=copy) + + +def register_AoS_extension(amr): + """ArrayOfStructs helper methods""" + import inspect + import sys + + # register member functions for every ArrayOfStructs_* type + for _, AoS_type in inspect.getmembers( + sys.modules[amr.__name__], + lambda member: inspect.isclass(member) + and member.__module__ == amr.__name__ + and member.__name__.startswith("ArrayOfStructs_"), + ): + AoS_type.to_numpy = aos_to_numpy + AoS_type.to_cupy = aos_to_cupy diff --git a/src/amrex/MultiFab.py b/src/amrex/MultiFab.py new file mode 100644 index 00000000..30ca5f4a --- /dev/null +++ b/src/amrex/MultiFab.py @@ -0,0 +1,94 @@ +""" +This file is part of pyAMReX + +Copyright 2023 AMReX community +Authors: Axel Huebl +License: BSD-3-Clause-LBNL +""" + + +def mf_to_numpy(self, copy=False, order="F"): + """ + Provide a Numpy view into a MultiFab. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.MultiFab + A MultiFab class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + list of np.array + A list of numpy n-dimensional arrays, for each local block in the + MultiFab. + """ + views = [] + for mfi in self: + views.append(self.array(mfi).to_numpy(copy, order)) + + return views + + +def mf_to_cupy(self, copy=False, order="F"): + """ + Provide a Cupy view into a MultiFab. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.MultiFab + A MultiFab class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + list of cupy.array + A list of cupy n-dimensional arrays, for each local block in the + MultiFab. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + """ + views = [] + for mfi in self: + views.append(self.array(mfi).to_cupy(copy, order)) + + return views + + +def register_MultiFab_extension(amr): + """MultiFab helper methods""" + import inspect + import sys + + # register member functions for every MultiFab* type + for _, MultiFab_type in inspect.getmembers( + sys.modules[amr.__name__], + lambda member: inspect.isclass(member) + and member.__module__ == amr.__name__ + and member.__name__.startswith("MultiFab"), + ): + MultiFab_type.to_numpy = mf_to_numpy + MultiFab_type.to_cupy = mf_to_cupy diff --git a/src/amrex/PODVector.py b/src/amrex/PODVector.py new file mode 100644 index 00000000..c241405c --- /dev/null +++ b/src/amrex/PODVector.py @@ -0,0 +1,84 @@ +""" +This file is part of pyAMReX + +Copyright 2023 AMReX community +Authors: Axel Huebl +License: BSD-3-Clause-LBNL +""" + + +def podvector_to_numpy(self, copy=False): + """ + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + """ + import numpy as np + + if self.size() > 0: + if copy: + # This supports a device-to-host copy. + # + # todo: validate of the to_host() returned object + # lifetime is always managed correctly by + # Python's GC - otherwise copy twice via copy=True + return np.array(self.to_host(), copy=False) + else: + return np.array(self, copy=False) + else: + raise ValueError("Vector is empty.") + + +def podvector_to_cupy(self, copy=False): + """ + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + """ + import cupy as cp + + if self.size() > 0: + return cp.array(self, copy=copy) + else: + raise ValueError("Vector is empty.") + + +def register_PODVector_extension(amr): + """PODVector helper methods""" + import inspect + import sys + + # register member functions for every PODVector_* type + for _, POD_type in inspect.getmembers( + sys.modules[amr.__name__], + lambda member: inspect.isclass(member) + and member.__module__ == amr.__name__ + and member.__name__.startswith("PODVector_"), + ): + POD_type.to_numpy = podvector_to_numpy + POD_type.to_cupy = podvector_to_cupy diff --git a/src/amrex/StructOfArrays.py b/src/amrex/StructOfArrays.py new file mode 100644 index 00000000..e906732b --- /dev/null +++ b/src/amrex/StructOfArrays.py @@ -0,0 +1,99 @@ +""" +This file is part of pyAMReX + +Copyright 2023 AMReX community +Authors: Axel Huebl +License: BSD-3-Clause-LBNL +""" +from collections import namedtuple + + +def soa_to_numpy(self, copy=False): + """ + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + """ + import numpy as np + + SoA_np = namedtuple(type(self).__name__ + "_np", ["real", "int"]) + + soa_view = SoA_np([], []) + + if self.size() == 0: + raise ValueError("SoA is empty.") + + for idx_real in range(self.NumRealComps()): + soa_view.real.append(self.GetRealData(idx_real).to_numpy(copy=copy)) + + for idx_int in range(self.NumIntComps()): + soa_view.int.append(self.GetIntData(idx_int).to_numpy(copy=copy)) + + return soa_view + + +def soa_to_cupy(self, copy=False): + """ + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + """ + import cupy as cp + + SoA_cp = namedtuple(type(self).__name__ + "_cp", ["real", "int"]) + + soa_view = SoA_cp([], []) + + if self.size() == 0: + raise ValueError("SoA is empty.") + + for idx_real in range(self.NumRealComps()): + soa_view.real.append(self.GetRealData(idx_real).to_cupy(copy=copy)) + + for idx_int in range(self.NumIntComps()): + soa_view.int.append(self.GetIntData(idx_int).to_cupy(copy=copy)) + + return soa_view + + +def register_SoA_extension(amr): + """StructOfArrays helper methods""" + import inspect + import sys + + # register member functions for every StructOfArrays_* type + for _, SoA_type in inspect.getmembers( + sys.modules[amr.__name__], + lambda member: inspect.isclass(member) + and member.__module__ == amr.__name__ + and member.__name__.startswith("StructOfArrays_"), + ): + SoA_type.to_numpy = soa_to_numpy + SoA_type.to_cupy = soa_to_cupy diff --git a/src/amrex/space1d/__init__.py b/src/amrex/space1d/__init__.py index 6e042339..76b75647 100644 --- a/src/amrex/space1d/__init__.py +++ b/src/amrex/space1d/__init__.py @@ -31,6 +31,7 @@ # in pure Python or add some other Python logic # def d_decl(x, y, z): + """Return a tuple of the first passed element""" return (x,) @@ -41,3 +42,14 @@ def Print(*args, **kwargs): print(*args, **kwargs) elif ParallelDescriptor.IOProcessor(): print(*args, **kwargs) + + +from ..Array4 import register_Array4_extension +from ..ArrayOfStructs import register_AoS_extension +from ..PODVector import register_PODVector_extension +from ..StructOfArrays import register_SoA_extension + +register_Array4_extension(amrex_1d_pybind) +register_PODVector_extension(amrex_1d_pybind) +register_SoA_extension(amrex_1d_pybind) +register_AoS_extension(amrex_1d_pybind) diff --git a/src/amrex/space2d/__init__.py b/src/amrex/space2d/__init__.py index 235189dd..b3626276 100644 --- a/src/amrex/space2d/__init__.py +++ b/src/amrex/space2d/__init__.py @@ -31,6 +31,7 @@ # in pure Python or add some other Python logic # def d_decl(x, y, z): + """Return a tuple of the first two passed elements""" return (x, y) @@ -41,3 +42,14 @@ def Print(*args, **kwargs): print(*args, **kwargs) elif ParallelDescriptor.IOProcessor(): print(*args, **kwargs) + + +from ..Array4 import register_Array4_extension +from ..ArrayOfStructs import register_AoS_extension +from ..PODVector import register_PODVector_extension +from ..StructOfArrays import register_SoA_extension + +register_Array4_extension(amrex_2d_pybind) +register_PODVector_extension(amrex_2d_pybind) +register_SoA_extension(amrex_2d_pybind) +register_AoS_extension(amrex_2d_pybind) diff --git a/src/amrex/space3d/__init__.py b/src/amrex/space3d/__init__.py index 50e7897c..4b4fd623 100644 --- a/src/amrex/space3d/__init__.py +++ b/src/amrex/space3d/__init__.py @@ -31,6 +31,7 @@ # in pure Python or add some other Python logic # def d_decl(x, y, z): + """Return a tuple of the three passed elements""" return (x, y, z) @@ -41,3 +42,14 @@ def Print(*args, **kwargs): print(*args, **kwargs) elif ParallelDescriptor.IOProcessor(): print(*args, **kwargs) + + +from ..Array4 import register_Array4_extension +from ..ArrayOfStructs import register_AoS_extension +from ..PODVector import register_PODVector_extension +from ..StructOfArrays import register_SoA_extension + +register_Array4_extension(amrex_3d_pybind) +register_PODVector_extension(amrex_3d_pybind) +register_SoA_extension(amrex_3d_pybind) +register_AoS_extension(amrex_3d_pybind) diff --git a/tests/test_aos.py b/tests/test_aos.py index ad4fd043..139cda0b 100644 --- a/tests/test_aos.py +++ b/tests/test_aos.py @@ -68,7 +68,7 @@ def test_array_interface(): # print('particle 1 from aos:\n',aos[0]) # print('particle 2 from aos:\n',aos[1]) # print('array interface\n', aos.__array_interface__) - arr = np.array(aos, copy=False) + arr = aos.to_numpy() assert ( np.isclose(arr[0][0], 1.0) and np.isclose(arr[0][4], 5.2) diff --git a/tests/test_multifab.py b/tests/test_multifab.py index 7ad60c0d..80727615 100644 --- a/tests/test_multifab.py +++ b/tests/test_multifab.py @@ -45,18 +45,17 @@ def test_mfab_loop(make_mfab): # numpy representation: non-copying view, including the # guard/ghost region - # note: in numpy, indices are in C-order! - marr_np = np.array(marr, copy=False) + marr_np = marr.to_numpy() # check the values at start/end are the same: first component assert marr_np[0, 0, 0, 0] == marr[bx.small_end] - assert marr_np[0, -1, -1, -1] == marr[bx.big_end] + assert marr_np[-1, -1, -1, 0] == marr[bx.big_end] # same check, but for all components for n in range(mfab.num_comp): small_end_comp = list(bx.small_end) + [n] big_end_comp = list(bx.big_end) + [n] - assert marr_np[n, 0, 0, 0] == marr[small_end_comp] - assert marr_np[n, -1, -1, -1] == marr[big_end_comp] + assert marr_np[0, 0, 0, n] == marr[small_end_comp] + assert marr_np[-1, -1, -1, n] == marr[big_end_comp] # now we do some faster assignments, using range based access # this should fail as out-of-bounds, but does not @@ -64,7 +63,7 @@ def test_mfab_loop(make_mfab): # marr_np[24:200, :, :, :] = 42. # all components and all indices set at once to 42 - marr_np[:, :, :, :] = 42.0 + marr_np[()] = 42.0 # values in start & end still match? assert marr_np[0, 0, 0, 0] == marr[bx.small_end] @@ -210,10 +209,11 @@ def test_mfab_ops_cuda_cupy(make_mfab_device): with cupy.profiler.time_range("assign 3 [()]", color_id=0): for mfi in mfab_device: bx = mfi.tilebox().grow(ngv) - marr = mfab_device.array(mfi) - marr_cupy = cp.array(marr, copy=False) + marr_cupy = mfab_device.array(mfi).to_cupy(order="C") # print(marr_cupy.shape) # 1, 32, 32, 32 # print(marr_cupy.dtype) # float64 + # performance: + # https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 # write and read into the marr_cupy marr_cupy[()] = 3.0 @@ -244,8 +244,11 @@ def set_to_five(mm): for mfi in mfab_device: bx = mfi.tilebox().grow(ngv) - marr = mfab_device.array(mfi) - marr_cupy = cp.array(marr, copy=False) + marr_cupy = mfab_device.array(mfi).to_cupy(order="F") + # print(marr_cupy.shape) # 32, 32, 32, 1 + # print(marr_cupy.dtype) # float64 + # performance: + # https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 # write and read into the marr_cupy fives_cp = set_to_five(marr_cupy) @@ -266,8 +269,7 @@ def set_to_seven(x): for mfi in mfab_device: bx = mfi.tilebox().grow(ngv) - marr = mfab_device.array(mfi) - marr_cupy = cp.array(marr, copy=False) + marr_cupy = mfab_device.array(mfi).to_cupy(order="C") # write and read into the marr_cupy set_to_seven(marr_cupy) diff --git a/tests/test_particleContainer.py b/tests/test_particleContainer.py index 3a873cfb..43e722e2 100644 --- a/tests/test_particleContainer.py +++ b/tests/test_particleContainer.py @@ -137,7 +137,7 @@ def test_pc_init(): print(pti.geom(level=lvl)) aos = pti.aos() - aos_arr = np.array(aos, copy=False) + aos_arr = aos.to_numpy() aos_arr[0]["x"] = 0.30 aos_arr[0]["y"] = 0.35 aos_arr[0]["z"] = 0.40 @@ -163,7 +163,7 @@ def test_pc_init(): assert pti.level == lvl aos = pti.aos() - aos_arr = np.array(aos, copy=False) + aos_arr = aos.to_numpy() assert aos[0].x == 0.30 assert aos[0].y == 0.35 assert aos[0].z == 0.40 @@ -196,7 +196,7 @@ def test_particle_init(Npart, particle_container): real_arrays = pt.GetStructOfArrays().GetRealData() int_arrays = pt.GetStructOfArrays().GetIntData() aos = pt.GetArrayOfStructs() - aos_arr = np.array(aos, copy=False) + aos_arr = aos.to_numpy() if len(real_arrays) > 0: assert np.isclose(real_arrays[0][0], 0.5) and np.isclose( real_arrays[1][0], 0.2 @@ -226,13 +226,13 @@ def test_particle_init(Npart, particle_container): print(real_arrays) print(ra1) for ii, arr in enumerate(real_arrays): - assert np.allclose(np.array(arr), np.array(ra1[ii])) + assert np.allclose(arr.to_numpy(), ra1[ii].to_numpy()) print("soa int test") - iarr_np = np.array(int_arrays[0], copy=False) + iarr_np = int_arrays[0].to_numpy() iarr_np[0] = -3 ia1 = pt.GetStructOfArrays().GetIntData() - ia1_np = np.array(ia1[0], copy=False) + ia1_np = ia1[0].to_numpy() print(iarr_np) print(ia1_np) assert np.allclose(iarr_np, ia1_np) diff --git a/tests/test_podvector.py b/tests/test_podvector.py index 3a44927f..3b3233f8 100644 --- a/tests/test_podvector.py +++ b/tests/test_podvector.py @@ -33,7 +33,7 @@ def test_array_interface(): podv.push_back(2) podv.push_back(1) podv.push_back(5) - arr = np.array(podv, copy=False) + arr = podv.to_numpy() print(arr) # podv[2] = 3 diff --git a/tests/test_soa.py b/tests/test_soa.py index 86aec7bb..373ac4f1 100644 --- a/tests/test_soa.py +++ b/tests/test_soa.py @@ -82,13 +82,13 @@ def test_soa_from_tile(): print(real_arrays) print(ra1) for ii, arr in enumerate(real_arrays): - assert np.allclose(np.array(arr), np.array(ra1[ii])) + assert np.allclose(arr.to_numpy(), ra1[ii].to_numpy()) print("soa int test") - iarr_np = np.array(int_arrays[0], copy=False) + iarr_np = int_arrays[0].to_numpy() iarr_np[0] = -3 ia1 = soa.GetIntData() - ia1_np = np.array(ia1[0], copy=False) + ia1_np = ia1[0].to_numpy() print(iarr_np) print(ia1_np) assert np.allclose(iarr_np, ia1_np) From 73d4b74a2788a76a063c8400b05c818bc819b0a9 Mon Sep 17 00:00:00 2001 From: ax3l Date: Thu, 21 Sep 2023 16:42:44 +0000 Subject: [PATCH 2/2] Update Stub Files --- src/amrex/space1d/__init__.pyi | 13 +- .../space1d/amrex_1d_pybind/__init__.pyi | 2591 +++++++++++++++++ src/amrex/space2d/__init__.pyi | 13 +- .../space2d/amrex_2d_pybind/__init__.pyi | 2591 +++++++++++++++++ src/amrex/space3d/__init__.pyi | 13 +- .../space3d/amrex_3d_pybind/__init__.pyi | 2591 +++++++++++++++++ 6 files changed, 7809 insertions(+), 3 deletions(-) diff --git a/src/amrex/space1d/__init__.pyi b/src/amrex/space1d/__init__.pyi index 3db28536..d59d128f 100644 --- a/src/amrex/space1d/__init__.pyi +++ b/src/amrex/space1d/__init__.pyi @@ -36,6 +36,10 @@ from __future__ import annotations import os as os +from amrex.Array4 import register_Array4_extension +from amrex.ArrayOfStructs import register_AoS_extension +from amrex.PODVector import register_PODVector_extension +from amrex.StructOfArrays import register_SoA_extension from amrex.space1d.amrex_1d_pybind import ( AlmostEqual, AMReX, @@ -455,6 +459,10 @@ __all__ = [ "min", "os", "refine", + "register_AoS_extension", + "register_Array4_extension", + "register_PODVector_extension", + "register_SoA_extension", "size", "ubound", "unpack_cpus", @@ -467,7 +475,10 @@ def Print(*args, **kwargs): Wrap amrex::Print() - only the IO processor writes """ -def d_decl(x, y, z): ... +def d_decl(x, y, z): + """ + Return a tuple of the first passed element + """ __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" diff --git a/src/amrex/space1d/amrex_1d_pybind/__init__.pyi b/src/amrex/space1d/amrex_1d_pybind/__init__.pyi index 60458be9..d10686c6 100644 --- a/src/amrex/space1d/amrex_1d_pybind/__init__.pyi +++ b/src/amrex/space1d/amrex_1d_pybind/__init__.pyi @@ -329,6 +329,65 @@ class Array4_double: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -359,6 +418,65 @@ class Array4_double_const: def __init__(self, arg0: numpy.ndarray[numpy.float64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -395,6 +513,65 @@ class Array4_float: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -425,6 +602,65 @@ class Array4_float_const: def __init__(self, arg0: numpy.ndarray[numpy.float32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -461,6 +697,65 @@ class Array4_int: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -491,6 +786,65 @@ class Array4_int_const: def __init__(self, arg0: numpy.ndarray[numpy.int32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -527,6 +881,65 @@ class Array4_long: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -557,6 +970,65 @@ class Array4_long_const: def __init__(self, arg0: numpy.ndarray[numpy.int64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -593,6 +1065,65 @@ class Array4_longdouble: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -623,6 +1154,65 @@ class Array4_longdouble_const: def __init__(self, arg0: numpy.ndarray[numpy.longdouble]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -659,6 +1249,65 @@ class Array4_longlong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -689,6 +1338,65 @@ class Array4_longlong_const: def __init__(self, arg0: numpy.ndarray[numpy.int64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -725,6 +1433,65 @@ class Array4_short: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -755,6 +1522,65 @@ class Array4_short_const: def __init__(self, arg0: numpy.ndarray[numpy.int16]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -791,6 +1617,65 @@ class Array4_uint: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -821,6 +1706,65 @@ class Array4_uint_const: def __init__(self, arg0: numpy.ndarray[numpy.uint32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -857,6 +1801,65 @@ class Array4_ulong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -887,6 +1890,65 @@ class Array4_ulong_const: def __init__(self, arg0: numpy.ndarray[numpy.uint64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -923,6 +1985,65 @@ class Array4_ulonglong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -953,6 +2074,65 @@ class Array4_ulonglong_const: def __init__(self, arg0: numpy.ndarray[numpy.uint64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -989,6 +2169,65 @@ class Array4_ushort: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1019,6 +2258,65 @@ class Array4_ushort_const: def __init__(self, arg0: numpy.ndarray[numpy.uint16]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1053,6 +2351,50 @@ class ArrayOfStructs_0_0_arena: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1081,6 +2423,50 @@ class ArrayOfStructs_0_0_default: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1109,6 +2495,50 @@ class ArrayOfStructs_0_0_pinned: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1137,6 +2567,50 @@ class ArrayOfStructs_1_1_arena: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1165,6 +2639,50 @@ class ArrayOfStructs_1_1_default: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1193,6 +2711,50 @@ class ArrayOfStructs_1_1_pinned: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1221,6 +2783,50 @@ class ArrayOfStructs_2_1_arena: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1249,6 +2855,50 @@ class ArrayOfStructs_2_1_default: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1277,6 +2927,50 @@ class ArrayOfStructs_2_1_pinned: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2440,6 +4134,48 @@ class PODVector_int_arena: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2468,6 +4204,48 @@ class PODVector_int_pinned: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2496,6 +4274,48 @@ class PODVector_int_std: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2524,6 +4344,48 @@ class PODVector_real_arena: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2552,6 +4414,48 @@ class PODVector_real_pinned: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2580,6 +4484,48 @@ class PODVector_real_std: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -6060,6 +8006,49 @@ class StructOfArrays_2_1_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_2_1_default: @typing.overload @@ -6106,6 +8095,49 @@ class StructOfArrays_2_1_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_2_1_pinned: @typing.overload @@ -6152,6 +8184,49 @@ class StructOfArrays_2_1_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_arena: @typing.overload @@ -6198,6 +8273,49 @@ class StructOfArrays_37_1_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_default: @typing.overload @@ -6244,6 +8362,49 @@ class StructOfArrays_37_1_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_pinned: @typing.overload @@ -6290,6 +8451,49 @@ class StructOfArrays_37_1_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_arena: @typing.overload @@ -6336,6 +8540,49 @@ class StructOfArrays_4_0_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_default: @typing.overload @@ -6382,6 +8629,49 @@ class StructOfArrays_4_0_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_pinned: @typing.overload @@ -6428,6 +8718,49 @@ class StructOfArrays_4_0_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_arena: @typing.overload @@ -6474,6 +8807,49 @@ class StructOfArrays_5_0_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_default: @typing.overload @@ -6520,6 +8896,49 @@ class StructOfArrays_5_0_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_pinned: @typing.overload @@ -6566,6 +8985,49 @@ class StructOfArrays_5_0_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_arena: @typing.overload @@ -6612,6 +9074,49 @@ class StructOfArrays_8_2_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_default: @typing.overload @@ -6658,6 +9163,49 @@ class StructOfArrays_8_2_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_pinned: @typing.overload @@ -6704,6 +9252,49 @@ class StructOfArrays_8_2_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class Vector_BoxArray: __hash__: typing.ClassVar[None] = None diff --git a/src/amrex/space2d/__init__.pyi b/src/amrex/space2d/__init__.pyi index a0297ffa..9715ccd0 100644 --- a/src/amrex/space2d/__init__.pyi +++ b/src/amrex/space2d/__init__.pyi @@ -36,6 +36,10 @@ from __future__ import annotations import os as os +from amrex.Array4 import register_Array4_extension +from amrex.ArrayOfStructs import register_AoS_extension +from amrex.PODVector import register_PODVector_extension +from amrex.StructOfArrays import register_SoA_extension from amrex.space2d.amrex_2d_pybind import ( AlmostEqual, AMReX, @@ -455,6 +459,10 @@ __all__ = [ "min", "os", "refine", + "register_AoS_extension", + "register_Array4_extension", + "register_PODVector_extension", + "register_SoA_extension", "size", "ubound", "unpack_cpus", @@ -467,7 +475,10 @@ def Print(*args, **kwargs): Wrap amrex::Print() - only the IO processor writes """ -def d_decl(x, y, z): ... +def d_decl(x, y, z): + """ + Return a tuple of the first two passed elements + """ __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" diff --git a/src/amrex/space2d/amrex_2d_pybind/__init__.pyi b/src/amrex/space2d/amrex_2d_pybind/__init__.pyi index 6b328f3e..45d0863d 100644 --- a/src/amrex/space2d/amrex_2d_pybind/__init__.pyi +++ b/src/amrex/space2d/amrex_2d_pybind/__init__.pyi @@ -329,6 +329,65 @@ class Array4_double: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -359,6 +418,65 @@ class Array4_double_const: def __init__(self, arg0: numpy.ndarray[numpy.float64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -395,6 +513,65 @@ class Array4_float: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -425,6 +602,65 @@ class Array4_float_const: def __init__(self, arg0: numpy.ndarray[numpy.float32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -461,6 +697,65 @@ class Array4_int: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -491,6 +786,65 @@ class Array4_int_const: def __init__(self, arg0: numpy.ndarray[numpy.int32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -527,6 +881,65 @@ class Array4_long: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -557,6 +970,65 @@ class Array4_long_const: def __init__(self, arg0: numpy.ndarray[numpy.int64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -593,6 +1065,65 @@ class Array4_longdouble: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -623,6 +1154,65 @@ class Array4_longdouble_const: def __init__(self, arg0: numpy.ndarray[numpy.longdouble]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -659,6 +1249,65 @@ class Array4_longlong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -689,6 +1338,65 @@ class Array4_longlong_const: def __init__(self, arg0: numpy.ndarray[numpy.int64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -725,6 +1433,65 @@ class Array4_short: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -755,6 +1522,65 @@ class Array4_short_const: def __init__(self, arg0: numpy.ndarray[numpy.int16]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -791,6 +1617,65 @@ class Array4_uint: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -821,6 +1706,65 @@ class Array4_uint_const: def __init__(self, arg0: numpy.ndarray[numpy.uint32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -857,6 +1801,65 @@ class Array4_ulong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -887,6 +1890,65 @@ class Array4_ulong_const: def __init__(self, arg0: numpy.ndarray[numpy.uint64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -923,6 +1985,65 @@ class Array4_ulonglong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -953,6 +2074,65 @@ class Array4_ulonglong_const: def __init__(self, arg0: numpy.ndarray[numpy.uint64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -989,6 +2169,65 @@ class Array4_ushort: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1019,6 +2258,65 @@ class Array4_ushort_const: def __init__(self, arg0: numpy.ndarray[numpy.uint16]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1053,6 +2351,50 @@ class ArrayOfStructs_0_0_arena: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1081,6 +2423,50 @@ class ArrayOfStructs_0_0_default: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1109,6 +2495,50 @@ class ArrayOfStructs_0_0_pinned: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1137,6 +2567,50 @@ class ArrayOfStructs_1_1_arena: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1165,6 +2639,50 @@ class ArrayOfStructs_1_1_default: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1193,6 +2711,50 @@ class ArrayOfStructs_1_1_pinned: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1221,6 +2783,50 @@ class ArrayOfStructs_2_1_arena: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1249,6 +2855,50 @@ class ArrayOfStructs_2_1_default: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1277,6 +2927,50 @@ class ArrayOfStructs_2_1_pinned: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2446,6 +4140,48 @@ class PODVector_int_arena: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2474,6 +4210,48 @@ class PODVector_int_pinned: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2502,6 +4280,48 @@ class PODVector_int_std: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2530,6 +4350,48 @@ class PODVector_real_arena: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2558,6 +4420,48 @@ class PODVector_real_pinned: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2586,6 +4490,48 @@ class PODVector_real_std: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -6077,6 +8023,49 @@ class StructOfArrays_2_1_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_2_1_default: @typing.overload @@ -6123,6 +8112,49 @@ class StructOfArrays_2_1_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_2_1_pinned: @typing.overload @@ -6169,6 +8201,49 @@ class StructOfArrays_2_1_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_arena: @typing.overload @@ -6215,6 +8290,49 @@ class StructOfArrays_37_1_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_default: @typing.overload @@ -6261,6 +8379,49 @@ class StructOfArrays_37_1_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_pinned: @typing.overload @@ -6307,6 +8468,49 @@ class StructOfArrays_37_1_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_arena: @typing.overload @@ -6353,6 +8557,49 @@ class StructOfArrays_4_0_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_default: @typing.overload @@ -6399,6 +8646,49 @@ class StructOfArrays_4_0_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_pinned: @typing.overload @@ -6445,6 +8735,49 @@ class StructOfArrays_4_0_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_arena: @typing.overload @@ -6491,6 +8824,49 @@ class StructOfArrays_5_0_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_default: @typing.overload @@ -6537,6 +8913,49 @@ class StructOfArrays_5_0_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_pinned: @typing.overload @@ -6583,6 +9002,49 @@ class StructOfArrays_5_0_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_arena: @typing.overload @@ -6629,6 +9091,49 @@ class StructOfArrays_8_2_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_default: @typing.overload @@ -6675,6 +9180,49 @@ class StructOfArrays_8_2_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_pinned: @typing.overload @@ -6721,6 +9269,49 @@ class StructOfArrays_8_2_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class Vector_BoxArray: __hash__: typing.ClassVar[None] = None diff --git a/src/amrex/space3d/__init__.pyi b/src/amrex/space3d/__init__.pyi index a3fc466d..6a68ed0a 100644 --- a/src/amrex/space3d/__init__.pyi +++ b/src/amrex/space3d/__init__.pyi @@ -36,6 +36,10 @@ from __future__ import annotations import os as os +from amrex.Array4 import register_Array4_extension +from amrex.ArrayOfStructs import register_AoS_extension +from amrex.PODVector import register_PODVector_extension +from amrex.StructOfArrays import register_SoA_extension from amrex.space3d.amrex_3d_pybind import ( AlmostEqual, AMReX, @@ -455,6 +459,10 @@ __all__ = [ "min", "os", "refine", + "register_AoS_extension", + "register_Array4_extension", + "register_PODVector_extension", + "register_SoA_extension", "size", "ubound", "unpack_cpus", @@ -467,7 +475,10 @@ def Print(*args, **kwargs): Wrap amrex::Print() - only the IO processor writes """ -def d_decl(x, y, z): ... +def d_decl(x, y, z): + """ + Return a tuple of the three passed elements + """ __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" diff --git a/src/amrex/space3d/amrex_3d_pybind/__init__.pyi b/src/amrex/space3d/amrex_3d_pybind/__init__.pyi index a93fad8f..f5a30e7d 100644 --- a/src/amrex/space3d/amrex_3d_pybind/__init__.pyi +++ b/src/amrex/space3d/amrex_3d_pybind/__init__.pyi @@ -329,6 +329,65 @@ class Array4_double: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -359,6 +418,65 @@ class Array4_double_const: def __init__(self, arg0: numpy.ndarray[numpy.float64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -395,6 +513,65 @@ class Array4_float: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -425,6 +602,65 @@ class Array4_float_const: def __init__(self, arg0: numpy.ndarray[numpy.float32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -461,6 +697,65 @@ class Array4_int: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -491,6 +786,65 @@ class Array4_int_const: def __init__(self, arg0: numpy.ndarray[numpy.int32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -527,6 +881,65 @@ class Array4_long: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -557,6 +970,65 @@ class Array4_long_const: def __init__(self, arg0: numpy.ndarray[numpy.int64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -593,6 +1065,65 @@ class Array4_longdouble: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: float) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -623,6 +1154,65 @@ class Array4_longdouble_const: def __init__(self, arg0: numpy.ndarray[numpy.longdouble]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -659,6 +1249,65 @@ class Array4_longlong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -689,6 +1338,65 @@ class Array4_longlong_const: def __init__(self, arg0: numpy.ndarray[numpy.int64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -725,6 +1433,65 @@ class Array4_short: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -755,6 +1522,65 @@ class Array4_short_const: def __init__(self, arg0: numpy.ndarray[numpy.int16]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -791,6 +1617,65 @@ class Array4_uint: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -821,6 +1706,65 @@ class Array4_uint_const: def __init__(self, arg0: numpy.ndarray[numpy.uint32]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -857,6 +1801,65 @@ class Array4_ulong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -887,6 +1890,65 @@ class Array4_ulong_const: def __init__(self, arg0: numpy.ndarray[numpy.uint64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -923,6 +1985,65 @@ class Array4_ulonglong: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -953,6 +2074,65 @@ class Array4_ulonglong_const: def __init__(self, arg0: numpy.ndarray[numpy.uint64]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -989,6 +2169,65 @@ class Array4_ushort: @typing.overload def __setitem__(self, arg0: list[int[3]], arg1: int) -> None: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1019,6 +2258,65 @@ class Array4_ushort_const: def __init__(self, arg0: numpy.ndarray[numpy.uint16]) -> None: ... def __repr__(self) -> str: ... def contains(self, arg0: int, arg1: int, arg2: int) -> bool: ... + def to_cupy(self, copy=False, order="F"): + """ + + Provide a Cupy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + cupy.array + A cupy n-dimensional array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False, order="F"): + """ + + Provide a Numpy view into an Array4. + + Note on the order of indices: + By default, this is as in AMReX in Fortran contiguous order, indexing as + x,y,z. This has performance implications for use in external libraries such + as cupy. + The order="C" option will index as z,y,x and perform better with cupy. + https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074 + + Parameters + ---------- + self : amrex.Array4_* + An Array4 class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + order : string, optional + F order (default) or C. C is faster with external libraries. + + Returns + ------- + np.array + A numpy n-dimensional array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1053,6 +2351,50 @@ class ArrayOfStructs_0_0_arena: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1081,6 +2423,50 @@ class ArrayOfStructs_0_0_default: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1109,6 +2495,50 @@ class ArrayOfStructs_0_0_pinned: def push_back(self, arg0: Particle_0_0) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_0_0_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1137,6 +2567,50 @@ class ArrayOfStructs_1_1_arena: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1165,6 +2639,50 @@ class ArrayOfStructs_1_1_default: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1193,6 +2711,50 @@ class ArrayOfStructs_1_1_pinned: def push_back(self, arg0: Particle_1_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_1_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1221,6 +2783,50 @@ class ArrayOfStructs_2_1_arena: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1249,6 +2855,50 @@ class ArrayOfStructs_2_1_default: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -1277,6 +2927,50 @@ class ArrayOfStructs_2_1_pinned: def push_back(self, arg0: Particle_2_1) -> None: ... def setNumNeighbors(self, arg0: int) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> ArrayOfStructs_2_1_default: ... + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a ArrayOfStructs. + + Parameters + ---------- + self : amrex.ArrayOfStructs_* + An ArrayOfStructs class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2449,6 +4143,48 @@ class PODVector_int_arena: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2477,6 +4213,48 @@ class PODVector_int_pinned: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2505,6 +4283,48 @@ class PODVector_int_std: def resize(self, arg0: int, arg1: int) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_int_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2533,6 +4353,48 @@ class PODVector_real_arena: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2561,6 +4423,48 @@ class PODVector_real_pinned: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -2589,6 +4493,48 @@ class PODVector_real_std: def resize(self, arg0: int, arg1: float) -> None: ... def shrink_to_fit(self) -> None: ... def size(self) -> int: ... + def to_cupy(self, copy=False): + """ + + Provide a Cupy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + cupy.array + A 1D cupy array. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_host(self) -> PODVector_real_std: ... + def to_numpy(self, copy=False): + """ + + Provide a Numpy view into a PODVector (e.g., RealVector, IntVector). + + Parameters + ---------- + self : amrex.PODVector_* + A PODVector class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + np.array + A 1D numpy array. + + """ @property def __array_interface__(self) -> dict: ... @property @@ -6101,6 +8047,49 @@ class StructOfArrays_2_1_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_2_1_default: @typing.overload @@ -6147,6 +8136,49 @@ class StructOfArrays_2_1_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_2_1_pinned: @typing.overload @@ -6193,6 +8225,49 @@ class StructOfArrays_2_1_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_arena: @typing.overload @@ -6239,6 +8314,49 @@ class StructOfArrays_37_1_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_default: @typing.overload @@ -6285,6 +8403,49 @@ class StructOfArrays_37_1_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_37_1_pinned: @typing.overload @@ -6331,6 +8492,49 @@ class StructOfArrays_37_1_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_arena: @typing.overload @@ -6377,6 +8581,49 @@ class StructOfArrays_4_0_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_default: @typing.overload @@ -6423,6 +8670,49 @@ class StructOfArrays_4_0_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_4_0_pinned: @typing.overload @@ -6469,6 +8759,49 @@ class StructOfArrays_4_0_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_arena: @typing.overload @@ -6515,6 +8848,49 @@ class StructOfArrays_5_0_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_default: @typing.overload @@ -6561,6 +8937,49 @@ class StructOfArrays_5_0_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_5_0_pinned: @typing.overload @@ -6607,6 +9026,49 @@ class StructOfArrays_5_0_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_arena: @typing.overload @@ -6653,6 +9115,49 @@ class StructOfArrays_8_2_arena: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_default: @typing.overload @@ -6699,6 +9204,49 @@ class StructOfArrays_8_2_default: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class StructOfArrays_8_2_pinned: @typing.overload @@ -6745,6 +9293,49 @@ class StructOfArrays_8_2_pinned: """ Get the number of particles """ + def to_cupy(self, copy=False): + """ + + Provide Cupy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + Raises + ------ + ImportError + Raises an exception if cupy is not installed + + """ + def to_numpy(self, copy=False): + """ + + Provide Numpy views into a StructOfArrays. + + Parameters + ---------- + self : amrex.StructOfArrays_* + A StructOfArrays class in pyAMReX + copy : bool, optional + Copy the data if true, otherwise create a view (default). + + Returns + ------- + namedtuple + A tuple with real and int components that are each lists + of 1D numpy arrays. + + """ class Vector_BoxArray: __hash__: typing.ClassVar[None] = None