38 Table face_dof, dof_face;
57 int *I = dof_dof.
GetI();
58 int *J = dof_dof.
GetJ();
121 MFEM_ABORT(
"the assembly level has already been set!");
142 MFEM_ABORT(
"BilinearForm: unknown assembly level");
152 MFEM_WARNING(
"Static condensation not supported for this assembly level");
158 bool symmetric =
false;
159 bool block_diagonal =
false;
178 MFEM_WARNING(
"Hybridization not supported for this assembly level");
205 "invalid matrix A dimensions: "
207 MFEM_ASSERT(A.
Finalized(),
"matrix A must be Finalized");
296 domain_integs[0]->AssembleElementMatrix(fe, *eltrans, elmat);
406#ifdef MFEM_USE_LEGACY_OPENMP
407 int free_element_matrices = 0;
411 free_element_matrices = 1;
423 "invalid element marker for domain integrator #"
424 << k <<
", counting from zero");
429 MFEM_VERIFY(
fes->
GetNURBSext(),
"Patchwise integration requires a "
430 <<
"NURBS FE space");
435 for (
int i = 0; i <
fes -> GetNE(); i++)
443 elmat_p = &(*element_matrices)(i);
459 if (elmat.
Size() == 0)
469 if (elmat.
Size() == 0)
502 bool vdofsSet =
false;
518 for (
int r=0; r<spmat->
Height(); ++r)
520 spmat->
GetRow(r, cols, srow);
521 for (
int i=0; i<cols.
Size(); ++i)
523 cols[i] =
vdofs[cols[i]];
549 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
550 "invalid boundary marker for boundary integrator #"
551 << k <<
", counting from zero");
552 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
554 bdr_attr_marker[i] |= bdr_marker[i];
558 for (
int i = 0; i <
fes -> GetNBE(); i++)
561 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
564 doftrans =
fes -> GetBdrElementVDofs (i,
vdofs);
565 eltrans =
fes -> GetBdrElementTransformation (i);
610 for (
int i = 0; i < nfaces; i++)
612 tr = mesh -> GetInteriorFaceTransformations (i);
615 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
616 fes -> GetElementVDofs (tr -> Elem2No, vdofs2);
621 AssembleFaceMatrix(*
fes->
GetFE(tr->Elem1No),
647 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
648 "invalid boundary marker for boundary face integrator #"
649 << k <<
", counting from zero");
650 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
652 bdr_attr_marker[i] |= bdr_marker[i];
656 for (
int i = 0; i <
fes -> GetNBE(); i++)
659 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
661 tr = mesh -> GetBdrFaceTransformations (i);
664 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
665 fe1 =
fes -> GetFE (tr -> Elem1No);
684#ifdef MFEM_USE_LEGACY_OPENMP
685 if (free_element_matrices)
699 MFEM_ASSERT(
mat,
"the BilinearForm is not assembled");
730 "Vector for holding diagonal has wrong size!");
734 MFEM_ASSERT(
mat,
"the BilinearForm is not assembled!");
736 "BilinearForm::ConformingAssemble() is not called!");
758 Vector &B,
int copy_interior)
854 const int remove_zeros = 0;
942#ifdef MFEM_USE_LEGACY_OPENMP
943 #pragma omp parallel for private(tmp,eltrans)
945 for (
int i = 0; i < num_elements; i++)
948 num_dofs_per_el, num_dofs_per_el);
952 mfem_error(
"BilinearForm::ComputeElementMatrices:"
953 " all elements must have same number of dofs");
1025 for (
int i = 0; i < vdofs_.
Size(); i++)
1027 int vdof = vdofs_[i];
1030 mat -> EliminateRowCol (vdof, sol(vdof), rhs, dpolicy);
1034 mat -> EliminateRowCol (-1-vdof, sol(-1-vdof), rhs, dpolicy);
1048 for (
int i = 0; i < vdofs_.
Size(); i++)
1050 int vdof = vdofs_[i];
1053 mat -> EliminateRowCol (vdof, *
mat_e, dpolicy);
1057 mat -> EliminateRowCol (-1-vdof, *
mat_e, dpolicy);
1066 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
1067 MFEM_ASSERT(sol.
Size() ==
height,
"incorrect sol Vector size");
1068 MFEM_ASSERT(rhs.
Size() ==
height,
"incorrect rhs Vector size");
1070 for (
int i = 0; i < ess_dofs.
Size(); i++)
1071 if (ess_dofs[i] < 0)
1073 mat -> EliminateRowCol (i, sol(i), rhs, dpolicy);
1081 "incorrect dof Array size: " << ess_dofs.
Size() <<
' ' <<
height);
1083 for (
int i = 0; i < ess_dofs.
Size(); i++)
1084 if (ess_dofs[i] < 0)
1086 mat -> EliminateRowCol (i, dpolicy);
1094 "incorrect dof Array size: " << ess_dofs.
Size() <<
' ' <<
height);
1096 for (
int i = 0; i < ess_dofs.
Size(); i++)
1097 if (ess_dofs[i] < 0)
1099 mat -> EliminateRowColDiag (i, value);
1139 if (nfes && nfes !=
fes)
1207 :
Matrix(te_fes->GetVSize(), tr_fes->GetVSize())
1221 :
Matrix(te_fes->GetVSize(), tr_fes->GetVSize())
1250 MFEM_ABORT(
"the assembly level has already been set!");
1262 mfem_error(
"Element assembly not supported yet... stay tuned!");
1269 mfem_error(
"Matrix-free action not supported yet... stay tuned!");
1279 return (*
mat)(i, j);
1284 return (*
mat)(i, j);
1329 MFEM_WARNING(
"MixedBilinearForm::Inverse not possible with this "
1351 "MixedBilinearForm::GetBlocks: both trial and test spaces "
1352 "must use Ordering::byNODES!");
1432 "invalid element marker for domain integrator #"
1433 << k <<
", counting from zero");
1437 for (
int i = 0; i <
test_fes -> GetNE(); i++)
1442 eltrans =
test_fes -> GetElementTransformation (i);
1457 if (ran_dof_trans || dom_dof_trans)
1470 bdr_attr_marker = 0;
1475 bdr_attr_marker = 1;
1479 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
1480 "invalid boundary marker for boundary integrator #"
1481 << k <<
", counting from zero");
1482 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
1484 bdr_attr_marker[i] |= bdr_marker[i];
1488 for (
int i = 0; i <
test_fes -> GetNBE(); i++)
1491 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
1495 eltrans =
test_fes -> GetBdrElementTransformation (i);
1509 if (ran_dof_trans || dom_dof_trans)
1524 for (
int i = 0; i < nfaces; i++)
1542 test_fe2 = test_fe1;
1562 bdr_attr_marker = 0;
1567 bdr_attr_marker = 1;
1571 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
1572 "invalid boundary marker for boundary trace face"
1573 "integrator #" << k <<
", counting from zero");
1574 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
1576 bdr_attr_marker[i] |= bdr_marker[i];
1580 for (
int i = 0; i <
trial_fes -> GetNBE(); i++)
1583 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
1596 test_fe2 = test_fe1;
1620 "Vector for holding diagonal has wrong size!");
1622 "Vector for holding diagonal has wrong size!");
1628 P_trial->
Mult(D, local_D);
1657 MFEM_ABORT(
"Not implemented. Maybe assemble your bilinear form into a "
1658 "matrix and use SparseMatrix functions?");
1666 MFEM_WARNING(
"Conforming assemble not supported for this assembly level!");
1702 domain_integs[0]->AssembleElementMatrix2(trial_fe, test_fe, *eltrans,
1706 domain_integs[k]->AssembleElementMatrix2(trial_fe, test_fe, *eltrans,
1727 boundary_integs[0]->AssembleElementMatrix2(trial_be, test_be, *eltrans,
1731 boundary_integs[k]->AssembleElementMatrix2(trial_be, test_be, *eltrans,
1790 for (i = 0; i <
trial_fes -> GetNBE(); i++)
1791 if (bdr_attr_is_ess[
trial_fes -> GetBdrAttribute (i)-1])
1793 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
1794 for (j = 0; j < tr_vdofs.
Size(); j++)
1796 if ( (k = tr_vdofs[j]) < 0 )
1803 mat -> EliminateCols (cols_marker, &sol, &rhs);
1809 mat -> EliminateCols (marked_vdofs, &sol, &rhs);
1817 for (i = 0; i <
test_fes -> GetNBE(); i++)
1818 if (bdr_attr_is_ess[
test_fes -> GetBdrAttribute (i)-1])
1820 test_fes -> GetBdrElementVDofs (i, te_vdofs);
1821 for (j = 0; j < te_vdofs.
Size(); j++)
1823 if ( (k = te_vdofs[j]) < 0 )
1827 mat -> EliminateRow (k);
1849 if (test_P && trial_P)
1868 Array<int> ess_trial_tdof_marker, ess_test_tdof_marker;
1870 ess_trial_tdof_marker);
1872 ess_test_tdof_marker);
1877 for (
int i=0; i<test_tdof_list.
Size(); ++i)
1948 MFEM_ABORT(
"the assembly level has already been set!");
1958 mfem_error(
"Element assembly not supported yet... stay tuned!");
1964 mfem_error(
"Matrix-free action not supported yet... stay tuned!");
1999 "invalid element marker for domain integrator #"
2000 << k <<
", counting from zero");
2024 if (ran_dof_trans || dom_dof_trans)
2035 for (
int i = 0; i < nfaces; i++)
Dynamic 2D array using row-major layout.
void SetSize(int m, int n)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
const T * HostRead() const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), false).
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Data type dense matrix using column-major storage.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
int Size() const
For backward compatibility define Size to be synonym of Width()
Rank 3 tensor (array of matrices)
virtual void Assemble(int skip_zeros=1)
Construct the internal matrix representation of the discrete linear operator.
void SetAssemblyLevel(AssemblyLevel assembly_level)
Set the desired assembly level. The default is AssemblyLevel::FULL.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
const SparseMatrix * GetConformingRestriction() const
The returned SparseMatrix is owned by the FiniteElementSpace.
const Table & GetElementToDofTable() const
Return a reference to the internal Table that stores the lists of scalar dofs, for each mesh element,...
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th boundary fac...
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i-th element.
virtual const SparseMatrix * GetRestrictionMatrix() const
The returned SparseMatrix is owned by the FiniteElementSpace.
static void ListToMarker(const Array< int > &list, int marker_size, Array< int > &marker, int mark_val=-1)
Convert an array of indices (list) to a Boolean marker array where all indices in the list are marked...
const NURBSExtension * GetNURBSext() const
virtual const Operator * GetProlongationMatrix() const
The returned Operator is owned by the FiniteElementSpace.
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for the i'th element. The returned indices are offsets into an ...
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Ordering::Type GetOrdering() const
Return the ordering method.
ElementTransformation * GetBdrElementTransformation(int i) const
Returns ElementTransformation for the i-th boundary element.
int GetNE() const
Returns number of elements in the mesh.
void GetFaceVDofs(int i, Array< int > &vdofs) const
Returns the indices of the degrees of freedom for the specified face, including the DOFs for the edge...
const FiniteElement * GetFaceElement(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th face in the ...
const SparseMatrix * GetConformingProlongation() const
The returned SparseMatrix is owned by the FiniteElementSpace.
Mesh * GetMesh() const
Returns the mesh.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
int GetVDim() const
Returns vector dimension.
DofTransformation * GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for i'th boundary element. The returned indices are offsets int...
virtual void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_vdofs, int component=-1) const
Mark degrees of freedom associated with boundary elements with the specified boundary attributes (mar...
void GetPatchVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom in vdofs for NURBS patch i.
Abstract class for all finite elements.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Auxiliary class Hybridization, used to implement BilinearForm hybridization.
void Reset()
Destroy the current hybridization matrix while preserving the computed constraint matrix and the set ...
void Init(const Array< int > &ess_tdof_list)
Prepare the Hybridization object for assembly.
SparseMatrix & GetMatrix()
Return the serial hybridized matrix.
void AssembleBdrMatrix(int bdr_el, const DenseMatrix &A)
Assemble the boundary element matrix A into the hybridized system matrix.
void AssembleMatrix(int el, const DenseMatrix &A)
Assemble the element matrix A into the hybridized system matrix.
void ComputeSolution(const Vector &b, const Vector &sol_r, Vector &sol) const
void Finalize()
Finalize the construction of the hybridized matrix.
void ReduceRHS(const Vector &b, Vector &b_r) const
void SetConstraintIntegrator(BilinearFormIntegrator *c_integ)
Abstract data type for matrix inverse.
Abstract data type matrix.
Class used by MFEM to store pointers to host and/or device memory.
virtual FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
int GetAttribute(int i) const
Return the attribute of element i.
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
int GetBdrElementFaceIndex(int be_idx) const
Return the local face (codimension-1) index for the given boundary element index.
ElementTransformation * GetFaceTransformation(int FaceNo)
Returns a pointer to the transformation defining the given face element.
FaceElementTransformations * GetBdrFaceTransformations(int BdrElemNo)
Builds the transformation defining the given boundary face.
Table * GetFaceToElementTable() const
Array< int > attributes
A list of all unique element attributes used by the Mesh.
Pointer to an Operator of a specified type.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
int width
Dimension of the input / number of columns in the matrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
@ DIAG_ONE
Set the diagonal value to one.
@ DIAG_KEEP
Keep the diagonal value.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
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...
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.
virtual void AddMultTranspose(const Vector &x, Vector &y, const real_t a=1.0) const
Operator transpose application: y+=A^t(x) (default) or y+=a*A^t(x).
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 ...
virtual void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const
Operator application: y+=A(x) (default) or y+=a*A(x).
Partial assembly extension for DiscreteLinearOperator.
void GetDiag(Vector &d) const
Returns the Diagonal of A.
virtual void MultTranspose(const Vector &x, Vector &y) const
Multiply a vector with the transposed matrix. y = At * x.
void PartMult(const Array< int > &rows, const Vector &x, Vector &y) const
bool ColumnsAreSorted() const
Returns whether or not the columns are sorted.
virtual int GetRow(const int row, Array< int > &cols, Vector &srow) const
Extract all column indices and values from a given row.
bool Finalized() const
Returns whether or not CSR format has been finalized.
virtual void AddMultTranspose(const Vector &x, Vector &y, const real_t a=1.0) const
y += At * x (default) or y += a * At * x
void AbsMultTranspose(const Vector &x, Vector &y) const
y = |At| * x, using entry-wise absolute values of the transpose of matrix A
void SetSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
void BooleanMult(const Array< int > &x, Array< int > &y) const
y = A * x, treating all entries as booleans (zero=false, nonzero=true).
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
void EliminateRow(int row, const real_t sol, Vector &rhs)
Eliminates a column from the transpose matrix.
void GetBlocks(Array2D< SparseMatrix * > &blocks) const
virtual void Finalize(int skip_zeros=1)
Finalize the matrix initialization, switching the storage format from LIL to CSR.
virtual void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const
y += A * x (default) or y += a * A * x
void EliminateCols(const Array< int > &cols, const Vector *x=NULL, Vector *b=NULL)
Eliminate all columns i for which cols[i] != 0.
int * GetJ()
Return the array J.
void AddRow(const int row, const Array< int > &cols, const Vector &srow)
int * GetI()
Return the array I.
void AssembleMatrix(int el, const DenseMatrix &elmat)
void AssembleBdrMatrix(int el, const DenseMatrix &elmat)
void Finalize()
Finalize the construction of the Schur complement matrix.
SparseMatrix & GetMatrix()
Return the serial Schur complement matrix.
void EliminateReducedTrueDofs(const Array< int > &ess_rtdof_list, Matrix::DiagonalPolicy dpolicy)
Eliminate the given reduced true dofs from the Schur complement matrix S.
bool ReducesTrueVSize() const
void Init(bool symmetric, bool block_diagonal)
void SetEssentialTrueDofs(const Array< int > &ess_tdof_list)
Determine and save internally essential reduced 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....
void ComputeSolution(const Vector &b, const Vector &sc_sol, Vector &sol) const
bool HasEliminatedBC() const
Return true if essential boundary conditions have been eliminated from the Schur complement matrix.
void LoseData()
Call this if data has been stolen.
void SortRows()
Sort the column (TYPE II) indices in each row.
void SetSubVector(const Array< int > &dofs, const real_t value)
Set the entries listed in dofs to the given value.
void SyncMemory(const Vector &v) const
Update the memory location of the vector to match v.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
void SetSubVectorComplement(const Array< int > &dofs, const real_t val)
Set all vector entries NOT in the dofs Array to the given val.
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
void mfem_error(const char *msg)
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void TransformDual(const DofTransformation *ran_dof_trans, const DofTransformation *dom_dof_trans, DenseMatrix &elmat)
void TransformPrimal(const DofTransformation *ran_dof_trans, const DofTransformation *dom_dof_trans, DenseMatrix &elmat)
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
AssemblyLevel
Enumeration defining the assembly level for bilinear and nonlinear form classes derived from Operator...
void RAP(const DenseMatrix &A, const DenseMatrix &P, DenseMatrix &RAP)
bool IsIdentityProlongation(const Operator *P)
std::function< real_t(const Vector &)> f(real_t mass_coeff)
SparseMatrix * TransposeMult(const SparseMatrix &A, const SparseMatrix &B)
C = A^T B.
real_t p(const Vector &x, real_t t)