8 #ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_ 9 #define WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_ 17 #include <AMReX_Config.H> 35 #include <type_traits> 80 template<
typename ReduceOp>
88 constexpr
int lev = 0;
105 constexpr
int reduction_comp = 0;
109 using ReduceTuple =
typename decltype(reduce_data)::Type;
120 for (
int i = 0;
i < AMREX_SPACEDIM; ++
i){
121 Extype[
i] = Ex.ixType()[
i];
122 Eytype[
i] = Ey.ixType()[
i];
123 Eztype[
i] = Ez.ixType()[
i];
124 Bxtype[
i] = Bx.ixType()[
i];
125 Bytype[
i] = By.ixType()[
i];
126 Bztype[
i] = Bz.ixType()[
i];
130 auto reduction_function_parser = m_parser->
compile<m_nvars>();
134 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) 141 const auto& arrEx = Ex[mfi].
array();
142 const auto& arrEy = Ey[mfi].
array();
143 const auto& arrEz = Ez[mfi].
array();
144 const auto& arrBx = Bx[mfi].
array();
145 const auto& arrBy = By[mfi].
array();
146 const auto& arrBz = Bz[mfi].
array();
148 reduce_op.
eval(box, reduce_data,
152 const amrex::Real
x = (i + 0.5_rt)*
dx[0] + real_box.
lo(0);
153 #if defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ) 154 const amrex::Real y = 0._rt;
155 const amrex::Real
z = (j + 0.5_rt)*
dx[1] + real_box.
lo(1);
157 const amrex::Real y = (j + 0.5_rt)*
dx[1] + real_box.
lo(1);
158 const amrex::Real z = (k + 0.5_rt)*
dx[2] + real_box.
lo(2);
161 reduction_coarsening_ratio, i, j, k, reduction_comp);
163 reduction_coarsening_ratio, i, j, k, reduction_comp);
165 reduction_coarsening_ratio, i, j, k, reduction_comp);
167 reduction_coarsening_ratio, i, j, k, reduction_comp);
169 reduction_coarsening_ratio, i, j, k, reduction_comp);
171 reduction_coarsening_ratio, i, j, k, reduction_comp);
172 return reduction_function_parser(x, y, z, Ex_interp, Ey_interp, Ez_interp,
173 Bx_interp, By_interp, Bz_interp);
177 amrex::Real reduce_value = amrex::get<0>(reduce_data.
value());
193 #if defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ) 194 reduce_value *=
dx[0]*
dx[1];
196 reduce_value *= dx[0]*dx[1]*dx[2];
208 #endif // WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Box enclosedCells(const Box &b, int dir) noexcept
Array4< typename FabArray< FArrayBox >::value_type const > array(const MFIter &mfi) const noexcept
std::enable_if_t< IsFabArray< MF >::value > eval(MF const &mf, IntVect const &nghost, D &reduce_data, F &&f)
GpuArray< Real, AMREX_SPACEDIM > CellSizeArray() const noexcept
ParserExecutor< N > compile() const
std::vector< amrex::Real > m_data
output data
Definition: ReducedDiags.H:46
def x
Definition: read_lab_particles.py:26
Definition: ReducedDiags.H:23
int dx
Definition: compute_domain.py:35
static constexpr int m_nvars
Definition: FieldReduction.H:65
void ReduceRealMin(Vector< std::reference_wrapper< Real > > &&)
int m_reduction_type
Definition: FieldReduction.H:69
def z
Definition: read_lab_particles.py:27
Definition: FieldReduction.H:44
void ComputeFieldReduction()
Definition: FieldReduction.H:81
i
Definition: check_interp_points_and_weights.py:173
void ReduceRealMax(Vector< std::reference_wrapper< Real > > &&)
FieldReduction(std::string rd_name)
Definition: FieldReduction.cpp:25
const RealBox & ProbDomain() const noexcept
static WarpX & GetInstance()
Definition: WarpX.cpp:215
AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real Interp(Array4< Real const > const &arr_src, GpuArray< int, 3 > const &sf, GpuArray< int, 3 > const &sc, GpuArray< int, 3 > const &cr, const int i, const int j, const int k, const int comp)
Interpolates the floating point data contained in the source Array4 arr_src, extracted from a fine Mu...
Definition: CoarsenIO.H:38
virtual void ComputeDiags(int step) override final
Definition: FieldReduction.cpp:89
bool TilingIfNotGPU() noexcept
void ReduceRealSum(Vector< std::reference_wrapper< Real > > &&)
Definition: NCIGodfreyTables.H:13
const AMREX_GPU_HOST_DEVICE Real * lo() const &noexcept
value
Definition: updateAMReX.py:141
std::unique_ptr< amrex::Parser > m_parser
Definition: FieldReduction.H:66