MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
operator.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_OPERATOR
13#define MFEM_OPERATOR
14
15#include "vector.hpp"
16
17namespace mfem
18{
19
20class ConstrainedOperator;
21class RectangularConstrainedOperator;
22
23/// Abstract operator
25{
26protected:
27 int height; ///< Dimension of the output / number of rows in the matrix.
28 int width; ///< Dimension of the input / number of columns in the matrix.
29
30 /// see FormSystemOperator()
31 /** @note Uses DiagonalPolicy::DIAG_ONE. */
33 const Array<int> &ess_tdof_list, ConstrainedOperator* &Aout);
34
35 /// see FormRectangularSystemOperator()
37 const Array<int> &trial_tdof_list,
38 const Array<int> &test_tdof_list,
40
41 /** @brief Returns RAP Operator of this, using input/output Prolongation matrices
42 @a Pi corresponds to "P", @a Po corresponds to "Rt" */
43 Operator *SetupRAP(const Operator *Pi, const Operator *Po);
44
45public:
46 /// Defines operator diagonal policy upon elimination of rows and/or columns.
48 {
49 DIAG_ZERO, ///< Set the diagonal value to zero
50 DIAG_ONE, ///< Set the diagonal value to one
51 DIAG_KEEP ///< Keep the diagonal value
52 };
53
54 /// Initializes memory for true vectors of linear system
55 void InitTVectors(const Operator *Po, const Operator *Ri, const Operator *Pi,
56 Vector &x, Vector &b, Vector &X, Vector &B) const;
57
58 /// Construct a square Operator with given size s (default 0).
59 explicit Operator(int s = 0) { height = width = s; }
60
61 /** @brief Construct an Operator with the given height (output size) and
62 width (input size). */
63 Operator(int h, int w) { height = h; width = w; }
64
65 /// Get the height (size of output) of the Operator. Synonym with NumRows().
66 inline int Height() const { return height; }
67 /** @brief Get the number of rows (size of output) of the Operator. Synonym
68 with Height(). */
69 inline int NumRows() const { return height; }
70
71 /// Get the width (size of input) of the Operator. Synonym with NumCols().
72 inline int Width() const { return width; }
73 /** @brief Get the number of columns (size of input) of the Operator. Synonym
74 with Width(). */
75 inline int NumCols() const { return width; }
76
77 /// Return the MemoryClass preferred by the Operator.
78 /** This is the MemoryClass that will be used to access the input and output
79 vectors in the Mult() and MultTranspose() methods.
80
81 For example, classes using the mfem::forall macro for implementation can
82 return the value returned by Device::GetMemoryClass().
83
84 The default implementation of this method in class Operator returns
85 MemoryClass::HOST. */
86 virtual MemoryClass GetMemoryClass() const { return MemoryClass::HOST; }
87
88 /// Operator application: `y=A(x)`.
89 virtual void Mult(const Vector &x, Vector &y) const = 0;
90
91 /** @brief Action of the absolute-value operator: `y=|A|(x)`. The default
92 behavior in class Operator is to generate an error. If the Operator is a
93 composition of several operators, the composition unfold into a product
94 of absolute-value operators too. */
95 virtual void AbsMult(const Vector &x, Vector &y) const
96 { MFEM_ABORT("Operator::AbsMult() is not overridden!"); }
97
98 /** @brief Action of the transpose operator: `y=A^t(x)`. The default behavior
99 in class Operator is to generate an error. */
100 virtual void MultTranspose(const Vector &x, Vector &y) const
101 { MFEM_ABORT("Operator::MultTranspose() is not overridden!"); }
102
103 /** @brief Action of the transpose absolute-value operator: `y=|A|^t(x)`.
104 The default behavior in class Operator is to generate an error. */
105 virtual void AbsMultTranspose(const Vector &x, Vector &y) const
106 { MFEM_ABORT("Operator::AbsMultTranspose() is not overridden!"); }
107
108 /// Operator application: `y+=A(x)` (default) or `y+=a*A(x)`.
109 virtual void AddMult(const Vector &x, Vector &y, const real_t a = 1.0) const;
110
111 /// Operator transpose application: `y+=A^t(x)` (default) or `y+=a*A^t(x)`.
112 virtual void AddMultTranspose(const Vector &x, Vector &y,
113 const real_t a = 1.0) const;
114
115 /// Operator application on a matrix: `Y=A(X)`.
116 virtual void ArrayMult(const Array<const Vector *> &X,
117 Array<Vector *> &Y) const;
118
119 /// Action of the transpose operator on a matrix: `Y=A^t(X)`.
120 virtual void ArrayMultTranspose(const Array<const Vector *> &X,
121 Array<Vector *> &Y) const;
122
123 /// Operator application on a matrix: `Y+=A(X)` (default) or `Y+=a*A(X)`.
124 virtual void ArrayAddMult(const Array<const Vector *> &X, Array<Vector *> &Y,
125 const real_t a = 1.0) const;
126
127 /** @brief Operator transpose application on a matrix: `Y+=A^t(X)` (default)
128 or `Y+=a*A^t(X)`. */
129 virtual void ArrayAddMultTranspose(const Array<const Vector *> &X,
130 Array<Vector *> &Y, const real_t a = 1.0) const;
131
132 /** @brief Evaluate the gradient operator at the point @a x. The default
133 behavior in class Operator is to generate an error. */
134 virtual Operator &GetGradient(const Vector &x) const
135 {
136 MFEM_ABORT("Operator::GetGradient() is not overridden!");
137 return const_cast<Operator &>(*this);
138 }
139
140 /** @brief Computes the diagonal entries into @a diag. Typically, this
141 operation only makes sense for linear Operator%s. In some cases, only an
142 approximation of the diagonal is computed. */
143 virtual void AssembleDiagonal(Vector &diag) const
144 {
145 MFEM_CONTRACT_VAR(diag);
146 MFEM_ABORT("Not relevant or not implemented for this Operator.");
147 }
148
149 /** @brief Prolongation operator from linear algebra (linear system) vectors,
150 to input vectors for the operator. `NULL` means identity. */
151 virtual const Operator *GetProlongation() const { return NULL; }
152
153 /** @brief Restriction operator from input vectors for the operator to linear
154 algebra (linear system) vectors. `NULL` means identity. */
155 virtual const Operator *GetRestriction() const { return NULL; }
156
157 /** @brief Prolongation operator from linear algebra (linear system) vectors,
158 to output vectors for the operator. `NULL` means identity. */
159 virtual const Operator *GetOutputProlongation() const
160 {
161 return GetProlongation(); // Assume square unless specialized
162 }
163
164 /** @brief Transpose of GetOutputRestriction, directly available in this
165 form to facilitate matrix-free RAP-type operators.
166
167 `NULL` means identity. */
168 virtual const Operator *GetOutputRestrictionTranspose() const { return NULL; }
169
170 /** @brief Restriction operator from output vectors for the operator to linear
171 algebra (linear system) vectors. `NULL` means identity. */
172 virtual const Operator *GetOutputRestriction() const
173 {
174 return GetRestriction(); // Assume square unless specialized
175 }
176
177 /** @brief Form a constrained linear system using a matrix-free approach.
178
179 Assuming square operator, form the operator linear system `A(X)=B`,
180 corresponding to it and the right-hand side @a b, by applying any
181 necessary transformations such as: parallel assembly, conforming
182 constraints for non-conforming AMR and eliminating boundary conditions.
183 @note Static condensation and hybridization are not supported for general
184 operators (cf. the analogous methods BilinearForm::FormLinearSystem() and
185 ParBilinearForm::FormLinearSystem()).
186
187 The constraints are specified through the prolongation P from
188 GetProlongation(), and restriction R from GetRestriction() methods, which
189 are e.g. available through the (parallel) finite element space of any
190 (parallel) bilinear form operator. We assume that the operator is square,
191 using the same input and output space, so we have: `A(X)=[P^t (*this)
192 P](X)`, `B=P^t(b)`, and `X=R(x)`.
193
194 The vector @a x must contain the essential boundary condition values.
195 These are eliminated through the ConstrainedOperator class and the vector
196 @a X is initialized by setting its essential entries to the boundary
197 conditions and all other entries to zero (@a copy_interior == 0) or
198 copied from @a x (@a copy_interior != 0).
199
200 After solving the system `A(X)=B`, the (finite element) solution @a x can
201 be recovered by calling Operator::RecoverFEMSolution() with the same
202 vectors @a X, @a b, and @a x.
203
204 @note The caller is responsible for destroying the output operator @a A!
205 @note If there are no transformations, @a X simply reuses the data of @a
206 x. */
207 void FormLinearSystem(const Array<int> &ess_tdof_list,
208 Vector &x, Vector &b,
209 Operator* &A, Vector &X, Vector &B,
210 int copy_interior = 0);
211
212 /** @brief Form a column-constrained linear system using a matrix-free approach.
213
214 Form the operator linear system `A(X)=B` corresponding to the operator
215 and the right-hand side @a b, by applying any necessary transformations
216 such as: parallel assembly, conforming constraints for non-conforming AMR
217 and eliminating boundary conditions. @note Static condensation and
218 hybridization are not supported for general operators (cf. the method
219 MixedBilinearForm::FormRectangularLinearSystem())
220
221 The constraints are specified through the input prolongation Pi from
222 GetProlongation(), and output restriction Ro from GetOutputRestriction()
223 methods, which are e.g. available through the (parallel) finite element
224 spaces of any (parallel) mixed bilinear form operator. So we have:
225 `A(X)=[Ro (*this) Pi](X)`, `B=Ro(b)`, and `X=Pi^T(x)`.
226
227 The vector @a x must contain the essential boundary condition values.
228 The "columns" in this operator corresponding to these values are
229 eliminated through the RectangularConstrainedOperator class.
230
231 After solving the system `A(X)=B`, the (finite element) solution @a x can
232 be recovered by calling Operator::RecoverFEMSolution() with the same
233 vectors @a X, @a b, and @a x.
234
235 @note The caller is responsible for destroying the output operator @a A!
236 @note If there are no transformations, @a X simply reuses the data of @a
237 x. */
238 void FormRectangularLinearSystem(const Array<int> &trial_tdof_list,
239 const Array<int> &test_tdof_list,
240 Vector &x, Vector &b,
241 Operator* &A, Vector &X, Vector &B);
242
243 /** @brief Reconstruct a solution vector @a x (e.g. a GridFunction) from the
244 solution @a X of a constrained linear system obtained from
245 Operator::FormLinearSystem() or Operator::FormRectangularLinearSystem().
246
247 Call this method after solving a linear system constructed using
248 Operator::FormLinearSystem() to recover the solution as an input vector,
249 @a x, for this Operator (presumably a finite element grid function). This
250 method has identical signature to the analogous method for bilinear
251 forms, though currently @a b is not used in the implementation. */
252 virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x);
253
254 /** @brief Return in @a A a parallel (on truedofs) version of this square
255 operator.
256
257 This returns the same operator as FormLinearSystem(), but does without
258 the transformations of the right-hand side and initial guess. */
259 void FormSystemOperator(const Array<int> &ess_tdof_list,
260 Operator* &A);
261
262 /** @brief Return in @a A a parallel (on truedofs) version of this
263 rectangular operator (including constraints).
264
265 This returns the same operator as FormRectangularLinearSystem(), but does
266 without the transformations of the right-hand side. */
267 void FormRectangularSystemOperator(const Array<int> &trial_tdof_list,
268 const Array<int> &test_tdof_list,
269 Operator* &A);
270
271 /** @brief Return in @a A a parallel (on truedofs) version of this
272 rectangular operator.
273
274 This is similar to FormSystemOperator(), but for dof-to-dof mappings
275 (discrete linear operators), which can also correspond to rectangular
276 matrices. The user should provide specializations of GetProlongation()
277 for the input dofs and GetOutputRestriction() for the output dofs in
278 their Operator implementation that are appropriate for the two spaces the
279 Operator maps between. These are e.g. available through the (parallel)
280 finite element space of any (parallel) bilinear form operator. We have:
281 `A(X)=[Rout (*this) Pin](X)`. */
283
284 /// Prints operator with input size n and output size m in Matlab format.
285 void PrintMatlab(std::ostream & out, int n, int m = 0) const;
286
287 /// Prints operator in Matlab format.
288 virtual void PrintMatlab(std::ostream & out) const;
289
290 /// Virtual destructor.
291 virtual ~Operator() { }
292
293 /// Enumeration defining IDs for some classes derived from Operator.
294 /** This enumeration is primarily used with class OperatorHandle. */
295 enum Type
296 {
297 ANY_TYPE, ///< ID for the base class Operator, i.e. any type.
298 MFEM_SPARSEMAT, ///< ID for class SparseMatrix.
299 Hypre_ParCSR, ///< ID for class HypreParMatrix.
300 PETSC_MATAIJ, ///< ID for class PetscParMatrix, MATAIJ format.
301 PETSC_MATIS, ///< ID for class PetscParMatrix, MATIS format.
302 PETSC_MATSHELL, ///< ID for class PetscParMatrix, MATSHELL format.
303 PETSC_MATNEST, ///< ID for class PetscParMatrix, MATNEST format.
304 PETSC_MATHYPRE, ///< ID for class PetscParMatrix, MATHYPRE format.
305 PETSC_MATGENERIC, ///< ID for class PetscParMatrix, unspecified format.
306 Complex_Operator, ///< ID for class ComplexOperator.
307 MFEM_ComplexSparseMat, ///< ID for class ComplexSparseMatrix.
308 Complex_Hypre_ParCSR, ///< ID for class ComplexHypreParMatrix.
309 Complex_DenseMat, ///< ID for class ComplexDenseMatrix
310 MFEM_Block_Matrix, ///< ID for class BlockMatrix.
311 MFEM_Block_Operator ///< ID for the base class BlockOperator.
312 };
313
314 /// Return the type ID of the Operator class.
315 /** This method is intentionally non-virtual, so that it returns the ID of
316 the specific pointer or reference type used when calling this method. If
317 not overridden by derived classes, they will automatically use the type ID
318 of the base Operator class, ANY_TYPE. */
319 Type GetType() const { return ANY_TYPE; }
320};
321
322
323/// Base abstract class for first order time dependent operators.
324/** Operator of the form: (u,t) -> k(u,t), where k generally solves the
325 algebraic equation F(u,k,t) = G(u,t). The functions F and G represent the
326 _implicit_ and _explicit_ parts of the operator, respectively.
327
328 A common use for this class is representing a differential algebraic
329 equation of the form $ F(y,\frac{dy}{dt},t) = G(y,t) $.
330
331 For example, consider an ordinary differential equation of the form
332 $ M \frac{dy}{dt} = g(y,t) $. There are various ways of expressing this ODE
333 as a TimeDependentOperator depending on the choices for F and G. Here are
334 some common choices:
335
336 1. F(u,k,t) = k and G(u,t) = inv(M) g(u,t),
337 2. F(u,k,t) = M k and G(u,t) = g(u,t),
338 3. F(u,k,t) = M k - g(u,t) and G(u,t) = 0.
339
340 Note that depending on the ODE solver, some of the above choices may be
341 preferable to the others.
342*/
344{
345public:
346 /// Enum used to describe the form of the time-dependent operator.
347 /** The type should be set by classes derived from TimeDependentOperator to
348 describe the form, in terms of the functions F and G, used by the
349 specific derived class. This information can be queried by classes or
350 functions (like time stepping algorithms) to make choices about the
351 algorithm to use, or to ensure that the TimeDependentOperator uses the
352 form expected by the class/function.
353
354 For example, assume that a derived class is implementing the ODE
355 $M \frac{dy}{dt} = g(y,t)$ and chooses to define $F(u,k,t) = M k$ and
356 $G(u,t) = g(u,t)$. Then it cannot use type EXPLICIT, unless $M = I$, or
357 type HOMOGENEOUS, unless $g(u,t) = 0$. If, on the other hand, the derived
358 class chooses to define $F(u,k,t) = k$ and $G(u,t) = M^{-1} g(y,t)$, then
359 the natural choice is to set the type to EXPLICIT, even though setting it
360 to IMPLICIT is also not wrong -- doing so will simply fail to inform
361 methods that query this information that it uses a more specific
362 implementation, EXPLICIT, that may allow the use of algorithms that
363 support only the EXPLICIT type. */
364 enum Type
365 {
366 EXPLICIT, ///< This type assumes F(u,k,t) = k.
367 IMPLICIT, ///< This is the most general type, no assumptions on F and G.
368 HOMOGENEOUS ///< This type assumes that G(u,t) = 0.
369 };
370
371 /// Evaluation mode. See SetEvalMode() for details.
373 {
374 /** Normal evaluation. */
376 /** Assuming additive split, k(u,t) = k1(u,t) + k2(u,t), evaluate the
377 first term, k1. */
379 /** Assuming additive split, k(u,t) = k1(u,t) + k2(u,t), evaluate the
380 second term, k2. */
382 };
383
384protected:
385 real_t t; ///< Current time.
386 Type type; /**< @brief Describes the form of the TimeDependentOperator, see
387 the documentation of #Type. */
388 EvalMode eval_mode; ///< Current evaluation mode.
389
390public:
391 /** @brief Construct a "square" TimeDependentOperator (u,t) -> k(u,t), where
392 u and k have the same dimension @a n. */
393 explicit TimeDependentOperator(int n = 0, real_t t_ = 0.0,
394 Type type_ = EXPLICIT)
395 : Operator(n) { t = t_; type = type_; eval_mode = NORMAL; }
396
397 /** @brief Construct a TimeDependentOperator (u,t) -> k(u,t), where u and k
398 have dimensions @a w and @a h, respectively. */
399 TimeDependentOperator(int h, int w, double t_ = 0.0, Type type_ = EXPLICIT)
400 : Operator(h, w) { t = t_; type = type_; eval_mode = NORMAL; }
401
402 /// Read the currently set time.
403 virtual real_t GetTime() const { return t; }
404
405 /// Set the current time.
406 virtual void SetTime(const real_t t_) { t = t_; }
407
408 /// True if #type is #EXPLICIT.
409 bool isExplicit() const { return (type == EXPLICIT); }
410 /// True if #type is #IMPLICIT or #HOMOGENEOUS.
411 bool isImplicit() const { return !isExplicit(); }
412 /// True if #type is #HOMOGENEOUS.
413 bool isHomogeneous() const { return (type == HOMOGENEOUS); }
414
415 /// Return the current evaluation mode. See SetEvalMode() for details.
416 EvalMode GetEvalMode() const { return eval_mode; }
417
418 /// Set the evaluation mode of the time-dependent operator.
419 /** The evaluation mode is a switch that allows time-stepping methods to
420 request evaluation of separate components/terms of the time-dependent
421 operator. For example, IMEX methods typically assume additive split of
422 the operator: k(u,t) = k1(u,t) + k2(u,t) and they rely on the ability to
423 evaluate the two terms separately.
424
425 Generally, setting the evaluation mode should affect the behavior of all
426 evaluation-related methods in the class, such as Mult(), ImplicitSolve(),
427 etc. However, the exact list of methods that need to support a specific
428 mode will depend on the used time-stepping method. */
429 virtual void SetEvalMode(const EvalMode new_eval_mode)
430 { eval_mode = new_eval_mode; }
431
432 /** @brief Perform the action of the explicit part of the operator, G:
433 @a v = G(@a u, t) where t is the current time.
434
435 Presently, this method is used by some PETSc ODE solvers and the
436 SUNDIALS ARKStep integrator, for more details, see either the PETSc
437 Manual or the ARKode User Guide, respectively. */
438 virtual void ExplicitMult(const Vector &u, Vector &v) const;
439
440 /** @brief Perform the action of the implicit part of the operator, F:
441 @a v = F(@a u, @a k, t) where t is the current time.
442
443 Presently, this method is used by some PETSc ODE solvers, for more
444 details, see the PETSc Manual.*/
445 virtual void ImplicitMult(const Vector &u, const Vector &k, Vector &v) const;
446
447 /** @brief Perform the action of the operator (u,t) -> k(u,t) where t is the
448 current time set by SetTime() and @a k satisfies
449 F(@a u, @a k, t) = G(@a u, t).
450
451 For solving an ordinary differential equation of the form
452 $ M \frac{dy}{dt} = g(y,t) $, recall that F and G can be defined in
453 various ways, e.g.:
454
455 1. F(u,k,t) = k and G(u,t) = inv(M) g(u,t)
456 2. F(u,k,t) = M k and G(u,t) = g(u,t)
457 3. F(u,k,t) = M k - g(u,t) and G(u,t) = 0.
458
459 Regardless of the choice of F and G, this function should always compute
460 @a k = inv(M) g(@a u, t). */
461 void Mult(const Vector &u, Vector &k) const override;
462
463 /** @brief Solve for the unknown @a k, at the current time t, the following
464 equation:
465 F(@a u + @a gamma @a k, @a k, t) = G(@a u + @a gamma @a k, t).
466
467 For solving an ordinary differential equation of the form
468 $ M \frac{dy}{dt} = g(y,t) $, recall that F and G can be defined in
469 various ways, e.g.:
470
471 1. F(u,k,t) = k and G(u,t) = inv(M) g(u,t)
472 2. F(u,k,t) = M k and G(u,t) = g(u,t)
473 3. F(u,k,t) = M k - g(u,t) and G(u,t) = 0
474
475 Regardless of the choice of F and G, this function should solve for @a k
476 in M @a k = g(@a u + @a gamma @a k, t).
477
478 To see how @a k can be useful, consider the backward Euler method defined
479 by $ y(t + \Delta t) = y(t) + \Delta t k_0 $ where
480 $ M k_0 = g \big( y(t) + \Delta t k_0, t + \Delta t \big) $. A backward
481 Euler integrator can use @a k from this function for $k_0$, with the call
482 using @a u set to $ y(t) $, @a gamma set to $ \Delta t$, and time set to
483 $t + \Delta t$. See class BackwardEulerSolver.
484
485 Generalizing further, consider a diagonally implicit Runge-Kutta (DIRK)
486 method defined by
487 $ y(t + \Delta t) = y(t) + \Delta t \sum_{i=1}^s b_i k_i $ where
488 $ M k_i = g \big( y(t) + \Delta t \sum_{j=1}^i a_{ij} k_j,
489 t + c_i \Delta t \big) $.
490 A DIRK integrator can use @a k from this function, with @a u set to
491 $ y(t) + \Delta t \sum_{j=1}^{i-1} a_{ij} k_j $ and @a gamma set to
492 $ a_{ii} \Delta t $, for $ k_i $. For example, see class SDIRK33Solver.
493
494 If not re-implemented, this method simply generates an error. */
495 virtual void ImplicitSolve(const real_t gamma, const Vector &u, Vector &k);
496
497 /** @brief Return an Operator representing (dF/dk @a shift + dF/du) at the
498 given @a u, @a k, and the currently set time.
499
500 Presently, this method is used by some PETSc ODE solvers, for more
501 details, see the PETSc Manual. */
502 virtual Operator& GetImplicitGradient(const Vector &u, const Vector &k,
503 real_t shift) const;
504
505 /** @brief Return an Operator representing dG/du at the given point @a u and
506 the currently set time.
507
508 Presently, this method is used by some PETSc ODE solvers, for more
509 details, see the PETSc Manual. */
510 virtual Operator& GetExplicitGradient(const Vector &u) const;
511
512 /** @brief Setup a linear system as needed by some SUNDIALS ODE solvers to
513 perform a similar action to ImplicitSolve, i.e., solve for k, at the
514 current time t, in F(u + gamma k, k, t) = G(u + gamma k, t).
515
516 The SUNDIALS ODE solvers iteratively solve for k, as knew = kold + dk.
517 The linear system here is for dk, obtained by linearizing the nonlinear
518 system F(u + gamma knew, knew, t) = G(u + gamma knew, t) about dk = 0:
519 F(u + gamma (kold + dk), kold + dk, t) = G(u + gamma (kold + dk), t)
520 => [dF/dk + gamma (dF/du - dG/du)] dk = G - F + O(dk^2)
521 In other words, the linear system to be setup here is A dk = r, where
522 A = [dF/dk + gamma (dF/du - dG/du)] and r = G - F.
523
524 For solving an ordinary differential equation of the form
525 $ M \frac{dy}{dt} = g(y,t) $, recall that F and G can be defined as one
526 of the following:
527
528 1. F(u,k,t) = k and G(u,t) = inv(M) g(u,t)
529 2. F(u,k,t) = M k and G(u,t) = g(u,t)
530 3. F(u,k,t) = M k - g(u,t) and G(u,t) = 0
531
532 This function performs setup to solve $ A dk = r $ where A is either
533
534 1. A(@a y,t) = I - @a gamma inv(M) J(@a y,t)
535 2. A(@a y,t) = M - @a gamma J(@a y,t)
536 3. A(@a y,t) = M - @a gamma J(@a y,t)
537
538 with J = dg/dy (or a reasonable approximation thereof).
539
540 @param[in] y The state at which A(@a y,t) should be evaluated.
541 @param[in] v The value of inv(M) g(y,t) for 1 or g(y,t) for 2 & 3.
542 @param[in] jok Flag indicating if the Jacobian should be updated.
543 @param[out] jcur Flag to signal if the Jacobian was updated.
544 @param[in] gamma The scaled time step value.
545
546 If not re-implemented, this method simply generates an error.
547
548 Presently, this method is used by SUNDIALS ODE solvers, for more
549 details, see the SUNDIALS User Guides. */
550 virtual int SUNImplicitSetup(const Vector &y, const Vector &v,
551 int jok, int *jcur, real_t gamma);
552
553 /** @brief Solve the ODE linear system A @a dk = @a r , where A and r are
554 defined by the method SUNImplicitSetup().
555
556 For solving an ordinary differential equation of the form
557 $ M \frac{dy}{dt} = g(y,t) $, recall that F and G can be defined as one
558 of the following:
559
560 1. F(u,k,t) = k and G(u,t) = inv(M) g(u,t)
561 2. F(u,k,t) = M k and G(u,t) = g(u,t)
562 3. F(u,k,t) = M k - g(u,t) and G(u,t) = 0
563
564 @param[in] r inv(M) g(y,t) - k for 1 or g(y,t) - M k for 2 & 3.
565 @param[in,out] dk On input, the initial guess. On output, the solution.
566 @param[in] tol Linear solve tolerance.
567
568 If not re-implemented, this method simply generates an error.
569
570 Presently, this method is used by SUNDIALS ODE solvers, for more
571 details, see the SUNDIALS User Guides. */
572 virtual int SUNImplicitSolve(const Vector &r, Vector &dk, real_t tol);
573
574 /** @brief Setup the mass matrix in the ODE system
575 $ M \frac{dy}{dt} = g(y,t) $ .
576
577 If not re-implemented, this method simply generates an error.
578
579 Presently, this method is used by SUNDIALS ARKStep integrator, for more
580 details, see the ARKode User Guide. */
581 virtual int SUNMassSetup();
582
583 /** @brief Solve the mass matrix linear system M @a x = @a b, where M is
584 defined by the method SUNMassSetup().
585
586 @param[in] b The linear system right-hand side.
587 @param[in,out] x On input, the initial guess. On output, the solution.
588 @param[in] tol Linear solve tolerance.
589
590 If not re-implemented, this method simply generates an error.
591
592 Presently, this method is used by SUNDIALS ARKStep integrator, for more
593 details, see the ARKode User Guide. */
594 virtual int SUNMassSolve(const Vector &b, Vector &x, real_t tol);
595
596 /** @brief Compute the mass matrix-vector product @a v = M @a x, where M is
597 defined by the method SUNMassSetup().
598
599 @param[in] x The vector to multiply.
600 @param[out] v The result of the matrix-vector product.
601
602 If not re-implemented, this method simply generates an error.
603
604 Presently, this method is used by SUNDIALS ARKStep integrator, for more
605 details, see the ARKode User Guide. */
606 virtual int SUNMassMult(const Vector &x, Vector &v);
607
609};
610
611
612/** TimeDependentAdjointOperator is a TimeDependentOperator with Adjoint rate
613 equations to be used with CVODESSolver. */
615{
616public:
617
618 /**
619 \brief The TimedependentAdjointOperator extends the TimeDependentOperator
620 class to use features in SUNDIALS CVODESSolver for computing quadratures
621 and solving adjoint problems.
622
623 To solve adjoint problems one needs to implement the AdjointRateMult
624 method to tell CVODES what the adjoint rate equation is.
625
626 QuadratureIntegration (optional) can be used to compute values over the
627 forward problem
628
629 QuadratureSensitivityMult (optional) can be used to find the sensitivity
630 of the quadrature using the adjoint solution in part.
631
632 SUNImplicitSetupB (optional) can be used to setup custom solvers for the
633 newton solve for the adjoint problem.
634
635 SUNImplicitSolveB (optional) actually uses the solvers from
636 SUNImplicitSetupB to solve the adjoint problem.
637
638 See SUNDIALS user manuals for specifics.
639
640 \param[in] dim Dimension of the forward operator
641 \param[in] adjdim Dimension of the adjoint operator. Typically it is the
642 same size as dim. However, SUNDIALS allows users to specify the size if
643 one wants to perform custom operations.
644 \param[in] t Starting time to set
645 \param[in] type The TimeDependentOperator type
646 */
648 Type type = EXPLICIT) :
650 adjoint_height(adjdim)
651 {}
652
653 /// Destructor
655
656 /**
657 \brief Provide the operator integration of a quadrature equation
658
659 \param[in] y The current value at time t
660 \param[out] qdot The current quadrature rate value at t
661 */
662 virtual void QuadratureIntegration(const Vector &y, Vector &qdot) const {};
663
664 /** @brief Perform the action of the operator:
665 @a yBdot = k = f(@a y,@2 yB, t), where
666
667 @param[in] y The primal solution at time t
668 @param[in] yB The adjoint solution at time t
669 @param[out] yBdot the rate at time t
670 */
671 virtual void AdjointRateMult(const Vector &y, Vector & yB,
672 Vector &yBdot) const = 0;
673
674 /**
675 \brief Provides the sensitivity of the quadrature w.r.t to primal and
676 adjoint solutions
677
678 \param[in] y the value of the primal solution at time t
679 \param[in] yB the value of the adjoint solution at time t
680 \param[out] qBdot the value of the sensitivity of the quadrature rate at
681 time t
682 */
683 virtual void QuadratureSensitivityMult(const Vector &y, const Vector &yB,
684 Vector &qBdot) const {}
685
686 /** @brief Setup the ODE linear system $ A(x,t) = (I - gamma J) $ or
687 $ A = (M - gamma J) $, where $ J(x,t) = \frac{df}{dt(x,t)} $.
688
689 @param[in] t The current time
690 @param[in] x The state at which $A(x,xB,t)$ should be evaluated.
691 @param[in] xB The state at which $A(x,xB,t)$ should be evaluated.
692 @param[in] fxB The current value of the ODE rhs function, $f(x,t)$.
693 @param[in] jokB Flag indicating if the Jacobian should be updated.
694 @param[out] jcurB Flag to signal if the Jacobian was updated.
695 @param[in] gammaB The scaled time step value.
696
697 If not re-implemented, this method simply generates an error.
698
699 Presently, this method is used by SUNDIALS ODE solvers, for more details,
700 see the SUNDIALS User Guides.
701 */
702 virtual int SUNImplicitSetupB(const real_t t, const Vector &x,
703 const Vector &xB, const Vector &fxB,
704 int jokB, int *jcurB, real_t gammaB)
705 {
706 MFEM_ABORT("TimeDependentAdjointOperator::SUNImplicitSetupB() is not "
707 "overridden!");
708 return (-1);
709 }
710
711 /** @brief Solve the ODE linear system $ A(x,xB,t) xB = b $ as setup by
712 the method SUNImplicitSetup().
713
714 @param[in] b The linear system right-hand side.
715 @param[in,out] x On input, the initial guess. On output, the solution.
716 @param[in] tol Linear solve tolerance.
717
718 If not re-implemented, this method simply generates an error.
719
720 Presently, this method is used by SUNDIALS ODE solvers, for more details,
721 see the SUNDIALS User Guides. */
722 virtual int SUNImplicitSolveB(Vector &x, const Vector &b, real_t tol)
723 {
724 MFEM_ABORT("TimeDependentAdjointOperator::SUNImplicitSolveB() is not "
725 "overridden!");
726 return (-1);
727 }
728
729 /// Returns the size of the adjoint problem state space
731
732protected:
733 int adjoint_height; /// Size of the adjoint problem
734};
735
736
737/// Base abstract class for second order time dependent operators.
738/** Operator of the form: (x,dxdt,t) -> f(x,dxdt,t), where k = f(x,dxdt,t)
739 generally solves the algebraic equation F(x,dxdt,k,t) = G(x,dxdt,t).
740 The functions F and G represent the_implicit_ and _explicit_ parts of
741 the operator, respectively. For explicit operators,
742 F(x,dxdt,k,t) = k, so f(x,dxdt,t) = G(x,dxdt,t). */
744{
745public:
746 /** @brief Construct a "square" SecondOrderTimeDependentOperator
747 y = f(x,dxdt,t), where x, dxdt and y have the same dimension @a n. */
748 explicit SecondOrderTimeDependentOperator(int n = 0, real_t t_ = 0.0,
749 Type type_ = EXPLICIT)
750 : TimeDependentOperator(n, t_,type_) { }
751
752 /** @brief Construct a SecondOrderTimeDependentOperator y = f(x,dxdt,t),
753 where x, dxdt and y have the same dimension @a n. */
755 Type type_ = EXPLICIT)
756 : TimeDependentOperator(h, w, t_,type_) { }
757
759
760 /** @brief Perform the action of the operator: @a y = k = f(@a x,@ dxdt, t),
761 where k solves the algebraic equation
762 F(@a x,@ dxdt, k, t) = G(@a x,@ dxdt, t) and t is the current time. */
763 virtual void Mult(const Vector &x, const Vector &dxdt, Vector &y) const;
764
766 /** @brief Solve the equation:
767 @a k = f(@a x + @a fac0 @a k, @a dxdt + @a fac1 @a k, t), for the
768 unknown @a k at the current time t.
769
770 For general F and G, the equation for @a k becomes:
771 F(@a x + @a fac0 @a k, @a dxdt + @a fac1 @a k, t)
772 = G(@a x + @a fac0 @a k, @a dxdt + @a fac1 @a k, t).
773
774 The input vectors @a x and @a dxdt corresponds to time index (or cycle) n, while the
775 currently set time, #t, and the result vector @a k correspond to time
776 index n+1.
777
778 This method allows for the abstract implementation of some time
779 integration methods.
780
781 If not re-implemented, this method simply generates an error. */
782 virtual void ImplicitSolve(const real_t fac0, const real_t fac1,
783 const Vector &x, const Vector &dxdt, Vector &k);
784
785
787};
788
789
790/// Base class for solvers
791class Solver : public Operator
792{
793public:
794 /// If true, use the second argument of Mult() as an initial guess.
796
797 /** @brief Initialize a square Solver with size @a s.
798
799 @warning Use a Boolean expression for the second parameter (not an int)
800 to distinguish this call from the general rectangular constructor. */
801 explicit Solver(int s = 0, bool iter_mode = false)
802 : Operator(s) { iterative_mode = iter_mode; }
803
804 /// Initialize a Solver with height @a h and width @a w.
805 Solver(int h, int w, bool iter_mode = false)
806 : Operator(h, w) { iterative_mode = iter_mode; }
807
808 /// Set/update the solver for the given operator.
809 virtual void SetOperator(const Operator &op) = 0;
810};
811
812
813/// Identity Operator I: x -> x.
815{
816public:
817 /// Create an identity operator of size @a n.
818 explicit IdentityOperator(int n) : Operator(n) { }
819
820 /// Operator application
821 void Mult(const Vector &x, Vector &y) const override { y = x; }
822
823 /// Application of the transpose
824 void MultTranspose(const Vector &x, Vector &y) const override { y = x; }
825};
826
827/// Returns true if P is the identity prolongation, i.e. if it is either NULL or
828/// an IdentityOperator.
829inline bool IsIdentityProlongation(const Operator *P)
830{
831 return !P || dynamic_cast<const IdentityOperator*>(P);
832}
833
834/// Scaled Operator B: x -> a A(x).
836{
837private:
838 const Operator &A_;
839 real_t a_;
840
841public:
842 /// Create an operator which is a scalar multiple of A.
843 explicit ScaledOperator(const Operator *A, real_t a)
844 : Operator(A->Height(), A->Width()), A_(*A), a_(a) { }
845
846 /// Operator application
847 void Mult(const Vector &x, Vector &y) const override
848 { A_.Mult(x, y); y *= a_; }
849
850 /// Application of the transpose.
851 void MultTranspose(const Vector &x, Vector &y) const override
852 { A_.MultTranspose(x, y); y *= a_; }
853};
854
855
856/** @brief The transpose of a given operator. Switches the roles of the methods
857 Mult() and MultTranspose(). */
859{
860private:
861 const Operator &A;
862
863public:
864 /// Construct the transpose of a given operator @a *a.
866 : Operator(a->Width(), a->Height()), A(*a) { }
867
868 /// Construct the transpose of a given operator @a a.
870 : Operator(a.Width(), a.Height()), A(a) { }
871
872 /// Operator application. Apply the transpose of the original Operator.
873 void Mult(const Vector &x, Vector &y) const override
874 { A.MultTranspose(x, y); }
875
876 /// Application of the transpose. Apply the original Operator.
877 void MultTranspose(const Vector &x, Vector &y) const override
878 { A.Mult(x, y); }
879};
880
881/// General linear combination operator: x -> a A(x) + b B(x).
882class SumOperator : public Operator
883{
884 const Operator *A, *B;
885 const real_t alpha, beta;
886 bool ownA, ownB;
887 mutable Vector z;
888
889public:
891 const Operator *A, const real_t alpha,
892 const Operator *B, const real_t beta,
893 bool ownA, bool ownB);
894
895 void Mult(const Vector &x, Vector &y) const override
896 { z.SetSize(A->Height()); A->Mult(x, z); B->Mult(x, y); add(alpha, z, beta, y, y); }
897
898 void MultTranspose(const Vector &x, Vector &y) const override
899 { z.SetSize(A->Width()); A->MultTranspose(x, z); B->MultTranspose(x, y); add(alpha, z, beta, y, y); }
900
901 virtual ~SumOperator();
902};
903
904/// General product operator: x -> (A*B)(x) = A(B(x)).
906{
907 const Operator *A, *B;
908 bool ownA, ownB;
909 mutable Vector z;
910
911public:
912 ProductOperator(const Operator *A, const Operator *B, bool ownA, bool ownB);
913
914 void Mult(const Vector &x, Vector &y) const override
915 { B->Mult(x, z); A->Mult(z, y); }
916
917 void MultTranspose(const Vector &x, Vector &y) const override
918 { A->MultTranspose(x, z); B->MultTranspose(z, y); }
919
920 virtual ~ProductOperator();
921};
922
923
924/// The operator x -> R*A*P*x constructed through the actions of R^T, A and P
925class RAPOperator : public Operator
926{
927private:
928 const Operator & Rt;
929 const Operator & A;
930 const Operator & P;
931 mutable Vector Px;
932 mutable Vector APx;
933 MemoryClass mem_class;
934
935public:
936 /// Construct the RAP operator given R^T, A and P.
937 RAPOperator(const Operator &Rt_, const Operator &A_, const Operator &P_);
938
939 MemoryClass GetMemoryClass() const override { return mem_class; }
940
941 /// Operator application.
942 void Mult(const Vector & x, Vector & y) const override
943 { P.Mult(x, Px); A.Mult(Px, APx); Rt.MultTranspose(APx, y); }
944
945 /// Operator-wise absolute-value application.
946 void AbsMult(const Vector & x, Vector & y) const override
947 { P.AbsMult(x, Px); A.AbsMult(Px, APx); Rt.AbsMultTranspose(APx, y); }
948
949 /// Approximate diagonal of the RAP Operator.
950 /** Returns the diagonal of A, as returned by its AssembleDiagonal method,
951 multiplied be P^T.
952
953 When P is the FE space prolongation operator on a mesh without hanging
954 nodes and Rt = P, the returned diagonal is exact, as long as the diagonal
955 of A is also exact. */
956 void AssembleDiagonal(Vector &diag) const override
957 {
958 A.AssembleDiagonal(APx);
959 P.MultTranspose(APx, diag);
960
961 // TODO: For an AMR mesh, a convergent diagonal can be assembled with
962 // |P^T| APx, where |P^T| has entry-wise absolute values of the conforming
963 // prolongation transpose operator. See BilinearForm::AssembleDiagonal.
964 }
965
966 /// Application of the transpose.
967 void MultTranspose(const Vector & x, Vector & y) const override
968 { Rt.Mult(x, APx); A.MultTranspose(APx, Px); P.MultTranspose(Px, y); }
969
970 /// Operator-wise absolute-value application of the transpose
971 void AbsMultTranspose(const Vector & x, Vector & y) const override
972 {
973 Rt.AbsMult(x, APx);
974 A.AbsMultTranspose(APx, Px);
975 P.AbsMultTranspose(Px, y);
976 }
977};
978
979
980/// General triple product operator x -> A*B*C*x, with ownership of the factors.
982{
983 const Operator *A;
984 const Operator *B;
985 const Operator *C;
986 bool ownA, ownB, ownC;
987 mutable Vector t1, t2;
988 MemoryClass mem_class;
989
990public:
991 TripleProductOperator(const Operator *A, const Operator *B,
992 const Operator *C, bool ownA, bool ownB, bool ownC);
993
994 MemoryClass GetMemoryClass() const override { return mem_class; }
995
996 void Mult(const Vector &x, Vector &y) const override
997 { C->Mult(x, t1); B->Mult(t1, t2); A->Mult(t2, y); }
998
999 void MultTranspose(const Vector &x, Vector &y) const override
1000 { A->MultTranspose(x, t2); B->MultTranspose(t2, t1); C->MultTranspose(t1, y); }
1001
1002 virtual ~TripleProductOperator();
1003};
1004
1005
1006/** @brief Square Operator for imposing essential boundary conditions using only
1007 the action, Mult(), of a given unconstrained Operator.
1008
1009 Square operator constrained by fixing certain entries in the solution to
1010 given "essential boundary condition" values. This class is used by the
1011 general, matrix-free system formulation of Operator::FormLinearSystem.
1012
1013 Do not confuse with ConstrainedSolver, which despite the name has very
1014 different functionality. */
1016{
1017protected:
1018 Array<int> constraint_list; ///< List of constrained indices/dofs.
1019 Operator *A; ///< The unconstrained Operator.
1020 bool own_A; ///< Ownership flag for A.
1021 mutable Vector z, w; ///< Auxiliary vectors.
1023 DiagonalPolicy diag_policy; ///< Diagonal policy for constrained dofs
1024
1025public:
1026 /** @brief Constructor from a general Operator and a list of essential
1027 indices/dofs.
1028
1029 Specify the unconstrained operator @a *A and a @a list of indices to
1030 constrain, i.e. each entry @a list[i] represents an essential dof. If the
1031 ownership flag @a own_A is true, the operator @a *A will be destroyed
1032 when this object is destroyed. The @a diag_policy determines how the
1033 operator sets entries corresponding to essential dofs. */
1034 ConstrainedOperator(Operator *A, const Array<int> &list, bool own_A = false,
1036
1037 /// Returns the type of memory in which the solution and temporaries are stored.
1038 MemoryClass GetMemoryClass() const override { return mem_class; }
1039
1040 /// Set the diagonal policy for the constrained operator.
1041 void SetDiagonalPolicy(const DiagonalPolicy diag_policy_)
1042 { diag_policy = diag_policy_; }
1043
1044 /// Diagonal of A, modified according to the used DiagonalPolicy.
1045 void AssembleDiagonal(Vector &diag) const override;
1046
1047 /** @brief Eliminate "essential boundary condition" values specified in @a x
1048 from the given right-hand side @a b.
1049
1050 Performs the following steps:
1051
1052 z = A((0,x_b)); b_i -= z_i; b_b = x_b;
1053
1054 where the "_b" subscripts denote the essential (boundary) indices/dofs of
1055 the vectors, and "_i" -- the rest of the entries.
1056
1057 @note This method is consistent with `DiagonalPolicy::DIAG_ONE`. */
1058 void EliminateRHS(const Vector &x, Vector &b) const;
1059
1060 /** @brief Constrained operator action.
1061
1062 Performs the following steps:
1063
1064 z = A((x_i,0)); y_i = z_i; y_b = x_b;
1065
1066 where the "_b" subscripts denote the essential (boundary) indices/dofs of
1067 the vectors, and "_i" -- the rest of the entries. */
1068 void Mult(const Vector &x, Vector &y) const override;
1069
1070 void AddMult(const Vector &x, Vector &y, const real_t a = 1.0) const override;
1071
1072 void AbsMult(const Vector &x, Vector &y) const override;
1073
1074 void MultTranspose(const Vector &x, Vector &y) const override;
1075
1076 void AbsMultTranspose(const Vector &x, Vector &y) const override;
1077
1078 /** @brief Implementation of Mult or MultTranspose.
1079 TODO - Generalize to allow constraining rows and columns differently. */
1080 void ConstrainedMult(const Vector &x, Vector &y, const bool transpose) const;
1081
1082 /** @brief Implementation of AbsMult or AbsMultTranspose.
1083 TODO - Generalize to allow constraining rows and columns differently. */
1084 void ConstrainedAbsMult(const Vector &x, Vector &y,
1085 const bool transpose) const;
1086
1087 /// Destructor: destroys the unconstrained Operator, if owned.
1088 ~ConstrainedOperator() override { if (own_A) { delete A; } }
1089};
1090
1091/** @brief Rectangular Operator for imposing essential boundary conditions on
1092 the input space using only the action, Mult(), of a given unconstrained
1093 Operator.
1094
1095 Rectangular operator constrained by fixing certain entries in the solution
1096 to given "essential boundary condition" values. This class is used by the
1097 general matrix-free formulation of Operator::FormRectangularLinearSystem. */
1099{
1100protected:
1103 bool own_A;
1104 mutable Vector z, w;
1106
1107public:
1108 /** @brief Constructor from a general Operator and a list of essential
1109 indices/dofs.
1110
1111 Specify the unconstrained operator @a *A and two lists of indices to
1112 constrain, i.e. each entry @a trial_list[i] represents an essential trial
1113 dof. If the ownership flag @a own_A is true, the operator @a *A will be
1114 destroyed when this object is destroyed. */
1116 const Array<int> &test_list, bool own_A = false);
1117 /// Returns the type of memory in which the solution and temporaries are stored.
1118 MemoryClass GetMemoryClass() const override { return mem_class; }
1119 /** @brief Eliminate columns corresponding to "essential boundary condition"
1120 values specified in @a x from the given right-hand side @a b.
1121
1122 Performs the following steps:
1123
1124 b -= A((0,x_b));
1125 b_j = 0
1126
1127 where the "_b" subscripts denote the essential (boundary) indices and the
1128 "_j" subscript denotes the essential test indices */
1129 void EliminateRHS(const Vector &x, Vector &b) const;
1130 /** @brief Rectangular-constrained operator action.
1131
1132 Performs the following steps:
1133
1134 y = A((x_i,0));
1135 y_j = 0
1136
1137 where the "_i" subscripts denote all the nonessential (boundary) trial
1138 indices and the "_j" subscript denotes the essential test indices */
1139 void Mult(const Vector &x, Vector &y) const override;
1140 void MultTranspose(const Vector &x, Vector &y) const override;
1141 virtual ~RectangularConstrainedOperator() { if (own_A) { delete A; } }
1142};
1143
1144/** @brief Abstract class for defining inner products. The method Eval()
1145 must be implemented in derived classes to compute the inner product
1146 of two vectors according to a specific inner product definition.
1147*/
1149{
1150#ifdef MFEM_USE_MPI
1151private:
1152 MPI_Comm comm = MPI_COMM_NULL;
1153 int dot_prod_type = 0; // 0: local, 1: global
1154
1155public:
1156 InnerProductOperator(MPI_Comm comm_) : Operator(1)
1157 { comm = comm_; dot_prod_type = 1; }
1158#endif
1159protected:
1160 /// @brief Standard global/local $\ell_2$ inner product.
1161 virtual real_t Dot(const Vector &x, const Vector &y) const;
1162
1163public:
1164 /// Create an operator of size 1 (scalar).
1166 {
1167#ifdef MFEM_USE_MPI
1168 dot_prod_type = 0;
1169#endif
1170 }
1171
1172 /// Operator application - not always needed/used but added
1173 /// to satisfy the abstract base class interface.
1174 virtual void Mult(const Vector &x, Vector &y) const override
1175 {
1176 MFEM_ABORT("Mult is not implemented.");
1177 }
1178
1179 /** @brief Compute the inner product (x,y) of vectors x and y.
1180 This is an abstract method that must be
1181 implemented in derived classes. */
1182 virtual real_t Eval(const Vector &x, const Vector &y) = 0;
1183};
1184
1185/** @brief PowerMethod helper class to estimate the largest eigenvalue of an
1186 operator using the iterative power method. */
1188{
1189 Vector v1;
1190#ifdef MFEM_USE_MPI
1191 MPI_Comm comm;
1192#endif
1193
1194public:
1195
1196#ifdef MFEM_USE_MPI
1197 PowerMethod() : comm(MPI_COMM_NULL) {}
1198#else
1200#endif
1201
1202#ifdef MFEM_USE_MPI
1203 PowerMethod(MPI_Comm comm_) : comm(comm_) {}
1204#endif
1205
1206 /// @brief Returns an estimate of the largest eigenvalue of the operator \p opr
1207 /// using the iterative power method.
1208 /** \p v0 is being used as the vector for the iterative process and will contain
1209 the eigenvector corresponding to the largest eigenvalue after convergence.
1210 The maximum number of iterations may set with \p numSteps, the relative
1211 tolerance with \p tolerance and the seed of the random initialization of
1212 \p v0 with \p seed. If \p seed is 0 \p v0 will not be random-initialized. */
1214 int numSteps = 10, real_t tolerance = 1e-8,
1215 int seed = 12345);
1216};
1217
1218}
1219
1220#endif
Square Operator for imposing essential boundary conditions using only the action, Mult(),...
MemoryClass GetMemoryClass() const override
Returns the type of memory in which the solution and temporaries are stored.
Array< int > constraint_list
List of constrained indices/dofs.
void Mult(const Vector &x, Vector &y) const override
Constrained operator action.
Definition operator.cpp:710
Operator * A
The unconstrained Operator.
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate "essential boundary condition" values specified in x from the given right-hand side b.
Definition operator.cpp:559
void ConstrainedAbsMult(const Vector &x, Vector &y, const bool transpose) const
Implementation of AbsMult or AbsMultTranspose. TODO - Generalize to allow constraining rows and colum...
Definition operator.cpp:648
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.
Definition operator.cpp:511
void AbsMultTranspose(const Vector &x, Vector &y) const override
Action of the transpose absolute-value operator: y=|A|^t(x). The default behavior in class Operator i...
Definition operator.cpp:728
void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const override
Operator application: y+=A(x) (default) or y+=a*A(x).
Definition operator.cpp:734
void AssembleDiagonal(Vector &diag) const override
Diagonal of A, modified according to the used DiagonalPolicy.
Definition operator.cpp:528
DiagonalPolicy diag_policy
Diagonal policy for constrained dofs.
void ConstrainedMult(const Vector &x, Vector &y, const bool transpose) const
Implementation of Mult or MultTranspose. TODO - Generalize to allow constraining rows and columns dif...
Definition operator.cpp:586
Vector w
Auxiliary vectors.
bool own_A
Ownership flag for A.
~ConstrainedOperator() override
Destructor: destroys the unconstrained Operator, if owned.
void SetDiagonalPolicy(const DiagonalPolicy diag_policy_)
Set the diagonal policy for the constrained operator.
void AbsMult(const Vector &x, Vector &y) const override
Action of the absolute-value operator: y=|A|(x). The default behavior in class Operator is to generat...
Definition operator.cpp:716
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Definition operator.cpp:722
Identity Operator I: x -> x.
Definition operator.hpp:815
void MultTranspose(const Vector &x, Vector &y) const override
Application of the transpose.
Definition operator.hpp:824
void Mult(const Vector &x, Vector &y) const override
Operator application.
Definition operator.hpp:821
IdentityOperator(int n)
Create an identity operator of size n.
Definition operator.hpp:818
Abstract class for defining inner products. The method Eval() must be implemented in derived classes ...
InnerProductOperator(MPI_Comm comm_)
virtual real_t Eval(const Vector &x, const Vector &y)=0
Compute the inner product (x,y) of vectors x and y. This is an abstract method that must be implement...
virtual real_t Dot(const Vector &x, const Vector &y) const
Standard global/local inner product.
Definition operator.cpp:855
virtual void Mult(const Vector &x, Vector &y) const override
InnerProductOperator()
Create an operator of size 1 (scalar).
Abstract operator.
Definition operator.hpp:25
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.
Definition operator.cpp:131
virtual MemoryClass GetMemoryClass() const
Return the MemoryClass preferred by the Operator.
Definition operator.hpp:86
void FormConstrainedSystemOperator(const Array< int > &ess_tdof_list, ConstrainedOperator *&Aout)
see FormSystemOperator()
Definition operator.cpp:197
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:114
int width
Dimension of the input / number of columns in the matrix.
Definition operator.hpp:28
void FormSystemOperator(const Array< int > &ess_tdof_list, Operator *&A)
Return in A a parallel (on truedofs) version of this square operator.
Definition operator.cpp:227
void FormDiscreteOperator(Operator *&A)
Return in A a parallel (on truedofs) version of this rectangular operator.
Definition operator.cpp:244
virtual void ArrayMultTranspose(const Array< const Vector * > &X, Array< Vector * > &Y) const
Action of the transpose operator on a matrix: Y=A^t(X).
Definition operator.cpp:78
Operator(int s=0)
Construct a square Operator with given size s (default 0).
Definition operator.hpp:59
virtual const Operator * GetOutputRestrictionTranspose() const
Transpose of GetOutputRestriction, directly available in this form to facilitate matrix-free RAP-type...
Definition operator.hpp:168
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Definition operator.hpp:66
int height
Dimension of the output / number of rows in the matrix.
Definition operator.hpp:27
virtual void ArrayAddMult(const Array< const Vector * > &X, Array< Vector * > &Y, const real_t a=1.0) const
Operator application on a matrix: Y+=A(X) (default) or Y+=a*A(X).
Definition operator.cpp:90
virtual const Operator * GetRestriction() const
Restriction operator from input vectors for the operator to linear algebra (linear system) vectors....
Definition operator.hpp:155
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
int NumCols() const
Get the number of columns (size of input) of the Operator. Synonym with Width().
Definition operator.hpp:75
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
Definition operator.hpp:48
@ DIAG_ONE
Set the diagonal value to one.
Definition operator.hpp:50
@ DIAG_KEEP
Keep the diagonal value.
Definition operator.hpp:51
@ DIAG_ZERO
Set the diagonal value to zero.
Definition operator.hpp:49
virtual const Operator * GetOutputRestriction() const
Restriction operator from output vectors for the operator to linear algebra (linear system) vectors....
Definition operator.hpp:172
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Definition operator.hpp:72
virtual const Operator * GetOutputProlongation() const
Prolongation operator from linear algebra (linear system) vectors, to output vectors for the operator...
Definition operator.hpp:159
virtual void ArrayAddMultTranspose(const Array< const Vector * > &X, Array< Vector * > &Y, const real_t a=1.0) const
Operator transpose application on a matrix: Y+=A^t(X) (default) or Y+=a*A^t(X).
Definition operator.cpp:102
virtual void ArrayMult(const Array< const Vector * > &X, Array< Vector * > &Y) const
Operator application on a matrix: Y=A(X).
Definition operator.cpp:66
virtual const Operator * GetProlongation() const
Prolongation operator from linear algebra (linear system) vectors, to input vectors for the operator....
Definition operator.hpp:151
virtual ~Operator()
Virtual destructor.
Definition operator.hpp:291
Type
Enumeration defining IDs for some classes derived from Operator.
Definition operator.hpp:296
@ ANY_TYPE
ID for the base class Operator, i.e. any type.
Definition operator.hpp:297
@ MFEM_SPARSEMAT
ID for class SparseMatrix.
Definition operator.hpp:298
@ PETSC_MATIS
ID for class PetscParMatrix, MATIS format.
Definition operator.hpp:301
@ MFEM_ComplexSparseMat
ID for class ComplexSparseMatrix.
Definition operator.hpp:307
@ Hypre_ParCSR
ID for class HypreParMatrix.
Definition operator.hpp:299
@ PETSC_MATHYPRE
ID for class PetscParMatrix, MATHYPRE format.
Definition operator.hpp:304
@ Complex_Operator
ID for class ComplexOperator.
Definition operator.hpp:306
@ PETSC_MATGENERIC
ID for class PetscParMatrix, unspecified format.
Definition operator.hpp:305
@ MFEM_Block_Matrix
ID for class BlockMatrix.
Definition operator.hpp:310
@ MFEM_Block_Operator
ID for the base class BlockOperator.
Definition operator.hpp:311
@ Complex_Hypre_ParCSR
ID for class ComplexHypreParMatrix.
Definition operator.hpp:308
@ PETSC_MATAIJ
ID for class PetscParMatrix, MATAIJ format.
Definition operator.hpp:300
@ PETSC_MATNEST
ID for class PetscParMatrix, MATNEST format.
Definition operator.hpp:303
@ Complex_DenseMat
ID for class ComplexDenseMatrix.
Definition operator.hpp:309
@ PETSC_MATSHELL
ID for class PetscParMatrix, MATSHELL format.
Definition operator.hpp:302
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).
Definition operator.cpp:235
Operator * SetupRAP(const Operator *Pi, const Operator *Po)
Returns RAP Operator of this, using input/output Prolongation matrices Pi corresponds to "P",...
Definition operator.cpp:168
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:148
Type GetType() const
Return the type ID of the Operator class.
Definition operator.hpp:319
virtual void AbsMultTranspose(const Vector &x, Vector &y) const
Action of the transpose absolute-value operator: y=|A|^t(x). The default behavior in class Operator i...
Definition operator.hpp:105
virtual void AssembleDiagonal(Vector &diag) const
Computes the diagonal entries into diag. Typically, this operation only makes sense for linear Operat...
Definition operator.hpp:143
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.
Definition operator.cpp:22
int NumRows() const
Get the number of rows (size of output) of the Operator. Synonym with Height().
Definition operator.hpp:69
virtual void AddMultTranspose(const Vector &x, Vector &y, const real_t a=1.0) const
Operator transpose application: y+=A^t(x) (default) or y+=a*A^t(x).
Definition operator.cpp:58
void FormRectangularConstrainedSystemOperator(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, RectangularConstrainedOperator *&Aout)
see FormRectangularSystemOperator()
Definition operator.cpp:210
Operator(int h, int w)
Construct an Operator with the given height (output size) and width (input size).
Definition operator.hpp:63
virtual void AbsMult(const Vector &x, Vector &y) const
Action of the absolute-value operator: y=|A|(x). The default behavior in class Operator is to generat...
Definition operator.hpp:95
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:100
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:134
void PrintMatlab(std::ostream &out, int n, int m=0) const
Prints operator with input size n and output size m in Matlab format.
Definition operator.cpp:251
virtual void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const
Operator application: y+=A(x) (default) or y+=a*A(x).
Definition operator.cpp:51
PowerMethod helper class to estimate the largest eigenvalue of an operator using the iterative power ...
real_t EstimateLargestEigenvalue(Operator &opr, Vector &v0, int numSteps=10, real_t tolerance=1e-8, int seed=12345)
Returns an estimate of the largest eigenvalue of the operator opr using the iterative power method.
Definition operator.cpp:871
PowerMethod(MPI_Comm comm_)
General product operator: x -> (A*B)(x) = A(B(x)).
Definition operator.hpp:906
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Definition operator.hpp:917
ProductOperator(const Operator *A, const Operator *B, bool ownA, bool ownB)
Definition operator.cpp:407
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
Definition operator.hpp:914
virtual ~ProductOperator()
Definition operator.cpp:426
The operator x -> R*A*P*x constructed through the actions of R^T, A and P.
Definition operator.hpp:926
void Mult(const Vector &x, Vector &y) const override
Operator application.
Definition operator.hpp:942
void AbsMultTranspose(const Vector &x, Vector &y) const override
Operator-wise absolute-value application of the transpose.
Definition operator.hpp:971
void AssembleDiagonal(Vector &diag) const override
Approximate diagonal of the RAP Operator.
Definition operator.hpp:956
void AbsMult(const Vector &x, Vector &y) const override
Operator-wise absolute-value application.
Definition operator.hpp:946
RAPOperator(const Operator &Rt_, const Operator &A_, const Operator &P_)
Construct the RAP operator given R^T, A and P.
Definition operator.cpp:433
MemoryClass GetMemoryClass() const override
Return the MemoryClass preferred by the Operator.
Definition operator.hpp:939
void MultTranspose(const Vector &x, Vector &y) const override
Application of the transpose.
Definition operator.hpp:967
Rectangular Operator for imposing essential boundary conditions on the input space using only the act...
MemoryClass GetMemoryClass() const override
Returns the type of memory in which the solution and temporaries are stored.
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.
Definition operator.cpp:741
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate columns corresponding to "essential boundary condition" values specified in x from the give...
Definition operator.cpp:760
void Mult(const Vector &x, Vector &y) const override
Rectangular-constrained operator action.
Definition operator.cpp:786
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Definition operator.cpp:820
Scaled Operator B: x -> a A(x).
Definition operator.hpp:836
ScaledOperator(const Operator *A, real_t a)
Create an operator which is a scalar multiple of A.
Definition operator.hpp:843
void MultTranspose(const Vector &x, Vector &y) const override
Application of the transpose.
Definition operator.hpp:851
void Mult(const Vector &x, Vector &y) const override
Operator application.
Definition operator.hpp:847
Base abstract class for second order time dependent operators.
Definition operator.hpp:744
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...
Definition operator.cpp:352
virtual void ImplicitSolve(const real_t fac0, const real_t 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.
Definition operator.cpp:359
SecondOrderTimeDependentOperator(int h, int w, real_t t_=0.0, Type type_=EXPLICIT)
Construct a SecondOrderTimeDependentOperator y = f(x,dxdt,t), where x, dxdt and y have the same dimen...
Definition operator.hpp:754
SecondOrderTimeDependentOperator(int n=0, real_t t_=0.0, Type type_=EXPLICIT)
Construct a "square" SecondOrderTimeDependentOperator y = f(x,dxdt,t), where x, dxdt and y have the s...
Definition operator.hpp:748
Base class for solvers.
Definition operator.hpp:792
Solver(int h, int w, bool iter_mode=false)
Initialize a Solver with height h and width w.
Definition operator.hpp:805
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
Definition operator.hpp:795
virtual void SetOperator(const Operator &op)=0
Set/update the solver for the given operator.
Solver(int s=0, bool iter_mode=false)
Initialize a square Solver with size s.
Definition operator.hpp:801
General linear combination operator: x -> a A(x) + b B(x).
Definition operator.hpp:883
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Definition operator.hpp:898
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
Definition operator.hpp:895
virtual ~SumOperator()
Definition operator.cpp:401
SumOperator(const Operator *A, const real_t alpha, const Operator *B, const real_t beta, bool ownA, bool ownB)
Definition operator.cpp:368
virtual int SUNImplicitSolveB(Vector &x, const Vector &b, real_t tol)
Solve the ODE linear system as setup by the method SUNImplicitSetup().
Definition operator.hpp:722
virtual int SUNImplicitSetupB(const real_t t, const Vector &x, const Vector &xB, const Vector &fxB, int jokB, int *jcurB, real_t gammaB)
Setup the ODE linear system or , where .
Definition operator.hpp:702
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 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.
Definition operator.hpp:683
virtual void QuadratureIntegration(const Vector &y, Vector &qdot) const
Provide the operator integration of a quadrature equation.
Definition operator.hpp:662
virtual ~TimeDependentAdjointOperator()
Destructor.
Definition operator.hpp:654
TimeDependentAdjointOperator(int dim, int adjdim, real_t t=0., Type type=EXPLICIT)
The TimedependentAdjointOperator extends the TimeDependentOperator class to use features in SUNDIALS ...
Definition operator.hpp:647
int GetAdjointHeight()
Returns the size of the adjoint problem state space.
Definition operator.hpp:730
Base abstract class for first order time dependent operators.
Definition operator.hpp:344
bool isHomogeneous() const
True if type is HOMOGENEOUS.
Definition operator.hpp:413
EvalMode
Evaluation mode. See SetEvalMode() for details.
Definition operator.hpp:373
bool isExplicit() const
True if type is EXPLICIT.
Definition operator.hpp:409
EvalMode eval_mode
Current evaluation mode.
Definition operator.hpp:388
virtual void ImplicitSolve(const real_t gamma, const Vector &u, Vector &k)
Solve for the unknown k, at the current time t, the following equation: F(u + gamma k,...
Definition operator.cpp:298
virtual int SUNImplicitSolve(const Vector &r, Vector &dk, real_t tol)
Solve the ODE linear system A dk = r , where A and r are defined by the method SUNImplicitSetup().
Definition operator.cpp:327
TimeDependentOperator(int h, int w, double t_=0.0, Type type_=EXPLICIT)
Construct a TimeDependentOperator (u,t) -> k(u,t), where u and k have dimensions w and h,...
Definition operator.hpp:399
virtual int SUNMassMult(const Vector &x, Vector &v)
Compute the mass matrix-vector product v = M x, where M is defined by the method SUNMassSetup().
Definition operator.cpp:345
Type
Enum used to describe the form of the time-dependent operator.
Definition operator.hpp:365
@ HOMOGENEOUS
This type assumes that G(u,t) = 0.
Definition operator.hpp:368
@ EXPLICIT
This type assumes F(u,k,t) = k.
Definition operator.hpp:366
@ IMPLICIT
This is the most general type, no assumptions on F and G.
Definition operator.hpp:367
virtual Operator & GetExplicitGradient(const Vector &u) const
Return an Operator representing dG/du at the given point u and the currently set time.
Definition operator.cpp:312
bool isImplicit() const
True if type is IMPLICIT or HOMOGENEOUS.
Definition operator.hpp:411
virtual int SUNMassSetup()
Setup the mass matrix in the ODE system .
Definition operator.cpp:333
TimeDependentOperator(int n=0, real_t t_=0.0, Type type_=EXPLICIT)
Construct a "square" TimeDependentOperator (u,t) -> k(u,t), where u and k have the same dimension n.
Definition operator.hpp:393
real_t t
Current time.
Definition operator.hpp:385
void Mult(const Vector &u, Vector &k) const override
Perform the action of the operator (u,t) -> k(u,t) where t is the current time set by SetTime() and k...
Definition operator.cpp:293
virtual int SUNMassSolve(const Vector &b, Vector &x, real_t tol)
Solve the mass matrix linear system M x = b, where M is defined by the method SUNMassSetup().
Definition operator.cpp:339
virtual void ExplicitMult(const Vector &u, Vector &v) const
Perform the action of the explicit part of the operator, G: v = G(u, t) where t is the current time.
Definition operator.cpp:282
virtual Operator & GetImplicitGradient(const Vector &u, const Vector &k, real_t shift) const
Return an Operator representing (dF/dk shift + dF/du) at the given u, k, and the currently set time.
Definition operator.cpp:304
virtual void SetEvalMode(const EvalMode new_eval_mode)
Set the evaluation mode of the time-dependent operator.
Definition operator.hpp:429
virtual void SetTime(const real_t t_)
Set the current time.
Definition operator.hpp:406
EvalMode GetEvalMode() const
Return the current evaluation mode. See SetEvalMode() for details.
Definition operator.hpp:416
virtual void ImplicitMult(const Vector &u, const Vector &k, Vector &v) const
Perform the action of the implicit part of the operator, F: v = F(u, k, t) where t is the current tim...
Definition operator.cpp:287
Type type
Describes the form of the TimeDependentOperator, see the documentation of Type.
Definition operator.hpp:386
virtual int SUNImplicitSetup(const Vector &y, const Vector &v, int jok, int *jcur, real_t gamma)
Setup a linear system as needed by some SUNDIALS ODE solvers to perform a similar action to ImplicitS...
Definition operator.cpp:319
virtual real_t GetTime() const
Read the currently set time.
Definition operator.hpp:403
The transpose of a given operator. Switches the roles of the methods Mult() and MultTranspose().
Definition operator.hpp:859
void MultTranspose(const Vector &x, Vector &y) const override
Application of the transpose. Apply the original Operator.
Definition operator.hpp:877
void Mult(const Vector &x, Vector &y) const override
Operator application. Apply the transpose of the original Operator.
Definition operator.hpp:873
TransposeOperator(const Operator *a)
Construct the transpose of a given operator *a.
Definition operator.hpp:865
TransposeOperator(const Operator &a)
Construct the transpose of a given operator a.
Definition operator.hpp:869
General triple product operator x -> A*B*C*x, with ownership of the factors.
Definition operator.hpp:982
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Definition operator.hpp:999
TripleProductOperator(const Operator *A, const Operator *B, const Operator *C, bool ownA, bool ownB, bool ownC)
Definition operator.cpp:467
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
Definition operator.hpp:996
MemoryClass GetMemoryClass() const override
Return the MemoryClass preferred by the Operator.
Definition operator.hpp:994
Vector data type.
Definition vector.hpp:82
void SetSize(int s)
Resize the vector to size s.
Definition vector.hpp:584
const real_t alpha
Definition ex15.cpp:369
int dim
Definition ex24.cpp:53
real_t b
Definition lissajous.cpp:42
real_t a
Definition lissajous.cpp:41
real_t u(const Vector &xvec)
Definition lor_mms.hpp:22
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:66
void add(const Vector &v1, const Vector &v2, Vector &v)
Definition vector.cpp:414
MemoryClass
Memory classes identify sets of memory types.
bool IsIdentityProlongation(const Operator *P)
Definition operator.hpp:829
float real_t
Definition config.hpp:46