DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::ArrayAdjacency< _row_size, _row_max, _align > Class Template Reference

Mesh-connectivity array: ParArray<index> whose operator[] yields an AdjacencyRow typed view. More...

#include <ArrayAdjacency.hpp>

Inheritance diagram for DNDS::ArrayAdjacency< _row_size, _row_max, _align >:
[legend]
Collaboration diagram for DNDS::ArrayAdjacency< _row_size, _row_max, _align >:
[legend]

Classes

class  iterator
 Row iterator for ArrayAdjacency, yielding AdjacencyRow per element. More...
 

Public Types

using t_self = ArrayAdjacency< _row_size, _row_max, _align >
 
using t_base = ParArray< index, _row_size, _row_max, _align >
 
template<DeviceBackend B>
using t_deviceView = ArrayAdjacencyDeviceView< B, index, _row_size, _row_max, _align >
 
template<DeviceBackend B>
using t_deviceViewConst = ArrayAdjacencyDeviceView< B, const index, _row_size, _row_max, _align >
 
- Public Types inherited from DNDS::ParArray< T, _row_size, _row_max, _align >
using TArray = Array< T, _row_size, _row_max, _align >
 
using t_self = ParArray< T, _row_size, _row_max, _align >
 
using t_pArray = ssp< TArray >
 
using t_pRowSizes = typename TArray::t_pRowSizes
 
- Public Types inherited from DNDS::Array< T, _row_size, _row_max, _align >
using self_type = Array< T, _row_size, _row_max, _align >
 
using t_Layout = ArrayLayout< T, _row_size, _row_max, _align >
 
using t_View = ArrayView< T, _row_size, _row_max, _align >
 
using t_Data = host_device_vector< value_type >
 
using t_DataUncompressed = std::vector< std::vector< value_type > >
 
using t_RowStart = host_device_vector< index >
 
using t_pRowStart = ssp< t_RowStart >
 
using t_RowSizes = host_device_vector< rowsize >
 
using t_pRowSizes = ssp< t_RowSizes >
 
template<DeviceBackend B>
using t_deviceView = ArrayDeviceView< B, T, _row_size, _row_max, _align >
 
template<DeviceBackend B>
using t_deviceViewConst = ArrayDeviceView< B, const T, _row_size, _row_max, _align >
 
- Public Types inherited from DNDS::ArrayLayout< T, _row_size, _row_max, _align >
using value_type = T
 

Public Member Functions

 ArrayAdjacency (const t_self &R)=default
 
t_selfoperator= (const t_self &R)=default
 
void clone (const t_self &R)
 Shallow copy (same semantics as assignment).
 
AdjacencyRow< indexoperator[] (index i)
 Typed row access; returns an AdjacencyRow bound to the row's pointer and width. Past-the-end queries are disabled.
 
AdjacencyRow< const indexoperator[] (index i) const
 Const typed row access.
 
indexrowPtr (index i)
 Raw index* pointer to row i (bypasses the typed wrapper).
 
template<DeviceBackend B>
auto deviceView ()
 
template<DeviceBackend B>
auto deviceView () const
 
template<DeviceBackend B>
iterator< B > begin ()
 
template<DeviceBackend B>
iterator< B > end ()
 
- Public Member Functions inherited from DNDS::ParArray< T, _row_size, _row_max, _align >
 ParArray (const t_self &R)=default
 
t_selfoperator= (const t_self &R)=default
 
void clone (const t_self &R)
 Copy-assign from another ParArray. Shallow copy semantics (mirrors Arrayclone): shares structural/data buffers.
 
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.
 
MPI_Datatype getDataType ()
 MPI element datatype used for ghost exchange (deduced from T).
 
MPI_int getTypeMult ()
 Per-element count multiplier that goes with getDataType.
 
void setMPI (const MPIInfo &n_mpi)
 Install the MPI context after default construction.
 
MPIInfogetMPI ()
 Mutable MPI context accessor.
 
const MPIInfogetMPI () const
 Read-only MPI context accessor.
 
void setDataType (MPI_Datatype n_dType, MPI_int n_TypeMult)
 Override the deduced MPI datatype and element multiplier (advanced; needed for custom compound element types).
 
 ParArray ()=default
 Default-construct an uninitialised ParArray; call setMPI and Resize later.
 
 ParArray (const MPIInfo &n_mpi)
 Construct a ParArray bound to the given MPI context.
 
 ParArray (MPI_Datatype n_dType, MPI_int n_TypeMult, const MPIInfo &n_mpi)
 Construct with a custom (MPI datatype, multiplier) pair.
 
template<typename... Args>
 ParArray (ObjName objName, Args &&...args)
 Named constructor: sets the object name for tracing/debugging. All existing constructor overloads are supported via perfect forwarding. Inherited by derived classes (ArrayAdjacency, ArrayEigenVector, etc.) through using t_base::t_base.
 
void AssertDataType ()
 Assert the MPI datatype matches sizeof(T) exactly.
 
bool AssertConsistent ()
 Check array consistency across all ranks.
 
void createGlobalMapping ()
 Collective: build the global offsets table.
 
index globalSize () const
 Returns the total global size (sum of sizes across all ranks).
 
 Array ()=default
 Default-constructed array: empty, no storage.
 
 Array (ObjName objName)
 Named constructor: sets the object name for tracing/debugging. Delegates to the default constructor, then sets the name.
 
 Array (const self_type &R)
 Copy constructor (same semantics as clone).
 
- Public Member Functions inherited from DNDS::Array< T, _row_size, _row_max, _align >
t_pRowStart getRowStart ()
 Shared pointer to the row-start index (CSR layout only).
 
t_pRowSizes getRowSizes ()
 Shared pointer to the per-row size vector (TABLE_Max / TABLE_StaticMax).
 
 Array ()=default
 Default-constructed array: empty, no storage.
 
 Array (ObjName objName)
 Named constructor: sets the object name for tracing/debugging. Delegates to the default constructor, then sets the name.
 
index Size () const
 Number of rows currently stored. O(1).
 
rowsize RowSize () const
 Uniform row width for fixed layouts (no row index needed).
 
rowsize DataStride () const
 Number of T elements per row in flat storage (data stride). For TABLE_StaticMax/TABLE_Max, this is _row_max (padded), not RowSize (used). Not valid for CSR (variable stride per row).
 
rowsize RowSize (index iRow) const
 Width used by row iRow in number of T elements.
 
rowsize RowSizeMax () const
 Maximum allowed row width for TABLE_Max / TABLE_StaticMax.
 
rowsize RowSizeField () const
 "Logical" row-field width used by derived (Eigen) arrays: max for padded layouts, uniform width for fixed layouts. Not valid for CSR.
 
rowsize RowSizeField (index iRow) const
 Per-row "field" size for CSR (= actual row width). Invalid elsewhere.
 
bool IfCompressed () const
 (CSR only) Whether the array is in packed / flat form.
 
void CSRDecompress ()
 (CSR only) Switch to the uncompressed (nested vector) representation.
 
void CSRCompress ()
 (CSR only) Pack the nested-vector representation into a flat buffer plus _pRowStart. No-op if already compressed.
 
void Compress ()
 Layout-polymorphic compress: no-op for non-CSR, calls CSRCompress for CSR.
 
void Decompress ()
 Layout-polymorphic decompress: no-op for non-CSR, calls CSRDecompress for CSR.
 
t_DataRawDataVector ()
 Access to the underlying flat buffer (host_device_vector<T>).
 
void Resize (index nSize, rowsize nRow_size_dynamic)
 Resize the array, setting a uniform or maximum row width.
 
void Resize (index nSize)
 Resize using only the row count (layouts with an implicit row width).
 
template<class TFRowSize >
void Resize (index nSize, TFRowSize &&FRowSize)
 Resize a CSR array directly to the compressed form via a width functor.
 
void ResizeRow (index iRow, rowsize nRowSize)
 Change the width of a single row.
 
void ReserveRow (index iRow, rowsize nRowSize)
 Reserve capacity for a CSR decompressed row without changing its size.
 
t_View view ()
 Produce a lightweight, device-agnostic view onto the array.
 
const T & at (index iRow, rowsize iCol) const
 Bounds-checked element access.
 
T & operator() (index iRow, rowsize iCol=0)
 Bounds-checked 2D element access (writable).
 
const T & operator() (index iRow, rowsize iCol=0) const
 Bounds-checked 2D element access (read-only).
 
T * operator[] (index iRow)
 Return a raw pointer to the start of row iRow.
 
const T * operator[] (index iRow) const
 Const row pointer, see the non-const overload.
 
T * data (DeviceBackend B=DeviceBackend::Unknown)
 Raw pointer to the flat data buffer.
 
size_t DataSize () const
 Total number of T elements currently stored in the flat buffer.
 
size_t DataSizeBytes () const
 Flat buffer size in bytes (= DataSize() * sizeof(T)).
 
void CopyRowFrom (index dstRow, const self_type &src, index srcRow)
 Copy raw row data from another Array of the same type. Works for all layouts (StaticFixed, Fixed, CSR, etc.) and is not hidden by derived types that make operator()/operator[] private.
 
template<class TRowSizeFunc >
void ResizeRowsAndCompress (TRowSizeFunc &&rowSizeFunc)
 Set per-row sizes from a source, applying an index mapping, then compress. For CSR layout only. rowSizeFunc(i) returns the desired row size for row i. Not hidden by derived types that make ResizeRow private.
 
size_t FullSizeBytes () const
 Total footprint in bytes including structural arrays.
 
std::size_t hash ()
 Combined hash of size, structural arrays, and data.
 
constexpr DataLayout GetDataLayout ()
 Runtime accessor for the layout tag (constexpr-folded).
 
void clone (const self_type &R)
 Shallow clone: copies all metadata and shares structural/data storage.
 
void CopyData (const self_type &R)
 Deep copy alias. Currently delegates to clone; kept for API compatibility and to allow a future true deep-copy implementation.
 
self_typeoperator= (const self_type &R)
 Copy-assignment; implemented via clone with self-assign guard.
 
 Array (const self_type &R)
 Copy constructor (same semantics as clone).
 
void SwapData (self_type &R)
 Swap the storage of two arrays in-place.
 
void __WriteSerializerData (const Serializer::SerializerBaseSSP &serializerP, Serializer::ArrayGlobalOffset offset)
 
void __ReadSerializerData (const Serializer::SerializerBaseSSP &serializerP, Serializer::ArrayGlobalOffset &offset)
 
void WriteSerializer (Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset offset, Serializer::ArrayGlobalOffset dataOffset=Serializer::ArrayGlobalOffset_Unknown)
 Serialize (write) array data to a serializer.
 
void ReadSerializer (Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset &offset)
 Convenience overload that discards the dataOffset output.
 
void ReadSerializer (Serializer::SerializerBaseSSP serializerP, const std::string &name, Serializer::ArrayGlobalOffset &offset, Serializer::ArrayGlobalOffset &dataOffset)
 Deserialize (read) array data from a serializer.
 
ReadSerializerMetaResult ReadSerializerMeta (Serializer::SerializerBaseSSP serializerP, const std::string &name)
 Reads only metadata from a serialized array without reading data.
 
void __ReadSerializerStructuralAndResolveDataOffset (const Serializer::SerializerBaseSSP &serializerP, Serializer::ArrayGlobalOffset &offset, Serializer::ArrayGlobalOffset &dataOffset)
 Reads structural data (pRowStart / pRowSizes) and resolves dataOffset.
 
void __ReadSerializerDataAndPropagateOffset (const Serializer::SerializerBaseSSP &serializerP, Serializer::ArrayGlobalOffset &offset, Serializer::ArrayGlobalOffset &dataOffset)
 Reads flat data and propagates resolved offsets back to the caller.
 
void to_host ()
 Mirror the flat/structural buffers back to host memory.
 
void to_device (DeviceBackend backend=DeviceBackend::Host)
 Mirror the flat/structural buffers to a target device (e.g. CUDA).
 
void clear_device ()
 Release any device-side mirror of this array's buffers.
 
template<DeviceBackend B>
t_deviceView< B > deviceView ()
 Mutable device-callable view (Eigen::Map-style row access on GPU).
 
template<DeviceBackend B>
t_deviceViewConst< B > deviceView () const
 Const device-callable view. See non-const overload.
 
DeviceBackend device () const
 Current device backend the data is mirrored on, or Unknown if host-only.
 
template<DeviceBackend B>
iterator< B > begin ()
 Iterator to the first row, viewed on device backend B.
 
template<DeviceBackend B>
iterator< B > end ()
 Iterator one past the last row, viewed on device backend B.
 
- Public Member Functions inherited from DNDS::ObjectNaming
 ObjectNaming ()=default
 
 ObjectNaming (const ObjectNaming &)=default
 
 ObjectNaming (ObjectNaming &&)=default
 
ObjectNamingoperator= (const ObjectNaming &)=default
 
ObjectNamingoperator= (ObjectNaming &&)=default
 
 ~ObjectNaming ()=default
 
void setObjectName (const std::string &name)
 
const std::string & getObjectName () const
 
std::string getObjectIdentity (const std::string &sig) const
 

Additional Inherited Members

- Static Public Member Functions inherited from DNDS::Array< T, _row_size, _row_max, _align >
static constexpr bool IsCSR ()
 
static constexpr DataLayout GetDataLayoutStatic ()
 Compile-time layout tag (one of TABLE_StaticFixed, TABLE_Fixed, TABLE_StaticMax, TABLE_Max, CSR).
 
- Static Public Member Functions inherited from DNDS::ArrayLayout< T, _row_size, _row_max, _align >
static constexpr DataLayout _GetDataLayout ()
 Deduce the DataLayout tag from the template parameters.
 
static std::string GetArrayName ()
 Human-readable type identifier including element typeid, sizes, and alignment.
 
static std::string GetArraySignature ()
 Compiler-independent identifier used by serializers to tag an array.
 
static std::string GetArraySignatureRelaxed ()
 Signature with _row_size / _row_max replaced by DynamicSize.
 
static std::tuple< int, int, int, int > ParseArraySignatureTuple (const std::string &v)
 Parse a signature string into (sizeof_T, row_size, row_max, align).
 
static bool ArraySignatureIsCompatible (const std::string &v)
 Whether a stored signature can be read into this array type.
 
- Public Attributes inherited from DNDS::ParArray< T, _row_size, _row_max, _align >
t_pLGlobalMapping pLGlobalMapping
 Shared pointer to the global-offsets table. Populated by createGlobalMapping; may be pointed at an existing table to skip the collective setup.
 
MPIInfo mpi
 MPI context associated with this array (must be set before collectives).
 
- Static Public Attributes inherited from DNDS::ParArray< T, _row_size, _row_max, _align >
static const DataLayout _dataLayout = TArray::_dataLayout
 
- Static Public Attributes inherited from DNDS::ArrayLayout< T, _row_size, _row_max, _align >
static const rowsize al = _align
 
static const rowsize rs = _row_size
 
static const rowsize rm = _row_max
 
static const size_t sizeof_T = sizeof(value_type)
 
static const rowsize s_T = al == NoAlign ? sizeof_T : (sizeof_T / al + 1) * al
 
static const DataLayout _dataLayout = _GetDataLayout()
 
static const bool isCSR = _dataLayout == CSR
 
- Protected Member Functions inherited from DNDS::Array< T, _row_size, _row_max, _align >
bool IfCompressed_ () const
 
- Protected Attributes inherited from DNDS::Array< T, _row_size, _row_max, _align >
t_pRowStart _pRowStart
 
t_pRowSizes _pRowSizes
 
t_Data _data
 
DeviceBackend deviceBackend = DeviceBackend::Unknown
 
t_DataUncompressed _dataUncompressed
 
index _size = 0
 
rowsize _row_size_dynamic = 0
 

Detailed Description

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
class DNDS::ArrayAdjacency< _row_size, _row_max, _align >

Mesh-connectivity array: ParArray<index> whose operator[] yields an AdjacencyRow typed view.

Used for cell-to-node, cell-to-cell, face-to-cell, ... every mesh connectivity table in DNDSR. Variable row widths (triangle vs quad vs hex) fall out naturally when instantiated with NonUniformSize / NonUniformSize template parameters (CSR layout); fixed-width connectivity (e.g., edges = 2 nodes) uses ArrayAdjacency<2>.

The typed operator[] returns an AdjacencyRow<index>, a lightweight span that supports size queries, range-based for, conversion to std::vector, and assignment from std::vector.

Template Parameters
_row_size1 or a small fixed edge/face size; NonUniformSize for mixed-element connectivity.
_row_maxIgnored unless _row_size == NonUniformSize (see Array).

Definition at line 41 of file ArrayAdjacency.hpp.

Member Typedef Documentation

◆ t_base

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
using DNDS::ArrayAdjacency< _row_size, _row_max, _align >::t_base = ParArray<index, _row_size, _row_max, _align>

Definition at line 45 of file ArrayAdjacency.hpp.

◆ t_deviceView

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
template<DeviceBackend B>
using DNDS::ArrayAdjacency< _row_size, _row_max, _align >::t_deviceView = ArrayAdjacencyDeviceView<B, index, _row_size, _row_max, _align>

Definition at line 80 of file ArrayAdjacency.hpp.

◆ t_deviceViewConst

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
template<DeviceBackend B>
using DNDS::ArrayAdjacency< _row_size, _row_max, _align >::t_deviceViewConst = ArrayAdjacencyDeviceView<B, const index, _row_size, _row_max, _align>

Definition at line 83 of file ArrayAdjacency.hpp.

◆ t_self

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
using DNDS::ArrayAdjacency< _row_size, _row_max, _align >::t_self = ArrayAdjacency<_row_size, _row_max, _align>

Definition at line 44 of file ArrayAdjacency.hpp.

Constructor & Destructor Documentation

◆ ArrayAdjacency()

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
DNDS::ArrayAdjacency< _row_size, _row_max, _align >::ArrayAdjacency ( const t_self R)
default

Member Function Documentation

◆ begin()

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
template<DeviceBackend B>
iterator< B > DNDS::ArrayAdjacency< _row_size, _row_max, _align >::begin ( )
inline

Definition at line 126 of file ArrayAdjacency.hpp.

◆ clone()

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
void DNDS::ArrayAdjacency< _row_size, _row_max, _align >::clone ( const t_self R)
inline

Shallow copy (same semantics as assignment).

Definition at line 54 of file ArrayAdjacency.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deviceView() [1/2]

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
template<DeviceBackend B>
auto DNDS::ArrayAdjacency< _row_size, _row_max, _align >::deviceView ( )
inline

Definition at line 86 of file ArrayAdjacency.hpp.

◆ deviceView() [2/2]

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
template<DeviceBackend B>
auto DNDS::ArrayAdjacency< _row_size, _row_max, _align >::deviceView ( ) const
inline

Definition at line 92 of file ArrayAdjacency.hpp.

◆ end()

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
template<DeviceBackend B>
iterator< B > DNDS::ArrayAdjacency< _row_size, _row_max, _align >::end ( )
inline

Definition at line 132 of file ArrayAdjacency.hpp.

Here is the call graph for this function:

◆ operator=()

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
t_self & DNDS::ArrayAdjacency< _row_size, _row_max, _align >::operator= ( const t_self R)
default
Here is the caller graph for this function:

◆ operator[]() [1/2]

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
AdjacencyRow< index > DNDS::ArrayAdjacency< _row_size, _row_max, _align >::operator[] ( index  i)
inline

Typed row access; returns an AdjacencyRow bound to the row's pointer and width. Past-the-end queries are disabled.

disable past-end input

Definition at line 61 of file ArrayAdjacency.hpp.

Here is the call graph for this function:

◆ operator[]() [2/2]

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
AdjacencyRow< const index > DNDS::ArrayAdjacency< _row_size, _row_max, _align >::operator[] ( index  i) const
inline

Const typed row access.

Definition at line 71 of file ArrayAdjacency.hpp.

◆ rowPtr()

template<rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
index * DNDS::ArrayAdjacency< _row_size, _row_max, _align >::rowPtr ( index  i)
inline

Raw index* pointer to row i (bypasses the typed wrapper).

Definition at line 77 of file ArrayAdjacency.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: