MFEM  v3.4
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
bilinearform.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
11 
12 #ifndef MFEM_BILINEARFORM
13 #define MFEM_BILINEARFORM
14 
15 #include "../config/config.hpp"
16 #include "../linalg/linalg.hpp"
17 #include "fespace.hpp"
18 #include "gridfunc.hpp"
19 #include "linearform.hpp"
20 #include "bilininteg.hpp"
21 #include "staticcond.hpp"
22 #include "hybridization.hpp"
23 
24 namespace mfem
25 {
26 
27 /** Class for bilinear form - "Matrix" with associated FE space and
28  BLFIntegrators. */
29 class BilinearForm : public Matrix
30 {
31 protected:
32  /// Sparse matrix to be associated with the form.
34 
35  /// Matrix used to eliminate b.c.
37 
38  /// FE space on which the form lives.
40 
41  /// Indicates the Mesh::sequence corresponding to the current state of the
42  /// BilinearForm.
43  long sequence;
44 
46 
47  /// Set of Domain Integrators to be applied.
49 
50  /// Set of Boundary Integrators to be applied.
53 
54  /// Set of interior face Integrators to be applied.
56 
57  /// Set of boundary face Integrators to be applied.
60 
63 
65 
68 
69  /**
70  * This member allows one to specify what should be done
71  * to the diagonal matrix entries and corresponding RHS
72  * values upon elimination of the constrained DoFs.
73  */
75 
77  // Allocate appropriate SparseMatrix and assign it to mat
78  void AllocMat();
79 
80  void ConformingAssemble();
81 
82  // may be used in the construction of derived classes
84  {
85  fes = NULL; sequence = -1;
86  mat = mat_e = NULL; extern_bfs = 0; element_matrices = NULL;
87  static_cond = NULL; hybridization = NULL;
90  }
91 
92 public:
93  /// Creates bilinear form associated with FE space @a *f.
95 
96  BilinearForm(FiniteElementSpace *f, BilinearForm *bf, int ps = 0);
97 
98  /// Get the size of the BilinearForm as a square matrix.
99  int Size() const { return height; }
100 
101  /** Enable the use of static condensation. For details see the description
102  for class StaticCondensation in fem/staticcond.hpp This method should be
103  called before assembly. If the number of unknowns after static
104  condensation is not reduced, it is not enabled. */
106 
107  /** Check if static condensation was actually enabled by a previous call to
108  EnableStaticCondensation(). */
109  bool StaticCondensationIsEnabled() const { return static_cond; }
110 
111  /// Return the trace FE space associated with static condensation.
113  { return static_cond ? static_cond->GetTraceFESpace() : NULL; }
114 
115  /** Enable hybridization; for details see the description for class
116  Hybridization in fem/hybridization.hpp. This method should be called
117  before assembly. */
118  void EnableHybridization(FiniteElementSpace *constr_space,
119  BilinearFormIntegrator *constr_integ,
120  const Array<int> &ess_tdof_list);
121 
122  /** For scalar FE spaces, precompute the sparsity pattern of the matrix
123  (assuming dense element matrices) based on the types of integrators
124  present in the bilinear form. */
125  void UsePrecomputedSparsity(int ps = 1) { precompute_sparsity = ps; }
126 
127  /** @brief Use the given CSR sparsity pattern to allocate the internal
128  SparseMatrix.
129 
130  - The @a I and @a J arrays must define a square graph with size equal to
131  GetVSize() of the associated FiniteElementSpace.
132  - This method should be called after enabling static condensation or
133  hybridization, if used.
134  - In the case of static condensation, @a I and @a J are not used.
135  - The ownership of the arrays @a I and @a J remains with the caller. */
136  void UseSparsity(int *I, int *J, bool isSorted);
137 
138  /// Use the sparsity of @a A to allocate the internal SparseMatrix.
139  void UseSparsity(SparseMatrix &A);
140 
141  /** Pre-allocate the internal SparseMatrix before assembly. If the flag
142  'precompute sparsity' is set, the matrix is allocated in CSR format (i.e.
143  finalized) and the entries are initialized with zeros. */
144  void AllocateMatrix() { if (mat == NULL) { AllocMat(); } }
145 
147 
149 
151 
153 
154  const double &operator()(int i, int j) { return (*mat)(i,j); }
155 
156  /// Returns reference to a_{ij}.
157  virtual double &Elem(int i, int j);
158 
159  /// Returns constant reference to a_{ij}.
160  virtual const double &Elem(int i, int j) const;
161 
162  /// Matrix vector multiplication.
163  virtual void Mult(const Vector &x, Vector &y) const { mat->Mult(x, y); }
164 
165  void FullMult(const Vector &x, Vector &y) const
166  { mat->Mult(x, y); mat_e->AddMult(x, y); }
167 
168  virtual void AddMult(const Vector &x, Vector &y, const double a = 1.0) const
169  { mat -> AddMult (x, y, a); }
170 
171  void FullAddMult(const Vector &x, Vector &y) const
172  { mat->AddMult(x, y); mat_e->AddMult(x, y); }
173 
174  virtual void AddMultTranspose(const Vector & x, Vector & y,
175  const double a = 1.0) const
176  { mat->AddMultTranspose(x, y, a); }
177 
178  void FullAddMultTranspose (const Vector & x, Vector & y) const
179  { mat->AddMultTranspose(x, y); mat_e->AddMultTranspose(x, y); }
180 
181  virtual void MultTranspose (const Vector & x, Vector & y) const
182  { y = 0.0; AddMultTranspose (x, y); }
183 
184  double InnerProduct(const Vector &x, const Vector &y) const
185  { return mat->InnerProduct (x, y); }
186 
187  /// Returns a pointer to (approximation) of the matrix inverse.
188  virtual MatrixInverse *Inverse() const;
189 
190  /// Finalizes the matrix initialization.
191  virtual void Finalize(int skip_zeros = 1);
192 
193  /// Returns a reference to the sparse matrix
194  const SparseMatrix &SpMat() const
195  {
196  MFEM_VERIFY(mat, "mat is NULL and can't be dereferenced");
197  return *mat;
198  }
200  {
201  MFEM_VERIFY(mat, "mat is NULL and can't be dereferenced");
202  return *mat;
203  }
204  SparseMatrix *LoseMat() { SparseMatrix *tmp = mat; mat = NULL; return tmp; }
205 
206  /// Returns a reference to the sparse matrix of eliminated b.c.
207  const SparseMatrix &SpMatElim() const
208  {
209  MFEM_VERIFY(mat_e, "mat_e is NULL and can't be dereferenced");
210  return *mat_e;
211  }
213  {
214  MFEM_VERIFY(mat_e, "mat_e is NULL and can't be dereferenced");
215  return *mat_e;
216  }
217 
218  /// Adds new Domain Integrator.
220 
221  /// Adds new Boundary Integrator.
223 
224  /** @brief Adds new Boundary Integrator, restricted to specific boundary
225  attributes. */
227  Array<int> &bdr_marker);
228 
229  /// Adds new interior Face Integrator.
231 
232  /// Adds new boundary Face Integrator.
234 
235  /** @brief Adds new boundary Face Integrator, restricted to specific boundary
236  attributes. */
238  Array<int> &bdr_marker);
239 
240  void operator=(const double a)
241  {
242  if (mat != NULL) { *mat = a; }
243  if (mat_e != NULL) { *mat_e = a; }
244  }
245 
246  /// Assembles the form i.e. sums over all domain/bdr integrators.
247  void Assemble(int skip_zeros = 1);
248 
249  /// Get the finite element space prolongation matrix
250  virtual const Operator *GetProlongation() const
251  { return fes->GetConformingProlongation(); }
252  /// Get the finite element space restriction matrix
253  virtual const Operator *GetRestriction() const
254  { return fes->GetConformingRestriction(); }
255 
256  /// Form a linear system, A X = B.
257  /** Form the linear system A X = B, corresponding to the current bilinear
258  form and b(.), by applying any necessary transformations such as:
259  eliminating boundary conditions; applying conforming constraints for
260  non-conforming AMR; static condensation; hybridization.
261 
262  The GridFunction-size vector @a x must contain the essential b.c. The
263  BilinearForm and the LinearForm-size vector @a b must be assembled.
264 
265  The vector @a X is initialized with a suitable initial guess: when using
266  hybridization, the vector @a X is set to zero; otherwise, the essential
267  entries of @a X are set to the corresponding b.c. and all other entries
268  are set to zero (@a copy_interior == 0) or copied from @a x
269  (@a copy_interior != 0).
270 
271  This method can be called multiple times (with the same @a ess_tdof_list
272  array) to initialize different right-hand sides and boundary condition
273  values.
274 
275  After solving the linear system, the finite element solution @a x can be
276  recovered by calling RecoverFEMSolution() (with the same vectors @a X,
277  @a b, and @a x).
278 
279  NOTE: If there are no transformations, @a X simply reuses the data of
280  @a x. */
281  void FormLinearSystem(const Array<int> &ess_tdof_list, Vector &x, Vector &b,
282  SparseMatrix &A, Vector &X, Vector &B,
283  int copy_interior = 0);
284 
285  /// Form the linear system matrix A, see FormLinearSystem() for details.
286  void FormSystemMatrix(const Array<int> &ess_tdof_list, SparseMatrix &A);
287 
288  /// Recover the solution of a linear system formed with FormLinearSystem().
289  /** Call this method after solving a linear system constructed using the
290  FormLinearSystem() method to recover the solution as a GridFunction-size
291  vector in @a x. Use the same arguments as in the FormLinearSystem() call.
292  */
293  virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x);
294 
295  /// Compute and store internally all element matrices.
296  void ComputeElementMatrices();
297 
298  /// Free the memory used by the element matrices.
300  { delete element_matrices; element_matrices = NULL; }
301 
302  void ComputeElementMatrix(int i, DenseMatrix &elmat);
303  void AssembleElementMatrix(int i, const DenseMatrix &elmat,
304  Array<int> &vdofs, int skip_zeros = 1);
305  void AssembleBdrElementMatrix(int i, const DenseMatrix &elmat,
306  Array<int> &vdofs, int skip_zeros = 1);
307 
308  /// Eliminate essential boundary DOFs from the system.
309  /** The array @a bdr_attr_is_ess marks boundary attributes that constitute
310  the essential part of the boundary. By default, the diagonal at the
311  essential DOFs is set to 1.0. This behavior is controlled by the argument
312  @a dpolicy. */
313  void EliminateEssentialBC(const Array<int> &bdr_attr_is_ess,
314  const Vector &sol, Vector &rhs,
315  DiagonalPolicy dpolicy = DIAG_ONE);
316 
317  /// Eliminate essential boundary DOFs from the system matrix.
318  void EliminateEssentialBC(const Array<int> &bdr_attr_is_ess,
319  DiagonalPolicy dpolicy = DIAG_ONE);
320  /// Perform elimination and set the diagonal entry to the given value
321  void EliminateEssentialBCDiag(const Array<int> &bdr_attr_is_ess,
322  double value);
323 
324  /// Eliminate the given @a vdofs. NOTE: here, @a vdofs is a list of DOFs.
325  void EliminateVDofs(const Array<int> &vdofs, const Vector &sol, Vector &rhs,
326  DiagonalPolicy dpolicy = DIAG_ONE);
327 
328  /// Eliminate the given @a vdofs, storing the eliminated part internally.
329  /** This method works in conjunction with EliminateVDofsInRHS() and allows
330  elimination of boundary conditions in multiple right-hand sides. In this
331  method, @a vdofs is a list of DOFs. */
332  void EliminateVDofs(const Array<int> &vdofs,
333  DiagonalPolicy dpolicy = DIAG_ONE);
334 
335  /** @brief Similar to
336  EliminateVDofs(const Array<int> &, const Vector &, Vector &, DiagonalPolicy)
337  but here @a ess_dofs is a marker (boolean) array on all vector-dofs
338  (@a ess_dofs[i] < 0 is true). */
339  void EliminateEssentialBCFromDofs(const Array<int> &ess_dofs, const Vector &sol,
340  Vector &rhs, DiagonalPolicy dpolicy = DIAG_ONE);
341 
342  /** @brief Similar to EliminateVDofs(const Array<int> &, DiagonalPolicy) but
343  here @a ess_dofs is a marker (boolean) array on all vector-dofs
344  (@a ess_dofs[i] < 0 is true). */
345  void EliminateEssentialBCFromDofs(const Array<int> &ess_dofs,
346  DiagonalPolicy dpolicy = DIAG_ONE);
347  /// Perform elimination and set the diagonal entry to the given value
348  void EliminateEssentialBCFromDofsDiag(const Array<int> &ess_dofs,
349  double value);
350 
351  /** @brief Use the stored eliminated part of the matrix (see
352  EliminateVDofs(const Array<int> &, DiagonalPolicy)) to modify the r.h.s.
353  @a b; @a vdofs is a list of DOFs (non-directional, i.e. >= 0). */
354  void EliminateVDofsInRHS(const Array<int> &vdofs, const Vector &x,
355  Vector &b);
356 
357  double FullInnerProduct(const Vector &x, const Vector &y) const
358  { return mat->InnerProduct(x, y) + mat_e->InnerProduct(x, y); }
359 
360  virtual void Update(FiniteElementSpace *nfes = NULL);
361 
362  /// (DEPRECATED) Return the FE space associated with the BilinearForm.
363  /** @deprecated Use FESpace() instead. */
365 
366  /// Return the FE space associated with the BilinearForm.
368  /// Read-only access to the associated FiniteElementSpace.
369  const FiniteElementSpace *FESpace() const { return fes; }
370 
371  /// Sets diagonal policy used upon construction of the linear system
372  void SetDiagonalPolicy(DiagonalPolicy policy);
373 
374  /// Destroys bilinear form.
375  virtual ~BilinearForm();
376 };
377 
378 /**
379  Class for assembling of bilinear forms `a(u,v)` defined on different
380  trial and test spaces. The assembled matrix `A` is such that
381 
382  a(u,v) = V^t A U
383 
384  where `U` and `V` are the vectors representing the functions `u` and `v`,
385  respectively. The first argument, `u`, of `a(,)` is in the trial space
386  and the second argument, `v`, is in the test space. Thus,
387 
388  # of rows of A = dimension of the test space and
389  # of cols of A = dimension of the trial space.
390 
391  Both trial and test spaces should be defined on the same mesh.
392 */
393 class MixedBilinearForm : public Matrix
394 {
395 protected:
397 
399 
402  Array<BilinearFormIntegrator*> skt; // trace face integrators
403 
404 public:
406  FiniteElementSpace *te_fes);
407 
408  virtual double& Elem (int i, int j);
409 
410  virtual const double& Elem (int i, int j) const;
411 
412  virtual void Mult (const Vector & x, Vector & y) const;
413 
414  virtual void AddMult (const Vector & x, Vector & y,
415  const double a = 1.0) const;
416 
417  virtual void AddMultTranspose (const Vector & x, Vector & y,
418  const double a = 1.0) const;
419 
420  virtual void MultTranspose (const Vector & x, Vector & y) const
421  { y = 0.0; AddMultTranspose (x, y); }
422 
423  virtual MatrixInverse * Inverse() const;
424 
425  virtual void Finalize (int skip_zeros = 1);
426 
427  /** Extract the associated matrix as SparseMatrix blocks. The number of
428  block rows and columns is given by the vector dimensions (vdim) of the
429  test and trial spaces, respectively. */
430  void GetBlocks(Array2D<SparseMatrix *> &blocks) const;
431 
432  const SparseMatrix &SpMat() const { return *mat; }
433  SparseMatrix &SpMat() { return *mat; }
434  SparseMatrix *LoseMat() { SparseMatrix *tmp = mat; mat = NULL; return tmp; }
435 
437 
439 
440  /** Add a trace face integrator. This type of integrator assembles terms
441  over all faces of the mesh using the face FE from the trial space and the
442  two adjacent volume FEs from the test space. */
444 
446 
448 
450 
451  void operator= (const double a) { *mat = a; }
452 
453  void Assemble (int skip_zeros = 1);
454 
455  /** For partially conforming trial and/or test FE spaces, complete the
456  assembly process by performing A := P2^t A P1 where A is the internal
457  sparse matrix; P1 and P2 are the conforming prolongation matrices of the
458  trial and test FE spaces, respectively. After this call the
459  MixedBilinearForm becomes an operator on the conforming FE spaces. */
460  void ConformingAssemble();
461 
462  void EliminateTrialDofs(Array<int> &bdr_attr_is_ess,
463  const Vector &sol, Vector &rhs);
464 
466  const Vector &sol, Vector &rhs);
467 
468  virtual void EliminateTestDofs(Array<int> &bdr_attr_is_ess);
469 
470  void Update();
471 
472  virtual ~MixedBilinearForm();
473 };
474 
475 
476 /**
477  Class for constructing the matrix representation of a linear operator,
478  `v = L u`, from one FiniteElementSpace (domain) to another FiniteElementSpace
479  (range). The constructed matrix `A` is such that
480 
481  V = A U
482 
483  where `U` and `V` are the vectors of degrees of freedom representing the
484  functions `u` and `v`, respectively. The dimensions of `A` are
485 
486  number of rows of A = dimension of the range space and
487  number of cols of A = dimension of the domain space.
488 
489  This class is very similar to MixedBilinearForm. One difference is that
490  the linear operator `L` is defined using a special kind of
491  BilinearFormIntegrator (we reuse its functionality instead of defining a
492  new class). The other difference with the MixedBilinearForm class is that
493  the "assembly" process overwrites the global matrix entries using the
494  local element matrices instead of adding them.
495 
496  Note that if we define the bilinear form `b(u,v) := (Lu,v)` using an inner
497  product in the range space, then its matrix representation, `B`, is
498 
499  B = M A, (since V^t B U = b(u,v) = (Lu,v) = V^t M A U)
500 
501  where `M` denotes the mass matrix for the inner product in the range space:
502  `V1^t M V2 = (v1,v2)`. Similarly, if `c(u,w) := (Lu,Lw)` then
503 
504  C = A^t M A.
505 */
507 {
508 public:
510  FiniteElementSpace *range_fes)
511  : MixedBilinearForm(domain_fes, range_fes) { }
512 
514  { AddDomainIntegrator(di); }
515 
517  { AddTraceFaceIntegrator(di); }
518 
520 
521  virtual void Assemble(int skip_zeros = 1);
522 };
523 
524 }
525 
526 #endif
void EliminateEssentialBCFromDofs(const Array< int > &ess_dofs, const Vector &sol, Vector &rhs, DiagonalPolicy dpolicy=DIAG_ONE)
Similar to EliminateVDofs(const Array&lt;int&gt; &amp;, const Vector &amp;, Vector &amp;, DiagonalPolicy) but here ess_...
void FullAddMult(const Vector &x, Vector &y) const
SparseMatrix & SpMat()
Array< BilinearFormIntegrator * > * GetBBFI()
virtual void AddMult(const Vector &x, Vector &y, const double a=1.0) const
Array< BilinearFormIntegrator * > skt
const SparseMatrix * GetConformingProlongation() const
Definition: fespace.cpp:761
virtual MatrixInverse * Inverse() const
Returns a pointer to (approximation) of the matrix inverse.
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.
FiniteElementSpace * FESpace()
Return the FE space associated with the BilinearForm.
Array< BilinearFormIntegrator * > * GetDBFI()
Array< BilinearFormIntegrator * > dbfi
Set of Domain Integrators to be applied.
virtual void AddMult(const Vector &x, Vector &y, const double a=1.0) const
Array< BilinearFormIntegrator * > * GetBFBFI()
void EliminateEssentialBCFromTrialDofs(Array< int > &marked_vdofs, const Vector &sol, Vector &rhs)
Array< Array< int > * > bbfi_marker
virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x)
Recover the solution of a linear system formed with FormLinearSystem().
void EliminateTrialDofs(Array< int > &bdr_attr_is_ess, const Vector &sol, Vector &rhs)
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
void AddMult(const Vector &x, Vector &y, const double a=1.0) const
y += A * x (default) or y += a * A * x
Definition: sparsemat.cpp:492
void AddMultTranspose(const Vector &x, Vector &y, const double a=1.0) const
y += At * x (default) or y += a * At * x
Definition: sparsemat.cpp:569
Abstract data type for matrix inverse.
Definition: matrix.hpp:66
void FormSystemMatrix(const Array< int > &ess_tdof_list, SparseMatrix &A)
Form the linear system matrix A, see FormLinearSystem() for details.
virtual const Operator * GetProlongation() const
Get the finite element space prolongation matrix.
virtual void Finalize(int skip_zeros=1)
Finalizes the matrix initialization.
Array< BilinearFormIntegrator * > * GetFBFI()
MixedBilinearForm(FiniteElementSpace *tr_fes, FiniteElementSpace *te_fes)
double FullInnerProduct(const Vector &x, const Vector &y) const
void AddDomainInterpolator(DiscreteInterpolator *di)
void SetDiagonalPolicy(DiagonalPolicy policy)
Sets diagonal policy used upon construction of the linear system.
void EnableHybridization(FiniteElementSpace *constr_space, BilinearFormIntegrator *constr_integ, const Array< int > &ess_tdof_list)
void EliminateEssentialBCFromDofsDiag(const Array< int > &ess_dofs, double value)
Perform elimination and set the diagonal entry to the given value.
Array< BilinearFormIntegrator * > bdr
void AddDomainIntegrator(BilinearFormIntegrator *bfi)
SparseMatrix & SpMat()
const SparseMatrix * GetConformingRestriction() const
Definition: fespace.cpp:768
void FullAddMultTranspose(const Vector &x, Vector &y) const
Keep the diagonal value.
Definition: matrix.hpp:36
DiscreteLinearOperator(FiniteElementSpace *domain_fes, FiniteElementSpace *range_fes)
virtual void AddMultTranspose(const Vector &x, Vector &y, const double a=1.0) const
Data type sparse matrix.
Definition: sparsemat.hpp:38
StaticCondensation * static_cond
const FiniteElementSpace * FESpace() const
Read-only access to the associated FiniteElementSpace.
SparseMatrix * mat
Sparse matrix to be associated with the form.
void EliminateVDofs(const Array< int > &vdofs, const Vector &sol, Vector &rhs, DiagonalPolicy dpolicy=DIAG_ONE)
Eliminate the given vdofs. NOTE: here, vdofs is a list of DOFs.
int Size() const
Get the size of the BilinearForm as a square matrix.
Abstract data type matrix.
Definition: matrix.hpp:27
void EliminateEssentialBC(const Array< int > &bdr_attr_is_ess, const Vector &sol, Vector &rhs, DiagonalPolicy dpolicy=DIAG_ONE)
Eliminate essential boundary DOFs from the system.
void Assemble(int skip_zeros=1)
void FullMult(const Vector &x, Vector &y) const
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
void EliminateEssentialBCDiag(const Array< int > &bdr_attr_is_ess, double value)
Perform elimination and set the diagonal entry to the given value.
virtual void Update(FiniteElementSpace *nfes=NULL)
FiniteElementSpace * GetFES()
(DEPRECATED) Return the FE space associated with the BilinearForm.
void AddTraceFaceIntegrator(BilinearFormIntegrator *bfi)
void GetBlocks(Array2D< SparseMatrix * > &blocks) const
Array< BilinearFormIntegrator * > * GetTFBFI()
Set the diagonal value to one.
Definition: matrix.hpp:35
Dynamic 2D array using row-major layout.
Definition: array.hpp:289
Array< BilinearFormIntegrator * > * GetBBFI()
void ComputeElementMatrix(int i, DenseMatrix &elmat)
SparseMatrix & SpMatElim()
SparseMatrix * mat_e
Matrix used to eliminate b.c.
bool StaticCondensationIsEnabled() const
Abstract base class BilinearFormIntegrator.
Definition: bilininteg.hpp:22
virtual const Operator * GetRestriction() const
Get the finite element space restriction matrix.
void AssembleElementMatrix(int i, const DenseMatrix &elmat, Array< int > &vdofs, int skip_zeros=1)
void UsePrecomputedSparsity(int ps=1)
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 ...
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:66
SparseMatrix * LoseMat()
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
Definition: sparsemat.cpp:486
Array< BilinearFormIntegrator * > bfbfi
Set of boundary face Integrators to be applied.
Array< BilinearFormIntegrator * > bbfi
Set of Boundary Integrators to be applied.
DenseTensor * element_matrices
SparseMatrix * LoseMat()
void operator=(const double a)
virtual void AddMultTranspose(const Vector &x, Vector &y, const double a=1.0) const
void AddTraceFaceInterpolator(DiscreteInterpolator *di)
virtual double & Elem(int i, int j)
Returns reference to a_{ij}.
Array< BilinearFormIntegrator * > dom
double InnerProduct(const Vector &x, const Vector &y) const
DiagonalPolicy diag_policy
int height
Dimension of the output / number of rows in the matrix.
Definition: operator.hpp:24
const SparseMatrix & SpMat() const
FiniteElementSpace * test_fes
const double & operator()(int i, int j)
FiniteElementSpace * GetTraceFESpace()
Return a pointer to the reduced/trace FE space.
Definition: staticcond.hpp:109
virtual void EliminateTestDofs(Array< int > &bdr_attr_is_ess)
virtual void Finalize(int skip_zeros=1)
Finalizes the matrix initialization.
void EliminateVDofsInRHS(const Array< int > &vdofs, const Vector &x, Vector &b)
Use the stored eliminated part of the matrix (see EliminateVDofs(const Array&lt;int&gt; &amp;...
const SparseMatrix & SpMatElim() const
Returns a reference to the sparse matrix of eliminated b.c.
void AddBoundaryIntegrator(BilinearFormIntegrator *bfi)
Adds new Boundary Integrator.
void AddInteriorFaceIntegrator(BilinearFormIntegrator *bfi)
Adds new interior Face Integrator.
FiniteElementSpace * fes
FE space on which the form lives.
void AddDomainIntegrator(BilinearFormIntegrator *bfi)
Adds new Domain Integrator.
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
void ComputeElementMatrices()
Compute and store internally all element matrices.
FiniteElementSpace * SCFESpace() const
Return the trace FE space associated with static condensation.
void AssembleBdrElementMatrix(int i, const DenseMatrix &elmat, Array< int > &vdofs, int skip_zeros=1)
DenseMatrix elemmat
FiniteElementSpace * trial_fes
virtual double & Elem(int i, int j)
Returns reference to a_{ij}.
virtual ~BilinearForm()
Destroys bilinear form.
Vector data type.
Definition: vector.hpp:48
void AddBoundaryIntegrator(BilinearFormIntegrator *bfi)
virtual MatrixInverse * Inverse() const
Returns a pointer to (an approximation) of the matrix inverse.
Hybridization * hybridization
void operator=(const double a)
Array< BilinearFormIntegrator * > * GetDBFI()
const SparseMatrix & SpMat() const
Returns a reference to the sparse matrix.
Array< Array< int > * > bfbfi_marker
Array< int > vdofs
void FreeElementMatrices()
Free the memory used by the element matrices.
Abstract operator.
Definition: operator.hpp:21
virtual void Assemble(int skip_zeros=1)
void FormLinearSystem(const Array< int > &ess_tdof_list, Vector &x, Vector &b, SparseMatrix &A, Vector &X, Vector &B, int copy_interior=0)
Form a linear system, A X = B.
Rank 3 tensor (array of matrices)
Definition: densemat.hpp:638
Array< BilinearFormIntegrator * > * GetDI()
void UseSparsity(int *I, int *J, bool isSorted)
Use the given CSR sparsity pattern to allocate the internal SparseMatrix.
double InnerProduct(const Vector &x, const Vector &y) const
Compute y^t A x.
Definition: sparsemat.cpp:690
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
void EnableStaticCondensation()
void AddBdrFaceIntegrator(BilinearFormIntegrator *bfi)
Adds new boundary Face Integrator.