Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Src/EB/AMReX_EB2_GeometryShop.H
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public:
problo[2]+amrex::Clamp(ivhi[2],blo.z,bhi.z)*dx[2])},
idim, f);
} else {
inter(i,j,k) = std::numeric_limits<Real>::quiet_NaN();
inter(i,j,k) = no_intercept;
}
});
}
Expand Down Expand Up @@ -503,7 +503,7 @@ public:
problo[2]+amrex::Clamp(ivhi[2],blo.z,bhi.z)*dx[2])},
idim, m_f);
} else {
inter(i,j,k) = std::numeric_limits<Real>::quiet_NaN();
inter(i,j,k) = no_intercept;
}
});
}
Expand All @@ -529,40 +529,40 @@ public:
AMREX_HOST_DEVICE_PARALLEL_FOR_3D (bx, i, j, k,
{
if (type(i,j,k) == Type::irregular) {
bool is_nan = amrex::isnan(inter(i,j,k));
bool no_inter = (inter(i,j,k) == no_intercept);
if (idim == 0) {
if (lst(i,j,k) == Real(0.0) ||
(lst(i,j,k) > Real(0.0) && is_nan))
(lst(i,j,k) > Real(0.0) && no_inter))
{
// interp might still be quiet_nan because lst that
// was set to zero has been changed by FillBoundary
// at periodic boundaries.
// The edge can still be without an intercept because
// lst that was set to zero has been changed by
// FillBoundary at periodic boundaries.
inter(i,j,k) = problo[0] + i*dx[0];
}
else if (lst(i+1,j,k) == Real(0.0) ||
(lst(i+1,j,k) > Real(0.0) && is_nan))
(lst(i+1,j,k) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[0] + (i+1)*dx[0];
}
} else if (idim == 1) {
if (lst(i,j,k) == Real(0.0) ||
(lst(i,j,k) > Real(0.0) && is_nan))
(lst(i,j,k) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[1] + j*dx[1];
}
else if (lst(i,j+1,k) == Real(0.0) ||
(lst(i,j+1,k) > Real(0.0) && is_nan))
(lst(i,j+1,k) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[1] + (j+1)*dx[1];
}
} else {
if (lst(i,j,k) == Real(0.0) ||
(lst(i,j,k) > Real(0.0) && is_nan))
(lst(i,j,k) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[2] + k*dx[2];
}
else if (lst(i,j,k+1) == Real(0.0) ||
(lst(i,j,k+1) > Real(0.0) && is_nan))
(lst(i,j,k+1) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[2] + (k+1)*dx[2];
}
Expand Down
4 changes: 4 additions & 0 deletions Src/EB/AMReX_EB2_Graph.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <unordered_map>
#include <utility>
#include <cstdint>
#include <limits>

/**
* \file AMReX_EB2_Graph.H
Expand Down Expand Up @@ -52,6 +53,9 @@ namespace Type {
static constexpr Type_t unknown=0x3;
}

//! \brief Marker stored in an edge intercept array when the edge has no intercept.
static constexpr Real no_intercept = std::numeric_limits<Real>::max();

//! Packed neighbor structure that tracks the neighbor type in every direction.
struct Neighbor
{
Expand Down
22 changes: 11 additions & 11 deletions Src/EB/AMReX_EB_STL_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ STLtools::getIntercept (Array<Array4<Real>,AMREX_SPACEDIM> const& inter_arr,
#ifdef AMREX_USE_CUDA
amrex::ignore_unused(num_triangles,tri_pts,tri_norm,lst,bvh_root);
#endif
Real r = std::numeric_limits<Real>::quiet_NaN();
Real r = EB2::no_intercept;
if (type(i,j,k) == EB2::Type::irregular) {
XDim3 p1{.x = plo[0]+static_cast<Real>(i)*dx[0],
.y = plo[1]+static_cast<Real>(j)*dx[1],
Expand Down Expand Up @@ -1280,40 +1280,40 @@ STLtools::updateIntercept (Array<Array4<Real>,AMREX_SPACEDIM> const& inter_arr,
amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
if (type(i,j,k) == EB2::Type::irregular) {
bool is_nan = amrex::isnan(inter(i,j,k));
bool no_inter = (inter(i,j,k) == EB2::no_intercept);
if (idim == 0) {
if (lst(i,j,k) == Real(0.0) ||
(lst(i,j,k) > Real(0.0) && is_nan))
(lst(i,j,k) > Real(0.0) && no_inter))
{
// interp might still be quiet_nan because lst that
// was set to zero has been changed by FillBoundary
// at periodic boundaries.
// The edge can still be without an intercept because
// lst that was set to zero has been changed by
// FillBoundary at periodic boundaries.
inter(i,j,k) = problo[0] + static_cast<Real>(i)*dx[0];
}
else if (lst(i+1,j,k) == Real(0.0) ||
(lst(i+1,j,k) > Real(0.0) && is_nan))
(lst(i+1,j,k) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[0] + static_cast<Real>(i+1)*dx[0];
}
} else if (idim == 1) {
if (lst(i,j,k) == Real(0.0) ||
(lst(i,j,k) > Real(0.0) && is_nan))
(lst(i,j,k) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[1] + static_cast<Real>(j)*dx[1];
}
else if (lst(i,j+1,k) == Real(0.0) ||
(lst(i,j+1,k) > Real(0.0) && is_nan))
(lst(i,j+1,k) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[1] + static_cast<Real>(j+1)*dx[1];
}
} else {
if (lst(i,j,k) == Real(0.0) ||
(lst(i,j,k) > Real(0.0) && is_nan))
(lst(i,j,k) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[2] + static_cast<Real>(k)*dx[2];
}
else if (lst(i,j,k+1) == Real(0.0) ||
(lst(i,j,k+1) > Real(0.0) && is_nan))
(lst(i,j,k+1) > Real(0.0) && no_inter))
{
inter(i,j,k) = problo[2] + static_cast<Real>(k+1)*dx[2];
}
Expand Down
Loading