MFEM
v3.3
Finite element discretization library
|
Pointer to an Operator of a specified type. More...
#include <handle.hpp>
Public Member Functions | |
OperatorHandle () | |
Create an OperatorHandle with type id = Operator::MFEM_SPARSEMAT without allocating the actual matrix. More... | |
OperatorHandle (Operator::Type tid) | |
Create a OperatorHandle with a specified type id, tid, without allocating the actual matrix. More... | |
template<typename OpType > | |
OperatorHandle (OpType *A, bool own_A=true) | |
Create an OperatorHandle for the given OpType pointer, A. More... | |
~OperatorHandle () | |
OperatorHandle & | operator= (const OperatorHandle &master) |
Shallow copy. The ownership flag of the target is set to false. More... | |
Operator * | Ptr () const |
Access the underlying Operator pointer. More... | |
Operator::Type | Type () const |
Get the currently set operator type id. More... | |
template<typename OpType > | |
OpType * | As () const |
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get(). More... | |
template<typename OpType > | |
OpType * | Is () const |
Return the Operator pointer dynamically cast to a specified OpType. More... | |
template<typename OpType > | |
void | Get (OpType *&A) const |
Return the Operator pointer statically cast to a given OpType. More... | |
bool | OwnsOperator () const |
Return true if the OperatorHandle owns the held Operator. More... | |
void | SetOperatorOwner (bool own=true) |
Set the ownership flag for the held Operator. More... | |
void | Clear () |
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged. More... | |
void | SetType (Operator::Type tid) |
Invoke Clear() and set a new type id. More... | |
template<typename OpType > | |
void | Reset (OpType *A, bool own_A=true) |
Reset the OperatorHandle to the given OpType pointer, A. More... | |
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 id. More... | |
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 type id. More... | |
void | MakePtAP (OperatorHandle &A, OperatorHandle &P) |
Reset the OperatorHandle to hold the product P^t A P. More... | |
void | MakeRAP (OperatorHandle &Rt, OperatorHandle &A, OperatorHandle &P) |
Reset the OperatorHandle to hold the product R A P, where R = Rt^t. More... | |
void | ConvertFrom (OperatorHandle &A) |
Convert the given OperatorHandle A to the currently set type id. More... | |
template<typename OpType > | |
void | ConvertFrom (OpType *A) |
Convert the given OpType pointer, A, to the currently set type id. More... | |
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_dof_list. More... | |
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. More... | |
Protected Member Functions | |
Operator::Type | CheckType (Operator::Type tid) |
template<typename OpType > | |
void | pSet (OpType *A, bool own_A=true) |
Protected Attributes | |
Operator * | oper |
Operator::Type | type_id |
bool | own_oper |
Static Protected Attributes | |
static const char | not_supported_msg [] |
Pointer to an Operator of a specified type.
This class provides a common interface for global, matrix-type operators to be used in bilinear forms, gradients of nonlinear forms, static condensation, hybridization, etc. The following backends are currently supported:
Definition at line 34 of file handle.hpp.
|
inline |
Create an OperatorHandle with type id = Operator::MFEM_SPARSEMAT without allocating the actual matrix.
Definition at line 56 of file handle.hpp.
|
inline |
Create a OperatorHandle with a specified type id, tid, without allocating the actual matrix.
Definition at line 61 of file handle.hpp.
|
inlineexplicit |
Create an OperatorHandle for the given OpType pointer, A.
Presently, OpType can be SparseMatrix, HypreParMatrix, or PetscParMatrix.
The operator ownership flag is set to the value of own_A.
It is expected that A points to a valid object.
Definition at line 71 of file handle.hpp.
|
inline |
Definition at line 73 of file handle.hpp.
|
inline |
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get().
Definition at line 91 of file handle.hpp.
|
protected |
Definition at line 21 of file handle.cpp.
|
inline |
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged.
Definition at line 111 of file handle.hpp.
void mfem::OperatorHandle::ConvertFrom | ( | OperatorHandle & | A | ) |
Convert the given OperatorHandle A to the currently set type id.
The operator ownership flag is set to false if the target type id is the same as the input; otherwise it is set to true.
Definition at line 163 of file handle.cpp.
|
inline |
Convert the given OpType pointer, A, to the currently set type id.
This method creates a temporary OperatorHandle for A and invokes ConvertFrom(OperatorHandle &) with it.
Definition at line 173 of file handle.hpp.
void mfem::OperatorHandle::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.
The argument A_e is expected to be the result of the method EliminateRowsCols().
Definition at line 236 of file handle.cpp.
void mfem::OperatorHandle::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_dof_list.
Definition at line 194 of file handle.cpp.
|
inline |
Return the Operator pointer statically cast to a given OpType.
Similar to the method As(), however the template type OpType can be derived automatically from the argument A.
Definition at line 101 of file handle.hpp.
|
inline |
Return the Operator pointer dynamically cast to a specified OpType.
Definition at line 95 of file handle.hpp.
void mfem::OperatorHandle::MakePtAP | ( | OperatorHandle & | A, |
OperatorHandle & | P | ||
) |
Reset the OperatorHandle to hold the product P^t A P.
The type id of the result is determined by that of A and P. The operator ownership flag is set to true.
Definition at line 98 of file handle.cpp.
void mfem::OperatorHandle::MakeRAP | ( | OperatorHandle & | Rt, |
OperatorHandle & | A, | ||
OperatorHandle & | P | ||
) |
Reset the OperatorHandle to hold the product R A P, where R = Rt^t.
The type id of the result is determined by that of Rt, A, and P. The operator ownership flag is set to true.
Definition at line 130 of file handle.cpp.
void mfem::OperatorHandle::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 type id.
The operator ownership flag is set to true.
Definition at line 72 of file handle.cpp.
void mfem::OperatorHandle::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 id.
The operator ownership flag is set to true.
Definition at line 48 of file handle.cpp.
|
inline |
Shallow copy. The ownership flag of the target is set to false.
Definition at line 76 of file handle.hpp.
|
inline |
Return true if the OperatorHandle owns the held Operator.
Definition at line 104 of file handle.hpp.
|
inlineprotected |
Definition at line 46 of file handle.hpp.
|
inline |
Access the underlying Operator pointer.
Definition at line 83 of file handle.hpp.
|
inline |
Reset the OperatorHandle to the given OpType pointer, A.
Presently, OpType can be SparseMatrix, HypreParMatrix, or PetscParMatrix.
The operator ownership flag is set to the value of own_A.
It is expected that A points to a valid object.
Definition at line 132 of file handle.hpp.
|
inline |
Set the ownership flag for the held Operator.
Definition at line 107 of file handle.hpp.
|
inline |
Invoke Clear() and set a new type id.
Definition at line 119 of file handle.hpp.
|
inline |
Get the currently set operator type id.
Definition at line 86 of file handle.hpp.
|
staticprotected |
Definition at line 37 of file handle.hpp.
|
protected |
Definition at line 39 of file handle.hpp.
|
protected |
Definition at line 41 of file handle.hpp.
|
protected |
Definition at line 40 of file handle.hpp.