6#include "../DeviceView.hpp"
16 template <
int a,
int b>
19 if constexpr (a >= 0 &&
b >= 0)
23 if constexpr (a == Eigen::Dynamic ||
b == Eigen::Dynamic)
37 template <DeviceBackend B,
class real_T,
int _n_row,
int _n_col>
40 static_assert(_n_row >= 0 || _n_row == Eigen::Dynamic,
"invalid _n_row");
41 static_assert(_n_col >= 0 || _n_col == Eigen::Dynamic,
"invalid _n_col");
48 using t_EigenMatrix = Eigen::Matrix<std::remove_cv_t<real_T>, _n_row, _n_col,
50 ((_n_row == 1 && _n_col != 1) ? Eigen ::RowMajor : (_n_col == 1 && _n_row != 1) ? Eigen ::ColMajor
52 using t_EigenMap_const = Eigen::Map<const t_EigenMatrix, Eigen::Unaligned>;
54 std::conditional_t<std::is_const_v<real_T>,
56 Eigen::Map<t_EigenMatrix, Eigen::Unaligned>>;
59 int _row_dynamic = _n_row > 0 ? _n_row : 0;
60 int _col_dynamic = _n_col > 0 ? _n_col : 0;
61 int _m_size = this->
Rows() * this->
Cols();
69 int n_row_dynamic,
int n_col_dynamic,
int n_m_size)
70 :
t_base(base_view), _row_dynamic(n_row_dynamic), _col_dynamic(n_col_dynamic), _m_size(n_m_size) {}
76 if constexpr (_n_row >= 0 && _n_col >= 0)
77 return _n_row * _n_col;
91 return row_size_c /
MSize();
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE(T, T_Self)
#define DNDS_DEVICE_CALLABLE
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Non-owning device-callable view of an Array, specialised per DeviceBackend.
Device-callable view onto ArrayEigenUniMatrixBatch rows.
DNDS_DEVICE_CALLABLE int Cols() const
DNDS_DEVICE_CALLABLE rowsize RowSize(index i) const
DNDS_DEVICE_CALLABLE t_EigenMap_const operator()(index i, rowsize j) const
DNDS_DEVICE_CALLABLE int MSize() const
DNDS_DEVICE_CALLABLE t_EigenMap operator()(index i, rowsize j)
DNDS_DEVICE_CALLABLE int Rows() const
DNDS_DEVICE_CALLABLE rowsize BatchSize(index i) const
T * operator[](index iRow)
Raw row pointer. iRow == Size() is allowed for past-the-end queries (useful for computing buffer end ...
DNDS_DEVICE_CALLABLE rowsize RowSize() const
Uniform row width for fixed layouts (asserts otherwise).
the host side operators are provided as implemented
int32_t rowsize
Row-width / per-row element-count type (signed 32-bit).
DNDS_CONSTANT const rowsize DynamicSize
Template parameter flag: "row width is set at runtime but uniform".
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
constexpr rowsize EigenSize_Mul_RowSize()
a * b if both are compile-time sizes, DynamicSize if either is Eigen::Dynamic, otherwise a sentinel.