KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
List of all members
Kratos::CsrMatrix< TDataType, TIndexType > Class Template Referencefinal

This class implements "serial" CSR matrix, including capabilities for FEM assembly. More...

#include <csr_matrix.h>

Collaboration diagram for Kratos::CsrMatrix< TDataType, TIndexType >:

Public Member Functions

Life Cycle
 CsrMatrix ()
 
 CsrMatrix (const DataCommunicator &rComm)
 
template<class TGraphType >
 CsrMatrix (const TGraphType &rSparseGraph)
 constructor. More...
 
 CsrMatrix (const MatrixMapType &matrix_map)
 
 CsrMatrix (const CsrMatrix< TDataType, TIndexType > &rOtherMatrix)
 
 CsrMatrix (CsrMatrix< TDataType, TIndexType > &&rOtherMatrix)
 
 ~CsrMatrix ()
 Destructor. More...
 
CsrMatrix & operator= (CsrMatrix const &rOtherMatrix)=delete
 Assignment operator. More...
 
CsrMatrix & operator= (CsrMatrix &&rOtherMatrix)
 
Operators
void Clear ()
 
const DataCommunicator & GetComm () const
 
const DataCommunicator * pGetComm () const
 
void SetValue (const TDataType value)
 
IndexType size1 () const
 
IndexType size2 () const
 
IndexType nnz () const
 
bool IsOwnerOfData () const
 
void SetIsOwnerOfData (bool IsOwner)
 
Kratos::span< IndexType > & index1_data ()
 
Kratos::span< IndexType > & index2_data ()
 
Kratos::span< TDataType > & value_data ()
 
const Kratos::span< IndexType > & index1_data () const
 
const Kratos::span< IndexType > & index2_data () const
 
const Kratos::span< TDataType > & value_data () const
 
void SetColSize (IndexType Ncols)
 
void SetRowSize (IndexType Nrows)
 
void ComputeColSize ()
 
void AssignIndex1Data (TIndexType *pExternalData, TIndexType DataSize)
 
void AssignIndex2Data (TIndexType *pExternalData, TIndexType DataSize)
 
void AssignValueData (TDataType *pExternalData, TIndexType DataSize)
 
void ResizeIndex1Data (TIndexType DataSize)
 
void ResizeIndex2Data (TIndexType DataSize)
 
void ResizeValueData (TIndexType DataSize)
 
void CheckColSize ()
 
TDataType & operator() (IndexType I, IndexType J)
 
const TDataType & operator() (IndexType I, IndexType J) const
 
bool Has (IndexType I, IndexType J) const
 
template<class TInputVectorType , class TOutputVectorType >
void SpMV (const TInputVectorType &x, TOutputVectorType &y) const
 
template<class TInputVectorType , class TOutputVectorType >
void SpMV (const TDataType alpha, const TInputVectorType &x, const TDataType beta, TOutputVectorType &y) const
 
template<class TInputVectorType , class TOutputVectorType >
void TransposeSpMV (const TInputVectorType &x, TOutputVectorType &y) const
 
template<class TInputVectorType , class TOutputVectorType >
void TransposeSpMV (const TDataType alpha, const TInputVectorType &x, const TDataType beta, TOutputVectorType &y) const
 
TDataType NormFrobenius () const
 
Operations
void reserve (IndexType NRows, IndexType nnz)
 
MatrixMapType ToMap () const
 
void BeginAssemble ()
 
void FinalizeAssemble ()
 
template<class TMatrixType , class TIndexVectorType >
void Assemble (const TMatrixType &rMatrixInput, const TIndexVectorType &EquationId)
 
template<class TMatrixType , class TIndexVectorType >
void Assemble (const TMatrixType &rMatrixInput, const TIndexVectorType &RowEquationId, const TIndexVectorType &ColEquationId)
 
void AssembleEntry (const TDataType Value, const IndexType GlobalI, const IndexType GlobalJ)
 
template<class TVectorType1 , class TVectorType2 = TVectorType1>
void ApplyHomogeneousDirichlet (const TVectorType1 &rFreeDofsVector, const TDataType DiagonalValue, TVectorType2 &rRHS)
 
Input and output
std::string Info () const
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const
 Print object's data. More...
 

Protected Member Functions

Protected Operators
template<class TVectorType >
IndexType BinarySearch (const TVectorType &arr, IndexType l, IndexType r, IndexType x) const
 

Type Definitions

typedef TIndexType IndexType
 
typedef std::unordered_map< std::pair< IndexType, IndexType >, double, PairHasher< IndexType, IndexType >, PairComparor< IndexType, IndexType > > MatrixMapType
 
 KRATOS_CLASS_POINTER_DEFINITION (CsrMatrix)
 Pointer definition of CsrMatrix. More...
 

Private Operators

class Serializer
 

Detailed Description

template<class TDataType = double, class TIndexType = std::size_t>
class Kratos::CsrMatrix< TDataType, TIndexType >

This class implements "serial" CSR matrix, including capabilities for FEM assembly.

Member Typedef Documentation

◆ IndexType

template<class TDataType = double, class TIndexType = std::size_t>
typedef TIndexType Kratos::CsrMatrix< TDataType, TIndexType >::IndexType

◆ MatrixMapType

template<class TDataType = double, class TIndexType = std::size_t>
typedef std::unordered_map<std::pair<IndexType, IndexType>, double, PairHasher<IndexType, IndexType>, PairComparor<IndexType, IndexType> > Kratos::CsrMatrix< TDataType, TIndexType >::MatrixMapType

Constructor & Destructor Documentation

◆ CsrMatrix() [1/6]

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::CsrMatrix< TDataType, TIndexType >::CsrMatrix ( )
inline

◆ CsrMatrix() [2/6]

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::CsrMatrix< TDataType, TIndexType >::CsrMatrix ( const DataCommunicator &  rComm)
inline

◆ CsrMatrix() [3/6]

template<class TDataType = double, class TIndexType = std::size_t>
template<class TGraphType >
Kratos::CsrMatrix< TDataType, TIndexType >::CsrMatrix ( const TGraphType &  rSparseGraph)
inline

constructor.

◆ CsrMatrix() [4/6]

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::CsrMatrix< TDataType, TIndexType >::CsrMatrix ( const MatrixMapType &  matrix_map)
inline

◆ CsrMatrix() [5/6]

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::CsrMatrix< TDataType, TIndexType >::CsrMatrix ( const CsrMatrix< TDataType, TIndexType > &  rOtherMatrix)
inlineexplicit

◆ CsrMatrix() [6/6]

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::CsrMatrix< TDataType, TIndexType >::CsrMatrix ( CsrMatrix< TDataType, TIndexType > &&  rOtherMatrix)
inline

◆ ~CsrMatrix()

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::CsrMatrix< TDataType, TIndexType >::~CsrMatrix ( )
inline

Destructor.

Member Function Documentation

◆ ApplyHomogeneousDirichlet()

template<class TDataType = double, class TIndexType = std::size_t>
template<class TVectorType1 , class TVectorType2 = TVectorType1>
void Kratos::CsrMatrix< TDataType, TIndexType >::ApplyHomogeneousDirichlet ( const TVectorType1 &  rFreeDofsVector,
const TDataType  DiagonalValue,
TVectorType2 &  rRHS 
)
inline

◆ Assemble() [1/2]

template<class TDataType = double, class TIndexType = std::size_t>
template<class TMatrixType , class TIndexVectorType >
void Kratos::CsrMatrix< TDataType, TIndexType >::Assemble ( const TMatrixType &  rMatrixInput,
const TIndexVectorType &  EquationId 
)
inline

◆ Assemble() [2/2]

template<class TDataType = double, class TIndexType = std::size_t>
template<class TMatrixType , class TIndexVectorType >
void Kratos::CsrMatrix< TDataType, TIndexType >::Assemble ( const TMatrixType &  rMatrixInput,
const TIndexVectorType &  RowEquationId,
const TIndexVectorType &  ColEquationId 
)
inline

◆ AssembleEntry()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::AssembleEntry ( const TDataType  Value,
const IndexType  GlobalI,
const IndexType  GlobalJ 
)
inline

◆ AssignIndex1Data()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::AssignIndex1Data ( TIndexType *  pExternalData,
TIndexType  DataSize 
)
inline

◆ AssignIndex2Data()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::AssignIndex2Data ( TIndexType *  pExternalData,
TIndexType  DataSize 
)
inline

◆ AssignValueData()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::AssignValueData ( TDataType *  pExternalData,
TIndexType  DataSize 
)
inline

◆ BeginAssemble()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::BeginAssemble ( )
inline

◆ BinarySearch()

template<class TDataType = double, class TIndexType = std::size_t>
template<class TVectorType >
IndexType Kratos::CsrMatrix< TDataType, TIndexType >::BinarySearch ( const TVectorType &  arr,
IndexType  l,
IndexType  r,
IndexType  x 
) const
inlineprotected

◆ CheckColSize()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::CheckColSize ( )
inline

◆ Clear()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::Clear ( )
inline

◆ ComputeColSize()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::ComputeColSize ( )
inline

◆ FinalizeAssemble()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::FinalizeAssemble ( )
inline

◆ GetComm()

template<class TDataType = double, class TIndexType = std::size_t>
const DataCommunicator& Kratos::CsrMatrix< TDataType, TIndexType >::GetComm ( ) const
inline

◆ Has()

template<class TDataType = double, class TIndexType = std::size_t>
bool Kratos::CsrMatrix< TDataType, TIndexType >::Has ( IndexType  I,
IndexType  J 
) const
inline

◆ index1_data() [1/2]

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::span<IndexType>& Kratos::CsrMatrix< TDataType, TIndexType >::index1_data ( )
inline

◆ index1_data() [2/2]

template<class TDataType = double, class TIndexType = std::size_t>
const Kratos::span<IndexType>& Kratos::CsrMatrix< TDataType, TIndexType >::index1_data ( ) const
inline

◆ index2_data() [1/2]

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::span<IndexType>& Kratos::CsrMatrix< TDataType, TIndexType >::index2_data ( )
inline

◆ index2_data() [2/2]

template<class TDataType = double, class TIndexType = std::size_t>
const Kratos::span<IndexType>& Kratos::CsrMatrix< TDataType, TIndexType >::index2_data ( ) const
inline

◆ Info()

template<class TDataType = double, class TIndexType = std::size_t>
std::string Kratos::CsrMatrix< TDataType, TIndexType >::Info ( ) const
inline

Turn back information as a string.

◆ IsOwnerOfData()

template<class TDataType = double, class TIndexType = std::size_t>
bool Kratos::CsrMatrix< TDataType, TIndexType >::IsOwnerOfData ( ) const
inline

◆ KRATOS_CLASS_POINTER_DEFINITION()

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::CsrMatrix< TDataType, TIndexType >::KRATOS_CLASS_POINTER_DEFINITION ( CsrMatrix< TDataType, TIndexType >  )

Pointer definition of CsrMatrix.

◆ nnz()

template<class TDataType = double, class TIndexType = std::size_t>
IndexType Kratos::CsrMatrix< TDataType, TIndexType >::nnz ( ) const
inline

◆ NormFrobenius()

template<class TDataType = double, class TIndexType = std::size_t>
TDataType Kratos::CsrMatrix< TDataType, TIndexType >::NormFrobenius ( ) const
inline

◆ operator()() [1/2]

template<class TDataType = double, class TIndexType = std::size_t>
TDataType& Kratos::CsrMatrix< TDataType, TIndexType >::operator() ( IndexType  I,
IndexType  J 
)
inline

◆ operator()() [2/2]

template<class TDataType = double, class TIndexType = std::size_t>
const TDataType& Kratos::CsrMatrix< TDataType, TIndexType >::operator() ( IndexType  I,
IndexType  J 
) const
inline

◆ operator=() [1/2]

template<class TDataType = double, class TIndexType = std::size_t>
CsrMatrix& Kratos::CsrMatrix< TDataType, TIndexType >::operator= ( CsrMatrix< TDataType, TIndexType > &&  rOtherMatrix)
inline

◆ operator=() [2/2]

template<class TDataType = double, class TIndexType = std::size_t>
CsrMatrix& Kratos::CsrMatrix< TDataType, TIndexType >::operator= ( CsrMatrix< TDataType, TIndexType > const &  rOtherMatrix)
delete

Assignment operator.

◆ pGetComm()

template<class TDataType = double, class TIndexType = std::size_t>
const DataCommunicator* Kratos::CsrMatrix< TDataType, TIndexType >::pGetComm ( ) const
inline

◆ PrintData()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::PrintData ( std::ostream &  rOStream) const
inline

Print object's data.

◆ PrintInfo()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::PrintInfo ( std::ostream &  rOStream) const
inline

Print information about this object.

◆ reserve()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::reserve ( IndexType  NRows,
IndexType  nnz 
)
inline

◆ ResizeIndex1Data()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::ResizeIndex1Data ( TIndexType  DataSize)
inline

◆ ResizeIndex2Data()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::ResizeIndex2Data ( TIndexType  DataSize)
inline

◆ ResizeValueData()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::ResizeValueData ( TIndexType  DataSize)
inline

◆ SetColSize()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::SetColSize ( IndexType  Ncols)
inline

◆ SetIsOwnerOfData()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::SetIsOwnerOfData ( bool  IsOwner)
inline

◆ SetRowSize()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::SetRowSize ( IndexType  Nrows)
inline

◆ SetValue()

template<class TDataType = double, class TIndexType = std::size_t>
void Kratos::CsrMatrix< TDataType, TIndexType >::SetValue ( const TDataType  value)
inline

◆ size1()

template<class TDataType = double, class TIndexType = std::size_t>
IndexType Kratos::CsrMatrix< TDataType, TIndexType >::size1 ( ) const
inline

◆ size2()

template<class TDataType = double, class TIndexType = std::size_t>
IndexType Kratos::CsrMatrix< TDataType, TIndexType >::size2 ( ) const
inline

◆ SpMV() [1/2]

template<class TDataType = double, class TIndexType = std::size_t>
template<class TInputVectorType , class TOutputVectorType >
void Kratos::CsrMatrix< TDataType, TIndexType >::SpMV ( const TDataType  alpha,
const TInputVectorType &  x,
const TDataType  beta,
TOutputVectorType &  y 
) const
inline

◆ SpMV() [2/2]

template<class TDataType = double, class TIndexType = std::size_t>
template<class TInputVectorType , class TOutputVectorType >
void Kratos::CsrMatrix< TDataType, TIndexType >::SpMV ( const TInputVectorType &  x,
TOutputVectorType &  y 
) const
inline

◆ ToMap()

template<class TDataType = double, class TIndexType = std::size_t>
MatrixMapType Kratos::CsrMatrix< TDataType, TIndexType >::ToMap ( ) const
inline

◆ TransposeSpMV() [1/2]

template<class TDataType = double, class TIndexType = std::size_t>
template<class TInputVectorType , class TOutputVectorType >
void Kratos::CsrMatrix< TDataType, TIndexType >::TransposeSpMV ( const TDataType  alpha,
const TInputVectorType &  x,
const TDataType  beta,
TOutputVectorType &  y 
) const
inline

◆ TransposeSpMV() [2/2]

template<class TDataType = double, class TIndexType = std::size_t>
template<class TInputVectorType , class TOutputVectorType >
void Kratos::CsrMatrix< TDataType, TIndexType >::TransposeSpMV ( const TInputVectorType &  x,
TOutputVectorType &  y 
) const
inline

◆ value_data() [1/2]

template<class TDataType = double, class TIndexType = std::size_t>
Kratos::span<TDataType>& Kratos::CsrMatrix< TDataType, TIndexType >::value_data ( )
inline

◆ value_data() [2/2]

template<class TDataType = double, class TIndexType = std::size_t>
const Kratos::span<TDataType>& Kratos::CsrMatrix< TDataType, TIndexType >::value_data ( ) const
inline

Friends And Related Function Documentation

◆ Serializer

template<class TDataType = double, class TIndexType = std::size_t>
friend class Serializer
friend

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