13 #include "../general/forall.hpp"
21 :
Vector(2*(fes->GetVSize()))
66 gfi->
MakeRef(*
this, vsize, vsize);
78 gfi->
MakeRef(*
this, vsize, vsize);
155 :
Vector(2*(fes->GetVSize())),
171 :
Vector(2*(fes->GetVSize())),
268 return complex<double>((*lfr)(gf.
real()) - s * (*
lfi)(gf.
imag()),
273 bool SesquilinearForm::RealInteg()
280 bool SesquilinearForm::ImagInteg()
304 diag_policy = dpolicy;
399 MFEM_ASSERT(x.
Size() == 2 * vsize,
"Input GridFunction of incorrect size!");
404 MFEM_ASSERT(b.
Size() == 2 * vsize,
"Input LinearForm of incorrect size!");
435 X_r = X_0; B_r = B_0;
439 X_i = X_0; B_i = B_0;
454 else if (ImagInteg())
460 X_r = X_0; B_i = B_0;
462 b_0 = b_r; b_0 *= -1.0;
464 X_i = X_0; B_r = B_0; B_r *= -1.0;
468 MFEM_ABORT(
"Real and Imaginary part of the Sesquilinear form are empty");
471 if (RealInteg() && ImagInteg())
477 const int n = ess_tdof_list.
Size();
478 auto d_B_r = B_r.
Write();
479 auto d_B_i = B_i.
Write();
480 auto d_X_r = X_r.
Read();
481 auto d_X_i = X_i.
Read();
482 auto d_idx = ess_tdof_list.
Read();
485 const int j = d_idx[i];
490 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
551 mfem::Matrix::DiagonalPolicy::DIAG_ZERO :
555 if (!RealInteg() && !ImagInteg())
557 MFEM_ABORT(
"Both Real and Imaginary part of the Sesquilinear form are empty");
560 if (RealInteg() && ImagInteg())
567 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
612 const int tvsize = X.
Size() / 2;
616 Vector X_i; X_i.
MakeRef(const_cast<Vector&>(X), tvsize, tvsize);
633 if ( blfr ) { blfr->
Update(nfes); }
634 if ( blfi ) { blfi->
Update(nfes); }
641 :
Vector(2*(pfes->GetVSize()))
683 pgfr->
MakeRef(*
this, 0, vsize);
684 pgfi->
MakeRef(*
this, vsize, vsize);
695 pgfr->
MakeRef(*
this, 0, vsize);
696 pgfi->
MakeRef(*
this, vsize, vsize);
779 Vector tvr; tvr.
MakeRef(const_cast<Vector&>(*tv), 0, tvsize);
780 Vector tvi; tvi.
MakeRef(const_cast<Vector&>(*tv), tvsize, tvsize);
815 :
Vector(2*(pfes->GetVSize())),
829 int n = (HYPRE_AssumedPartitionCheck()) ? 2 : pfes->
GetNRanks();
832 for (
int i = 0; i <= n; i++)
844 :
Vector(2*(pfes->GetVSize())),
858 int n = (HYPRE_AssumedPartitionCheck()) ? 2 : pfes->
GetNRanks();
861 for (
int i = 0; i <= n; i++)
994 return complex<double>((*plfr)(gf.
real()) - s * (*
plfi)(gf.
imag()),
999 bool ParSesquilinearForm::RealInteg()
1006 bool ParSesquilinearForm::ImagInteg()
1115 const int vsize = pfes->
GetVSize();
1124 MFEM_ASSERT(x.
Size() == 2 * vsize,
"Input GridFunction of incorrect size!");
1129 MFEM_ASSERT(b.
Size() == 2 * vsize,
"Input LinearForm of incorrect size!");
1158 X_r = X_0; B_r = B_0;
1162 X_i = X_0; B_i = B_0;
1175 else if (ImagInteg())
1179 X_r = X_0; B_i = B_0;
1181 b_0 = b_r; b_0 *= -1.0;
1183 X_i = X_0; B_r = B_0; B_r *= -1.0;
1187 MFEM_ABORT(
"Real and Imaginary part of the Sesquilinear form are empty");
1190 if (RealInteg() && ImagInteg())
1193 const int n = ess_tdof_list.
Size();
1194 auto d_B_r = B_r.
Write();
1195 auto d_B_i = B_i.
Write();
1196 auto d_X_r = X_r.
Read();
1197 auto d_X_i = X_i.
Read();
1198 auto d_idx = ess_tdof_list.
Read();
1201 const int j = d_idx[i];
1202 d_B_r[j] = d_X_r[j];
1203 d_B_i[j] = d_X_i[j];
1211 hypre_ParCSRMatrix *Aih = *Ah;
1212 for (
int k = 0; k < n; k++)
1214 const int j = ess_tdof_list[k];
1215 Aih->diag->
data[Aih->diag->i[j]] = 0.0;
1221 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
1281 if (!RealInteg() && !ImagInteg())
1283 MFEM_ABORT(
"Both Real and Imaginary part of the Sesquilinear form are empty");
1286 if (RealInteg() && ImagInteg())
1292 int n = ess_tdof_list.
Size();
1295 hypre_ParCSRMatrix * Aih = *Ah;
1296 for (
int k = 0; k < n; k++)
1298 int j = ess_tdof_list[k];
1299 Aih->diag->
data[Aih->diag->i[j]] = 0.0;
1305 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
1344 const int vsize = pfes->
GetVSize();
1345 const int tvsize = X.
Size() / 2;
1349 Vector X_i; X_i.
MakeRef(const_cast<Vector&>(X), tvsize, tvsize);
1366 if ( pblfr ) { pblfr->
Update(nfes); }
1367 if ( pblfi ) { pblfi->
Update(nfes); }
1370 #endif // MFEM_USE_MPI
int Size() const
Return the logical size of the array.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
Class for grid function - Vector with associated FE space.
const SparseMatrix * GetConformingProlongation() const
The returned SparseMatrix is owned by the FiniteElementSpace.
Base class for vector Coefficients that optionally depend on time and space.
virtual void ProjectBdrCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff, Array< int > &attr)
void SyncMemory(const Vector &v)
Update the memory location of the vector to match v.
virtual const Operator * GetProlongationMatrix() const
The returned Operator is owned by the FiniteElementSpace.
void SetSize(int s)
Resize the vector to size s.
Mimic the action of a complex operator using two real operators.
virtual void ProjectCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff)
Pointer to an Operator of a specified type.
Operator::Type Type() const
Get the currently set operator type id.
void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
int Size() const
Returns the size of the vector.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
Abstract parallel finite element space.
virtual void ProjectCoefficient(Coefficient &coeff)
double * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
Alternate convention for damping operators.
virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
virtual int GetTrueVSize() const
Return the number of local vector true dofs.
Vector & operator=(const double *v)
Copy Size() entries from v.
virtual void MakeRef(FiniteElementSpace *f, double *v)
Make the ParGridFunction reference external data on a new FiniteElementSpace.
ID for class SparseMatrix.
void ProjectBdrCoefficientNormal(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
OpType * Is() const
Return the Operator pointer dynamically cast to a specified OpType.
bool UseDevice() const
Return the device flag of the Memory object used by the Vector.
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual void ProjectBdrCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff, Array< int > &attr)
HYPRE_Int GlobalTrueVSize() const
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
virtual void MakeRef(FiniteElementSpace *f, double *v)
Make the GridFunction reference external data on a new FiniteElementSpace.
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
FiniteElementSpace * FESpace()
Operator * Ptr() const
Access the underlying Operator pointer.
Memory< T > data
Pointer to data.
Wrapper for hypre's parallel vector class.
void Distribute(const Vector *tv)
virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
Specialization of the ComplexOperator built from a pair of Sparse Matrices.
void ProjectBdrCoefficient(Coefficient *coeff[], VectorCoefficient *vcoeff, Array< int > &attr)
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
bool OwnsOperator() const
Return true if the OperatorHandle owns the held Operator.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged...
void Distribute(const Vector *tv)
ParComplexGridFunction(ParFiniteElementSpace *pf)
Construct a ParComplexGridFunction associated with the ParFiniteElementSpace *pf. ...
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
Project the tangential components of the given VectorCoefficient on the boundary. Only boundary attri...
Specialization of the ComplexOperator built from a pair of HypreParMatrices.
Native convention for Hermitian operators.
const Operator * GetUpdateOperator()
Get the GridFunction update operator.
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
Project the tangential components of the given VectorCoefficient on the boundary. Only boundary attri...
virtual void ProjectCoefficient(Coefficient &coeff)
HYPRE_Int * GetTrueDofOffsets() const
void Get(OpType *&A) const
Return the Operator pointer statically cast to a given OpType.
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
ID for class HypreParMatrix.
Class for parallel grid function.
void ParallelProject(Vector &tv) const
Returns the vector restricted to the true dofs.
Square Operator for imposing essential boundary conditions using only the action, Mult()...
Wrapper for hypre's ParCSR matrix class.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
virtual void ProjectCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff)
void ProjectBdrCoefficient(Coefficient &coeff, Array< int > &attr)
Project a Coefficient on the GridFunction, modifying only DOFs on the boundary associated with the bo...
void ParallelProject(Vector &tv) const
Returns the vector restricted to the true dofs.
double f(const Vector &p)
ParFiniteElementSpace * ParFESpace() const
void SyncAliasMemory(const Vector &v)
Update the alias memory location of the vector to match v.