Evaluate signed distance at a point.
This operator performs trilinear interpolation of the pre-sampled signed distance field. For points outside the sampled domain, it returns a negative value (fluid region).
Note: The signed distance field is computed in parallel across ranks during construction, then replicated for fast operator() access.
59 using namespace amrex;
68 int i =
static_cast<int>(std::floor(i_real));
69 int j =
static_cast<int>(std::floor(j_real));
70 int k =
static_cast<int>(std::floor(k_real));
73 if (!
m_data_box.contains(IntVect(AMREX_D_DECL(i, j, k))) ||
74 !
m_data_box.contains(IntVect(AMREX_D_DECL(i + 1, j + 1, k + 1)))) {
80 Real wx = i_real -
static_cast<Real
>(i);
81 Real wy = j_real -
static_cast<Real
>(j);
82 Real wz = k_real -
static_cast<Real
>(k);
88 Real phi_000 = arr(i, j, k);
89 Real phi_100 = arr(i + 1, j, k);
90 Real phi_010 = arr(i, j + 1, k);
91 Real phi_110 = arr(i + 1, j + 1, k);
92 Real phi_001 = arr(i, j, k + 1);
93 Real phi_101 = arr(i + 1, j, k + 1);
94 Real phi_011 = arr(i, j + 1, k + 1);
95 Real phi_111 = arr(i + 1, j + 1, k + 1);
97 Real phi_00 = phi_000 * (1.0 - wx) + phi_100 * wx;
98 Real phi_01 = phi_001 * (1.0 - wx) + phi_101 * wx;
99 Real phi_10 = phi_010 * (1.0 - wx) + phi_110 * wx;
100 Real phi_11 = phi_011 * (1.0 - wx) + phi_111 * wx;
102 Real phi_0 = phi_00 * (1.0 - wy) + phi_10 * wy;
103 Real phi_1 = phi_01 * (1.0 - wy) + phi_11 * wy;
105 Real
phi = phi_0 * (1.0 - wz) + phi_1 * wz;
amrex::Array4< const amrex::Real > m_local_array
Local array view for GPU-compatible operator() access.
Definition: ERF_EBIFBuildings.H:135
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_problo
Cached geometry data for GPU-compatible access.
Definition: ERF_EBIFBuildings.H:131
amrex::Box m_data_box
Bounding box of sampled data.
Definition: ERF_EBIFBuildings.H:128
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_dx
Definition: ERF_EBIFBuildings.H:132
Definition: ERF_ConsoleIO.cpp:17
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real phi(amrex::Real d, amrex::Real z0, amrex::Real psi) noexcept
Definition: ERF_ImmersedWallCell.H:176