15 #ifndef GEOSX_LINEARALGEBRA_SOLVERS_PRECONDITIONERBLOCKJACOBI_HPP_ 16 #define GEOSX_LINEARALGEBRA_SOLVERS_PRECONDITIONERBLOCKJACOBI_HPP_ 19 #include "linearAlgebra/solvers/PreconditionerBase.hpp" 29 template<
typename LAI >
50 m_blockSize = blockSize;
66 m_blockDiag.createWithLocalSize( mat.numLocalRows(), mat.numLocalCols(), m_blockSize, mat.getComm() );
74 for(
globalIndex i = mat.ilower(); i < mat.iupper(); i+=m_blockSize )
79 globalIndex const iRow = i + LvArray::integerConversion< globalIndex >( j );
81 localIndex const rowLength = mat.globalRowLength( iRow );
84 mat.getRowCopy( iRow, cols, vals );
87 localIndex const jCol = LvArray::integerConversion< localIndex >( cols[k]-i );
88 if( cols[k] >= i && cols[k] < i+LvArray::integerConversion< globalIndex >( m_blockSize ) )
90 values( j, jCol ) = vals[k];
95 m_blockDiag.insert( idxBlk, idxBlk, valuesInv );
135 Vector & dst )
const override 141 m_blockDiag.apply( src, dst );
175 #endif //GEOSX_LINEARALGEBRA_SOLVERS_PRECONDITIONERBLOCKJACOBI_HPP_ PreconditionerBlockJacobi(localIndex const &blockSize=0)
Constructor.
virtual globalIndex numGlobalRows() const override
Get the number of global rows.
virtual void compute(Matrix const &mat) override
Compute the preconditioner from a matrix.
Common interface for preconditioning operators.
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
virtual globalIndex numGlobalCols() const override
Get the number of global columns.
virtual void compute(Matrix const &mat)
Compute the preconditioner from a matrix.
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns, and generally simplifying the interaction between PhysicsSolvers and linear algebra operations.
static void matrixInverse(MatRowMajor< real64 const > const &A, MatRowMajor< real64 > const &Ainv, real64 &detA)
Computes the inverse matrix; Ainv = inverse(A).
virtual bool hasPreconditionerMatrix() const override
Whether the preconditioner is available in matrix form.
virtual void compute(Matrix const &mat, DofManager const &dofManager) override
Compute the preconditioner from a matrix.
virtual void clear() override
Clean up the preconditioner setup.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
#define GEOSX_LAI_ASSERT_EQ(lhs, rhs)
void setValues(T const &value) const
Set all entries in the array to value.
Common interface for identity preconditioning operator.
#define GEOSX_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
#define GEOSX_LAI_ASSERT_GT(lhs, rhs)
void resize(int const numDims, DIMS_TYPE const *const dims)
Resize the dimensions of the Array to match the given dimensions.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
#define GEOSX_LAI_ASSERT(expr)
Abstract base class for linear operators.
typename Base::Vector Vector
Alias for vector type.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
virtual Matrix const & preconditionerMatrix() const override
Access the preconditioner in matrix form.
virtual void apply(Vector const &src, Vector &dst) const override
Apply operator to a vector.