7 int scomp,
int dcomp,
int ncomp,
CpOp op)
9 auto const N_locs =
static_cast<int>(thecpc.
m_LocTags->size());
10 if (N_locs == 0) {
return; }
16 #pragma omp parallel for
18 for (
int i = 0; i < N_locs; ++i)
25 if (op == FabArrayBase::COPY)
27 dfab->template copy<RunOn::Host>(*sfab, tag.
sbox, scomp, tag.
dbox, dcomp, ncomp);
31 dfab->template plus<RunOn::Host>(*sfab, tag.
sbox, tag.
dbox, scomp, dcomp, ncomp);
39 for (
int i = 0; i < N_locs; ++i)
43 loc_copy_tags[tag.
dstIndex].push_back
53 const auto& tags = loc_copy_tags[mfi];
54 auto dfab = this->array(mfi);
55 if (op == FabArrayBase::COPY)
57 for (
auto const & tag : tags)
59 auto const sfab = tag.sfab->array();
62 [=] (
int i,
int j,
int k,
int n) noexcept
64 dfab(i,j,k,dcomp+n) = sfab(i+offset.x,j+offset.y,k+offset.z,scomp+n);
70 for (
auto const & tag : tags)
72 auto const sfab = tag.sfab->array();
75 [=] (
int i,
int j,
int k,
int n) noexcept
77 dfab(i,j,k,dcomp+n) += sfab(i+offset.x,j+offset.y,k+offset.z,scomp+n);
89 int scomp,
int dcomp,
int ncomp,
CpOp op)
92 if (N_locs == 0) {
return; }
97 loc_copy_tags.reserve(N_locs);
106 maskfabs.resize(this->local_size());
107 masks.reserve(N_locs);
111 for (
int i = 0; i < N_locs; ++i)
115 int li = this->localindex(tag.
dstIndex);
116 loc_copy_tags.push_back
117 ({this->atLocalIdx(li).array(),
122 if (maskfabs.
size() > 0) {
123 if (!maskfabs[li].isAllocated()) {
124 maskfabs[li].resize(this->atLocalIdx(li).box());
131 if (maskfabs.
size() > 0) {
139 if (op == FabArrayBase::COPY)
141 if (is_thread_safe) {
142 detail::fab_to_fab<value_type, value_type>(loc_copy_tags, scomp,
145 detail::fab_to_fab_atomic_cpy<value_type, value_type>(
146 loc_copy_tags, scomp, dcomp, ncomp, masks);
151 if (is_thread_safe) {
152 detail::fab_to_fab<value_type, value_type>(loc_copy_tags, scomp,
155 detail::fab_to_fab_atomic_add<value_type, value_type>(
156 loc_copy_tags, scomp, dcomp, ncomp, masks);
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
Array4< int const > offset
Definition: AMReX_HypreMLABecLap.cpp:1089
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & smallEnd() const &noexcept
Get the smallend of the BoxND.
Definition: AMReX_Box.H:105
CpOp
parallel copy or add
Definition: AMReX_FabArrayBase.H:393
An Array of FortranArrayBox(FAB)-like Objects.
Definition: AMReX_FabArray.H:344
FAB * fabPtr(const MFIter &mfi) noexcept
Return pointer to FAB.
Definition: AMReX_FabArray.H:1498
a one-thingy-per-box distributed object
Definition: AMReX_LayoutData.H:13
Definition: AMReX_MFIter.H:57
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition: AMReX_MFIter.H:141
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition: AMReX_Vector.H:27
Long size() const noexcept
Definition: AMReX_Vector.H:50
@ FAB
Definition: AMReX_AmrvisConstants.H:86
std::enable_if_t< std::is_integral_v< T > > ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition: AMReX_CTOParallelForImpl.H:200
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopConcurrentOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:378
constexpr AMREX_GPU_HOST_DEVICE GpuTupleElement< I, GpuTuple< Ts... > >::type & get(GpuTuple< Ts... > &tup) noexcept
Definition: AMReX_Tuple.H:179
BoxArray const & boxArray(FabArrayBase const &fa)
Definition: AMReX_TagParallelFor.H:26
Definition: AMReX_TagParallelFor.H:49
Array4< T > dfab
Definition: AMReX_TagParallelFor.H:50
Definition: AMReX_Dim3.H:12
parallel copy or add
Definition: AMReX_FabArrayBase.H:536
Used by a bunch of routines when communicating via MPI.
Definition: AMReX_FabArrayBase.H:194
Box sbox
Definition: AMReX_FabArrayBase.H:196
int srcIndex
Definition: AMReX_FabArrayBase.H:198
Box dbox
Definition: AMReX_FabArrayBase.H:195
int dstIndex
Definition: AMReX_FabArrayBase.H:197
Definition: AMReX_TypeTraits.H:56
Definition: AMReX_TypeTraits.H:266
Definition: AMReX_FBI.H:32
Definition: AMReX_FBI.H:22