36 Table face_dof, dof_face;
55 int *I = dof_dof.
GetI();
56 int *J = dof_dof.
GetJ();
57 double *data =
new double[I[
height]];
95 for (i = 0; i < bfi->
Size(); i++)
102 for (i = 0; i < bfi->
Size(); i++)
109 for (i = 0; i < bfi->
Size(); i++)
116 for (i = 0; i < bfi->
Size(); i++)
118 bfbfi[i] = (*bfi)[i];
130 bool symmetric =
false;
131 bool block_diagonal =
false;
170 "invalid matrix A dimensions: "
172 MFEM_ASSERT(A.
Finalized(),
"matrix A must be Finalized");
246 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
247 for (
int k = 1; k <
dbfi.Size(); k++)
249 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
318 #ifdef MFEM_USE_OPENMP
319 int free_element_matrices = 0;
323 free_element_matrices = 1;
329 for (i = 0; i <
fes -> GetNE(); i++)
334 elmat_p = &(*element_matrices)(i);
340 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
341 for (
int k = 1; k <
dbfi.Size(); k++)
343 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
365 for (i = 0; i <
fes -> GetNBE(); i++)
368 fes -> GetBdrElementVDofs (i,
vdofs);
369 eltrans =
fes -> GetBdrElementTransformation (i);
370 bbfi[0]->AssembleElementMatrix(be, *eltrans, elmat);
371 for (
int k = 1; k <
bbfi.Size(); k++)
373 bbfi[k]->AssembleElementMatrix(be, *eltrans,
elemmat);
397 for (i = 0; i < nfaces; i++)
399 tr = mesh -> GetInteriorFaceTransformations (i);
402 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
403 fes -> GetElementVDofs (tr -> Elem2No, vdofs2);
405 for (
int k = 0; k <
fbfi.Size(); k++)
407 fbfi[k] -> AssembleFaceMatrix (*
fes -> GetFE (tr -> Elem1No),
408 *
fes -> GetFE (tr -> Elem2No),
425 for (
int k = 0; k <
bfbfi.Size(); k++)
433 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
434 "invalid boundary marker for boundary face integrator #"
435 << k <<
", counting from zero");
436 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
438 bdr_attr_marker[i] |= bdr_marker[i];
442 for (i = 0; i <
fes -> GetNBE(); i++)
445 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
447 tr = mesh -> GetBdrFaceTransformations (i);
450 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
451 fe1 =
fes -> GetFE (tr -> Elem1No);
456 for (
int k = 0; k <
bfbfi.Size(); k++)
461 bfbfi[k] -> AssembleFaceMatrix (*fe1, *fe2, *tr,
elemmat);
468 #ifdef MFEM_USE_OPENMP
469 if (free_element_matrices)
483 MFEM_ASSERT(
mat,
"the BilinearForm is not assembled");
582 const int keep_diag = 1;
601 const int remove_zeros = 0;
679 #ifdef MFEM_USE_OPENMP
680 #pragma omp parallel for private(tmp,eltrans)
682 for (
int i = 0; i < num_elements; i++)
685 num_dofs_per_el, num_dofs_per_el);
688 if (num_dofs_per_el != fe.GetDof()*
fes->
GetVDim())
689 mfem_error(
"BilinearForm::ComputeElementMatrices:"
690 " all elements must have same number of dofs");
694 dbfi[0]->AssembleElementMatrix(fe, eltrans, elmat);
695 for (
int k = 1; k <
dbfi.Size(); k++)
698 dbfi[k]->AssembleElementMatrix(fe, eltrans, tmp);
759 for (
int i = 0; i < vdofs.
Size(); i++)
764 mat -> EliminateRowCol (vdof, sol(vdof), rhs, d);
768 mat -> EliminateRowCol (-1-vdof, sol(-1-vdof), rhs, d);
780 for (
int i = 0; i < vdofs.
Size(); i++)
785 mat -> EliminateRowCol (vdof, *
mat_e, d);
789 mat -> EliminateRowCol (-1-vdof, *
mat_e, d);
797 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
798 MFEM_ASSERT(sol.
Size() ==
height,
"incorrect sol Vector size");
799 MFEM_ASSERT(rhs.
Size() ==
height,
"incorrect rhs Vector size");
801 for (
int i = 0; i < ess_dofs.
Size(); i++)
804 mat -> EliminateRowCol (i, sol(i), rhs, d);
811 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
813 for (
int i = 0; i < ess_dofs.
Size(); i++)
816 mat -> EliminateRowCol (i, d);
823 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
825 for (
int i = 0; i < ess_dofs.
Size(); i++)
828 mat -> EliminateRowColDiag (i, value);
843 if (nfes && nfes !=
fes)
890 for (k=0; k <
dbfi.Size(); k++) {
delete dbfi[k]; }
891 for (k=0; k <
bbfi.Size(); k++) {
delete bbfi[k]; }
892 for (k=0; k <
fbfi.Size(); k++) {
delete fbfi[k]; }
893 for (k=0; k <
bfbfi.Size(); k++) {
delete bfbfi[k]; }
900 :
Matrix(te_fes->GetVSize(), tr_fes->GetVSize())
923 const double a)
const
929 const double a)
const
948 "MixedBilinearForm::GetBlocks: both trial and test spaces "
949 "must use Ordering::byNODES!");
987 for (i = 0; i <
test_fes -> GetNE(); i++)
989 trial_fes -> GetElementVDofs (i, tr_vdofs);
990 test_fes -> GetElementVDofs (i, te_vdofs);
991 eltrans =
test_fes -> GetElementTransformation (i);
992 for (k = 0; k <
dom.Size(); k++)
994 dom[k] -> AssembleElementMatrix2 (*
trial_fes -> GetFE(i),
997 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
1004 for (i = 0; i <
test_fes -> GetNBE(); i++)
1006 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
1007 test_fes -> GetBdrElementVDofs (i, te_vdofs);
1008 eltrans =
test_fes -> GetBdrElementTransformation (i);
1009 for (k = 0; k <
bdr.Size(); k++)
1011 bdr[k] -> AssembleElementMatrix2 (*
trial_fes -> GetBE(i),
1014 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
1026 for (i = 0; i < nfaces; i++)
1036 te_vdofs.
Append(te_vdofs2);
1044 test_fe2 = test_fe1;
1046 for (
int k = 0; k <
skt.Size(); k++)
1048 skt[k]->AssembleFaceMatrix(*trial_face_fe, *test_fe1, *test_fe2,
1089 for (i = 0; i <
trial_fes -> GetNBE(); i++)
1090 if (bdr_attr_is_ess[
trial_fes -> GetBdrAttribute (i)-1])
1092 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
1093 for (j = 0; j < tr_vdofs.
Size(); j++)
1095 if ( (k = tr_vdofs[j]) < 0 )
1102 mat -> EliminateCols (cols_marker, &sol, &rhs);
1108 mat -> EliminateCols (marked_vdofs, &sol, &rhs);
1116 for (i = 0; i <
test_fes -> GetNBE(); i++)
1117 if (bdr_attr_is_ess[
test_fes -> GetBdrAttribute (i)-1])
1119 test_fes -> GetBdrElementVDofs (i, te_vdofs);
1120 for (j = 0; j < te_vdofs.
Size(); j++)
1122 if ( (k = te_vdofs[j]) < 0 )
1126 mat -> EliminateRow (k);
1144 for (i = 0; i <
dom.Size(); i++) {
delete dom[i]; }
1145 for (i = 0; i <
bdr.Size(); i++) {
delete bdr[i]; }
1146 for (i = 0; i <
skt.Size(); i++) {
delete skt[i]; }
1172 dom[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1173 for (
int j = 1; j <
dom.Size(); j++)
1175 dom[j]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, elmat);
1185 for (
int i = 0; i < nfaces; i++)
1193 skt[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1194 for (
int j = 1; j <
skt.Size(); j++)
1196 skt[j]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, elmat);
Abstract class for Finite Elements.
Ordering::Type GetOrdering() const
Return the ordering method.
int Size() const
Logical size of the array.
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
void NewDataAndSize(double *d, int s)
Set the Vector data and size, deleting the old data, if owned.
void SetConstraintIntegrator(BilinearFormIntegrator *c_integ)
bool ReducesTrueVSize() const
virtual void Finalize(int skip_zeros=1)
Finalize the matrix initialization, switching the storage format from LIL to CSR. ...
void MakeRef(const SparseMatrix &master)
Clear the contents of the SparseMatrix and make it a reference to master.
void SortRows()
Sort the column (TYPE II) indices in each row.
void SetSize(int s)
Resize the vector to size s.
void GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
virtual void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_vdofs) const
void BooleanMult(const Array< int > &x, Array< int > &y) const
y = A * x, but treat all elements as booleans (zero=false, nonzero=true).
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Data type dense matrix using column-major storage.
void AddMult(const Vector &x, Vector &y, const double a=1.0) const
y += A * x (default) or y += a * A * x
int Size() const
Returns the size of the vector.
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...
Abstract data type for matrix inverse.
void LoseData()
Call this if data has been stolen.
const FiniteElement * GetFaceElement(int i) const
void ComputeSolution(const Vector &b, const Vector &sc_sol, Vector &sol) const
FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31)
void Reset()
Destroy the current hybridization matrix while preserving the computed constraint matrix and the set ...
void GetBlocks(Array2D< SparseMatrix * > &blocks) const
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
int GetNE() const
Returns number of elements in the mesh.
void SetSize(int m, int n)
void Finalize()
Finalize the construction of the hybridized matrix.
void AssembleBdrMatrix(int bdr_el, const DenseMatrix &A)
Assemble the boundary element matrix A into the hybridized system matrix.
const SparseMatrix * GetConformingRestriction()
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
SparseMatrix & GetMatrix()
Return the serial hybridized matrix.
int Append(const T &el)
Append element to array, resize if necessary.
Mesh * GetMesh() const
Returns the mesh.
bool areColumnsSorted() const
void GetFaceTransformation(int i, IsoparametricTransformation *FTr)
void ComputeSolution(const Vector &b, const Vector &sol_r, Vector &sol) const
Abstract data type matrix.
HypreParMatrix * RAP(HypreParMatrix *A, HypreParMatrix *P)
Returns the matrix P^t * A * P.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void Transpose(const Table &A, Table &At, int _ncols_A)
Transpose a Table.
const SparseMatrix * GetConformingProlongation()
int GetVDim() const
Returns vector dimension.
virtual const SparseMatrix * GetRestrictionMatrix()
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
int * GetI() const
Return the array I.
void SetSubVectorComplement(const Array< int > &dofs, const double val)
Set all vector entries NOT in the 'dofs' array to the given 'val'.
void SetSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i'th element.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void AssembleMatrix(int el, const DenseMatrix &A)
Assemble the element matrix A into the hybridized system matrix.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
void Finalize()
Finalize the construction of the Schur complement matrix.
void mfem_error(const char *msg)
void AssembleBdrMatrix(int el, const DenseMatrix &elmat)
void EliminateReducedTrueDofs(const Array< int > &ess_rtdof_list, int keep_diagonal)
Eliminate the given reduced true dofs from the Schur complement matrix S.
int height
Dimension of the output / number of rows in the matrix.
Table * GetFaceToElementTable() const
void AssembleMatrix(int el, const DenseMatrix &elmat)
bool HasEliminatedBC() const
Return true if essential boundary conditions have been eliminated from the Schur complement matrix...
void MultTranspose(const Vector &x, Vector &y) const
Multiply a vector with the transposed matrix. y = At * x.
const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement associated with i'th element.
void GetFaceVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th face element (2D and 3D).
SparseMatrix & GetMatrix()
Return the serial Schur complement matrix.
void ReduceRHS(const Vector &b, Vector &b_r) const
const Table & GetElementToDofTable() const
void Init(const Array< int > &ess_tdof_list)
Prepare the Hybridization object for assembly.
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement for the i'th boundary element.
void GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th boundary element.
void SetEssentialTrueDofs(const Array< int > &ess_tdof_list)
Determine and save internally essential reduced true dofs.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
long GetSequence() const
Return update counter (see Mesh::sequence)
void Init(bool symmetric, bool block_diagonal)
virtual void Assemble(int skip_zeros=1)
int * GetJ() const
Return the array J.
Rank 3 tensor (array of matrices)
int width
Dimension of the input / number of columns in the matrix.
void PartMult(const Array< int > &rows, const Vector &x, Vector &y) const