NeoN
A framework for CFD software
Loading...
Searching...
No Matches
NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > Class Template Reference

A class representing a linear system of equations. More...

#include <linearSystem.hpp>

Inheritance diagram for NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >:
NeoN::SupportsCopyTo< HostType >

Public Types

using LinearSystemIndexType = typename SystemMatrixType::MatrixSparsityType::SparsityIndexType

Public Member Functions

 LinearSystem (const SystemMatrixType &matrix, const Vector< RHSValueType > &rhs, const BoundaryMatrixType &offDiagonalMatrix, const BoundaryMatrixType &boundaryMatrix, const Vector< RHSValueType > &boundaryRhs, std::shared_ptr< MeshIterationStrategy > strategy=std::make_shared< FaceBasedIterator >())
 LinearSystem (const SystemMatrixType &matrix, const Vector< RHSValueType > &rhs, const BoundaryMatrixType &boundaryMatrix, const Vector< RHSValueType > &boundaryRhs, std::shared_ptr< MeshIterationStrategy > strategy=std::make_shared< FaceBasedIterator >())
 LinearSystem (const LinearSystem &ls)
 ~LinearSystem ()=default
SystemMatrixType & matrix ()
const SystemMatrixType & matrix () const
BoundaryMatrixType & offDiagonalMatrix ()
const BoundaryMatrixType & offDiagonalMatrix () const
BoundaryMatrixType & boundaryMatrix ()
const BoundaryMatrixType & boundaryMatrix () const
Vector< RHSValueType > & rhs ()
const Vector< RHSValueType > & rhs () const
Vector< RHSValueType > & boundaryRhs ()
const Vector< RHSValueType > & boundaryRhs () const
std::shared_ptr< Vector< RHSValueType > > & faceFluxCorrection ()
const std::shared_ptr< Vector< RHSValueType > > & faceFluxCorrection () const
bool keepFaceFluxCorrection () const
void keepFaceFluxCorrection (bool keep)
const std::shared_ptr< Vector< RHSValueType > > & diagCmpt () const
 Per-component diagonal correction for implicit transform BCs (slip/symmetry). nullptr when no implicit transform patch is present (the fast multi-RHS path).
Vector< RHSValueType > & ensureDiagCmpt ()
 Lazily allocate (zero-initialised, one RHSValueType per cell) and return the per-component diagonal-correction store, so the Laplacian assembly can accumulate the implicit transform-BC contribution into it.
LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > copyToExecutor (Executor exec) const override
void reset ()
LinearSystemView< RHSValueType, MatrixView< MatrixValueType, SparsityView< typename SystemMatrixType::MatrixSparsityType::SparsityIndexType > > > view () &&=delete
LinearSystemView< RHSValueType, MatrixView< MatrixValueType, SparsityView< typename SystemMatrixType::MatrixSparsityType::SparsityIndexType > > > view () const &&=delete
LinearSystemView< RHSValueType, MatrixView< MatrixValueType, SparsityView< LinearSystemIndexType > > > view () &
std::shared_ptr< const FaceToMatrixAddress > faceToMatrixAddress () const
LinearSystemView< const RHSValueType, const MatrixView< MatrixValueType, SparsityView< const LinearSystemIndexType > > > view () const &
std::shared_ptr< MeshIteratorContext > getMeshIterator ()
const Executor & exec () const
Public Member Functions inherited from NeoN::SupportsCopyTo< HostType >
virtual ~SupportsCopyTo ()=default
HostType copyToHost () const

Detailed Description

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
class NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >

A class representing a linear system of equations.

The LinearSystem class provides functionality to store and manipulate a linear system of equations. It supports the storage of the coefficient matrix and the right-hand side vector, as well as the solution vector.

Template Parameters
MatrixValueTypeThe value type of the system and boundary matrix coefficients.
RHSValueTypeThe value type of the right-hand side and boundary rhs vectors. Defaults to MatrixValueType, but may differ (e.g. scalar matrix with Vec3 rhs for segregated vector solves).
SystemMatrixTypeThe sparse matrix type used for the system matrix (default: CSRMatrix<MatrixValueType, localIdx>).
BoundaryMatrixTypeThe sparse matrix type used for boundary and off-diagonal matrices (default: COOMatrix<MatrixValueType, localIdx>).

Definition at line 77 of file linearSystem.hpp.

Member Typedef Documentation

◆ LinearSystemIndexType

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
using NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::LinearSystemIndexType = typename SystemMatrixType::MatrixSparsityType::SparsityIndexType

Definition at line 103 of file linearSystem.hpp.

Constructor & Destructor Documentation

◆ LinearSystem() [1/3]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::LinearSystem ( const SystemMatrixType & matrix,
const Vector< RHSValueType > & rhs,
const BoundaryMatrixType & offDiagonalMatrix,
const BoundaryMatrixType & boundaryMatrix,
const Vector< RHSValueType > & boundaryRhs,
std::shared_ptr< MeshIterationStrategy > strategy = std::make_shared<FaceBasedIterator>() )
inline

Definition at line 105 of file linearSystem.hpp.

◆ LinearSystem() [2/3]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::LinearSystem ( const SystemMatrixType & matrix,
const Vector< RHSValueType > & rhs,
const BoundaryMatrixType & boundaryMatrix,
const Vector< RHSValueType > & boundaryRhs,
std::shared_ptr< MeshIterationStrategy > strategy = std::make_shared<FaceBasedIterator>() )
inline

Definition at line 121 of file linearSystem.hpp.

◆ LinearSystem() [3/3]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::LinearSystem ( const LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > & ls)
inline

Definition at line 133 of file linearSystem.hpp.

◆ ~LinearSystem()

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::~LinearSystem ( )
default

Member Function Documentation

◆ boundaryMatrix() [1/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
BoundaryMatrixType & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::boundaryMatrix ( )
inlinenodiscard

Definition at line 159 of file linearSystem.hpp.

◆ boundaryMatrix() [2/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
const BoundaryMatrixType & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::boundaryMatrix ( ) const
inlinenodiscard

Definition at line 161 of file linearSystem.hpp.

◆ boundaryRhs() [1/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
Vector< RHSValueType > & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::boundaryRhs ( )
inlinenodiscard

Definition at line 167 of file linearSystem.hpp.

◆ boundaryRhs() [2/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
const Vector< RHSValueType > & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::boundaryRhs ( ) const
inlinenodiscard

Definition at line 169 of file linearSystem.hpp.

◆ copyToExecutor()

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::copyToExecutor ( Executor exec) const
inlinenodiscardoverridevirtual

Implements NeoN::SupportsCopyTo< HostType >.

Definition at line 218 of file linearSystem.hpp.

◆ diagCmpt()

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
const std::shared_ptr< Vector< RHSValueType > > & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::diagCmpt ( ) const
inlinenodiscard

Per-component diagonal correction for implicit transform BCs (slip/symmetry). nullptr when no implicit transform patch is present (the fast multi-RHS path).

Definition at line 198 of file linearSystem.hpp.

◆ ensureDiagCmpt()

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
Vector< RHSValueType > & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::ensureDiagCmpt ( )
inlinenodiscard

Lazily allocate (zero-initialised, one RHSValueType per cell) and return the per-component diagonal-correction store, so the Laplacian assembly can accumulate the implicit transform-BC contribution into it.

Definition at line 206 of file linearSystem.hpp.

◆ exec()

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
const Executor & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::exec ( ) const
inline

Definition at line 296 of file linearSystem.hpp.

◆ faceFluxCorrection() [1/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
std::shared_ptr< Vector< RHSValueType > > & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::faceFluxCorrection ( )
inlinenodiscard

Definition at line 178 of file linearSystem.hpp.

◆ faceFluxCorrection() [2/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
const std::shared_ptr< Vector< RHSValueType > > & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::faceFluxCorrection ( ) const
inlinenodiscard

Definition at line 183 of file linearSystem.hpp.

◆ faceToMatrixAddress()

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
std::shared_ptr< const FaceToMatrixAddress > NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::faceToMatrixAddress ( ) const
inline

Definition at line 269 of file linearSystem.hpp.

◆ getMeshIterator()

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
std::shared_ptr< MeshIteratorContext > NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::getMeshIterator ( )
inline

Definition at line 287 of file linearSystem.hpp.

◆ keepFaceFluxCorrection() [1/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
bool NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::keepFaceFluxCorrection ( ) const
inlinenodiscard

Definition at line 192 of file linearSystem.hpp.

◆ keepFaceFluxCorrection() [2/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
void NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::keepFaceFluxCorrection ( bool keep)
inline

Definition at line 194 of file linearSystem.hpp.

◆ matrix() [1/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
SystemMatrixType & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::matrix ( )
inlinenodiscard

Definition at line 151 of file linearSystem.hpp.

◆ matrix() [2/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
const SystemMatrixType & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::matrix ( ) const
inlinenodiscard

Definition at line 153 of file linearSystem.hpp.

◆ offDiagonalMatrix() [1/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
BoundaryMatrixType & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::offDiagonalMatrix ( )
inlinenodiscard

Definition at line 155 of file linearSystem.hpp.

◆ offDiagonalMatrix() [2/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
const BoundaryMatrixType & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::offDiagonalMatrix ( ) const
inlinenodiscard

Definition at line 157 of file linearSystem.hpp.

◆ reset()

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
void NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::reset ( )
inline

Definition at line 237 of file linearSystem.hpp.

◆ rhs() [1/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
Vector< RHSValueType > & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::rhs ( )
inlinenodiscard

Definition at line 163 of file linearSystem.hpp.

◆ rhs() [2/2]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
const Vector< RHSValueType > & NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::rhs ( ) const
inlinenodiscard

Definition at line 165 of file linearSystem.hpp.

◆ view() [1/4]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
LinearSystemView< RHSValueType, MatrixView< MatrixValueType, SparsityView< LinearSystemIndexType > > > NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::view ( ) &
inlinenodiscard

Definition at line 264 of file linearSystem.hpp.

◆ view() [2/4]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
LinearSystemView< RHSValueType, MatrixView< MatrixValueType, SparsityView< typename SystemMatrixType::MatrixSparsityType::SparsityIndexType > > > NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::view ( ) &&
nodiscarddelete

◆ view() [3/4]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
LinearSystemView< const RHSValueType, const MatrixView< MatrixValueType, SparsityView< const LinearSystemIndexType > > > NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::view ( ) const &
inlinenodiscard

Definition at line 282 of file linearSystem.hpp.

◆ view() [4/4]

template<typename MatrixValueType, typename RHSValueType = MatrixValueType, typename SystemMatrixType = CSRMatrix<MatrixValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<MatrixValueType, localIdx>>
LinearSystemView< RHSValueType, MatrixView< MatrixValueType, SparsityView< typename SystemMatrixType::MatrixSparsityType::SparsityIndexType > > > NeoN::la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType >::view ( ) const &&
nodiscarddelete

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