ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_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_height (amrex::Vector< amrex::Real > &v, std::unique_ptr< amrex::MultiFab > &mf)
 

Function Documentation

◆ reduce_to_max_per_height()

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

Reduce a multifab to a vector of max values at each height

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::setSpongeRefFromSounding().

Here is the caller graph for this function: