12 #ifndef MFEM_HANDLE_HPP 13 #define MFEM_HANDLE_HPP 15 #include "../config/config.hpp" 16 #include "operator.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)
164 #endif // MFEM_USE_MPI 186 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.
Pointer to an Operator of a specified type.
OpType * Is() const
Return the Operator pointer dynamically cast to a specified OpType.
void Get(OpType *&A) const
Return the Operator pointer statically cast to a given OpType.
void EliminateRows(const Array< int > &ess_dof_list)
Eliminate the rows corresponding to the essential dofs ess_dof_list.
const Operator & operator*() const
Access the underlying Operator.
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.
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(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 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...
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...
OperatorHandle(const OperatorHandle &other)
Shallow copy. The ownership flag of the target is set to false.
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)
Operator * Ptr() const
Access the underlying Operator pointer.
OperatorHandle & operator=(const OperatorHandle &master)
Shallow copy. The ownership flag of the target is set to false.
Operator * operator->() const
Support the use of -> to call methods of the underlying Operator.
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.