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");
241 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
242 for (
int k = 1; k <
dbfi.Size(); k++)
244 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
313 #ifdef MFEM_USE_OPENMP
314 int free_element_matrices = 0;
318 free_element_matrices = 1;
324 for (i = 0; i <
fes -> GetNE(); i++)
329 elmat_p = &(*element_matrices)(i);
335 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
336 for (
int k = 1; k <
dbfi.Size(); k++)
338 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
360 for (i = 0; i <
fes -> GetNBE(); i++)
363 fes -> GetBdrElementVDofs (i,
vdofs);
364 eltrans =
fes -> GetBdrElementTransformation (i);
365 bbfi[0]->AssembleElementMatrix(be, *eltrans, elmat);
366 for (
int k = 1; k <
bbfi.Size(); k++)
368 bbfi[k]->AssembleElementMatrix(be, *eltrans,
elemmat);
392 for (i = 0; i < nfaces; i++)
394 tr = mesh -> GetInteriorFaceTransformations (i);
397 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
398 fes -> GetElementVDofs (tr -> Elem2No, vdofs2);
400 for (
int k = 0; k <
fbfi.Size(); k++)
402 fbfi[k] -> AssembleFaceMatrix (*
fes -> GetFE (tr -> Elem1No),
403 *
fes -> GetFE (tr -> Elem2No),
420 for (
int k = 0; k <
bfbfi.Size(); k++)
428 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
429 "invalid boundary marker for boundary face integrator #"
430 << k <<
", counting from zero");
431 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
433 bdr_attr_marker[i] |= bdr_marker[i];
437 for (i = 0; i <
fes -> GetNBE(); i++)
440 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
442 tr = mesh -> GetBdrFaceTransformations (i);
445 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
446 fe1 =
fes -> GetFE (tr -> Elem1No);
451 for (
int k = 0; k <
bfbfi.Size(); k++)
456 bfbfi[k] -> AssembleFaceMatrix (*fe1, *fe2, *tr,
elemmat);
463 #ifdef MFEM_USE_OPENMP
464 if (free_element_matrices)
478 MFEM_ASSERT(
mat,
"the BilinearForm is not assembled");
577 const int keep_diag = 1;
596 const int remove_zeros = 0;
674 #ifdef MFEM_USE_OPENMP
675 #pragma omp parallel for private(tmp,eltrans)
677 for (
int i = 0; i < num_elements; i++)
680 num_dofs_per_el, num_dofs_per_el);
683 if (num_dofs_per_el != fe.GetDof()*
fes->
GetVDim())
684 mfem_error(
"BilinearForm::ComputeElementMatrices:"
685 " all elements must have same number of dofs");
689 dbfi[0]->AssembleElementMatrix(fe, eltrans, elmat);
690 for (
int k = 1; k <
dbfi.Size(); k++)
693 dbfi[k]->AssembleElementMatrix(fe, eltrans, tmp);
754 for (
int i = 0; i < vdofs.
Size(); i++)
759 mat -> EliminateRowCol (vdof, sol(vdof), rhs, d);
763 mat -> EliminateRowCol (-1-vdof, sol(-1-vdof), rhs, d);
775 for (
int i = 0; i < vdofs.
Size(); i++)
780 mat -> EliminateRowCol (vdof, *
mat_e, d);
784 mat -> EliminateRowCol (-1-vdof, *
mat_e, d);
792 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
793 MFEM_ASSERT(sol.
Size() ==
height,
"incorrect sol Vector size");
794 MFEM_ASSERT(rhs.
Size() ==
height,
"incorrect rhs Vector size");
796 for (
int i = 0; i < ess_dofs.
Size(); i++)
799 mat -> EliminateRowCol (i, sol(i), rhs, d);
806 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
808 for (
int i = 0; i < ess_dofs.
Size(); i++)
811 mat -> EliminateRowCol (i, d);
818 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
820 for (
int i = 0; i < ess_dofs.
Size(); i++)
823 mat -> EliminateRowColDiag (i, value);
838 if (nfes && nfes !=
fes)
885 for (k=0; k <
dbfi.Size(); k++) {
delete dbfi[k]; }
886 for (k=0; k <
bbfi.Size(); k++) {
delete bbfi[k]; }
887 for (k=0; k <
fbfi.Size(); k++) {
delete fbfi[k]; }
888 for (k=0; k <
bfbfi.Size(); k++) {
delete bfbfi[k]; }
895 :
Matrix(te_fes->GetVSize(), tr_fes->GetVSize())
918 const double a)
const
924 const double a)
const
943 "MixedBilinearForm::GetBlocks: both trial and test spaces "
944 "must use Ordering::byNODES!");
982 for (i = 0; i <
test_fes -> GetNE(); i++)
984 trial_fes -> GetElementVDofs (i, tr_vdofs);
985 test_fes -> GetElementVDofs (i, te_vdofs);
986 eltrans =
test_fes -> GetElementTransformation (i);
987 for (k = 0; k <
dom.Size(); k++)
989 dom[k] -> AssembleElementMatrix2 (*
trial_fes -> GetFE(i),
992 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
999 for (i = 0; i <
test_fes -> GetNBE(); i++)
1001 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
1002 test_fes -> GetBdrElementVDofs (i, te_vdofs);
1003 eltrans =
test_fes -> GetBdrElementTransformation (i);
1004 for (k = 0; k <
bdr.Size(); k++)
1006 bdr[k] -> AssembleElementMatrix2 (*
trial_fes -> GetBE(i),
1009 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
1021 for (i = 0; i < nfaces; i++)
1031 te_vdofs.
Append(te_vdofs2);
1039 test_fe2 = test_fe1;
1041 for (
int k = 0; k <
skt.Size(); k++)
1043 skt[k]->AssembleFaceMatrix(*trial_face_fe, *test_fe1, *test_fe2,
1084 for (i = 0; i <
trial_fes -> GetNBE(); i++)
1085 if (bdr_attr_is_ess[
trial_fes -> GetBdrAttribute (i)-1])
1087 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
1088 for (j = 0; j < tr_vdofs.
Size(); j++)
1090 if ( (k = tr_vdofs[j]) < 0 )
1097 mat -> EliminateCols (cols_marker, &sol, &rhs);
1103 mat -> EliminateCols (marked_vdofs, &sol, &rhs);
1111 for (i = 0; i <
test_fes -> GetNBE(); i++)
1112 if (bdr_attr_is_ess[
test_fes -> GetBdrAttribute (i)-1])
1114 test_fes -> GetBdrElementVDofs (i, te_vdofs);
1115 for (j = 0; j < te_vdofs.
Size(); j++)
1117 if ( (k = te_vdofs[j]) < 0 )
1121 mat -> EliminateRow (k);
1139 for (i = 0; i <
dom.Size(); i++) {
delete dom[i]; }
1140 for (i = 0; i <
bdr.Size(); i++) {
delete bdr[i]; }
1141 for (i = 0; i <
skt.Size(); i++) {
delete skt[i]; }
1167 dom[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1168 for (
int j = 1; j <
dom.Size(); j++)
1170 dom[j]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, elmat);
1180 for (
int i = 0; i < nfaces; i++)
1188 skt[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1189 for (
int j = 1; j <
skt.Size(); j++)
1191 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.
const SparseMatrix * GetConformingProlongation() const
void SetConstraintIntegrator(BilinearFormIntegrator *c_integ)
bool ReducesTrueVSize() const
HypreParMatrix * RAP(const HypreParMatrix *A, const HypreParMatrix *P)
Returns the matrix P^t * A * P.
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.
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().
virtual void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_vdofs, int component=-1) const
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).
const SparseMatrix * GetConformingRestriction() const
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.
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.
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.
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