15#ifndef CD_PETSCSTENCIL_H
16#define CD_PETSCSTENCIL_H
26#include <CD_NamespaceHeader.H>
66 size() const noexcept;
74 row(const
int a_entry) const noexcept;
82 weight(const
int a_entry) const noexcept;
91 add(const PetscInt& a_row, const PetscScalar& a_weight) noexcept;
100 operator+=(const
PetscStencil& a_otherStencil) noexcept;
116 operator*=(const PetscScalar& a_scalingFactor) noexcept;
122 std::vector<std::pair<PetscInt, PetscScalar>>
m_entries;
125#include <CD_NamespaceFooter.H>
PetscScalar weight(const int a_entry) const noexcept
Get the weight of a stencil entry.
Definition CD_PetscStencil.cpp:46
void add(const PetscInt &a_row, const PetscScalar &a_weight) noexcept
Append an entry to this stencil.
Definition CD_PetscStencil.cpp:54
void compress() noexcept
Sort the entries by row and merge entries with the same row by summing their weights.
Definition CD_PetscStencil.cpp:68
~PetscStencil()=default
Destructor.
void clear()
Remove all entries from the stencil.
Definition CD_PetscStencil.cpp:26
PetscStencil()=default
Default constructor. Creates an empty stencil.
std::vector< std::pair< PetscInt, PetscScalar > > m_entries
Stencil entries as (global PETSc row, weight). Rows are unique and ascending only after compress().
Definition CD_PetscStencil.H:122
PetscInt row(const int a_entry) const noexcept
Get the PETSc row of a stencil entry.
Definition CD_PetscStencil.cpp:38
int size() const noexcept
Get the number of entries in the stencil.
Definition CD_PetscStencil.cpp:32