46 int s1 = lelem_ldof.
Size(), s2 = nelem_ndof.
Size();
47 const int *I1 = lelem_ldof.
GetI(), *J1 = lelem_ldof.
GetJ();
48 const int *I2 = nelem_ndof.
GetI(), *J2 = nelem_ndof.
GetJ();
49 const int nnz1 = I1[s1], nnz2 = I2[s2];
51 elem_dof.
SetDims(s1 + s2, nnz1 + nnz2);
53 int *I = elem_dof.
GetI(), *J = elem_dof.
GetJ();
54 for (
int i = 0; i <= s1; i++)
58 for (
int j = 0; j < nnz1; j++)
62 for (
int i = 0; i <= s2; i++)
64 I[s1+i] = I2[i] + nnz1;
66 for (
int j = 0; j < nnz2; j++)
68 J[nnz1+j] = J2[j] +
height;
105 mfem::Mult(*face_lelem, lelem_ldof, face_ldof);
113 int *I = dof_dof.
GetI();
114 int *J = dof_dof.
GetJ();
115 int nrows = dof_dof.
Size();
158 if (A_local == NULL) {
return; }
159 MFEM_VERIFY(A_local->
Finalized(),
"the local matrix must be finalized");
177 int *J = A_local->
GetJ();
178 for (
int i = 0; i < glob_J.
Size(); i++)
182 glob_J[i] = J[i] + ldof_offset;
186 glob_J[i] = face_nbr_glob_ldof[J[i] - lvsize];
228 for (
int i = 0; i < nfaces; i++)
234 vdofs1.
Copy(vdofs_all);
235 for (
int j = 0; j < vdofs2.
Size(); j++)
287 "Vector for holding diagonal has wrong size!");
291 MFEM_ASSERT(
p_mat.
Ptr(),
"the ParBilinearForm is not assembled!");
319 MFEM_ABORT(
"unsupported prolongation matrix type.");
324::ParallelEliminateEssentialBC(
const Array<int> &bdr_attr_is_ess,
330 pfes->GetEssentialTrueDofs(bdr_attr_is_ess, dof_list);
363 "the case of interior face integrators is not"
374 MFEM_ASSERT(
mat != NULL,
"local matrix must be assembled");
388 MFEM_ASSERT(x.
ParFESpace() ==
pfes,
"the parallel spaces must match");
389 MFEM_ASSERT(y.
ParFESpace() ==
pfes,
"the parallel spaces must match");
405 MFEM_VERIFY(
p_mat.
Ptr() != NULL,
"parallel matrix must be assembled");
427 MFEM_VERIFY(
p_mat.
Ptr() != NULL,
"parallel matrix must be assembled");
518 const int remove_zeros = 0;
521 "The ParBilinearForm must be updated with Update() before "
522 "re-assembling the ParBilinearForm.");
583 MFEM_VERIFY(
pfes != NULL,
"nfes must be a ParFiniteElementSpace!");
627 A.
MakeRAP(P_test, dA, P_trial);
704 MFEM_ASSERT(
mat,
"Matrix is not assembled");
705 MFEM_ASSERT(
mat->
Finalized(),
"Matrix is not finalized");
737 A.
MakeRAP(R_test_transpose, dA, P_trial);
756 MFEM_VERIFY(
mat->
Finalized(),
"Local matrix needs to be finalized for "
Dynamic 2D array using row-major layout.
void SetSize(int m, int n)
int Size() const
Return the logical size of the array.
void DeleteAll()
Delete the whole array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
void Copy(Array ©) const
Create a copy of the internal array to the provided copy.
Data type dense matrix using column-major storage.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
const Table & GetElementToDofTable() const
Return a reference to the internal Table that stores the lists of scalar dofs, for each mesh element,...
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
virtual const Operator * GetProlongationMatrix() const
The returned Operator is owned by the FiniteElementSpace.
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for the i'th element. The returned indices are offsets into an ...
Ordering::Type GetOrdering() const
Return the ordering method.
Mesh * GetMesh() const
Returns the mesh.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
int GetVDim() const
Returns vector dimension.
void ComputeSolution(const Vector &b, const Vector &sol_r, Vector &sol) const
HypreParMatrix & GetParallelMatrix()
Return the parallel hybridized matrix.
void ReduceRHS(const Vector &b, Vector &b_r) const
Wrapper for hypre's ParCSR matrix class.
void AbsMultTranspose(real_t a, const Vector &x, real_t b, Vector &y) const
Computes y = a * |At| * x + b * y, using entry-wise absolute values of the transpose of the matrix A.
HYPRE_Int MultTranspose(HypreParVector &x, HypreParVector &y, real_t alpha=1.0, real_t beta=0.0) const
Computes y = alpha * A^t * x + beta * y.
HypreParMatrix * LeftDiagMult(const SparseMatrix &D, HYPRE_BigInt *row_starts=NULL) const
Multiply the HypreParMatrix on the left by a block-diagonal parallel matrix D and return the result a...
void EliminateRowsCols(const Array< int > &rows_cols, const HypreParVector &X, HypreParVector &B)
HYPRE_Int Mult(HypreParVector &x, HypreParVector &y, real_t alpha=1.0, real_t beta=0.0) const
Computes y = alpha * A * x + beta * y.
void GetBlocks(Array2D< HypreParMatrix * > &blocks, bool interleaved_rows=false, bool interleaved_cols=false) const
Wrapper for hypre's parallel vector class.
Class used by MFEM to store pointers to host and/or device memory.
int GetNE() const
Returns number of elements.
Table * GetFaceToElementTable() const
Pointer to an Operator of a specified type.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get().
void EliminateRowsCols(OperatorHandle &A, const Array< int > &ess_dof_list)
Reset the OperatorHandle to be the eliminated part of A after elimination of the essential dofs ess_d...
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
void MakeRAP(OperatorHandle &Rt, OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product R A P, where R = Rt^t.
void ConvertFrom(OperatorHandle &A)
Convert the given OperatorHandle A to the currently set type id.
void MakePtAP(OperatorHandle &A, OperatorHandle &P)
Reset the OperatorHandle to hold the product P^t A P.
void MakeSquareBlockDiag(MPI_Comm comm, HYPRE_BigInt glob_size, HYPRE_BigInt *row_starts, SparseMatrix *diag)
Reset the OperatorHandle to hold a parallel square block-diagonal matrix using the currently set type...
Operator * Ptr() const
Access the underlying Operator pointer.
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
void EliminateBC(const OperatorHandle &A_e, const Array< int > &ess_dof_list, const Vector &X, Vector &B) const
Eliminate essential dofs from the solution X into the r.h.s. B.
Operator::Type Type() const
Get the currently set operator type id.
void MakeRectangularBlockDiag(MPI_Comm comm, HYPRE_BigInt glob_num_rows, HYPRE_BigInt glob_num_cols, HYPRE_BigInt *row_starts, HYPRE_BigInt *col_starts, SparseMatrix *diag)
Reset the OperatorHandle to hold a parallel rectangular block-diagonal matrix using the currently set...
int width
Dimension of the input / number of columns in the matrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
@ DIAG_ONE
Set the diagonal value to one.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
@ Hypre_ParCSR
ID for class HypreParMatrix.
virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x)
Reconstruct a solution vector x (e.g. a GridFunction) from the solution X of a constrained linear sys...
Type GetType() const
Return the type ID of the Operator class.
virtual void AssembleDiagonal(Vector &diag) const
Computes the diagonal entries into diag. Typically, this operation only makes sense for linear Operat...
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 ...
void GetParBlocks(Array2D< HypreParMatrix * > &blocks) const
ParFiniteElementSpace * range_fes
Points to the same object as test_fes.
HypreParMatrix * ParallelAssemble() const
Returns the matrix "assembled" on the true dofs.
ParFiniteElementSpace * domain_fes
Points to the same object as trial_fes.
virtual void FormRectangularSystemMatrix(OperatorHandle &A)
Return in A a parallel (on truedofs) version of this operator.
Abstract parallel finite element space.
HYPRE_BigInt * GetTrueDofOffsets() const
void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const override
HYPRE_BigInt GlobalVSize() const
void ExchangeFaceNbrData()
HYPRE_BigInt GlobalTrueVSize() const
int GetTrueVSize() const override
Return the number of local vector true dofs.
HYPRE_BigInt GetMyDofOffset() const
HYPRE_BigInt * GetDofOffsets() const
const Operator * GetProlongationMatrix() const override
The returned Operator is owned by the FiniteElementSpace.
HypreParMatrix * Dof_TrueDof_Matrix() const
The true dof-to-dof interpolation matrix.
void GetFaceNbrElementVDofs(int i, Array< int > &vdofs, DofTransformation &doftrans) const
const HYPRE_BigInt * GetFaceNbrGlobalDofMap()
int GetFaceNbrVSize() const
const SparseMatrix * GetRestrictionMatrix() const override
Get the R matrix which restricts a local dof vector to true dof vector.
ParMesh * GetParMesh() const
int TrueVSize() const
Obsolete, kept for backward compatibility.
const FiniteElement * GetFaceNbrFE(int i) const
const FiniteElement * GetFE(int i) const override
Table face_nbr_element_dof
Class for parallel grid function.
ParFiniteElementSpace * ParFESpace() const
void ParallelProject(Vector &tv) const
Returns the vector restricted to the true dofs.
void SetSpace(FiniteElementSpace *f) override
Associate a new FiniteElementSpace with the ParGridFunction.
void Distribute(const Vector *tv)
Class for parallel meshes.
int GetNSharedFaces() const
Return the number of shared faces (3D), edges (2D), vertices (1D)
Table * GetFaceToAllElementTable() const
FaceElementTransformations * GetSharedFaceTransformations(int sf, bool fill2=true)
Get the FaceElementTransformations for the given shared face (edge 2D) using the shared face index sf...
virtual void MultTranspose(const Vector &x, Vector &y) const
Multiply a vector with the transposed matrix. y = At * x.
bool Finalized() const
Returns whether or not CSR format has been finalized.
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
real_t * GetData()
Return the element data, i.e. the array A.
int * GetJ()
Return the array J.
virtual int NumNonZeroElems() const
Returns the number of the nonzero elements in the matrix.
int * GetI()
Return the array I.
void Finalize()
Finalize the construction of the Schur complement matrix.
void EliminateReducedTrueDofs(const Array< int > &ess_rtdof_list, Matrix::DiagonalPolicy dpolicy)
Eliminate the given reduced true dofs from the Schur complement matrix S.
void SetEssentialTrueDofs(const Array< int > &ess_tdof_list)
Determine and save internally essential reduced true dofs.
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 ComputeSolution(const Vector &b, const Vector &sc_sol, Vector &sol) const
HypreParMatrix & GetParallelMatrix()
Return the parallel Schur complement matrix.
bool HasEliminatedBC() const
Return true if essential boundary conditions have been eliminated from the Schur complement matrix.
void LoseData()
Call this if data has been stolen.
int Size() const
Returns the number of TYPE I elements.
void SetDims(int rows, int nnz)
void SetSubVector(const Array< int > &dofs, const real_t value)
Set the entries listed in dofs to the given value.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
void SetSubVectorComplement(const Array< int > &dofs, const real_t val)
Set all vector entries NOT in the dofs Array to the given val.
Vector & Add(const real_t a, const Vector &Va)
(*this) += a * Va
MemoryType GetHypreMemoryType()
The MemoryType used by MFEM when allocating arrays for Hypre objects.
void mfem_error(const char *msg)
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
real_t InnerProduct(HypreParVector *x, HypreParVector *y)
void RAP(const DenseMatrix &A, const DenseMatrix &P, DenseMatrix &RAP)
bool IsIdentityProlongation(const Operator *P)
void HypreStealOwnership(HypreParMatrix &A_hyp, SparseMatrix &A_diag)
Make A_hyp steal ownership of its diagonal part A_diag.
Helper struct to convert a C++ type to an MPI type.