@@ -4043,6 +4043,67 @@ class MultiFab(FabArray_FArrayBox):
40434043 """
40444044 Same as sum with local=false, but for non-cell-centered data, thisskips non-unique points that are owned by multiple boxes.
40454045 """
4046+ def to_cupy (self , copy = False , order = "F" ):
4047+ """
4048+
4049+ Provide a Cupy view into a MultiFab.
4050+
4051+ Note on the order of indices:
4052+ By default, this is as in AMReX in Fortran contiguous order, indexing as
4053+ x,y,z. This has performance implications for use in external libraries such
4054+ as cupy.
4055+ The order="C" option will index as z,y,x and perform better with cupy.
4056+ https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074
4057+
4058+ Parameters
4059+ ----------
4060+ self : amrex.MultiFab
4061+ A MultiFab class in pyAMReX
4062+ copy : bool, optional
4063+ Copy the data if true, otherwise create a view (default).
4064+ order : string, optional
4065+ F order (default) or C. C is faster with external libraries.
4066+
4067+ Returns
4068+ -------
4069+ list of cupy.array
4070+ A list of cupy n-dimensional arrays, for each local block in the
4071+ MultiFab.
4072+
4073+ Raises
4074+ ------
4075+ ImportError
4076+ Raises an exception if cupy is not installed
4077+
4078+ """
4079+ def to_numpy (self , copy = False , order = "F" ):
4080+ """
4081+
4082+ Provide a Numpy view into a MultiFab.
4083+
4084+ Note on the order of indices:
4085+ By default, this is as in AMReX in Fortran contiguous order, indexing as
4086+ x,y,z. This has performance implications for use in external libraries such
4087+ as cupy.
4088+ The order="C" option will index as z,y,x and perform better with cupy.
4089+ https://github.com/AMReX-Codes/pyamrex/issues/55#issuecomment-1579610074
4090+
4091+ Parameters
4092+ ----------
4093+ self : amrex.MultiFab
4094+ A MultiFab class in pyAMReX
4095+ copy : bool, optional
4096+ Copy the data if true, otherwise create a view (default).
4097+ order : string, optional
4098+ F order (default) or C. C is faster with external libraries.
4099+
4100+ Returns
4101+ -------
4102+ list of numpy.array
4103+ A list of numpy n-dimensional arrays, for each local block in the
4104+ MultiFab.
4105+
4106+ """
40464107 def weighted_sync (self , arg0 : MultiFab , arg1 : Periodicity ) -> None : ...
40474108
40484109class PIdx :
0 commit comments