Gyselalib++
 
Loading...
Searching...
No Matches
ipoisson_solver.hpp
1// SPDX-License-Identifier: MIT
2#pragma once
3#include <ddc/ddc.hpp>
4
5#include "ddc_aliases.hpp"
6#include "ddc_helper.hpp"
7#include "vector_field.hpp"
8
9template <class IdxRangeLaplacian, class IdxRangeFull, class MemorySpace, class LayoutSpace>
11
24template <class... ODims, class IdxRangeFull, class MemorySpace, class LayoutSpace>
25class IPoissonSolver<IdxRange<ODims...>, IdxRangeFull, MemorySpace, LayoutSpace>
26{
27protected:
29 using real_laplacian_tags = ddc::detail::TypeSeq<typename ODims::continuous_dimension_type...>;
31 using laplacian_tags = ddc::detail::TypeSeq<ODims...>;
33 using space_tags = ddc::to_type_seq_t<IdxRangeFull>;
35 using batch_tags = ddc::type_seq_remove_t<space_tags, laplacian_tags>;
36
37protected:
39 static constexpr bool using_vector_field = ddc::type_seq_size_v<laplacian_tags> == 1;
40
41public:
43 using field_type = DField<IdxRangeFull, MemorySpace, LayoutSpace>;
45 using const_field_type = DConstField<IdxRangeFull, MemorySpace, LayoutSpace>;
46
48 using vector_field_type = std::conditional_t<
49 ddc::type_seq_size_v<laplacian_tags> == 1,
52
55 typename ddc::detail::convert_type_seq_to_discrete_domain_t<batch_tags>;
57 using batch_index_type = typename batch_idx_range_type::discrete_element_type;
58
60 using laplacian_idx_range_type = IdxRange<ODims...>;
61
63 using layout_space = LayoutSpace;
65 using memory_space = MemorySpace;
66
67public:
77 virtual field_type operator()(field_type phi, field_type rho) const = 0;
78
92};
MemorySpace memory_space
The space (CPU/GPU) where the Fields passed to operator() are saved.
Definition ipoisson_solver.hpp:65
ddc::type_seq_remove_t< space_tags, laplacian_tags > batch_tags
The tags describing the batched dimensions.
Definition ipoisson_solver.hpp:35
IdxRange< ODims... > laplacian_idx_range_type
The type of the index range on which the equation is defined.
Definition ipoisson_solver.hpp:60
DConstField< IdxRangeFull, MemorySpace, LayoutSpace > const_field_type
The const Field type of the arguments to operator().
Definition ipoisson_solver.hpp:45
ddc::detail::TypeSeq< ODims... > laplacian_tags
The tags describing the discrete dimensions in the equation.
Definition ipoisson_solver.hpp:31
typename batch_idx_range_type::discrete_element_type batch_index_type
The index for indexing a batch dimension.
Definition ipoisson_solver.hpp:57
ddc::to_type_seq_t< IdxRangeFull > space_tags
The tags describing the dimensions of the index range on which the operator acts.
Definition ipoisson_solver.hpp:33
DField< IdxRangeFull, MemorySpace, LayoutSpace > field_type
The Field type of the arguments to operator().
Definition ipoisson_solver.hpp:43
ddc::detail::TypeSeq< typename ODims::continuous_dimension_type... > real_laplacian_tags
The tags describing the real dimensions in the equation.
Definition ipoisson_solver.hpp:29
virtual field_type operator()(field_type phi, vector_field_type E, field_type rho) const =0
An operator which calculates the solution to Poisson's equation and its derivative: .
std::conditional_t< ddc::type_seq_size_v< laplacian_tags >==1, field_type, VectorField< double, IdxRangeFull, real_laplacian_tags, MemorySpace, LayoutSpace > > vector_field_type
The type of the derivative of .
Definition ipoisson_solver.hpp:51
virtual field_type operator()(field_type phi, field_type rho) const =0
An operator which calculates the solution to Poisson's equation: .
LayoutSpace layout_space
The layout space of the Fields passed to operator().
Definition ipoisson_solver.hpp:63
typename ddc::detail::convert_type_seq_to_discrete_domain_t< batch_tags > batch_idx_range_type
The index range type describing the batch dimensions.
Definition ipoisson_solver.hpp:55
Definition ipoisson_solver.hpp:10
A class which holds multiple (scalar) fields in order to represent a vector field.
Definition vector_field.hpp:64