6#include "../DeviceView.hpp"
7#include "../EigenUtil.hpp"
19 template <rowsize _mat_ni, rowsize _mat_nj>
22 if constexpr (_mat_ni >= 0 && _mat_nj >= 0)
24 return _mat_ni * _mat_nj;
48 __OneMatGetRowSize<_mat_ni, _mat_nj>(),
49 __OneMatGetRowSize<_mat_ni_max, _mat_nj_max>(),
54 __OneMatGetRowSize<_mat_ni, _mat_nj>(),
55 __OneMatGetRowSize<_mat_ni_max, _mat_nj_max>(),
62 std::conditional_t<_mat_ni == NonUniformSize, const rowsize *, EmptyNoDefault>
_mat_nRows =
nullptr;
79 using t_EigenMap = std::conditional_t<std::is_const_v<real_T>,
81 Eigen::Map<t_EigenMatrix, Eigen::Unaligned>>;
87 if constexpr (_mat_ni >= 0)
101 if constexpr (_mat_nj >= 0)
110#define DNDS_ARRAYEIGENMATRIXVIEW_GETTER_PREREQ \
111 DNDS_HD_assert_infof(iRow >= 0 && iRow < this->Size(), "invalid index %lld / %lld", iRow, this->Size()); \
113 if constexpr (_mat_ni == NonUniformSize) \
114 c_nRow = _mat_nRows[iRow]; \
115 else if constexpr (_mat_ni == DynamicSize) \
116 c_nRow = _mat_nRow_dynamic; \
136 if constexpr (_mat_ni == 1 && _mat_nj == 1)
137 return *t_base::operator[](iRow);
144 if constexpr (_mat_ni == 1 && _mat_nj == 1)
145 return *t_base::operator[](iRow);
152 if constexpr (_mat_ni == 1 || _mat_nj == 1)
153 return t_base::operator()(iRow, j);
160 if constexpr (_mat_ni == 1 || _mat_nj == 1)
161 return t_base::operator()(iRow, j);
#define DNDS_ARRAYEIGENMATRIXVIEW_GETTER_PREREQ
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE(T, T_Self)
#define DNDS_DEVICE_CALLABLE
#define DNDS_HD_assert(cond)
Host-only expansion of DNDS_HD_assert (equivalent to DNDS_assert).
Non-owning device-callable view of an Array, specialised per DeviceBackend.
Device-callable view onto ArrayEigenMatrix rows.
DNDS_DEVICE_CALLABLE std::conditional_t< _mat_ni==1||_mat_nj==1, real, void > operator()(index iRow, rowsize j) const
std::conditional_t< _mat_ni==NonUniformSize, const rowsize *, EmptyNoDefault > _mat_nRows
Eigen::Matrix< std::remove_cv_t< real_T >, RowSize_To_EigenSize(_mat_ni), RowSize_To_EigenSize(_mat_nj)> t_EigenMatrix
DNDS_DEVICE_CALLABLE std::conditional_t< _mat_ni==1||_mat_nj==1, real &, void > operator()(index iRow, rowsize j)
Eigen::Map< const t_EigenMatrix, Eigen::Unaligned > t_EigenMap_const
DNDS_DEVICE_CALLABLE rowsize MatRowSize(index iMat=0) const
DNDS_DEVICE_CALLABLE rowsize MatColSize(index iMat=0) const
std::conditional_t< std::is_const_v< real_T >, t_EigenMap_const, Eigen::Map< t_EigenMatrix, Eigen::Unaligned > > t_EigenMap
DNDS_DEVICE_CALLABLE std::conditional_t< _mat_ni==1 &&_mat_nj==1, real &, void > operator()(index iRow)
DNDS_DEVICE_CALLABLE t_EigenMap_const operator[](index iRow) const
DNDS_DEVICE_CALLABLE std::conditional_t< _mat_ni==1 &&_mat_nj==1, real, void > operator()(index iRow) const
DNDS_DEVICE_CALLABLE t_EigenView MatView(index iRow)
DNDS_DEVICE_CALLABLE t_EigenView MatView(index iRow) const
std::conditional_t< _mat_ni==DynamicSize, rowsize, EmptyNoDefault > _mat_nRow_dynamic
DNDS_DEVICE_CALLABLE t_EigenMap operator[](index iRow)
T * operator[](index iRow)
Raw row pointer. iRow == Size() is allowed for past-the-end queries (useful for computing buffer end ...
DNDS_DEVICE_CALLABLE index Size() const
Number of rows in the viewed array.
DNDS_DEVICE_CALLABLE rowsize RowSize() const
Uniform row width for fixed layouts (asserts otherwise).
the host side operators are provided as implemented
DeviceBackend
Enumerates the backends a DeviceStorage / Array can live on.
DNDS_CONSTANT const rowsize NoAlign
Alignment flag: no padding applied to rows (the only currently-supported value).
constexpr int RowSize_To_EigenSize(rowsize rs)
Convert a rowsize constant to the corresponding Eigen compile-time size. Fixed >= 0 -> the value; Dyn...
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".
constexpr rowsize __OneMatGetRowSize()
Compute the underlying per-row element count for an Ni x Nj matrix cell.
DNDS_CONSTANT const rowsize NonUniformSize
Template parameter flag: "each row has an independent width".
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
DNDS_CONSTANT const rowsize UnInitRowsize
Sentinel "not initialised" rowsize value (= INT32_MIN).