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
68 auto get (
int i,
int j,
int k,
int n)
const noexcept
82 Real nx = this->get<EBData_t::bndrynorm>(i,j,k,0);
83 Real ny = this->get<EBData_t::bndrynorm>(i,j,k,1);
84 Real bcx = this->get<EBData_t::bndrycent>(i,j,k,0);
85 Real bcy = this->get<EBData_t::bndrycent>(i,j,k,1);
86 int dir = (std::abs(nx) >= std::abs(ny)) ? 0 : 1;
87#if (AMREX_SPACEDIM == 2)
97 Real ymin = std::min(ym,yp);
98 Real ymax = std::max(ym,yp);
99 ymin = std::max(ymin,
Real(-0.5));
100 ymax = std::min(ymax,
Real( 0.5));
101 Real y = rn*(ymax-ymin) + ymin;
102 Real x = bc0 - (
y-bc1)*n1/n0;
108 auto [
x,
y] = f( nx, ny,
112 auto [
y,
x] = f( ny, nx,
117 Real nz = this->get<EBData_t::bndrynorm>(i,j,k,2);
118 Real bcz = this->get<EBData_t::bndrycent>(i,j,k,2);
119 if (std::abs(nz) > std::abs(nx) && std::abs(nz) > std::abs(ny)) {
124 if (n1 == 0 && n2 == 0) {
128 }
else if (n2 == 0) {
132 Real ymin = std::min(ym,yp);
133 Real ymax = std::max(ym,yp);
134 ymin = std::max(ymin,
Real(-0.5));
135 ymax = std::min(ymax,
Real( 0.5));
138 Real x = bc0 - ((
y-bc1)*n1+(
z-bc2)*n2)/n0;
141 Real y0 = bc1 - ((
Real(-0.5)-bc0)*n0+(
Real(-0.5)-bc2)*n2)/n1;
142 Real y1 = bc1 - ((
Real( 0.5)-bc0)*n0+(
Real(-0.5)-bc2)*n2)/n1;
143 Real y2 = bc1 - ((
Real(-0.5)-bc0)*n0+(
Real( 0.5)-bc2)*n2)/n1;
144 Real y3 = bc1 - ((
Real( 0.5)-bc0)*n0+(
Real( 0.5)-bc2)*n2)/n1;
147 ymin = std::max(ymin,
Real(-0.5));
148 ymax = std::min(ymax,
Real( 0.5));
149 Real z0 = bc2 - ((
Real(-0.5)-bc0)*n0+(
Real(-0.5)-bc1)*n1)/n2;
150 Real z1 = bc2 - ((
Real( 0.5)-bc0)*n0+(
Real(-0.5)-bc1)*n1)/n2;
151 Real z2 = bc2 - ((
Real(-0.5)-bc0)*n0+(
Real( 0.5)-bc1)*n1)/n2;
152 Real z3 = bc2 - ((
Real( 0.5)-bc0)*n0+(
Real( 0.5)-bc1)*n1)/n2;
155 zmin = std::max(zmin,
Real(-0.5));
156 zmax = std::min(zmax,
Real( 0.5));
161 x = bc0 - ((
y-bc1)*n1+(
z-bc2)*n2)/n0;
167 if (std::abs(ny) >= std::abs(nz)) {
168 auto [
x,
y,
z] = f( nx, ny, nz,
172 auto [
x,
z,
y] = f( nx, nz, ny,
176 }
else if (dir == 1) {
177 if (std::abs(nx) >= std::abs(nz)) {
178 auto [
y,
x,
z] = f( ny, nx, nz,
182 auto [
y,
z,
x] = f( ny, nz, nx,
187 if (std::abs(nx) >= std::abs(ny)) {
188 auto [
z,
x,
y] = f( nz, nx, ny,
192 auto [
z,
y,
x] = f( nz, ny, nx,
209 template <EBData_t T>
212 auto get (
int box_no,
int i,
int j,
int k)
const noexcept
221 template <EBData_t T>
230 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:133
Definition AMReX_Amr.cpp:50
__host__ __device__ constexpr GpuTuple< detail::tuple_decay_t< Ts >... > makeTuple(Ts &&... args)
Definition AMReX_Tuple.H:269
__host__ __device__ constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:25
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:45
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:285
Views aggregating EBData for multiple boxes.
Definition AMReX_EBData.H:208
Array4< Real const > const *__restrict__ m_real_data
Definition AMReX_EBData.H:246
static constexpr int real_data_size
Definition AMReX_EBData.H:243
Array4< EBCellFlag const > const *__restrict__ m_cell_flag
Definition AMReX_EBData.H:245
__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:212
__host__ __device__ EBData get(int box_no) const noexcept
Return an EBData wrapper anchored at box box_no.
Definition AMReX_EBData.H:237
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:80
__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:202
static constexpr int real_data_size
Definition AMReX_EBData.H:200
Array4< Real const > const * m_real_data
Definition AMReX_EBData.H:203
__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