45 const int NE = fes->
GetNE();
47 for (
int i = 0; i < NE; i++)
53 for (
int i = 0; i < NE; i++)
56 const int nsd = vdofs.
Size()/vdim;
58 const int *dofs = vdofs.
GetData();
59 for (
int vd = 0; vd < vdim; vd++)
62 for (
int j = 0; j < nspd; j++)
64 MFEM_ASSERT(dofs[nsd-nspd+j] >= 0,
"");
75 "incompatible volume and trace FE spaces");
79 for (
int i = 0; i < NE; i++)
83 const int nsd = vdofs.
Size()/vdim;
84 const int nsrd = rvdofs.
Size()/vdim;
85 for (
int vd = 0; vd < vdim; vd++)
87 for (
int j = 0; j < nsrd; j++)
89 int rvdof = rvdofs[j+nsrd*vd];
90 int vdof = vdofs[j+nsd*vd];
96 MFEM_ASSERT(vdof >= 0,
"incompatible volume and trace FE spaces");
97 rdof_edof[rvdof] = vdof;
134 const int NE = fes->
GetNE();
138 A_offsets[0] = A_ipiv_offsets[0] = 0;
140 for (
int i = 0; i < NE; i++)
143 const int ned = rvdofs.
Size();
144 const int npd = elem_pdof.
RowSize(i);
145 A_offsets[i+1] = A_offsets[i] + npd*(npd + (symm ? 1 : 2)*ned);
146 A_ipiv_offsets[i+1] = A_ipiv_offsets[i] + npd;
150 const int nedofs = tr_fes->
GetVSize();
156 Table elem_rdof, rdof_elem;
158 for (
int i = 0; i < NE; i++)
164 for (
int i = 0; i < NE; i++)
175 nedofs, nedofs,
true,
false,
false);
191 const int vdim = fes->
GetVDim();
192 const int nvpd = elem_pdof.
RowSize(el);
193 const int nved = rvdofs.
Size();
194 DenseMatrix A_pp(A_data + A_offsets[el], nvpd, nvpd);
197 if (symm) { A_ep.
SetSize(nved, nvpd); }
201 const int npd = nvpd/vdim;
202 const int ned = nved/vdim;
203 const int nd = npd + ned;
205 for (
int i = 0; i < vdim; i++)
207 for (
int j = 0; j < vdim; j++)
209 A_pp.
CopyMN(elmat, npd, npd, i*nd+ned, j*nd+ned, i*npd, j*npd);
210 A_pe.
CopyMN(elmat, npd, ned, i*nd+ned, j*nd, i*npd, j*ned);
211 A_ep.
CopyMN(elmat, ned, npd, i*nd, j*nd+ned, i*ned, j*npd);
212 A_ee.
CopyMN(elmat, ned, ned, i*nd, j*nd, i*ned, j*ned);
221 const int skip_zeros = 0;
229 const int skip_zeros = 0;
235 const int skip_zeros = 0;
239 if (S_e) { S_e->
Finalize(skip_zeros); }
262 if (S_e) { S_e->
Finalize(skip_zeros); }
289 if (!Parallel() || S)
295 for (
int i = 0; i < ess_rtdof_list_.
Size(); i++)
303 MFEM_ASSERT(pS_e.
Ptr() == NULL,
"essential b.c. already eliminated");
313 MFEM_ASSERT(
b.Size() == fes->
GetVSize(),
"'b' has incorrect size");
315 const int NE = fes->
GetNE();
316 const int nedofs = tr_fes->
GetVSize();
328 for (
int i = 0; i < nedofs; i++)
330 b_r(i) =
b(rdof_edof[i]);
336 for (
int i = 0; i < NE; i++)
339 const int ned = rvdofs.
Size();
340 const int *rd = rvdofs.
GetData();
341 const int npd = elem_pdof.
RowSize(i);
342 const int *pd = elem_pdof.
GetRow(i);
345 for (
int j = 0; j < npd; j++)
351 const_cast<int*
>((
const int*)A_ipiv) + A_ipiv_offsets[i]);
363 L_ep.
Mult(b_p, b_ep);
365 for (
int j = 0; j < ned; j++)
367 if (rd[j] >= 0) { b_r(rd[j]) -= b_ep(j); }
368 else { b_r(-1-rd[j]) += b_ep(j); }
391 MFEM_ASSERT(sol.
Size() == fes->
GetVSize(),
"'sol' has incorrect size");
393 const int nedofs = tr_fes->
GetVSize();
405 for (
int i = 0; i < nedofs; i++)
407 sol_r(i) = sol(rdof_edof[i]);
412 tr_R->
Mult(sol_r, sc_sol);
417 Vector &B,
int copy_interior)
const
429 MFEM_ASSERT(pS.
Type() == pS_e.
Type(),
"type id mismatch");
442 const int nedofs = tr_fes->
GetVSize();
447 ess_dof_marker.
MakeRef(ess_tdof_marker);
458 ess_rtdof_marker.
SetSize(nedofs);
459 ess_rdof_marker.
MakeRef(ess_rtdof_marker);
463 ess_rdof_marker.
SetSize(nedofs);
465 for (
int i = 0; i < nedofs; i++)
467 ess_rdof_marker[i] = ess_dof_marker[rdof_edof[i]];
472 tr_R->
BooleanMult(ess_rdof_marker, ess_rtdof_marker);
482 MFEM_ASSERT(
b.Size() == fes->
GetVSize(),
"'b' has incorrect size");
484 const int nedofs = tr_fes->
GetVSize();
496 tr_cP->
Mult(sc_sol, sol_r);
507 for (
int i = 0; i < nedofs; i++)
509 sol(rdof_edof[i]) = sol_r(i);
511 const int NE = fes->
GetNE();
514 for (
int i = 0; i < NE; i++)
517 const int ned = rvdofs.
Size();
518 const int npd = elem_pdof.
RowSize(i);
519 const int *pd = elem_pdof.
GetRow(i);
522 for (
int j = 0; j < npd; j++)
529 const_cast<int*
>((
const int*)A_ipiv) + A_ipiv_offsets[i]);
534 for (
int j = 0; j < npd; j++)
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
void MakeRef(T *data_, int size_, bool own_data=false)
Make this Array a reference to a pointer.
T * GetData()
Returns the data.
Data type dense matrix using column-major storage.
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
void MultTranspose(const real_t *x, real_t *y) const
Multiply a vector with the transpose matrix.
real_t * Data() const
Returns the matrix data array.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
void CopyMN(const DenseMatrix &A, int m, int n, int Aro, int Aco)
Copy the m x n submatrix of A at row/col offsets Aro/Aco to *this.
void UseExternalData(real_t *d, int h, int w)
Change the data array and the size of the DenseMatrix.
virtual FiniteElementCollection * GetTraceCollection() const
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
int GetNumElementInteriorDofs(int i) const
Returns the number of degrees of freedom associated with the interior of the specified element.
virtual const SparseMatrix * GetRestrictionMatrix() const
The returned SparseMatrix is owned by the FiniteElementSpace.
static void AdjustVDofs(Array< int > &vdofs)
Remove the orientation information encoded into an array of dofs Some basis function types have a rel...
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.
int GetNE() const
Returns number of elements in the mesh.
const SparseMatrix * GetConformingProlongation() const
The returned SparseMatrix is owned by the FiniteElementSpace.
const FiniteElementCollection * FEColl() const
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.
DofTransformation * GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for i'th boundary element. The returned indices are offsets int...
void LSolve(int m, int n, real_t *X) const
virtual bool Factor(int m, real_t TOL=0.0)
Compute the LU factorization of the current matrix.
void BlockFactor(int m, int n, real_t *A12, real_t *A21, real_t *A22) const
void BlockBackSolve(int m, int n, int r, const real_t *U12, const real_t *X2, real_t *Y1) const
Class used by MFEM to store pointers to host and/or device memory.
void Delete()
Delete the owned pointers and reset the Memory object.
Pointer to an Operator of a specified type.
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 ConvertFrom(OperatorHandle &A)
Convert the given OperatorHandle A to the currently set type id.
void SetType(Operator::Type tid)
Invoke Clear() and set a new 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 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.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
@ Hypre_ParCSR
ID for class HypreParMatrix.
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 ...
Abstract parallel finite element space.
HYPRE_BigInt GlobalVSize() const
HYPRE_BigInt GlobalTrueVSize() 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.
ParMesh * GetParMesh() const
virtual void MultTranspose(const Vector &x, Vector &y) const
Multiply a vector with the transposed matrix. y = At * x.
void PartMult(const Array< int > &rows, const Vector &x, Vector &y) const
void EliminateRowCol(int rc, const real_t sol, Vector &rhs, DiagonalPolicy dpolicy=DIAG_ONE)
Eliminate row rc and column rc and modify the rhs using sol.
void BooleanMultTranspose(const Array< int > &x, Array< int > &y) const
y = At * x, treating all entries as booleans (zero=false, nonzero=true).
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
void BooleanMult(const Array< int > &x, Array< int > &y) const
y = A * x, treating all entries as booleans (zero=false, nonzero=true).
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
virtual void Finalize(int skip_zeros=1)
Finalize the matrix initialization, switching the storage format from LIL to CSR.
virtual void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const
y += A * x (default) or y += a * A * x
void AssembleMatrix(int el, const DenseMatrix &elmat)
StaticCondensation(FiniteElementSpace *fespace)
Construct a StaticCondensation object.
void AssembleBdrMatrix(int el, const DenseMatrix &elmat)
void Finalize()
Finalize the construction of the Schur complement matrix.
void ConvertMarkerToReducedTrueDofs(const Array< int > &ess_tdof_marker, Array< int > &ess_rtdof_marker) const
void EliminateReducedTrueDofs(const Array< int > &ess_rtdof_list, Matrix::DiagonalPolicy dpolicy)
Eliminate the given reduced true dofs from the Schur complement matrix S.
bool ReducesTrueVSize() const
void Init(bool symmetric, bool block_diagonal)
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
void ReduceRHS(const Vector &b, Vector &sc_b) const
~StaticCondensation()
Destroy a StaticCondensation object.
void ReduceSolution(const Vector &sol, Vector &sc_sol) const
void LoseData()
Call this if data has been stolen.
void AddConnections(int r, const int *c, int nc)
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
void MakeI(int nrows)
Next 7 methods are used together with the default constructor.
int Size_of_connections() const
void AddColumnsInRow(int r, int ncol)
void SetDataAndSize(real_t *d, int s)
Set the Vector data and size.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
void SetSubVectorComplement(const Array< int > &dofs, const real_t val)
Set all vector entries NOT in the dofs Array to the given val.
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
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.
void RAP(const DenseMatrix &A, const DenseMatrix &P, DenseMatrix &RAP)