SimiLie
Loading...
Searching...
No Matches
indexed_scalar_field.hpp
1// SPDX-FileCopyrightText: 2026 Baptiste Legouix
2// SPDX-License-Identifier: AGPL-3.0-or-later
3// AI-GENERATED
4
5#pragma once
6
7#include <similie/tensor/tensor.hpp>
8
9namespace sil::multidomains {
15template <class... DDim>
17{
18 using memory_space = Kokkos::DefaultExecutionSpace::memory_space;
20 using non_indices_domain_t = ddc::DiscreteDomain<DDim...>;
21 using discrete_domain_type = ddc::DiscreteDomain<DDim..., component_type>;
22 using indices_domain_t = ddc::DiscreteDomain<component_type>;
23
25 using discrete_element_type = typename discrete_domain_type::discrete_element_type;
27 using element_type = double;
28 KOKKOS_FUNCTION static constexpr accessor_t accessor()
29 {
30 return accessor_t();
31 }
32 KOKKOS_FUNCTION indices_domain_t indices_domain() const
33 {
34 return accessor().domain();
35 }
36 KOKKOS_FUNCTION discrete_domain_type domain() const
37 {
39 }
40 KOKKOS_FUNCTION discrete_domain_type access_domain() const
41 {
42 return domain();
43 }
44 KOKKOS_FUNCTION natural_domain_t natural_domain() const
45 {
46 return domain();
47 }
48
50 std::size_t const* indices;
51
53 {
54 return grid;
55 }
56
57 template <class Element, class Component>
58 KOKKOS_FUNCTION std::size_t global_index(Element elem, Component) const
59 {
60 std::size_t local = 0;
61 ((local = local * grid.template extent<DDim>() + elem.template uid<DDim>()
62 - grid.front().template uid<DDim>()),
63 ...);
64 assert(sil::misc::domain_contains(grid, elem));
65 return indices[local];
66 }
67};
68
69
70} // namespace sil::multidomains
static KOKKOS_FUNCTION constexpr discrete_domain_type domain()
KOKKOS_FUNCTION bool domain_contains(ddc::DiscreteDomain< DDim... > const &dom, ddc::DiscreteElement< ODDim... > elem)
Index-only scalar cochain; sampling maps local nodes to global unknowns.
KOKKOS_FUNCTION discrete_domain_type access_domain() const
KOKKOS_FUNCTION non_indices_domain_t non_indices_domain() const
ddc::DiscreteDomain< component_type > indices_domain_t
KOKKOS_FUNCTION std::size_t global_index(Element elem, Component) const
ddc::DiscreteDomain< DDim..., component_type > discrete_domain_type
typename discrete_domain_type::discrete_element_type discrete_element_type
ddc::DiscreteDomain< DDim... > non_indices_domain_t
static KOKKOS_FUNCTION constexpr accessor_t accessor()
KOKKOS_FUNCTION discrete_domain_type domain() const
Kokkos::DefaultExecutionSpace::memory_space memory_space
sil::tensor::TensorAccessor< component_type > accessor_t
KOKKOS_FUNCTION indices_domain_t indices_domain() const
KOKKOS_FUNCTION natural_domain_t natural_domain() const