12#ifndef MFEM_HANDLE_HPP
13#define MFEM_HANDLE_HPP
44 template <
typename OpType>
45 void pSet(OpType *A,
bool own_A =
true)
69 template <
typename OpType>
103 template <
typename OpType>
104 OpType *
As()
const {
return static_cast<OpType*
>(
oper); }
107 template <
typename OpType>
108 OpType *
Is()
const {
return dynamic_cast<OpType*
>(
oper); }
113 template <
typename OpType>
114 void Get(OpType *&A)
const { A =
static_cast<OpType*
>(
oper); }
144 template <
typename OpType>
145 void Reset(OpType *A,
bool own_A =
true)
186 template <
typename OpType>
Pointer to an Operator of a specified type.
OperatorHandle(Operator::Type tid)
Create a OperatorHandle with a specified type id, tid, without allocating the actual matrix.
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)
OperatorHandle & operator=(const OperatorHandle &master)
Shallow copy. The ownership flag of the target is set to false.
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.
Operator * operator->() const
Support the use of -> to call methods of the underlying Operator.
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.
OperatorHandle(OpType *A, bool own_A=true)
Create an OperatorHandle for the given OpType pointer, A.
void SetType(Operator::Type tid)
Invoke Clear() and set a new type id.
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 & operator*()
Access the underlying Operator.
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.
OperatorHandle()
Create an OperatorHandle with type id = Operator::MFEM_SPARSEMAT without allocating the actual matrix...
OperatorHandle(const OperatorHandle &other)
Shallow copy. The ownership flag of the target is set to false.
void Get(OpType *&A) const
Return the Operator pointer statically cast to a given OpType.
void ConvertFrom(OpType *A)
Convert the given OpType pointer, A, to the currently set 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...
const Operator & operator*() const
Access the underlying Operator.
Type
Enumeration defining IDs for some classes derived from Operator.
Type GetType() const
Return the type ID of the Operator class.
OperatorHandle OperatorPtr
Add an alternative name for OperatorHandle – OperatorPtr.