12 #ifndef MFEM_BLOCKOPERATOR
13 #define MFEM_BLOCKOPERATOR
15 #include "../config/config.hpp"
16 #include "../general/array.hpp"
17 #include "operator.hpp"
81 int IsZeroBlock(
int i,
int j)
const {
return (op(i,j)==NULL) ? 1 : 0; }
84 { MFEM_VERIFY(op(i,j),
"");
return *op(i,j); }
87 { MFEM_VERIFY(op(i,j),
"");
return *op(i,j); }
90 { MFEM_VERIFY(op(i,j),
"");
return coef(i,j); }
93 { MFEM_VERIFY(op(i,j),
""); coef(i,j) = c; }
169 { MFEM_VERIFY(ops[iblock],
"");
return *ops[iblock]; }
173 { MFEM_VERIFY(ops[iblock],
"");
return *ops[iblock]; }
259 { MFEM_VERIFY(ops(iblock,jblock),
"");
return *ops(iblock,jblock); }
Array< int > & Offsets()
Return the offsets for block starts.
A class to handle Vectors in a block fashion.
Array< int > & RowOffsets()
Return the row offsets for block starts.
Array< int > & Offsets()
Return the offsets for block starts.
ID for the base class BlockOperator.
BlockOperator & operator=(const BlockOperator &)=delete
Copy assignment is not supported.
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator.
int IsZeroBlock(int i, int j) const
Check if block (i,j) is a zero block.
virtual void SetOperator(const Operator &op)
This method is present since required by the abstract base class Solver.
virtual Type GetType() const
Operator & GetBlock(int i, int j)
Return a reference to block i,j.
int NumBlocks() const
Return the number of blocks.
A class to handle Block lower triangular preconditioners in a matrix-free implementation.
Operator & GetDiagonalBlock(int iblock)
Return a reference to block i,i.
A class to handle Block diagonal preconditioners in a matrix-free implementation. ...
~BlockDiagonalPreconditioner()
void SetBlock(int iRow, int iCol, Operator *op)
Add a block opt in the block-entry (iblock, jblock).
Operator & GetBlock(int iblock, int jblock)
Return a reference to block i,j.
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
BlockDiagonalPreconditioner(const Array< int > &offsets)
Constructor that specifies the block structure.
Dynamic 2D array using row-major layout.
BlockOperator(const Array< int > &offsets)
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
void SetDiagonalBlock(int iblock, Operator *op, double c=1.0)
Add block op in the block-entry (iblock, iblock).
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator.
void SetBlockCoef(int i, int j, double c)
Set the coefficient for block i,j.
Type
Enumeration defining IDs for some classes derived from Operator.
virtual void SetOperator(const Operator &op)
This method is present since required by the abstract base class Solver.
const Array< int > & RowOffsets() const
Read only access to the row offsets for block starts.
~BlockLowerTriangularPreconditioner()
const Array< int > & ColOffsets() const
Read only access to the columns offsets for block starts.
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator.
void SetDiagonalBlock(int iblock, Operator *op)
Add block op in the block-entry (iblock, iblock).
int NumBlocks() const
Return the number of blocks.
const Operator & GetBlock(int i, int j) const
Return a reference to block i,j (const version)
const Array< int > & Offsets() const
Read only access to the offsets for block starts.
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
double GetBlockCoef(int i, int j) const
Return the coefficient for block i,j.
int NumRowBlocks() const
Return the number of row blocks.
BlockLowerTriangularPreconditioner(const Array< int > &offsets)
A class to handle Block systems in a matrix-free implementation.
const Operator & GetDiagonalBlock(int iblock) const
Return a reference to block i,i (const version).
int NumColBlocks() const
Return the number of column blocks.
void SetBlock(int iRow, int iCol, Operator *op, double c=1.0)
Add a block op in the block-entry (iblock, jblock).
void SetDiagonalBlock(int iblock, Operator *op)
Add a square block op in the block-entry (iblock, iblock).
Array< int > & ColOffsets()
Return the columns offsets for block starts.