MFEM v4.7.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. | |
OperatorHandle (Operator::Type tid) | |
Create a OperatorHandle with a specified type id, tid, without allocating the actual matrix. | |
template<typename OpType > | |
OperatorHandle (OpType *A, bool own_A=true) | |
Create an OperatorHandle for the given OpType pointer, A. | |
OperatorHandle (const OperatorHandle &other) | |
Shallow copy. The ownership flag of the target is set to false. | |
~OperatorHandle () | |
OperatorHandle & | operator= (const OperatorHandle &master) |
Shallow copy. The ownership flag of the target is set to false. | |
Operator * | Ptr () const |
Access the underlying Operator pointer. | |
Operator * | operator-> () const |
Support the use of -> to call methods of the underlying Operator. | |
Operator & | operator* () |
Access the underlying Operator. | |
const Operator & | operator* () const |
Access the underlying Operator. | |
Operator::Type | Type () const |
Get the currently set operator type id. | |
template<typename OpType > | |
OpType * | As () const |
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get(). | |
template<typename OpType > | |
OpType * | Is () const |
Return the Operator pointer dynamically cast to a specified OpType. | |
template<typename OpType > | |
void | Get (OpType *&A) const |
Return the Operator pointer statically cast to a given OpType. | |
bool | OwnsOperator () const |
Return true if the OperatorHandle owns the held Operator. | |
void | SetOperatorOwner (bool own=true) |
Set the ownership flag for the held Operator. | |
void | Clear () |
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged. | |
void | SetType (Operator::Type tid) |
Invoke Clear() and set a new type id. | |
template<typename OpType > | |
void | Reset (OpType *A, bool own_A=true) |
Reset the OperatorHandle to the given OpType pointer, A. | |
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 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 type id. | |
void | MakePtAP (OperatorHandle &A, OperatorHandle &P) |
Reset the OperatorHandle to hold the product P^t A P. | |
void | MakeRAP (OperatorHandle &Rt, OperatorHandle &A, OperatorHandle &P) |
Reset the OperatorHandle to hold the product R A P, where R = Rt^t. | |
void | ConvertFrom (OperatorHandle &A) |
Convert the given OperatorHandle A to the currently set type id. | |
template<typename OpType > | |
void | ConvertFrom (OpType *A) |
Convert the given OpType pointer, A, to the currently set type id. | |
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. | |
void | EliminateRows (const Array< int > &ess_dof_list) |
Eliminate the rows corresponding to the essential dofs ess_dof_list. | |
void | EliminateCols (const Array< int > &ess_dof_list) |
Eliminate columns corresponding to the essential dofs ess_dof_list. | |
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. | |
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 |
Shallow copy. The ownership flag of the target is set to false.
Definition at line 73 of file handle.hpp.
|
inline |
Definition at line 77 of file handle.hpp.
|
inline |
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get().
Definition at line 104 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 124 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 187 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 114 of file handle.hpp.
|
inline |
Return the Operator pointer dynamically cast to a specified OpType.
Definition at line 108 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_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 id.
The operator ownership flag is set to true.
Definition at line 90 of file handle.cpp.
void mfem::OperatorHandle::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 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 93 of file handle.hpp.
|
inline |
Access the underlying Operator.
Definition at line 96 of file handle.hpp.
|
inline |
Support the use of -> to call methods of the underlying Operator.
Definition at line 90 of file handle.hpp.
|
inline |
Shallow copy. The ownership flag of the target is set to false.
Definition at line 80 of file handle.hpp.
|
inline |
Return true if the OperatorHandle owns the held Operator.
Definition at line 117 of file handle.hpp.
|
inlineprotected |
Definition at line 45 of file handle.hpp.
|
inline |
Access the underlying Operator pointer.
Definition at line 87 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 145 of file handle.hpp.
|
inline |
Set the ownership flag for the held Operator.
Definition at line 120 of file handle.hpp.
|
inline |
Invoke Clear() and set a new type id.
Definition at line 132 of file handle.hpp.
|
inline |
Get the currently set operator type id.
Definition at line 99 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.