20 class ConstrainedOperator;
21 class RectangularConstrainedOperator;
94 {
mfem_error(
"Operator::MultTranspose() is not overridden!"); }
101 const double a = 1.0)
const;
113 const double a = 1.0)
const;
124 mfem_error(
"Operator::GetGradient() is not overridden!");
125 return const_cast<Operator &
>(*this);
133 MFEM_CONTRACT_VAR(diag);
134 MFEM_ABORT(
"Not relevant or not implemented for this Operator.");
198 int copy_interior = 0);
452 int jok,
int *jcur,
double gamma);
595 int jokB,
int *jcurB,
double gammaB)
597 mfem_error(
"TimeDependentAdjointOperator::SUNImplicitSetupB() is not " 615 mfem_error(
"TimeDependentAdjointOperator::SUNImplicitSolveB() is not " 673 virtual void ImplicitSolve(
const double fac0,
const double fac1,
692 explicit Solver(
int s = 0,
bool iter_mode =
false)
696 Solver(
int h,
int w,
bool iter_mode =
false)
739 { A_.
Mult(x, y); y *= a_; }
843 bool ownA, ownB, ownC;
849 const Operator *C,
bool ownA,
bool ownB,
bool ownC);
1013 int numSteps = 10,
double tolerance = 1e-8,
virtual MemoryClass GetMemoryClass() const
Return the MemoryClass preferred by the Operator.
PowerMethod helper class to estimate the largest eigenvalue of an operator using the iterative power ...
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 ...
void FormRectangularSystemOperator(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, Operator *&A)
Return in A a parallel (on truedofs) version of this rectangular operator (including constraints)...
ConstrainedOperator(Operator *A, const Array< int > &list, bool own_A=false, DiagonalPolicy diag_policy=DIAG_ONE)
Constructor from a general Operator and a list of essential indices/dofs.
virtual void AddMultTranspose(const Vector &x, Vector &y, const double a=1.0) const
Operator transpose application: y+=A^t(x) (default) or y+=a*A^t(x).
virtual int SUNImplicitSolveB(Vector &x, const Vector &b, double tol)
Solve the ODE linear system as setup by the method SUNImplicitSetup().
Solver(int s=0, bool iter_mode=false)
Initialize a square Solver with size s.
virtual Operator & GetGradient(const Vector &x) const
Evaluate the gradient operator at the point x. The default behavior in class Operator is to generate ...
virtual Operator & GetImplicitGradient(const Vector &x, const Vector &k, double shift) const
Return an Operator representing (dF/dk shift + dF/dx) at the given x, k, and the currently set time...
virtual ~ProductOperator()
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 ...
Array< int > constraint_list
List of constrained indices/dofs.
virtual void ImplicitSolve(const double fac0, const double fac1, const Vector &x, const Vector &dxdt, Vector &k)
Solve the equation: k = f(x + fac0 k, dxdt + fac1 k, t), for the unknown k at the current time t...
Type type
Describes the form of the TimeDependentOperator.
EvalMode GetEvalMode() const
Return the current evaluation mode. See SetEvalMode() for details.
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate columns corresponding to "essential boundary condition" values specified in x from the give...
virtual void MultTranspose(const Vector &x, Vector &y) const
Application of the transpose.
virtual void AddMult(const Vector &x, Vector &y, const double a=1.0) const
Operator application: y+=A(x) (default) or y+=a*A(x).
ID for the base class BlockOperator.
Base abstract class for first order time dependent operators.
virtual void ImplicitSolve(const double dt, const Vector &x, Vector &k)
Solve the equation: k = f(x + dt k, t), for the unknown k at the current time t.
virtual void AdjointRateMult(const Vector &y, Vector &yB, Vector &yBdot) const =0
Perform the action of the operator: yBdot = k = f(y,@2 yB, t), where.
virtual const Operator * GetRestriction() const
Restriction operator from input vectors for the operator to linear algebra (linear system) vectors...
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
ID for class ComplexHypreParMatrix.
virtual void MultTranspose(const Vector &x, Vector &y) const
Application of the transpose.
void InitTVectors(const Operator *Po, const Operator *Ri, const Operator *Pi, Vector &x, Vector &b, Vector &X, Vector &B) const
Initializes memory for true vectors of linear system.
virtual MemoryClass GetMemoryClass() const
Return the MemoryClass preferred by the Operator.
int NumRows() const
Get the number of rows (size of output) of the Operator. Synonym with Height().
void FormDiscreteOperator(Operator *&A)
Return in A a parallel (on truedofs) version of this rectangular operator.
EvalMode eval_mode
Current evaluation mode.
ProductOperator(const Operator *A, const Operator *B, bool ownA, bool ownB)
ID for class PetscParMatrix, MATHYPRE format.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
virtual void SetTime(const double t_)
Set the current time.
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 ...
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
ID for class BlockMatrix.
SecondOrderTimeDependentOperator(int n=0, double t_=0.0, Type type_=EXPLICIT)
Construct a "square" SecondOrderTimeDependentOperator y = f(x,dxdt,t), where x, dxdt and y have the s...
void PrintMatlab(std::ostream &out, int n, int m=0) const
Prints operator with input size n and output size m in Matlab format.
SecondOrderTimeDependentOperator(int h, int w, double t_=0.0, Type type_=EXPLICIT)
Construct a SecondOrderTimeDependentOperator y = f(x,dxdt,t), where x, dxdt and y have the same dimen...
virtual ~TimeDependentOperator()
virtual void Mult(const Vector &x, Vector &y) const
Operator application. Apply the transpose of the original Operator.
virtual ~TimeDependentAdjointOperator()
Destructor.
bool own_A
Ownership flag for A.
void FormRectangularConstrainedSystemOperator(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, RectangularConstrainedOperator *&Aout)
see FormRectangularSystemOperator()
Solver(int h, int w, bool iter_mode=false)
Initialize a Solver with height h and width w.
ID for class ComplexDenseMatrix.
Array< int > test_constraints
virtual int SUNImplicitSolve(const Vector &b, Vector &x, double tol)
Solve the ODE linear system as setup by the method SUNImplicitSetup().
void FormRectangularLinearSystem(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, Vector &x, Vector &b, Operator *&A, Vector &X, Vector &B)
Form a column-constrained linear system using a matrix-free approach.
ID for class SparseMatrix.
virtual void Mult(const Vector &x, Vector &y) const
Perform the action of the operator: y = k = f(x, t), where k solves the algebraic equation F(x...
TransposeOperator(const Operator &a)
Construct the transpose of a given operator a.
Type GetType() const
Return the type ID of the Operator class.
General product operator: x -> (A*B)(x) = A(B(x)).
virtual void ArrayAddMultTranspose(const Array< const Vector *> &X, Array< Vector *> &Y, const double a=1.0) const
Operator transpose application on a matrix: Y+=A^t(X) (default) or Y+=a*A^t(X).
ID for the base class Operator, i.e. any type.
void SetDiagonalPolicy(const DiagonalPolicy diag_policy_)
Set the diagonal policy for the constrained operator.
virtual ~SecondOrderTimeDependentOperator()
virtual void SetEvalMode(const EvalMode new_eval_mode)
Set the evaluation mode of the time-dependent operator.
virtual ~ConstrainedOperator()
Destructor: destroys the unconstrained Operator, if owned.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
virtual void ArrayMult(const Array< const Vector *> &X, Array< Vector *> &Y) const
Operator application on a matrix: Y=A(X).
void FormConstrainedSystemOperator(const Array< int > &ess_tdof_list, ConstrainedOperator *&Aout)
see FormSystemOperator()
This type assumes F(x,k,t) = k, i.e. k = f(x,t) = G(x,t).
bool isHomogeneous() const
True if type is HOMOGENEOUS.
ID for class PetscParMatrix, unspecified format.
virtual int SUNMassSetup()
Setup the mass matrix in the ODE system .
virtual ~RectangularConstrainedOperator()
TimeDependentOperator(int h, int w, double t_=0.0, Type type_=EXPLICIT)
Construct a TimeDependentOperator y = f(x,t), where x and y have dimensions w and h...
int GetAdjointHeight()
Returns the size of the adjoint problem state space.
virtual void MultTranspose(const Vector &x, Vector &y) const
Application of the transpose. Apply the original Operator.
virtual MemoryClass GetMemoryClass() const
Returns the type of memory in which the solution and temporaries are stored.
The operator x -> R*A*P*x constructed through the actions of R^T, A and P.
virtual const Operator * GetOutputRestrictionTranspose() const
Transpose of GetOutputRestriction, directly available in this form to facilitate matrix-free RAP-type...
PowerMethod(MPI_Comm comm_)
virtual void Mult(const Vector &x, Vector &y) const
Rectangular-constrained operator action.
ID for class PetscParMatrix, MATNEST format.
virtual void QuadratureIntegration(const Vector &y, Vector &qdot) const
Provide the operator integration of a quadrature equation.
Set the diagonal value to one.
RAPOperator(const Operator &Rt_, const Operator &A_, const Operator &P_)
Construct the RAP operator given R^T, A and P.
This is the most general type, no assumptions on F and G.
ID for class PetscParMatrix, MATSHELL format.
virtual const Operator * GetProlongation() const
Prolongation operator from linear algebra (linear system) vectors, to input vectors for the operator...
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
Operator(int s=0)
Construct a square Operator with given size s (default 0).
IdentityOperator(int n)
Create an identity operator of size n.
bool IsIdentityProlongation(const Operator *P)
virtual const Operator * GetOutputRestriction() const
Restriction operator from output vectors for the operator to linear algebra (linear system) vectors...
Type
Enumeration defining IDs for some classes derived from Operator.
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
Array< int > trial_constraints
virtual void ExplicitMult(const Vector &x, Vector &y) const
Perform the action of the explicit part of the operator, G: y = G(x, t) where t is the current time...
virtual int SUNMassSolve(const Vector &b, Vector &x, double tol)
Solve the mass matrix linear system as setup by the method SUNMassSetup().
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate "essential boundary condition" values specified in x from the given right-hand side b...
Scaled Operator B: x -> a A(x).
TimeDependentOperator(int n=0, double t_=0.0, Type type_=EXPLICIT)
Construct a "square" TimeDependentOperator y = f(x,t), where x and y have the same dimension n...
Vector w
Auxiliary vectors.
virtual void MultTranspose(const Vector &x, Vector &y) const
Application of the transpose.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
virtual void AssembleDiagonal(Vector &diag) const
Diagonal of A, modified according to the used DiagonalPolicy.
virtual void QuadratureSensitivityMult(const Vector &y, const Vector &yB, Vector &qBdot) const
Provides the sensitivity of the quadrature w.r.t to primal and adjoint solutions. ...
Base abstract class for second order time dependent operators.
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
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 ...
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.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
ScaledOperator(const Operator *A, double a)
Create an operator which is a scalar multiple of A.
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
The transpose of a given operator. Switches the roles of the methods Mult() and MultTranspose().
int NumCols() const
Get the number of columns (size of input) of the Operator. Synonym with Width().
virtual MemoryClass GetMemoryClass() const
Return the MemoryClass preferred by the Operator.
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 sys...
int height
Dimension of the output / number of rows in the matrix.
virtual void ArrayMultTranspose(const Array< const Vector *> &X, Array< Vector *> &Y) const
Action of the transpose operator on a matrix: Y=A^t(X).
This type assumes that G(x,t) = 0.
TimeDependentAdjointOperator(int dim, int adjdim, double t=0., Type type=EXPLICIT)
The TimedependentAdjointOperator extends the TimeDependentOperator class to use features in SUNDIALS ...
virtual double GetTime() const
Read the currently set time.
virtual void Mult(const Vector &x, const Vector &dxdt, Vector &y) const
Perform the action of the operator: y = k = f(x,@ dxdt, t), where k solves the algebraic equation F(x...
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
Rectangular Operator for imposing essential boundary conditions on the input space using only the act...
Host memory; using new[] and delete[].
virtual ~TripleProductOperator()
virtual Operator & GetExplicitGradient(const Vector &x) const
Return an Operator representing dG/dx at the given point x and the currently set time.
virtual MemoryClass GetMemoryClass() const
Returns the type of memory in which the solution and temporaries are stored.
ID for class PetscParMatrix, MATAIJ format.
void FormSystemOperator(const Array< int > &ess_tdof_list, Operator *&A)
Return in A a parallel (on truedofs) version of this square operator.
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
General triple product operator x -> A*B*C*x, with ownership of the factors.
bool isExplicit() const
True if type is EXPLICIT.
virtual void AssembleDiagonal(Vector &diag) const
Computes the diagonal entries into diag. Typically, this operation only makes sense for linear Operat...
Operator(int h, int w)
Construct an Operator with the given height (output size) and width (input size). ...
virtual int SUNImplicitSetup(const Vector &x, const Vector &fx, int jok, int *jcur, double gamma)
Setup the ODE linear system or , where .
TripleProductOperator(const Operator *A, const Operator *B, const Operator *C, bool ownA, bool ownB, bool ownC)
virtual int SUNMassMult(const Vector &x, Vector &v)
Compute the mass matrix-vector product .
ID for class ComplexSparseMatrix.
virtual void ArrayAddMult(const Array< const Vector *> &X, Array< Vector *> &Y, const double a=1.0) const
Operator application on a matrix: Y+=A(X) (default) or Y+=a*A(X).
Operator * SetupRAP(const Operator *Pi, const Operator *Po)
Returns RAP Operator of this, using input/output Prolongation matrices Pi corresponds to "P"...
virtual void SetOperator(const Operator &op)=0
Set/update the solver for the given operator.
EvalMode
Evaluation mode. See SetEvalMode() for details.
Identity Operator I: x -> x.
ID for class HypreParMatrix.
virtual const Operator * GetOutputProlongation() const
Prolongation operator from linear algebra (linear system) vectors, to output vectors for the operator...
TransposeOperator(const Operator *a)
Construct the transpose of a given operator *a.
DiagonalPolicy diag_policy
Diagonal policy for constrained dofs.
virtual void AssembleDiagonal(Vector &diag) const
Approximate diagonal of the RAP Operator.
virtual void Mult(const Vector &x, Vector &y) const
Constrained operator action.
Operator * A
The unconstrained Operator.
ID for class ComplexOperator.
Square Operator for imposing essential boundary conditions using only the action, Mult()...
double EstimateLargestEigenvalue(Operator &opr, Vector &v0, int numSteps=10, double tolerance=1e-8, int seed=12345)
Returns an estimate of the largest eigenvalue of the operator opr using the iterative power method...
bool isImplicit() const
True if type is IMPLICIT or HOMOGENEOUS.
virtual ~Operator()
Virtual destructor.
ID for class PetscParMatrix, MATIS format.
MemoryClass
Memory classes identify sets of memory types.
Set the diagonal value to zero.
int width
Dimension of the input / number of columns in the matrix.
virtual int SUNImplicitSetupB(const double t, const Vector &x, const Vector &xB, const Vector &fxB, int jokB, int *jcurB, double gammaB)
Setup the ODE linear system or , where .
virtual void ImplicitMult(const Vector &x, const Vector &k, Vector &y) const
Perform the action of the implicit part of the operator, F: y = F(x, k, t) where t is the current tim...
RectangularConstrainedOperator(Operator *A, const Array< int > &trial_list, const Array< int > &test_list, bool own_A=false)
Constructor from a general Operator and a list of essential indices/dofs.