pyAMReX
Functions
amrex.MultiFab Namespace Reference

Functions

def mf_to_numpy (amr, self, copy=False, order="F")
 
def mf_to_cupy (self, copy=False, order="F")
 
def copy_multifab (amr, self)
 
def register_MultiFab_extension (amr)
 

Detailed Description

This file is part of pyAMReX

Copyright 2023 AMReX community
Authors: Axel Huebl
License: BSD-3-Clause-LBNL

Function Documentation

◆ copy_multifab()

def amrex.MultiFab.copy_multifab (   amr,
  self 
)
Create a copy of this MultiFab, using the same Arena.

Parameters
----------
self : amrex.MultiFab
    A MultiFab class in pyAMReX

Returns
-------
amrex.MultiFab
    A copy of this MultiFab.

◆ mf_to_cupy()

def amrex.MultiFab.mf_to_cupy (   self,
  copy = False,
  order = "F" 
)
Provide a Cupy view into a MultiFab.

This includes ngrow guard cells of each box.

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

◆ mf_to_numpy()

def amrex.MultiFab.mf_to_numpy (   amr,
  self,
  copy = False,
  order = "F" 
)
Provide a Numpy view into a MultiFab.

This includes ngrow guard cells of each box.

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 numpy.array
    A list of numpy n-dimensional arrays, for each local block in the
    MultiFab.

◆ register_MultiFab_extension()

def amrex.MultiFab.register_MultiFab_extension (   amr)
MultiFab helper methods