37 Table face_dof, dof_face;
54 int *I = dof_dof.
GetI();
55 int *J = dof_dof.
GetJ();
56 double *data =
new double[I[
height]];
92 for (i = 0; i < bfi->
Size(); i++)
99 for (i = 0; i < bfi->
Size(); i++)
106 for (i = 0; i < bfi->
Size(); i++)
113 for (i = 0; i < bfi->
Size(); i++)
115 bfbfi[i] = (*bfi)[i];
127 bool symmetric =
false;
128 bool block_diagonal =
false;
209 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
210 for (
int k = 1; k <
dbfi.Size(); k++)
212 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
259 #ifdef MFEM_USE_OPENMP
260 int free_element_matrices = 0;
264 free_element_matrices = 1;
270 for (i = 0; i <
fes -> GetNE(); i++)
275 elmat_p = &(*element_matrices)(i);
281 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
282 for (
int k = 1; k <
dbfi.Size(); k++)
284 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
306 for (i = 0; i <
fes -> GetNBE(); i++)
309 fes -> GetBdrElementVDofs (i,
vdofs);
310 eltrans =
fes -> GetBdrElementTransformation (i);
311 bbfi[0]->AssembleElementMatrix(be, *eltrans, elmat);
312 for (
int k = 1; k <
bbfi.Size(); k++)
314 bbfi[k]->AssembleElementMatrix(be, *eltrans,
elemmat);
334 for (i = 0; i < nfaces; i++)
336 tr = mesh -> GetInteriorFaceTransformations (i);
339 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
340 fes -> GetElementVDofs (tr -> Elem2No, vdofs2);
342 for (
int k = 0; k <
fbfi.Size(); k++)
344 fbfi[k] -> AssembleFaceMatrix (*
fes -> GetFE (tr -> Elem1No),
345 *
fes -> GetFE (tr -> Elem2No),
358 for (i = 0; i <
fes -> GetNBE(); i++)
360 tr = mesh -> GetBdrFaceTransformations (i);
363 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
364 fe1 =
fes -> GetFE (tr -> Elem1No);
369 for (
int k = 0; k <
bfbfi.Size(); k++)
371 bfbfi[k] -> AssembleFaceMatrix (*fe1, *fe2, *tr,
elemmat);
378 #ifdef MFEM_USE_OPENMP
379 if (free_element_matrices)
393 MFEM_ASSERT(
mat,
"the BilinearForm is not assembled")
431 const int keep_diag = 1;
579 #ifdef MFEM_USE_OPENMP
580 #pragma omp parallel for private(tmp,eltrans)
582 for (
int i = 0; i < num_elements; i++)
585 num_dofs_per_el, num_dofs_per_el);
588 if (num_dofs_per_el != fe.GetDof()*
fes->
GetVDim())
589 mfem_error(
"BilinearForm::ComputeElementMatrices:"
590 " all elements must have same number of dofs");
594 dbfi[0]->AssembleElementMatrix(fe, eltrans, elmat);
595 for (
int k = 1; k <
dbfi.Size(); k++)
598 dbfi[k]->AssembleElementMatrix(fe, eltrans, tmp);
658 for (
int i = 0; i < vdofs.
Size(); i++)
663 mat -> EliminateRowCol (vdof, sol(vdof), rhs, d);
667 mat -> EliminateRowCol (-1-vdof, sol(-1-vdof), rhs, d);
679 for (
int i = 0; i < vdofs.
Size(); i++)
684 mat -> EliminateRowCol (vdof, *
mat_e, d);
688 mat -> EliminateRowCol (-1-vdof, *
mat_e, d);
696 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
697 MFEM_ASSERT(sol.
Size() ==
height,
"incorrect sol Vector size");
698 MFEM_ASSERT(rhs.
Size() ==
height,
"incorrect rhs Vector size");
700 for (
int i = 0; i < ess_dofs.
Size(); i++)
703 mat -> EliminateRowCol (i, sol(i), rhs, d);
709 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
711 for (
int i = 0; i < ess_dofs.
Size(); i++)
714 mat -> EliminateRowCol (i, d);
721 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
723 for (
int i = 0; i < ess_dofs.
Size(); i++)
726 mat -> EliminateRowColDiag (i, value);
739 if (nfes) {
fes = nfes; }
765 for (k=0; k <
dbfi.Size(); k++) {
delete dbfi[k]; }
766 for (k=0; k <
bbfi.Size(); k++) {
delete bbfi[k]; }
767 for (k=0; k <
fbfi.Size(); k++) {
delete fbfi[k]; }
768 for (k=0; k <
bfbfi.Size(); k++) {
delete bfbfi[k]; }
775 :
Matrix(te_fes->GetVSize(), tr_fes->GetVSize())
798 const double a)
const
804 const double a)
const
823 "MixedBilinearForm::GetBlocks: both trial and test spaces "
824 "must use Ordering::byNODES!");
862 for (i = 0; i <
test_fes -> GetNE(); i++)
864 trial_fes -> GetElementVDofs (i, tr_vdofs);
865 test_fes -> GetElementVDofs (i, te_vdofs);
866 eltrans =
test_fes -> GetElementTransformation (i);
867 for (k = 0; k <
dom.Size(); k++)
869 dom[k] -> AssembleElementMatrix2 (*
trial_fes -> GetFE(i),
872 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
879 for (i = 0; i <
test_fes -> GetNBE(); i++)
881 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
882 test_fes -> GetBdrElementVDofs (i, te_vdofs);
883 eltrans =
test_fes -> GetBdrElementTransformation (i);
884 for (k = 0; k <
bdr.Size(); k++)
886 bdr[k] -> AssembleElementMatrix2 (*
trial_fes -> GetBE(i),
889 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
901 for (i = 0; i < nfaces; i++)
911 te_vdofs.
Append(te_vdofs2);
921 for (
int k = 0; k <
skt.Size(); k++)
923 skt[k]->AssembleFaceMatrix(*trial_face_fe, *test_fe1, *test_fe2,
964 for (i = 0; i <
trial_fes -> GetNBE(); i++)
965 if (bdr_attr_is_ess[
trial_fes -> GetBdrAttribute (i)-1])
967 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
968 for (j = 0; j < tr_vdofs.
Size(); j++)
970 if ( (k = tr_vdofs[j]) < 0 )
977 mat -> EliminateCols (cols_marker, &sol, &rhs);
983 mat -> EliminateCols (marked_vdofs, &sol, &rhs);
991 for (i = 0; i <
test_fes -> GetNBE(); i++)
992 if (bdr_attr_is_ess[
test_fes -> GetBdrAttribute (i)-1])
994 test_fes -> GetBdrElementVDofs (i, te_vdofs);
995 for (j = 0; j < te_vdofs.
Size(); j++)
997 if ( (k = te_vdofs[j]) < 0 )
1001 mat -> EliminateRow (k);
1019 for (i = 0; i <
dom.Size(); i++) {
delete dom[i]; }
1020 for (i = 0; i <
bdr.Size(); i++) {
delete bdr[i]; }
1021 for (i = 0; i <
skt.Size(); i++) {
delete skt[i]; }
1047 dom[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1048 for (
int j = 1; j <
dom.Size(); j++)
1050 dom[j]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, elmat);
1060 for (
int i = 0; i < nfaces; i++)
1068 skt[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1069 for (
int j = 1; j <
skt.Size(); j++)
1071 skt[j]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, elmat);
Abstract class for Finite Elements.
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 SetSize(int s)
Resizes 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.
void BuildElementToDofTable()
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 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.
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)
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)
int GetOrdering() const
Return the ordering method.
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.
Abstract finite element space.
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 SetSize(int s)
Change the size of the DenseMatrix to s x s.
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