21 MFEM_ABORT(
"the assembly level has already been set!");
33 mfem_error(
"Unknown assembly level for this form.");
74 MFEM_ABORT(
"internal MFEM error");
91 for (
int i = 0; i <
fes->
GetNE(); i++)
97 for (
int k = 0; k <
dnfi.Size(); k++)
99 energy +=
dnfi[k]->GetElementEnergy(*fe, *T, el_x);
106 MFEM_ABORT(
"TODO: add energy contribution from interior face terms");
111 MFEM_ABORT(
"TODO: add energy contribution from boundary face terms");
119 MFEM_VERIFY(x.
Size() ==
Width(),
"invalid input Vector size");
154 for (
int i = 0; i <
fes->
GetNE(); i++)
160 for (
int k = 0; k <
dnfi.Size(); k++)
162 dnfi[k]->AssembleElementVector(*fe, *T, el_x, el_y);
188 for (
int k = 0; k <
fnfi.Size(); k++)
190 fnfi[k]->AssembleFaceVector(*fe1, *fe2, *tr, el_x, el_y);
206 for (
int k = 0; k <
bfnfi.Size(); k++)
214 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
215 "invalid boundary marker for boundary face integrator #"
216 << k <<
", counting from zero");
217 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
219 bdr_attr_marker[i] |= bdr_marker[i];
223 for (
int i = 0; i <
fes -> GetNBE(); i++)
226 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
239 for (
int k = 0; k <
bfnfi.Size(); k++)
244 bfnfi[k]->AssembleFaceVector(*fe1, *fe2, *tr, el_x, el_y);
267 MFEM_ABORT(
"Not yet implemented!");
270 const int skip_zeros = 0;
290 for (
int i = 0; i <
fes->
GetNE(); i++)
296 for (
int k = 0; k <
dnfi.Size(); k++)
298 dnfi[k]->AssembleElementGrad(*fe, *T, el_x, elmat);
325 for (
int k = 0; k <
fnfi.Size(); k++)
327 fnfi[k]->AssembleFaceGrad(*fe1, *fe2, *tr, el_x, elmat);
343 for (
int k = 0; k <
bfnfi.Size(); k++)
351 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
352 "invalid boundary marker for boundary face integrator #"
353 << k <<
", counting from zero");
354 for (
int i = 0; i < bdr_attr_marker.
Size(); i++)
356 bdr_attr_marker[i] |= bdr_marker[i];
360 for (
int i = 0; i <
fes -> GetNBE(); i++)
363 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
376 for (
int k = 0; k <
bfnfi.Size(); k++)
381 bfnfi[k]->AssembleFaceGrad(*fe1, *fe2, *tr, el_x, elmat);
413 if (
ext) { MFEM_ABORT(
"Not yet implemented!"); }
436 for (
int i = 0; i <
dnfi.Size(); i++) {
delete dnfi[i]; }
437 for (
int i = 0; i <
fnfi.Size(); i++) {
delete fnfi[i]; }
438 for (
int i = 0; i <
bfnfi.Size(); i++) {
delete bfnfi[i]; }
444 fes(0), BlockGrad(NULL)
454 for (
int i=0; i<
Grads.NumRows(); ++i)
456 for (
int j=0; j<
Grads.NumCols(); ++j)
461 for (
int i = 0; i <
ess_vdofs.Size(); ++i)
474 for (
int i=0; i<
fes.
Size(); ++i)
490 for (
int s = 0; s <
fes.
Size(); ++s)
497 fes(0), BlockGrad(NULL)
515 for (
int s=0; s<
fes.
Size(); ++s)
518 vsize =
fes[s]->GetVSize();
522 fes[s]->GetEssentialVDofs(*(bdr_attr_is_ess[s]), vdof_marker);
524 for (i = 0; i < vsize; ++i)
534 for (i = j = 0; i < vsize; ++i)
544 for (i = 0; i < nv; ++i)
561 for (
int i=0; i<
fes.
Size(); ++i)
563 el_x_const[i] = el_x[i] =
new Vector();
568 for (
int i = 0; i <
fes[0]->GetNE(); ++i)
570 T =
fes[0]->GetElementTransformation(i);
571 for (
int s=0; s<
fes.
Size(); ++s)
573 fe[s] =
fes[s]->GetFE(i);
574 fes[s]->GetElementVDofs(i, *vdofs[s]);
578 for (
int k = 0; k <
dnfi.Size(); ++k)
580 energy +=
dnfi[k]->GetElementEnergy(fe, *T, el_x_const);
586 MFEM_ABORT(
"TODO: add energy contribution from interior face terms");
591 MFEM_ABORT(
"TODO: add energy contribution from boundary face terms");
616 for (
int s=0; s<
fes.
Size(); ++s)
618 el_x_const[s] = el_x[s] =
new Vector();
626 for (
int i = 0; i <
fes[0]->GetNE(); ++i)
628 T =
fes[0]->GetElementTransformation(i);
629 for (
int s = 0; s <
fes.
Size(); ++s)
631 fes[s]->GetElementVDofs(i, *(vdofs[s]));
632 fe[s] =
fes[s]->GetFE(i);
636 for (
int k = 0; k <
dnfi.Size(); ++k)
638 dnfi[k]->AssembleElementVector(fe, *T,
641 for (
int s=0; s<
fes.
Size(); ++s)
643 if (el_y[s]->Size() == 0) {
continue; }
652 Mesh *mesh =
fes[0]->GetMesh();
660 for (
int s=0; s<
fes.
Size(); ++s)
665 fes[s]->GetElementVDofs(tr->
Elem1No, *(vdofs[s]));
666 fes[s]->GetElementVDofs(tr->
Elem2No, *(vdofs2[s]));
668 vdofs[s]->
Append(*(vdofs2[s]));
673 for (
int k = 0; k <
fnfi.Size(); ++k)
676 fnfi[k]->AssembleFaceVector(fe, fe2, *tr, el_x_const, el_y);
678 for (
int s=0; s<
fes.
Size(); ++s)
680 if (el_y[s]->Size() == 0) {
continue; }
690 Mesh *mesh =
fes[0]->GetMesh();
696 for (
int k = 0; k <
bfnfi.Size(); ++k)
704 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
705 "invalid boundary marker for boundary face integrator #"
706 << k <<
", counting from zero");
707 for (
int i = 0; i < bdr_attr_marker.
Size(); ++i)
709 bdr_attr_marker[i] |= bdr_marker[i];
713 for (
int i = 0; i < mesh->
GetNBE(); ++i)
716 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
721 for (
int s=0; s<
fes.
Size(); ++s)
726 fes[s]->GetElementVDofs(tr->
Elem1No, *(vdofs[s]));
730 for (
int k = 0; k <
bfnfi.Size(); ++k)
735 bfnfi[k]->AssembleFaceVector(fe, fe2, *tr, el_x_const, el_y);
737 for (
int s=0; s<
fes.
Size(); ++s)
739 if (el_y[s]->Size() == 0) {
continue; }
747 for (
int s=0; s<
fes.
Size(); ++s)
766 const int skip_zeros = 0;
783 for (
int i=0; i<
fes.
Size(); ++i)
785 el_x_const[i] = el_x[i] =
new Vector();
788 for (
int j=0; j<
fes.
Size(); ++j)
794 for (
int i=0; i<
fes.
Size(); ++i)
796 for (
int j=0; j<
fes.
Size(); ++j)
798 if (
Grads(i,j) != NULL)
812 for (
int i = 0; i <
fes[0]->GetNE(); ++i)
814 T =
fes[0]->GetElementTransformation(i);
815 for (
int s = 0; s <
fes.
Size(); ++s)
817 fe[s] =
fes[s]->GetFE(i);
818 fes[s]->GetElementVDofs(i, *vdofs[s]);
822 for (
int k = 0; k <
dnfi.Size(); ++k)
824 dnfi[k]->AssembleElementGrad(fe, *T, el_x_const, elmats);
826 for (
int j=0; j<
fes.
Size(); ++j)
828 for (
int l=0; l<
fes.
Size(); ++l)
830 if (elmats(j,l)->Height() == 0) {
continue; }
831 Grads(j,l)->AddSubMatrix(*vdofs[j], *vdofs[l],
832 *elmats(j,l), skip_zeros);
842 Mesh *mesh =
fes[0]->GetMesh();
848 for (
int s=0; s <
fes.
Size(); ++s)
853 fes[s]->GetElementVDofs(tr->
Elem1No, *vdofs[s]);
854 fes[s]->GetElementVDofs(tr->
Elem2No, *vdofs2[s]);
855 vdofs[s]->
Append(*(vdofs2[s]));
860 for (
int k = 0; k <
fnfi.Size(); ++k)
862 fnfi[k]->AssembleFaceGrad(fe, fe2, *tr, el_x_const, elmats);
863 for (
int j=0; j<
fes.
Size(); ++j)
865 for (
int l=0; l<
fes.
Size(); ++l)
867 if (elmats(j,l)->Height() == 0) {
continue; }
868 Grads(j,l)->AddSubMatrix(*vdofs[j], *vdofs[l],
869 *elmats(j,l), skip_zeros);
879 Mesh *mesh =
fes[0]->GetMesh();
885 for (
int k = 0; k <
bfnfi.Size(); ++k)
893 MFEM_ASSERT(bdr_marker.
Size() == bdr_attr_marker.
Size(),
894 "invalid boundary marker for boundary face integrator #"
895 << k <<
", counting from zero");
896 for (
int i = 0; i < bdr_attr_marker.
Size(); ++i)
898 bdr_attr_marker[i] |= bdr_marker[i];
902 for (
int i = 0; i < mesh->
GetNBE(); ++i)
905 if (bdr_attr_marker[bdr_attr-1] == 0) {
continue; }
910 for (
int s = 0; s <
fes.
Size(); ++s)
915 fes[s]->GetElementVDofs(i, *vdofs[s]);
919 for (
int k = 0; k <
bfnfi.Size(); ++k)
921 bfnfi[k]->AssembleFaceGrad(fe, fe2, *tr, el_x_const, elmats);
922 for (
int l=0; l<
fes.
Size(); ++l)
924 for (
int j=0; j<
fes.
Size(); ++j)
926 if (elmats(j,l)->Height() == 0) {
continue; }
927 Grads(j,l)->AddSubMatrix(*vdofs[j], *vdofs[l],
928 *elmats(j,l), skip_zeros);
936 for (
int s=0; s<
fes.
Size(); ++s)
938 for (
int i = 0; i <
ess_vdofs[s]->Size(); ++i)
940 for (
int j=0; j<
fes.
Size(); ++j)
955 if (!
Grads(0,0)->Finalized())
957 for (
int i=0; i<
fes.
Size(); ++i)
959 for (
int j=0; j<
fes.
Size(); ++j)
961 Grads(i,j)->Finalize(skip_zeros);
966 for (
int i=0; i<
fes.
Size(); ++i)
968 for (
int j=0; j<
fes.
Size(); ++j)
990 for (
int i=0; i<
fes.
Size(); ++i)
992 for (
int j=0; j<
fes.
Size(); ++j)
999 for (
int i = 0; i <
dnfi.Size(); ++i)
1004 for (
int i = 0; i <
fnfi.Size(); ++i)
1009 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.
A class to handle Vectors in a block fashion.
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.
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.
void BooleanMultTranspose(int alpha, const int *x, int beta, int *y)
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.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
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
The returned Operator is owned by the FiniteElementSpace.
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.
bool Finalized() const
Returns whether or not CSR format has been finalized.
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.