43 for (
int j = 0; j <
lfis_r.Size(); j++)
130 "ComplexDPGWeakFrom::AddTrialIntegrator: trial fespace index out of bounds");
132 "ComplexDPGWeakFrom::AddTrialIntegrator: test fecol index out of bounds");
150 "ComplexDPGWeakFrom::AdTestIntegrator: test fecol index out of bounds");
167 "ComplexDPGWeakFrom::AddDomainLFIntegrator: test fecol index out of bounds");
184 for (
int i = 0; i<
nblocks; i++)
190 P->
SetBlock(i, i, const_cast<SparseMatrix*>(P_));
191 R->
SetBlock(i, i, const_cast<SparseMatrix*>(R_));
206 for (
int i = 0; i <
nblocks; i++)
208 for (
int j = 0; j <
nblocks; j++)
232 for (
int i = 0; i<
nblocks; i++)
234 for (
int j = 0; j<
nblocks; j++)
262 for (
int i = 0; i <
nblocks; i++)
264 for (
int j = 0; j <
nblocks; j++)
289 for (
int i = 0; i <
nblocks; i++)
291 for (
int j = 0; j <
nblocks; j++)
333 Vector vec_e_r, vec_r, b_r;
334 Vector vec_e_i, vec_i, b_i;
338 for (
int iel = 0; iel <
mesh -> GetNE(); iel++)
354 MFEM_ABORT(
"ComplexDPGWeakForm::Assemble: dim > 3 not supported");
356 int numfaces = faces.
Size();
372 for (
int ie = 0; ie < faces.
Size(); ie++)
375 faces[ie])->GetDof();
403 for (
int k = 0; k <
lfis_r[j]->Size(); k++)
405 (*
lfis_r[j])[k]->AssembleRHSElementVect(test_fe, *eltrans, vec_e_r);
409 for (
int k = 0; k <
lfis_i[j]->Size(); k++)
411 (*
lfis_i[j])[k]->AssembleRHSElementVect(test_fe,*eltrans,vec_e_i);
427 (*
test_integs_r(i,j))[k]->AssembleElementMatrix(test_fe, *eltrans, Ge_r);
431 (*
test_integs_r(i,j))[k]->AssembleElementMatrix2(test_fe_i, test_fe, *eltrans,
442 (*
test_integs_i(i,j))[k]->AssembleElementMatrix(test_fe,*eltrans,Ge_i);
446 (*
test_integs_i(i,j))[k]->AssembleElementMatrix2(test_fe_i,test_fe,*eltrans,
460 int face_dof_offs = 0;
461 for (
int ie = 0; ie < numfaces; ie++)
463 int iface = faces[ie];
466 (*
trial_integs_r(i,j))[k]->AssembleTraceFaceMatrix(iel, tfe, test_fe, *ftr,
468 B_r.
AddSubMatrix(test_offs[j], trial_offs[i]+face_dof_offs, Be_r);
469 face_dof_offs += Be_r.
Width();
475 int face_dof_offs = 0;
476 for (
int ie = 0; ie < numfaces; ie++)
478 int iface = faces[ie];
481 (*
trial_integs_i(i,j))[k]->AssembleTraceFaceMatrix(iel,tfe,test_fe,*ftr,Be_i);
482 B_i.
AddSubMatrix(test_offs[j], trial_offs[i]+face_dof_offs, Be_i);
483 face_dof_offs += Be_i.
Width();
494 (*
trial_integs_r(i,j))[k]->AssembleElementMatrix2(fe,test_fe,*eltrans,Be_r);
500 (*
trial_integs_i(i,j))[k]->AssembleElementMatrix2(fe, test_fe, *eltrans, Be_i);
517 vec.SetVector(vec_i, vec_r.
Size());
543 doftrans_i =
nullptr;
547 for (
int k = 0; k < numfaces; k++)
549 int iface = faces[k];
550 trial_fes[i]->GetFaceVDofs(iface, face_vdofs);
551 vdofs_i.
Append(face_vdofs);
556 doftrans_i =
trial_fes[i]->GetElementVDofs(iel, vdofs_i);
561 doftrans_j =
nullptr;
566 for (
int k = 0; k < numfaces; k++)
568 int iface = faces[k];
569 trial_fes[j]->GetFaceVDofs(iface, face_vdofs);
570 vdofs_j.
Append(face_vdofs);
575 doftrans_j =
trial_fes[j]->GetElementVDofs(iel, vdofs_j);
580 trial_offs[j],trial_offs[j+1], Ae_r);
582 trial_offs[j],trial_offs[j+1], Ae_i);
583 if (doftrans_i || doftrans_j)
590 mfem::out <<
"null matrix " << std::endl;
597 Vector vec1_r(b_r,trial_offs[i],trial_offs[i+1]-trial_offs[i]);
598 Vector vec1_i(b_i,trial_offs[i],trial_offs[i+1]-trial_offs[i]);
633 x_r.SetSubVectorComplement(ess_tdof_list, 0.0);
634 x_i.SetSubVectorComplement(ess_tdof_list, 0.0);
648 for (
int i = 0; i<
nblocks; i++)
655 B_r.SetVector(tmp_r,offset);
656 B_i.SetVector(tmp_i,offset);
669 for (
int i = 0; i<
nblocks; i++)
676 X_r.SetVector(tmp_r,offset);
677 X_i.SetVector(tmp_i,offset);
684 X_r.SetSubVectorComplement(ess_tdof_list, 0.0);
685 X_i.SetSubVectorComplement(ess_tdof_list, 0.0);
707 bool conforming =
true;
708 for (
int i = 0; i<
nblocks; i++)
718 const int remove_zeros = 0;
755 int h = offsets[i+1] - offsets[i];
758 int w = offsets[j+1] - offsets[j];
783 Vector X_r(const_cast<Vector &>(X), 0, X.
Size()/2);
793 for (
int i = 0; i<
nblocks; i++)
800 x_r.SetVector(tmp_r,offset);
801 x_i.SetVector(tmp_i,offset);
849 for (
int k = 0; k <
lfis_r.Size(); k++)
851 for (
int i = 0; i <
lfis_r[k]->Size(); i++)
856 for (
int i = 0; i <
lfis_i[k]->Size(); i++)
871 delete mat;
mat =
nullptr;
874 delete y;
y =
nullptr;
875 delete y_r;
y_r =
nullptr;
876 delete y_i;
y_i =
nullptr;
880 delete P;
P =
nullptr;
881 delete R;
R =
nullptr;
903 for (
int i = 0; i <
Bmat.Size(); i++)
910 for (
int i = 0; i <
Bmat.Size(); i++)
927 "Matrices needed for the residual are not store. Call ComplexDPGWeakForm::StoreMatrices()")
941 for (
int iel = 0; iel <
mesh -> GetNE(); iel++)
957 MFEM_ABORT(
"ComplexDPGWeakForm::ComputeResidual: " 958 "dim > 3 not supported");
960 int numfaces = faces.
Size();
968 for (
int ie = 0; ie < faces.
Size(); ie++)
970 trial_offs[j+1] +=
trial_fes[j]->GetFaceElement(faces[ie])->GetDof();
981 int nn = trial_offs.
Last();
991 for (
int k = 0; k < numfaces; k++)
993 int iface = faces[k];
994 trial_fes[i]->GetFaceVDofs(iface, face_vdofs);
1000 doftrans =
trial_fes[i]->GetElementVDofs(iel, vdofs);
1004 vec1_r.
MakeRef(
u, trial_offs[i], trial_offs[i+1]-trial_offs[i]);
1005 vec1_i.
MakeRef(
u, trial_offs[i]+nn, trial_offs[i+1]-trial_offs[i]);
1017 Bmat[iel]->Mult(
u,v);
1028 delete mat;
mat =
nullptr;
1031 delete y;
y =
nullptr;
1032 delete y_r;
y_r =
nullptr;
1033 delete y_i;
y_i =
nullptr;
Abstract class for all finite elements.
void SetEssentialTrueDofs(const Array< int > &ess_tdof_list)
Determine and save internally essential reduced true dofs.
Class that performs static condensation of interior dofs for multiple FE spaces for complex systems (...
void SetVector(const Vector &v, int offset)
void GetElementEdges(int i, Array< int > &edges, Array< int > &cor) const
Return the indices and the orientations of all edges of element i.
A class to handle Vectors in a block fashion.
void PartMult(const Array< int > &rows, const Vector &x, Vector &y) const
Partial matrix vector multiplication of (*this) with x involving only the rows given by rows...
virtual DenseMatrix & real()
Real or imaginary part accessor methods.
int Dimension() const
Dimension of the reference space used within the elements.
int owns_blocks
If owns_blocks the SparseMatrix objects Aij will be deallocated.
void SyncMemory(const Vector &v) const
Update the memory location of the vector to match v.
void SetSize(int s)
Resize the vector to size s.
Mimic the action of a complex operator using two real operators.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Pointer to an Operator of a specified type.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
int Size() const
Returns the size of the vector.
Data type dense matrix using column-major storage.
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
virtual FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31)
bool HasEliminatedBC() const
void AddSubVector(const Vector &v, int offset)
void SetBlock(int i, int j, SparseMatrix *mat)
Set A(i,j) = mat.
int NumRowBlocks() const
Return the number of row blocks.
virtual void Finalize(int skip_zeros=1)
Finalize all the submatrices.
void GetElementFaces(int i, Array< int > &faces, Array< int > &ori) const
Return the indices and the orientations of all faces of element i.
double * GetData() const
Returns the matrix data array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
void ReduceSystem(Vector &x, 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...
virtual void MultTranspose(const Vector &x, Vector &y) const
MatrixTranspose-Vector Multiplication y = A'*x.
void GetElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of element i.
int NumColBlocks() const
Return the number of column blocks.
Set the diagonal value to one.
void AddElementVector(const Array< int > &dofs, const Vector &elemvect)
Add elements of the elemvect Vector to the entries listed in dofs. Negative dof values cause the -dof...
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
double * GetData() const
Return a pointer to the beginning of the Vector data.
void ComputeSolution(const Vector &sc_sol, Vector &sol) const
ComplexDenseMatrix * MultAtB(const ComplexDenseMatrix &A, const ComplexDenseMatrix &B)
Multiply the complex conjugate transpose of a matrix A with a matrix B. A^H*B.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void PartialSum()
Fill the entries of the array with the cumulative sum of the entries.
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
void AssembleReducedSystem(int el, ComplexDenseMatrix &elmat, Vector &elvect_r, Vector &elvect_i)
virtual void Mult(const Vector &x, Vector &y) const
Matrix-Vector Multiplication y = A*x.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int GetNE() const
Returns number of elements.
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
void GetSubMatrix(const Array< int > &idx, DenseMatrix &A) const
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
ComplexOperator & GetSchurComplexOperator()
SparseMatrix & GetBlock(int i, int j)
Return a reference to block (i,j). Reference may be invalid if Aij(i,j) == NULL.
void Finalize(int skip_zeros=0)
Finalize the construction of the Schur complement matrix.
double Norml2() const
Returns the l2 norm of the vector.
virtual void AddMult(const Vector &x, Vector &y, const double val=1.) const
Matrix-Vector Multiplication y = y + val*A*x.
int Size() const
Return the logical size of the array.
T & Last()
Return the last element in the array.
void MakeRef(T *, int)
Make this Array a reference to a pointer.
void FormSystemMatrix(Operator::DiagonalPolicy diag_policy)
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
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 TransformDual(const DofTransformation *ran_dof_trans, const DofTransformation *dom_dof_trans, DenseMatrix &elmat)
double u(const Vector &xvec)
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual DenseMatrix & imag()
void EliminateRowCols(const Array< int > &vdofs, BlockMatrix *Ae, DiagonalPolicy dpolicy=DIAG_ONE)
Eliminate the rows and columns corresponding to the entries in vdofs + save the eliminated entries in...
void AddSubMatrix(const Array< int > &idx, const DenseMatrix &A)
(*this)(idx[i],idx[j]) += A(i,j)
Specialization of the ComplexOperator built from a pair of Dense Matrices. The purpose of this specia...
int IsZeroBlock(int i, int j) const
Check if block (i,j) is a zero block.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
Vector & GetBlock(int i)
Get the i-th vector in the block.