12 #ifndef MFEM_HANDLE_HPP
13 #define MFEM_HANDLE_HPP
15 #include "../config/config.hpp"
44 template <
typename OpType>
45 void pSet(OpType *A,
bool own_A =
true)
69 template <
typename OpType>
95 template <
typename OpType>
96 OpType *
As()
const {
return static_cast<OpType*
>(
oper); }
99 template <
typename OpType>
100 OpType *
Is()
const {
return dynamic_cast<OpType*
>(
oper); }
105 template <
typename OpType>
106 void Get(OpType *&A)
const { A =
static_cast<OpType*
>(
oper); }
136 template <
typename OpType>
137 void Reset(OpType *A,
bool own_A =
true)
154 HYPRE_Int glob_num_cols, HYPRE_Int *row_starts,
156 #endif // MFEM_USE_MPI
178 template <
typename OpType>
OperatorHandle()
Create an OperatorHandle with type id = Operator::MFEM_SPARSEMAT without allocating the actual matrix...
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()...
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 EliminateRows(const Array< int > &ess_dof_list)
Eliminate the rows corresponding to the essential dofs ess_dof_list.
void EliminateCols(const Array< int > &ess_dof_list)
Eliminate columns corresponding to the essential dofs ess_dof_list.
static const char not_supported_msg[]
Operator & operator*()
Access the underlying Operator.
OpType * Is() const
Return the Operator pointer dynamically cast to a specified OpType.
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)
Operator * operator->() const
Support the use of -> to call methods of the underlying Operator.
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.
OperatorHandle OperatorPtr
Add an alternative name for OperatorHandle – OperatorPtr.
OperatorHandle(Operator::Type tid)
Create a OperatorHandle with a specified type id, tid, without allocating the actual matrix...
void ConvertFrom(OpType *A)
Convert the given OpType pointer, A, to the currently set type id.
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 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...
void Get(OpType *&A) const
Return the Operator pointer statically cast to a given OpType.
OperatorHandle & operator=(const OperatorHandle &master)
Shallow copy. The ownership flag of the target is set to false.
void MakePtAP(OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product P^t A P.
void SetType(Operator::Type tid)
Invoke Clear() and set a new type id.
void MakeRAP(OperatorHandle &Rt, OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product R A P, where R = Rt^t.
OperatorHandle(OpType *A, bool own_A=true)
Create an OperatorHandle for the given OpType pointer, A.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.