21#include <Kokkos_Core.hpp>
57 static_assert(std::is_integral_v<I>);
58 return p[
static_cast<size_t>(k) *
stride];
70template <
typename T,
class Space = Kokkos::DefaultExecutionSpace::memory_space>
72 Kokkos::View<T *, Kokkos::LayoutRight, Space>
data;
95 using V = Kokkos::View<T, Kokkos::LayoutRight, Space>;
113 const bool interleaved)
118 scale(
"teno_batch_scale", 1, n, interleaved),
basis_mean(
"teno_batch_mean",
nk_in, n, interleaved),
159 const std::vector<uint32_t> *
cells =
nullptr;
186 Kokkos::View<rtype **> face_quad_weights,
const Options & options);
210 std::unique_ptr<Setup3D> impl;
225std::array<double, 9>
ranking_metric(
const Mesh & mesh,
const Kokkos::View<int32_t *>::host_mirror_type & face_bc,
226 const Kokkos::View<BoundaryCondition *>::host_mirror_type & bcs,
uint32_t i);
std::shared_ptr< const curved::Geometry > curved_geometry
Definition mesh.h:422
The 3D TENO-E precomputation of a mesh: the geometry it needs (cell moments, bounding boxes and ranki...
Definition teno_setup.h:183
void compute(const Kokkos::View< uint32_t * > &cells, uint32_t n, TableBatch &out)
Tables of cells[0..n) into slots 0..n of out (out.slots >= n); cells must be reconstructed cells.
Definition teno_setup.cpp:3452
uint32_t batch_cells() const
Cells per batch that fit the device.
Definition teno_setup.cpp:3456
const Timings & timings() const
Definition teno_setup.cpp:3459
uint16_t max_large() const
Definition teno_setup.cpp:3457
uint16_t max_small() const
Definition teno_setup.cpp:3458
The setup of one mesh.
Definition teno_setup.cpp:2994
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
#define N_DIM
Definition common_typedef.h:28
Definition teno_setup.cpp:32
teno::SmoothnessTerms smoothness_terms(const uint8_t degree)
The terms of every smoothness-matrix entry of the given degree, in the order the setup sums them.
Definition teno_setup.cpp:3463
constexpr double LEBESGUE_SLACK
Definition teno_setup.h:46
TableBatchT< Kokkos::DefaultExecutionSpace::memory_space > TableBatch
Definition teno_setup.h:128
constexpr double MAX_LEBESGUE_3D
Definition teno_setup.h:42
bool one_sided_face(const Mesh &mesh, const BoundaryCondition &bc, const uint32_t f, const bool curved_mirrors)
Whether stencils take no mirror images across boundary face f (with condition bc): curved wall and sy...
Definition teno_setup.h:136
constexpr double MAX_LEBESGUE_2D
Definition teno_setup.h:36
std::array< double, 9 > ranking_metric(const Mesh &mesh, const Kokkos::View< int32_t * >::host_mirror_type &face_bc, const Kokkos::View< BoundaryCondition * >::host_mirror_type &bcs, const uint32_t i)
Metric (3 x 3, row-major) in which the stencil candidates of cell i are ranked by distance: the ident...
Definition teno_setup.cpp:3573
Status
Why a cell's device setup must be redone on the host.
Definition teno_setup.h:148
@ OUT_OF_SCRATCH
Definition teno_setup.h:148
@ OK
Definition teno_setup.h:148
bool batch_interleaved()
Whether batches interleave their cells (GPUs).
Definition teno_setup.cpp:2957
TableBatch device_copy(const TableBatchT< Kokkos::HostSpace > &h)
The device copy of a host batch.
Definition teno_setup.cpp:2960
constexpr double GEOMETRY_TOL
Definition teno_setup.h:30
Kokkos::View< double **, Kokkos::LayoutRight > Moments
(cell, k): central moments of each cell, mean of ((x - x_c) / h_c)^a ... (3D).
Definition teno.h:118
Device-copyable boundary condition.
Definition boundary.h:97
Device-side lookup from faces to boundary conditions.
Definition boundary.h:229
The terms of the smoothness-indicator matrix (3D): entry e (upper_index(l, m)) is sum_t weight(t) mom...
Definition teno.h:126
Element k of one cell's array in a batch: interleaved across cells on GPUs.
Definition teno_setup.h:50
size_t stride
Definition teno_setup.h:52
KOKKOS_INLINE_FUNCTION Lane at(const size_t k) const
Definition teno_setup.h:62
T * p
Definition teno_setup.h:51
KOKKOS_INLINE_FUNCTION T & operator[](const I k) const
Element k, of any integral type like a View's indices (the loops index in int).
Definition teno_setup.h:56
Options and sizes of the 3D setup.
Definition teno_setup.h:151
uint16_t ns
Definition teno_setup.h:154
uint16_t nss
Definition teno_setup.h:155
bool curved_mirrors
Definition teno_setup.h:160
uint8_t curved_wall_degree
Definition teno_setup.h:161
uint32_t batch_cells
Definition teno_setup.h:157
bool host_only
Definition teno_setup.h:158
double max_condition
Definition teno_setup.h:156
const std::vector< uint32_t > * cells
Definition teno_setup.h:159
uint8_t nk
Definition teno_setup.h:153
uint8_t degree
Definition teno_setup.h:152
uint16_t wall_ns
Definition teno_setup.h:162
An array of cap elements for each of slots cells. On GPUs element k of every cell is contiguous,...
Definition teno_setup.h:71
Kokkos::View< T *, Kokkos::LayoutRight, Space > data
Definition teno_setup.h:72
size_t slots
Definition teno_setup.h:74
size_t cap
Definition teno_setup.h:73
bool interleaved
Definition teno_setup.h:75
SlotArray(const std::string &label, const size_t cap_in, const size_t slots_in, const bool interleaved_in)
Definition teno_setup.h:78
KOKKOS_INLINE_FUNCTION Lane< T > lane(const size_t slot) const
Definition teno_setup.h:83
Tables of a batch of cells before packing, one slot per cell, at the largest stencil sizes the search...
Definition teno_setup.h:93
SlotArray< int32_t, Space > small_faces
Definition teno_setup.h:108
V< uint8_t * > failed_large
Definition teno_setup.h:102
V< uint16_t * > small_total
Definition teno_setup.h:106
V< uint16_t * > large_size
Definition teno_setup.h:104
uint16_t max_large
Definition teno_setup.h:98
V< uint8_t * > gather_depth
Definition teno_setup.h:101
Kokkos::View< T, Kokkos::LayoutRight, Space > V
Definition teno_setup.h:95
SlotArray< rtype, Space > si
Definition teno_setup.h:107
V< uint8_t * > status
Definition teno_setup.h:100
SlotArray< rtype, Space > small_pinv
Definition teno_setup.h:109
TableBatchT(const uint32_t n, const uint8_t nk_in, const uint16_t max_large_in, const uint16_t max_small_in, const bool interleaved)
Definition teno_setup.h:112
uint8_t nk
Definition teno_setup.h:97
SlotArray< int32_t, Space > large_faces
Definition teno_setup.h:108
V< uint8_t * > invalid_small
Definition teno_setup.h:103
SlotArray< rtype, Space > scale
Definition teno_setup.h:107
SlotArray< int32_t, Space > large_cells
Definition teno_setup.h:108
SlotArray< rtype, Space > large_pinv
Definition teno_setup.h:109
uint32_t slots
Definition teno_setup.h:96
V< uint16_t ** > small_size
Definition teno_setup.h:105
uint16_t max_small
Definition teno_setup.h:99
SlotArray< int32_t, Space > small_cells
Definition teno_setup.h:108
SlotArray< rtype, Space > basis_mean
Definition teno_setup.h:107
Timings of the last setup, in seconds.
Definition teno_setup.h:166
double geometry
Definition teno_setup.h:167
double tables
Definition teno_setup.h:168
uint64_t n_host_cells
Definition teno_setup.h:170
double host_cells
Definition teno_setup.h:169
Device helpers for the TENO-E reconstruction.
TableBatchT< Space > out
Definition teno_setup.cpp:681
int n_moments
Definition teno_setup.cpp:300
R< double ** > moments
Definition teno_setup.cpp:406
Kokkos::View< uint32_t *, Space > cells
Definition teno_setup.cpp:682