MFEM  v3.4 Finite element discretization library
operator.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
10 // Software Foundation) version 2.1 dated February 1999.
11
12 #ifndef MFEM_OPERATOR
13 #define MFEM_OPERATOR
14
15 #include "vector.hpp"
16
17 namespace mfem
18 {
19
20 /// Abstract operator
21 class Operator
22 {
23 protected:
24  int height; ///< Dimension of the output / number of rows in the matrix.
25  int width; ///< Dimension of the input / number of columns in the matrix.
26
27 public:
28  /// Construct a square Operator with given size s (default 0).
29  explicit Operator(int s = 0) { height = width = s; }
30
31  /** @brief Construct an Operator with the given height (output size) and
32  width (input size). */
33  Operator(int h, int w) { height = h; width = w; }
34
35  /// Get the height (size of output) of the Operator. Synonym with NumRows().
36  inline int Height() const { return height; }
37  /** @brief Get the number of rows (size of output) of the Operator. Synonym
38  with Height(). */
39  inline int NumRows() const { return height; }
40
41  /// Get the width (size of input) of the Operator. Synonym with NumCols().
42  inline int Width() const { return width; }
43  /** @brief Get the number of columns (size of input) of the Operator. Synonym
44  with Width(). */
45  inline int NumCols() const { return width; }
46
47  /// Operator application: y=A(x).
48  virtual void Mult(const Vector &x, Vector &y) const = 0;
49
50  /** @brief Action of the transpose operator: y=A^t(x). The default behavior
51  in class Operator is to generate an error. */
52  virtual void MultTranspose(const Vector &x, Vector &y) const
53  { mfem_error("Operator::MultTranspose() is not overloaded!"); }
54
55  /** @brief Evaluate the gradient operator at the point @a x. The default
56  behavior in class Operator is to generate an error. */
57  virtual Operator &GetGradient(const Vector &x) const
58  {
60  return const_cast<Operator &>(*this);
61  }
62
63  /** @brief Prolongation operator from linear algebra (linear system) vectors,
64  to input vectors for the operator. NULL means identity. */
65  virtual const Operator *GetProlongation() const { return NULL; }
66  /** @brief Restriction operator from input vectors for the operator to linear
67  algebra (linear system) vectors. NULL means identity. */
68  virtual const Operator *GetRestriction() const { return NULL; }
69
70  /** @brief Form a constrained linear system using a matrix-free approach.
71
72  Assuming square operator, form the operator linear system A(X)=B,
73  corresponding to it and the right-hand side @a b, by applying any
74  necessary transformations such as: parallel assembly, conforming
75  constraints for non-conforming AMR and eliminating boundary conditions.
76  @note Static condensation and hybridization are not supported for general
77  operators (cf. the analogous methods BilinearForm::FormLinearSystem() and
78  ParBilinearForm::FormLinearSystem()).
79
80  The constraints are specified through the prolongation P from
81  GetProlongation(), and restriction R from GetRestriction() methods, which
82  are e.g. available through the (parallel) finite element space of any
83  (parallel) bilinear form operator. We assume that the operator is square,
84  using the same input and output space, so we have: A(X)=[P^t (*this)
85  P](X), B=P^t(b), and x=P(X).
86
87  The vector @a x must contain the essential boundary condition values.
88  These are eliminated through the ConstrainedOperator class and the vector
89  @a X is initialized by setting its essential entries to the boundary
90  conditions and all other entries to zero (@a copy_interior == 0) or
91  copied from @a x (@a copy_interior != 0).
92
93  After solving the system A(X)=B, the (finite element) solution @a x can
94  be recovered by calling Operator::RecoverFEMSolution() with the same
95  vectors @a X, @a b, and @a x.
96
97  @note The caller is responsible for destroying the output operator @a A!
98  @note If there are no transformations, @a X simply reuses the data of @a
99  x. */
100  void FormLinearSystem(const Array<int> &ess_tdof_list,
101  Vector &x, Vector &b,
102  Operator* &A, Vector &X, Vector &B,
103  int copy_interior = 0);
104
105  /** @brief Reconstruct a solution vector @a x (e.g. a GridFunction) from the
106  solution @a X of a constrained linear system obtained from
107  Operator::FormLinearSystem().
108
109  Call this method after solving a linear system constructed using
110  Operator::FormLinearSystem() to recover the solution as an input vector,
111  @a x, for this Operator (presumably a finite element grid function). This
112  method has identical signature to the analogous method for bilinear
113  forms, though currently @a b is not used in the implementation. */
114  virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x);
115
116  /// Prints operator with input size n and output size m in Matlab format.
117  void PrintMatlab(std::ostream & out, int n = 0, int m = 0) const;
118
119  /// Virtual destructor.
120  virtual ~Operator() { }
121
122  /// Enumeration defining IDs for some classes derived from Operator.
123  /** This enumeration is primarily used with class OperatorHandle. */
124  enum Type
125  {
126  ANY_TYPE, ///< ID for the base class Operator, i.e. any type.
127  MFEM_SPARSEMAT, ///< ID for class SparseMatrix
128  Hypre_ParCSR, ///< ID for class HypreParMatrix.
129  PETSC_MATAIJ, ///< ID for class PetscParMatrix, MATAIJ format.
130  PETSC_MATIS, ///< ID for class PetscParMatrix, MATIS format.
131  PETSC_MATSHELL, ///< ID for class PetscParMatrix, MATSHELL format.
132  PETSC_MATNEST, ///< ID for class PetscParMatrix, MATNEST format.
133  PETSC_MATHYPRE, ///< ID for class PetscParMatrix, MATHYPRE format.
134  PETSC_MATGENERIC ///< ID for class PetscParMatrix, unspecified format.
135  };
136
137  /// Return the type ID of the Operator class.
138  /** This method is intentionally non-virtual, so that it returns the ID of
139  the specific pointer or reference type used when calling this method. If
140  not overridden by derived classes, they will automatically use the type ID
141  of the base Operator class, ANY_TYPE. */
142  Type GetType() const { return ANY_TYPE; }
143 };
144
145
146 /// Base abstract class for time dependent operators.
147 /** Operator of the form: (x,t) -> f(x,t), where k = f(x,t) generally solves the
148  algebraic equation F(x,k,t) = G(x,t). The functions F and G represent the
149  _implicit_ and _explicit_ parts of the operator, respectively. For explicit
150  operators, F(x,k,t) = k, so f(x,t) = G(x,t).*/
152 {
153 public:
154  enum Type
155  {
156  EXPLICIT, ///< This type assumes F(x,k,t) = k, i.e. k = f(x,t) = G(x,t).
157  IMPLICIT, ///< This is the most general type, no assumptions on F and G.
158  HOMOGENEOUS ///< This type assumes that G(x,t) = 0.
159  };
160
161 protected:
162  double t; ///< Current time.
163  Type type; ///< Describes the form of the TimeDependentOperator.
164
165 public:
166  /** @brief Construct a "square" TimeDependentOperator y = f(x,t), where x and
167  y have the same dimension @a n. */
168  explicit TimeDependentOperator(int n = 0, double t_ = 0.0,
169  Type type_ = EXPLICIT)
170  : Operator(n) { t = t_; type = type_; }
171
172  /** @brief Construct a TimeDependentOperator y = f(x,t), where x and y have
173  dimensions @a w and @a h, respectively. */
174  TimeDependentOperator(int h, int w, double t_ = 0.0, Type type_ = EXPLICIT)
175  : Operator(h, w) { t = t_; type = type_; }
176
177  /// Read the currently set time.
178  virtual double GetTime() const { return t; }
179
180  /// Set the current time.
181  virtual void SetTime(const double _t) { t = _t; }
182
183  /// True if #type is #EXPLICIT.
184  bool isExplicit() const { return (type == EXPLICIT); }
185  /// True if #type is #IMPLICIT or #HOMOGENEOUS.
186  bool isImplicit() const { return !isExplicit(); }
187  /// True if #type is #HOMOGENEOUS.
188  bool isHomogeneous() const { return (type == HOMOGENEOUS); }
189
190  /** @brief Perform the action of the explicit part of the operator, G:
191  @a y = G(@a x, t) where t is the current time.
192
193  Presently, this method is used by some PETSc ODE solvers, for more
194  details, see the PETSc Manual. */
195  virtual void ExplicitMult(const Vector &x, Vector &y) const
196  {
197  mfem_error("TimeDependentOperator::ExplicitMult() is not overridden!");
198  }
199
200  /** @brief Perform the action of the implicit part of the operator, F:
201  @a y = F(@a x, @a k, t) where t is the current time.
202
203  Presently, this method is used by some PETSc ODE solvers, for more
204  details, see the PETSc Manual.*/
205  virtual void ImplicitMult(const Vector &x, const Vector &k, Vector &y) const
206  {
207  mfem_error("TimeDependentOperator::ImplicitMult() is not overridden!");
208  }
209
210  /** @brief Perform the action of the operator: @a y = k = f(@a x, t), where
211  k solves the algebraic equation F(@a x, k, t) = G(@a x, t) and t is the
212  current time. */
213  virtual void Mult(const Vector &x, Vector &y) const
214  {
215  mfem_error("TimeDependentOperator::Mult() is not overridden!");
216  }
217
218  /** @brief Solve the equation: @a k = f(@a x + @a dt @a k, t), for the
219  unknown @a k at the current time t.
220
221  For general F and G, the equation for @a k becomes:
222  F(@a x + @a dt @a k, @a k, t) = G(@a x + @a dt @a k, t).
223
224  The input vector @a x corresponds to time index (or cycle) n, while the
225  currently set time, #t, and the result vector @a k correspond to time
226  index n+1. The time step @a dt corresponds to the time interval between
227  cycles n and n+1.
228
229  This method allows for the abstract implementation of some time
230  integration methods, including diagonal implicit Runge-Kutta (DIRK)
231  methods and the backward Euler method in particular.
232
233  If not re-implemented, this method simply generates an error. */
234  virtual void ImplicitSolve(const double dt, const Vector &x, Vector &k)
235  {
236  mfem_error("TimeDependentOperator::ImplicitSolve() is not overridden!");
237  }
238
239  /** @brief Return an Operator representing (dF/dk @a shift + dF/dx) at the
240  given @a x, @a k, and the currently set time.
241
242  Presently, this method is used by some PETSc ODE solvers, for more
243  details, see the PETSc Manual. */
244  virtual Operator& GetImplicitGradient(const Vector &x, const Vector &k,
245  double shift) const
246  {
248  "not overridden!");
249  return const_cast<Operator &>(dynamic_cast<const Operator &>(*this));
250  }
251
252  /** @brief Return an Operator representing dG/dx at the given point @a x and
253  the currently set time.
254
255  Presently, this method is used by some PETSc ODE solvers, for more
256  details, see the PETSc Manual. */
257  virtual Operator& GetExplicitGradient(const Vector &x) const
258  {
260  "not overridden!");
261  return const_cast<Operator &>(dynamic_cast<const Operator &>(*this));
262  }
263
265 };
266
267 /// Base class for solvers
268 class Solver : public Operator
269 {
270 public:
271  /// If true, use the second argument of Mult() as an initial guess.
273
274  /** @brief Initialize a square Solver with size @a s.
275
276  @warning Use a Boolean expression for the second parameter (not an int)
277  to distinguish this call from the general rectangular constructor. */
278  explicit Solver(int s = 0, bool iter_mode = false)
279  : Operator(s) { iterative_mode = iter_mode; }
280
281  /// Initialize a Solver with height @a h and width @a w.
282  Solver(int h, int w, bool iter_mode = false)
283  : Operator(h, w) { iterative_mode = iter_mode; }
284
285  /// Set/update the solver for the given operator.
286  virtual void SetOperator(const Operator &op) = 0;
287 };
288
289
290 /// Identity Operator I: x -> x.
292 {
293 public:
294  /// Create an identity operator of size @a n.
295  explicit IdentityOperator(int n) : Operator(n) { }
296
297  /// Operator application
298  virtual void Mult(const Vector &x, Vector &y) const { y = x; }
299 };
300
301
302 /** @brief The transpose of a given operator. Switches the roles of the methods
303  Mult() and MultTranspose(). */
305 {
306 private:
307  const Operator &A;
308
309 public:
310  /// Construct the transpose of a given operator @a *a.
312  : Operator(a->Width(), a->Height()), A(*a) { }
313
314  /// Construct the transpose of a given operator @a a.
316  : Operator(a.Width(), a.Height()), A(a) { }
317
318  /// Operator application. Apply the transpose of the original Operator.
319  virtual void Mult(const Vector &x, Vector &y) const
320  { A.MultTranspose(x, y); }
321
322  /// Application of the transpose. Apply the original Operator.
323  virtual void MultTranspose(const Vector &x, Vector &y) const
324  { A.Mult(x, y); }
325 };
326
327
328 /// General product operator: x -> (A*B)(x) = A(B(x)).
329 class ProductOperator : public Operator
330 {
331  const Operator *A, *B;
332  bool ownA, ownB;
333  mutable Vector z;
334
335 public:
336  ProductOperator(const Operator *A, const Operator *B, bool ownA, bool ownB);
337
338  virtual void Mult(const Vector &x, Vector &y) const
339  { B->Mult(x, z); A->Mult(z, y); }
340
341  virtual void MultTranspose(const Vector &x, Vector &y) const
342  { A->MultTranspose(x, z); B->MultTranspose(z, y); }
343
344  virtual ~ProductOperator();
345 };
346
347
348 /// The operator x -> R*A*P*x constructed through the actions of R^T, A and P
349 class RAPOperator : public Operator
350 {
351 private:
352  const Operator & Rt;
353  const Operator & A;
354  const Operator & P;
355  mutable Vector Px;
356  mutable Vector APx;
357
358 public:
359  /// Construct the RAP operator given R^T, A and P.
360  RAPOperator(const Operator &Rt_, const Operator &A_, const Operator &P_);
361
362  /// Operator application.
363  virtual void Mult(const Vector & x, Vector & y) const
364  { P.Mult(x, Px); A.Mult(Px, APx); Rt.MultTranspose(APx, y); }
365
366  /// Application of the transpose.
367  virtual void MultTranspose(const Vector & x, Vector & y) const
368  { Rt.Mult(x, APx); A.MultTranspose(APx, Px); P.MultTranspose(Px, y); }
369 };
370
371
372 /// General triple product operator x -> A*B*C*x, with ownership of the factors.
374 {
375  const Operator *A;
376  const Operator *B;
377  const Operator *C;
378  bool ownA, ownB, ownC;
379  mutable Vector t1, t2;
380
381 public:
382  TripleProductOperator(const Operator *A, const Operator *B,
383  const Operator *C, bool ownA, bool ownB, bool ownC);
384
385  virtual void Mult(const Vector &x, Vector &y) const
386  { C->Mult(x, t1); B->Mult(t1, t2); A->Mult(t2, y); }
387
388  virtual void MultTranspose(const Vector &x, Vector &y) const
389  { A->MultTranspose(x, t2); B->MultTranspose(t2, t1); C->MultTranspose(t1, y); }
390
391  virtual ~TripleProductOperator();
392 };
393
394
395 /** @brief Square Operator for imposing essential boundary conditions using only
396  the action, Mult(), of a given unconstrained Operator.
397
398  Square operator constrained by fixing certain entries in the solution to
399  given "essential boundary condition" values. This class is used by the
400  general, matrix-free system formulation of Operator::FormLinearSystem. */
402 {
403 protected:
404  Array<int> constraint_list; ///< List of constrained indices/dofs.
405  Operator *A; ///< The unconstrained Operator.
406  bool own_A; ///< Ownership flag for A.
407  mutable Vector z, w; ///< Auxiliary vectors.
408
409 public:
410  /** @brief Constructor from a general Operator and a list of essential
411  indices/dofs.
412
413  Specify the unconstrained operator @a *A and a @a list of indices to
414  constrain, i.e. each entry @a list[i] represents an essential-dof. If the
415  ownership flag @a own_A is true, the operator @a *A will be destroyed
416  when this object is destroyed. */
417  ConstrainedOperator(Operator *A, const Array<int> &list, bool own_A = false);
418
419  /** @brief Eliminate "essential boundary condition" values specified in @a x
420  from the given right-hand side @a b.
421
422  Performs the following steps:
423
424  z = A((0,x_b)); b_i -= z_i; b_b = x_b;
425
426  where the "_b" subscripts denote the essential (boundary) indices/dofs of
427  the vectors, and "_i" -- the rest of the entries. */
428  void EliminateRHS(const Vector &x, Vector &b) const;
429
430  /** @brief Constrained operator action.
431
432  Performs the following steps:
433
434  z = A((x_i,0)); y_i = z_i; y_b = x_b;
435
436  where the "_b" subscripts denote the essential (boundary) indices/dofs of
437  the vectors, and "_i" -- the rest of the entries. */
438  virtual void Mult(const Vector &x, Vector &y) const;
439
440  /// Destructor: destroys the unconstrained Operator @a A if @a own_A is true.
441  virtual ~ConstrainedOperator() { if (own_A) { delete A; } }
442 };
443
444 }
445
446 #endif
virtual double GetTime() const
Definition: operator.hpp:178
bool isImplicit() const
True if type is IMPLICIT or HOMOGENEOUS.
Definition: operator.hpp:186
bool isHomogeneous() const
True if type is HOMOGENEOUS.
Definition: operator.hpp:188
Solver(int s=0, bool iter_mode=false)
Initialize a square Solver with size s.
Definition: operator.hpp:278
virtual ~ProductOperator()
Definition: operator.cpp:108
Array< int > constraint_list
List of constrained indices/dofs.
Definition: operator.hpp:404
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
Definition: operator.hpp:363
Type type
Describes the form of the TimeDependentOperator.
Definition: operator.hpp:163
Base abstract class for time dependent operators.
Definition: operator.hpp:151
virtual Operator & GetGradient(const Vector &x) const
Evaluate the gradient operator at the point x. The default behavior in class Operator is to generate ...
Definition: operator.hpp:57
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Definition: operator.hpp:42
virtual void Mult(const Vector &x, Vector &y) const
Constrained operator action.
Definition: operator.cpp:182
virtual void SetTime(const double _t)
Set the current time.
Definition: operator.hpp:181
ProductOperator(const Operator *A, const Operator *B, bool ownA, bool ownB)
Definition: operator.cpp:98
ID for class PetscParMatrix, MATHYPRE format.
Definition: operator.hpp:133
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
virtual void MultTranspose(const Vector &x, Vector &y) const
Application of the transpose. Apply the original Operator.
Definition: operator.hpp:323
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
Definition: operator.hpp:272
virtual Operator & GetExplicitGradient(const Vector &x) const
Return an Operator representing dG/dx at the given point x and the currently set time.
Definition: operator.hpp:257
bool own_A
Ownership flag for A.
Definition: operator.hpp:406
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 ...
Definition: operator.hpp:52
Solver(int h, int w, bool iter_mode=false)
Initialize a Solver with height h and width w.
Definition: operator.hpp:282
double t
Current time.
Definition: operator.hpp:162
virtual void Mult(const Vector &x, Vector &y) const
Operator application. Apply the transpose of the original Operator.
Definition: operator.hpp:319
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...
Definition: operator.hpp:244
ID for class SparseMatrix.
Definition: operator.hpp:127
virtual const Operator * GetProlongation() const
Prolongation operator from linear algebra (linear system) vectors, to input vectors for the operator...
Definition: operator.hpp:65
TransposeOperator(const Operator &a)
Construct the transpose of a given operator a.
Definition: operator.hpp:315
virtual void MultTranspose(const Vector &x, Vector &y) const
Application of the transpose.
Definition: operator.hpp:367
General product operator: x -&gt; (A*B)(x) = A(B(x)).
Definition: operator.hpp:329
ID for the base class Operator, i.e. any type.
Definition: operator.hpp:126
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Definition: operator.hpp:36
virtual ~ConstrainedOperator()
Destructor: destroys the unconstrained Operator A if own_A is true.
Definition: operator.hpp:441
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
Definition: error.cpp:146
This type assumes F(x,k,t) = k, i.e. k = f(x,t) = G(x,t).
Definition: operator.hpp:156
ID for class PetscParMatrix, unspecified format.
Definition: operator.hpp:134
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...
Definition: operator.hpp:174
The operator x -&gt; R*A*P*x constructed through the actions of R^T, A and P.
Definition: operator.hpp:349
ID for class PetscParMatrix, MATNEST format.
Definition: operator.hpp:132
bool isExplicit() const
True if type is EXPLICIT.
Definition: operator.hpp:184
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.
Definition: operator.hpp:234
RAPOperator(const Operator &Rt_, const Operator &A_, const Operator &P_)
Construct the RAP operator given R^T, A and P.
Definition: operator.cpp:115
virtual const Operator * GetRestriction() const
Restriction operator from input vectors for the operator to linear algebra (linear system) vectors...
Definition: operator.hpp:68
This is the most general type, no assumptions on F and G.
Definition: operator.hpp:157
ID for class PetscParMatrix, MATSHELL format.
Definition: operator.hpp:131
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
Definition: operator.hpp:385
Operator(int s=0)
Construct a square Operator with given size s (default 0).
Definition: operator.hpp:29
IdentityOperator(int n)
Create an identity operator of size n.
Definition: operator.hpp:295
Type
Enumeration defining IDs for some classes derived from Operator.
Definition: operator.hpp:124
TimeDependentOperator(int n=0, double t_=0.0, Type type_=EXPLICIT)
Construct a &quot;square&quot; TimeDependentOperator y = f(x,t), where x and y have the same dimension n...
Definition: operator.hpp:168
Vector w
Auxiliary vectors.
Definition: operator.hpp:407
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...
Definition: operator.hpp:213
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...
Definition: operator.hpp:195
int NumRows() const
Get the number of rows (size of output) of the Operator. Synonym with Height().
Definition: operator.hpp:39
int NumCols() const
Get the number of columns (size of input) of the Operator. Synonym with Width().
Definition: operator.hpp:45
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.
Definition: operator.cpp:21
The transpose of a given operator. Switches the roles of the methods Mult() and MultTranspose().
Definition: operator.hpp:304
Type GetType() const
Return the type ID of the Operator class.
Definition: operator.hpp:142
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...
Definition: operator.cpp:57
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 ...
Definition: operator.hpp:341
int height
Dimension of the output / number of rows in the matrix.
Definition: operator.hpp:24
This type assumes that G(x,t) = 0.
Definition: operator.hpp:158
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate &quot;essential boundary condition&quot; values specified in x from the given right-hand side b...
Definition: operator.cpp:163
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.
Definition: operator.cpp:72
ID for class PetscParMatrix, MATAIJ format.
Definition: operator.hpp:129
General triple product operator x -&gt; A*B*C*x, with ownership of the factors.
Definition: operator.hpp:373
ConstrainedOperator(Operator *A, const Array< int > &list, bool own_A=false)
Constructor from a general Operator and a list of essential indices/dofs.
Definition: operator.cpp:154
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
Definition: operator.hpp:298
Operator(int h, int w)
Construct an Operator with the given height (output size) and width (input size). ...
Definition: operator.hpp:33
TripleProductOperator(const Operator *A, const Operator *B, const Operator *C, bool ownA, bool ownB, bool ownC)
Definition: operator.cpp:129
virtual void SetOperator(const Operator &op)=0
Set/update the solver for the given operator.
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
Definition: operator.hpp:338
Vector data type.
Definition: vector.hpp:48
Identity Operator I: x -&gt; x.
Definition: operator.hpp:291
ID for class HypreParMatrix.
Definition: operator.hpp:128
TransposeOperator(const Operator *a)
Construct the transpose of a given operator *a.
Definition: operator.hpp:311
Base class for solvers.
Definition: operator.hpp:268
Operator * A
The unconstrained Operator.
Definition: operator.hpp:405
Square Operator for imposing essential boundary conditions using only the action, Mult()...
Definition: operator.hpp:401
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
Definition: globals.hpp:64
Abstract operator.
Definition: operator.hpp:21
virtual ~Operator()
Virtual destructor.
Definition: operator.hpp:120
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 ...
Definition: operator.hpp:388
ID for class PetscParMatrix, MATIS format.
Definition: operator.hpp:130
int width
Dimension of the input / number of columns in the matrix.
Definition: operator.hpp:25
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...
Definition: operator.hpp:205