ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_WriteBndryPlanes.cpp File Reference
#include "AMReX_Gpu.H"
#include "AMReX_ParmParse.H"
#include "AMReX_PlotFileUtil.H"
#include "AMReX_MultiFabUtil.H"
#include "ERF_WriteBndryPlanes.H"
#include "ERF_IndexDefines.H"
#include "ERF_Derive.H"
Include dependency graph for ERF_WriteBndryPlanes.cpp:

Functions

void br_shift (OrientationIter oit, const BndryRegister &b1, BndryRegister &b2)
 

Function Documentation

◆ br_shift()

void br_shift ( OrientationIter  oit,
const BndryRegister &  b1,
BndryRegister &  b2 
)

Copies the contents of one boundary register to another in either x or y dimensions.

Parameters
oitOrientation iterator used for determining which dimension we are to copy
b1Boundary register containing the source data
b2Boundary register containing the destination data
19 {
20  auto ori = oit();
21  int ncomp = b1[ori].nComp();
22  if (ori.coordDir() < 2) {
23 #ifdef AMREX_USE_OMP
24 #pragma omp parallel if (Gpu::notInLaunchRegion())
25 #endif
26  for (FabSetIter bfsi(b1[ori]); bfsi.isValid(); ++bfsi) {
27  int idx = bfsi.index();
28  const Box& bx1 = b1[ori].boxArray()[idx];
29  const Box& bx2 = b2[ori].boxArray()[idx];
30 
31  // Copy onto a boundary register based on a box starting at (0,0,0)
32  Array4<Real> dest_arr = b2[ori][idx].array();
33  Array4<Real const> src_arr = b1[ori][idx].const_array();
34  int ioff = bx1.smallEnd(0) - bx2.smallEnd(0);
35  int joff = bx1.smallEnd(1) - bx2.smallEnd(1);
36  ParallelFor(bx2, ncomp,
37  [=] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept
38  {
39  dest_arr(i,j,k,n) = src_arr(i+ioff,j+joff,k,n);
40  });
41  }
42  }
43 }

Referenced by WriteBndryPlanes::write_planes().

Here is the caller graph for this function: