12#include "../ArrayTransformer.hpp"
33 template <
int _n_row,
int _n_col>
36 static_assert(
_n_row >= 0 ||
_n_row == Eigen::Dynamic,
"invalid _n_row");
37 static_assert(
_n_col >= 0 ||
_n_col == Eigen::Dynamic,
"invalid _n_col");
48 using t_EigenMap = Eigen::Map<t_EigenMatrix, Eigen::Unaligned>;
54 int _m_size = this->
Rows() * this->
Cols();
91 _m_size = this->
Rows() * this->
Cols();
104 this->
Resize(n_size, -1, -1);
109 template <
class TFRowSize>
114 {
return rsf(i) * this->
MSize(); });
172 std::vector<t_EigenMap>
ret;
183 return "ArrayEigenUniMatrixBatch__" + std::to_string(
_n_row) +
184 "_" + std::to_string(
_n_col);
194 serializerP->WriteInt(
"row_dynamic", _row_dynamic);
195 serializerP->WriteInt(
"col_dynamic", _col_dynamic);
211 serializerP->ReadInt(
"row_dynamic", _row_dynamic);
244 template <DeviceBackend B>
247 template <DeviceBackend B>
250 template <DeviceBackend B>
256 template <DeviceBackend B>
266 template <DeviceBackend B>
294 template <DeviceBackend B>
321 template <DeviceBackend B>
327 template <DeviceBackend B>
Array layout descriptors, non-owning views, row views, and iterator base.
Device-callable view for ArrayEigenUniMatrixBatch (rows of identically-shaped matrix batches,...
#define DNDS_DEVICE_CALLABLE
#define DNDS_assert_info(expr, info)
Debug-only assertion with an extra std::string info message.
#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.
Non-owning view of one row's matrix batch in ArrayEigenUniMatrixBatch.
DNDS_DEVICE_CALLABLE UniMatrixRowView(const t_deviceView< B > &n_view, index n_iRow, rowsize n_row_size)
DNDS_DEVICE_CALLABLE t_EigenMap_const operator[](rowsize j) const
DNDS_DEVICE_CALLABLE t_EigenMap operator[](rowsize j)
Element iterator for ArrayEigenUniMatrixBatch, yielding UniMatrixRowView per row.
DNDS_DEVICE_CALLABLE ~iterator()=default
DNDS_DEVICE_CALLABLE iterator(const view_type &n_view, index n_iRow)
std::random_access_iterator_tag iterator_category
DNDS_DEVICE_CALLABLE reference operator*()
DNDS_DEVICE_CALLABLE iterator(const iterator &)=default
CSR array whose rows store a batch of identically-sized Eigen matrices.
rowsize BatchSize(index i) const
Eigen::Map< const t_EigenMatrix, Eigen::Unaligned > t_EigenMap_const
void Resize(index n_size, int r, int c)
std::vector< t_EigenMap > operator[](index i)
t_EigenMap_const operator()(index i, rowsize j) const
static std::string GetDerivedArraySignature()
ArrayEigenUniMatrixBatchDeviceView< B, real, _n_row, _n_col > t_deviceView
Eigen::Map< t_EigenMatrix, Eigen::Unaligned > t_EigenMap
void Resize(index n_size)
void ResizeRow(index i, rowsize b_size)
t_EigenMap operator()(index i, rowsize j)
rowsize RowSize(index i) const
void ResizeMatrix(int r=-1, int c=-1)
resizes all matrices to be used; -1 means no change
ArrayEigenUniMatrixBatch(const t_self &R)=default
void clone(const t_self &R)
t_self & operator=(const t_self &R)=default
void WriteSerializer(Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset offset)
void Resize(index n_size, int r, int c, TFRowSize &&rsf)
void ResizeBatch(index i, rowsize b_size)
void ReadSerializer(Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset &offset)
Eigen::Matrix< real, _n_row, _n_col, Eigen::AutoAlign|((_n_row==1 &&_n_col !=1) ? Eigen ::RowMajor :(_n_col==1 &&_n_row !=1) ? Eigen ::ColMajor :Eigen ::ColMajor)> t_EigenMatrix
ReadSerializerMetaResult ReadSerializerMeta(Serializer::SerializerBaseSSP serializerP, const std::string &name)
CRTP base for row-granularity iterators over an Array / ArrayView.
std::ptrdiff_t difference_type
DNDS_DEVICE_CALLABLE index RowSize() const
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.
T * operator[](index iRow)
Return a raw pointer to the start of row iRow.
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.
t_View view()
Produce a lightweight, device-agnostic view onto the array.
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
int32_t rowsize
Row-width / per-row element-count type (signed 32-bit).
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).