Functions | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::uint32_t | makeSpace (std::uint32_t x) noexcept |
This makes space in the input 32-bit integer by splitting the bits so they can be interleaved. More... | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::uint32_t | toUInt10 (amrex::Real x, amrex::Real xmin, amrex::Real xmax) noexcept |
Convert a Real to a uint32, keeping only 10 significant bits. This puts the first 10 bits of x into retval with the 22 highest bits set to 0. It is assumed that xmin <= x < xmax. More... | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::uint32_t | toUInt16 (amrex::Real x, amrex::Real xmin, amrex::Real xmax) noexcept |
Convert a Real to a uint32, keeping only 16 significant bits. This puts the first 16 bits of x into retval with the 16 highest bits set to 0. It is assumed that xmin <= x < xmax. More... | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::uint32_t | toUInt32 (amrex::Real x, amrex::Real xmin, amrex::Real xmax) noexcept |
Convert a Real to a uint32, keeping all significant bits. It is assumed that xmin <= x < xmax. More... | |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::uint32_t | get32BitCode (AMREX_D_DECL(Real x, Real y, Real z), const GpuArray< amrex::Real, AMREX_SPACEDIM > &plo, const GpuArray< amrex::Real, AMREX_SPACEDIM > &phi) noexcept |
Given a 3D real-space coordinate, returns a Morton code stored in an unsigned 32 bit integer. More... | |
|
noexcept |
Given a 3D real-space coordinate, returns a Morton code stored in an unsigned 32 bit integer.
In 3D, this works by converting the coordinate to a 10-bit nonnegative integer in each direction and then interleaving the bits.
In 2D, it is same except the lowest 16 bits of of the coordinates are kept.
It is assumed that plo <= p < phi has already been enforced.
x,y,z | the coordinates to convert. |
plo | the low end of the domain. |
phi | the high end of the domain. |
|
noexcept |
This makes space in the input 32-bit integer by splitting the bits so they can be interleaved.
In 3D, the lowest 10 bits of x are assumed filled, with the next 22 0. On output, x has been "stretched" to 30 bits, with each input bit followed by two interleaving bits set to 0.
In 2D, it is the same except the lowest 16 bits on x are filled, and there is only one interleaving bit.
In 1D no interleaving is needed and x is just returned.
x | unsigned int holding the input to be split |
|
noexcept |
Convert a Real to a uint32, keeping only 10 significant bits. This puts the first 10 bits of x into retval with the 22 highest bits set to 0. It is assumed that xmin <= x < xmax.
This is useful in 3D, because you can interleave the bits of 3 10-bit numbers and store the result in one 32-bit integer.
x | the coordinate to convert. |
xmin | the low end of the domain. |
xmax | the high end of the domain. |
|
noexcept |
Convert a Real to a uint32, keeping only 16 significant bits. This puts the first 16 bits of x into retval with the 16 highest bits set to 0. It is assumed that xmin <= x < xmax.
This is useful in 2D, because you can interleave the bits of two 16-bit numbers and store the result in one 32-bit integer.
x | the coordinate to convert. |
xmin | the low end of the domain. |
xmax | the high end of the domain. |
|
noexcept |
Convert a Real to a uint32, keeping all significant bits. It is assumed that xmin <= x < xmax.
This is useful in 1D, because no interleaving is needed.
x | the coordinate to convert. |
xmin | the low end of the domain. |
xmax | the high end of the domain. |