Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::analysis::BondCutoffMatrix Class Reference

Contiguous 2D matrix of element-pair bond cutoff ranges. More...

#include <AnalysisTypes.hpp>

Classes

class  RowProxy
 Mutable row proxy providing element access, span conversion, and compatibility resize. More...
class  ConstRowProxy
 Immutable row proxy providing element access and span conversion. More...
class  RowIterator
 Random-access iterator yielding RowProxy views for each row. More...

Public Types

using iterator = RowIterator<false>
using const_iterator = RowIterator<true>

Public Member Functions

 BondCutoffMatrix ()=default
 Default constructor creating an empty matrix.
 BondCutoffMatrix (size_t n)
 Constructs an n x n square matrix.
 BondCutoffMatrix (size_t rows, size_t cols, BondCutoffRange default_val={})
 Constructs a matrix with specified dimensions and default value.
 BondCutoffMatrix (size_t rows, const std::vector< BondCutoffRange > &initial_row)
 Compatibility constructor replicating an initial row across all rows.
 BondCutoffMatrix (std::initializer_list< std::vector< BondCutoffRange > > list)
 Initializer-list constructor for 2D row initializers.
size_t size () const noexcept
size_t rows () const noexcept
size_t cols () const noexcept
bool empty () const noexcept
void clear () noexcept
 Clears all elements, resetting matrix dimensions to zero.
void resize (size_t rows)
 Resizes matrix rows, defaulting columns to rows if uninitialized.
void resize (size_t rows, const std::vector< BondCutoffRange > &initial_row)
 Compatibility resize replicating initial_row across all rows.
void resize (size_t rows, size_t cols, BondCutoffRange default_val={})
 Resizes matrix to specified dimensions.
void ensureCols (size_t new_cols)
 Ensures matrix has at least new_cols columns.
RowProxy operator[] (size_t row) noexcept
 Accesses row via mutable RowProxy.
ConstRowProxy operator[] (size_t row) const noexcept
 Accesses row via immutable ConstRowProxy.
BondCutoffRange & operator() (size_t row, size_t col) noexcept
 Direct 2D mutable element accessor.
const BondCutoffRange & operator() (size_t row, size_t col) const noexcept
 Direct 2D immutable element accessor.
BondCutoffRange * rowData (size_t row) noexcept
const BondCutoffRange * rowData (size_t row) const noexcept
std::span< const BondCutoffRange > flatSpan () const noexcept
std::span< BondCutoffRange > flatSpan () noexcept
iterator begin () noexcept
iterator end () noexcept
const_iterator begin () const noexcept
const_iterator end () const noexcept
const_iterator cbegin () const noexcept
const_iterator cend () const noexcept
bool operator== (const BondCutoffMatrix &other) const noexcept
 Equality operator for BondCutoffMatrix.

Private Attributes

size_t rows_ {0}
size_t cols_ {0}
std::vector< BondCutoffRange > data_

Detailed Description

Contiguous 2D matrix of element-pair bond cutoff ranges.

Stores cutoff ranges in a single cache-line-aligned flat buffer while providing RowProxy and std::span row views for seamless operator[i][j] indexing with zero heap fragmentation.

Member Typedef Documentation

◆ const_iterator

◆ iterator

Constructor & Destructor Documentation

◆ BondCutoffMatrix() [1/5]

correlation::analysis::BondCutoffMatrix::BondCutoffMatrix ( )
default

Default constructor creating an empty matrix.

Here is the caller graph for this function:

◆ BondCutoffMatrix() [2/5]

correlation::analysis::BondCutoffMatrix::BondCutoffMatrix ( size_t n)
inlineexplicit

Constructs an n x n square matrix.

Parameters
[in]nRow and column count.

◆ BondCutoffMatrix() [3/5]

correlation::analysis::BondCutoffMatrix::BondCutoffMatrix ( size_t rows,
size_t cols,
BondCutoffRange default_val = {} )
inline

Constructs a matrix with specified dimensions and default value.

Parameters
[in]rowsNumber of rows.
[in]colsNumber of columns.
[in]default_valInitial value for all matrix entries.
Here is the call graph for this function:

◆ BondCutoffMatrix() [4/5]

correlation::analysis::BondCutoffMatrix::BondCutoffMatrix ( size_t rows,
const std::vector< BondCutoffRange > & initial_row )
inline

Compatibility constructor replicating an initial row across all rows.

Parameters
[in]rowsNumber of rows.
[in]initial_rowInitial row vector to copy into every row.
Here is the call graph for this function:

◆ BondCutoffMatrix() [5/5]

correlation::analysis::BondCutoffMatrix::BondCutoffMatrix ( std::initializer_list< std::vector< BondCutoffRange > > list)
inline

Initializer-list constructor for 2D row initializers.

Parameters
[in]listInitializer list of vector rows.
Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

const_iterator correlation::analysis::BondCutoffMatrix::begin ( ) const
inlinenodiscardnoexcept

◆ begin() [2/2]

iterator correlation::analysis::BondCutoffMatrix::begin ( )
inlinenodiscardnoexcept
Here is the caller graph for this function:

◆ cbegin()

const_iterator correlation::analysis::BondCutoffMatrix::cbegin ( ) const
inlinenodiscardnoexcept
Here is the call graph for this function:

◆ cend()

const_iterator correlation::analysis::BondCutoffMatrix::cend ( ) const
inlinenodiscardnoexcept
Here is the call graph for this function:

◆ clear()

void correlation::analysis::BondCutoffMatrix::clear ( )
inlinenoexcept

Clears all elements, resetting matrix dimensions to zero.

◆ cols()

size_t correlation::analysis::BondCutoffMatrix::cols ( ) const
inlinenodiscardnoexcept
Returns
Number of columns in the matrix.
Here is the caller graph for this function:

◆ empty()

bool correlation::analysis::BondCutoffMatrix::empty ( ) const
inlinenodiscardnoexcept
Returns
True if matrix has zero elements.
Here is the caller graph for this function:

◆ end() [1/2]

const_iterator correlation::analysis::BondCutoffMatrix::end ( ) const
inlinenodiscardnoexcept

◆ end() [2/2]

iterator correlation::analysis::BondCutoffMatrix::end ( )
inlinenodiscardnoexcept
Here is the caller graph for this function:

◆ ensureCols()

void correlation::analysis::BondCutoffMatrix::ensureCols ( size_t new_cols)
inline

Ensures matrix has at least new_cols columns.

Parameters
[in]new_colsColumn count to set.

◆ flatSpan() [1/2]

std::span< const BondCutoffRange > correlation::analysis::BondCutoffMatrix::flatSpan ( ) const
inlinenodiscardnoexcept
Returns
Contiguous span of all matrix elements.

◆ flatSpan() [2/2]

std::span< BondCutoffRange > correlation::analysis::BondCutoffMatrix::flatSpan ( )
inlinenodiscardnoexcept
Returns
Mutable contiguous span of all matrix elements.

◆ operator()() [1/2]

const BondCutoffRange & correlation::analysis::BondCutoffMatrix::operator() ( size_t row,
size_t col ) const
inlinenodiscardnoexcept

Direct 2D immutable element accessor.

Parameters
[in]rowZero-based row index.
[in]colZero-based column index.
Returns
Const reference to the cutoff range.

◆ operator()() [2/2]

BondCutoffRange & correlation::analysis::BondCutoffMatrix::operator() ( size_t row,
size_t col )
inlinenodiscardnoexcept

Direct 2D mutable element accessor.

Parameters
[in]rowZero-based row index.
[in]colZero-based column index.
Returns
Reference to the cutoff range.

◆ operator==()

bool correlation::analysis::BondCutoffMatrix::operator== ( const BondCutoffMatrix & other) const
inlinenoexcept

Equality operator for BondCutoffMatrix.

Parameters
[in]otherThe other matrix to compare against.
Returns
True if dimensions and contents match.
Here is the call graph for this function:

◆ operator[]() [1/2]

ConstRowProxy correlation::analysis::BondCutoffMatrix::operator[] ( size_t row) const
inlinenodiscardnoexcept

Accesses row via immutable ConstRowProxy.

Parameters
[in]rowZero-based row index.
Returns
ConstRowProxy over the row's elements.

◆ operator[]() [2/2]

RowProxy correlation::analysis::BondCutoffMatrix::operator[] ( size_t row)
inlinenodiscardnoexcept

Accesses row via mutable RowProxy.

Parameters
[in]rowZero-based row index.
Returns
RowProxy over the row's elements.

◆ resize() [1/3]

void correlation::analysis::BondCutoffMatrix::resize ( size_t rows)
inline

Resizes matrix rows, defaulting columns to rows if uninitialized.

Parameters
[in]rowsNew row count.
Here is the call graph for this function:

◆ resize() [2/3]

void correlation::analysis::BondCutoffMatrix::resize ( size_t rows,
const std::vector< BondCutoffRange > & initial_row )
inline

Compatibility resize replicating initial_row across all rows.

Parameters
[in]rowsNew row count.
[in]initial_rowRow to replicate.
Here is the call graph for this function:

◆ resize() [3/3]

void correlation::analysis::BondCutoffMatrix::resize ( size_t rows,
size_t cols,
BondCutoffRange default_val = {} )
inline

Resizes matrix to specified dimensions.

Parameters
[in]rowsNew row count.
[in]colsNew column count.
[in]default_valDefault value for populated cells.
Here is the call graph for this function:

◆ rowData() [1/2]

const BondCutoffRange * correlation::analysis::BondCutoffMatrix::rowData ( size_t row) const
inlinenodiscardnoexcept
Returns
Const pointer to start of row row.

◆ rowData() [2/2]

BondCutoffRange * correlation::analysis::BondCutoffMatrix::rowData ( size_t row)
inlinenodiscardnoexcept
Returns
Pointer to start of row row.

◆ rows()

size_t correlation::analysis::BondCutoffMatrix::rows ( ) const
inlinenodiscardnoexcept
Returns
Number of rows in the matrix.
Here is the caller graph for this function:

◆ size()

size_t correlation::analysis::BondCutoffMatrix::size ( ) const
inlinenodiscardnoexcept
Returns
Number of rows in the matrix.
Here is the caller graph for this function:

Member Data Documentation

◆ cols_

size_t correlation::analysis::BondCutoffMatrix::cols_ {0}
private

◆ data_

std::vector<BondCutoffRange> correlation::analysis::BondCutoffMatrix::data_
private

◆ rows_

size_t correlation::analysis::BondCutoffMatrix::rows_ {0}
private

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