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;
212 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
213 for (
int k = 1; k <
dbfi.Size(); k++)
215 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
284 #ifdef MFEM_USE_OPENMP
285 int free_element_matrices = 0;
289 free_element_matrices = 1;
295 for (i = 0; i <
fes -> GetNE(); i++)
300 elmat_p = &(*element_matrices)(i);
306 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
307 for (
int k = 1; k <
dbfi.Size(); k++)
309 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
331 for (i = 0; i <
fes -> GetNBE(); i++)
334 fes -> GetBdrElementVDofs (i,
vdofs);
335 eltrans =
fes -> GetBdrElementTransformation (i);
336 bbfi[0]->AssembleElementMatrix(be, *eltrans, elmat);
337 for (
int k = 1; k <
bbfi.Size(); k++)
339 bbfi[k]->AssembleElementMatrix(be, *eltrans,
elemmat);
363 for (i = 0; i < nfaces; i++)
365 tr = mesh -> GetInteriorFaceTransformations (i);
368 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
369 fes -> GetElementVDofs (tr -> Elem2No, vdofs2);
371 for (
int k = 0; k <
fbfi.Size(); k++)
373 fbfi[k] -> AssembleFaceMatrix (*
fes -> GetFE (tr -> Elem1No),
374 *
fes -> GetFE (tr -> Elem2No),
387 for (i = 0; i <
fes -> GetNBE(); i++)
389 tr = mesh -> GetBdrFaceTransformations (i);
392 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
393 fe1 =
fes -> GetFE (tr -> Elem1No);
398 for (
int k = 0; k <
bfbfi.Size(); k++)
400 bfbfi[k] -> AssembleFaceMatrix (*fe1, *fe2, *tr,
elemmat);
407 #ifdef MFEM_USE_OPENMP
408 if (free_element_matrices)
422 MFEM_ASSERT(
mat,
"the BilinearForm is not assembled")
460 const int keep_diag = 1;
475 const int remove_zeros = 0;
609 #ifdef MFEM_USE_OPENMP
610 #pragma omp parallel for private(tmp,eltrans)
612 for (
int i = 0; i < num_elements; i++)
615 num_dofs_per_el, num_dofs_per_el);
618 if (num_dofs_per_el != fe.GetDof()*
fes->
GetVDim())
619 mfem_error(
"BilinearForm::ComputeElementMatrices:"
620 " all elements must have same number of dofs");
624 dbfi[0]->AssembleElementMatrix(fe, eltrans, elmat);
625 for (
int k = 1; k <
dbfi.Size(); k++)
628 dbfi[k]->AssembleElementMatrix(fe, eltrans, tmp);
688 for (
int i = 0; i < vdofs.
Size(); i++)
693 mat -> EliminateRowCol (vdof, sol(vdof), rhs, d);
697 mat -> EliminateRowCol (-1-vdof, sol(-1-vdof), rhs, d);
709 for (
int i = 0; i < vdofs.
Size(); i++)
714 mat -> EliminateRowCol (vdof, *
mat_e, d);
718 mat -> EliminateRowCol (-1-vdof, *
mat_e, d);
726 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
727 MFEM_ASSERT(sol.
Size() ==
height,
"incorrect sol Vector size");
728 MFEM_ASSERT(rhs.
Size() ==
height,
"incorrect rhs Vector size");
730 for (
int i = 0; i < ess_dofs.
Size(); i++)
733 mat -> EliminateRowCol (i, sol(i), rhs, d);
739 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
741 for (
int i = 0; i < ess_dofs.
Size(); i++)
744 mat -> EliminateRowCol (i, d);
751 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
753 for (
int i = 0; i < ess_dofs.
Size(); i++)
756 mat -> EliminateRowColDiag (i, value);
771 if (nfes && nfes !=
fes)
818 for (k=0; k <
dbfi.Size(); k++) {
delete dbfi[k]; }
819 for (k=0; k <
bbfi.Size(); k++) {
delete bbfi[k]; }
820 for (k=0; k <
fbfi.Size(); k++) {
delete fbfi[k]; }
821 for (k=0; k <
bfbfi.Size(); k++) {
delete bfbfi[k]; }
828 :
Matrix(te_fes->GetVSize(), tr_fes->GetVSize())
851 const double a)
const
857 const double a)
const
876 "MixedBilinearForm::GetBlocks: both trial and test spaces "
877 "must use Ordering::byNODES!");
915 for (i = 0; i <
test_fes -> GetNE(); i++)
917 trial_fes -> GetElementVDofs (i, tr_vdofs);
918 test_fes -> GetElementVDofs (i, te_vdofs);
919 eltrans =
test_fes -> GetElementTransformation (i);
920 for (k = 0; k <
dom.Size(); k++)
922 dom[k] -> AssembleElementMatrix2 (*
trial_fes -> GetFE(i),
925 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
932 for (i = 0; i <
test_fes -> GetNBE(); i++)
934 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
935 test_fes -> GetBdrElementVDofs (i, te_vdofs);
936 eltrans =
test_fes -> GetBdrElementTransformation (i);
937 for (k = 0; k <
bdr.Size(); k++)
939 bdr[k] -> AssembleElementMatrix2 (*
trial_fes -> GetBE(i),
942 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
954 for (i = 0; i < nfaces; i++)
964 te_vdofs.
Append(te_vdofs2);
974 for (
int k = 0; k <
skt.Size(); k++)
976 skt[k]->AssembleFaceMatrix(*trial_face_fe, *test_fe1, *test_fe2,
1017 for (i = 0; i <
trial_fes -> GetNBE(); i++)
1018 if (bdr_attr_is_ess[
trial_fes -> GetBdrAttribute (i)-1])
1020 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
1021 for (j = 0; j < tr_vdofs.
Size(); j++)
1023 if ( (k = tr_vdofs[j]) < 0 )
1030 mat -> EliminateCols (cols_marker, &sol, &rhs);
1036 mat -> EliminateCols (marked_vdofs, &sol, &rhs);
1044 for (i = 0; i <
test_fes -> GetNBE(); i++)
1045 if (bdr_attr_is_ess[
test_fes -> GetBdrAttribute (i)-1])
1047 test_fes -> GetBdrElementVDofs (i, te_vdofs);
1048 for (j = 0; j < te_vdofs.
Size(); j++)
1050 if ( (k = te_vdofs[j]) < 0 )
1054 mat -> EliminateRow (k);
1072 for (i = 0; i <
dom.Size(); i++) {
delete dom[i]; }
1073 for (i = 0; i <
bdr.Size(); i++) {
delete bdr[i]; }
1074 for (i = 0; i <
skt.Size(); i++) {
delete skt[i]; }
1100 dom[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1101 for (
int j = 1; j <
dom.Size(); j++)
1103 dom[j]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, elmat);
1113 for (
int i = 0; i < nfaces; i++)
1121 skt[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1122 for (
int j = 1; j <
skt.Size(); j++)
1124 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.
void NewDataAndSize(double *d, int s)
void SetConstraintIntegrator(BilinearFormIntegrator *c_integ)
bool ReducesTrueVSize() const
void ReduceRHS(const Vector &b, Vector &sc_b) const
void MakeRef(const SparseMatrix &master)
void SortRows()
Sort the column (TYPE II) indices in each row.
void SetSize(int s)
Resize the vector if the new size is different.
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.
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.
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.
void Transpose(const Table &A, Table &At, int _ncols_A)
Transpose a Table.
const SparseMatrix * GetConformingProlongation()
int GetVDim() const
Returns vector dimension.
virtual void Finalize(int skip_zeros=1)
virtual const SparseMatrix * GetRestrictionMatrix()
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
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.
void AssembleMatrix(int el, const DenseMatrix &A)
Assemble the element matrix A into the hybridized system matrix.
int GetDof() const
Returns the degrees of freedom in the FE space.
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.
Table * GetFaceToElementTable() const
void AssembleMatrix(int el, const DenseMatrix &elmat)
bool HasEliminatedBC() const
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 ReduceSolution(const Vector &sol, Vector &sc_sol) const
SparseMatrix & GetMatrixElim()
Return the eliminated part of the serial Schur complement matrix.
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 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)
Rank 3 tensor (array of matrices)
void ConvertListToReducedTrueDofs(const Array< int > &ess_tdof_list, Array< int > &ess_rtdof_list) const
void PartMult(const Array< int > &rows, const Vector &x, Vector &y) const