|
pyAMReX
|
Functions | |
| def | soa_real_comps (self, num_comps, spacedim=3, rotate=True) |
| def | soa_int_comps (self, num_comps) |
| def | soa_to_numpy (self, copy=False) |
| def | soa_to_cupy (self, copy=False) |
| def | register_SoA_extension (amr) |
This file is part of pyAMReX Copyright 2023 AMReX community Authors: Axel Huebl License: BSD-3-Clause-LBNL
| def amrex.StructOfArrays.register_SoA_extension | ( | amr | ) |
StructOfArrays helper methods
| def amrex.StructOfArrays.soa_int_comps | ( | self, | |
| num_comps | |||
| ) |
Name the int components in SoA. Parameters ---------- self : SoA Type maybe unused, depending on implementation num_comps : int number of components to generate names for. Returns ------- A list of length num_comps with values "i1", "i2", "i3", ...
| def amrex.StructOfArrays.soa_real_comps | ( | self, | |
| num_comps, | |||
spacedim = 3, |
|||
rotate = True |
|||
| ) |
Name the ParticleReal components in SoA. Parameters ---------- self : SoA Type maybe unused, depending on implementation num_comps : int number of components to generate names for. spacedim : int AMReX dimensionality rotate : bool = True start with "x", "y", "z", "a", "b", ... Returns ------- A list of length num_comps with values rotate=True (for pure SoA layout): - 3D: "x", "y", "z", "a", "b", ... "w", "r0", "r1", ... - 2D: "x", "y", "a", "b", ... "w", "r0", "r1", ... - 1D: "x", "a", "b", ... "w", "r0", "r1", ... rotate=False (for legacy layout): - 1D-3D: "a", "b", ... "w", "r0", "r1", ...
| def amrex.StructOfArrays.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 dicts
of 1D numpy arrays. The dictionary key order is the same as
in the C++ component order.
For pure SoA particle layouts, an additional component idcpu
with global particle indices is populated.
Raises
------
ImportError
Raises an exception if cupy is not installed
| def amrex.StructOfArrays.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 dicts
of 1D numpy arrays. The dictionary key order is the same as
in the C++ component order.
For pure SoA particle layouts, an additional component idcpu
with global particle indices is populated.