Skip to content

Commit

Permalink
enable 1d and 2d ctest
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Oct 18, 2024
1 parent 3b71a9e commit 90410c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
41 changes: 23 additions & 18 deletions Src/FFT/AMReX_FFT.H
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,12 @@ R2C<T>::R2C (Box const& domain, Info const& info)
m_info(info)
{
static_assert(std::is_same_v<float,T> || std::is_same_v<double,T>);
AMREX_ALWAYS_ASSERT(m_real_domain.smallEnd() == 0 && m_real_domain.cellCentered());
AMREX_ALWAYS_ASSERT(m_real_domain.smallEnd() == 0 &&
m_real_domain.length(0) > 1 &&
m_real_domain.cellCentered());
#if (AMREX_SPACEDIM == 3)
AMREX_ALWAYS_ASSERT(m_real_domain.length(2) > 1 || false == m_info.batch_mode);
AMREX_ALWAYS_ASSERT(m_real_domain.length(1) > 1 || m_real_domain.length(2) == 1);
#else
AMREX_ALWAYS_ASSERT(false == m_info.batch_mode);
#endif
Expand Down Expand Up @@ -337,26 +340,28 @@ R2C<T>::R2C (Box const& domain, Info const& info)
}

#if (AMREX_SPACEDIM >= 2)
auto cbay = amrex::decompose(m_spectral_domain_y, nprocs, {AMREX_D_DECL(false,true,true)});
DistributionMapping cdmy;
if (cbay.size() == dmx.size()) {
cdmy = dmx;
} else {
Vector<int> pm(cbay.size());
std::iota(pm.begin(), pm.end(), 0);
cdmy.define(std::move(pm));
}
m_cy.define(cbay, cdmy, 1, 0);
if (m_real_domain.length(1) > 1) {
auto cbay = amrex::decompose(m_spectral_domain_y, nprocs, {AMREX_D_DECL(false,true,true)});
if (cbay.size() == dmx.size()) {
cdmy = dmx;
} else {
Vector<int> pm(cbay.size());
std::iota(pm.begin(), pm.end(), 0);
cdmy.define(std::move(pm));
}
m_cy.define(cbay, cdmy, 1, 0);

std::tie(m_fft_fwd_y, m_fft_bwd_y) = make_c2c_plans(m_cy);
std::tie(m_fft_fwd_y, m_fft_bwd_y) = make_c2c_plans(m_cy);

// comm meta-data between x and y phases
m_cmd_x2y = std::make_unique<MultiBlockCommMetaData>
(m_cy.boxArray(), m_cy.DistributionMap(), m_spectral_domain_y,
m_cx.boxArray(), m_cx.DistributionMap(), IntVect(0), m_dtos_x2y);
m_cmd_y2x = std::make_unique<MultiBlockCommMetaData>
(m_cx.boxArray(), m_cx.DistributionMap(), m_spectral_domain_x,
m_cy.boxArray(), m_cy.DistributionMap(), IntVect(0), m_dtos_y2x);
// comm meta-data between x and y phases
m_cmd_x2y = std::make_unique<MultiBlockCommMetaData>
(m_cy.boxArray(), m_cy.DistributionMap(), m_spectral_domain_y,
m_cx.boxArray(), m_cx.DistributionMap(), IntVect(0), m_dtos_x2y);
m_cmd_y2x = std::make_unique<MultiBlockCommMetaData>
(m_cx.boxArray(), m_cx.DistributionMap(), m_spectral_domain_x,
m_cy.boxArray(), m_cy.DistributionMap(), IntVect(0), m_dtos_y2x);
}

#if (AMREX_SPACEDIM == 3)
if (false == m_info.batch_mode || m_real_domain.length(2) > 1) {
Expand Down
4 changes: 0 additions & 4 deletions Tests/FFT/Poisson/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
foreach(D IN LISTS AMReX_SPACEDIM)
if (NOT D EQUAL 3) # 3d only for now
return()
endif()

set(_sources main.cpp)

set(_input_files)
Expand Down

0 comments on commit 90410c6

Please sign in to comment.