MFEM  v4.1.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
operator.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2020, 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 #include "vector.hpp"
13 #include "operator.hpp"
14 #include "../general/forall.hpp"
15 
16 #include <iostream>
17 #include <iomanip>
18 
19 namespace mfem
20 {
21 
22 void Operator::InitTVectors(const Operator *Po, const Operator *Ri,
23  const Operator *Pi,
24  Vector &x, Vector &b,
25  Vector &X, Vector &B) const
26 {
27  if (!IsIdentityProlongation(Po))
28  {
29  // Variational restriction with Po
30  B.SetSize(Po->Width(), b);
31  Po->MultTranspose(b, B);
32  }
33  else
34  {
35  // B points to same data as b
36  B.NewMemoryAndSize(b.GetMemory(), b.Size(), false);
37  }
38  if (!IsIdentityProlongation(Pi))
39  {
40  // Variational restriction with Ri
41  X.SetSize(Ri->Height(), x);
42  Ri->Mult(x, X);
43  }
44  else
45  {
46  // X points to same data as x
47  X.NewMemoryAndSize(x.GetMemory(), x.Size(), false);
48  }
49 }
50 
51 void Operator::FormLinearSystem(const Array<int> &ess_tdof_list,
52  Vector &x, Vector &b,
53  Operator* &Aout, Vector &X, Vector &B,
54  int copy_interior)
55 {
56  const Operator *P = this->GetProlongation();
57  const Operator *R = this->GetRestriction();
58  InitTVectors(P, R, P, x, b, X, B);
59 
60  if (!copy_interior) { X.SetSubVectorComplement(ess_tdof_list, 0.0); }
61 
62  ConstrainedOperator *constrainedA;
63  FormConstrainedSystemOperator(ess_tdof_list, constrainedA);
64  constrainedA->EliminateRHS(X, B);
65  Aout = constrainedA;
66 }
67 
69  const Array<int> &trial_tdof_list,
70  const Array<int> &test_tdof_list, Vector &x, Vector &b,
71  Operator* &Aout, Vector &X, Vector &B)
72 {
73  const Operator *Pi = this->GetProlongation();
74  const Operator *Po = this->GetOutputProlongation();
75  const Operator *Ri = this->GetRestriction();
76  InitTVectors(Po, Ri, Pi, x, b, X, B);
77 
78  RectangularConstrainedOperator *constrainedA;
79  FormRectangularConstrainedSystemOperator(trial_tdof_list, test_tdof_list,
80  constrainedA);
81  constrainedA->EliminateRHS(X, B);
82  Aout = constrainedA;
83 }
84 
86 {
87  // Same for Rectangular and Square operators
88  const Operator *P = this->GetProlongation();
89  if (!IsIdentityProlongation(P))
90  {
91  // Apply conforming prolongation
92  x.SetSize(P->Height());
93  P->Mult(X, x);
94  }
95  else
96  {
97  // X and x point to the same data
98 
99  // If the validity flags of X's Memory were changed (e.g. if it was moved
100  // to device memory) then we need to tell x about that.
101  x.SyncMemory(X);
102  }
103 }
104 
106 {
107  Operator *rap;
108  if (!IsIdentityProlongation(Pi))
109  {
110  if (!IsIdentityProlongation(Po))
111  {
112  rap = new RAPOperator(*Po, *this, *Pi);
113  }
114  else
115  {
116  rap = new ProductOperator(this, Pi, false,false);
117  }
118  }
119  else
120  {
121  if (!IsIdentityProlongation(Po))
122  {
123  TransposeOperator * PoT = new TransposeOperator(Po);
124  rap = new ProductOperator(PoT, this, true,false);
125  }
126  else
127  {
128  rap = this;
129  }
130  }
131  return rap;
132 }
133 
135  const Array<int> &ess_tdof_list, ConstrainedOperator* &Aout)
136 {
137  const Operator *P = this->GetProlongation();
138  Operator *rap = SetupRAP(P, P);
139 
140  // Impose the boundary conditions through a ConstrainedOperator, which owns
141  // the rap operator when P and R are non-trivial
142  ConstrainedOperator *A = new ConstrainedOperator(rap, ess_tdof_list,
143  rap != this);
144  Aout = A;
145 }
146 
148  const Array<int> &trial_tdof_list, const Array<int> &test_tdof_list,
150 {
151  const Operator *Pi = this->GetProlongation();
152  const Operator *Po = this->GetOutputProlongation();
153  Operator *rap = SetupRAP(Pi, Po);
154 
155  // Impose the boundary conditions through a RectangularConstrainedOperator,
156  // which owns the rap operator when P and R are non-trivial
159  trial_tdof_list, test_tdof_list,
160  rap != this);
161  Aout = A;
162 }
163 
164 void Operator::FormSystemOperator(const Array<int> &ess_tdof_list,
165  Operator* &Aout)
166 {
168  FormConstrainedSystemOperator(ess_tdof_list, A);
169  Aout = A;
170 }
171 
173  const Array<int> &test_tdof_list,
174  Operator* &Aout)
175 {
177  FormRectangularConstrainedSystemOperator(trial_tdof_list, test_tdof_list, A);
178  Aout = A;
179 }
180 
182 {
183  const Operator *Pin = this->GetProlongation();
184  const Operator *Rout = this->GetOutputRestriction();
185  Aout = new TripleProductOperator(Rout, this, Pin,false, false, false);
186 }
187 
188 void Operator::PrintMatlab(std::ostream & out, int n, int m) const
189 {
190  using namespace std;
191  if (n == 0) { n = width; }
192  if (m == 0) { m = height; }
193 
194  Vector x(n), y(m);
195  x = 0.0;
196 
197  out << setiosflags(ios::scientific | ios::showpos);
198  for (int i = 0; i < n; i++)
199  {
200  x(i) = 1.0;
201  Mult(x, y);
202  for (int j = 0; j < m; j++)
203  {
204  if (y(j))
205  {
206  out << j+1 << " " << i+1 << " " << y(j) << '\n';
207  }
208  }
209  x(i) = 0.0;
210  }
211 }
212 
213 
215 {
216  mfem_error("TimeDependentOperator::ExplicitMult() is not overridden!");
217 }
218 
220  Vector &) const
221 {
222  mfem_error("TimeDependentOperator::ImplicitMult() is not overridden!");
223 }
224 
226 {
227  mfem_error("TimeDependentOperator::Mult() is not overridden!");
228 }
229 
230 void TimeDependentOperator::ImplicitSolve(const double, const Vector &,
231  Vector &)
232 {
233  mfem_error("TimeDependentOperator::ImplicitSolve() is not overridden!");
234 }
235 
237  const Vector &, const Vector &, double) const
238 {
239  mfem_error("TimeDependentOperator::GetImplicitGradient() is "
240  "not overridden!");
241  return const_cast<Operator &>(dynamic_cast<const Operator &>(*this));
242 }
243 
245 {
246  mfem_error("TimeDependentOperator::GetExplicitGradient() is "
247  "not overridden!");
248  return const_cast<Operator &>(dynamic_cast<const Operator &>(*this));
249 }
250 
252  const Vector &,
253  int, int *, double)
254 {
255  mfem_error("TimeDependentOperator::SUNImplicitSetup() is not overridden!");
256  return (-1);
257 }
258 
260 {
261  mfem_error("TimeDependentOperator::SUNImplicitSolve() is not overridden!");
262  return (-1);
263 }
264 
266 {
267  mfem_error("TimeDependentOperator::SUNMassSetup() is not overridden!");
268  return (-1);
269 }
270 
272 {
273  mfem_error("TimeDependentOperator::SUNMassSolve() is not overridden!");
274  return (-1);
275 }
276 
278 {
279  mfem_error("TimeDependentOperator::SUNMassMult() is not overridden!");
280  return (-1);
281 }
282 
283 
285  const Vector &dxdt,
286  Vector &y) const
287 {
288  mfem_error("SecondOrderTimeDependentOperator::Mult() is not overridden!");
289 }
290 
292  const double dt1,
293  const Vector &x,
294  const Vector &dxdt,
295  Vector &k)
296 {
297  mfem_error("SecondOrderTimeDependentOperator::ImplicitSolve() is not overridden!");
298 }
299 
300 
302  bool ownA, bool ownB)
303  : Operator(A->Height(), B->Width()),
304  A(A), B(B), ownA(ownA), ownB(ownB), z(A->Width())
305 {
306  MFEM_VERIFY(A->Width() == B->Height(),
307  "incompatible Operators: A->Width() = " << A->Width()
308  << ", B->Height() = " << B->Height());
309 
310  {
311  const Solver* SolverB = dynamic_cast<const Solver*>(B);
312  if (SolverB)
313  {
314  MFEM_VERIFY(!(SolverB->iterative_mode),
315  "Operator B of a ProductOperator should not be in iterative mode");
316  }
317  }
318 }
319 
321 {
322  if (ownA) { delete A; }
323  if (ownB) { delete B; }
324 }
325 
326 
328  const Operator &P_)
329  : Operator(Rt_.Width(), P_.Width()), Rt(Rt_), A(A_), P(P_)
330 {
331  MFEM_VERIFY(Rt.Height() == A.Height(),
332  "incompatible Operators: Rt.Height() = " << Rt.Height()
333  << ", A.Height() = " << A.Height());
334  MFEM_VERIFY(A.Width() == P.Height(),
335  "incompatible Operators: A.Width() = " << A.Width()
336  << ", P.Height() = " << P.Height());
337 
338  {
339  const Solver* SolverA = dynamic_cast<const Solver*>(&A);
340  if (SolverA)
341  {
342  MFEM_VERIFY(!(SolverA->iterative_mode),
343  "Operator A of an RAPOperator should not be in iterative mode");
344  }
345 
346  const Solver* SolverP = dynamic_cast<const Solver*>(&P);
347  if (SolverP)
348  {
349  MFEM_VERIFY(!(SolverP->iterative_mode),
350  "Operator P of an RAPOperator should not be in iterative mode");
351  }
352  }
353 
354  mem_class = Rt.GetMemoryClass()*P.GetMemoryClass();
355  MemoryType mem_type = GetMemoryType(A.GetMemoryClass()*mem_class);
356  Px.SetSize(P.Height(), mem_type);
357  APx.SetSize(A.Height(), mem_type);
358 }
359 
360 
362  const Operator *A, const Operator *B, const Operator *C,
363  bool ownA, bool ownB, bool ownC)
364  : Operator(A->Height(), C->Width())
365  , A(A), B(B), C(C)
366  , ownA(ownA), ownB(ownB), ownC(ownC)
367 {
368  MFEM_VERIFY(A->Width() == B->Height(),
369  "incompatible Operators: A->Width() = " << A->Width()
370  << ", B->Height() = " << B->Height());
371  MFEM_VERIFY(B->Width() == C->Height(),
372  "incompatible Operators: B->Width() = " << B->Width()
373  << ", C->Height() = " << C->Height());
374 
375  {
376  const Solver* SolverB = dynamic_cast<const Solver*>(B);
377  if (SolverB)
378  {
379  MFEM_VERIFY(!(SolverB->iterative_mode),
380  "Operator B of a TripleProductOperator should not be in iterative mode");
381  }
382 
383  const Solver* SolverC = dynamic_cast<const Solver*>(C);
384  if (SolverC)
385  {
386  MFEM_VERIFY(!(SolverC->iterative_mode),
387  "Operator C of a TripleProductOperator should not be in iterative mode");
388  }
389  }
390 
391  mem_class = A->GetMemoryClass()*C->GetMemoryClass();
392  MemoryType mem_type = GetMemoryType(mem_class*B->GetMemoryClass());
393  t1.SetSize(C->Height(), mem_type);
394  t2.SetSize(B->Height(), mem_type);
395 }
396 
398 {
399  if (ownA) { delete A; }
400  if (ownB) { delete B; }
401  if (ownC) { delete C; }
402 }
403 
404 
406  bool _own_A)
407  : Operator(A->Height(), A->Width()), A(A), own_A(_own_A)
408 {
409  // 'mem_class' should work with A->Mult() and MFEM_FORALL():
411  MemoryType mem_type = GetMemoryType(mem_class);
412  list.Read(); // TODO: just ensure 'list' is registered, no need to copy it
413  constraint_list.MakeRef(list);
414  // typically z and w are large vectors, so store them on the device
415  z.SetSize(height, mem_type); z.UseDevice(true);
416  w.SetSize(height, mem_type); w.UseDevice(true);
417 }
418 
420 {
421  w = 0.0;
422  const int csz = constraint_list.Size();
423  auto idx = constraint_list.Read();
424  auto d_x = x.Read();
425  // Use read+write access - we are modifying sub-vector of w
426  auto d_w = w.ReadWrite();
427  MFEM_FORALL(i, csz,
428  {
429  const int id = idx[i];
430  d_w[id] = d_x[id];
431  });
432 
433  // A.AddMult(w, b, -1.0); // if available to all Operators
434  A->Mult(w, z);
435  b -= z;
436 
437  // Use read+write access - we are modifying sub-vector of b
438  auto d_b = b.ReadWrite();
439  MFEM_FORALL(i, csz,
440  {
441  const int id = idx[i];
442  d_b[id] = d_x[id];
443  });
444 }
445 
446 void ConstrainedOperator::Mult(const Vector &x, Vector &y) const
447 {
448  const int csz = constraint_list.Size();
449  if (csz == 0)
450  {
451  A->Mult(x, y);
452  return;
453  }
454 
455  z = x;
456 
457  auto idx = constraint_list.Read();
458  // Use read+write access - we are modifying sub-vector of z
459  auto d_z = z.ReadWrite();
460  MFEM_FORALL(i, csz, d_z[idx[i]] = 0.0;);
461 
462  A->Mult(z, y);
463 
464  auto d_x = x.Read();
465  // Use read+write access - we are modifying sub-vector of y
466  auto d_y = y.ReadWrite();
467  MFEM_FORALL(i, csz,
468  {
469  const int id = idx[i];
470  d_y[id] = d_x[id];
471  });
472 }
473 
475  Operator *A,
476  const Array<int> &trial_list,
477  const Array<int> &test_list,
478  bool _own_A)
479  : Operator(A->Height(), A->Width()), A(A), own_A(_own_A)
480 {
481  // 'mem_class' should work with A->Mult() and MFEM_FORALL():
483  MemoryType mem_type = GetMemoryType(mem_class);
484  trial_list.Read(); // TODO: just ensure 'list' is registered, no need to copy it
485  test_list.Read(); // TODO: just ensure 'list' is registered, no need to copy it
486  trial_constraints.MakeRef(trial_list);
487  test_constraints.MakeRef(test_list);
488  // typically z and w are large vectors, so store them on the device
489  z.SetSize(height, mem_type); z.UseDevice(true);
490  w.SetSize(width, mem_type); w.UseDevice(true);
491 }
492 
494  Vector &b) const
495 {
496  w = 0.0;
497  const int trial_csz = trial_constraints.Size();
498  auto trial_idx = trial_constraints.Read();
499  auto d_x = x.Read();
500  // Use read+write access - we are modifying sub-vector of w
501  auto d_w = w.ReadWrite();
502  MFEM_FORALL(i, trial_csz,
503  {
504  const int id = trial_idx[i];
505  d_w[id] = d_x[id];
506  });
507 
508  // A.AddMult(w, b, -1.0); // if available to all Operators
509  A->Mult(w, z);
510  b -= z;
511 
512  const int test_csz = test_constraints.Size();
513  auto test_idx = test_constraints.Read();
514  auto d_b = b.ReadWrite();
515  MFEM_FORALL(i, test_csz, d_b[test_idx[i]] = 0.0;);
516 }
517 
519 {
520  const int trial_csz = trial_constraints.Size();
521  const int test_csz = test_constraints.Size();
522  if (trial_csz == 0)
523  {
524  A->Mult(x, y);
525  }
526  else
527  {
528  w = x;
529 
530  auto idx = trial_constraints.Read();
531  // Use read+write access - we are modifying sub-vector of w
532  auto d_w = w.ReadWrite();
533  MFEM_FORALL(i, trial_csz, d_w[idx[i]] = 0.0;);
534 
535  A->Mult(w, y);
536  }
537 
538  if (test_csz != 0)
539  {
540  auto idx = test_constraints.Read();
541  auto d_y = y.ReadWrite();
542  MFEM_FORALL(i, test_csz, d_y[idx[i]] = 0.0;);
543  }
544 }
545 
546 }
static MemoryClass GetMemoryClass()
(DEPRECATED) Equivalent to GetDeviceMemoryClass().
Definition: device.hpp:261
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:284
int Size() const
Logical size of the array.
Definition: array.hpp:124
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:172
virtual ~ProductOperator()
Definition: operator.cpp:320
Array< int > constraint_list
List of constrained indices/dofs.
Definition: operator.hpp:669
void SyncMemory(const Vector &v)
Update the memory location of the vector to match v.
Definition: vector.hpp:187
void SetSize(int s)
Resize the vector to size s.
Definition: vector.hpp:407
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.cpp:230
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Definition: operator.hpp:63
void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
Definition: vector.hpp:86
virtual void Mult(const Vector &x, Vector &y) const
Constrained operator action.
Definition: operator.cpp:446
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.cpp:244
int Size() const
Returns the size of the vector.
Definition: vector.hpp:157
virtual const Operator * GetOutputProlongation() const
Prolongation operator from linear algebra (linear system) vectors, to output vectors for the operator...
Definition: operator.hpp:103
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate columns corresponding to &quot;essential boundary condition&quot; values specified in x from the give...
Definition: operator.cpp:493
void FormDiscreteOperator(Operator *&A)
Return in A a parallel (on truedofs) version of this rectangular operator.
Definition: operator.cpp:181
ProductOperator(const Operator *A, const Operator *B, bool ownA, bool ownB)
Definition: operator.cpp:301
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
Definition: operator.hpp:504
Memory< double > & GetMemory()
Return a reference to the Memory object used by the Vector.
Definition: vector.hpp:180
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:84
void FormRectangularConstrainedSystemOperator(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, RectangularConstrainedOperator *&Aout)
see FormRectangularSystemOperator()
Definition: operator.cpp:147
virtual int SUNImplicitSolve(const Vector &b, Vector &x, double tol)
Solve the ODE linear system as setup by the method SUNImplicitSetup().
Definition: operator.cpp:259
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.cpp:214
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:68
virtual const Operator * GetProlongation() const
Prolongation operator from linear algebra (linear system) vectors, to input vectors for the operator...
Definition: operator.hpp:97
General product operator: x -&gt; (A*B)(x) = A(B(x)).
Definition: operator.hpp:588
double * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
Definition: vector.hpp:349
virtual MemoryClass GetMemoryClass() const
Return the MemoryClass preferred by the Operator.
Definition: operator.hpp:77
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Definition: operator.hpp:57
static MemoryClass GetDeviceMemoryClass()
Get the current Device MemoryClass. This is the MemoryClass used by most MFEM device kernels to acces...
Definition: device.hpp:257
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:153
void FormConstrainedSystemOperator(const Array< int > &ess_tdof_list, ConstrainedOperator *&Aout)
see FormSystemOperator()
Definition: operator.cpp:134
double b
Definition: lissajous.cpp:42
virtual int SUNMassSetup()
Setup the mass matrix in the ODE system .
Definition: operator.cpp:265
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
Definition: array.hpp:273
The operator x -&gt; R*A*P*x constructed through the actions of R^T, A and P.
Definition: operator.hpp:608
virtual void Mult(const Vector &x, Vector &y) const
Rectangular-constrained operator action.
Definition: operator.cpp:518
RAPOperator(const Operator &Rt_, const Operator &A_, const Operator &P_)
Construct the RAP operator given R^T, A and P.
Definition: operator.cpp:327
virtual const Operator * GetRestriction() const
Restriction operator from input vectors for the operator to linear algebra (linear system) vectors...
Definition: operator.hpp:100
void SetSubVectorComplement(const Array< int > &dofs, const double val)
Set all vector entries NOT in the &#39;dofs&#39; array to the given &#39;val&#39;.
Definition: vector.cpp:633
bool IsIdentityProlongation(const Operator *P)
Definition: operator.hpp:538
virtual int SUNMassSolve(const Vector &b, Vector &x, double tol)
Solve the mass matrix linear system as setup by the method SUNMassSetup().
Definition: operator.cpp:271
Vector w
Auxiliary vectors.
Definition: operator.hpp:672
MemoryType
Memory types supported by MFEM.
Definition: mem_manager.hpp:27
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
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.cpp:236
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:51
The transpose of a given operator. Switches the roles of the methods Mult() and MultTranspose().
Definition: operator.hpp:563
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:85
int height
Dimension of the output / number of rows in the matrix.
Definition: operator.hpp:27
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.cpp:219
Rectangular Operator for imposing essential boundary conditions on the input space using only the act...
Definition: operator.hpp:720
const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
Definition: vector.hpp:333
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:419
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:188
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:164
General triple product operator x -&gt; A*B*C*x, with ownership of the factors.
Definition: operator.hpp:635
void NewMemoryAndSize(const Memory< double > &mem, int s, bool own_mem)
Reset the Vector to use the given external Memory mem and size s.
Definition: vector.hpp:456
MemoryType GetMemoryType(MemoryClass mc)
Return a suitable MemoryType for a given MemoryClass.
Definition: mem_manager.cpp:49
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:405
virtual int SUNImplicitSetup(const Vector &x, const Vector &fx, int jok, int *jcur, double gamma)
Setup the ODE linear system or , where .
Definition: operator.cpp:251
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.cpp:225
TripleProductOperator(const Operator *A, const Operator *B, const Operator *C, bool ownA, bool ownB, bool ownC)
Definition: operator.cpp:361
virtual int SUNMassMult(const Vector &x, Vector &v)
Compute the mass matrix-vector product .
Definition: operator.cpp:277
Operator * SetupRAP(const Operator *Pi, const Operator *Po)
Returns RAP Operator of this, taking in input/output Prolongation matrices.
Definition: operator.cpp:105
void MakeRef(T *, int)
Make this Array a reference to a pointer.
Definition: array.hpp:820
Vector data type.
Definition: vector.hpp:48
Base class for solvers.
Definition: operator.hpp:500
Operator * A
The unconstrained Operator.
Definition: operator.hpp:670
Square Operator for imposing essential boundary conditions using only the action, Mult()...
Definition: operator.hpp:666
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
Abstract operator.
Definition: operator.hpp:24
virtual void ImplicitSolve(const double dt0, const double dt1, const Vector &x, const Vector &dxdt, Vector &k)
Solve the equation: k = f(x + 1/2 dt0^2 k, dxdt + dt1 k, t), for the unknown k at the current time t...
Definition: operator.cpp:291
int width
Dimension of the input / number of columns in the matrix.
Definition: operator.hpp:28
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:474
virtual const Operator * GetOutputRestriction() const
Restriction operator from output vectors for the operator to linear algebra (linear system) vectors...
Definition: operator.hpp:109