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>
89 template <
typename OpType>
90 OpType *
As()
const {
return static_cast<OpType*
>(
oper); }
93 template <
typename OpType>
94 OpType *
Is()
const {
return dynamic_cast<OpType*
>(
oper); }
99 template <
typename OpType>
100 void Get(OpType *&A)
const { A =
static_cast<OpType*
>(
oper); }
130 template <
typename OpType>
131 void Reset(OpType *A,
bool own_A =
true)
148 HYPRE_Int glob_num_cols, HYPRE_Int *row_starts,
150 #endif // MFEM_USE_MPI
171 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.
static const char not_supported_msg[]
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 * 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(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.