14#include "../ArrayTransformer.hpp"
47 __OneMatGetRowSize<_mat_ni, _mat_nj>(),
48 __OneMatGetRowSize<_mat_ni_max, _mat_nj_max>(),
64 using t_EigenMap = Eigen::Map<t_EigenMatrix, Eigen::Unaligned>;
81 b += _mat_nRows->size() *
sizeof(
rowsize);
119 return _mat_nRows->
at(
iMat);
121 return _mat_nRow_dynamic;
186 c_nRow = (*_mat_nRows)[i];
188 c_nRow = _mat_nRow_dynamic;
201 c_nRow = (*_mat_nRows)[i];
203 c_nRow = _mat_nRow_dynamic;
213 std::array<char, 1024> buf;
257 serializerP->WriteInt(
"mat_nRow_dynamic", _mat_nRow_dynamic);
259 serializerP->WriteSharedRowsizeVector(
"mat_nRows", _mat_nRows, offset);
277 serializerP->ReadInt(
"mat_nRow_dynamic", _mat_nRow_dynamic);
284 serializerP->ReadSharedRowsizeVector(
"mat_nRows", _mat_nRows, offset);
325 template <DeviceBackend B>
327 template <DeviceBackend B>
330 template <DeviceBackend B>
341 template <DeviceBackend B>
358 _mat_nRows->to_device(backend);
362 template <DeviceBackend B,
bool is_const = false>
373 static_assert(std::is_signed_v<typename iterator::difference_type>);
397 return fmt::format(
"ArrayEigenMatrix::iterator<> iRow[{}] Size[{}]", this->
iRow, this->view.Size());
401 template <DeviceBackend B>
407 template <DeviceBackend B>
Device-callable view for ArrayEigenMatrix. operator[] returns an Eigen::Map<Matrix<real,...
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
#define DNDS_DEVICE_CALLABLE
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE_NO_EMPTY_CTOR(T, T_Self)
Device memory abstraction layer with backend-specific storage and factory creation.
#define DNDS_check_throw_info(expr, info)
Same as DNDS_check_throw but attaches a user-supplied info message to the thrown std::runtime_error.
#define DNDS_HD_assert(cond)
Host-only expansion of DNDS_HD_assert (equivalent to DNDS_assert).
#define DNDS_check_throw(expr)
Runtime check active in both debug and release builds. Throws std::runtime_error if expr evaluates to...
Non-owning device-callable view of an Array, specialised per DeviceBackend.
Device-callable view onto ArrayEigenMatrix rows.
Element iterator for ArrayEigenMatrix, yielding Eigen::Map<Matrix> per row.
DNDS_DEVICE_CALLABLE auto getView() const
std::conditional_t< is_const, t_deviceViewConst< B >, t_deviceView< B > > view_type
DNDS_DEVICE_CALLABLE reference operator*() const
DNDS_DEVICE_CALLABLE reference operator*()
ParArray<real> whose operator[] returns an Eigen::Map<Matrix<real, Ni, Nj>>.
std::conditional_t< _mat_ni==1||_mat_nj==1, real &, void > operator()(index iRow, rowsize j)
std::conditional_t< _mat_ni==1 &&_mat_nj==1, real &, void > operator()(index iRow)
ArrayEigenMatrixDeviceView< B, real, _mat_ni, _mat_nj, _mat_ni_max, _mat_nj_max, _align > t_deviceView
void WriteSerializer(Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset offset)
void ResizeRow(index iMat, rowsize nSizeRow, rowsize nSizeCol)
rowsize MatColSize(index iMat=0) const
Eigen::Matrix< real, RowSize_To_EigenSize(_mat_ni), RowSize_To_EigenSize(_mat_nj)> t_EigenMatrix
std::conditional_t< _mat_ni==1||_mat_nj==1, real, void > operator()(index iRow, rowsize j) const
static std::string GetDerivedArraySignature()
ArrayEigenMatrix(const t_self &R)=default
void ResizeMat(index iMat, rowsize nSizeRow, rowsize nSizeCol)
t_EigenMap operator[](index i)
size_t FullSizeBytes() const
extra data
void to_device(DeviceBackend backend)
Eigen::Map< t_EigenMatrix, Eigen::Unaligned > t_EigenMap
bool SignatureIsCompatible(const std::string &v)
void Resize(index nSize, rowsize nSizeRowDynamic, rowsize nSizeColDynamic)
static std::tuple< int, int, int, int > GetDerivedArraySignatureInts(const std::string &v)
void clone(const t_self &R)
t_EigenMap_const operator[](index i) const
rowsize MatRowSize(index iMat=0) const
t_self & operator=(const t_self &R)=default
std::conditional_t< _mat_ni==1 &&_mat_nj==1, real, void > operator()(index iRow) const
Eigen::Map< const t_EigenMatrix, Eigen::Unaligned > t_EigenMap_const
static const rowsize _row_size_max
void ReadSerializer(Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset &offset)
ReadSerializerMetaResult ReadSerializerMeta(Serializer::SerializerBaseSSP serializerP, const std::string &name)
static const rowsize _row_size
CRTP base for row-granularity iterators over an Array / ArrayView.
std::ptrdiff_t difference_type
const T & at(index iRow, rowsize iCol) const
Bounds-checked element read (not device-callable because CSR decompressed uses std::vector::at which ...
DNDS_DEVICE_CALLABLE T * data()
Raw pointer to the start of the flat data buffer.
void to_device(DeviceBackend backend=DeviceBackend::Host)
Mirror the flat/structural buffers to a target device (e.g. CUDA).
void Resize(index nSize, rowsize nRow_size_dynamic)
Resize the array, setting a uniform or maximum row width.
size_t FullSizeBytes() const
Total footprint in bytes including structural arrays.
rowsize RowSize() const
Uniform row width for fixed layouts (no row index needed).
void to_host()
Mirror the flat/structural buffers back to host memory.
ReadSerializerMetaResult ReadSerializerMeta(Serializer::SerializerBaseSSP serializerP, const std::string &name)
Reads only metadata from a serialized array without reading data.
void ResizeRow(index iRow, rowsize nRowSize)
Change the width of a single row.
index Size() const
Number of rows currently stored. O(1).
MPI-aware Array: adds a communicator, rank, and global index mapping.
void WriteSerializer(Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset offset)
Serialize (write) the parallel array with MPI-aware metadata.
void ReadSerializer(Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset &offset)
Deserialize (read) the parallel array with MPI-aware metadata.
Describes one rank's window into a globally-distributed dataset.
ssp< SerializerBase > SerializerBaseSSP
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".
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).
std::vector< std::string > splitSStringClean(const std::string &str, char delim)
DNDS_CONSTANT const rowsize UnInitRowsize
Sentinel "not initialised" rowsize value (= INT32_MIN).
Eigen::Matrix< real, 5, 1 > v