ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_BndryPlaneIndex.H File Reference
#include <cmath>
#include <AMReX_Extension.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_REAL.H>
Include dependency graph for ERF_BndryPlaneIndex.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PlaneIndex
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int bndry_plane_index (int i, int lo, int hi, bool periodic) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE PlaneIndex plane_index (int i, int ratio, bool nodal, int plo, int phi, bool periodic) noexcept
 

Function Documentation

◆ bndry_plane_index()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int bndry_plane_index ( int  i,
int  lo,
int  hi,
bool  periodic 
)
noexcept

The index along a boundary plane that fills the ghost cell at index i: inside the domain, i itself; outside it, the periodic image when the direction is periodic, so that a ghost cell beside the inflow face holds what the plane holds at the periodic image (as the interior cells across the seam do); else the nearest cell of the plane. A plane holds the domain's cells only along its face, so its ghost cells in the other directions come from here.

19 {
20  if (i >= lo && i <= hi) { return i; }
21  if (periodic) {
22  const int n = hi - lo + 1;
23  const int r = (i - lo) % n;
24  return lo + ((r < 0) ? r + n : r);
25  }
26  return (i < lo) ? lo : hi;
27 }

Referenced by plane_index().

Here is the caller graph for this function:

◆ plane_index()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE PlaneIndex plane_index ( int  i,
int  ratio,
bool  nodal,
int  plo,
int  phi,
bool  periodic 
)
noexcept
44 {
45  using amrex::Real;
46  const Real x = (nodal ? Real(i) : Real(i) + Real(0.5)) / Real(ratio) - Real(0.5);
47  const int i0 = static_cast<int>(std::floor(x));
48  const Real w = x - Real(i0);
49  return { bndry_plane_index(i0 , plo, phi, periodic),
50  bndry_plane_index(i0+1, plo, phi, periodic), w };
51 }
GpuArray< Real, AMREX_SPACEDIM > plo
Definition: ERF_ActuatorSpreading.cpp:131
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int bndry_plane_index(int i, int lo, int hi, bool periodic) noexcept
Definition: ERF_BndryPlaneIndex.H:18
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

Referenced by ERF::fill_from_bndryregs().

Here is the call graph for this function:
Here is the caller graph for this function: