CSR class
Compressed sparse row (CSR) storage for a sparse matrix.
Contents
Constructors, destructors, conversion operators
Public functions
- auto operator()(std::size_t row, std::size_t col, std::size_t pos = 0) const -> const real&
- Return const reference to sparse matrix entry at a position.
- auto operator()(std::size_t row, std::size_t col, std::size_t pos = 0) -> real&
- void dirichlet(std::size_t i, const std::vector<std::size_t>& gid = {}, const NodeCommMap& nodecommap = {}, std::size_t pos = 0)
- Set Dirichlet boundary condition at a node.
- 
              void mult(const std::vector<real>& x,
              std::vector<real>& r,
              const std::vector<tk::real>& bcmask) const 
- Multiply CSR matrix with vector from the right: r = A * x.
- auto rsize() const -> std::size_t
- Access real size of matrix.
- auto Ncomp() const -> std::size_t
- Access the number of scalar components per non-zero matrix entry.
- auto write_stored(std::ostream& os) const -> std::ostream&
- Write out CSR as stored.
- auto write_structure(std::ostream& os) const -> std::ostream&
- Write out CSR nonzero structure.
- auto write_contribute(std::ostream& os) const -> std::ostream&
- Write out CSR contribute structure.
- auto write_matrix(std::ostream& os) const -> std::ostream&
- Write out CSR as a real matrix.
- auto write_matlab(std::ostream& os) const -> std::ostream&
- Write out CSR in Matlab/Octave format.
Pack/unpack (Charm++ serialization) routines
Function documentation
               tk::
            Constructor: Create a CSR symmetric matrix with ncomp scalar components, storing only the upper triangular part.
| Parameters | |
|---|---|
| nc in | Number of scalar components (degrees of freedom) | 
| psup in | Points surrounding points of mesh graph, see tk:: | 
              const real& tk::
            Return const reference to sparse matrix entry at a position.
| Parameters | |
|---|---|
| row in | Block row | 
| col in | Block column | 
| pos in | Position in block | 
| Returns | Const reference to matrix entry at position specified | 
              real& tk::
Return non-const reference to sparse matrix entry at a position
              void tk::
            Set Dirichlet boundary condition at a node.
| Parameters | |
|---|---|
| i in | Local id at which to set Dirichlet BC | 
| gid in | Local->global node id map | 
| nodecommap in | Node communication map with global node ids | 
| pos in | Position in block | 
In parallel there can be multiple contributions to a single node on the mesh, and correspondingly, a single matrix row can be partially represented on multiple partitions. Setting a Dirichlet BC entails zeroing out the row of the matrix and putting 1/N into the diagonal entry, where N is the number of partitions that contribute to the mesh node (matrix row). As a result, when the matrix participates in a matrix-vector product, where the partial contributions across all partitions are aggregated, the diagonal will contain 1 after the sum across partitions.
              void tk::
            Multiply CSR matrix with vector from the right: r = A * x.
| Parameters | |
|---|---|
| x in | Vector to multiply matrix with from the right | 
| r in | Result vector of product r = A * x | 
| bcmask in | Dirichlet BC mask | 
              std::ostream& tk::
            Write out CSR as stored.
| Parameters | |
|---|---|
| os in/out | Output stream to write to | 
| Returns | Updated output stream | 
              std::ostream& tk::
            Write out CSR nonzero structure.
| Parameters | |
|---|---|
| os in/out | Output stream to write to | 
| Returns | Updated output stream | 
              std::ostream& tk::
            Write out CSR as a real matrix.
| Parameters | |
|---|---|
| os in/out | Output stream to write to | 
| Returns | Updated output stream | 
              std::ostream& tk::
            Write out CSR in Matlab/Octave format.
| Parameters | |
|---|---|
| os in/out | Output stream to write to | 
| Returns | Updated output stream | 
              void tk::
            Pack/Unpack serialize member function.
| Parameters | |
|---|---|
| p in/out | Charm++'s PUP::er serializer object reference |