1 #ifndef AMREX_FFT_R2C_H_
2 #define AMREX_FFT_R2C_H_
3 #include <AMReX_Config.H>
14 template <
typename T>
class OpenBCSolver;
15 template <
typename T>
class Poisson;
16 template <
typename T>
class PoissonHybrid;
38 using MF = std::conditional_t<std::is_same_v<T,Real>,
43 template <
typename U>
friend class Poisson;
81 std::enable_if_t<DIR == Direction::both, int> = 0>
86 this->post_forward_doit<0>(post_forward);
124 template <Direction DIR=D, std::enable_if_t<DIR == Direction::both,
int> = 0>
168 template <
int Depth,
typename F>
234 template <
typename T, Direction D, DomainStrategy S>
236 : m_real_domain(domain),
241 #
if (AMREX_SPACEDIM >= 2)
246 #
if (AMREX_SPACEDIM == 3)
253 m_sub_helper(domain),
258 static_assert(std::is_same_v<float,T> || std::is_same_v<double,T>);
261 #if (AMREX_SPACEDIM == 2)
266 int(domain.
length(1) > 1) +
267 int(domain.
length(2) > 1)) >= 2);
274 m_r2c_sub = std::make_unique<R2C<T,D,S>>(subbox, info);
282 #if (AMREX_SPACEDIM == 3)
295 m_rx.define(bax, dmx, 1, 0,
MFInfo().SetAlloc(
false));
299 for (
auto &
b : bl) {
315 #if (AMREX_SPACEDIM >= 2)
316 #if (AMREX_SPACEDIM == 2)
317 bool batch_on_y =
false;
326 if (cbay.size() == dmx.size()) {
335 #if (AMREX_SPACEDIM == 3)
340 {
false,
true,
true},
true);
342 if (cbaz.size() == dmx.size()) {
344 }
else if (cbaz.size() == cdmy.
size()) {
365 #if (AMREX_SPACEDIM >= 2)
368 m_cmd_x2y = std::make_unique<MultiBlockCommMetaData>
370 m_cmd_y2x = std::make_unique<MultiBlockCommMetaData>
374 #if (AMREX_SPACEDIM == 3)
378 m_cmd_x2z = std::make_unique<MultiBlockCommMetaData>
380 m_cmd_z2x = std::make_unique<MultiBlockCommMetaData>
384 m_cmd_y2z = std::make_unique<MultiBlockCommMetaData>
386 m_cmd_z2y = std::make_unique<MultiBlockCommMetaData>
396 if (myproc <
m_rx.size())
398 Box const& box =
m_rx.box(myproc);
399 auto* pr =
m_rx[myproc].dataPtr();
401 #ifdef AMREX_USE_SYCL
414 #if (AMREX_SPACEDIM >= 2)
419 #if (AMREX_SPACEDIM == 3)
431 auto* pr = (
void*)
m_rx[0].dataPtr();
432 auto* pc = (
void*)
m_cx[0].dataPtr();
433 #ifdef AMREX_USE_SYCL
434 m_fft_fwd_x.template init_r2c<Direction::forward>(len, pr, pc,
false);
438 m_fft_fwd_x.template init_r2c<Direction::forward>(len, pr, pc,
false);
441 m_fft_bwd_x.template init_r2c<Direction::backward>(len, pr, pc,
false);
447 template <
typename T, Direction D, DomainStrategy S>
450 if (m_fft_bwd_x.plan != m_fft_fwd_x.plan) {
451 m_fft_bwd_x.destroy();
453 if (m_fft_bwd_y.plan != m_fft_fwd_y.plan) {
454 m_fft_bwd_y.destroy();
456 if (m_fft_bwd_z.plan != m_fft_fwd_z.plan) {
457 m_fft_bwd_z.destroy();
459 m_fft_fwd_x.destroy();
460 m_fft_fwd_y.destroy();
461 m_fft_fwd_z.destroy();
462 if (m_fft_bwd_x_half.plan != m_fft_fwd_x_half.plan) {
463 m_fft_bwd_x_half.destroy();
465 m_fft_fwd_x_half.destroy();
468 template <
typename T, Direction D, DomainStrategy S>
471 if (m_r2c_sub) {
amrex::Abort(
"R2C: OpenBC not supported with reduced dimensions"); }
473 #if (AMREX_SPACEDIM == 3)
474 if (m_do_alld_fft) {
return; }
479 Box bottom_half = m_real_domain;
480 bottom_half.
growHi(2,-m_real_domain.length(2)/2);
481 Box box = fab->box() & bottom_half;
483 auto* pr = fab->dataPtr();
486 #ifdef AMREX_USE_SYCL
487 m_fft_fwd_x_half.template init_r2c<Direction::forward>
488 (box, pr, pc, m_slab_decomp);
489 m_fft_bwd_x_half = m_fft_fwd_x_half;
492 m_fft_fwd_x_half.template init_r2c<Direction::forward>
493 (box, pr, pc, m_slab_decomp);
496 m_fft_bwd_x_half.template init_r2c<Direction::backward>
497 (box, pr, pc, m_slab_decomp);
504 if (m_cmd_x2z && ! m_cmd_x2z_half) {
505 Box bottom_half = m_spectral_domain_z;
508 bottom_half.
growHi(0,-m_spectral_domain_z.length(0)/2);
509 m_cmd_x2z_half = std::make_unique<MultiBlockCommMetaData>
510 (m_cz, bottom_half, m_cx,
IntVect(0), m_dtos_x2z);
513 if (m_cmd_z2x && ! m_cmd_z2x_half) {
514 Box bottom_half = m_spectral_domain_x;
515 bottom_half.
growHi(2,-m_spectral_domain_x.length(2)/2);
516 m_cmd_z2x_half = std::make_unique<MultiBlockCommMetaData>
517 (m_cx, bottom_half, m_cz,
IntVect(0), m_dtos_z2x);
522 template <
typename T, Direction D, DomainStrategy S>
530 if (m_sub_helper.ghost_safe(inmf.nGrowVect())) {
531 m_r2c_sub->forward(m_sub_helper.make_alias_mf(inmf));
533 MF tmp(inmf.boxArray(), inmf.DistributionMap(), 1, 0);
534 tmp.LocalCopy(inmf, 0, 0, 1,
IntVect(0));
535 m_r2c_sub->forward(m_sub_helper.make_alias_mf(tmp));
540 if (&m_rx != &inmf) {
541 m_rx.ParallelCopy(inmf, 0, 0, 1);
545 m_fft_fwd_x.template compute_r2c<Direction::forward>();
549 auto& fft_x = m_openbc_half ? m_fft_fwd_x_half : m_fft_fwd_x;
550 fft_x.template compute_r2c<Direction::forward>();
553 ParallelCopy(m_cy, m_cx, *m_cmd_x2y, 0, 0, 1, m_dtos_x2y);
555 m_fft_fwd_y.template compute_c2c<Direction::forward>();
558 ParallelCopy(m_cz, m_cy, *m_cmd_y2z, 0, 0, 1, m_dtos_y2z);
560 #if (AMREX_SPACEDIM == 3)
561 else if ( m_cmd_x2z) {
567 Box upper_half = m_spectral_domain_z;
570 upper_half.
growLo (0,-m_spectral_domain_z.length(0)/2);
571 m_cz.setVal(0, upper_half, 0, 1);
575 ParallelCopy(m_cz, m_cx, *m_cmd_x2z, 0, 0, 1, m_dtos_x2z);
579 m_fft_fwd_z.template compute_c2c<Direction::forward>();
582 template <
typename T, Direction D, DomainStrategy S>
583 template <Direction DIR, std::enable_if_t<DIR == Direction::both,
int> >
586 backward_doit(outmf);
589 template <
typename T, Direction D, DomainStrategy S>
596 if (m_sub_helper.ghost_safe(outmf.nGrowVect())) {
597 MF submf = m_sub_helper.make_alias_mf(outmf);
598 IntVect const& subngout = m_sub_helper.make_iv(ngout);
599 Periodicity const& subperiod = m_sub_helper.make_periodicity(period);
600 m_r2c_sub->backward_doit(submf, subngout, subperiod);
602 MF tmp(outmf.boxArray(), outmf.DistributionMap(), 1,
603 m_sub_helper.make_safe_ghost(outmf.nGrowVect()));
604 this->backward_doit(tmp, ngout, period);
605 outmf.LocalCopy(tmp, 0, 0, 1, tmp.nGrowVect());
611 m_fft_bwd_x.template compute_r2c<Direction::backward>();
612 outmf.ParallelCopy(m_rx, 0, 0, 1,
IntVect(0),
617 m_fft_bwd_z.template compute_c2c<Direction::backward>();
619 ParallelCopy(m_cy, m_cz, *m_cmd_z2y, 0, 0, 1, m_dtos_z2y);
621 #if (AMREX_SPACEDIM == 3)
622 else if ( m_cmd_z2x) {
623 auto const& cmd = m_openbc_half ? m_cmd_z2x_half : m_cmd_z2x;
628 m_fft_bwd_y.template compute_c2c<Direction::backward>();
630 ParallelCopy(m_cx, m_cy, *m_cmd_y2x, 0, 0, 1, m_dtos_y2x);
633 auto& fft_x = m_openbc_half ? m_fft_bwd_x_half : m_fft_bwd_x;
634 fft_x.template compute_r2c<Direction::backward>();
635 outmf.ParallelCopy(m_rx, 0, 0, 1,
IntVect(0),
639 template <
typename T, Direction D, DomainStrategy S>
647 if (!fab) {
return {fwd, bwd};}
649 Box const& box = fab->box();
652 #ifdef AMREX_USE_SYCL
653 fwd.template init_c2c<Direction::forward>(box, pio);
657 fwd.template init_c2c<Direction::forward>(box, pio);
660 bwd.template init_c2c<Direction::backward>(box, pio);
667 template <
typename T, Direction D, DomainStrategy S>
668 template <
int Depth,
typename F>
671 if (m_info.batch_mode) {
673 #if (AMREX_SPACEDIM > 1)
674 }
else if (m_r2c_sub) {
675 if constexpr (Depth == 0) {
677 #if (AMREX_SPACEDIM == 2)
679 m_r2c_sub->template post_forward_doit<(Depth+1)>
682 post_forward(0, i, 0, sp);
685 if (m_real_domain.length(0) == 1 && m_real_domain.length(1) == 1) {
687 m_r2c_sub->template post_forward_doit<(Depth+1)>
690 post_forward(0, 0, i, sp);
692 }
else if (m_real_domain.length(0) == 1 && m_real_domain.length(2) == 1) {
694 m_r2c_sub->template post_forward_doit<(Depth+1)>
697 post_forward(0, i, 0, sp);
699 }
else if (m_real_domain.length(0) == 1) {
701 m_r2c_sub->template post_forward_doit<(Depth+1)>
704 post_forward(0, i, j, sp);
706 }
else if (m_real_domain.length(1) == 1) {
708 m_r2c_sub->template post_forward_doit<(Depth+1)>
711 post_forward(i, 0, j, sp);
714 amrex::Abort(
"R2c::post_forward_doit: how did this happen?");
718 amrex::Abort(
"R2C::post_forward_doit: How did this happen?");
722 if ( ! m_cz.empty()) {
725 auto const& a = spectral_fab->array();
729 post_forward(jx,ky,
iz,a(
iz,jx,ky));
732 }
else if ( ! m_cy.empty()) {
735 auto const& a = spectral_fab->array();
739 post_forward(jx,
iy,k,a(
iy,jx,k));
745 auto const& a = spectral_fab->array();
749 post_forward(i,j,k,a(i,j,k));
756 template <
typename T, Direction D, DomainStrategy S>
759 #if (AMREX_SPACEDIM == 3)
760 if (m_info.batch_mode) {
761 if (m_real_domain.length(2) > 1) {
762 return T(1)/T(Long(m_real_domain.length(0)) *
763 Long(m_real_domain.length(1)));
765 return T(1)/T(m_real_domain.length(0));
770 return T(1)/T(m_real_domain.numPts());
774 template <
typename T, Direction D, DomainStrategy S>
777 std::pair<typename R2C<T,D,S>::cMF *,
IntVect>
780 #if (AMREX_SPACEDIM > 1)
782 auto [cmf, order] = m_r2c_sub->getSpectralData();
783 return std::make_pair(cmf, m_sub_helper.inverse_order(order));
788 }
else if (!m_cy.empty()) {
795 template <
typename T, Direction D, DomainStrategy S>
804 bool inmf_safe = m_sub_helper.ghost_safe(inmf.nGrowVect());
805 MF inmf_sub, inmf_tmp;
807 inmf_sub = m_sub_helper.make_alias_mf(inmf);
809 inmf_tmp.define(inmf.boxArray(), inmf.DistributionMap(), 1, 0);
810 inmf_tmp.LocalCopy(inmf, 0, 0, 1,
IntVect(0));
811 inmf_sub = m_sub_helper.make_alias_mf(inmf_tmp);
814 bool outmf_safe = m_sub_helper.ghost_safe(outmf.
nGrowVect());
815 cMF outmf_sub, outmf_tmp;
817 outmf_sub = m_sub_helper.make_alias_mf(outmf);
820 outmf_sub = m_sub_helper.make_alias_mf(outmf_tmp);
823 m_r2c_sub->forward(inmf_sub, outmf_sub);
835 (outmf, m_spectral_domain_x, m_cz,
IntVect(0), dtos);
837 }
else if (!m_cy.empty()) {
839 (outmf, m_spectral_domain_x, m_cy,
IntVect(0), m_dtos_y2x);
847 template <
typename T, Direction D, DomainStrategy S>
852 backward_doit(inmf, outmf);
855 template <
typename T, Direction D, DomainStrategy S>
863 bool inmf_safe = m_sub_helper.ghost_safe(inmf.
nGrowVect());
864 cMF inmf_sub, inmf_tmp;
866 inmf_sub = m_sub_helper.make_alias_mf(inmf);
870 inmf_sub = m_sub_helper.make_alias_mf(inmf_tmp);
873 bool outmf_safe = m_sub_helper.ghost_safe(outmf.nGrowVect());
874 MF outmf_sub, outmf_tmp;
876 outmf_sub = m_sub_helper.make_alias_mf(outmf);
878 IntVect const& ngtmp = m_sub_helper.make_safe_ghost(outmf.nGrowVect());
879 outmf_tmp.define(outmf.boxArray(), outmf.DistributionMap(), 1, ngtmp);
880 outmf_sub = m_sub_helper.make_alias_mf(outmf_tmp);
883 IntVect const& subngout = m_sub_helper.make_iv(ngout);
884 Periodicity const& subperiod = m_sub_helper.make_periodicity(period);
885 m_r2c_sub->backward_doit(inmf_sub, outmf_sub, subngout, subperiod);
888 outmf.LocalCopy(outmf_tmp, 0, 0, 1, outmf_tmp.nGrowVect());
896 (m_cz, m_spectral_domain_z, inmf,
IntVect(0), dtos);
898 }
else if (!m_cy.empty()) {
900 (m_cy, m_spectral_domain_y, inmf,
IntVect(0), m_dtos_x2y);
903 m_cx.ParallelCopy(inmf, 0, 0, 1);
905 backward_doit(outmf, ngout, period);
909 template <
typename T, Direction D, DomainStrategy S>
910 std::pair<BoxArray,DistributionMapping>
913 #if (AMREX_SPACEDIM > 1)
915 auto const& [ba, dm] = m_r2c_sub->getSpectralDataLayout();
916 return std::make_pair(m_sub_helper.inverse_boxarray(ba), dm);
920 #if (AMREX_SPACEDIM == 3)
922 BoxList bl = m_cz.boxArray().boxList();
924 auto lo =
b.smallEnd();
925 auto hi =
b.bigEnd();
933 return std::make_pair(
BoxArray(std::move(bl)), m_cz.DistributionMap());
936 #if (AMREX_SPACEDIM >= 2)
938 BoxList bl = m_cy.boxArray().boxList();
940 auto lo =
b.smallEnd();
941 auto hi =
b.bigEnd();
947 return std::make_pair(
BoxArray(std::move(bl)), m_cy.DistributionMap());
951 return std::make_pair(m_cx.boxArray(), m_cx.DistributionMap());
#define BL_PROFILE(a)
Definition: AMReX_BLProfiler.H:551
#define AMREX_ALWAYS_ASSERT(EX)
Definition: AMReX_BLassert.H:50
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
if(!(yy_init))
Definition: amrex_iparser.lex.nolint.H:935
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:550
A class for managing a List of Boxes that share a common IndexType. This class implements operations ...
Definition: AMReX_BoxList.H:52
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 const IntVectND< dim > & bigEnd() const &noexcept
Get the bigend.
Definition: AMReX_Box.H:116
AMREX_GPU_HOST_DEVICE IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition: AMReX_Box.H:146
AMREX_GPU_HOST_DEVICE BoxND & growHi(int idir, int n_cell=1) noexcept
Grow the BoxND on the high end by n_cell cells in direction idir. NOTE: n_cell negative shrinks the B...
Definition: AMReX_Box.H:659
AMREX_GPU_HOST_DEVICE BoxND & growLo(int idir, int n_cell=1) noexcept
Grow the BoxND on the low end by n_cell cells in direction idir. NOTE: n_cell negative shrinks the Bo...
Definition: AMReX_Box.H:648
AMREX_GPU_HOST_DEVICE IntVectND< dim > size() const noexcept
Return the length of the BoxND.
Definition: AMReX_Box.H:139
AMREX_GPU_HOST_DEVICE bool ok() const noexcept
Checks if it is a proper BoxND (including a valid type).
Definition: AMReX_Box.H:200
AMREX_GPU_HOST_DEVICE Long numPts() const noexcept
Returns the number of points contained in the BoxND.
Definition: AMReX_Box.H:346
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
Long size() const noexcept
Length of the underlying processor map.
Definition: AMReX_DistributionMapping.H:127
Definition: AMReX_FFT_OpenBCSolver.H:11
3D Poisson solver for periodic, Dirichlet & Neumann boundaries in the first two dimensions,...
Definition: AMReX_FFT_Poisson.H:106
Poisson solver for periodic, Dirichlet & Neumann boundaries using FFT.
Definition: AMReX_FFT_Poisson.H:22
Parallel Discrete Fourier Transform.
Definition: AMReX_FFT_R2C.H:36
T scalingFactor() const
Definition: AMReX_FFT_R2C.H:757
void prepare_openbc()
Definition: AMReX_FFT_R2C.H:469
std::unique_ptr< MultiBlockCommMetaData > m_cmd_x2z_half
Definition: AMReX_FFT_R2C.H:202
std::unique_ptr< MultiBlockCommMetaData > m_cmd_z2x_half
Definition: AMReX_FFT_R2C.H:203
void backward_doit(cMF const &inmf, MF &outmf, IntVect const &ngout=IntVect(0), Periodicity const &period=Periodicity::NonPeriodic())
Definition: AMReX_FFT_R2C.H:856
static std::pair< Plan< T >, Plan< T > > make_c2c_plans(cMF &inout)
Definition: AMReX_FFT_R2C.H:641
std::conditional_t< std::is_same_v< T, Real >, MultiFab, FabArray< BaseFab< T > > > MF
Definition: AMReX_FFT_R2C.H:39
std::pair< cMF *, IntVect > getSpectralData()
Get the internal spectral data.
void forwardThenBackward(MF const &inmf, MF &outmf, F const &post_forward)
Forward and then backward transform.
Definition: AMReX_FFT_R2C.H:82
MF m_rx
Definition: AMReX_FFT_R2C.H:211
bool m_openbc_half
Definition: AMReX_FFT_R2C.H:231
std::unique_ptr< R2C< T, D, S > > m_r2c_sub
Definition: AMReX_FFT_R2C.H:224
detail::SubHelper m_sub_helper
Definition: AMReX_FFT_R2C.H:225
Box m_real_domain
Definition: AMReX_FFT_R2C.H:219
Swap02 m_dtos_z2y
Definition: AMReX_FFT_R2C.H:207
Swap01 m_dtos_y2x
Definition: AMReX_FFT_R2C.H:205
std::unique_ptr< MultiBlockCommMetaData > m_cmd_z2y
Definition: AMReX_FFT_R2C.H:199
Info m_info
Definition: AMReX_FFT_R2C.H:227
Plan< T > m_fft_fwd_x_half
Definition: AMReX_FFT_R2C.H:190
cMF m_cy
Definition: AMReX_FFT_R2C.H:213
std::unique_ptr< MultiBlockCommMetaData > m_cmd_x2z
Definition: AMReX_FFT_R2C.H:200
Box m_spectral_domain_z
Definition: AMReX_FFT_R2C.H:222
void forward(MF const &inmf, cMF &outmf)
Forward transform.
Definition: AMReX_FFT_R2C.H:798
bool m_do_alld_fft
Definition: AMReX_FFT_R2C.H:229
std::unique_ptr< MultiBlockCommMetaData > m_cmd_y2z
Definition: AMReX_FFT_R2C.H:198
Plan< T > m_fft_bwd_z
Definition: AMReX_FFT_R2C.H:189
RotateBwd m_dtos_z2x
Definition: AMReX_FFT_R2C.H:209
void backward(MF &outmf)
Backward transform.
Definition: AMReX_FFT_R2C.H:584
Box m_spectral_domain_y
Definition: AMReX_FFT_R2C.H:221
Plan< T > m_fft_fwd_y
Definition: AMReX_FFT_R2C.H:186
std::unique_ptr< MultiBlockCommMetaData > m_cmd_y2x
Definition: AMReX_FFT_R2C.H:197
std::pair< BoxArray, DistributionMapping > getSpectralDataLayout() const
Get BoxArray and DistributionMapping for spectral data.
Definition: AMReX_FFT_R2C.H:911
void post_forward_doit(F const &post_forward)
Definition: AMReX_FFT_R2C.H:669
std::unique_ptr< char, DataDeleter > m_data_1
Definition: AMReX_FFT_R2C.H:216
std::unique_ptr< MultiBlockCommMetaData > m_cmd_z2x
Definition: AMReX_FFT_R2C.H:201
std::unique_ptr< MultiBlockCommMetaData > m_cmd_x2y
Definition: AMReX_FFT_R2C.H:196
void backward_doit(MF &outmf, IntVect const &ngout=IntVect(0), Periodicity const &period=Periodicity::NonPeriodic())
Definition: AMReX_FFT_R2C.H:590
R2C(Box const &domain, Info const &info=Info{})
Constructor.
Definition: AMReX_FFT_R2C.H:235
R2C & operator=(R2C const &)=delete
std::unique_ptr< char, DataDeleter > m_data_2
Definition: AMReX_FFT_R2C.H:217
Swap02 m_dtos_y2z
Definition: AMReX_FFT_R2C.H:206
Plan< T > m_fft_bwd_y
Definition: AMReX_FFT_R2C.H:187
bool m_slab_decomp
Definition: AMReX_FFT_R2C.H:230
Box m_spectral_domain_x
Definition: AMReX_FFT_R2C.H:220
cMF m_cz
Definition: AMReX_FFT_R2C.H:214
Swap01 m_dtos_x2y
Definition: AMReX_FFT_R2C.H:204
Plan< T > m_fft_fwd_z
Definition: AMReX_FFT_R2C.H:188
RotateFwd m_dtos_x2z
Definition: AMReX_FFT_R2C.H:208
~R2C()
Definition: AMReX_FFT_R2C.H:448
Plan< T > m_fft_bwd_x
Definition: AMReX_FFT_R2C.H:185
void backward(cMF const &inmf, MF &outmf)
Backward transform.
Definition: AMReX_FFT_R2C.H:850
void forward(MF const &inmf)
Forward transform.
Definition: AMReX_FFT_R2C.H:525
Plan< T > m_fft_fwd_x
Definition: AMReX_FFT_R2C.H:184
cMF m_cx
Definition: AMReX_FFT_R2C.H:212
Plan< T > m_fft_bwd_x_half
Definition: AMReX_FFT_R2C.H:191
IntVect nGrowVect() const noexcept
Definition: AMReX_FabArrayBase.H:79
const BoxArray & boxArray() const noexcept
Return a constant reference to the BoxArray that defines the valid region associated with this FabArr...
Definition: AMReX_FabArrayBase.H:94
bool empty() const noexcept
Definition: AMReX_FabArrayBase.H:88
const DistributionMapping & DistributionMap() const noexcept
Return constant reference to associated DistributionMapping.
Definition: AMReX_FabArrayBase.H:130
An Array of FortranArrayBox(FAB)-like Objects.
Definition: AMReX_FabArray.H:344
void ParallelCopy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition: AMReX_FabArray.H:778
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, int ngrow, const MFInfo &info=MFInfo(), const FabFactory< FAB > &factory=DefaultFabFactory< FAB >())
Define this FabArray identically to that performed by the constructor having an analogous function si...
Definition: AMReX_FabArray.H:2027
void LocalCopy(FabArray< SFAB > const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
Perform local copy of FabArray data.
Definition: AMReX_FabArray.H:1818
A collection (stored as an array) of FArrayBox objects.
Definition: AMReX_MultiFab.H:38
This provides length of period for periodic domains. 0 means it is not periodic in that direction....
Definition: AMReX_Periodicity.H:17
static const Periodicity & NonPeriodic() noexcept
Definition: AMReX_Periodicity.cpp:52
FA::FABType::value_type * get_fab(FA &fa)
Definition: AMReX_FFT_Helper.H:1305
std::unique_ptr< char, DataDeleter > make_mfs_share(FA1 &fa1, FA2 &fa2)
Definition: AMReX_FFT_Helper.H:1316
DistributionMapping make_iota_distromap(Long n)
Definition: AMReX_FFT.cpp:88
Definition: AMReX_FFT.cpp:7
Direction
Definition: AMReX_FFT_Helper.H:48
DomainStrategy
Definition: AMReX_FFT_Helper.H:50
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
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
int MyProcSub() noexcept
my sub-rank in current frame
Definition: AMReX_ParallelContext.H:76
int NProcsSub() noexcept
number of ranks in current frame
Definition: AMReX_ParallelContext.H:74
int NProcs() noexcept
return the number of MPI ranks local to the current Parallel Context
Definition: AMReX_ParallelDescriptor.H:243
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void swap(T &a, T &b) noexcept
Definition: AMReX_algoim_K.H:113
@ min
Definition: AMReX_ParallelReduce.H:18
constexpr int iz
Definition: AMReX_Interp_3D_C.H:37
constexpr int iy
Definition: AMReX_Interp_2D_C.H:33
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
IntVectND< AMREX_SPACEDIM > IntVect
Definition: AMReX_BaseFwd.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 length(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:322
BoxArray decompose(Box const &domain, int nboxes, Array< bool, AMREX_SPACEDIM > const &decomp={AMREX_D_DECL(true, true, true)}, bool no_overlap=false)
Decompose domain box into BoxArray.
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
void ParallelCopy(MF &dst, MF const &src, int scomp, int dcomp, int ncomp, IntVect const &ng_src=IntVect(0), IntVect const &ng_dst=IntVect(0), Periodicity const &period=Periodicity::NonPeriodic())
dst = src w/ MPI communication
Definition: AMReX_FabArrayUtility.H:1672
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE T elemwiseMin(T const &a, T const &b) noexcept
Definition: AMReX_Algorithm.H:49
Definition: AMReX_FFT_Helper.H:58
bool batch_mode
Definition: AMReX_FFT_Helper.H:62
int nprocs
Max number of processes to use.
Definition: AMReX_FFT_Helper.H:65
Definition: AMReX_FFT_Helper.H:113
std::conditional_t< std::is_same_v< float, T >, cuComplex, cuDoubleComplex > VendorComplex
Definition: AMReX_FFT_Helper.H:117
Definition: AMReX_FFT_Helper.H:1428
Definition: AMReX_FFT_Helper.H:1403
Definition: AMReX_FFT_Helper.H:1357
Definition: AMReX_FFT_Helper.H:1380
Definition: AMReX_FFT_Helper.H:1455
Box make_box(Box const &box) const
Definition: AMReX_FFT.cpp:142
FabArray memory allocation information.
Definition: AMReX_FabArray.H:66
This class specializes behaviour on local copies and unpacking receive buffers.
Definition: AMReX_NonLocalBC.H:615
Contains information about which components take part of the data transaction.
Definition: AMReX_NonLocalBC.H:528