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
87 Real nx = this->get<EBData_t::bndrynorm>(i,j,k,0) * dx[0];
88 Real ny = this->get<EBData_t::bndrynorm>(i,j,k,1) * dx[1];
89 Real bcx = this->get<EBData_t::bndrycent>(i,j,k,0);
90 Real bcy = this->get<EBData_t::bndrycent>(i,j,k,1);
91 int dir = (std::abs(nx) >= std::abs(ny)) ? 0 : 1;
92#if (AMREX_SPACEDIM == 2)
102 Real ymin = std::min(ym,yp);
103 Real ymax = std::max(ym,yp);
104 ymin = std::max(ymin,
Real(-0.5));
105 ymax = std::min(ymax,
Real( 0.5));
106 Real y = rn*(ymax-ymin) + ymin;
107 Real x = bc0 - (
y-bc1)*n1/n0;
113 auto [
x,
y] = f( nx, ny,
117 auto [
y,
x] = f( ny, nx,
122 Real nz = this->get<EBData_t::bndrynorm>(i,j,k,2) * dx[2];
123 Real bcz = this->get<EBData_t::bndrycent>(i,j,k,2);
124 if (std::abs(nz) > std::abs(nx) && std::abs(nz) > std::abs(ny)) {
129 if (n1 == 0 && n2 == 0) {
133 }
else if (n2 == 0) {
137 Real ymin = std::min(ym,yp);
138 Real ymax = std::max(ym,yp);
139 ymin = std::max(ymin,
Real(-0.5));
140 ymax = std::min(ymax,
Real( 0.5));
143 Real x = bc0 - ((
y-bc1)*n1+(
z-bc2)*n2)/n0;
146 Real y0 = bc1 - ((
Real(-0.5)-bc0)*n0+(
Real(-0.5)-bc2)*n2)/n1;
147 Real y1 = bc1 - ((
Real( 0.5)-bc0)*n0+(
Real(-0.5)-bc2)*n2)/n1;
148 Real y2 = bc1 - ((
Real(-0.5)-bc0)*n0+(
Real( 0.5)-bc2)*n2)/n1;
149 Real y3 = bc1 - ((
Real( 0.5)-bc0)*n0+(
Real( 0.5)-bc2)*n2)/n1;
152 ymin = std::max(ymin,
Real(-0.5));
153 ymax = std::min(ymax,
Real( 0.5));
154 Real z0 = bc2 - ((
Real(-0.5)-bc0)*n0+(
Real(-0.5)-bc1)*n1)/n2;
155 Real z1 = bc2 - ((
Real( 0.5)-bc0)*n0+(
Real(-0.5)-bc1)*n1)/n2;
156 Real z2 = bc2 - ((
Real(-0.5)-bc0)*n0+(
Real( 0.5)-bc1)*n1)/n2;
157 Real z3 = bc2 - ((
Real( 0.5)-bc0)*n0+(
Real( 0.5)-bc1)*n1)/n2;
160 zmin = std::max(zmin,
Real(-0.5));
161 zmax = std::min(zmax,
Real( 0.5));
166 x = bc0 - ((
y-bc1)*n1+(
z-bc2)*n2)/n0;
172 if (std::abs(ny) >= std::abs(nz)) {
173 auto [
x,
y,
z] = f( nx, ny, nz,
177 auto [
x,
z,
y] = f( nx, nz, ny,
181 }
else if (dir == 1) {
182 if (std::abs(nx) >= std::abs(nz)) {
183 auto [
y,
x,
z] = f( ny, nx, nz,
187 auto [
y,
z,
x] = f( ny, nz, nx,
192 if (std::abs(nx) >= std::abs(ny)) {
193 auto [
z,
x,
y] = f( nz, nx, ny,
197 auto [
z,
y,
x] = f( nz, ny, nx,
214 template <EBData_t T>
217 auto get (
int box_no,
int i,
int j,
int k)
const noexcept
226 template <EBData_t T>
235 auto get (
int box_no,
int i,
int j,
int k,
int n)
const noexcept
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:124
#define AMREX_RESTRICT
Definition AMReX_Extension.H:37
#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:80
Real Random()
Generate a psuedo-random real from uniform distribution.
Definition AMReX_Random.cpp:155
__host__ __device__ constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:31
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:53
Definition AMReX_Amr.cpp:50
__host__ __device__ constexpr GpuTuple< detail::tuple_decay_t< Ts >... > makeTuple(Ts &&... args)
Definition AMReX_Tuple.H:275
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:289
Views aggregating EBData for multiple boxes.
Definition AMReX_EBData.H:213
Array4< Real const > const *__restrict__ m_real_data
Definition AMReX_EBData.H:251
static constexpr int real_data_size
Definition AMReX_EBData.H:248
Array4< EBCellFlag const > const *__restrict__ m_cell_flag
Definition AMReX_EBData.H:250
__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:217
__host__ __device__ EBData get(int box_no) const noexcept
Return an EBData wrapper anchored at box box_no.
Definition AMReX_EBData.H:242
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, GpuArray< Real, 3 > const &dx) const
Generate a uniformly random point on the EB face inside cell (i,j,k).
Definition AMReX_EBData.H:84
__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:207
static constexpr int real_data_size
Definition AMReX_EBData.H:205
Array4< Real const > const * m_real_data
Definition AMReX_EBData.H:208
__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:52
Definition AMReX_RandomEngine.H:72