16 #ifndef GEOS_LINEARALGEBRA_SOLVERS_PRECONDITIONERBLOCKJACOBI_HPP_
17 #define GEOS_LINEARALGEBRA_SOLVERS_PRECONDITIONERBLOCKJACOBI_HPP_
20 #include "linearAlgebra/common/PreconditionerBase.hpp"
21 #include "denseLinearAlgebra/interfaces/blaslapack/BlasLapackLA.hpp"
30 template<
typename LAI >
51 m_blockSize = blockSize;
67 m_blockDiag.createWithLocalSize( mat.numLocalRows(), mat.numLocalCols(), m_blockSize, mat.comm() );
75 for(
globalIndex i = mat.ilower(); i < mat.iupper(); i += m_blockSize )
80 globalIndex const iRow = i + LvArray::integerConversion< globalIndex >( j );
82 localIndex const rowLength = mat.rowLength( iRow );
83 cols.resize( rowLength );
84 vals.resize( rowLength );
85 mat.getRowCopy( iRow, cols, vals );
88 localIndex const jCol = LvArray::integerConversion< localIndex >( cols[k]-i );
89 if( cols[k] >= i && cols[k] < i+LvArray::integerConversion< globalIndex >( m_blockSize ) )
91 values( j, jCol ) = vals[k];
95 BlasLapackLA::matrixInverse( values, valuesInv );
96 m_blockDiag.insert( idxBlk, idxBlk, valuesInv );
124 Vector & dst )
const override
130 m_blockDiag.apply( src, dst );
Abstract base class for linear operators.
Common interface for preconditioning operators.
virtual void setup(Matrix const &mat)
Compute the preconditioner from a matrix.
virtual globalIndex numGlobalCols() const override
Get the number of global columns.
virtual globalIndex numGlobalRows() const override
Get the number of global rows.
typename Base::Vector Vector
Alias for vector type.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
Common interface for identity preconditioning operator.
virtual void apply(Vector const &src, Vector &dst) const override
Apply operator to a vector.
virtual void clear() override
Clean up the preconditioner setup.
virtual void setup(Matrix const &mat) override
Compute the preconditioner from a matrix.
PreconditionerBlockJacobi(localIndex const &blockSize=0)
Constructor.
virtual bool hasPreconditionerMatrix() const override
Whether the preconditioner is available in matrix form.
typename Base::Matrix Matrix
Alias for matrix type.
virtual Matrix const & preconditionerMatrix() const override
Access the preconditioner in matrix form.
#define GEOS_LAI_ASSERT_EQ(lhs, rhs)
#define GEOS_LAI_ASSERT_GT(lhs, rhs)
#define GEOS_LAI_ASSERT(expr)
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Array< T, 1 > array1d
Alias for 1D array.