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);
61 HYPRE_Int *row_starts,
92 HYPRE_Int glob_num_cols, HYPRE_Int *row_starts,
107 row_starts, col_starts, diag);
109 #ifdef MFEM_USE_PETSC
121 #endif // MFEM_USE_MPI
127 MFEM_VERIFY(A.
Type() == P.
Type(),
"type mismatch in A and P");
148 #ifdef MFEM_USE_PETSC
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");
186 #ifdef MFEM_USE_PETSC
230 #ifdef MFEM_USE_PETSC
236 #ifdef MFEM_USE_PETSC
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");
292 #ifdef MFEM_USE_PETSC
295 MFEM_ABORT(
"type id = Operator::PETSC_* requires MFEM_USE_PETSC");
312 MFEM_VERIFY(A != NULL,
"EliminateRowsCols() is not called");
319 As<SparseMatrix>()->PartMult(ess_dof_list, X, B);
328 MFEM_ABORT(
"type id = Hypre_ParCSR requires MFEM_USE_MPI");
335 #ifdef MFEM_USE_PETSC
339 MFEM_ABORT(
"type id = Operator::PETSC_* requires MFEM_USE_PETSC");
int Size() const
Logical size of the array.
void EliminateRowsCols(const Array< int > &rows_cols, const HypreParVector &X, HypreParVector &B)
void ConvertFrom(OperatorHandle &A)
Convert the given OperatorHandle A to the currently set type id.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
HypreParMatrix * RAP(const HypreParMatrix *A, const HypreParMatrix *P)
Returns the matrix P^t * A * P.
Wrapper for PETSc's matrix class.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Pointer to an Operator of a specified type.
Operator::Type Type() const
Get the currently set operator type id.
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.
void EliminateRowsCols(const Array< int > &rows_cols, const PetscParVector &X, PetscParVector &B, double diag=1.)
Eliminate rows and columns from the matrix, and rows from the vector B. Modify B with the BC values i...
static const char not_supported_msg[]
void EliminateBC(HypreParMatrix &A, HypreParMatrix &Ae, const Array< int > &ess_dof_list, const Vector &X, Vector &B)
ID for class SparseMatrix.
ID for the base class Operator, i.e. any type.
OpType * Is() const
Return the Operator pointer dynamically cast to a specified OpType.
void AddMult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += B * C.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
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...
Operator::Type CheckType(Operator::Type tid)
void Transpose(const Table &A, Table &At, int _ncols_A)
Transpose a Table.
The operator x -> R*A*P*x constructed through the actions of R^T, A and P.
Operator * Ptr() const
Access the underlying Operator pointer.
Type
Enumeration defining IDs for some classes derived from Operator.
bool OwnsOperator() const
Return true if the OperatorHandle owns the held Operator.
void EliminateRowCol(int rc, const double sol, Vector &rhs, DiagonalPolicy dpolicy=DIAG_ONE)
Eliminate row rc and column rc and modify the rhs using sol.
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged...
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
void MakeSquareBlockDiag(MPI_Comm comm, HYPRE_Int glob_size, HYPRE_Int *row_starts, SparseMatrix *diag)
Reset the OperatorHandle to hold a parallel square block-diagonal matrix using the currently set type...
void pSet(OpType *A, bool own_A=true)
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate "essential boundary condition" values specified in x from the given right-hand side b...
ID for class PetscParMatrix, MATAIJ format.
void MakeRectangularBlockDiag(MPI_Comm comm, HYPRE_Int glob_num_rows, HYPRE_Int glob_num_cols, HYPRE_Int *row_starts, HYPRE_Int *col_starts, SparseMatrix *diag)
Reset the OperatorHandle to hold a parallel rectangular block-diagonal matrix using the currently set...
ID for class HypreParMatrix.
Square Operator for imposing essential boundary conditions using only the action, Mult()...
Wrapper for hypre's ParCSR matrix class.
ID for class PetscParMatrix, MATIS format.
void MakePtAP(OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product P^t A P.
void MakeRAP(OperatorHandle &Rt, OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product R A P, where R = Rt^t.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.