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);
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_ABORT(
"type id = Hypre_ParCSR requires MFEM_USE_MPI");
328 auto Ae = this->As<HypreParMatrix>()->
EliminateCols(ess_dof_list);
331 MFEM_ABORT(
"type id = Hypre_ParCSR requires MFEM_USE_MPI");
349 MFEM_VERIFY(A != NULL,
"EliminateRowsCols() is not called");
356 As<SparseMatrix>()->PartMult(ess_dof_list, X, B);
365 MFEM_ABORT(
"type id = Hypre_ParCSR requires MFEM_USE_MPI");
372 #ifdef MFEM_USE_PETSC 376 MFEM_ABORT(
"type id = Operator::PETSC_* requires MFEM_USE_PETSC");
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.
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. B.
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.
OpType * Is() const
Return the Operator pointer dynamically cast to a specified OpType.
void EliminateRows(const Array< int > &ess_dof_list)
Eliminate the rows corresponding to the essential dofs ess_dof_list.
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...
void EliminateCols(const Array< int > &ess_dof_list)
Eliminate columns corresponding to the essential dofs ess_dof_list.
static const char not_supported_msg[]
ID for class SparseMatrix.
ID for the base class Operator, i.e. any type.
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 AddMult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += B * C.
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)
The operator x -> R*A*P*x constructed through the actions of R^T, A and P.
void RAP(const DenseMatrix &A, const DenseMatrix &P, DenseMatrix &RAP)
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...
Type
Enumeration defining IDs for some classes derived from Operator.
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...
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate "essential boundary condition" values specified in x from the given right-hand side b...
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 Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged...
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
bool OwnsOperator() const
Return true if the OperatorHandle owns the held Operator.
Operator::Type Type() const
Get the currently set operator type id.
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
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)
ID for class PetscParMatrix, MATAIJ format.
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
Operator * Ptr() const
Access the underlying Operator pointer.
int Size() const
Return the logical size of the array.
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.