1#ifndef AMREX_ALG_VEC_UTIL_H_
2#define AMREX_ALG_VEC_UTIL_H_
3#include <AMReX_Config.H>
16template <
class V,
class Enable =
void>
struct IsAlgVector : std::false_type {};
19struct IsAlgVector<V, std::enable_if_t<std::is_same_v<AlgVector<typename V::value_type,
20 typename V::allocator_type>,
31template <
typename V1,
typename F>
32std::enable_if_t<IsAlgVector<std::decay_t<V1> >::value>
35 Long n =
x.numLocalRows();
50template <
typename V1,
typename V2,
typename F>
51std::enable_if_t<IsAlgVector<std::decay_t<V1> >::value &&
52 IsAlgVector<std::decay_t<V2> >::value>
56 Long n =
x.numLocalRows();
73template <
typename V1,
typename V2,
typename V3,
typename F>
74std::enable_if_t<IsAlgVector<std::decay_t<V1> >::value &&
75 IsAlgVector<std::decay_t<V2> >::value &&
76 IsAlgVector<std::decay_t<V3> >::value>
81 Long n =
x.numLocalRows();
87 f(px[i], py[i], pz[i]);
100template <
typename V1,
typename V2,
typename V3,
typename V4,
typename F>
101std::enable_if_t<IsAlgVector<std::decay_t<V1> >::value &&
102 IsAlgVector<std::decay_t<V2> >::value &&
103 IsAlgVector<std::decay_t<V3> >::value &&
104 IsAlgVector<std::decay_t<V4> >::value>
110 Long n =
x.numLocalRows();
117 f(px[i], py[i], pz[i], pa[i]);
131template <
typename V1,
typename V2,
typename V3,
typename V4,
typename V5,
typename F>
132std::enable_if_t<IsAlgVector<std::decay_t<V1> >::value &&
133 IsAlgVector<std::decay_t<V2> >::value &&
134 IsAlgVector<std::decay_t<V3> >::value &&
135 IsAlgVector<std::decay_t<V4> >::value &&
136 IsAlgVector<std::decay_t<V5> >::value>
143 Long n =
x.numLocalRows();
151 f(px[i], py[i], pz[i], pa[i], pb[i]);
164template <
typename T,
typename Allocator>
168 Long n =
x.numLocalRows();
169 auto const* px =
x.data();
170 auto const* py =
y.data();
173 return px[i] * py[i];
182template <
typename T,
typename Allocator>
189template <
typename T,
typename Allocator>
196template <
typename T,
typename Allocator>
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_RESTRICT
Definition AMReX_Extension.H:32
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
Distributed dense vector that mirrors the layout of an AlgPartition.
Definition AMReX_AlgVector.H:29
amrex_long Long
Definition AMReX_INT.H:30
void ParallelForOMP(T n, L const &f) noexcept
Performance-portable kernel launch function with optional OpenMP threading.
Definition AMReX_GpuLaunch.H:319
void Sum(T &v, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:221
MPI_Comm CommunicatorSub() noexcept
sub-communicator for current frame
Definition AMReX_ParallelContext.H:70
Definition AMReX_Amr.cpp:49
void LinComb(MF &dst, typename MF::value_type a, MF const &src_a, int acomp, typename MF::value_type b, MF const &src_b, int bcomp, int dcomp, int ncomp, IntVect const &nghost)
dst = a*src_a + b*src_b
Definition AMReX_FabArrayUtility.H:2009
void Xpay(MF &dst, typename MF::value_type a, MF const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
dst = src + a * dst
Definition AMReX_FabArrayUtility.H:1974
constexpr void ForEach(TypeList< Ts... >, F &&f)
For each type t in TypeList, call f(t)
Definition AMReX_TypeList.H:83
FAB::value_type Dot(FabArray< FAB > const &x, int xcomp, FabArray< FAB > const &y, int ycomp, int ncomp, IntVect const &nghost, bool local=false)
Compute dot products of two FabArrays.
Definition AMReX_FabArrayUtility.H:1673
void Axpy(AlgVector< T, Allocator > &y, T a, AlgVector< T, Allocator > const &x)
y = ax + y. For GPU builds this is asynchronous with respect to the host.
Definition AMReX_AlgVecUtil.H:183
Definition AMReX_AlgVecUtil.H:16