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 <algorithm>
#include <cmath>
#include <filesystem>
#include <fstream>
#include <limits>
#include <sstream>
#include <string>
#include <system_error>
#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
30 {
31  auto ori = oit();
32  int ncomp = b1[ori].nComp();
33  if (ori.coordDir() < 2) {
34 #ifdef AMREX_USE_OMP
35 #pragma omp parallel if (Gpu::notInLaunchRegion())
36 #endif
37  for (FabSetIter bfsi(b1[ori]); bfsi.isValid(); ++bfsi) {
38  int idx = bfsi.index();
39  const Box& bx1 = b1[ori].boxArray()[idx];
40  const Box& bx2 = b2[ori].boxArray()[idx];
41 
42  // Copy onto a boundary register based on a box starting at (0,0,0)
43  Array4<Real> dest_arr = b2[ori][idx].array();
44  Array4<Real const> src_arr = b1[ori][idx].const_array();
45  int ioff = bx1.smallEnd(0) - bx2.smallEnd(0);
46  int joff = bx1.smallEnd(1) - bx2.smallEnd(1);
47  ParallelFor(bx2, ncomp,
48  [=] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept
49  {
50  dest_arr(i,j,k,n) = src_arr(i+ioff,j+joff,k,n);
51  });
52  }
53  }
54 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int idx(int i, int j, int k, int nx, int ny)
Definition: ERF_InitForEnsemble.cpp:396
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})

Referenced by WriteBndryPlanes::write_planes().

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