1 #ifndef AMREX_NONLOCAL_BC_H_
2 #define AMREX_NONLOCAL_BC_H_
3 #include <AMReX_Config.H>
15 template <
typename T,
typename... Args>
16 using Inverse_t = decltype(std::declval<T>().Inverse(std::declval<Args>()...));
24 template <
class IndexMap>
26 :
Conjunction<IsCallableR<Dim3, IndexMap&, const Dim3&>,
27 HasInverseMemFn<const IndexMap&>> {};
52 int iv[3]{i.
x, i.y, i.z};
54 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
57 return {iv_new[0], iv_new[1], iv_new[2]};
67 int iv_new[3]{i.
x, i.y, i.z};
69 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
73 return {iv[0], iv[1], iv[2]};
82 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
100 template <
typename DTOS>
101 std::enable_if_t<IsCallableR<Dim3, DTOS, Dim3>::value,
IntVect>
116 template <
typename DTOS>
124 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
125 smallEnd[d] =
std::min(mapped_smallEnd[d], mapped_bigEnd[d]);
126 bigEnd[d] =
std::max(mapped_smallEnd[d], mapped_bigEnd[d]);
128 return Box{smallEnd, bigEnd, box.
ixType()};
139 template <
typename DTOS>
144 Box srcbox =
Image([&dtos](
Dim3 d) {
return dtos(d); }, box);
161 template <
typename DTOS>
162 std::enable_if_t<HasInverseMemFn<DTOS>::value,
IntVect>
165 return Apply([&dtos](
Dim3 i) {
return dtos.Inverse(i); }, iv);
176 template <
typename DTOS>
180 return Image([&dtos](
Dim3 i) {
return dtos.Inverse(i); }, box);
191 template <
typename DTOS>
195 return Image([&dtos](
auto&& i) {
return dtos.Inverse(i); }, box);
199 static_assert(IsIndexMapping<MultiBlockIndexMapping>(),
200 "MultiBlockIndexMapping is expected to satisfy IndexMapping");
216 template <
typename DTOS,
217 typename = std::enable_if_t<IsIndexMapping<DTOS>::value>>
219 const IntVect& ngrow, DTOS
const& dtos);
224 template <
typename DTOS,
225 typename = std::enable_if_t<IsIndexMapping<DTOS>::value>>
256 template <
typename DTOS>
257 std::enable_if_t<IsIndexMapping<DTOS>::value>
268 template <
typename P,
typename FAB>
270 :
IsCallableR<typename FAB::value_type, P, Array4<const typename FAB::value_type>, Dim3, int>
287 template <
typename T>
289 noexcept(noexcept(array(i.x, i.y, i.z, comp))) {
290 return array(i.
x, i.
y, i.
z, comp);
298 static_assert(
sizeof(Identity) == 1 );
299 static_assert(std::is_trivially_default_constructible_v<Identity> );
300 static_assert(std::is_trivially_copy_assignable_v<Identity> );
301 static_assert(std::is_trivially_copy_constructible_v<Identity> );
302 static_assert(IsIndexMapping<Identity>() );
303 static_assert(IsFabProjection<Identity, FArrayBox>() );
316 "Base needs to be a callable function: (Array4<const T>, Dim3, i) -> auto.");
319 "Map needs to be a callable function: int -> int.");
324 template <
typename T,
325 typename = std::enable_if_t<IsCallable<Base, Array4<const T>,
Dim3,
int>::value>,
326 typename = std::enable_if_t<IsCallableR<int, Map, int>::value>>
327 constexpr decltype(
auto) operator()(
Array4<const T> array,
Dim3 i,
int comp) const
328 noexcept(noexcept(
base(array, i,
map(comp)))) {
329 return base(array, i,
map(comp));
333 static_assert(std::is_trivially_copy_assignable<MapComponents<Identity>>() );
334 static_assert(std::is_trivially_copy_constructible<MapComponents<Identity>>() );
335 static_assert(IsFabProjection<MapComponents<Identity>,
FArrayBox>() );
346 static_assert(I >= 0 && J >= 0,
"I >= 0 && J >= 0");
352 const int map[2] = {I, J};
353 return i == I || i == J ? map[std::size_t(i == I)] : i;
358 static_assert(I >= 0,
"I >= 0");
362 const int map[2] = {I, J};
363 return i == I || i == J ? map[std::size_t(i == I)] : i;
368 static_assert(J >= 0,
"J >= 0");
372 const int map[2] = {I, J};
373 return i == I || i == J ? map[std::size_t(i == I)] : i;
381 const int map[2] = {I, J};
382 return i == I || i == J ? map[std::size_t(i == I)] : i;
390 static_assert(
sizeof(SwapComponents<0, 1>) == 1 );
392 static_assert(
sizeof(SwapComponents<0, -1>) ==
sizeof(
int) );
393 static_assert(
sizeof(SwapComponents<-1, 1>) ==
sizeof(
int) );
394 static_assert(std::is_trivially_default_constructible<MapComponents<Identity, SwapComponents<0, 1>>>() );
395 static_assert(std::is_trivially_copy_assignable<MapComponents<Identity, SwapComponents<0, 1>>>() );
396 static_assert(std::is_trivially_copy_constructible<MapComponents<Identity, SwapComponents<0, 1>>>() );
397 static_assert(IsFabProjection<MapComponents<Identity, SwapComponents<0, 1>>,
FArrayBox>() );
399 static_assert(swap_indices<0, 1>(0) == 1 );
400 static_assert(swap_indices<0, 1>(1) == 0 );
401 static_assert(swap_indices<0, 1>(2) == 2 );
439 int n_components, std::size_t object_size, std::size_t align);
442 void PostRecvs(CommData& recv,
int mpi_tag);
445 void PostSends(CommData& send,
int mpi_tag);
463 template <
typename... Args>
466 template <
typename... Args>
469 template <
typename... Args>
472 template <
typename... Args>
475 template <
typename... Args>
479 template <
typename DP,
typename FAB>
482 IsDetected<LocalCopy_t, DP&, FabArray<FAB>&, const FabArray<FAB>&, const FabArrayBase::CopyComTagsContainer&>
484 ,IsDetected<PrepareSendBuffers_t, DP&, FabArray<FAB>&, const FabArray<FAB>&, CommData&, const FabArrayBase::MapOfCopyComTagContainers&>,
485 IsDetected<PrepareRecvBuffers_t, DP&, FabArray<FAB>&, const FabArray<FAB>&, CommData&, const FabArrayBase::MapOfCopyComTagContainers&>,
486 IsDetected<PackSendBuffers_t, DP&, const FabArray<FAB>&, CommData&>,
487 IsDetected<UnpackRecvBuffers_t, DP&, FabArray<FAB>&, CommData&>
491 template <
class FAB,
class DTOS = Identity,
class Proj = Identity>
495 Proj
const& proj = Proj{}) noexcept;
497 template <
class FAB,
class DTOS = Identity,
class Proj = Identity>
498 std::enable_if_t<IsBaseFab<FAB>() && IsCallableR<Dim3, DTOS, Dim3>() && IsFabProjection<Proj, FAB>()>
502 DTOS
const& dtos = DTOS{}, Proj
const& proj = Proj{}) noexcept;
505 template <
class FAB,
class DTOS = Identity,
class Proj = Identity>
506 std::enable_if_t<IsBaseFab<FAB>() && IsCallableR<Dim3, DTOS, Dim3>() && IsFabProjection<Proj, FAB>()>
509 Proj
const& proj = Proj{}) noexcept;
511 template <
class FAB,
class DTOS = Identity,
class Proj = Identity>
512 std::enable_if_t<IsBaseFab<FAB>() && IsCallableR<Dim3, DTOS, Dim3>() && IsFabProjection<Proj, FAB>()>
517 DTOS
const& dtos = DTOS{}, Proj
const& proj = Proj{});
535 template <
typename FAB>
536 std::enable_if_t<IsBaseFab<FAB>::value>
553 template <
typename FAB>
554 std::enable_if_t<IsBaseFab<FAB>::value>
557 using T =
typename FAB::value_type;
563 template <
typename FAB>
564 std::enable_if_t<IsBaseFab<FAB>::value>
567 using T =
typename FAB::value_type;
573 template <
typename FAB>
574 std::enable_if_t<IsBaseFab<FAB>::value>
589 template <
typename FAB>
590 std::enable_if_t<IsBaseFab<FAB>::value>
605 static_assert(IsDataPacking<PackComponents, FArrayBox>(),
606 "PackComponents is expected to satisfy the concept DataPacking.");
614 template <
typename DTOS = Identity,
typename FabProj = Identity>
618 : PackComponents(components),
dtos(std::move(dtos_)),
proj(std::move(proj_)) {}
628 template <
typename FAB,
typename DTOS,
typename FabProj>
629 std::enable_if_t<IsBaseFab<FAB>::value>
647 template <
typename FAB,
typename DTOS,
typename FabProj>
648 std::enable_if_t<IsBaseFab<FAB>::value>
666 static_assert(IsDataPacking<ApplyDtosAndProjectionOnReciever<>,
FArrayBox>(),
667 "ApplyDtosAndProjectionOnReciever<> is expected to satisfy the DataPacking concept.");
696 template <
typename FAB,
typename DataPacking,
697 typename = std::enable_if_t<IsBaseFab<FAB>::value>,
698 typename = std::enable_if_t<IsDataPacking<DataPacking, FAB>::value>>
715 PostRecvs(handler.recv, handler.mpi_tag);
721 PostSends(handler.send, handler.mpi_tag);
753 template <
typename FAB,
typename DataPacking,
754 typename = std::enable_if_t<IsBaseFab<FAB>::value>,
755 typename = std::enable_if_t<IsDataPacking<DataPacking, FAB>::value>>
790 template <
typename FAB,
typename DataPacking>
791 std::enable_if_t<IsBaseFab<FAB>() && IsDataPacking<DataPacking, FAB>()>
808 amrex::Abort(
"NonLocalPC::ParallelCopy_finish failed with wrong message size");
842 template <
typename FAB,
typename DataPacking>
843 std::enable_if_t<IsBaseFab<FAB>() && IsDataPacking<DataPacking, FAB>()>
877 template <
typename FAB,
typename DTOS = Identity,
typename Proj = Identity>
881 PackComponents components{};
885 #if defined(__GNUC__) && !defined(__clang__)
886 #pragma GCC diagnostic push
887 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
889 ApplyDtosAndProjectionOnReciever<DTOS, Proj> packing{components, dtos, proj};
892 #if defined(__GNUC__) && !defined(__clang__)
893 #pragma GCC diagnostic pop
921 template <
typename FAB,
typename DTOS = Identity,
typename Proj = Identity>
922 std::enable_if_t<IsBaseFab<FAB>() && IsCallableR<Dim3, DTOS, Dim3>() && IsFabProjection<Proj, FAB>()>
924 int srccomp,
int destcomp,
int numcomp, DTOS
const& dtos = DTOS{}, Proj
const& proj = Proj{}) {
925 ParallelCopy(dest, src, cmd, SrcComp(srccomp), DestComp(destcomp), NumComps(numcomp), dtos, proj);
957 template <
typename FAB,
typename DTOS = Identity,
typename Proj = Identity>
958 std::enable_if_t<IsBaseFab<FAB>() && IsIndexMapping<DTOS>() && IsFabProjection<Proj, FAB>(),
959 MultiBlockCommMetaData>
961 DestComp destcomp,
NumComps numcomp,
const IntVect& ngrow, DTOS
const& dtos = DTOS{}, Proj
const& proj = Proj{}) {
962 MultiBlockCommMetaData cmd(dest, destbox, src, ngrow, dtos);
963 ParallelCopy(dest, src, cmd, srccomp, destcomp, numcomp, dtos, proj);
996 template <
typename FAB,
typename DTOS = Identity,
typename Proj = Identity>
997 std::enable_if_t<IsBaseFab<FAB>() && IsIndexMapping<DTOS>() && IsFabProjection<Proj, FAB>(),
998 MultiBlockCommMetaData>
1000 int destcomp,
int numcomp,
const IntVect& ngrow, DTOS
const& dtos = DTOS{}, Proj
const& proj = Proj{}) {
1001 return ParallelCopy(dest, destbox, src, SrcComp(srccomp), DestComp(destcomp), NumComps(numcomp), ngrow, dtos, proj);
1009 template <
class FAB>
1010 std::enable_if_t<IsBaseFab<FAB>::value>
1013 template <
class FAB>
1014 std::enable_if_t<IsBaseFab<FAB>::value>
1020 template <
class FAB>
1021 std::enable_if_t<IsBaseFab<FAB>::value>
1024 template <
class FAB>
1025 std::enable_if_t<IsBaseFab<FAB>::value>
1032 template <
class FAB>
1033 std::enable_if_t<IsBaseFab<FAB>::value>
1036 template <
class FAB>
1037 std::enable_if_t<IsBaseFab<FAB>::value>
1076 template <
typename FAB,
typename DTOS,
typename Proj = Identity>
1078 std::enable_if_t<IsBaseFab<FAB>() &&
1083 int scomp,
int ncomp, DTOS
const& dtos,
1084 Proj
const& proj = Proj{});
1121 template <
typename FAB,
typename DTOS,
typename Proj = Identity>
1122 std::enable_if_t<IsBaseFab<FAB>() &&
1124 IsFabProjection<Proj,FAB>()>
1127 int scomp,
int ncomp, DTOS
const& dtos,
1128 Proj
const& proj = Proj{});
1161 template <
typename FAB,
typename DTOS,
typename Proj = Identity>
1162 std::enable_if_t<IsBaseFab<FAB>() &&
1164 IsFabProjection<Proj,FAB>()>
1166 int scomp,
int ncomp, DTOS
const& dtos, Proj
const& proj = Proj{})
1187 template <
typename FAB,
typename DTOS>
1189 std::enable_if_t<IsBaseFab<FAB>() && IsCallableR<Dim3,DTOS,Dim3>(),
1190 FabArrayBase::CommMetaData>
1192 Geometry const& geom, DTOS
const& dtos);
1203 using NonLocalBC::SphThetaPhiRIndexMapping;
1204 using NonLocalBC::SphThetaPhiRComponentMapping;
#define BL_PROFILE(a)
Definition: AMReX_BLProfiler.H:551
#define AMREX_ASSERT(EX)
Definition: AMReX_BLassert.H:38
#define AMREX_NODISCARD
Definition: AMReX_Extension.H:251
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:550
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & smallEnd() const &noexcept
Get the smallend of the BoxND.
Definition: AMReX_Box.H:105
AMREX_GPU_HOST_DEVICE IndexTypeND< dim > ixType() const noexcept
Returns the indexing type.
Definition: AMReX_Box.H:127
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & bigEnd() const &noexcept
Get the bigend.
Definition: AMReX_Box.H:116
AMREX_GPU_HOST_DEVICE BoxND & setType(const IndexTypeND< dim > &t) noexcept
Set indexing type.
Definition: AMReX_Box.H:492
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
A Fortran Array of REALs.
Definition: AMReX_FArrayBox.H:229
Base class for FabArray.
Definition: AMReX_FabArrayBase.H:41
CopyComTag::CopyComTagsContainer CopyComTagsContainer
Definition: AMReX_FabArrayBase.H:219
CopyComTag::MapOfCopyComTagContainers MapOfCopyComTagContainers
Definition: AMReX_FabArrayBase.H:220
bool empty() const noexcept
Definition: AMReX_FabArrayBase.H:88
An Array of FortranArrayBox(FAB)-like Objects.
Definition: AMReX_FabArray.H:344
static void pack_send_buffer_gpu(FabArray< FAB > const &src, int scomp, int ncomp, Vector< char * > const &send_data, Vector< std::size_t > const &send_size, Vector< const CopyComTagsContainer * > const &send_cctc)
static void pack_send_buffer_cpu(FabArray< FAB > const &src, int scomp, int ncomp, Vector< char * > const &send_data, Vector< std::size_t > const &send_size, Vector< const CopyComTagsContainer * > const &send_cctc)
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 dim3() const noexcept
Definition: AMReX_IntVect.H:163
@ FAB
Definition: AMReX_AmrvisConstants.H:86
bool inLaunchRegion() noexcept
Definition: AMReX_GpuControl.H:86
Definition: AMReX_NonLocalBC.cpp:3
decltype(UnpackRecvBuffers(std::declval< Args >()...)) UnpackRecvBuffers_t
Definition: AMReX_NonLocalBC.H:473
std::enable_if_t< IsBaseFab< FAB >::value > PrepareRecvBuffers(const PackComponents &components, FabArray< FAB > &dest, const FabArray< FAB > &src, CommData &comm, const FabArrayBase::MapOfCopyComTagContainers &cctc)
Calls PrepareComBuffers.
Definition: AMReX_NonLocalBC.H:565
decltype(std::declval< T >().Inverse(std::declval< Args >()...)) Inverse_t
Return type of an InverseImage class member function.
Definition: AMReX_NonLocalBC.H:16
std::enable_if_t< IsBaseFab< FAB >::value > FillPolar(FabArray< FAB > &mf, int scomp, int ncomp, IntVect const &nghost, Box const &domain)
decltype(PackSendBuffers(std::declval< Args >()...)) PackSendBuffers_t
Definition: AMReX_NonLocalBC.H:470
std::enable_if_t< IsBaseFab< FAB >) &&IsCallableR< Dim3, DTOS, Dim3 >), FabArrayBase::CommMetaData > makeFillBoundaryMetaData(FabArray< FAB > &mf, IntVect const &nghost, Geometry const &geom, DTOS const &dtos)
Make metadata for FillBoundary.
std::enable_if_t< IsBaseFab< FAB >::value > PackSendBuffers(const PackComponents &components, const FabArray< FAB > &src, CommData &send)
Serializes FAB data without any knowledge of a DTOS nor a projection.
Definition: AMReX_NonLocalBC.H:575
std::enable_if_t< IsBaseFab< FAB >::value > Rotate90(FabArray< FAB > &mf, int scomp, int ncomp, IntVect const &nghost, Box const &domain)
void PrepareCommBuffers(CommData &comm, const FabArrayBase::MapOfCopyComTagContainers &cctc, int n_components, std::size_t object_size, std::size_t align)
Fill all class member variables of comm but the request and the stats vector.
Definition: AMReX_NonLocalBC.cpp:41
std::enable_if_t< IsBaseFab< FAB >::value > Rotate180(FabArray< FAB > &mf, int scomp, int ncomp, IntVect const &nghost, Box const &domain)
std::enable_if_t< IsBaseFab< FAB >) &&IsCallableR< Dim3, DTOS, Dim3 >) &&IsFabProjection< Proj, FAB >)> local_copy_cpu(FabArray< FAB > &dest, const FabArray< FAB > &src, int dcomp, int scomp, int ncomp, FabArrayBase::CopyComTagsContainer const &local_tags, DTOS const &dtos=DTOS{}, Proj const &proj=Proj{}) noexcept
std::enable_if_t< IsBaseFab< FAB >) &&IsCallableR< Dim3, DTOS, Dim3 >) &&IsFabProjection< Proj, FAB >)> unpack_recv_buffer_cpu(FabArray< FAB > &mf, int dcomp, int ncomp, Vector< char * > const &recv_data, Vector< std::size_t > const &recv_size, Vector< FabArrayBase::CopyComTagsContainer const * > const &recv_cctc, DTOS const &dtos=DTOS{}, Proj const &proj=Proj{}) noexcept
decltype(LocalCopy(std::declval< Args >()...)) LocalCopy_t
Definition: AMReX_NonLocalBC.H:476
std::enable_if_t< IsBaseFab< FAB >) &&IsCallableR< Dim3, DTOS, Dim3 >) &&IsFabProjection< Proj, FAB >)> local_copy_gpu(FabArray< FAB > &dest, const FabArray< FAB > &src, int dcomp, int scomp, int ncomp, FabArrayBase::CopyComTagsContainer const &local_tags, DTOS const &dtos=DTOS{}, Proj const &proj=Proj{}) noexcept
std::enable_if_t< IsBaseFab< FAB >) &&IsDataPacking< DataPacking, FAB >)> ParallelCopy_finish(FabArray< FAB > &dest, CommHandler handler, const FabArrayBase::CommMetaData &cmd, const DataPacking &data_packing)
Definition: AMReX_NonLocalBC.H:793
std::enable_if_t< IsCallableR< Dim3, DTOS, Dim3 >::value, IntVect > Apply(DTOS const &dtos, const IntVect &iv)
Applies the Dim3 to Dim3 mapping onto IntVects.
Definition: AMReX_NonLocalBC.H:102
void PostSends(CommData &send, int mpi_tag)
Initiate all sends with MPI_Isend calls associated with tag mpi_tag.
Definition: AMReX_NonLocalBC.cpp:121
std::enable_if_t< IsBaseFab< FAB >::value > PrepareSendBuffers(const PackComponents &components, FabArray< FAB > &dest, const FabArray< FAB > &src, CommData &comm, const FabArrayBase::MapOfCopyComTagContainers &cctc)
Calls PrepareComBuffers.
Definition: AMReX_NonLocalBC.H:555
static constexpr SwapComponents< I, J > swap_indices
Definition: AMReX_NonLocalBC.H:388
void PostRecvs(CommData &recv, int mpi_tag)
Initiate all recvieves with MPI_Irecv calls associated with tag mpi_tag.
Definition: AMReX_NonLocalBC.cpp:105
std::enable_if_t< HasInverseMemFn< DTOS >::value, IntVect > ApplyInverse(DTOS const &dtos, const IntVect &iv)
Applies the Dim3 to Dim3 invserse mapping onto IntVects.
Definition: AMReX_NonLocalBC.H:163
AMREX_NODISCARD CommHandler ParallelCopy_nowait(NoLocalCopy, FabArray< FAB > &dest, const FabArray< FAB > &src, const FabArrayBase::CommMetaData &cmd, const DataPacking &data_packing)
Definition: AMReX_NonLocalBC.H:701
std::enable_if_t< IsCallableR< Dim3, DTOS, Dim3 >::value &&!IsCallableR< IndexType, DTOS, IndexType >::value, Box > Image(DTOS const &dtos, const Box &box)
Applies the Dim3 to Dim3 mapping onto Boxes but does not change the index type.
Definition: AMReX_NonLocalBC.H:118
std::enable_if_t< IsBaseFab< FAB >::value > UnpackRecvBuffers(const PackComponents &components, FabArray< FAB > &dest, const CommData &recv)
De-serializes FAB data without any knowledge of a DTOS nor a projection.
Definition: AMReX_NonLocalBC.H:591
static constexpr struct amrex::NonLocalBC::DoLocalCopy do_local_copy
decltype(PrepareSendBuffers(std::declval< Args >()...)) PrepareSendBuffers_t
Definition: AMReX_NonLocalBC.H:464
std::enable_if_t< IsBaseFab< FAB >) &&IsCallableR< Dim3, DTOS, Dim3 >) &&IsFabProjection< Proj, FAB >), CommHandler > FillBoundary_nowait(FabArray< FAB > &mf, const FabArrayBase::CommMetaData &cmd, int scomp, int ncomp, DTOS const &dtos, Proj const &proj=Proj{})
Start communication to fill boundary.
template MultiBlockCommMetaData ParallelCopy(FabArray< FArrayBox > &dest, const Box &destbox, const FabArray< FArrayBox > &src, int destcomp, int srccomp, int numcomp, const IntVect &ngrow, MultiBlockIndexMapping const &, Identity const &)
std::enable_if_t< HasInverseMemFn< DTOS >::value &&!IsCallableR< IndexType, DTOS, IndexType >::value, Box > InverseImage(DTOS const &dtos, const Box &box)
Applies the inverse Dim3 to Dim3 mapping onto Boxes without changing the index type.
Definition: AMReX_NonLocalBC.H:178
std::enable_if_t< IsBaseFab< FAB >) &&IsCallableR< Dim3, DTOS, Dim3 >) &&IsFabProjection< Proj, FAB >)> unpack_recv_buffer_gpu(FabArray< FAB > &mf, int scomp, int ncomp, Vector< char * > const &recv_data, Vector< std::size_t > const &recv_size, Vector< FabArrayBase::CopyComTagsContainer const * > const &recv_cctc, DTOS const &dtos=DTOS{}, Proj const &proj=Proj{})
std::enable_if_t< IsBaseFab< FAB >::value > LocalCopy(const PackComponents &components, FabArray< FAB > &dest, const FabArray< FAB > &src, const FabArrayBase::CopyComTagsContainer &local_tags)
Dispatch local copies to the default behaviour that knows no DTOS nor projection.
Definition: AMReX_NonLocalBC.H:537
static constexpr Identity identity
Definition: AMReX_NonLocalBC.H:296
decltype(PrepareRecvBuffers(std::declval< Args >()...)) PrepareRecvBuffers_t
Definition: AMReX_NonLocalBC.H:467
static constexpr struct amrex::NonLocalBC::NoLocalCopy no_local_copy
SwapComponents<-1, -1 > DynamicSwapComponents
Definition: AMReX_NonLocalBC.H:386
std::enable_if_t< IsBaseFab< FAB >) &&IsCallableR< Dim3, DTOS, Dim3 >) &&IsFabProjection< Proj, FAB >)> FillBoundary(FabArray< FAB > &mf, const FabArrayBase::CommMetaData &cmd, int scomp, int ncomp, DTOS const &dtos, Proj const &proj=Proj{})
Fill ghost cells for FabArray/MultiFab.
Definition: AMReX_NonLocalBC.H:1165
std::enable_if_t< IsBaseFab< FAB >) &&IsCallableR< Dim3, DTOS, Dim3 >) &&IsFabProjection< Proj, FAB >)> FillBoundary_finish(CommHandler handler, FabArray< FAB > &mf, const FabArrayBase::CommMetaData &cmd, int scomp, int ncomp, DTOS const &dtos, Proj const &proj=Proj{})
Finish communication started by FillBoundary_nowait.
int NProcsSub() noexcept
number of ranks in current frame
Definition: AMReX_ParallelContext.H:74
void Waitall(Vector< MPI_Request > &, Vector< MPI_Status > &)
Definition: AMReX_ParallelDescriptor.cpp:1295
int SeqNum() noexcept
Returns sequential message sequence numbers, usually used as tags for send/recv.
Definition: AMReX_ParallelDescriptor.H:613
@ min
Definition: AMReX_ParallelReduce.H:18
@ max
Definition: AMReX_ParallelReduce.H:17
Definition: AMReX_Amr.cpp:49
std::unique_ptr< char, TheFaArenaDeleter > TheFaArenaPointer
Definition: AMReX_FabArray.H:104
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition: AMReX.H:111
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
std::is_same< Expected, Detected_t< Op, Args... > > IsDetectedExact
Definition: AMReX_TypeTraits.H:181
Definition: AMReX_Array4.H:61
Logical traits let us combine multiple type requirements in one enable_if_t clause.
Definition: AMReX_TypeTraits.H:225
Definition: AMReX_BaseFab.H:72
int i
Definition: AMReX_BaseFab.H:75
Definition: AMReX_Dim3.H:12
int x
Definition: AMReX_Dim3.H:12
int z
Definition: AMReX_Dim3.H:12
int y
Definition: AMReX_Dim3.H:12
Test if a given type T is callable with arguments of type Args...
Definition: AMReX_TypeTraits.H:207
Test if a given type T is callable with arguments of type Args...
Definition: AMReX_TypeTraits.H:201
This class specializes behaviour on local copies and unpacking receive buffers.
Definition: AMReX_NonLocalBC.H:615
constexpr ApplyDtosAndProjectionOnReciever()=default
constexpr ApplyDtosAndProjectionOnReciever(const PackComponents &components, DTOS dtos_=DTOS{}, FabProj proj_=FabProj{})
Definition: AMReX_NonLocalBC.H:617
FabProj proj
Definition: AMReX_NonLocalBC.H:621
DTOS dtos
Definition: AMReX_NonLocalBC.H:620
This class holds data buffers for either immediate MPI send or recv calls.
Definition: AMReX_NonLocalBC.H:415
Vector< std::size_t > size
The size in bytes for each data transaction.
Definition: AMReX_NonLocalBC.H:426
Vector< char * > data
Pointers to the_data that can be used for each single data transaction.
Definition: AMReX_NonLocalBC.H:422
Vector< const FabArrayBase::CopyComTagsContainer * > cctc
For each request the copy comm tags for the corresponding data FABs.
Definition: AMReX_NonLocalBC.H:432
Vector< MPI_Status > stats
For each request the corresponding MPI_status, used for debugging.
Definition: AMReX_NonLocalBC.H:430
Vector< MPI_Request > request
The associated MPI_Request for each data transaction.
Definition: AMReX_NonLocalBC.H:428
TheFaArenaPointer the_data
Holds 'em all in one data pointer.
Definition: AMReX_NonLocalBC.H:418
Vector< int > rank
Stores MPI ranks. For recvs it is the 'from' rank and for sends it is the 'to' rank.
Definition: AMReX_NonLocalBC.H:420
Vector< std::size_t > offset
All offsets of data in the_data.
Definition: AMReX_NonLocalBC.H:424
This class stores both recv and send buffers with an associated MPI tag.
Definition: AMReX_NonLocalBC.H:452
CommData send
Definition: AMReX_NonLocalBC.H:456
int mpi_tag
Definition: AMReX_NonLocalBC.H:454
CommData recv
Definition: AMReX_NonLocalBC.H:455
Definition: AMReX_NonLocalBC.H:673
Type trait that tests if T has an InverseImage class member function.
Definition: AMReX_NonLocalBC.H:20
This class acts as a default no-op operator.
Definition: AMReX_NonLocalBC.H:280
constexpr Dim3 operator()(Dim3 i) const noexcept
The identity function for Dim3.
Definition: AMReX_NonLocalBC.H:282
constexpr T operator()(Array4< const T > array, Dim3 i, int comp=0) const noexcept(noexcept(array(i.x, i.y, i.z, comp)))
Definition: AMReX_NonLocalBC.H:288
constexpr int operator()(int i) const noexcept
The identity for int.
Definition: AMReX_NonLocalBC.H:294
static constexpr Dim3 Inverse(Dim3 i) noexcept
The identity function for Dim3.
Definition: AMReX_NonLocalBC.H:284
This type trait tests if a given type DP satisfies the DataPacking concept for type FAB.
Definition: AMReX_NonLocalBC.H:489
This type trait tests if a type P is a projection for FAB.
Definition: AMReX_NonLocalBC.H:271
Tests if a given type IndexMap is usable as an index mapping between two index based coordinate syste...
Definition: AMReX_NonLocalBC.H:27
This class takes a projection and a component map and combines them to form a new projection.
Definition: AMReX_NonLocalBC.H:314
Base base
Definition: AMReX_NonLocalBC.H:316
Map map
Definition: AMReX_NonLocalBC.H:322
This struct describes an affine index transformation for two coordinate systems.
Definition: AMReX_NonLocalBC.H:37
IndexType operator()(IndexType it) const noexcept
Definition: AMReX_NonLocalBC.H:76
IntVect sign
A vector of 1 and -1 describing the orientation in each component.
Definition: AMReX_NonLocalBC.H:43
IntVect offset
The offset in the source index space.
Definition: AMReX_NonLocalBC.H:41
AMREX_GPU_HOST_DEVICE Dim3 operator()(Dim3 i) const noexcept
Applies this mapping on the index from destination space and returns an index in the source space.
Definition: AMReX_NonLocalBC.H:51
IntVect permutation
This vector needs to be a valid permutation.
Definition: AMReX_NonLocalBC.H:39
IndexType Inverse(IndexType it) const noexcept
Definition: AMReX_NonLocalBC.H:80
AMREX_GPU_HOST_DEVICE Dim3 Inverse(Dim3 i) const noexcept
The inverse function is given by rearringing all above terms.
Definition: AMReX_NonLocalBC.H:66
Definition: AMReX_NonLocalBC.H:672
Contains information about which components take part of the data transaction.
Definition: AMReX_NonLocalBC.H:528
int dest_component
Definition: AMReX_NonLocalBC.H:529
int src_component
Definition: AMReX_NonLocalBC.H:530
int n_components
Definition: AMReX_NonLocalBC.H:531
Definition: AMReX_NonLocalBC.H:377
int J
Definition: AMReX_NonLocalBC.H:379
int I
Definition: AMReX_NonLocalBC.H:378
constexpr int operator()(int i) const noexcept
Definition: AMReX_NonLocalBC.H:380
constexpr int operator()(int i) const noexcept
Definition: AMReX_NonLocalBC.H:371
int I
Definition: AMReX_NonLocalBC.H:368
int J
Definition: AMReX_NonLocalBC.H:358
constexpr int operator()(int i) const noexcept
Definition: AMReX_NonLocalBC.H:361
This is a permutation where only two components are swapped.
Definition: AMReX_NonLocalBC.H:345
constexpr int operator()(int i) const noexcept
Swaps indices I and J.
Definition: AMReX_NonLocalBC.H:351
Definition: AMReX_BaseFab.H:78
int n
Definition: AMReX_BaseFab.H:81
Definition: AMReX_BaseFab.H:66
int i
Definition: AMReX_BaseFab.H:69