1#ifndef AMREX_EB_DATA_H_
2#define AMREX_EB_DATA_H_
3#include <AMReX_Config.H>
38 auto get (
int i,
int j,
int k)
const noexcept
50 const auto&
get () const noexcept
67 auto get (
int i,
int j,
int k,
int n)
const noexcept
81 Real nx = this->get<EBData_t::bndrynorm>(i,j,k,0);
82 Real ny = this->get<EBData_t::bndrynorm>(i,j,k,1);
83 Real bcx = this->get<EBData_t::bndrycent>(i,j,k,0);
84 Real bcy = this->get<EBData_t::bndrycent>(i,j,k,1);
85 int dir = (std::abs(nx) >= std::abs(ny)) ? 0 : 1;
86#if (AMREX_SPACEDIM == 2)
96 Real ymin = std::min(ym,yp);
97 Real ymax = std::max(ym,yp);
98 ymin = std::max(ymin,
Real(-0.5));
99 ymax = std::min(ymax,
Real( 0.5));
100 Real y = rn*(ymax-ymin) + ymin;
101 Real x = bc0 - (
y-bc1)*n1/n0;
107 auto [
x,
y] = f( nx, ny,
111 auto [
y,
x] = f( ny, nx,
116 Real nz = this->get<EBData_t::bndrynorm>(i,j,k,2);
117 Real bcz = this->get<EBData_t::bndrycent>(i,j,k,2);
118 if (std::abs(nz) > std::abs(nx) && std::abs(nz) > std::abs(ny)) {
123 if (n1 == 0 && n2 == 0) {
127 }
else if (n2 == 0) {
131 Real ymin = std::min(ym,yp);
132 Real ymax = std::max(ym,yp);
133 ymin = std::max(ymin,
Real(-0.5));
134 ymax = std::min(ymax,
Real( 0.5));
137 Real x = bc0 - ((
y-bc1)*n1+(
z-bc2)*n2)/n0;
140 Real y0 = bc1 - ((
Real(-0.5)-bc0)*n0+(
Real(-0.5)-bc2)*n2)/n1;
141 Real y1 = bc1 - ((
Real( 0.5)-bc0)*n0+(
Real(-0.5)-bc2)*n2)/n1;
142 Real y2 = bc1 - ((
Real(-0.5)-bc0)*n0+(
Real( 0.5)-bc2)*n2)/n1;
143 Real y3 = bc1 - ((
Real( 0.5)-bc0)*n0+(
Real( 0.5)-bc2)*n2)/n1;
146 ymin = std::max(ymin,
Real(-0.5));
147 ymax = std::min(ymax,
Real( 0.5));
148 Real z0 = bc2 - ((
Real(-0.5)-bc0)*n0+(
Real(-0.5)-bc1)*n1)/n2;
149 Real z1 = bc2 - ((
Real( 0.5)-bc0)*n0+(
Real(-0.5)-bc1)*n1)/n2;
150 Real z2 = bc2 - ((
Real(-0.5)-bc0)*n0+(
Real( 0.5)-bc1)*n1)/n2;
151 Real z3 = bc2 - ((
Real( 0.5)-bc0)*n0+(
Real( 0.5)-bc1)*n1)/n2;
154 zmin = std::max(zmin,
Real(-0.5));
155 zmax = std::min(zmax,
Real( 0.5));
160 x = bc0 - ((
y-bc1)*n1+(
z-bc2)*n2)/n0;
166 if (std::abs(ny) >= std::abs(nz)) {
167 auto [
x,
y,
z] = f( nx, ny, nz,
171 auto [
x,
z,
y] = f( nx, nz, ny,
175 }
else if (dir == 1) {
176 if (std::abs(nx) >= std::abs(nz)) {
177 auto [
y,
x,
z] = f( ny, nx, nz,
181 auto [
y,
z,
x] = f( ny, nz, nx,
186 if (std::abs(nx) >= std::abs(ny)) {
187 auto [
z,
x,
y] = f( nz, nx, ny,
191 auto [
z,
y,
x] = f( nz, ny, nx,
208 template <EBData_t T>
211 auto get (
int box_no,
int i,
int j,
int k)
const noexcept
228 auto get (
int box_no,
int i,
int j,
int k,
int n)
const noexcept
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_RESTRICT
Definition AMReX_Extension.H:32
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:172
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
Real Random()
Generate a psuedo-random real from uniform distribution.
Definition AMReX_Random.cpp:132
Definition AMReX_Amr.cpp:49
__host__ __device__ constexpr GpuTuple< detail::tuple_decay_t< Ts >... > makeTuple(Ts &&... args)
Definition AMReX_Tuple.H:263
__host__ __device__ constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:24
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:44
EBData_t
Tags that index into EB data arrays stored in EBData/EBDataArrays.
Definition AMReX_EBData.H:19
A multidimensional array accessor.
Definition AMReX_Array4.H:283
Views aggregating EBData for multiple boxes.
Definition AMReX_EBData.H:207
Array4< Real const > const *__restrict__ m_real_data
Definition AMReX_EBData.H:243
__host__ __device__ auto get(int box_no, int i, int j, int k, int n) const noexcept
Access data for box box_no and at (i,j,k), component n.
Definition AMReX_EBData.H:228
static constexpr int real_data_size
Definition AMReX_EBData.H:240
Array4< EBCellFlag const > const *__restrict__ m_cell_flag
Definition AMReX_EBData.H:242
__host__ __device__ auto get(int box_no, int i, int j, int k) const noexcept
Access scalar EB data for box box_no at (i,j,k).
Definition AMReX_EBData.H:211
__host__ __device__ EBData get(int box_no) const noexcept
Return an EBData wrapper anchored at box box_no.
Definition AMReX_EBData.H:235
Set of Array4 views to EB data for a single box (plus helpers).
Definition AMReX_EBData.H:34
__host__ __device__ GpuArray< Real, 3 > randomPointOnEB(int i, int j, int k, RandomEngine const &engine) const
Generate a uniformly random point on the EB face inside cell (i,j,k).
Definition AMReX_EBData.H:79
__host__ __device__ const auto & get() const noexcept
Access the Array4 backing EB data T.
Definition AMReX_EBData.H:50
Array4< EBCellFlag const > const * m_cell_flag
Definition AMReX_EBData.H:201
static constexpr int real_data_size
Definition AMReX_EBData.H:199
Array4< Real const > const * m_real_data
Definition AMReX_EBData.H:202
__host__ __device__ auto get(int i, int j, int k, int n) const noexcept
Access data at (i,j,k), component n.
Definition AMReX_EBData.H:67
__host__ __device__ auto get(int i, int j, int k) const noexcept
Access scalar EB data entries at cell (i,j,k).
Definition AMReX_EBData.H:38
Fixed-size array that can be used on GPU.
Definition AMReX_Array.H:43
Definition AMReX_RandomEngine.H:72