NeoN
A framework for CFD software
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
NeoN::la Namespace Reference

Classes

class  CellBasedIterator
 Iteration strategy that traverses cells and their face stencils. More...
 
class  CooSparsityPattern
 row and column index representation of a mesh More...
 
class  CsrSparsityPattern
 row and column index representation of a mesh More...
 
class  DiagonalSolver
 
struct  Dimensions
 hold the number of rows and columns of a matrix More...
 
class  FaceBasedIterator
 Iteration strategy that traverses internal faces. More...
 
class  FaceToMatrixAddress
 
struct  FaceToMatrixView
 
class  LinearSystem
 A class representing a linear system of equations. More...
 
struct  LinearSystemView
 A view linear into a linear system's data. More...
 
class  Matrix
 Sparse matrix class with compact storage by row (CSR) format. More...
 
struct  MatrixView
 A view struct to allow easy read/write on all executors. More...
 
class  MeshIterationStrategy
 Abstract base class defining the interface for mesh iteration strategies. More...
 
class  MeshIteratorContext
 Holds and exposes the active MeshIterationStrategy. More...
 
struct  SharedSparsityBundle
 
class  Solver
 
class  SolverFactory
 
struct  SolverStats
 
struct  SolverStatsEntry
 
struct  SparsityView
 A view struct to allow easy read/write on all executors. More...
 

Typedefs

template<typename ValueType , typename IndexType >
using CSRMatrix = Matrix< ValueType, la::CsrSparsityPattern< IndexType > >
 
template<typename ValueType , typename IndexType >
using COOMatrix = Matrix< ValueType, la::CooSparsityPattern< IndexType > >
 

Functions

template<typename SparsityType >
std::pair< std::shared_ptr< const SparsityType >, std::shared_ptr< const FaceToMatrixAddress > > createSparsityPatternFaceToMatrixAddress (const UnstructuredMesh &mesh)
 
template<typename SparsityType >
std::shared_ptr< const SparsityType > createBoundarySparsityPattern (const UnstructuredMesh &mesh, const FaceToMatrixAddress &faceToMatrixAddress)
 
template<typename SparsityType >
std::shared_ptr< const SparsityType > createOffDiagonalSparsityPattern (const UnstructuredMesh &mesh, const FaceToMatrixAddress &faceToMatrixAddress)
 
template<typename SystemSparsityType , typename BoundarySparsityType >
SharedSparsityBundle< SystemSparsityType, BoundarySparsityType > readOrCreateSparsityBundle (const UnstructuredMesh &mesh)
 
template<typename ValueType , typename RHSValueType = ValueType, typename SystemMatrixType = CSRMatrix<ValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<ValueType, localIdx>>
LinearSystem< ValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > createEmptyLinearSystem (const UnstructuredMesh &mesh, std::shared_ptr< MeshIterationStrategy > strategy=std::make_shared< FaceBasedIterator >())
 
template<typename MatrixValueType , typename RHSValueType , typename SystemMatrixType , typename BoundaryMatrixType >
la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > removeBoundaryContributions (const la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > &lsIn)
 for testing purposes, this function reverses boundary contributions previously applied to the matrix diagonal and RHS for some operators (e.g., div).
 
template<typename ValueType , typename IndexType >
Vector< ValueType > upper (const CSRMatrix< ValueType, IndexType > &)
 extract the upper triangular of the matrix
 
Vector< scalarscaledInverseDiag (const CSRMatrix< Vec3, localIdx > &, const Vector< scalar > &)
 computes the inverted diagonal of a matrix and scales it by a, ie. a*D^-1
 
void scaledInverseDiag (const CSRMatrix< Vec3, localIdx > &mtx, const Vector< scalar > &a, Vector< scalar > &out)
 
Vector< scalarscaledInverseDiag (const CSRMatrix< Vec3, localIdx > &, const FaceToMatrixAddress &mi, const Vector< scalar > &)
 computes the inverted diagonal of a matrix and scales it by a, ie. a*D^-1
 
void scaledInverseDiag (const CSRMatrix< Vec3, localIdx > &mtx, const FaceToMatrixAddress &mi, const Vector< scalar > &a, Vector< scalar > &out)
 
Vector< scalarscaledInverseDiag (const CSRMatrix< scalar, localIdx > &, const FaceToMatrixAddress &mi, const Vector< scalar > &)
 scalar-matrix variant of scaledInverseDiag for the segregated vector-solve form
 
void scaledInverseDiag (const CSRMatrix< scalar, localIdx > &mtx, const FaceToMatrixAddress &mi, const Vector< scalar > &a, Vector< scalar > &out)
 
template<unsigned int I>
auto getComponent (const CSRMatrix< Vec3, localIdx > &in)
 
void negLUx (const CSRMatrix< Vec3, localIdx > &mtx, const Vector< Vec3 > &a, const Vector< Vec3 > &b, const Vector< scalar > &rAU, const Vector< scalar > &vol, Vector< Vec3 > &out)
 computes out = -(L+U) x
 
void scaledInvDiagNegLUx (const CSRMatrix< Vec3, localIdx > &mtx, const Vector< Vec3 > &a, const Vector< Vec3 > &b, const Vector< scalar > &vol, Vector< scalar > &rAU, Vector< Vec3 > &out)
 computes out = -(L+U) x
 
void scaledInvDiagNegLUx (const CSRMatrix< scalar, localIdx > &mtx, const Vector< Vec3 > &a, const Vector< Vec3 > &b, const Vector< scalar > &vol, Vector< scalar > &rAU, Vector< Vec3 > &out)
 scalar-matrix / Vec3-rhs variant of scaledInvDiagNegLUx
 
Vector< localIdxunpackColIdx (const Vector< localIdx > &in, const Vector< localIdx > &unpackedRowOffs, const Vector< localIdx > &packedRowOffs)
 
Vector< localIdxunpackRowOffs (const Vector< localIdx > &in)
 
Vector< scalarunpackVecValues (const Vector< Vec3 > &in)
 
void packVecValues (const Vector< scalar > &in, Vector< Vec3 > &out)
 
Vector< scalarunpackMtxValues (const Vector< Vec3 > &in, const Vector< localIdx > &rowOffs, const Vector< localIdx > &newRowOffs)
 
template<typename MatrixType , typename ValueType = scalar>
void computeResidual (const MatrixType &mtx, const Vector< ValueType > &b, const Vector< ValueType > &x, Vector< ValueType > &res)
 given a linear system consisting of A, b and x the operator computes the residual vector Ax-b
 
template<typename IndexType >
Vector< IndexType > rowsToRowOffs (const Vector< IndexType > &rows)
 given a set off row idx this function converts to rowOffsets
 

Typedef Documentation

◆ COOMatrix

template<typename ValueType , typename IndexType >
using NeoN::la::COOMatrix = typedef Matrix<ValueType, la::CooSparsityPattern<IndexType> >

Definition at line 260 of file matrix.hpp.

◆ CSRMatrix

template<typename ValueType , typename IndexType >
using NeoN::la::CSRMatrix = typedef Matrix<ValueType, la::CsrSparsityPattern<IndexType> >

Definition at line 257 of file matrix.hpp.

Function Documentation

◆ computeResidual()

template<typename MatrixType , typename ValueType = scalar>
void NeoN::la::computeResidual ( const MatrixType &  mtx,
const Vector< ValueType > &  b,
const Vector< ValueType > &  x,
Vector< ValueType > &  res 
)

given a linear system consisting of A, b and x the operator computes the residual vector Ax-b

Parameters
[in]mtx,thecorresponding matrix
[in]b,rhsvector b
[in]x,initialguess vector x
[out]

◆ createBoundarySparsityPattern()

template<typename SparsityType >
std::shared_ptr< const SparsityType > NeoN::la::createBoundarySparsityPattern ( const UnstructuredMesh mesh,
const FaceToMatrixAddress faceToMatrixAddress 
)

◆ createEmptyLinearSystem()

template<typename ValueType , typename RHSValueType = ValueType, typename SystemMatrixType = CSRMatrix<ValueType, localIdx>, typename BoundaryMatrixType = COOMatrix<ValueType, localIdx>>
LinearSystem< ValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > NeoN::la::createEmptyLinearSystem ( const UnstructuredMesh mesh,
std::shared_ptr< MeshIterationStrategy strategy = std::make_shared<FaceBasedIterator>() 
)

Definition at line 353 of file linearSystem.hpp.

◆ createOffDiagonalSparsityPattern()

template<typename SparsityType >
std::shared_ptr< const SparsityType > NeoN::la::createOffDiagonalSparsityPattern ( const UnstructuredMesh mesh,
const FaceToMatrixAddress faceToMatrixAddress 
)

◆ createSparsityPatternFaceToMatrixAddress()

template<typename SparsityType >
std::pair< std::shared_ptr< const SparsityType >, std::shared_ptr< const FaceToMatrixAddress > > NeoN::la::createSparsityPatternFaceToMatrixAddress ( const UnstructuredMesh mesh)

◆ getComponent()

template<unsigned int I>
auto NeoN::la::getComponent ( const CSRMatrix< Vec3, localIdx > &  in)

Definition at line 309 of file matrix.hpp.

◆ negLUx()

void NeoN::la::negLUx ( const CSRMatrix< Vec3, localIdx > &  mtx,
const Vector< Vec3 > &  a,
const Vector< Vec3 > &  b,
const Vector< scalar > &  rAU,
const Vector< scalar > &  vol,
Vector< Vec3 > &  out 
)

computes out = -(L+U) x

@notes explicitly sets out values to zero

◆ packVecValues()

void NeoN::la::packVecValues ( const Vector< scalar > &  in,
Vector< Vec3 > &  out 
)

◆ readOrCreateSparsityBundle()

template<typename SystemSparsityType , typename BoundarySparsityType >
SharedSparsityBundle< SystemSparsityType, BoundarySparsityType > NeoN::la::readOrCreateSparsityBundle ( const UnstructuredMesh mesh)

◆ removeBoundaryContributions()

template<typename MatrixValueType , typename RHSValueType , typename SystemMatrixType , typename BoundaryMatrixType >
la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > NeoN::la::removeBoundaryContributions ( const la::LinearSystem< MatrixValueType, RHSValueType, SystemMatrixType, BoundaryMatrixType > &  lsIn)
inline

for testing purposes, this function reverses boundary contributions previously applied to the matrix diagonal and RHS for some operators (e.g., div).

Note
templated on the full LinearSystem parameter set so it also accepts the segregated vector-solve form (scalar matrix, Vec3 rhs): the scalar boundary diagonal is reversed on the scalar matrix while the rhs reversal uses the field (RHS) value type.

Definition at line 448 of file linearSystem.hpp.

◆ rowsToRowOffs()

template<typename IndexType >
Vector< IndexType > NeoN::la::rowsToRowOffs ( const Vector< IndexType > &  rows)

given a set off row idx this function converts to rowOffsets

◆ scaledInvDiagNegLUx() [1/2]

void NeoN::la::scaledInvDiagNegLUx ( const CSRMatrix< scalar, localIdx > &  mtx,
const Vector< Vec3 > &  a,
const Vector< Vec3 > &  b,
const Vector< scalar > &  vol,
Vector< scalar > &  rAU,
Vector< Vec3 > &  out 
)

scalar-matrix / Vec3-rhs variant of scaledInvDiagNegLUx

Mirrors the Vec3-matrix overload but for a scalar coefficient matrix assembled from a vector field (segregated vector-solve form). The scalar diagonal/off-diagonal entries scale all three rhs components equally.

@notes explicitly sets out values to zero

◆ scaledInvDiagNegLUx() [2/2]

void NeoN::la::scaledInvDiagNegLUx ( const CSRMatrix< Vec3, localIdx > &  mtx,
const Vector< Vec3 > &  a,
const Vector< Vec3 > &  b,
const Vector< scalar > &  vol,
Vector< scalar > &  rAU,
Vector< Vec3 > &  out 
)

computes out = -(L+U) x

@notes explicitly sets out values to zero

◆ scaledInverseDiag() [1/6]

Vector< scalar > NeoN::la::scaledInverseDiag ( const CSRMatrix< scalar, localIdx > &  ,
const FaceToMatrixAddress mi,
const Vector< scalar > &   
)

scalar-matrix variant of scaledInverseDiag for the segregated vector-solve form

Note
used when a vector field is assembled into a scalar coefficient matrix; the scalar diagonal is shared across all field components, so no per-component selection is needed

◆ scaledInverseDiag() [2/6]

void NeoN::la::scaledInverseDiag ( const CSRMatrix< scalar, localIdx > &  mtx,
const FaceToMatrixAddress mi,
const Vector< scalar > &  a,
Vector< scalar > &  out 
)

◆ scaledInverseDiag() [3/6]

Vector< scalar > NeoN::la::scaledInverseDiag ( const CSRMatrix< Vec3, localIdx > &  ,
const FaceToMatrixAddress mi,
const Vector< scalar > &   
)

computes the inverted diagonal of a matrix and scales it by a, ie. a*D^-1

Note
this function is a specialized function for CSR<Vec3> matrices assuming all diagonal entries are identical

◆ scaledInverseDiag() [4/6]

Vector< scalar > NeoN::la::scaledInverseDiag ( const CSRMatrix< Vec3, localIdx > &  ,
const Vector< scalar > &   
)

computes the inverted diagonal of a matrix and scales it by a, ie. a*D^-1

Note
this function is a specialized function for CSR<Vec3> matrices assuming all diagonal entries are identical

◆ scaledInverseDiag() [5/6]

void NeoN::la::scaledInverseDiag ( const CSRMatrix< Vec3, localIdx > &  mtx,
const FaceToMatrixAddress mi,
const Vector< scalar > &  a,
Vector< scalar > &  out 
)

◆ scaledInverseDiag() [6/6]

void NeoN::la::scaledInverseDiag ( const CSRMatrix< Vec3, localIdx > &  mtx,
const Vector< scalar > &  a,
Vector< scalar > &  out 
)

◆ unpackColIdx()

Vector< localIdx > NeoN::la::unpackColIdx ( const Vector< localIdx > &  in,
const Vector< localIdx > &  unpackedRowOffs,
const Vector< localIdx > &  packedRowOffs 
)

◆ unpackMtxValues()

Vector< scalar > NeoN::la::unpackMtxValues ( const Vector< Vec3 > &  in,
const Vector< localIdx > &  rowOffs,
const Vector< localIdx > &  newRowOffs 
)

◆ unpackRowOffs()

Vector< localIdx > NeoN::la::unpackRowOffs ( const Vector< localIdx > &  in)

◆ unpackVecValues()

Vector< scalar > NeoN::la::unpackVecValues ( const Vector< Vec3 > &  in)

◆ upper()

template<typename ValueType , typename IndexType >
Vector< ValueType > NeoN::la::upper ( const CSRMatrix< ValueType, IndexType > &  )

extract the upper triangular of the matrix

Note
this function is meant for testing purposes, it will recompute upper offsets