MFEM
v4.2.0
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 * | operator-> () const |
Support the use of -> to call methods of the underlying Operator. More... | |
Operator & | operator* () |
Access the underlying Operator. 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 | EliminateRows (const Array< int > &ess_dof_list) |
Eliminate the rows corresponding to the essential dofs ess_dof_list. More... | |
void | EliminateCols (const Array< int > &ess_dof_list) |
Eliminate columns corresponding to 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 33 of file handle.hpp.
|
inline |
Create an OperatorHandle with type id = Operator::MFEM_SPARSEMAT without allocating the actual matrix.
Definition at line 55 of file handle.hpp.
|
inlineexplicit |
Create a OperatorHandle with a specified type id, tid, without allocating the actual matrix.
Definition at line 60 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 70 of file handle.hpp.
|
inline |
Definition at line 72 of file handle.hpp.
|
inline |
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get().
Definition at line 96 of file handle.hpp.
|
protected |
Definition at line 32 of file handle.cpp.
|
inline |
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged.
Definition at line 116 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 object held by A will be held by this object as well, e.g. when the source and destination types are the same; otherwise it is set to true.
Definition at line 200 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 179 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 340 of file handle.cpp.
void mfem::OperatorHandle::EliminateCols | ( | const Array< int > & | ess_dof_list | ) |
Eliminate columns corresponding to the essential dofs ess_dof_list.
Definition at line 321 of file handle.cpp.
void mfem::OperatorHandle::EliminateRows | ( | const Array< int > & | ess_dof_list | ) |
Eliminate the rows corresponding to the essential dofs ess_dof_list.
Definition at line 303 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 252 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 106 of file handle.hpp.
|
inline |
Return the Operator pointer dynamically cast to a specified OpType.
Definition at line 100 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 123 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 161 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 91 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 60 of file handle.cpp.
|
inline |
Access the underlying Operator.
Definition at line 88 of file handle.hpp.
|
inline |
Support the use of -> to call methods of the underlying Operator.
Definition at line 85 of file handle.hpp.
|
inline |
Shallow copy. The ownership flag of the target is set to false.
Definition at line 75 of file handle.hpp.
|
inline |
Return true if the OperatorHandle owns the held Operator.
Definition at line 109 of file handle.hpp.
|
inlineprotected |
Definition at line 45 of file handle.hpp.
|
inline |
Access the underlying Operator pointer.
Definition at line 82 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 137 of file handle.hpp.
|
inline |
Set the ownership flag for the held Operator.
Definition at line 112 of file handle.hpp.
|
inline |
Invoke Clear() and set a new type id.
Definition at line 124 of file handle.hpp.
|
inline |
Get the currently set operator type id.
Definition at line 91 of file handle.hpp.
|
staticprotected |
Definition at line 36 of file handle.hpp.
|
protected |
Definition at line 38 of file handle.hpp.
|
protected |
Definition at line 40 of file handle.hpp.
|
protected |
Definition at line 39 of file handle.hpp.