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]];
97 for (i = 0; i < bfi->
Size(); i++)
104 for (i = 0; i < bfi->
Size(); i++)
111 for (i = 0; i < bfi->
Size(); i++)
118 for (i = 0; i < bfi->
Size(); i++)
120 bfbfi[i] = (*bfi)[i];
132 bool symmetric =
false;
133 bool block_diagonal =
false;
172 "invalid matrix A dimensions: "
174 MFEM_ASSERT(A.
Finalized(),
"matrix A must be Finalized");
251 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
252 for (
int k = 1; k <
dbfi.Size(); k++)
254 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
323 #ifdef MFEM_USE_OPENMP
324 int free_element_matrices = 0;
328 free_element_matrices = 1;
334 for (i = 0; i <
fes -> GetNE(); i++)
339 elmat_p = &(*element_matrices)(i);
345 dbfi[0]->AssembleElementMatrix(fe, *eltrans, elmat);
346 for (
int k = 1; k <
dbfi.Size(); k++)
348 dbfi[k]->AssembleElementMatrix(fe, *eltrans,
elemmat);
374 for (
int k = 0; k <
bbfi.Size(); k++)
382 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
383 "invalid boundary marker for boundary integrator #"
384 << k <<
", counting from zero");
385 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
387 bdr_attr_marker[i] |= bdr_marker[i];
391 for (i = 0; i <
fes -> GetNBE(); i++)
394 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
397 fes -> GetBdrElementVDofs (i,
vdofs);
398 eltrans =
fes -> GetBdrElementTransformation (i);
399 bbfi[0]->AssembleElementMatrix(be, *eltrans, elmat);
400 for (
int k = 1; k <
bbfi.Size(); k++)
405 bbfi[k]->AssembleElementMatrix(be, *eltrans,
elemmat);
429 for (i = 0; i < nfaces; i++)
431 tr = mesh -> GetInteriorFaceTransformations (i);
434 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
435 fes -> GetElementVDofs (tr -> Elem2No, vdofs2);
437 for (
int k = 0; k <
fbfi.Size(); k++)
439 fbfi[k] -> AssembleFaceMatrix (*
fes -> GetFE (tr -> Elem1No),
440 *
fes -> GetFE (tr -> Elem2No),
457 for (
int k = 0; k <
bfbfi.Size(); k++)
465 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
466 "invalid boundary marker for boundary face integrator #"
467 << k <<
", counting from zero");
468 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
470 bdr_attr_marker[i] |= bdr_marker[i];
474 for (i = 0; i <
fes -> GetNBE(); i++)
477 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
479 tr = mesh -> GetBdrFaceTransformations (i);
482 fes -> GetElementVDofs (tr -> Elem1No,
vdofs);
483 fe1 =
fes -> GetFE (tr -> Elem1No);
488 for (
int k = 0; k <
bfbfi.Size(); k++)
493 bfbfi[k] -> AssembleFaceMatrix (*fe1, *fe2, *tr,
elemmat);
500 #ifdef MFEM_USE_OPENMP
501 if (free_element_matrices)
515 MFEM_ASSERT(
mat,
"the BilinearForm is not assembled");
632 const int remove_zeros = 0;
710 #ifdef MFEM_USE_OPENMP
711 #pragma omp parallel for private(tmp,eltrans)
713 for (
int i = 0; i < num_elements; i++)
716 num_dofs_per_el, num_dofs_per_el);
719 if (num_dofs_per_el != fe.GetDof()*
fes->
GetVDim())
720 mfem_error(
"BilinearForm::ComputeElementMatrices:"
721 " all elements must have same number of dofs");
725 dbfi[0]->AssembleElementMatrix(fe, eltrans, elmat);
726 for (
int k = 1; k <
dbfi.Size(); k++)
729 dbfi[k]->AssembleElementMatrix(fe, eltrans, tmp);
754 DiagonalPolicy dpolicy)
789 DiagonalPolicy dpolicy)
791 for (
int i = 0; i < vdofs.
Size(); i++)
796 mat -> EliminateRowCol (vdof, sol(vdof), rhs, dpolicy);
800 mat -> EliminateRowCol (-1-vdof, sol(-1-vdof), rhs, dpolicy);
806 DiagonalPolicy dpolicy)
813 for (
int i = 0; i < vdofs.
Size(); i++)
818 mat -> EliminateRowCol (vdof, *
mat_e, dpolicy);
822 mat -> EliminateRowCol (-1-vdof, *
mat_e, dpolicy);
829 DiagonalPolicy dpolicy)
831 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
832 MFEM_ASSERT(sol.
Size() ==
height,
"incorrect sol Vector size");
833 MFEM_ASSERT(rhs.
Size() ==
height,
"incorrect rhs Vector size");
835 for (
int i = 0; i < ess_dofs.
Size(); i++)
838 mat -> EliminateRowCol (i, sol(i), rhs, dpolicy);
843 DiagonalPolicy dpolicy)
845 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
847 for (
int i = 0; i < ess_dofs.
Size(); i++)
850 mat -> EliminateRowCol (i, dpolicy);
857 MFEM_ASSERT(ess_dofs.
Size() ==
height,
"incorrect dof Array size");
859 for (
int i = 0; i < ess_dofs.
Size(); i++)
862 mat -> EliminateRowColDiag (i, value);
877 if (nfes && nfes !=
fes)
929 for (k=0; k <
dbfi.Size(); k++) {
delete dbfi[k]; }
930 for (k=0; k <
bbfi.Size(); k++) {
delete bbfi[k]; }
931 for (k=0; k <
fbfi.Size(); k++) {
delete fbfi[k]; }
932 for (k=0; k <
bfbfi.Size(); k++) {
delete bfbfi[k]; }
939 :
Matrix(te_fes->GetVSize(), tr_fes->GetVSize())
962 const double a)
const
968 const double a)
const
987 "MixedBilinearForm::GetBlocks: both trial and test spaces "
988 "must use Ordering::byNODES!");
1026 for (i = 0; i <
test_fes -> GetNE(); i++)
1028 trial_fes -> GetElementVDofs (i, tr_vdofs);
1029 test_fes -> GetElementVDofs (i, te_vdofs);
1030 eltrans =
test_fes -> GetElementTransformation (i);
1031 for (k = 0; k <
dom.Size(); k++)
1033 dom[k] -> AssembleElementMatrix2 (*
trial_fes -> GetFE(i),
1036 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
1043 for (i = 0; i <
test_fes -> GetNBE(); i++)
1045 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
1046 test_fes -> GetBdrElementVDofs (i, te_vdofs);
1047 eltrans =
test_fes -> GetBdrElementTransformation (i);
1048 for (k = 0; k <
bdr.Size(); k++)
1050 bdr[k] -> AssembleElementMatrix2 (*
trial_fes -> GetBE(i),
1053 mat -> AddSubMatrix (te_vdofs, tr_vdofs, elemmat, skip_zeros);
1065 for (i = 0; i < nfaces; i++)
1075 te_vdofs.
Append(te_vdofs2);
1083 test_fe2 = test_fe1;
1085 for (
int k = 0; k <
skt.Size(); k++)
1087 skt[k]->AssembleFaceMatrix(*trial_face_fe, *test_fe1, *test_fe2,
1128 for (i = 0; i <
trial_fes -> GetNBE(); i++)
1129 if (bdr_attr_is_ess[
trial_fes -> GetBdrAttribute (i)-1])
1131 trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
1132 for (j = 0; j < tr_vdofs.
Size(); j++)
1134 if ( (k = tr_vdofs[j]) < 0 )
1141 mat -> EliminateCols (cols_marker, &sol, &rhs);
1147 mat -> EliminateCols (marked_vdofs, &sol, &rhs);
1155 for (i = 0; i <
test_fes -> GetNBE(); i++)
1156 if (bdr_attr_is_ess[
test_fes -> GetBdrAttribute (i)-1])
1158 test_fes -> GetBdrElementVDofs (i, te_vdofs);
1159 for (j = 0; j < te_vdofs.
Size(); j++)
1161 if ( (k = te_vdofs[j]) < 0 )
1165 mat -> EliminateRow (k);
1183 for (i = 0; i <
dom.Size(); i++) {
delete dom[i]; }
1184 for (i = 0; i <
bdr.Size(); i++) {
delete bdr[i]; }
1185 for (i = 0; i <
skt.Size(); i++) {
delete skt[i]; }
1211 dom[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1212 for (
int j = 1; j <
dom.Size(); j++)
1214 dom[j]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, elmat);
1224 for (
int i = 0; i < nfaces; i++)
1232 skt[0]->AssembleElementMatrix2(*dom_fe, *ran_fe, *T, totelmat);
1233 for (
int j = 1; j <
skt.Size(); j++)
1235 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 GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
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...
void EliminateReducedTrueDofs(const Array< int > &ess_rtdof_list, Matrix::DiagonalPolicy dpolicy)
Eliminate the given reduced true dofs from the Schur complement matrix S.
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
double * GetData() const
Return a pointer to the beginning of the Vector data.
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.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
bool areColumnsSorted() const
void GetFaceTransformation(int i, IsoparametricTransformation *FTr)
Returns the transformation defining the given face element in a user-defined variable.
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.
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
int * GetI() const
Return the array I.
Dynamic 2D array using row-major layout.
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.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
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 AssembleBdrMatrix(int el, const DenseMatrix &elmat)
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.
virtual const SparseMatrix * GetRestrictionMatrix() const
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