13 #include "../general/array.hpp"
24 nRowBlocks(offsets.Size() - 1),
25 nColBlocks(offsets.Size() - 1),
28 op(nRowBlocks, nRowBlocks)
37 :
Operator(row_offsets_.Last(), col_offsets_.Last()),
39 nRowBlocks(row_offsets_.Size()-1),
40 nColBlocks(col_offsets_.Size()-1),
43 op(nRowBlocks, nColBlocks)
46 row_offsets.
MakeRef(row_offsets_);
47 col_offsets.
MakeRef(col_offsets_);
59 MFEM_VERIFY(row_offsets[iRow+1] - row_offsets[iRow] == opt->
NumRows() &&
60 col_offsets[iCol+1] - col_offsets[iCol] == opt->
NumCols(),
61 "incompatible Operator dimensions");
67 MFEM_ASSERT(x.
Size() ==
width,
"incorrect input Vector size");
68 MFEM_ASSERT(y.
Size() ==
height,
"incorrect output Vector size");
74 for (
int iRow=0; iRow < nRowBlocks; ++iRow)
76 tmp.
SetSize(row_offsets[iRow+1] - row_offsets[iRow]);
77 for (
int jCol=0; jCol < nColBlocks; ++jCol)
81 op(iRow,jCol)->Mult(xblock.
GetBlock(jCol), tmp);
91 MFEM_ASSERT(x.
Size() ==
height,
"incorrect input Vector size");
92 MFEM_ASSERT(y.
Size() ==
width,
"incorrect output Vector size");
97 yblock.
Update(y.GetData(),col_offsets);
99 for (
int iRow=0; iRow < nColBlocks; ++iRow)
101 tmp.
SetSize(col_offsets[iRow+1] - col_offsets[iRow]);
102 for (
int jCol=0; jCol < nRowBlocks; ++jCol)
106 op(jCol,iRow)->MultTranspose(xblock.
GetBlock(jCol), tmp);
117 for (
int iRow=0; iRow < nRowBlocks; ++iRow)
118 for (
int jCol=0; jCol < nColBlocks; ++jCol)
120 delete op(jCol,iRow);
129 nBlocks(offsets_.Size() - 1),
140 MFEM_VERIFY(offsets[iblock+1] - offsets[iblock] == opt->
Height() &&
141 offsets[iblock+1] - offsets[iblock] == opt->
Width(),
142 "incompatible Operator dimensions");
150 MFEM_ASSERT(x.
Size() ==
width,
"incorrect input Vector size");
151 MFEM_ASSERT(y.
Size() ==
height,
"incorrect output Vector size");
156 for (
int i=0; i<nBlocks; ++i)
171 MFEM_ASSERT(x.
Size() ==
height,
"incorrect input Vector size");
172 MFEM_ASSERT(y.
Size() ==
width,
"incorrect output Vector size");
177 for (
int i=0; i<nBlocks; ++i)
191 for (
int i=0; i<nBlocks; ++i)
void SetSize(int s)
Resize the vector if the new size is different.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols.
int Size() const
Returns the size of the vector.
void Update(double *data, const Array< int > &bOffsets)
Update method.
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator.
void SetBlock(int iRow, int iCol, Operator *op)
Add a block op in the block-entry (iblock, jblock).
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows.
void SetDiagonalBlock(int iblock, Operator *op)
Add block op in the block-entry (iblock, iblock).
~BlockDiagonalPreconditioner()
BlockDiagonalPreconditioner(const Array< int > &offsets)
Constructor that specifies the block structure.
BlockOperator(const Array< int > &offsets)
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator.
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
void MakeRef(T *, int)
Make this Array a reference to a pointer.
Vector & GetBlock(int i)
Get the i-th vector in the block.
void SetDiagonalBlock(int iblock, Operator *op)
Add a square block op in the block-entry (iblock, iblock).