55 MFEM_ABORT(
"internal MFEM error");
72 for (
int i = 0; i <
fes->
GetNE(); i++)
78 for (
int k = 0; k <
dnfi.Size(); k++)
80 energy +=
dnfi[k]->GetElementEnergy(*fe, *T, el_x);
87 MFEM_ABORT(
"TODO: add energy contribution from interior face terms");
92 MFEM_ABORT(
"TODO: add energy contribution from boundary face terms");
100 MFEM_VERIFY(x.
Size() ==
Width(),
"invalid input Vector size");
124 for (
int i = 0; i <
fes->
GetNE(); i++)
130 for (
int k = 0; k <
dnfi.Size(); k++)
132 dnfi[k]->AssembleElementVector(*fe, *T, el_x, el_y);
158 for (
int k = 0; k <
fnfi.Size(); k++)
160 fnfi[k]->AssembleFaceVector(*fe1, *fe2, *tr, el_x, el_y);
176 for (
int k = 0; k <
bfnfi.Size(); k++)
184 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
185 "invalid boundary marker for boundary face integrator #"
186 << k <<
", counting from zero");
187 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
189 bdr_attr_marker[i] |= bdr_marker[i];
193 for (
int i = 0; i <
fes -> GetNBE(); i++)
196 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
209 for (
int k = 0; k <
bfnfi.Size(); k++)
214 bfnfi[k]->AssembleFaceVector(*fe1, *fe2, *tr, el_x, el_y);
235 const int skip_zeros = 0;
255 for (
int i = 0; i <
fes->
GetNE(); i++)
261 for (
int k = 0; k <
dnfi.Size(); k++)
263 dnfi[k]->AssembleElementGrad(*fe, *T, el_x, elmat);
290 for (
int k = 0; k <
fnfi.Size(); k++)
292 fnfi[k]->AssembleFaceGrad(*fe1, *fe2, *tr, el_x, elmat);
308 for (
int k = 0; k <
bfnfi.Size(); k++)
316 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
317 "invalid boundary marker for boundary face integrator #"
318 << k <<
", counting from zero");
319 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
321 bdr_attr_marker[i] |= bdr_marker[i];
325 for (
int i = 0; i <
fes -> GetNBE(); i++)
328 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
341 for (
int k = 0; k <
bfnfi.Size(); k++)
346 bfnfi[k]->AssembleFaceGrad(*fe1, *fe2, *tr, el_x, elmat);
394 for (
int i = 0; i <
dnfi.Size(); i++) {
delete dnfi[i]; }
395 for (
int i = 0; i <
fnfi.Size(); i++) {
delete fnfi[i]; }
396 for (
int i = 0; i <
bfnfi.Size(); i++) {
delete bfnfi[i]; }
401 fes(0), BlockGrad(NULL)
411 for (
int i=0; i<
Grads.NumRows(); ++i)
413 for (
int j=0; j<
Grads.NumCols(); ++j)
418 for (
int i = 0; i <
ess_vdofs.Size(); ++i)
431 for (
int i=0; i<
fes.
Size(); ++i)
447 for (
int s = 0; s <
fes.
Size(); ++s)
454 fes(0), BlockGrad(NULL)
472 for (
int s=0; s<
fes.
Size(); ++s)
475 vsize =
fes[s]->GetVSize();
479 fes[s]->GetEssentialVDofs(*(bdr_attr_is_ess[s]), vdof_marker);
481 for (i = 0; i < vsize; ++i)
491 for (i = j = 0; i < vsize; ++i)
501 for (i = 0; i < nv; ++i)
518 for (
int i=0; i<
fes.
Size(); ++i)
520 el_x_const[i] = el_x[i] =
new Vector();
525 for (
int i = 0; i <
fes[0]->GetNE(); ++i)
527 T =
fes[0]->GetElementTransformation(i);
528 for (
int s=0; s<
fes.
Size(); ++s)
530 fe[s] =
fes[s]->GetFE(i);
531 fes[s]->GetElementVDofs(i, *vdofs[s]);
535 for (
int k = 0; k <
dnfi.Size(); ++k)
537 energy +=
dnfi[k]->GetElementEnergy(fe, *T, el_x_const);
543 MFEM_ABORT(
"TODO: add energy contribution from interior face terms");
548 MFEM_ABORT(
"TODO: add energy contribution from boundary face terms");
573 for (
int s=0; s<
fes.
Size(); ++s)
575 el_x_const[s] = el_x[s] =
new Vector();
583 for (
int i = 0; i <
fes[0]->GetNE(); ++i)
585 T =
fes[0]->GetElementTransformation(i);
586 for (
int s = 0; s <
fes.
Size(); ++s)
588 fes[s]->GetElementVDofs(i, *(vdofs[s]));
589 fe[s] =
fes[s]->GetFE(i);
593 for (
int k = 0; k <
dnfi.Size(); ++k)
595 dnfi[k]->AssembleElementVector(fe, *T,
598 for (
int s=0; s<
fes.
Size(); ++s)
600 if (el_y[s]->Size() == 0) {
continue; }
609 Mesh *mesh =
fes[0]->GetMesh();
617 for (
int s=0; s<
fes.
Size(); ++s)
622 fes[s]->GetElementVDofs(tr->
Elem1No, *(vdofs[s]));
623 fes[s]->GetElementVDofs(tr->
Elem2No, *(vdofs2[s]));
625 vdofs[s]->
Append(*(vdofs2[s]));
630 for (
int k = 0; k <
fnfi.Size(); ++k)
633 fnfi[k]->AssembleFaceVector(fe, fe2, *tr, el_x_const, el_y);
635 for (
int s=0; s<
fes.
Size(); ++s)
637 if (el_y[s]->Size() == 0) {
continue; }
647 Mesh *mesh =
fes[0]->GetMesh();
653 for (
int k = 0; k <
bfnfi.Size(); ++k)
661 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
662 "invalid boundary marker for boundary face integrator #"
663 << k <<
", counting from zero");
664 for (
int i = 0; i < bdr_attr_marker.
Size(); ++i)
666 bdr_attr_marker[i] |= bdr_marker[i];
670 for (
int i = 0; i < mesh->
GetNBE(); ++i)
673 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
678 for (
int s=0; s<
fes.
Size(); ++s)
683 fes[s]->GetElementVDofs(tr->
Elem1No, *(vdofs[s]));
687 for (
int k = 0; k <
bfnfi.Size(); ++k)
692 bfnfi[k]->AssembleFaceVector(fe, fe2, *tr, el_x_const, el_y);
694 for (
int s=0; s<
fes.
Size(); ++s)
696 if (el_y[s]->Size() == 0) {
continue; }
704 for (
int s=0; s<
fes.
Size(); ++s)
723 const int skip_zeros = 0;
740 for (
int i=0; i<
fes.
Size(); ++i)
742 el_x_const[i] = el_x[i] =
new Vector();
745 for (
int j=0; j<
fes.
Size(); ++j)
751 for (
int i=0; i<
fes.
Size(); ++i)
753 for (
int j=0; j<
fes.
Size(); ++j)
755 if (
Grads(i,j) != NULL)
769 for (
int i = 0; i <
fes[0]->GetNE(); ++i)
771 T =
fes[0]->GetElementTransformation(i);
772 for (
int s = 0; s <
fes.
Size(); ++s)
774 fe[s] =
fes[s]->GetFE(i);
775 fes[s]->GetElementVDofs(i, *vdofs[s]);
779 for (
int k = 0; k <
dnfi.Size(); ++k)
781 dnfi[k]->AssembleElementGrad(fe, *T, el_x_const, elmats);
783 for (
int j=0; j<
fes.
Size(); ++j)
785 for (
int l=0; l<
fes.
Size(); ++l)
787 if (elmats(j,l)->Height() == 0) {
continue; }
788 Grads(j,l)->AddSubMatrix(*vdofs[j], *vdofs[l],
789 *elmats(j,l), skip_zeros);
799 Mesh *mesh =
fes[0]->GetMesh();
805 for (
int s=0; s <
fes.
Size(); ++s)
810 fes[s]->GetElementVDofs(tr->
Elem1No, *vdofs[s]);
811 fes[s]->GetElementVDofs(tr->
Elem2No, *vdofs2[s]);
812 vdofs[s]->
Append(*(vdofs2[s]));
817 for (
int k = 0; k <
fnfi.Size(); ++k)
819 fnfi[k]->AssembleFaceGrad(fe, fe2, *tr, el_x_const, elmats);
820 for (
int j=0; j<
fes.
Size(); ++j)
822 for (
int l=0; l<
fes.
Size(); ++l)
824 if (elmats(j,l)->Height() == 0) {
continue; }
825 Grads(j,l)->AddSubMatrix(*vdofs[j], *vdofs[l],
826 *elmats(j,l), skip_zeros);
836 Mesh *mesh =
fes[0]->GetMesh();
842 for (
int k = 0; k <
bfnfi.Size(); ++k)
850 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
851 "invalid boundary marker for boundary face integrator #"
852 << k <<
", counting from zero");
853 for (
int i = 0; i < bdr_attr_marker.
Size(); ++i)
855 bdr_attr_marker[i] |= bdr_marker[i];
859 for (
int i = 0; i < mesh->
GetNBE(); ++i)
862 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
867 for (
int s = 0; s <
fes.
Size(); ++s)
872 fes[s]->GetElementVDofs(i, *vdofs[s]);
876 for (
int k = 0; k <
bfnfi.Size(); ++k)
878 bfnfi[k]->AssembleFaceGrad(fe, fe2, *tr, el_x_const, elmats);
879 for (
int l=0; l<
fes.
Size(); ++l)
881 for (
int j=0; j<
fes.
Size(); ++j)
883 if (elmats(j,l)->Height() == 0) {
continue; }
884 Grads(j,l)->AddSubMatrix(*vdofs[j], *vdofs[l],
885 *elmats(j,l), skip_zeros);
893 for (
int s=0; s<
fes.
Size(); ++s)
895 for (
int i = 0; i <
ess_vdofs[s]->Size(); ++i)
897 for (
int j=0; j<
fes.
Size(); ++j)
912 if (!
Grads(0,0)->Finalized())
914 for (
int i=0; i<
fes.
Size(); ++i)
916 for (
int j=0; j<
fes.
Size(); ++j)
918 Grads(i,j)->Finalize(skip_zeros);
923 for (
int i=0; i<
fes.
Size(); ++i)
925 for (
int j=0; j<
fes.
Size(); ++j)
947 for (
int i=0; i<
fes.
Size(); ++i)
949 for (
int j=0; j<
fes.
Size(); ++j)
956 for (
int i = 0; i <
dnfi.Size(); ++i)
961 for (
int i = 0; i <
fnfi.Size(); ++i)
966 for (
int i = 0; i <
bfnfi.Size(); ++i)
Abstract class for Finite Elements.
int Size() const
Logical size of the array.
void SetSubVector(const Array< int > &dofs, const double value)
Set the entries listed in dofs to the given value.
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.
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 SetSize(int s)
Resize the vector to size s.
int GetNBE() const
Returns number of boundary elements.
void GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void Copy(Array ©) const
Create a copy of the current array.
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Data type dense matrix using column-major storage.
int Size() const
Returns the size of the vector.
void Update(double *data, const Array< int > &bOffsets)
Update method.
void BooleanMultTranspose(int alpha, int *x, int beta, int *y)
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
Abstract parallel finite element space.
FaceElementTransformations * GetInteriorFaceTransformations(int FaceNo)
double * GetData() const
Return a pointer to the beginning of the Vector data.
static void MarkerToList(const Array< int > &marker, Array< int > &list)
Convert a Boolean marker array to a list containing all marked indices.
virtual int GetTrueVSize() const
Return the number of local vector true dofs.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
int GetNE() const
Returns number of elements in the mesh.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Append(const T &el)
Append element to array, resize if necessary.
Mesh * GetMesh() const
Returns the mesh.
HypreParMatrix * Dof_TrueDof_Matrix() const
The true dof-to-dof interpolation matrix.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
virtual const Operator * GetProlongationMatrix() const
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
FaceElementTransformations * GetBdrFaceTransformations(int BdrElemNo)
void AddElementVector(const Array< int > &dofs, const Vector &elemvect)
Add (element) subvector to the vector.
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
Set the diagonal value to one.
Dynamic 2D array using row-major layout.
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 SetSize(int nsize)
Change logical size of the array, keep existing entries.
void EliminateRowCol(int rc, const double sol, Vector &rhs, DiagonalPolicy dpolicy=DIAG_ONE)
Eliminate row rc and column rc and modify the rhs using sol.
void PartialSum()
Partial Sum.
int height
Dimension of the output / number of rows in the matrix.
void ConvertToConformingVDofs(const Array< int > &dofs, Array< int > &cdofs)
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.
static void ListToMarker(const Array< int > &list, int marker_size, Array< int > &marker, int mark_val=-1)
long GetSequence() const
Return update counter (see Mesh::sequence)
A class to handle Block systems in a matrix-free implementation.
int width
Dimension of the input / number of columns in the matrix.
void SetBlock(int iRow, int iCol, Operator *op, double c=1.0)
Add a block op in the block-entry (iblock, jblock).
Vector & GetBlock(int i)
Get the i-th vector in the block.