ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ParFunctions.H File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

AMREX_FORCE_INLINE void reduce_to_max_per_level (amrex::Vector< amrex::Real > &v, std::unique_ptr< amrex::MultiFab > &mf)
 

Function Documentation

◆ reduce_to_max_per_level()

AMREX_FORCE_INLINE void reduce_to_max_per_level ( amrex::Vector< amrex::Real > &  v,
std::unique_ptr< amrex::MultiFab > &  mf 
)

Reduce a multifab to a vector of values at height levels

10 {
11  amrex::MultiArray4<const amrex::Real> const& ma = mf->const_arrays();
12  for (int k = 0; k < v.size(); k++) {
13  v[k] = amrex::ParReduce(amrex::TypeList<amrex::ReduceOpMax>{},
14  amrex::TypeList<amrex::Real>{},
15  *mf,
16  amrex::IntVect(0),
17  [=] AMREX_GPU_DEVICE (int box_no, int i, int j, int) noexcept
18  -> amrex::GpuTuple<amrex::Real>
19  {
20  return { ma[box_no](i,j,k) };
21  });
22  }
23  amrex::ParallelDescriptor::ReduceRealMax(v.data(), v.size());
24 }

Referenced by erf_init_rayleigh(), ERF::setRayleighRefFromSounding(), and ERF::setSpongeRefFromSounding().

Here is the caller graph for this function: