MFEM  v4.1.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
pbilinearform.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 "../config/config.hpp"
13 
14 #ifdef MFEM_USE_MPI
15 
16 #include "fem.hpp"
17 #include "../general/sort_pairs.hpp"
18 
19 namespace mfem
20 {
21 
23 {
24  int nbr_size = pfes->GetFaceNbrVSize();
25 
26  if (precompute_sparsity == 0 || fes->GetVDim() > 1)
27  {
28  if (keep_nbr_block)
29  {
30  mat = new SparseMatrix(height + nbr_size, width + nbr_size);
31  }
32  else
33  {
34  mat = new SparseMatrix(height, width + nbr_size);
35  }
36  return;
37  }
38 
39  // the sparsity pattern is defined from the map: face->element->dof
40  const Table &lelem_ldof = fes->GetElementToDofTable(); // <-- dofs
41  const Table &nelem_ndof = pfes->face_nbr_element_dof; // <-- vdofs
42  Table elem_dof; // element + nbr-element <---> dof
43  if (nbr_size > 0)
44  {
45  // merge lelem_ldof and nelem_ndof into elem_dof
46  int s1 = lelem_ldof.Size(), s2 = nelem_ndof.Size();
47  const int *I1 = lelem_ldof.GetI(), *J1 = lelem_ldof.GetJ();
48  const int *I2 = nelem_ndof.GetI(), *J2 = nelem_ndof.GetJ();
49  const int nnz1 = I1[s1], nnz2 = I2[s2];
50 
51  elem_dof.SetDims(s1 + s2, nnz1 + nnz2);
52 
53  int *I = elem_dof.GetI(), *J = elem_dof.GetJ();
54  for (int i = 0; i <= s1; i++)
55  {
56  I[i] = I1[i];
57  }
58  for (int j = 0; j < nnz1; j++)
59  {
60  J[j] = J1[j];
61  }
62  for (int i = 0; i <= s2; i++)
63  {
64  I[s1+i] = I2[i] + nnz1;
65  }
66  for (int j = 0; j < nnz2; j++)
67  {
68  J[nnz1+j] = J2[j] + height;
69  }
70  }
71  // dof_elem x elem_face x face_elem x elem_dof (keep_nbr_block = true)
72  // ldof_lelem x lelem_face x face_elem x elem_dof (keep_nbr_block = false)
73  Table dof_dof;
74  {
75  Table face_dof; // face_elem x elem_dof
76  {
77  Table *face_elem = pfes->GetParMesh()->GetFaceToAllElementTable();
78  if (nbr_size > 0)
79  {
80  mfem::Mult(*face_elem, elem_dof, face_dof);
81  }
82  else
83  {
84  mfem::Mult(*face_elem, lelem_ldof, face_dof);
85  }
86  delete face_elem;
87  if (nbr_size > 0)
88  {
89  elem_dof.Clear();
90  }
91  }
92 
93  if (keep_nbr_block)
94  {
95  Table dof_face;
96  Transpose(face_dof, dof_face, height + nbr_size);
97  mfem::Mult(dof_face, face_dof, dof_dof);
98  }
99  else
100  {
101  Table ldof_face;
102  {
103  Table face_ldof;
104  Table *face_lelem = fes->GetMesh()->GetFaceToElementTable();
105  mfem::Mult(*face_lelem, lelem_ldof, face_ldof);
106  delete face_lelem;
107  Transpose(face_ldof, ldof_face, height);
108  }
109  mfem::Mult(ldof_face, face_dof, dof_dof);
110  }
111  }
112 
113  int *I = dof_dof.GetI();
114  int *J = dof_dof.GetJ();
115  int nrows = dof_dof.Size();
116  double *data = Memory<double>(I[nrows]);
117 
118  mat = new SparseMatrix(I, J, data, nrows, height + nbr_size);
119  *mat = 0.0;
120 
121  dof_dof.LoseData();
122 }
123 
125 {
126  A.Clear();
127 
128  if (A_local == NULL) { return; }
129  MFEM_VERIFY(A_local->Finalized(), "the local matrix must be finalized");
130 
131  OperatorHandle dA(A.Type()), Ph(A.Type()), hdA;
132 
133  if (fbfi.Size() == 0)
134  {
135  // construct a parallel block-diagonal matrix 'A' based on 'a'
137  pfes->GetDofOffsets(), A_local);
138  }
139  else
140  {
141  // handle the case when 'a' contains off-diagonal
142  int lvsize = pfes->GetVSize();
143  const HYPRE_Int *face_nbr_glob_ldof = pfes->GetFaceNbrGlobalDofMap();
144  HYPRE_Int ldof_offset = pfes->GetMyDofOffset();
145 
146  Array<HYPRE_Int> glob_J(A_local->NumNonZeroElems());
147  int *J = A_local->GetJ();
148  for (int i = 0; i < glob_J.Size(); i++)
149  {
150  if (J[i] < lvsize)
151  {
152  glob_J[i] = J[i] + ldof_offset;
153  }
154  else
155  {
156  glob_J[i] = face_nbr_glob_ldof[J[i] - lvsize];
157  }
158  }
159 
160  // TODO - construct dA directly in the A format
161  hdA.Reset(
162  new HypreParMatrix(pfes->GetComm(), lvsize, pfes->GlobalVSize(),
163  pfes->GlobalVSize(), A_local->GetI(), glob_J,
164  A_local->GetData(), pfes->GetDofOffsets(),
165  pfes->GetDofOffsets()));
166  // - hdA owns the new HypreParMatrix
167  // - the above constructor copies all input arrays
168  glob_J.DeleteAll();
169  dA.ConvertFrom(hdA);
170  }
171 
172  // TODO - assemble the Dof_TrueDof_Matrix directly in the required format?
173  Ph.ConvertFrom(pfes->Dof_TrueDof_Matrix());
174  // TODO: When Ph.Type() == Operator::ANY_TYPE we want to use the Operator
175  // returned by pfes->GetProlongationMatrix(), however that Operator is a
176  // const Operator, so we cannot store it in OperatorHandle. We need a const
177  // version of class OperatorHandle, e.g. ConstOperatorHandle.
178 
179  A.MakePtAP(dA, Ph);
180 }
181 
183 {
185  ParallelAssemble(Mh, m);
186  Mh.SetOperatorOwner(false);
187  return Mh.As<HypreParMatrix>();
188 }
189 
191 {
192  ParMesh *pmesh = pfes->GetParMesh();
194  Array<int> vdofs1, vdofs2, vdofs_all;
196 
197  int nfaces = pmesh->GetNSharedFaces();
198  for (int i = 0; i < nfaces; i++)
199  {
200  T = pmesh->GetSharedFaceTransformations(i);
201  pfes->GetElementVDofs(T->Elem1No, vdofs1);
202  pfes->GetFaceNbrElementVDofs(T->Elem2No, vdofs2);
203  vdofs1.Copy(vdofs_all);
204  for (int j = 0; j < vdofs2.Size(); j++)
205  {
206  if (vdofs2[j] >= 0)
207  {
208  vdofs2[j] += height;
209  }
210  else
211  {
212  vdofs2[j] -= height;
213  }
214  }
215  vdofs_all.Append(vdofs2);
216  for (int k = 0; k < fbfi.Size(); k++)
217  {
218  fbfi[k]->AssembleFaceMatrix(*pfes->GetFE(T->Elem1No),
219  *pfes->GetFaceNbrFE(T->Elem2No),
220  *T, elemmat);
221  if (keep_nbr_block)
222  {
223  mat->AddSubMatrix(vdofs_all, vdofs_all, elemmat, skip_zeros);
224  }
225  else
226  {
227  mat->AddSubMatrix(vdofs1, vdofs_all, elemmat, skip_zeros);
228  }
229  }
230  }
231 }
232 
233 void ParBilinearForm::Assemble(int skip_zeros)
234 {
235  if (mat == NULL && fbfi.Size() > 0)
236  {
238  pAllocMat();
239  }
240 
241  BilinearForm::Assemble(skip_zeros);
242 
243  if (fbfi.Size() > 0)
244  {
245  AssembleSharedFaces(skip_zeros);
246  }
247 }
248 
249 void ParBilinearForm
251  HypreParMatrix &A, const HypreParVector &X,
252  HypreParVector &B) const
253 {
254  Array<int> dof_list;
255 
256  pfes->GetEssentialTrueDofs(bdr_attr_is_ess, dof_list);
257 
258  // do the parallel elimination
259  A.EliminateRowsCols(dof_list, X, B);
260 }
261 
264  HypreParMatrix &A) const
265 {
266  Array<int> dof_list;
267 
268  pfes->GetEssentialTrueDofs(bdr_attr_is_ess, dof_list);
269 
270  return A.EliminateRowsCols(dof_list);
271 }
272 
273 void ParBilinearForm::TrueAddMult(const Vector &x, Vector &y, const double a)
274 const
275 {
276  MFEM_VERIFY(fbfi.Size() == 0, "the case of interior face integrators is not"
277  " implemented");
278 
279  if (X.ParFESpace() != pfes)
280  {
281  X.SetSpace(pfes);
282  Y.SetSpace(pfes);
283  }
284 
285  X.Distribute(&x);
286  mat->Mult(X, Y);
287  pfes->Dof_TrueDof_Matrix()->MultTranspose(a, Y, 1.0, y);
288 }
289 
291  const Array<int> &ess_tdof_list, Vector &x, Vector &b,
292  OperatorHandle &A, Vector &X, Vector &B, int copy_interior)
293 {
294  if (ext)
295  {
296  ext->FormLinearSystem(ess_tdof_list, x, b, A, X, B, copy_interior);
297  return;
298  }
299 
300  // Finish the matrix assembly and perform BC elimination, storing the
301  // eliminated part of the matrix.
302  FormSystemMatrix(ess_tdof_list, A);
303 
304  const Operator &P = *pfes->GetProlongationMatrix();
305  const SparseMatrix &R = *pfes->GetRestrictionMatrix();
306 
307  // Transform the system and perform the elimination in B, based on the
308  // essential BC values from x. Restrict the BC part of x in X, and set the
309  // non-BC part to zero. Since there is no good initial guess for the Lagrange
310  // multipliers, set X = 0.0 for hybridization.
311  if (static_cond)
312  {
313  // Schur complement reduction to the exposed dofs
314  static_cond->ReduceSystem(x, b, X, B, copy_interior);
315  }
316  else if (hybridization)
317  {
318  // Reduction to the Lagrange multipliers system
319  HypreParVector true_X(pfes), true_B(pfes);
320  P.MultTranspose(b, true_B);
321  R.Mult(x, true_X);
322  p_mat.EliminateBC(p_mat_e, ess_tdof_list, true_X, true_B);
323  R.MultTranspose(true_B, b);
324  hybridization->ReduceRHS(true_B, B);
325  X.SetSize(B.Size());
326  X = 0.0;
327  }
328  else
329  {
330  // Variational restriction with P
331  X.SetSize(pfes->TrueVSize());
332  B.SetSize(X.Size());
333  P.MultTranspose(b, B);
334  R.Mult(x, X);
335  p_mat.EliminateBC(p_mat_e, ess_tdof_list, X, B);
336  if (!copy_interior) { X.SetSubVectorComplement(ess_tdof_list, 0.0); }
337  }
338 }
339 
341  OperatorHandle &A)
342 {
343  if (ext)
344  {
345  ext->FormSystemMatrix(ess_tdof_list, A);
346  return;
347  }
348 
349  // Finish the matrix assembly and perform BC elimination, storing the
350  // eliminated part of the matrix.
351  if (static_cond)
352  {
354  {
355  static_cond->SetEssentialTrueDofs(ess_tdof_list);
358  }
360  }
361  else
362  {
363  if (mat)
364  {
365  const int remove_zeros = 0;
366  Finalize(remove_zeros);
367  MFEM_VERIFY(p_mat.Ptr() == NULL && p_mat_e.Ptr() == NULL,
368  "The ParBilinearForm must be updated with Update() before "
369  "re-assembling the ParBilinearForm.");
371  delete mat;
372  mat = NULL;
373  delete mat_e;
374  mat_e = NULL;
375  p_mat_e.EliminateRowsCols(p_mat, ess_tdof_list);
376  }
377  if (hybridization)
378  {
380  }
381  else
382  {
383  A = p_mat;
384  }
385  }
386 }
387 
389  const Vector &X, const Vector &b, Vector &x)
390 {
391  if (ext)
392  {
393  ext->RecoverFEMSolution(X, b, x);
394  return;
395  }
396 
397  const Operator &P = *pfes->GetProlongationMatrix();
398 
399  if (static_cond)
400  {
401  // Private dofs back solve
402  static_cond->ComputeSolution(b, X, x);
403  }
404  else if (hybridization)
405  {
406  // Primal unknowns recovery
407  HypreParVector true_X(pfes), true_B(pfes);
408  P.MultTranspose(b, true_B);
409  const SparseMatrix &R = *pfes->GetRestrictionMatrix();
410  R.Mult(x, true_X); // get essential b.c. from x
411  hybridization->ComputeSolution(true_B, X, true_X);
412  x.SetSize(P.Height());
413  P.Mult(true_X, x);
414  }
415  else
416  {
417  // Apply conforming prolongation
418  x.SetSize(P.Height());
419  P.Mult(X, x);
420  }
421 }
422 
424 {
425  BilinearForm::Update(nfes);
426 
427  if (nfes)
428  {
429  pfes = dynamic_cast<ParFiniteElementSpace *>(nfes);
430  MFEM_VERIFY(pfes != NULL, "nfes must be a ParFiniteElementSpace!");
431  }
432 
433  p_mat.Clear();
434  p_mat_e.Clear();
435 }
436 
437 
439 {
440  // construct the block-diagonal matrix A
441  HypreParMatrix *A =
447  mat);
448 
451 
452  delete A;
453 
454  return rap;
455 }
456 
458 {
459  // construct the rectangular block-diagonal matrix dA
460  OperatorHandle dA(A.Type());
466  mat);
467 
468  OperatorHandle P_test(A.Type()), P_trial(A.Type());
469 
470  // TODO - construct the Dof_TrueDof_Matrix directly in the required format.
472  P_trial.ConvertFrom(trial_pfes->Dof_TrueDof_Matrix());
473 
474  A.MakeRAP(P_test, dA, P_trial);
475 }
476 
477 /// Compute y += a (P^t A P) x, where x and y are vectors on the true dofs
479  const double a) const
480 {
481  if (X.ParFESpace() != trial_pfes)
482  {
485  }
486 
487  X.Distribute(&x);
488  mat->Mult(X, Y);
490 }
491 
493  const Array<int>
494  &trial_tdof_list,
495  const Array<int> &test_tdof_list,
496  OperatorHandle &A)
497 {
498  if (ext)
499  {
500  ext->FormRectangularSystemOperator(trial_tdof_list, test_tdof_list, A);
501  return;
502  }
503 
504  if (mat)
505  {
506  Finalize();
508  delete mat;
509  mat = NULL;
510  delete mat_e;
511  mat_e = NULL;
512  HypreParMatrix *temp =
513  p_mat.As<HypreParMatrix>()->EliminateCols(trial_tdof_list);
514  p_mat.As<HypreParMatrix>()->EliminateRows(test_tdof_list);
515  p_mat_e.Reset(temp, true);
516  }
517 
518  A = p_mat;
519 }
520 
522  const Array<int>
523  &trial_tdof_list,
524  const Array<int> &test_tdof_list, Vector &x,
525  Vector &b, OperatorHandle &A, Vector &X,
526  Vector &B)
527 {
528  if (ext)
529  {
530  ext->FormRectangularLinearSystem(trial_tdof_list, test_tdof_list,
531  x, b, A, X, B);
532  return;
533  }
534 
535  FormRectangularSystemMatrix(trial_tdof_list, test_tdof_list, A);
536 
537  const Operator *test_P = test_pfes->GetProlongationMatrix();
538  const SparseMatrix *trial_R = trial_pfes->GetRestrictionMatrix();
539 
542  test_P->MultTranspose(b, B);
543  trial_R->Mult(x, X);
544 
545  p_mat_e.As<HypreParMatrix>()->Mult(-1.0, X, 1.0, B);
546  B.SetSubVector(test_tdof_list, 0.0);
547 }
548 
550 {
551  MFEM_ASSERT(mat, "Matrix is not assembled");
552  MFEM_ASSERT(mat->Finalized(), "Matrix is not finalized");
556  delete RA;
557  return RAP;
558 }
559 
561 const
562 {
563  MFEM_VERIFY(mat->Finalized(), "Local matrix needs to be finalized for "
564  "GetParBlocks");
565 
567 
568  blocks.SetSize(range_fes->GetVDim(), domain_fes->GetVDim());
569 
570  RLP->GetBlocks(blocks,
573 
574  delete RLP;
575 }
576 
577 }
578 
579 #endif
Ordering::Type GetOrdering() const
Return the ordering method.
Definition: fespace.hpp:393
int Size() const
Logical size of the array.
Definition: array.hpp:124
void EliminateRowsCols(const Array< int > &rows_cols, const HypreParVector &X, HypreParVector &B)
Definition: hypre.cpp:1390
void SetSubVector(const Array< int > &dofs, const double value)
Set the entries listed in dofs to the given value.
Definition: vector.cpp:498
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
Definition: fespace.hpp:381
virtual int NumNonZeroElems() const
Returns the number of the nonzero elements in the matrix.
Definition: sparsemat.cpp:1162
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Definition: pfespace.cpp:770
void ConvertFrom(OperatorHandle &A)
Convert the given OperatorHandle A to the currently set type id.
Definition: handle.cpp:200
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
Definition: handle.hpp:96
int * GetJ()
Definition: table.hpp:114
Array< BilinearFormIntegrator * > fbfi
Set of interior face Integrators to be applied.
void Assemble(int skip_zeros=1)
Assembles the form i.e. sums over all domain/bdr integrators.
HypreParMatrix * RAP(const HypreParMatrix *A, const HypreParMatrix *P)
Returns the matrix P^t * A * P.
Definition: hypre.cpp:1636
virtual void FormLinearSystem(const Array< int > &ess_tdof_list, Vector &x, Vector &b, OperatorHandle &A, Vector &X, Vector &B, int copy_interior=0)
Form the linear system A X = B, corresponding to this bilinear form and the linear form b(...
ParGridFunction X
Auxiliary objects used in TrueAddMult().
HYPRE_Int * GetDofOffsets() const
Definition: pfespace.hpp:247
virtual const Operator * GetProlongationMatrix() const
The returned Operator is owned by the FiniteElementSpace.
Definition: pfespace.cpp:890
BilinearFormExtension * ext
HypreParMatrix * LeftDiagMult(const SparseMatrix &D, HYPRE_Int *row_starts=NULL) const
Multiply the HypreParMatrix on the left by a block-diagonal parallel matrix D and return the result a...
Definition: hypre.cpp:1103
void SetSize(int s)
Resize the vector to size s.
Definition: vector.hpp:407
HYPRE_Int MultTranspose(HypreParVector &x, HypreParVector &y, double alpha=1.0, double beta=0.0)
Computes y = alpha * A^t * x + beta * y.
Definition: hypre.cpp:1097
void GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i&#39;th element.
Definition: fespace.cpp:172
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Definition: table.cpp:476
HypreParMatrix & GetParallelMatrix()
Return the parallel hybridized matrix.
int GetNSharedFaces() const
Return the number of shared faces (3D), edges (2D), vertices (1D)
Definition: pmesh.cpp:2441
Pointer to an Operator of a specified type.
Definition: handle.hpp:33
int * GetJ()
Return the array J.
Definition: sparsemat.hpp:146
void SetDims(int rows, int nnz)
Definition: table.cpp:144
Operator::Type Type() const
Get the currently set operator type id.
Definition: handle.hpp:91
void Copy(Array &copy) const
Create a copy of the current array.
Definition: array.hpp:812
void EliminateBC(const OperatorHandle &A_e, const Array< int > &ess_dof_list, const Vector &X, Vector &B) const
Eliminate essential dofs from the solution X into the r.h.s. B.
Definition: handle.cpp:303
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
int Size() const
Returns the size of the vector.
Definition: vector.hpp:157
void TrueAddMult(const Vector &x, Vector &y, const double a=1.0) const
Compute y += a (P^t A P) x, where x and y are vectors on the true dofs.
void ReduceSystem(Vector &x, Vector &b, Vector &X, Vector &B, int copy_interior=0) const
Set the reduced solution X and r.h.s B vectors from the full linear system solution x and r...
Definition: staticcond.cpp:418
int * GetI()
Return the array I.
Definition: sparsemat.hpp:141
void EliminateReducedTrueDofs(const Array< int > &ess_rtdof_list, Matrix::DiagonalPolicy dpolicy)
Eliminate the given reduced true dofs from the Schur complement matrix S.
Definition: staticcond.cpp:288
OperatorHandle p_mat_e
void LoseData()
Call this if data has been stolen.
Definition: table.hpp:154
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
virtual void SetSpace(FiniteElementSpace *f)
Associate a new FiniteElementSpace with the ParGridFunction.
Definition: pgridfunc.cpp:87
Abstract parallel finite element space.
Definition: pfespace.hpp:28
virtual void Finalize(int skip_zeros=1)
Finalizes the matrix initialization.
void AssembleSharedFaces(int skip_zeros=1)
void ComputeSolution(const Vector &b, const Vector &sc_sol, Vector &sol) const
Definition: staticcond.cpp:478
const HYPRE_Int * GetFaceNbrGlobalDofMap()
Definition: pfespace.hpp:349
HYPRE_Int GetMyDofOffset() const
Definition: pfespace.cpp:880
void DeleteAll()
Delete whole array.
Definition: array.hpp:802
HypreParMatrix * ParallelAssemble()
Returns the matrix assembled on the true dofs, i.e. P^t A P.
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
virtual void FormLinearSystem(const Array< int > &ess_tdof_list, Vector &x, Vector &b, OperatorHandle &A, Vector &X, Vector &B, int copy_interior=0)=0
virtual void Update(FiniteElementSpace *nfes=NULL)
double * GetData()
Return the element data, i.e. the array A.
Definition: sparsemat.hpp:151
HypreParMatrix * ParallelAssemble()
Returns the matrix assembled on the true dofs, i.e. P_test^t A P_trial.
void GetFaceNbrElementVDofs(int i, Array< int > &vdofs) const
Definition: pfespace.cpp:1160
void SetSize(int m, int n)
Definition: array.hpp:335
ParFiniteElementSpace * pfes
Points to the same object as fes.
const FiniteElement * GetFaceNbrFE(int i) const
Definition: pfespace.cpp:1194
MPI_Comm GetComm() const
Definition: pfespace.hpp:239
virtual void FormRectangularSystemOperator(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, OperatorHandle &A)=0
Data type sparse matrix.
Definition: sparsemat.hpp:40
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Definition: operator.hpp:57
StaticCondensation * static_cond
Owned.
int Append(const T &el)
Append element to array, resize if necessary.
Definition: array.hpp:707
Mesh * GetMesh() const
Returns the mesh.
Definition: fespace.hpp:295
void Clear()
Definition: table.cpp:381
SparseMatrix * mat
Sparse matrix to be associated with the form. Owned.
double b
Definition: lissajous.cpp:42
void ComputeSolution(const Vector &b, const Vector &sol_r, Vector &sol) const
void EliminateRowsCols(OperatorHandle &A, const Array< int > &ess_dof_list)
Reset the OperatorHandle to be the eliminated part of A after elimination of the essential dofs ess_d...
Definition: handle.cpp:252
FaceElementTransformations * GetSharedFaceTransformations(int sf, bool fill2=true)
Definition: pmesh.cpp:2356
HypreParMatrix * Dof_TrueDof_Matrix() const
The true dof-to-dof interpolation matrix.
Definition: pfespace.hpp:281
HypreParMatrix & GetParallelMatrix()
Return the parallel Schur complement matrix.
Definition: staticcond.hpp:159
void Assemble(int skip_zeros=1)
Assemble the local matrix.
void Transpose(const Table &A, Table &At, int _ncols_A)
Transpose a Table.
Definition: table.cpp:414
virtual void FormRectangularSystemMatrix(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, OperatorHandle &A)
Return in A a parallel (on truedofs) version of this operator.
virtual void Update(FiniteElementSpace *nfes=NULL)
ParFiniteElementSpace * test_pfes
Points to the same object as test_fes.
int Size() const
Returns the number of TYPE I elements.
Definition: table.hpp:92
int GetVDim() const
Returns vector dimension.
Definition: fespace.hpp:370
SparseMatrix * mat
Owned.
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
Definition: sparsemat.cpp:2224
Set the diagonal value to one.
Definition: matrix.hpp:35
Operator * Ptr() const
Access the underlying Operator pointer.
Definition: handle.hpp:82
Dynamic 2D array using row-major layout.
Definition: array.hpp:316
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 Finalized() const
Returns whether or not CSR format has been finalized.
Definition: sparsemat.hpp:428
HYPRE_Int GlobalVSize() const
Definition: pfespace.hpp:249
HypreParMatrix * ParallelAssemble() const
Returns the matrix &quot;assembled&quot; on the true dofs.
SparseMatrix * mat_e
Matrix used to eliminate b.c. Owned.
Wrapper for hypre&#39;s parallel vector class.
Definition: hypre.hpp:73
ParFiniteElementSpace * domain_fes
Points to the same object as trial_fes.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:87
MixedBilinearFormExtension * ext
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
Definition: sparsemat.cpp:548
void Finalize()
Finalize the construction of the Schur complement matrix.
Definition: staticcond.cpp:235
ParGridFunction X
Auxiliary objects used in TrueAddMult().
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged...
Definition: handle.hpp:116
void Distribute(const Vector *tv)
Definition: pgridfunc.cpp:132
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
virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x)
int height
Dimension of the output / number of rows in the matrix.
Definition: operator.hpp:27
Table * GetFaceToElementTable() const
Definition: mesh.cpp:4529
double a
Definition: lissajous.cpp:41
virtual void FormSystemMatrix(const Array< int > &ess_tdof_list, OperatorHandle &A)
Form the linear system matrix A, see FormLinearSystem() for details.
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
Definition: handle.hpp:112
void MakeSquareBlockDiag(MPI_Comm comm, HYPRE_Int glob_size, HYPRE_Int *row_starts, SparseMatrix *diag)
Reset the OperatorHandle to hold a parallel square block-diagonal matrix using the currently set type...
Definition: handle.cpp:60
virtual void Finalize(int skip_zeros=1)
Finalizes the matrix initialization.
virtual const SparseMatrix * GetRestrictionMatrix() const
Get the R matrix which restricts a local dof vector to true dof vector.
Definition: pfespace.hpp:339
SparseMatrix * mat_e
Owned.
ParFiniteElementSpace * range_fes
Points to the same object as test_fes.
bool HasEliminatedBC() const
Return true if essential boundary conditions have been eliminated from the Schur complement matrix...
Definition: staticcond.hpp:142
void MultTranspose(const Vector &x, Vector &y) const
Multiply a vector with the transposed matrix. y = At * x.
Definition: sparsemat.cpp:619
FiniteElementSpace * fes
FE space on which the form lives. Not owned.
void ParallelEliminateEssentialBC(const Array< int > &bdr_attr_is_ess, HypreParMatrix &A, const HypreParVector &X, HypreParVector &B) const
Eliminate essential boundary DOFs from a parallel assembled system.
const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement associated with i&#39;th element.
Definition: fespace.cpp:1642
virtual void FormRectangularLinearSystem(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, Vector &x, Vector &b, OperatorHandle &A, Vector &X, Vector &B)
Form the parallel linear system A X = B, corresponding to this mixed bilinear form and the linear for...
DenseMatrix elemmat
void MakeRectangularBlockDiag(MPI_Comm comm, HYPRE_Int glob_num_rows, HYPRE_Int glob_num_cols, HYPRE_Int *row_starts, HYPRE_Int *col_starts, SparseMatrix *diag)
Reset the OperatorHandle to hold a parallel rectangular block-diagonal matrix using the currently set...
Definition: handle.cpp:91
ParFiniteElementSpace * trial_pfes
Points to the same object as trial_fes.
int GetFaceNbrVSize() const
Definition: pfespace.hpp:344
HYPRE_Int * GetTrueDofOffsets() const
Definition: pfespace.hpp:248
OperatorHandle p_mat
Vector data type.
Definition: vector.hpp:48
void GetParBlocks(Array2D< HypreParMatrix * > &blocks) const
virtual void FormSystemMatrix(const Array< int > &ess_tdof_list, OperatorHandle &A)=0
ID for class HypreParMatrix.
Definition: operator.hpp:233
Hybridization * hybridization
Owned.
void ReduceRHS(const Vector &b, Vector &b_r) const
int * GetI()
Definition: table.hpp:113
const Table & GetElementToDofTable() const
Definition: fespace.hpp:524
void SetEssentialTrueDofs(const Array< int > &ess_tdof_list)
Determine and save internally essential reduced true dofs.
Definition: staticcond.hpp:128
Table * GetFaceToAllElementTable() const
Definition: pmesh.cpp:2266
Abstract operator.
Definition: operator.hpp:24
Wrapper for hypre&#39;s ParCSR matrix class.
Definition: hypre.hpp:187
void TrueAddMult(const Vector &x, Vector &y, const double a=1.0) const
Compute y += a (P^t A P) x, where x and y are vectors on the true dofs.
Class for parallel meshes.
Definition: pmesh.hpp:32
OperatorHandle p_mat
Matrix and eliminated matrix.
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
void MakePtAP(OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product P^t A P.
Definition: handle.cpp:123
int width
Dimension of the input / number of columns in the matrix.
Definition: operator.hpp:28
void MakeRAP(OperatorHandle &Rt, OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product R A P, where R = Rt^t.
Definition: handle.cpp:161
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
Definition: handle.hpp:137
virtual void FormRectangularLinearSystem(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, Vector &x, Vector &b, OperatorHandle &A, Vector &X, Vector &B)=0
ParFiniteElementSpace * ParFESpace() const
Definition: pgridfunc.hpp:103