8#ifndef IPPL_FFT_OPEN_POISSON_SOLVER_H_
9#define IPPL_FFT_OPEN_POISSON_SOLVER_H_
11#include <Kokkos_MathematicalConstants.hpp>
12#include <Kokkos_MathematicalFunctions.hpp>
39 template <
int tensorRank,
typename>
42 template <
typename View>
44 KOKKOS_INLINE_FUNCTION
constexpr static auto&
get(View&& view,
unsigned dim1,
45 unsigned dim2,
size_t i,
size_t j,
47 return view(i, j, k)[dim1][dim2];
51 template <
typename View>
53 KOKKOS_INLINE_FUNCTION
constexpr static auto&
get(View&& view,
unsigned dim1,
54 [[maybe_unused]]
unsigned dim2,
55 size_t i,
size_t j,
size_t k) {
56 return view(i, j, k)[dim1];
60 template <
typename View>
62 KOKKOS_INLINE_FUNCTION
constexpr static auto&
get(View&& view,
63 [[maybe_unused]]
unsigned dim1,
64 [[maybe_unused]]
unsigned dim2,
65 size_t i,
size_t j,
size_t k) {
71 template <
typename FieldLHS,
typename FieldRHS>
73 constexpr static unsigned Dim = FieldLHS::dim;
74 using Trhs =
typename FieldRHS::value_type;
76 using Tg =
typename FieldLHS::value_type::value_type;
137 void solve()
override;
144 "FFTOpenPoissonSolver::getHessian()",
145 "Cannot call getHessian() if 'hessian' flag in ParameterList is false");
224 std::unique_ptr<FFT<CCTransform, CxField_gt>>
fft4n_m;
234 std::unique_ptr<FFT<Cos1Transform, Field_t>>
fft2n1_m;
249 using heffteBackend =
typename FFT_t::heffteBackend;
250 heffte::plan_options opts = heffte::default_options<heffteBackend>();
251 this->
params_m.add(
"use_pencils", opts.use_pencils);
252 this->
params_m.add(
"use_reorder", opts.use_reorder);
253 this->
params_m.add(
"use_gpu_aware", opts.use_gpu_aware);
254 this->
params_m.add(
"r2c_direction", 0);
256 switch (opts.algorithm) {
257 case heffte::reshape_algorithm::alltoall:
260 case heffte::reshape_algorithm::alltoallv:
263 case heffte::reshape_algorithm::p2p:
266 case heffte::reshape_algorithm::p2p_plined:
270 throw IpplException(
"FFTOpenPoissonSolver::setDefaultParameters",
271 "Unrecognized heffte communication type");
275 this->
params_m.add(
"hessian",
false);
KOKKOS_INLINE_FUNCTION auto & get(Tuple< Ts... > &t)
Accessor function to get an element mutable reference at a specific index from a Tuple.
std::shared_ptr< archive_type< MemorySpace > > buffer_type
typename BareField_t::view_type view_type
KOKKOS_INLINE_FUNCTION static constexpr auto & get(View &&view, unsigned dim1, unsigned dim2, size_t i, size_t j, size_t k)
KOKKOS_INLINE_FUNCTION static constexpr auto & get(View &&view, unsigned dim1, unsigned dim2, size_t i, size_t j, size_t k)
KOKKOS_INLINE_FUNCTION static constexpr auto & get(View &&view, unsigned dim1, unsigned dim2, size_t i, size_t j, size_t k)
FFT_t::ComplexField CxField_t
typename FieldLHS::value_type::value_type Tg
Field< Tg, Dim, mesh_type, Centering > Field_gt
std::unique_ptr< mesh_type > mesh2n1_m
typename mesh_type::vector_type vector_type
Field< Matrix_t, Dim, mesh_type, Centering > MField_t
typename FieldLHS::memory_space memory_space
std::unique_ptr< FieldLayout_t > layout2_m
NDIndex< Dim > domain2n1_m
typename FieldRHS::value_type Trhs
Field< int, Dim, mesh_type, Centering > IField_t
std::unique_ptr< FieldLayout_t > layout4_m
Field< Kokkos::complex< Tg >, Dim, mesh_type, Centering > CxField_gt
std::unique_ptr< mesh_type > mesh2_m
virtual void setDefaultParameters() override
std::unique_ptr< FFT< CCTransform, CxField_gt > > fft4n_m
FieldLHS::Centering_t Centering
std::unique_ptr< mesh_type > meshComplex_m
Poisson< FieldLHS, FieldRHS > Base
std::unique_ptr< FFT< Cos1Transform, Field_t > > fft2n1_m
std::unique_ptr< FieldLayout_t > layout2n1_m
std::unique_ptr< FFT_t > fft_m
FFT< RCTransform, FieldRHS > FFT_t
static constexpr unsigned Dim
MField_t * getHessian() override
typename FieldLHS::Mesh_t mesh_type
detail::FieldBufferData< Trhs > fd_m
void setRhs(rhs_type &rhs) override
std::unique_ptr< FieldLayout_t > layoutComplex_m
std::unique_ptr< mesh_type > mesh4_m
IField_t grnIField_m[Dim]
FieldLayout< Dim > FieldLayout_t
NDIndex< Dim > domainComplex_m
mesh_type::matrix_type Matrix_t
mpi::Communicator::buffer_type< memory_space > buffer_type
FieldLayout_t * layout_mp
Vector< Trhs, Dim > Vector_t
typename mesh_type::value_type scalar_type
void communicateVico(Vector< int, Dim > size, typename CxField_gt::view_type view_g, const ippl::NDIndex< Dim > ldom_g, const int nghost_g, typename Field_t::view_type view, const ippl::NDIndex< Dim > ldom, const int nghost)
~FFTOpenPoissonSolver()=default