19#if defined(MFEM_USE_MPI) && defined(MFEM_USE_PETSC)
20#if (defined(HYPRE_BIGINT) && !defined(PETSC_USE_64BIT_INDICES)) || \
21 (!defined(HYPRE_BIGINT) && defined(PETSC_USE_64BIT_INDICES))
22#error HYPRE and PETSC do not use the same size integers!
30 "Operator::Type is not supported: type_id = ";
42 MFEM_ABORT(
"cannot use HYPRE parallel matrix format: "
43 "MFEM is not built with HYPRE support");
50 MFEM_ABORT(
"cannot use PETSc matrix formats: "
51 "MFEM is not built with PETSc support");
54 MFEM_ABORT(
"invalid Operator::Type, type_id = " << (
int)
type_id);
107 row_starts, col_starts, diag);
127 MFEM_VERIFY(A.
Type() == P.
Type(),
"type mismatch in A and P");
166 MFEM_VERIFY(A.
Type() == Rt.
Type(),
"type mismatch in A and Rt");
167 MFEM_VERIFY(A.
Type() == P.
Type(),
"type mismatch in A and P");
247 MFEM_VERIFY(
oper != NULL,
"conversion from type id = " << A.
Type()
248 <<
" to type id = " <<
Type() <<
" is not supported");
272 for (
int i = 0; i < ess_dof_list.
Size(); i++)
285 MFEM_ABORT(
"type id = Hypre_ParCSR requires MFEM_USE_MPI");
295 MFEM_ABORT(
"type id = Operator::PETSC_* requires MFEM_USE_PETSC");
312 MFEM_ABORT(
"type id = Hypre_ParCSR requires MFEM_USE_MPI");
331 MFEM_ABORT(
"type id = Hypre_ParCSR requires MFEM_USE_MPI");
349 MFEM_VERIFY(A != NULL,
"EliminateRowsCols() is not called");
365 MFEM_ABORT(
"type id = Hypre_ParCSR requires MFEM_USE_MPI");
376 MFEM_ABORT(
"type id = Operator::PETSC_* requires MFEM_USE_PETSC");
int Size() const
Return the logical size of the array.
Square Operator for imposing essential boundary conditions using only the action, Mult(),...
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate "essential boundary condition" values specified in x from the given right-hand side b.
Wrapper for hypre's ParCSR matrix class.
void EliminateRowsCols(const Array< int > &rows_cols, const HypreParVector &X, HypreParVector &B)
Pointer to an Operator of a specified type.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get().
void pSet(OpType *A, bool own_A=true)
void EliminateRowsCols(OperatorHandle &A, const Array< int > &ess_dof_list)
Reset the OperatorHandle to be the eliminated part of A after elimination of the essential dofs ess_d...
bool OwnsOperator() const
Return true if the OperatorHandle owns the held Operator.
void EliminateRows(const Array< int > &ess_dof_list)
Eliminate the rows corresponding to the essential dofs ess_dof_list.
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
void MakeRAP(OperatorHandle &Rt, OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product R A P, where R = Rt^t.
void ConvertFrom(OperatorHandle &A)
Convert the given OperatorHandle A to the currently set type id.
void EliminateCols(const Array< int > &ess_dof_list)
Eliminate columns corresponding to the essential dofs ess_dof_list.
void MakePtAP(OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product P^t A P.
void MakeSquareBlockDiag(MPI_Comm comm, HYPRE_BigInt glob_size, HYPRE_BigInt *row_starts, SparseMatrix *diag)
Reset the OperatorHandle to hold a parallel square block-diagonal matrix using the currently set type...
Operator::Type CheckType(Operator::Type tid)
static const char not_supported_msg[]
Operator * Ptr() const
Access the underlying Operator pointer.
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
void EliminateBC(const OperatorHandle &A_e, const Array< int > &ess_dof_list, const Vector &X, Vector &B) const
Eliminate essential dofs from the solution X into the r.h.s. B.
OpType * Is() const
Return the Operator pointer dynamically cast to a specified OpType.
Operator::Type Type() const
Get the currently set operator type id.
void MakeRectangularBlockDiag(MPI_Comm comm, HYPRE_BigInt glob_num_rows, HYPRE_BigInt glob_num_cols, HYPRE_BigInt *row_starts, HYPRE_BigInt *col_starts, SparseMatrix *diag)
Reset the OperatorHandle to hold a parallel rectangular block-diagonal matrix using the currently set...
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
@ DIAG_KEEP
Keep the diagonal value.
Type
Enumeration defining IDs for some classes derived from Operator.
@ ANY_TYPE
ID for the base class Operator, i.e. any type.
@ MFEM_SPARSEMAT
ID for class SparseMatrix.
@ PETSC_MATIS
ID for class PetscParMatrix, MATIS format.
@ Hypre_ParCSR
ID for class HypreParMatrix.
@ PETSC_MATAIJ
ID for class PetscParMatrix, MATAIJ format.
Wrapper for PETSc's matrix class.
void EliminateRowsCols(const Array< int > &rows_cols, const PetscParVector &X, PetscParVector &B, real_t diag=1.)
Eliminate rows and columns from the matrix, and rows from the vector B. Modify B with the BC values i...
The operator x -> R*A*P*x constructed through the actions of R^T, A and P.
void EliminateRowCol(int rc, const real_t sol, Vector &rhs, DiagonalPolicy dpolicy=DIAG_ONE)
Eliminate row rc and column rc and modify the rhs using sol.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
void RAP(const DenseMatrix &A, const DenseMatrix &P, DenseMatrix &RAP)
void AddMult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += B * C.
void EliminateBC(const HypreParMatrix &A, const HypreParMatrix &Ae, const Array< int > &ess_dof_list, const Vector &X, Vector &B)
Eliminate essential BC specified by ess_dof_list from the solution X to the r.h.s....