17#include <Kokkos_Core.hpp>
35
36
40
41
42
43
44 std::recursive_mutex m_global_lock;
49 std::stringstream m_ss;
51 ChunkPrinter(ChunkPrinter& rhs) =
delete;
53 ChunkPrinter(ChunkPrinter&& rhs) =
delete;
57 ChunkPrinter& operator=(ChunkPrinter&& rhs) =
delete;
59 ChunkPrinter& operator=(ChunkPrinter& rhs) =
delete;
65
66
67 static std::ostream& align(std::ostream& os,
int level);
70
71
73 std::size_t get_element_width(T
const& elem)
81
82
84 void display_aligned_element(std::ostream& os, T
const& elem, std::size_t largest_element)
86 std::size_t
const elem_width = get_element_width(elem);
88 for (std::size_t i = 0; i < largest_element - elem_width; ++i) {
95
96
97 template <
class ElementType,
class Extents,
class Layout,
class Accessor>
98 std::ostream& base_case_display(
100 Kokkos::mdspan<ElementType, Extents, Layout, Accessor>
const& span,
101 std::size_t largest_element,
102 std::size_t beginning,
106 for (std::size_t i0 = beginning; i0 < end; ++i0) {
107 display_aligned_element(os, span[i0], largest_element);
108 if (i0 < extent - 1) {
116
117
118 template <
class ElementType,
class Extents,
class Layout,
class Accessor, std::size_t... Is>
119 std::ostream& recursive_display(
121 Kokkos::mdspan<ElementType, Extents, Layout, Accessor>
const& span,
123 std::size_t largest_element,
124 std::size_t beginning,
126 std::index_sequence<Is...>)
128 for (std::size_t i0 = beginning; i0 < end; ++i0) {
131 Kokkos::submdspan(span, i0, ((
void)Is, Kokkos::full_extent)...),
134 std::make_index_sequence<
sizeof...(Is)>());
136 for (
int ndims = 0; ndims <
sizeof...(Is); ++ndims) {
147 static ChunkPrinter& get_instance();
150 template <
class ElementType,
class Extents,
class Layout,
class Accessor>
151 std::ostream& print_impl(
153 Kokkos::mdspan<ElementType, Extents, Layout, Accessor>
const& span,
156 std::index_sequence<>)
158 return os << *span.data_handle();
169 std::ostream& print_impl(
171 Kokkos::mdspan<ElementType, Extents, Layout, Accessor>
const& span,
173 std::size_t largest_element,
174 std::index_sequence<I0, Is...>)
176 auto extent = span.extent(I0);
177 if constexpr (
sizeof...(Is) > 0) {
187 std::make_index_sequence<
sizeof...(Is)>());
196 std::make_index_sequence<
sizeof...(Is)>());
197 for (
int ndims = 0; ndims <
sizeof...(Is); ++ndims) {
202 for (
int ndims = 0; ndims <
sizeof...(Is); ++ndims) {
213 std::make_index_sequence<
sizeof...(Is)>());
219 base_case_display(os, span, largest_element, 0, extent, extent);
221 base_case_display(os, span, largest_element, 0, m_options
.edgeitems, extent);
238 template <
class ElementType,
class Extents,
class Layout,
class Accessor>
239 std::size_t find_largest_displayed_element(
240 Kokkos::mdspan<ElementType, Extents, Layout, Accessor>
const&,
241 std::index_sequence<>)
255 std::size_t find_largest_displayed_element(
256 Kokkos::mdspan<ElementType, Extents, Layout, Accessor>
const& span,
257 std::index_sequence<I0, Is...>)
260 auto extent = span.extent(I0);
261 if constexpr (
sizeof...(Is) > 0) {
263 for (std::size_t i0 = 0; i0 < extent; ++i0) {
266 find_largest_displayed_element(
267 Kokkos::submdspan(span, i0, ((
void)Is, Kokkos::full_extent)...),
268 std::make_index_sequence<
sizeof...(Is)>()));
271 for (std::size_t i0 = 0; i0 < m_options
.edgeitems; ++i0) {
274 find_largest_displayed_element(
275 Kokkos::submdspan(span, i0, ((
void)Is, Kokkos::full_extent)...),
276 std::make_index_sequence<
sizeof...(Is)>()));
278 for (std::size_t i0 = extent - m_options
.edgeitems; i0 < extent; ++i0) {
281 find_largest_displayed_element(
282 Kokkos::submdspan(span, i0, ((
void)Is, Kokkos::full_extent)...),
283 std::make_index_sequence<
sizeof...(Is)>()));
288 for (std::size_t i0 = 0; i0 < extent; ++i0) {
289 ret = std::max(ret, get_element_width(span[i0]));
292 for (std::size_t i0 = 0; i0 < m_options
.edgeitems; ++i0) {
293 ret = std::max(ret, get_element_width(span[i0]));
295 for (std::size_t i0 = extent - m_options
.edgeitems; i0 < extent; ++i0) {
296 ret = std::max(ret, get_element_width(span[i0]));
305
306
307 void saveformat(std::ostream& os);
311
312
313void print_demangled_type_name(std::ostream& os,
char const* mangled_name);
317 char const*
const* dims,
318 DiscreteVectorElement
const* sizes,
321template <
class... Dims>
322void print_dim_name(std::ostream& os,
DiscreteVector<Dims...>
const& dd)
324 std::array<
char const*,
sizeof...(Dims)>
const names {
typeid(Dims).name()...};
325 std::array
const std_dd = detail::array(dd);
326 print_dim_name(os, names.data(), std_dd.data(), std_dd.size());
332
333
334
335
336
340
341
345
346
347template <
class ElementType,
class SupportType,
class LayoutStridedPolicy,
class MemorySpace>
350 ChunkSpan<ElementType, SupportType, LayoutStridedPolicy, MemorySpace>
const& chunk_span)
352 auto h_chunk_span = create_mirror_view_and_copy(Kokkos::HostSpace(), chunk_span);
354 using chunkspan_type = std::remove_cv_t<std::remove_reference_t<
decltype(h_chunk_span)>>;
355 using mdspan_type = chunkspan_type::allocation_mdspan_type;
356 using extents = mdspan_type::extents_type;
358 mdspan_type
const allocated_mdspan = h_chunk_span.allocation_mdspan();
360 ddc::detail::ChunkPrinter& printer =
ddc::detail::ChunkPrinter::get_instance();
361 std::scoped_lock
const lock(printer.m_global_lock);
363 printer.saveformat(os);
365 std::size_t
const largest_element = printer.find_largest_displayed_element(
367 std::make_index_sequence<extents::rank()>());
374 std::make_index_sequence<extents::rank()>());
380
381
382template <
class ElementType,
class SupportType,
class LayoutStridedPolicy,
class MemorySpace>
385 ChunkSpan<ElementType, SupportType, LayoutStridedPolicy, MemorySpace>
const& chunk_span)
387 ddc::detail::ChunkPrinter& printer =
ddc::detail::ChunkPrinter::get_instance();
388 std::scoped_lock
const lock(printer.m_global_lock);
390 ddc::detail::print_dim_name(os, chunk_span.extents());
392 ddc::detail::print_demangled_type_name(os,
typeid(chunk_span).name());
399
400
401template <
class ElementType,
class SupportType,
class LayoutStridedPolicy,
class MemorySpace>
404 ChunkSpan<ElementType, SupportType, LayoutStridedPolicy, MemorySpace>
const& chunk_span)
406 ddc::detail::ChunkPrinter& printer =
ddc::detail::ChunkPrinter::get_instance();
407 std::scoped_lock
const lock(printer.m_global_lock);
409 print_type_info(os, chunk_span);
410 print_content(os, chunk_span);
416
417
418
419template <
class ElementType,
class SupportType,
class LayoutStridedPolicy,
class MemorySpace>
422 ChunkSpan<ElementType, SupportType, LayoutStridedPolicy, MemorySpace>
const& chunk_span)
424 ddc::detail::ChunkPrinter& printer =
ddc::detail::ChunkPrinter::get_instance();
425 std::scoped_lock
const lock(printer.m_global_lock);
430 print_type_info(os, chunk_span);
431 print_content(os, chunk_span);
438template <
class ElementType,
class SupportType,
class LayoutStridedPolicy,
class MemorySpace>
439std::ostream& operator<<(
441 ChunkSpan<ElementType, SupportType, LayoutStridedPolicy, MemorySpace>
const& chunk_span)
443 return print(os, chunk_span);
friend class DiscreteDomain
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement()=default
KOKKOS_FUNCTION constexpr bool operator!=(DiscreteVector< OTags... > const &rhs) const noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteVector()=default
Impl & operator=(Impl &&x)=default
KOKKOS_FUNCTION Coordinate< CDim > origin() const noexcept
Lower bound index of the mesh.
KOKKOS_FUNCTION discrete_element_type front() const noexcept
Lower bound index of the mesh.
KOKKOS_FUNCTION Coordinate< CDim > coordinate(discrete_element_type const &icoord) const noexcept
Convert a mesh index into a position in CDim
Impl(Impl const &)=delete
KOKKOS_FUNCTION std::size_t n_period() const
Number of steps in a period.
Impl(Impl< DDim, OriginMemorySpace > const &impl)
Impl(Coordinate< CDim > origin, Real step, std::size_t n_period)
Construct a Impl from a point and a spacing step.
KOKKOS_FUNCTION Real step() const
Spacing step of the mesh.
Impl & operator=(Impl const &x)=delete
PeriodicSampling models a periodic discretization of the provided continuous dimension.
static std::tuple< typename DDim::template Impl< DDim, Kokkos::HostSpace >, DiscreteDomain< DDim > > init(Coordinate< CDim > a, Coordinate< CDim > b, DiscreteVector< DDim > n, DiscreteVector< DDim > n_period)
Construct a Impl<Kokkos::HostSpace> and associated discrete_domain_type from a segment and a number ...
std::tuple< Impl< DDim, Kokkos::HostSpace >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim > > init_ghosted(Coordinate< CDim > a, Coordinate< CDim > b, DiscreteVector< DDim > n, DiscreteVector< DDim > n_period, DiscreteVector< DDim > n_ghosts_before, DiscreteVector< DDim > n_ghosts_after)
Construct a periodic DiscreteDomain from a segment and a number of points n.
std::tuple< Impl< DDim, Kokkos::HostSpace >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim > > init_ghosted(Coordinate< CDim > a, Coordinate< CDim > b, DiscreteVector< DDim > n, DiscreteVector< DDim > n_period, DiscreteVector< DDim > n_ghosts)
Construct a periodic DiscreteDomain from a segment and a number of points n.
ScopeGuard & operator=(ScopeGuard const &x)=delete
ScopeGuard(ScopeGuard &&x) noexcept=delete
ScopeGuard & operator=(ScopeGuard &&x) noexcept=delete
ScopeGuard(int, char **&)
ScopeGuard(ScopeGuard const &x)=delete
static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove(discrete_vector_type, discrete_vector_type) const
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_first(discrete_vector_type) const
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_DEFAULTED_FUNCTION constexpr SparseDiscreteDomain()=default
KOKKOS_FUNCTION constexpr DiscreteElement operator()(DiscreteVector<> const &) const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_last(discrete_vector_type) const
static KOKKOS_FUNCTION DiscreteVector distance_from_front() noexcept
static KOKKOS_FUNCTION constexpr std::size_t size()
static KOKKOS_FUNCTION constexpr bool empty() noexcept
static KOKKOS_FUNCTION DiscreteVector distance_from_front(DiscreteElement<>) noexcept
KOKKOS_FUNCTION constexpr bool operator==(SparseDiscreteDomain const &) const
static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
static KOKKOS_FUNCTION bool contains() noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_last(discrete_vector_type) const
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_first(discrete_vector_type) const
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION ~SparseDiscreteDomain()=default
static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain(SparseDiscreteDomain< ODDims... > const &)
static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_first(discrete_vector_type n) const
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_last(discrete_vector_type n) const
KOKKOS_FUNCTION DiscreteVector< DDims... > distance_from_front(DElems const &... delems) const noexcept
KOKKOS_FUNCTION constexpr auto discrete_elements() const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove(discrete_vector_type n1, discrete_vector_type n2) const
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
SparseDiscreteDomain(Kokkos::View< DiscreteElement< DDims > *, Kokkos::SharedSpace > const &... views)
Construct a SparseDiscreteDomain with Kokkos::View explicitly listing the discrete elements.
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr std::size_t size() const
KOKKOS_FUNCTION constexpr bool operator==(SparseDiscreteDomain< ODims... > const &other) const
KOKKOS_FUNCTION bool contains(DElems const &... delems) const noexcept
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_first(discrete_vector_type n) const
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain()=default
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_FUNCTION constexpr bool empty() const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain(DDoms const &... domains)
Construct a SparseDiscreteDomain by copies and merge of domains.
KOKKOS_FUNCTION constexpr DiscreteElement< DDims... > operator()(DiscreteVector< DDims... > const &dvect) const noexcept
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_last(discrete_vector_type n) const
friend class SparseDiscreteDomain
KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDim > extent() const noexcept
KOKKOS_DEFAULTED_FUNCTION ~SparseDiscreteDomain()=default
static KOKKOS_FUNCTION DiscreteVector distance_from_front() noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain & operator=(StridedDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_first(discrete_vector_type) const
static KOKKOS_FUNCTION constexpr std::size_t size()
KOKKOS_FUNCTION constexpr StridedDiscreteDomain(discrete_element_type const &element_begin, discrete_vector_type const &size, discrete_vector_type const &strides)
Construct a StridedDiscreteDomain starting from element_begin with size points.
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove(discrete_vector_type, discrete_vector_type) const
static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_last(discrete_vector_type) const
KOKKOS_FUNCTION constexpr bool operator==(StridedDiscreteDomain const &) const
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_first(discrete_vector_type) const
static KOKKOS_FUNCTION bool contains() noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_last(discrete_vector_type) const
static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain &&x)=default
static KOKKOS_FUNCTION DiscreteVector distance_from_front(DiscreteElement<>) noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr StridedDiscreteDomain()=default
KOKKOS_FUNCTION constexpr operator bool()
static KOKKOS_FUNCTION constexpr bool empty() noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr DiscreteElement operator()(DiscreteVector<> const &) const noexcept
static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain(StridedDiscreteDomain< ODDims... > const &)
KOKKOS_DEFAULTED_FUNCTION ~StridedDiscreteDomain()=default
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain & operator=(StridedDiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain & operator=(StridedDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_first(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDim > extent() const noexcept
KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
KOKKOS_FUNCTION bool contains(DElems const &... delems) const noexcept
KOKKOS_FUNCTION constexpr std::size_t size() const
KOKKOS_FUNCTION DiscreteVector< DDims... > distance_from_front(DElems const &... delems) const noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr discrete_vector_type strides() const noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain & operator=(StridedDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove(discrete_vector_type n1, discrete_vector_type n2) const
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_first(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain()=default
KOKKOS_FUNCTION constexpr DiscreteElement< DDims... > operator()(DiscreteVector< DDims... > const &dvect) const noexcept
friend class StridedDiscreteDomain
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_last(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_last(discrete_vector_type n) const
KOKKOS_DEFAULTED_FUNCTION ~StridedDiscreteDomain()=default
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr bool operator==(StridedDiscreteDomain< ODims... > const &other) const
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_FUNCTION constexpr StridedDiscreteDomain(DDoms const &... domains)
Construct a StridedDiscreteDomain by copies and merge of domains.
KOKKOS_FUNCTION constexpr bool empty() const noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain(discrete_element_type const &element_begin, discrete_vector_type const &extents, discrete_vector_type const &strides)
Construct a StridedDiscreteDomain starting from element_begin with size points.
#define DDC_BUILD_DEPRECATED_CODE
The top-level namespace of DDC.
auto parallel_fill(ExecSpace const &execution_space, ChunkDst &&dst, T const &value)
Fill a borrowed chunk with a given value.
constexpr bool is_non_uniform_point_sampling_v
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > back(SparseDiscreteDomain< DDims... > const &domain) noexcept
T parallel_transform_reduce(ExecSpace const &execution_space, Support const &domain, T neutral, BinaryReductionOp &&reduce, UnaryTransformOp &&transform) noexcept
A reduction over a nD domain using a given Kokkos execution space.
auto parallel_transform(ExecSpace const &execution_space, ChunkDst &&dst, UnaryTransformOp &&transform)
Transform a borrowed chunk with a given transform functor.
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > front(StridedDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > rlength(DiscreteDomain< DDim > const &d)
bool is_discrete_space_initialized() noexcept
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > coordinate(DiscreteElement< DDim > const &c)
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > distance_at_left(DiscreteElement< DDim > i)
T parallel_transform_reduce(Support const &domain, T neutral, BinaryReductionOp &&reduce, UnaryTransformOp &&transform) noexcept
A reduction over a nD domain using the Kokkos default execution space.
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > origin() noexcept
Lower bound index of the mesh.
T parallel_transform_reduce(std::string const &label, ExecSpace const &execution_space, Support const &domain, T neutral, BinaryReductionOp &&reduce, UnaryTransformOp &&transform) noexcept
A reduction over a nD domain using a given Kokkos execution space.
auto parallel_deepcopy(ChunkDst &&dst, ChunkSrc &&src)
Copy the content of a borrowed chunk into another.
void parallel_for_each(std::string const &label, Support const &domain, Functor &&f) noexcept
iterates over a nD domain using the Kokkos default execution space
void parallel_for_each(Support const &domain, Functor &&f) noexcept
iterates over a nD domain using the Kokkos default execution space
KOKKOS_FUNCTION constexpr SparseDiscreteDomain< QueryDDims... > select(SparseDiscreteDomain< DDims... > const &domain)
std::ostream & print_content(std::ostream &os, ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace > const &chunk_span)
Print the content of a ChunkSpan.
T host_transform_reduce(Support const &domain, T neutral, BinaryReductionOp &&reduce, UnaryTransformOp &&transform) noexcept
A reduction over a nD domain in serial.
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDims... > extents(StridedDiscreteDomain< DDims... > const &domain) noexcept
constexpr bool is_uniform_point_sampling_v
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > rmin(DiscreteDomain< DDim > const &d)
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > back(StridedDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain< QueryDDims... > select(StridedDiscreteDomain< DDims... > const &domain)
KOKKOS_FUNCTION constexpr auto remove_dims_of(StridedDiscreteDomain< DDimsA... > const &DDom_a) noexcept
Remove the dimensions DDimsB from DDom_a.
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > distance_at_right(DiscreteElement< DDim > i)
void init_discrete_space(Args &&... args)
Initialize (emplace) a global singleton discrete space.
KOKKOS_FUNCTION constexpr auto remove_dims_of(StridedDiscreteDomain< DDimsA... > const &DDom_a, StridedDiscreteDomain< DDimsB... > const &) noexcept
constexpr DiscreteElement< DDim > init_trivial_half_bounded_space() noexcept
Construct a half bounded dimension without attributes.
void host_for_each(Support const &domain, Functor &&f) noexcept
iterates over a nD domain in serial
KOKKOS_FUNCTION constexpr auto remove_dims_of(SparseDiscreteDomain< DDimsA... > const &DDom_a, SparseDiscreteDomain< DDimsB... > const &) noexcept
constexpr DiscreteDomain< DDim > init_trivial_bounded_space(DiscreteVector< DDim > const n) noexcept
Construct a bounded dimension without attributes.
detail::ddim_impl_t< DDim, Kokkos::HostSpace > const & host_discrete_space()
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDims... > extents(SparseDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr auto replace_dim_of(SparseDiscreteDomain< DDimsA... > const &DDom_a, SparseDiscreteDomain< DDimsB... > const &DDom_b) noexcept
KOKKOS_FUNCTION T device_transform_reduce(Support const &domain, T neutral, BinaryReductionOp &&reduce, UnaryTransformOp &&transform) noexcept
A reduction over a nD domain in serial.
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > front(SparseDiscreteDomain< DDims... > const &domain) noexcept
auto parallel_fill(ChunkDst &&dst, T const &value)
Fill a borrowed chunk with a given value.
constexpr bool is_strided_discrete_domain_v
KOKKOS_FUNCTION DiscreteVector< ODDims... > prod(DiscreteVector< ODDims... > const &lhs, DiscreteVector< ODDims... > const &rhs) noexcept
void parallel_for_each(ExecSpace const &execution_space, Support const &domain, Functor &&f) noexcept
iterates over a nD domain using a given Kokkos execution space
std::ostream & print(std::ostream &os, ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace > const &chunk_span)
Print metadata and content of a ChunkSpan.
constexpr bool is_periodic_sampling_v
KOKKOS_FUNCTION Real step() noexcept
Spacing step of the mesh.
KOKKOS_FUNCTION constexpr auto replace_dim_of(StridedDiscreteDomain< DDimsA... > const &DDom_a, StridedDiscreteDomain< DDimsB... > const &DDom_b) noexcept
constexpr bool is_sparse_discrete_domain_v
KOKKOS_FUNCTION constexpr auto remove_dims_of(SparseDiscreteDomain< DDimsA... > const &DDom_a) noexcept
Remove the dimensions DDimsB from DDom_a.
T parallel_transform_reduce(std::string const &label, Support const &domain, T neutral, BinaryReductionOp &&reduce, UnaryTransformOp &&transform) noexcept
A reduction over a nD domain using the Kokkos default execution space.
KOKKOS_FUNCTION DiscreteElement< DDim > front() noexcept
Lower bound index of the mesh.
KOKKOS_FUNCTION detail::ddim_impl_t< DDim, MemorySpace > const & discrete_space()
PrinterOptions get_print_options()
Return the currently used format options.
std::ostream & print_full(std::ostream &os, ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace > const &chunk_span)
Print metadata and content of a ChunkSpan Always print without elision, regardless of options set.
auto parallel_deepcopy(ExecSpace const &execution_space, ChunkDst &&dst, ChunkSrc &&src)
Copy the content of a borrowed chunk into another.
void parallel_for_each(std::string const &label, ExecSpace const &execution_space, Support const &domain, Functor &&f) noexcept
iterates over a nD domain using a given Kokkos execution space
Arg0 init_discrete_space(std::tuple< DDimImpl, Arg0 > &&a)
Move construct a global singleton discrete space and pass through the other argument.
std::ostream & print_type_info(std::ostream &os, ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace > const &chunk_span)
Print the metadata of a ChunkSpan (size, dimension name, ...)
auto parallel_transform(ChunkDst &&dst, UnaryTransformOp &&transform)
Transform a borrowed chunk with a given transform functor.
KOKKOS_FUNCTION void device_for_each(Support const &domain, Functor &&f) noexcept
iterates over a nD domain in serial
std::tuple< Arg0, Arg1, Args... > init_discrete_space(std::tuple< DDimImpl, Arg0, Arg1, Args... > &&a)
Move construct a global singleton discrete space and pass through remaining arguments.
PrinterOptions set_print_options(PrinterOptions options=PrinterOptions())
Try to set the options for the printer, returns the old format (or the current format if the option p...
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > rmax(DiscreteDomain< DDim > const &d)
bool operator==(PrinterOptions const &rhs) const noexcept
friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator-(StridedDiscreteDomainIterator i, difference_type n)
KOKKOS_FUNCTION constexpr DiscreteElement< DDim > operator*() const noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator & operator++()
friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator+(difference_type n, StridedDiscreteDomainIterator i)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator & operator-=(difference_type n)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator++(int)
friend KOKKOS_FUNCTION constexpr bool operator<(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomainIterator()=default
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator--(int)
friend KOKKOS_FUNCTION constexpr bool operator==(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator(DiscreteElement< DDim > value, DiscreteVector< DDim > stride)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator & operator+=(difference_type n)
KOKKOS_FUNCTION constexpr DiscreteElement< DDim > operator[](difference_type n) const
friend KOKKOS_FUNCTION constexpr difference_type operator-(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator & operator--()
friend KOKKOS_FUNCTION constexpr bool operator>=(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator+(StridedDiscreteDomainIterator i, difference_type n)
friend KOKKOS_FUNCTION constexpr bool operator>(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
friend KOKKOS_FUNCTION constexpr bool operator!=(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
friend KOKKOS_FUNCTION constexpr bool operator<=(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept
KOKKOS_FUNCTION constexpr value_type operator()(value_type const &lhs, value_type const &rhs) const noexcept