MFEM  v3.3 Finite element discretization library
mfem::Operator Class Referenceabstract

Abstract operator. More...

`#include <operator.hpp>`

Inherited by mfem::BlockOperator, mfem::ConstrainedOperator, mfem::HypreParMatrix, mfem::IdentityOperator, mfem::Matrix, mfem::miniapps::IrrotationalProjector, mfem::NonlinearForm, mfem::PetscParMatrix, mfem::RAPOperator, mfem::Solver, mfem::SuperLURowLocMatrix, mfem::TBilinearForm< meshType, solFESpace, IR, IntegratorType, solVecLayout_t, complex_t, real_t >, mfem::TimeDependentOperator, mfem::TransposeOperator, mfem::TripleProductOperator, ReducedSystemOperator, ReducedSystemOperator, ReducedSystemOperator, ReducedSystemOperator, and ReducedSystemOperator.

## Public Types

enum  Type {
MFEM_SPARSEMAT, HYPRE_PARCSR, PETSC_MATAIJ, PETSC_MATIS,
PETSC_MATSHELL, PETSC_MATNEST
}
Enumeration defining IDs for some classes derived from Operator. More...

## Public Member Functions

Operator (int s=0)
Construct a square Operator with given size s (default 0). More...

Operator (int h, int w)
Construct an Operator with the given height (output size) and width (input size). More...

int Height () const
Get the height (size of output) of the Operator. Synonym with NumRows(). More...

int NumRows () const
Get the number of rows (size of output) of the Operator. Synonym with Height(). More...

int Width () const
Get the width (size of input) of the Operator. Synonym with NumCols(). More...

int NumCols () const
Get the number of columns (size of input) of the Operator. Synonym with Width(). More...

virtual void Mult (const Vector &x, Vector &y) const =0
Operator application: `y=A(x)`. More...

virtual void MultTranspose (const Vector &x, Vector &y) const
Action of the transpose operator: `y=A^t(x)`. The default behavior in class Operator is to generate an error. More...

virtual OperatorGetGradient (const Vector &x) const
Evaluate the gradient operator at the point x. The default behavior in class Operator is to generate an error. More...

virtual const OperatorGetProlongation () const
Prolongation operator from linear algebra (linear system) vectors, to input vectors for the operator. `NULL` means identity. More...

virtual const OperatorGetRestriction () const
Restriction operator from input vectors for the operator to linear algebra (linear system) vectors. `NULL` means identity. More...

void FormLinearSystem (const Array< int > &ess_tdof_list, Vector &x, Vector &b, Operator *&A, Vector &X, Vector &B, int copy_interior=0)
Form a constrained linear system using a matrix-free approach. More...

virtual void RecoverFEMSolution (const Vector &X, const Vector &b, Vector &x)
Reconstruct a solution vector x (e.g. a GridFunction) from the solution X of a constrained linear system obtained from Operator::FormLinearSystem(). More...

void PrintMatlab (std::ostream &out, int n=0, int m=0) const
Prints operator with input size n and output size m in Matlab format. More...

virtual ~Operator ()
Virtual destructor. More...

## Protected Attributes

int height
Dimension of the output / number of rows in the matrix. More...

int width
Dimension of the input / number of columns in the matrix. More...

## Detailed Description

Abstract operator.

Definition at line 21 of file operator.hpp.

## Member Enumeration Documentation

 enum mfem::Operator::Type

Enumeration defining IDs for some classes derived from Operator.

Enumerator
MFEM_SPARSEMAT
HYPRE_PARCSR
PETSC_MATAIJ
PETSC_MATIS
PETSC_MATSHELL
PETSC_MATNEST

Definition at line 123 of file operator.hpp.

## Constructor & Destructor Documentation

 mfem::Operator::Operator ( int s = `0` )
inlineexplicit

Construct a square Operator with given size s (default 0).

Definition at line 29 of file operator.hpp.

 mfem::Operator::Operator ( int h, int w )
inline

Construct an Operator with the given height (output size) and width (input size).

Definition at line 33 of file operator.hpp.

 virtual mfem::Operator::~Operator ( )
inlinevirtual

Virtual destructor.

Definition at line 120 of file operator.hpp.

## Member Function Documentation

 void mfem::Operator::FormLinearSystem ( const Array< int > & ess_tdof_list, Vector & x, Vector & b, Operator *& A, Vector & X, Vector & B, int copy_interior = `0` )

Form a constrained linear system using a matrix-free approach.

Assuming square operator, form the operator linear system `A(X)=B`, corresponding to it and the right-hand side b, by applying any necessary transformations such as: parallel assembly, conforming constraints for non-conforming AMR and eliminating boundary conditions.

Note
Static condensation and hybridization are not supported for general operators (cf. the analogous methods BilinearForm::FormLinearSystem() and ParBilinearForm::FormLinearSystem()).

The constraints are specified through the prolongation P from GetProlongation(), and restriction R from GetRestriction() methods, which are e.g. available through the (parallel) finite element space of any (parallel) bilinear form operator. We assume that the operator is square, using the same input and output space, so we have: `A(X)=[P^t (*this) P](X)`, `B=P^t(b)`, and `x=P(X)`.

The vector x must contain the essential boundary condition values. These are eliminated through the ConstrainedOperator class and the vector X is initialized by setting its essential entries to the boundary conditions and all other entries to zero (copy_interior == 0) or copied from x (copy_interior != 0).

After solving the system `A(X)=B`, the (finite element) solution x can be recovered by calling Operator::RecoverFEMSolution() with the same vectors X, b, and x.

Note
The caller is responsible for destroying the output operator A!
If there are no transformations, X simply reuses the data of x.

Definition at line 21 of file operator.cpp.

 virtual Operator& mfem::Operator::GetGradient ( const Vector & x ) const
inlinevirtual

Evaluate the gradient operator at the point x. The default behavior in class Operator is to generate an error.

Reimplemented in mfem::NonlinearForm, and mfem::ParNonlinearForm.

Definition at line 57 of file operator.hpp.

 virtual const Operator* mfem::Operator::GetProlongation ( ) const
inlinevirtual

Prolongation operator from linear algebra (linear system) vectors, to input vectors for the operator. `NULL` means identity.

Definition at line 65 of file operator.hpp.

 virtual const Operator* mfem::Operator::GetRestriction ( ) const
inlinevirtual

Restriction operator from input vectors for the operator to linear algebra (linear system) vectors. `NULL` means identity.

Definition at line 68 of file operator.hpp.

 int mfem::Operator::Height ( ) const
inline

Get the height (size of output) of the Operator. Synonym with NumRows().

Definition at line 36 of file operator.hpp.

 virtual void mfem::Operator::Mult ( const Vector & x, Vector & y ) const
pure virtual
 virtual void mfem::Operator::MultTranspose ( const Vector & x, Vector & y ) const
inlinevirtual

Action of the transpose operator: `y=A^t(x)`. The default behavior in class Operator is to generate an error.

Definition at line 52 of file operator.hpp.

 int mfem::Operator::NumCols ( ) const
inline

Get the number of columns (size of input) of the Operator. Synonym with Width().

Definition at line 45 of file operator.hpp.

 int mfem::Operator::NumRows ( ) const
inline

Get the number of rows (size of output) of the Operator. Synonym with Height().

Definition at line 39 of file operator.hpp.

 void mfem::Operator::PrintMatlab ( std::ostream & out, int n = `0`, int m = `0` ) const

Prints operator with input size n and output size m in Matlab format.

Definition at line 72 of file operator.cpp.

 void mfem::Operator::RecoverFEMSolution ( const Vector & X, const Vector & b, Vector & x )
virtual

Reconstruct a solution vector x (e.g. a GridFunction) from the solution X of a constrained linear system obtained from Operator::FormLinearSystem().

Call this method after solving a linear system constructed using Operator::FormLinearSystem() to recover the solution as an input vector, x, for this Operator (presumably a finite element grid function). This method has identical signature to the analogous method for bilinear forms, though currently b is not used in the implementation.

Reimplemented in mfem::BilinearForm, and mfem::ParBilinearForm.

Definition at line 57 of file operator.cpp.

 int mfem::Operator::Width ( ) const
inline

Get the width (size of input) of the Operator. Synonym with NumCols().

Definition at line 42 of file operator.hpp.

## Member Data Documentation

 int mfem::Operator::height
protected

Dimension of the output / number of rows in the matrix.

Definition at line 24 of file operator.hpp.

 int mfem::Operator::width
protected

Dimension of the input / number of columns in the matrix.

Definition at line 25 of file operator.hpp.

The documentation for this class was generated from the following files:
{"ft_lang_label":"__label__en","ft_lang_prob":0.6535328,"math_prob":0.89608294,"size":9303,"snap":"2022-40-2023-06","text_gpt3_token_len":2441,"char_repetition_ratio":0.1977632,"word_repetition_ratio":0.32266435,"special_character_ratio":0.22465871,"punctuation_ratio":0.29220414,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97099584,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-01-31T11:18:59Z\",\"WARC-Record-ID\":\"<urn:uuid:cec73589-314c-4d87-adb4-1b9f34191962>\",\"Content-Length\":\"58167\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:4f32a630-5424-44a3-958b-e22cbaaf7200>\",\"WARC-Concurrent-To\":\"<urn:uuid:1de34ee3-a165-4989-8aa9-6af20c92f5c4>\",\"WARC-IP-Address\":\"185.199.108.153\",\"WARC-Target-URI\":\"https://docs.mfem.org/3.3/classmfem_1_1Operator.html\",\"WARC-Payload-Digest\":\"sha1:2FM4T6KTTKWRHWJ6JEKPAXTE74VFNKEV\",\"WARC-Block-Digest\":\"sha1:LQ2FKPY4TEFRHG7WPOOC4TA7JMN6AI45\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499857.57_warc_CC-MAIN-20230131091122-20230131121122-00500.warc.gz\"}"}