hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
Public Member Functions | List of all members
hpfem::assembly::SparseAssembler Class Reference

#include <sparse_assembler.hpp>

Public Member Functions

 SparseAssembler (Index rows, Index cols)
 
Index rows () const noexcept
 
Index cols () const noexcept
 
std::size_t num_triplets () const noexcept
 
void reserve (std::size_t triplets)
 
void add (std::span< const Index > rows, std::span< const Index > cols, const Matrix &local)
 Adds local(i, j) to the global entry (rows[i], cols[j]); sizes must match.
 
void add (Index row, Index col, Complex value)
 Adds one entry.
 
void append (const SparseAssembler &other)
 Appends the triplets of another assembler of the same size (per-thread buffers).
 
SparseMatrix finalize () const
 Compressed matrix with all contributions summed.
 

Detailed Description

Collects (row, col, value) triplets from the element loop and compresses them into the row-major CSR hpfem::SparseMatrix; duplicate entries are summed. Finalisation costs O(nnz log nnz).

Constructor & Destructor Documentation

◆ SparseAssembler()

hpfem::assembly::SparseAssembler::SparseAssembler ( Index  rows,
Index  cols 
)

Member Function Documentation

◆ add() [1/2]

void hpfem::assembly::SparseAssembler::add ( Index  row,
Index  col,
Complex  value 
)

Adds one entry.

◆ add() [2/2]

void hpfem::assembly::SparseAssembler::add ( std::span< const Index >  rows,
std::span< const Index >  cols,
const Matrix &  local 
)

Adds local(i, j) to the global entry (rows[i], cols[j]); sizes must match.

◆ append()

void hpfem::assembly::SparseAssembler::append ( const SparseAssembler &  other)

Appends the triplets of another assembler of the same size (per-thread buffers).

◆ cols()

Index hpfem::assembly::SparseAssembler::cols ( ) const
inlinenoexcept

◆ finalize()

SparseMatrix hpfem::assembly::SparseAssembler::finalize ( ) const

Compressed matrix with all contributions summed.

◆ num_triplets()

std::size_t hpfem::assembly::SparseAssembler::num_triplets ( ) const
inlinenoexcept

◆ reserve()

void hpfem::assembly::SparseAssembler::reserve ( std::size_t  triplets)
inline

◆ rows()

Index hpfem::assembly::SparseAssembler::rows ( ) const
inlinenoexcept

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