MFEM
v3.1
Finite element discretization library
|
#include <bilinearform.hpp>
Public Member Functions | |
BilinearForm (FiniteElementSpace *f) | |
Creates bilinear form associated with FE space *f. More... | |
BilinearForm (FiniteElementSpace *f, BilinearForm *bf, int ps=0) | |
int | Size () const |
Get the size of the BilinearForm as a square matrix. More... | |
void | EnableStaticCondensation () |
bool | StaticCondensationIsEnabled () const |
FiniteElementSpace * | SCFESpace () const |
Return the trace FE space associated with static condensation. More... | |
void | EnableHybridization (FiniteElementSpace *constr_space, BilinearFormIntegrator *constr_integ, const Array< int > &ess_tdof_list) |
void | UsePrecomputedSparsity (int ps=1) |
void | AllocateMatrix () |
Array< BilinearFormIntegrator * > * | GetDBFI () |
Array< BilinearFormIntegrator * > * | GetBBFI () |
Array< BilinearFormIntegrator * > * | GetFBFI () |
Array< BilinearFormIntegrator * > * | GetBFBFI () |
const double & | operator() (int i, int j) |
virtual double & | Elem (int i, int j) |
Returns reference to a_{ij}. More... | |
virtual const double & | Elem (int i, int j) const |
Returns constant reference to a_{ij}. More... | |
virtual void | Mult (const Vector &x, Vector &y) const |
Matrix vector multiplication. More... | |
void | FullMult (const Vector &x, Vector &y) const |
virtual void | AddMult (const Vector &x, Vector &y, const double a=1.0) const |
void | FullAddMult (const Vector &x, Vector &y) const |
double | InnerProduct (const Vector &x, const Vector &y) const |
virtual MatrixInverse * | Inverse () const |
Returns a pointer to (approximation) of the matrix inverse. More... | |
virtual void | Finalize (int skip_zeros=1) |
Finalizes the matrix initialization. More... | |
const SparseMatrix & | SpMat () const |
Returns a reference to the sparse matrix. More... | |
SparseMatrix & | SpMat () |
SparseMatrix * | LoseMat () |
void | AddDomainIntegrator (BilinearFormIntegrator *bfi) |
Adds new Domain Integrator. More... | |
void | AddBoundaryIntegrator (BilinearFormIntegrator *bfi) |
Adds new Boundary Integrator. More... | |
void | AddInteriorFaceIntegrator (BilinearFormIntegrator *bfi) |
Adds new interior Face Integrator. More... | |
void | AddBdrFaceIntegrator (BilinearFormIntegrator *bfi) |
Adds new boundary Face Integrator. More... | |
void | operator= (const double a) |
void | Assemble (int skip_zeros=1) |
Assembles the form i.e. sums over all domain/bdr integrators. More... | |
void | ConformingAssemble () |
void | ConformingAssemble (GridFunction &sol, LinearForm &rhs) |
void | FormLinearSystem (Array< int > &ess_tdof_list, Vector &x, Vector &b, SparseMatrix &A, Vector &X, Vector &B, int copy_interior=0) |
void | RecoverFEMSolution (const Vector &X, const Vector &b, Vector &x) |
void | ComputeElementMatrices () |
Compute and store internally all element matrices. More... | |
void | FreeElementMatrices () |
Free the memory used by the element matrices. More... | |
void | ComputeElementMatrix (int i, DenseMatrix &elmat) |
void | AssembleElementMatrix (int i, const DenseMatrix &elmat, Array< int > &vdofs, int skip_zeros=1) |
void | EliminateEssentialBC (Array< int > &bdr_attr_is_ess, Vector &sol, Vector &rhs, int d=0) |
void | EliminateEssentialBC (Array< int > &bdr_attr_is_ess, int d=0) |
void | EliminateEssentialBCDiag (Array< int > &bdr_attr_is_ess, double value) |
Perform elimination and set the diagonal entry to the given value. More... | |
void | EliminateVDofs (Array< int > &vdofs, Vector &sol, Vector &rhs, int d=0) |
Eliminate the given vdofs. NOTE: here, vdofs is a list of DOFs. More... | |
void | EliminateVDofs (Array< int > &vdofs, int d=0) |
void | EliminateEssentialBCFromDofs (Array< int > &ess_dofs, Vector &sol, Vector &rhs, int d=0) |
void | EliminateEssentialBCFromDofs (Array< int > &ess_dofs, int d=0) |
void | EliminateEssentialBCFromDofsDiag (Array< int > &ess_dofs, double value) |
Perform elimination and set the diagonal entry to the given value. More... | |
void | EliminateVDofsInRHS (Array< int > &vdofs, const Vector &x, Vector &b) |
double | FullInnerProduct (const Vector &x, const Vector &y) const |
virtual void | Update (FiniteElementSpace *nfes=NULL) |
FiniteElementSpace * | GetFES () |
Return the FE space associated with the BilinearForm. More... | |
virtual | ~BilinearForm () |
Destroys bilinear form. More... | |
Public Member Functions inherited from mfem::Matrix | |
Matrix (int s) | |
Creates a square matrix of size s. More... | |
Matrix (int h, int w) | |
Creates a matrix of the given height and width. More... | |
virtual void | Print (std::ostream &out=std::cout, int width_=4) const |
Prints matrix to stream out. More... | |
virtual | ~Matrix () |
Destroys matrix. More... | |
Public Member Functions inherited from mfem::Operator | |
Operator (int s=0) | |
Construct a square Operator with given size s (default 0) More... | |
Operator (int h, int w) | |
int | Height () const |
Get the height (size of output) of the Operator. Synonym with NumRows. More... | |
int | NumRows () const |
int | Width () const |
Get the width (size of input) of the Operator. Synonym with NumCols. More... | |
int | NumCols () const |
virtual void | MultTranspose (const Vector &x, Vector &y) const |
Action of the transpose operator. More... | |
virtual Operator & | GetGradient (const Vector &x) const |
Evaluate the gradient operator at the point x. More... | |
void | PrintMatlab (std::ostream &out, int n=0, int m=0) |
Prints operator with input size n and output size m in matlab format. More... | |
virtual | ~Operator () |
Protected Member Functions | |
void | AllocMat () |
BilinearForm () | |
Protected Attributes | |
SparseMatrix * | mat |
Sparse matrix to be associated with the form. More... | |
SparseMatrix * | mat_e |
FiniteElementSpace * | fes |
FE space on which the form lives. More... | |
int | extern_bfs |
Array< BilinearFormIntegrator * > | dbfi |
Set of Domain Integrators to be applied. More... | |
Array< BilinearFormIntegrator * > | bbfi |
Set of Boundary Integrators to be applied. More... | |
Array< BilinearFormIntegrator * > | fbfi |
Set of interior face Integrators to be applied. More... | |
Array< BilinearFormIntegrator * > | bfbfi |
Set of boundary face Integrators to be applied. More... | |
DenseMatrix | elemmat |
Array< int > | vdofs |
DenseTensor * | element_matrices |
StaticCondensation * | static_cond |
Hybridization * | hybridization |
int | precompute_sparsity |
Protected Attributes inherited from mfem::Operator | |
int | height |
int | width |
Class for bilinear form - "Matrix" with associated FE space and BLFIntegrators.
Definition at line 29 of file bilinearform.hpp.
|
inlineprotected |
Definition at line 68 of file bilinearform.hpp.
mfem::BilinearForm::BilinearForm | ( | FiniteElementSpace * | f | ) |
Creates bilinear form associated with FE space *f.
Definition at line 64 of file bilinearform.cpp.
mfem::BilinearForm::BilinearForm | ( | FiniteElementSpace * | f, |
BilinearForm * | bf, | ||
int | ps = 0 |
||
) |
Definition at line 76 of file bilinearform.cpp.
|
virtual |
Destroys bilinear form.
Definition at line 754 of file bilinearform.cpp.
void mfem::BilinearForm::AddBdrFaceIntegrator | ( | BilinearFormIntegrator * | bfi | ) |
Adds new boundary Face Integrator.
Definition at line 191 of file bilinearform.cpp.
void mfem::BilinearForm::AddBoundaryIntegrator | ( | BilinearFormIntegrator * | bfi | ) |
Adds new Boundary Integrator.
Definition at line 181 of file bilinearform.cpp.
void mfem::BilinearForm::AddDomainIntegrator | ( | BilinearFormIntegrator * | bfi | ) |
Adds new Domain Integrator.
Definition at line 176 of file bilinearform.cpp.
void mfem::BilinearForm::AddInteriorFaceIntegrator | ( | BilinearFormIntegrator * | bfi | ) |
Adds new interior Face Integrator.
Definition at line 186 of file bilinearform.cpp.
|
inlinevirtual |
Definition at line 137 of file bilinearform.hpp.
|
inline |
Pre-allocate the internal SparseMatrix before assembly. If the flag 'precompute sparsity' is set, the matrix is allocated in CSR format (i.e. finalized) and the entries are initialized with zeros.
Definition at line 113 of file bilinearform.hpp.
|
protected |
Definition at line 20 of file bilinearform.cpp.
void mfem::BilinearForm::Assemble | ( | int | skip_zeros = 1 | ) |
Assembles the form i.e. sums over all domain/bdr integrators.
Definition at line 246 of file bilinearform.cpp.
void mfem::BilinearForm::AssembleElementMatrix | ( | int | i, |
const DenseMatrix & | elmat, | ||
Array< int > & | vdofs, | ||
int | skip_zeros = 1 |
||
) |
Definition at line 224 of file bilinearform.cpp.
void mfem::BilinearForm::ComputeElementMatrices | ( | ) |
Compute and store internally all element matrices.
Definition at line 563 of file bilinearform.cpp.
void mfem::BilinearForm::ComputeElementMatrix | ( | int | i, |
DenseMatrix & | elmat | ||
) |
Definition at line 196 of file bilinearform.cpp.
void mfem::BilinearForm::ConformingAssemble | ( | ) |
For partially conforming FE spaces, complete the assembly process by performing A := P^t A P where A is the internal sparse matrix and P is the conforming prolongation of the FE space. After this call the BilinearForm becomes an operator on the conforming FE space.
Definition at line 386 of file bilinearform.cpp.
|
inline |
A shortcut for converting the whole linear system to conforming DOFs.
Definition at line 185 of file bilinearform.hpp.
|
virtual |
Returns reference to a_{ij}.
Implements mfem::Matrix.
Definition at line 148 of file bilinearform.cpp.
|
virtual |
Returns constant reference to a_{ij}.
Implements mfem::Matrix.
Definition at line 153 of file bilinearform.cpp.
void mfem::BilinearForm::EliminateEssentialBC | ( | Array< int > & | bdr_attr_is_ess, |
Vector & | sol, | ||
Vector & | rhs, | ||
int | d = 0 |
||
) |
Eliminate essential boundary DOFs from the system. The array 'bdr_attr_is_ess' marks boundary attributes that constitute the essential part of the boundary. If d == 0, the diagonal at the essential DOFs is set to 1.0, otherwise it is left the same.
Definition at line 605 of file bilinearform.cpp.
void mfem::BilinearForm::EliminateEssentialBC | ( | Array< int > & | bdr_attr_is_ess, |
int | d = 0 |
||
) |
Definition at line 622 of file bilinearform.cpp.
void mfem::BilinearForm::EliminateEssentialBCDiag | ( | Array< int > & | bdr_attr_is_ess, |
double | value | ||
) |
Perform elimination and set the diagonal entry to the given value.
Definition at line 638 of file bilinearform.cpp.
void mfem::BilinearForm::EliminateEssentialBCFromDofs | ( | Array< int > & | ess_dofs, |
Vector & | sol, | ||
Vector & | rhs, | ||
int | d = 0 |
||
) |
Similar to EliminateVDofs but here ess_dofs is a marker (boolean) array on all vdofs (ess_dofs[i] < 0 is true).
Definition at line 693 of file bilinearform.cpp.
void mfem::BilinearForm::EliminateEssentialBCFromDofs | ( | Array< int > & | ess_dofs, |
int | d = 0 |
||
) |
Similar to EliminateVDofs but here ess_dofs is a marker (boolean) array on all vdofs (ess_dofs[i] < 0 is true).
Definition at line 707 of file bilinearform.cpp.
void mfem::BilinearForm::EliminateEssentialBCFromDofsDiag | ( | Array< int > & | ess_dofs, |
double | value | ||
) |
Perform elimination and set the diagonal entry to the given value.
Definition at line 718 of file bilinearform.cpp.
void mfem::BilinearForm::EliminateVDofs | ( | Array< int > & | vdofs, |
Vector & | sol, | ||
Vector & | rhs, | ||
int | d = 0 |
||
) |
Eliminate the given vdofs. NOTE: here, vdofs is a list of DOFs.
Definition at line 655 of file bilinearform.cpp.
void mfem::BilinearForm::EliminateVDofs | ( | Array< int > & | vdofs, |
int | d = 0 |
||
) |
Eliminate the given vdofs storing the eliminated part internally; this method works in conjunction with EliminateVDofsInRHS and allows elimination of boundary conditions in multiple right-hand sides. In this method, vdofs is a list of DOFs.
Definition at line 672 of file bilinearform.cpp.
Use the stored eliminated part of the matrix (see EliminateVDofs) to modify r.h.s.; vdofs is a list of DOFs (non-directional, i.e. >= 0).
Definition at line 730 of file bilinearform.cpp.
void mfem::BilinearForm::EnableHybridization | ( | FiniteElementSpace * | constr_space, |
BilinearFormIntegrator * | constr_integ, | ||
const Array< int > & | ess_tdof_list | ||
) |
Enable hybridization; for details see the description for class Hybridization in fem/hybridization.hpp. This method should be called before assembly.
Definition at line 138 of file bilinearform.cpp.
void mfem::BilinearForm::EnableStaticCondensation | ( | ) |
Enable the use of static condensation. For details see the description for class StaticCondensation in fem/staticcond.hpp This method should be called before assembly. If the number of unknowns after static condensation is not reduced, it is not enabled.
Definition at line 121 of file bilinearform.cpp.
|
virtual |
Finalizes the matrix initialization.
Reimplemented from mfem::Matrix.
Definition at line 168 of file bilinearform.cpp.
void mfem::BilinearForm::FormLinearSystem | ( | Array< int > & | ess_tdof_list, |
Vector & | x, | ||
Vector & | b, | ||
SparseMatrix & | A, | ||
Vector & | X, | ||
Vector & | B, | ||
int | copy_interior = 0 |
||
) |
Form the linear system A X = B, corresponding to the current bilinear form and b(.), by applying any necessary transformations such as: eliminating boundary conditions; applying conforming constraints for non-conforming AMR; static condensation; hybridization.
The GridFunction-size vector x must contain the essential b.c. The BilinearForm and the LinearForm-size vector b must be assembled.
The vector X is initialized with a suitable initial guess: when using hybridization, the vector X is set to zero; otherwise, the essential entries of X are set to the corresponding b.c. and all other entries are set to zero (copy_interior == 0) or copied from x (copy_interior != 0).
This method can be called multiple times (with the same ess_tdof_list array) to initialize different right-hand sides and boundary condition values.
After solving the linear system, the finite element solution x can be recovered by calling RecoverFEMSolution (with the same vectors X, b, and x).
Definition at line 421 of file bilinearform.cpp.
|
inline |
Free the memory used by the element matrices.
Definition at line 225 of file bilinearform.hpp.
Definition at line 140 of file bilinearform.hpp.
Definition at line 267 of file bilinearform.hpp.
Definition at line 134 of file bilinearform.hpp.
|
inline |
Definition at line 117 of file bilinearform.hpp.
|
inline |
Definition at line 121 of file bilinearform.hpp.
|
inline |
Definition at line 115 of file bilinearform.hpp.
|
inline |
Definition at line 119 of file bilinearform.hpp.
|
inline |
Return the FE space associated with the BilinearForm.
Definition at line 273 of file bilinearform.hpp.
Definition at line 143 of file bilinearform.hpp.
|
virtual |
Returns a pointer to (approximation) of the matrix inverse.
Implements mfem::Matrix.
Definition at line 163 of file bilinearform.cpp.
|
inline |
Definition at line 155 of file bilinearform.hpp.
Matrix vector multiplication.
Implements mfem::Operator.
Definition at line 158 of file bilinearform.cpp.
|
inline |
Definition at line 123 of file bilinearform.hpp.
|
inline |
Definition at line 169 of file bilinearform.hpp.
Call this method after solving a linear system constructed using the FormLinearSystem method to recover the solution as a GridFunction-size vector in x.
Definition at line 515 of file bilinearform.cpp.
|
inline |
Return the trace FE space associated with static condensation.
Definition at line 95 of file bilinearform.hpp.
|
inline |
Get the size of the BilinearForm as a square matrix.
Definition at line 82 of file bilinearform.hpp.
|
inline |
Returns a reference to the sparse matrix.
Definition at line 153 of file bilinearform.hpp.
|
inline |
Definition at line 154 of file bilinearform.hpp.
|
inline |
Check if static condensation was actually enabled by a previous call to EnableStaticCondensation.
Definition at line 92 of file bilinearform.hpp.
|
virtual |
Reimplemented in mfem::ParBilinearForm.
Definition at line 737 of file bilinearform.cpp.
|
inline |
For scalar FE spaces, precompute the sparsity pattern of the matrix (assuming dense element matrices) based on the types of integrators present in the bilinear form.
Definition at line 108 of file bilinearform.hpp.
|
protected |
Set of Boundary Integrators to be applied.
Definition at line 47 of file bilinearform.hpp.
|
protected |
Set of boundary face Integrators to be applied.
Definition at line 53 of file bilinearform.hpp.
|
protected |
Set of Domain Integrators to be applied.
Definition at line 44 of file bilinearform.hpp.
|
protected |
Definition at line 58 of file bilinearform.hpp.
|
protected |
Definition at line 55 of file bilinearform.hpp.
|
protected |
Definition at line 41 of file bilinearform.hpp.
|
protected |
Set of interior face Integrators to be applied.
Definition at line 50 of file bilinearform.hpp.
|
protected |
FE space on which the form lives.
Definition at line 39 of file bilinearform.hpp.
|
protected |
Definition at line 61 of file bilinearform.hpp.
|
protected |
Sparse matrix to be associated with the form.
Definition at line 33 of file bilinearform.hpp.
|
protected |
Definition at line 36 of file bilinearform.hpp.
|
protected |
Definition at line 63 of file bilinearform.hpp.
|
protected |
Definition at line 60 of file bilinearform.hpp.
|
protected |
Definition at line 56 of file bilinearform.hpp.