15 #include "../general/forall.hpp"
17 #include "libceed/ceed.hpp"
42 trialFes(
a->FESpace()),
53 const int integratorCount = integrators.
Size();
54 for (
int i = 0; i < integratorCount; ++i)
56 integrators[i]->AssembleMF(*
a->
FESpace());
64 const int iSz = integrators.
Size();
68 for (
int i = 0; i < iSz; ++i)
70 integrators[i]->AssembleDiagonalMF(
localY);
87 for (
int i = 0; i < iSz; ++i)
89 integrators[i]->AssembleDiagonalMF(y);
129 const int iSz = integrators.
Size();
134 for (
int i = 0; i < iSz; ++i)
136 integrators[i]->AddMultMF(x, y);
143 for (
int i = 0; i < iSz; ++i)
151 const int iFISz = intFaceIntegrators.
Size();
158 for (
int i = 0; i < iFISz; ++i)
167 const int bFISz = bdrFaceIntegrators.
Size();
174 for (
int i = 0; i < bFISz; ++i)
186 const int iSz = integrators.
Size();
191 for (
int i = 0; i < iSz; ++i)
201 for (
int i = 0; i < iSz; ++i)
203 integrators[i]->AddMultTransposeMF(x, y);
208 const int iFISz = intFaceIntegrators.
Size();
215 for (
int i = 0; i < iFISz; ++i)
224 const int bFISz = bdrFaceIntegrators.
Size();
231 for (
int i = 0; i < bFISz; ++i)
243 trialFes(
a->FESpace()),
244 testFes(
a->FESpace())
293 const int integratorCount = integrators.
Size();
294 for (
int i = 0; i < integratorCount; ++i)
296 integrators[i]->AssemblePA(*
a->
FESpace());
299 MFEM_VERIFY(
a->
GetBBFI()->Size() == 0,
300 "Partial assembly does not support AddBoundaryIntegrator yet.");
303 const int intFaceIntegratorCount = intFaceIntegrators.Size();
304 for (
int i = 0; i < intFaceIntegratorCount; ++i)
306 intFaceIntegrators[i]->AssemblePAInteriorFaces(*
a->
FESpace());
310 const int boundFaceIntegratorCount = bdrFaceIntegrators.
Size();
311 for (
int i = 0; i < boundFaceIntegratorCount; ++i)
313 bdrFaceIntegrators[i]->AssemblePABoundaryFaces(*
a->
FESpace());
321 const int iSz = integrators.
Size();
325 for (
int i = 0; i < iSz; ++i)
327 integrators[i]->AssembleDiagonalPA(
localY);
344 for (
int i = 0; i < iSz; ++i)
346 integrators[i]->AssembleDiagonalPA(y);
386 const int iSz = integrators.
Size();
391 for (
int i = 0; i < iSz; ++i)
393 integrators[i]->AddMultPA(x, y);
400 for (
int i = 0; i < iSz; ++i)
408 const int iFISz = intFaceIntegrators.
Size();
415 for (
int i = 0; i < iFISz; ++i)
424 const int bFISz = bdrFaceIntegrators.
Size();
431 for (
int i = 0; i < bFISz; ++i)
443 const int iSz = integrators.
Size();
448 for (
int i = 0; i < iSz; ++i)
458 for (
int i = 0; i < iSz; ++i)
460 integrators[i]->AddMultTransposePA(x, y);
465 const int iFISz = intFaceIntegrators.
Size();
472 for (
int i = 0; i < iFISz; ++i)
481 const int bFISz = bdrFaceIntegrators.
Size();
488 for (
int i = 0; i < bFISz; ++i)
500 factorize_face_terms(form->FESpace()->IsDGSpace())
515 const int integratorCount = integrators.
Size();
516 for (
int i = 0; i < integratorCount; ++i)
525 MFEM_VERIFY(
a->
GetBBFI()->Size() == 0,
526 "Element assembly does not support AddBoundaryIntegrator yet.");
529 const int intFaceIntegratorCount = intFaceIntegrators.Size();
530 if (intFaceIntegratorCount>0)
536 for (
int i = 0; i < intFaceIntegratorCount; ++i)
538 intFaceIntegrators[i]->AssembleEAInteriorFaces(*
a->
FESpace(),
545 const int boundFaceIntegratorCount = bdrFaceIntegrators.
Size();
546 if (boundFaceIntegratorCount>0)
552 for (
int i = 0; i < boundFaceIntegratorCount; ++i)
572 const bool useRestrict = !DeviceCanUseCeed() &&
elem_restrict;
588 MFEM_FORALL(glob_j,
ne*NDOFS,
590 const int e = glob_j/NDOFS;
591 const int j = glob_j%NDOFS;
593 for (
int i = 0; i < NDOFS; i++)
595 res += A(i, j, e)*X(i, e);
607 const int iFISz = intFaceIntegrators.
Size();
622 MFEM_FORALL(glob_j,
nf_int*NDOFS,
624 const int f = glob_j/NDOFS;
625 const int j = glob_j%NDOFS;
627 for (
int i = 0; i < NDOFS; i++)
629 res += A_int(i, j, 0, f)*X(i, 0, f);
633 for (
int i = 0; i < NDOFS; i++)
635 res += A_int(i, j, 1, f)*X(i, 1, f);
641 MFEM_FORALL(glob_j,
nf_int*NDOFS,
643 const int f = glob_j/NDOFS;
644 const int j = glob_j%NDOFS;
646 for (
int i = 0; i < NDOFS; i++)
648 res += A_ext(i, j, 0, f)*X(i, 0, f);
652 for (
int i = 0; i < NDOFS; i++)
654 res += A_ext(i, j, 1, f)*X(i, 1, f);
665 const int bFISz = bdrFaceIntegrators.
Size();
678 MFEM_FORALL(glob_j,
nf_bdr*NDOFS,
680 const int f = glob_j/NDOFS;
681 const int j = glob_j%NDOFS;
683 for (
int i = 0; i < NDOFS; i++)
685 res += A(i, j, f)*X(i, f);
698 const bool useRestrict = DeviceCanUseCeed() || !
elem_restrict;
714 MFEM_FORALL(glob_j,
ne*NDOFS,
716 const int e = glob_j/NDOFS;
717 const int j = glob_j%NDOFS;
719 for (
int i = 0; i < NDOFS; i++)
721 res += A(j, i, e)*X(i, e);
733 const int iFISz = intFaceIntegrators.
Size();
748 MFEM_FORALL(glob_j,
nf_int*NDOFS,
750 const int f = glob_j/NDOFS;
751 const int j = glob_j%NDOFS;
753 for (
int i = 0; i < NDOFS; i++)
755 res += A_int(j, i, 0, f)*X(i, 0, f);
759 for (
int i = 0; i < NDOFS; i++)
761 res += A_int(j, i, 1, f)*X(i, 1, f);
767 MFEM_FORALL(glob_j,
nf_int*NDOFS,
769 const int f = glob_j/NDOFS;
770 const int j = glob_j%NDOFS;
772 for (
int i = 0; i < NDOFS; i++)
774 res += A_ext(j, i, 0, f)*X(i, 0, f);
778 for (
int i = 0; i < NDOFS; i++)
780 res += A_ext(j, i, 1, f)*X(i, 1, f);
791 const int bFISz = bdrFaceIntegrators.
Size();
804 MFEM_FORALL(glob_j,
nf_bdr*NDOFS,
806 const int f = glob_j/NDOFS;
807 const int j = glob_j%NDOFS;
809 for (
int i = 0; i < NDOFS; i++)
811 res += A(j, i, f)*X(i, f);
824 mat(form->FESpace()->GetVSize(),form->FESpace()->GetVSize(),0),
825 face_mat(form->FESpace()->GetVSize(),0,0),
830 dynamic_cast<ParFiniteElementSpace*>(form->
FESpace()) )
832 if (pfes->IsDGSpace())
835 pfes->ExchangeFaceNbrData();
836 face_mat.
SetWidth(pfes->GetFaceNbrVSize());
856 if (restF) { restF->
FillI(mat, face_mat); }
862 for (
int i = 0; i < ndofs; i++)
864 const int nnz = h_I[i];
872 if (use_face_mat && restF)
876 for (
int i = 0; i < ndofs; i++)
878 const int nnz = h_I_face[i];
882 const int nnz_face = cpt;
883 h_I_face[ndofs] = nnz_face;
896 for (
int i = ndofs; i > 0; i--)
901 if (use_face_mat && restF)
904 for (
int i = ndofs; i > 0; i--)
906 I_face[i] = I_face[i-1];
924 dynamic_cast<const ParFiniteElementSpace*>(
testFes))
927 x_gf.
MakeRef(const_cast<ParFiniteElementSpace*>(pfes),
928 const_cast<Vector&>(x),0);
931 if (shared_x.
Size()) { face_mat.
AddMult(shared_x, y); }
941 dynamic_cast<const ParFiniteElementSpace*>(
testFes))
944 x_gf.
MakeRef(const_cast<ParFiniteElementSpace*>(pfes),
945 const_cast<Vector&>(x),0);
955 :
Operator(form->Height(), form->Width()),
a(form)
985 trialFes(form->TrialFESpace()),
986 testFes(form->TestFESpace()),
987 elem_restrict_trial(NULL),
988 elem_restrict_test(NULL)
996 const int integratorCount = integrators.
Size();
997 for (
int i = 0; i < integratorCount; ++i)
1001 MFEM_VERIFY(
a->
GetBBFI()->Size() == 0,
1002 "Partial assembly does not support AddBoundaryIntegrator yet.");
1004 "Partial assembly does not support AddTraceFaceIntegrator yet.");
1006 "Partial assembly does not support AddBdrTraceFaceIntegrator yet.");
1057 void PAMixedBilinearFormExtension::SetupMultInputs(
1064 const double c)
const
1067 if (elem_restrict_x)
1069 elem_restrict_x->
Mult(x, localX);
1086 if (elem_restrict_y)
1104 const double c)
const
1107 const int iSz = integrators.
Size();
1114 for (
int i = 0; i < iSz; ++i)
1136 const double c)
const
1139 const int iSz = integrators.
Size();
1146 for (
int i = 0; i < iSz; ++i)
1165 const int iSz = integrators.
Size();
1171 if (H1elem_restrict_trial)
1184 for (
int i = 0; i < iSz; ++i)
1192 integrators[i]->AssembleDiagonalPA_ADAt(D,
localTest);
1197 if (H1elem_restrict_test)
1210 for (
int i = 0; i < iSz; ++i)
1214 integrators[i]->AssembleDiagonalPA_ADAt(
localTrial, diag);
1218 integrators[i]->AssembleDiagonalPA_ADAt(D, diag);
int GetNFbyType(FaceType type) const
Returns the number of faces according to the requested type.
int Size() const
Return the logical size of the array.
void FormRectangularSystemOperator(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, Operator *&A)
Return in A a parallel (on truedofs) version of this rectangular operator (including constraints)...
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
void MultTransposeUnsigned(const Vector &x, Vector &y) const
Compute MultTranspose without applying signs based on DOF orientations.
void ExchangeFaceNbrData()
virtual void FillI(SparseMatrix &mat, SparseMatrix &face_mat) const
void SetSize(int s)
Resize the vector to size s.
Pointer to an Operator of a specified type.
void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
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 AddFaceMatricesToElementMatrices(Vector &fea_data, Vector &ea_data) const
This methods adds the DG face matrices to the element matrices.
int GetNE() const
Returns number of elements.
void AddMultTranspose(const Vector &x, Vector &y, const double a=1.0) const
y += At * x (default) or y += a * At * x
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
Geometry::Type GetFaceBaseGeometry(int i) const
Abstract parallel finite element space.
bool UsesTensorBasis(const FiniteElementSpace &fes)
Memory< double > & GetMemoryData()
MemoryType GetMemoryType() const
Return a MemoryType that is currently valid. If both the host and the device pointers are currently v...
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Memory< int > & GetMemoryJ()
void FormRectangularLinearSystem(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, Vector &x, Vector &b, Operator *&A, Vector &X, Vector &B)
Form a column-constrained linear system using a matrix-free approach.
const Operator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims...dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
virtual void MakeRef(FiniteElementSpace *f, double *v)
Make the ParGridFunction reference external data on a new FiniteElementSpace.
double * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
Native ordering as defined by the FiniteElement.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void FillI(SparseMatrix &mat) const
Mesh * GetMesh() const
Returns the mesh.
Operator that extracts Face degrees of freedom.
void SetWidth(int width_=-1)
Change the width of a SparseMatrix.
static MemoryType GetDeviceMemoryType()
Get the current Device MemoryType. This is the MemoryType used by most MFEM classes when allocating m...
static MemoryType GetMemoryType()
(DEPRECATED) Equivalent to GetDeviceMemoryType().
bool IsDGSpace() const
Return whether or not the space is discontinuous (L2)
void MultUnsigned(const Vector &x, Vector &y) const
Compute Mult without applying signs based on DOF orientations.
int GetVDim() const
Returns vector dimension.
virtual const Operator * GetFaceRestriction(ElementDofOrdering e_ordering, FaceType, L2FaceValues mul=L2FaceValues::DoubleValued) const
Return an Operator that converts L-vectors to E-vectors on each face.
Operator that converts FiniteElementSpace L-vectors to E-vectors.
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 FillJAndData(const Vector &ea_data, SparseMatrix &mat) const
void FormLinearSystem(const Array< int > &ess_tdof_list, Vector &x, Vector &b, Operator *&A, Vector &X, Vector &B, int copy_interior=0)
Form a constrained linear system using a matrix-free approach.
Vector & Set(const double a, const Vector &x)
(*this) = a * x
int height
Dimension of the output / number of rows in the matrix.
const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
void New(int size)
Allocate host memory for size entries with the current host memory type returned by MemoryManager::Ge...
void FormSystemOperator(const Array< int > &ess_tdof_list, Operator *&A)
Return in A a parallel (on truedofs) version of this square operator.
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
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 in the FiniteElementCollection associated with i'th element in t...
Lexicographic ordering for tensor-product FiniteElements.
virtual void FillJAndData(const Vector &ea_data, SparseMatrix &mat, SparseMatrix &face_mat) const
Class for parallel grid function.
Operator that converts L2 FiniteElementSpace L-vectors to E-vectors.
int width
Dimension of the input / number of columns in the matrix.
void FillSparseMatrix(const Vector &mat_ea, SparseMatrix &mat) const
Fill a Sparse Matrix with Element Matrices.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
double f(const Vector &p)
void SyncAliasMemory(const Vector &v)
Update the alias memory location of the vector to match v.