FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ > Class Template Reference

Global Matrix wrapper class template. More...

#include <matrix.hpp>

Public Types

typedef ColMirror_ ColMirrorType
 
template<typename LocalMatrix2_ , typename RowMirror2_ = RowMirror_, typename ColMirror2_ = ColMirror_>
using ContainerType = Matrix< LocalMatrix2_, RowMirror2_, ColMirror2_ >
 Our 'base' class type. More...
 
template<typename DataType2_ , typename IndexType2_ >
using ContainerTypeByMDI = Matrix< typename LocalMatrix_::template ContainerType< DataType2_, IndexType2_ >, typename RowMirror_::template MirrorType< DataType2_, IndexType2_ >, typename ColMirror_::template MirrorType< DataType2_, IndexType2_ > >
 this typedef lets you create a matrix container with new Datatype and Index types More...
 
typedef LocalMatrix_::DataType DataType
 
typedef Gate< LocalVectorTypeR, ColMirror_ > GateColType
 
typedef Gate< LocalVectorTypeL, RowMirror_ > GateRowType
 
typedef LocalMatrix_::IndexType IndexType
 
typedef LocalMatrix_ LocalMatrixType
 
typedef LocalMatrix_::VectorTypeL LocalVectorTypeL
 
typedef LocalMatrix_::VectorTypeR LocalVectorTypeR
 
typedef RowMirror_ RowMirrorType
 
typedef Vector< LocalVectorTypeL, RowMirror_ > VectorTypeL
 
typedef Vector< LocalVectorTypeR, ColMirror_ > VectorTypeR
 

Public Member Functions

 Matrix ()
 standard constructor More...
 
template<typename... Args_>
 Matrix (GateRowType *row_gate, GateColType *col_gate, Args_ &&... args)
 Forwarding constructor. More...
 
void apply (VectorTypeL &r, const VectorTypeR &x) const
 Performs a matrix-vector multiplication: r <- A*x. More...
 
void apply (VectorTypeL &r, const VectorTypeR &x, const VectorTypeL &y, const DataType alpha=DataType(1)) const
 Performs a matrix-vector multiplication: r <- y + alpha*A*x. More...
 
auto apply_async (VectorTypeL &r, const VectorTypeR &x) const -> decltype(r.sync_0_async())
 Performs a matrix-vector multiplication: r <- A*x. More...
 
auto apply_async (VectorTypeL &r, const VectorTypeR &x, const VectorTypeL &y, const DataType alpha=DataType(1)) const -> decltype(r.sync_0_async())
 Performs a matrix-vector multiplication: r <- y + alpha*A*x. More...
 
void apply_transposed (VectorTypeR &r, const VectorTypeL &x) const
 Performs a matrix-vector multiplication: r <- A^T*x. More...
 
void apply_transposed (VectorTypeR &r, const VectorTypeL &x, const VectorTypeR &y, const DataType alpha=DataType(1)) const
 Performs a matrix-vector multiplication: r <- y + alpha*A^T*x. More...
 
auto apply_transposed_async (VectorTypeR &r, const VectorTypeL &x) const -> decltype(r.sync_0_async())
 Performs a matrix-vector multiplication: r <- A^T*x. More...
 
auto apply_transposed_async (VectorTypeR &r, const VectorTypeL &x, const VectorTypeR &y, const DataType alpha=DataType(1)) const -> decltype(r.sync_0_async())
 Performs a matrix-vector multiplication: r <- y + alpha*A^T*x. More...
 
std::size_t bytes () const
 Returns the total amount of bytes allocated. More...
 
Matrix clone (LAFEM::CloneMode mode=LAFEM::CloneMode::Weak) const
 Creates and returns a clone of this global matrix. More...
 
template<LAFEM::Perspective perspective_ = LAFEM::Perspective::pod>
Index columns () const
 Gets the total number of columns in this distributed matrix. More...
 
template<typename OtherGlobalMatrix_ >
void convert (GateRowType *row_gate, GateColType *col_gate, const OtherGlobalMatrix_ &other)
 
LocalMatrix_ convert_to_1 () const
 Computes and returns the type-1 conversion of this matrix as a local matrix. More...
 
void convert_to_1 (LocalMatrix_ &matrix_sync_1, bool full_copy=true) const
 Computes and returns the type-1 conversion of this matrix as a local matrix. More...
 
VectorTypeL create_vector_l () const
 Creates and returns a new L-compatible global vector object. More...
 
VectorTypeR create_vector_r () const
 Creates and returns a new R-compatible global vector object. More...
 
void extract_diag (VectorTypeL &diag, bool sync=true) const
 Extracts the main diagonal of the matrix as a vector. More...
 
std::uint64_t get_checkpoint_size (LAFEM::SerialConfig &config)
 Calculate size. More...
 
const GateColTypeget_col_gate () const
 Returns a const pointer to the internal column gate of the matrix. More...
 
const Dist::Commget_comm () const
 Returns a const pointer to the internal communicator of the gates of the matrix. More...
 
const GateRowTypeget_row_gate () const
 Returns a const pointer to the internal row gate of the matrix. More...
 
LocalMatrix_ & local ()
 Returns a reference to the internal local LAFEM matrix object. More...
 
const LocalMatrix_ & local () const
 Returns a const reference to the internal local LAFEM matrix object. More...
 
VectorTypeL lump_rows (bool sync=true) const
 Computes and returns the lumped rows of the matrix as a vector. More...
 
void lump_rows (VectorTypeL &lump, bool sync=true) const
 Computes the lumped rows of the matrix as a vector. More...
 
void restore_from_checkpoint_data (std::vector< char > &data)
 Extract object from checkpoint. More...
 
template<LAFEM::Perspective perspective_ = LAFEM::Perspective::pod>
Index rows () const
 Returns the total number of rows in this distributed matrix. More...
 
std::uint64_t set_checkpoint_data (std::vector< char > &data, LAFEM::SerialConfig &config)
 
template<LAFEM::Perspective perspective_ = LAFEM::Perspective::pod>
Index used_elements () const
 Returns the total number of non-zeros in this distributed matrix. More...
 

Static Public Attributes

static constexpr bool is_global = true
 this is a global matrix class More...
 
static constexpr bool is_local = false
 this is not a local matrix class More...
 

Protected Attributes

GateColType_col_gate
 a pointer to the column gate responsible for synchronization More...
 
LocalMatrix_ _matrix
 the internal local matrix object More...
 
GateRowType_row_gate
 a pointer to the row gate responsible for synchronization More...
 

Detailed Description

template<typename LocalMatrix_, typename RowMirror_, typename ColMirror_>
class FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >

Global Matrix wrapper class template.

This class implements a wrapper that contains a LAFEM matrix as its core data object and provides the necessary synchronization functions required in an MPI-parallel simulation based on the overlapping domain decomposition approach. Effectively, this class only couples a local LAFEM matrix with its corresponding pair of row/column Global::Gate objects, which are required to define the compatible L/R vector types, which then take care of the actual synchronization dirty work.

Template Parameters
LocalVector_The type of the local matrix container; may be any valid combination of LAFEM (meta-)matrix types
RowMirror_The type of the row mirror; must be compatible to the L-vector type of the local matrix
ColMirror_The type of the column mirror; must be compatible to the R-vector type of the local matrix
Author
Peter Zajac

Definition at line 39 of file matrix.hpp.

Member Typedef Documentation

◆ ColMirrorType

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef ColMirror_ FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::ColMirrorType

Definition at line 44 of file matrix.hpp.

◆ ContainerType

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
template<typename LocalMatrix2_ , typename RowMirror2_ = RowMirror_, typename ColMirror2_ = ColMirror_>
using FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::ContainerType = Matrix<LocalMatrix2_, RowMirror2_, ColMirror2_>

Our 'base' class type.

Definition at line 60 of file matrix.hpp.

◆ ContainerTypeByMDI

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
template<typename DataType2_ , typename IndexType2_ >
using FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::ContainerTypeByMDI = Matrix< typename LocalMatrix_::template ContainerType<DataType2_, IndexType2_>, typename RowMirror_::template MirrorType<DataType2_, IndexType2_>, typename ColMirror_::template MirrorType<DataType2_, IndexType2_> >

this typedef lets you create a matrix container with new Datatype and Index types

Definition at line 64 of file matrix.hpp.

◆ DataType

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef LocalMatrix_::DataType FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::DataType

Definition at line 46 of file matrix.hpp.

◆ GateColType

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef Gate<LocalVectorTypeR, ColMirror_> FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::GateColType

Definition at line 56 of file matrix.hpp.

◆ GateRowType

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef Gate<LocalVectorTypeL, RowMirror_> FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::GateRowType

Definition at line 55 of file matrix.hpp.

◆ IndexType

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef LocalMatrix_::IndexType FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::IndexType

Definition at line 47 of file matrix.hpp.

◆ LocalMatrixType

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef LocalMatrix_ FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::LocalMatrixType

Definition at line 42 of file matrix.hpp.

◆ LocalVectorTypeL

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef LocalMatrix_::VectorTypeL FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::LocalVectorTypeL

Definition at line 49 of file matrix.hpp.

◆ LocalVectorTypeR

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef LocalMatrix_::VectorTypeR FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::LocalVectorTypeR

Definition at line 50 of file matrix.hpp.

◆ RowMirrorType

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef RowMirror_ FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::RowMirrorType

Definition at line 43 of file matrix.hpp.

◆ VectorTypeL

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef Vector<LocalVectorTypeL, RowMirror_> FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::VectorTypeL

Definition at line 52 of file matrix.hpp.

◆ VectorTypeR

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
typedef Vector<LocalVectorTypeR, ColMirror_> FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::VectorTypeR

Definition at line 53 of file matrix.hpp.

Constructor & Destructor Documentation

◆ Matrix() [1/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::Matrix ( )
inline

standard constructor

Definition at line 84 of file matrix.hpp.

Referenced by FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::clone().

◆ Matrix() [2/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
template<typename... Args_>
FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::Matrix ( GateRowType row_gate,
GateColType col_gate,
Args_ &&...  args 
)
inlineexplicit

Forwarding constructor.

Parameters
[in]row_gateA resident pointer to the row gate to be used for synchronization
[in]col_gateA resident pointer to the column gate to be used for synchronization
[in]argsThe arguments that are to be passed to the local matrix object constructor
Attention
The two gates may be different objects, which is e.g. required for matrices which are defined by different test- and trial-spaces in the finite element context, but they always must use the same internal communicator!

Definition at line 109 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_col_gate, FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_row_gate, FEAT::Global::Gate< LocalVector_, Mirror_ >::get_comm(), and XASSERT.

Member Function Documentation

◆ apply() [1/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::apply ( VectorTypeL r,
const VectorTypeR x 
) const
inline

Performs a matrix-vector multiplication: r <- A*x.

Parameters
[in,out]rA transient reference to the vector that should receive the result of the matrix-vector product. Must be allocated to the correct sizes and must have a valid gate assigned, but its numerical contents upon entry are ignored. Must not be the same object as x.
[in]xA transient reference to the vector that is to be multiplied by this matrix. Must not be the same object as r.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.

Definition at line 311 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Vector< LocalVector_, Mirror_ >::local(), and FEAT::Global::Vector< LocalVector_, Mirror_ >::sync_0().

◆ apply() [2/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::apply ( VectorTypeL r,
const VectorTypeR x,
const VectorTypeL y,
const DataType  alpha = DataType(1) 
) const
inline

Performs a matrix-vector multiplication: r <- y + alpha*A*x.

Parameters
[in,out]rA transient reference to the vector that should receive the result of the matrix-vector product. Must be allocated to the correct sizes and must have a valid gate assigned, but its numerical contents upon entry are ignored. Must not be the same object as x, but it may be the same object as y.
[in]xA transient reference to the vector that is to be multiplied by this matrix. Must not be the same object as r.
[in]yA transient reference to the vector that is to be added onto the result of the product. May be the same object as r.
[in]alphaA scaling factor for the matrix-vector product A*x.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.

Definition at line 407 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Vector< LocalVector_, Mirror_ >::copy(), FEAT::Global::Vector< LocalVector_, Mirror_ >::from_1_to_0(), FEAT::Global::Vector< LocalVector_, Mirror_ >::local(), and FEAT::Global::Vector< LocalVector_, Mirror_ >::sync_0().

◆ apply_async() [1/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
auto FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::apply_async ( VectorTypeL r,
const VectorTypeR x 
) const -> decltype(r.sync_0_async())
inline

Performs a matrix-vector multiplication: r <- A*x.

Parameters
[in,out]rA transient reference to the vector that should receive the result of the matrix-vector product. Must be allocated to the correct sizes and must have a valid gate assigned, but its numerical contents upon entry are ignored. Must not be the same object as x.
[in]xA transient reference to the vector that is to be multiplied by this matrix. Must not be the same object as r.
Returns
A SynchVectorTicket object that waits for the operation to complete.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.

Definition at line 355 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix.

◆ apply_async() [2/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
auto FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::apply_async ( VectorTypeL r,
const VectorTypeR x,
const VectorTypeL y,
const DataType  alpha = DataType(1) 
) const -> decltype(r.sync_0_async())
inline

Performs a matrix-vector multiplication: r <- y + alpha*A*x.

Parameters
[in,out]rA transient reference to the vector that should receive the result of the matrix-vector product. Must be allocated to the correct sizes and must have a valid gate assigned, but its numerical contents upon entry are ignored. Must not be the same object as x, but it may be the same object as y.
[in]xA transient reference to the vector that is to be multiplied by this matrix. Must not be the same object as r.
[in]yA transient reference to the vector that is to be added onto the result of the product. May be the same object as r.
[in]alphaA scaling factor for the matrix-vector product A*x.
Returns
A SynchVectorTicket object that waits for the operation to complete.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.

Definition at line 485 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Vector< LocalVector_, Mirror_ >::copy(), FEAT::Global::Vector< LocalVector_, Mirror_ >::from_1_to_0(), FEAT::Global::Vector< LocalVector_, Mirror_ >::local(), and FEAT::Global::Vector< LocalVector_, Mirror_ >::sync_0_async().

◆ apply_transposed() [1/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::apply_transposed ( VectorTypeR r,
const VectorTypeL x 
) const
inline

Performs a matrix-vector multiplication: r <- A^T*x.

Parameters
[in,out]rA transient reference to the vector that should receive the result of the matrix-vector product. Must be allocated to the correct sizes and must have a valid gate assigned, but its numerical contents upon entry are ignored. Must not be the same object as x.
[in]xA transient reference to the vector that is to be multiplied by this matrix. Must not be the same object as r.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.

Definition at line 332 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Vector< LocalVector_, Mirror_ >::local(), and FEAT::Global::Vector< LocalVector_, Mirror_ >::sync_0().

◆ apply_transposed() [2/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::apply_transposed ( VectorTypeR r,
const VectorTypeL x,
const VectorTypeR y,
const DataType  alpha = DataType(1) 
) const
inline

Performs a matrix-vector multiplication: r <- y + alpha*A^T*x.

Parameters
[in,out]rA transient reference to the vector that should receive the result of the matrix-vector product. Must be allocated to the correct sizes and must have a valid gate assigned, but its numerical contents upon entry are ignored. Must not be the same object as x, but it may be the same object as y.
[in]xA transient reference to the vector that is to be multiplied by this matrix. Must not be the same object as r.
[in]yA transient reference to the vector that is to be added onto the result of the product. May be the same object as r.
[in]alphaA scaling factor for the matrix-vector product A*x.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.

Definition at line 445 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Vector< LocalVector_, Mirror_ >::copy(), FEAT::Global::Vector< LocalVector_, Mirror_ >::from_1_to_0(), FEAT::Global::Vector< LocalVector_, Mirror_ >::local(), and FEAT::Global::Vector< LocalVector_, Mirror_ >::sync_0().

◆ apply_transposed_async() [1/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
auto FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::apply_transposed_async ( VectorTypeR r,
const VectorTypeL x 
) const -> decltype(r.sync_0_async())
inline

Performs a matrix-vector multiplication: r <- A^T*x.

Parameters
[in,out]rA transient reference to the vector that should receive the result of the matrix-vector product. Must be allocated to the correct sizes and must have a valid gate assigned, but its numerical contents upon entry are ignored. Must not be the same object as x.
[in]xA transient reference to the vector that is to be multiplied by this matrix. Must not be the same object as r.
Returns
A SynchVectorTicket object that waits for the operation to complete.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.

Definition at line 378 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix.

◆ apply_transposed_async() [2/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
auto FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::apply_transposed_async ( VectorTypeR r,
const VectorTypeL x,
const VectorTypeR y,
const DataType  alpha = DataType(1) 
) const -> decltype(r.sync_0_async())
inline

Performs a matrix-vector multiplication: r <- y + alpha*A^T*x.

Parameters
[in,out]rA transient reference to the vector that should receive the result of the matrix-vector product. Must be allocated to the correct sizes and must have a valid gate assigned, but its numerical contents upon entry are ignored. Must not be the same object as x, but it may be the same object as y.
[in]xA transient reference to the vector that is to be multiplied by this matrix. Must not be the same object as r.
[in]yA transient reference to the vector that is to be added onto the result of the product. May be the same object as r.
[in]alphaA scaling factor for the matrix-vector product A*x.
Returns
A SynchVectorTicket object that waits for the operation to complete.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.

Definition at line 525 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Vector< LocalVector_, Mirror_ >::copy(), FEAT::Global::Vector< LocalVector_, Mirror_ >::from_1_to_0(), FEAT::Global::Vector< LocalVector_, Mirror_ >::local(), and FEAT::Global::Vector< LocalVector_, Mirror_ >::sync_0_async().

◆ bytes()

◆ clone()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
Matrix FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::clone ( LAFEM::CloneMode  mode = LAFEM::CloneMode::Weak) const
inline

Creates and returns a clone of this global matrix.

Parameters
[in]modeSpecifies the clone mode for the internal matrix object.
Returns
The created clone object

Definition at line 187 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::Matrix(), FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_col_gate, FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, and FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_row_gate.

◆ columns()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
template<LAFEM::Perspective perspective_ = LAFEM::Perspective::pod>
Index FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::columns ( ) const
inline

Gets the total number of columns in this distributed matrix.

Warning
In parallel, this requires communication and is very expensive, so use sparingly!
Attention
This function is collective, i.e. it must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.
Returns
The number of columns of this matrix

Definition at line 223 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_col_gate.

◆ convert()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
template<typename OtherGlobalMatrix_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::convert ( GateRowType row_gate,
GateColType col_gate,
const OtherGlobalMatrix_ &  other 
)
inline

Definition at line 142 of file matrix.hpp.

◆ convert_to_1() [1/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
LocalMatrix_ FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::convert_to_1 ( ) const
inline

Computes and returns the type-1 conversion of this matrix as a local matrix.

This function performs a type-0 to type-1 conversion of this matrix, which is effectively the matrix counterpart of the type-0 synchronization of a vector, i.e. all matrix entries, which are shared by multiple processes, are replaced by the sum of all contributions from all processes which share the corresponding row/column DOFs. This converted matrix is required for Schwarz-like solver approaches.

Attention
Please note that in theory, the resulting matrix would often have a larger stencil than the original underlying patch-local LAFEM matrix, which is stored in this object's _matrix variable. The reason is that a neighbor process may have additional couplings between DOFs shared with this process on its patch that this process does not have in its own type-0 stencil, which would then result in an increased stencil. However, this conversion function does not include these additional couplings (if any) and simply ignores them, so that the type-1 matrix always has the same stencil as the corresponding type-0 matrix.
Returns
A new local matrix object containing the type-1 matrix for this process patch.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application might deadlock.

Definition at line 617 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_col_gate, FEAT::Global::Gate< LocalVector_, Mirror_ >::_comm, FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Gate< LocalVector_, Mirror_ >::_mirrors, FEAT::Global::Gate< LocalVector_, Mirror_ >::_ranks, FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_row_gate, ASSERTM, FEAT::Global::SynchMatrix< MT_, VMT_ >::exec(), FEAT::Global::SynchMatrix< MT_, VMT_ >::init(), and FEAT::LAFEM::Weak.

◆ convert_to_1() [2/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::convert_to_1 ( LocalMatrix_ &  matrix_sync_1,
bool  full_copy = true 
) const
inline

Computes and returns the type-1 conversion of this matrix as a local matrix.

This function performs a type-0 to type-1 conversion of this matrix, which is effectively the matrix counterpart of the type-0 synchronization of a vector, i.e. all matrix entries, which are shared by multiple processes, are replaced by the sum of all contributions from all processes which share the corresponding row/column DOFs. This converted matrix is required for Schwarz-like solver approaches.

Attention
The resulting matrix may (and usually will) have a larger stencil than the original underlying patch-local LAFEM matrix, which is stored in this object's _matrix variable. The reason is that a neighbor process may have additional couplings between DOFs that this process does not have, and these additional coupling are also included in this process's type-1 matrix. However, the stencil of the returned matrix is never smaller than the original local matrix stencil, i.e. the stencil of the patch-local type-0 matrix is always a sub-stencil of the returned type-1 matrix.
Parameters
[in/out]matrix_sync_1 The matrix the type 1 conversion should be written into. Has to be allocated to hold at least the stencil of this type-0 matrix.
[in]full_copyAlso copy index arrays?
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application might deadlock.

Definition at line 656 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_col_gate, FEAT::Global::Gate< LocalVector_, Mirror_ >::_comm, FEAT::Global::Gate< LocalVector_, Mirror_ >::_mirrors, FEAT::Global::Gate< LocalVector_, Mirror_ >::_ranks, FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_row_gate, FEAT::Global::SynchMatrix< MT_, VMT_ >::exec(), FEAT::Global::SynchMatrix< MT_, VMT_ >::init(), and FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::local().

◆ create_vector_l()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
VectorTypeL FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::create_vector_l ( ) const
inline

◆ create_vector_r()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
VectorTypeR FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::create_vector_r ( ) const
inline

◆ extract_diag()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::extract_diag ( VectorTypeL diag,
bool  sync = true 
) const
inline

Extracts the main diagonal of the matrix as a vector.

Parameters
[in]diagA transient reference to the vector that shall receive the main diagonal elements
[in]syncSpecifies whether the main diagonal vector is to be synchronized to obtain a type-1 vector. If set to false, the resulting vector will be a type-0 vector.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application might deadlock.

Definition at line 287 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Vector< LocalVector_, Mirror_ >::local(), and FEAT::Global::Vector< LocalVector_, Mirror_ >::sync_0().

◆ get_checkpoint_size()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
std::uint64_t FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::get_checkpoint_size ( LAFEM::SerialConfig config)
inline

Calculate size.

Calculate size of complete object as it is stored in the checkpoint

Returns
size of object

Definition at line 668 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix.

◆ get_col_gate()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
const GateColType * FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::get_col_gate ( ) const
inline

Returns a const pointer to the internal column gate of the matrix.

Returns
A const pointer to the internal column gate of the matrix.

Definition at line 164 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_col_gate.

◆ get_comm()

◆ get_row_gate()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
const GateRowType * FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::get_row_gate ( ) const
inline

◆ local() [1/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
LocalMatrix_ & FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::local ( )
inline

Returns a reference to the internal local LAFEM matrix object.

Returns
A reference to the internal local LAFEM matrix object.

Definition at line 126 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix.

Referenced by FEAT::Control::StokesPowerSystemLevel< dim_, DataType_, IndexType_, ScalarMatrix_, TransferMatrix_ >::assemble_grad_div_matrices(), FEAT::Control::BlockedBasicSystemLevel< dim_, DataType_, IndexType_, BlockedMatrix_, TransferMatrix_ >::bytes(), FEAT::Control::ScalarBasicSystemLevel< DataType_, IndexType_, ScalarMatrix_, TransferMatrix_ >::bytes(), FEAT::Control::Stokes3FieldSystemLevel< dim_, nsc_, DataType_, IndexType_, MatrixBlockA_, MatrixBlockB_, MatrixBlockD_, MatrixBlockM_, MatrixBlockK_, MatrixBlockL_, ScalarMatrix_, TransferMatrixV_, TransferMatrixP_, TransferMatrixS_ >::bytes(), FEAT::Control::StokesBlockedSystemLevel< dim_, DataType_, IndexType_, MatrixBlockA_, MatrixBlockB_, MatrixBlockD_, ScalarMatrix_, TransferMatrixV_, TransferMatrixP_, TransferMatrixS_ >::bytes(), FEAT::Control::StokesBlockedUnitVeloMeanPresSystemLevel< dim_, DataType_, IndexType_, MatrixBlockA_, MatrixBlockB_, MatrixBlockD_, ScalarMatrix_, TransferMatrixV_, TransferMatrixP_ >::bytes(), FEAT::Control::StokesPowerUnitVeloNonePresSystemLevel< dim_, DataType_, IndexType_, ScalarMatrix_ >::bytes(), FEAT::Control::StokesPowerUnitVeloMeanPresSystemLevel< dim_, DataType_, IndexType_, ScalarMatrix_ >::bytes(), FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::convert_to_1(), FEAT::Global::PMDCDSCMatrix< Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, 1 >, MirrorV_, MirrorP_ >, Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, 1, dim_ >, MirrorP_, MirrorV_ > >::init_numeric(), FEAT::Global::PMDCDSCMatrix< Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, 1 >, MirrorV_, MirrorP_ >, Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, 1, dim_ >, MirrorP_, MirrorV_ > >::init_symbolic(), FEAT::Global::AlgDofPartiMatrix< LocalMatrix_, Mirror_ >::upload(), FEAT::Global::AlgDofPartiMatrix< LocalMatrix_, Mirror_ >::upload_numeric(), and FEAT::Global::AlgDofPartiMatrix< LocalMatrix_, Mirror_ >::upload_symbolic().

◆ local() [2/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
const LocalMatrix_ & FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::local ( ) const
inline

Returns a const reference to the internal local LAFEM matrix object.

Returns
A const reference to the internal local LAFEM matrix object.

Definition at line 136 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix.

◆ lump_rows() [1/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
VectorTypeL FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::lump_rows ( bool  sync = true) const
inline

Computes and returns the lumped rows of the matrix as a vector.

Each entry of the lumped rows vector contains the sum of all matrix elements in the corresponding row of this matrix.

Parameters
[in]syncSpecifies whether the lumped rows vector is to be synchronized to obtain a type-1 vector. If set to false, the resulting vector will be a type-0 vector.
Returns
A new vector containing the lumped row elements of this matrix.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application might deadlock.

Definition at line 584 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::create_vector_l(), and FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::lump_rows().

◆ lump_rows() [2/2]

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::lump_rows ( VectorTypeL lump,
bool  sync = true 
) const
inline

Computes the lumped rows of the matrix as a vector.

Each entry of the lumped rows vector contains the sum of all matrix elements in the corresponding row of this matrix.

Parameters
[in]lumpA transient reference to the vector that shall receive the lumped row elements
[in]syncSpecifies whether the lumped rows vector is to be synchronized to obtain a type-1 vector. If set to false, the resulting vector will be a type-0 vector.
Attention
This function must be called by all processes participating in the gate's communicator, otherwise the application might deadlock.

Definition at line 556 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Vector< LocalVector_, Mirror_ >::local(), FEAT::Global::Vector< LocalVector_, Mirror_ >::sync_0(), and XASSERTM.

Referenced by FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::lump_rows().

◆ restore_from_checkpoint_data()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
void FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::restore_from_checkpoint_data ( std::vector< char > &  data)
inline

Extract object from checkpoint.

Restores complete object with all its contents from checkpoint data

Parameters
[out]dataobject as bytestrem

Definition at line 674 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix.

◆ rows()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
template<LAFEM::Perspective perspective_ = LAFEM::Perspective::pod>
Index FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::rows ( ) const
inline

Returns the total number of rows in this distributed matrix.

Warning
In parallel, this requires communication and is very expensive, so use sparingly!
Attention
This function is collective, i.e. it must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.
Returns
The number of rows of this matrix

Definition at line 239 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_row_gate.

◆ set_checkpoint_data()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
std::uint64_t FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::set_checkpoint_data ( std::vector< char > &  data,
LAFEM::SerialConfig config 
)
inline

◆ used_elements()

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
template<LAFEM::Perspective perspective_ = LAFEM::Perspective::pod>
Index FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::used_elements ( ) const
inline

Returns the total number of non-zeros in this distributed matrix.

Warning
In parallel, this requires communication and is very expensive, so use sparingly!
Attention
This function is collective, i.e. it must be called by all processes participating in the gate's communicator, otherwise the application will deadlock.
Returns
The total number of non-zeros in this matrix

Definition at line 255 of file matrix.hpp.

References FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_col_gate, FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix, FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_row_gate, FEAT::Dist::Comm::allreduce(), FEAT::Global::Gate< LocalVector_, Mirror_ >::get_comm(), FEAT::Dist::op_sum, and FEAT::Dist::Comm::size().

Member Data Documentation

◆ _col_gate

◆ _matrix

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
LocalMatrix_ FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::_matrix
protected

◆ _row_gate

◆ is_global

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
constexpr bool FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::is_global = true
staticconstexpr

this is a global matrix class

Definition at line 70 of file matrix.hpp.

◆ is_local

template<typename LocalMatrix_ , typename RowMirror_ , typename ColMirror_ >
constexpr bool FEAT::Global::Matrix< LocalMatrix_, RowMirror_, ColMirror_ >::is_local = false
staticconstexpr

this is not a local matrix class

Definition at line 72 of file matrix.hpp.


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