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())),
277 return complex<double>((*lfr)(gf.
real()) - s * (*
lfi)(gf.
imag()),
282 bool SesquilinearForm::RealInteg()
289 bool SesquilinearForm::ImagInteg()
313 diag_policy = dpolicy;
416 MFEM_ASSERT(x.
Size() == 2 * vsize,
"Input GridFunction of incorrect size!");
421 MFEM_ASSERT(b.
Size() == 2 * vsize,
"Input LinearForm of incorrect size!");
452 X_r = X_0; B_r = B_0;
456 X_i = X_0; B_i = B_0;
471 else if (ImagInteg())
477 X_r = X_0; B_i = B_0;
479 b_0 = b_r; b_0 *= -1.0;
481 X_i = X_0; B_r = B_0; B_r *= -1.0;
485 MFEM_ABORT(
"Real and Imaginary part of the Sesquilinear form are empty");
488 if (RealInteg() && ImagInteg())
494 const int n = ess_tdof_list.
Size();
495 auto d_B_r = B_r.
Write();
496 auto d_B_i = B_i.
Write();
497 auto d_X_r = X_r.
Read();
498 auto d_X_i = X_i.
Read();
499 auto d_idx = ess_tdof_list.
Read();
502 const int j = d_idx[i];
507 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
568 mfem::Matrix::DiagonalPolicy::DIAG_ZERO :
572 if (!RealInteg() && !ImagInteg())
574 MFEM_ABORT(
"Both Real and Imaginary part of the Sesquilinear form are empty");
577 if (RealInteg() && ImagInteg())
584 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
629 const int tvsize = X.
Size() / 2;
633 Vector X_i; X_i.
MakeRef(const_cast<Vector&>(X), tvsize, tvsize);
650 if ( blfr ) { blfr->
Update(nfes); }
651 if ( blfi ) { blfi->
Update(nfes); }
658 :
Vector(2*(pfes->GetVSize()))
700 pgfr->
MakeRef(*
this, 0, vsize);
701 pgfi->
MakeRef(*
this, vsize, vsize);
712 pgfr->
MakeRef(*
this, 0, vsize);
713 pgfi->
MakeRef(*
this, vsize, vsize);
796 Vector tvr; tvr.
MakeRef(const_cast<Vector&>(*tv), 0, tvsize);
797 Vector tvi; tvi.
MakeRef(const_cast<Vector&>(*tv), tvsize, tvsize);
832 :
Vector(2*(pfes->GetVSize())),
846 int n = (HYPRE_AssumedPartitionCheck()) ? 2 : pfes->
GetNRanks();
849 for (
int i = 0; i <= n; i++)
861 :
Vector(2*(pfes->GetVSize())),
875 int n = (HYPRE_AssumedPartitionCheck()) ? 2 : pfes->
GetNRanks();
878 for (
int i = 0; i <= n; i++)
1020 return complex<double>((*plfr)(gf.
real()) - s * (*
plfi)(gf.
imag()),
1025 bool ParSesquilinearForm::RealInteg()
1032 bool ParSesquilinearForm::ImagInteg()
1149 const int vsize = pfes->
GetVSize();
1158 MFEM_ASSERT(x.
Size() == 2 * vsize,
"Input GridFunction of incorrect size!");
1163 MFEM_ASSERT(b.
Size() == 2 * vsize,
"Input LinearForm of incorrect size!");
1192 X_r = X_0; B_r = B_0;
1196 X_i = X_0; B_i = B_0;
1209 else if (ImagInteg())
1213 X_r = X_0; B_i = B_0;
1215 b_0 = b_r; b_0 *= -1.0;
1217 X_i = X_0; B_r = B_0; B_r *= -1.0;
1221 MFEM_ABORT(
"Real and Imaginary part of the Sesquilinear form are empty");
1224 if (RealInteg() && ImagInteg())
1227 const int n = ess_tdof_list.
Size();
1228 auto d_B_r = B_r.
Write();
1229 auto d_B_i = B_i.
Write();
1230 auto d_X_r = X_r.
Read();
1231 auto d_X_i = X_i.
Read();
1232 auto d_idx = ess_tdof_list.
Read();
1235 const int j = d_idx[i];
1236 d_B_r[j] = d_X_r[j];
1237 d_B_i[j] = d_X_i[j];
1245 hypre_ParCSRMatrix *Aih = *Ah;
1246 #if !defined(HYPRE_USING_GPU)
1248 for (
int k = 0; k < n; k++)
1250 const int j = ess_tdof_list[k];
1251 Aih->diag->
data[Aih->diag->i[j]] = 0.0;
1255 const int *d_ess_tdof_list =
1257 const int *d_diag_i = Aih->diag->i;
1258 double *d_diag_data = Aih->diag->data;
1259 MFEM_GPU_FORALL(k, n,
1261 const int j = d_ess_tdof_list[k];
1262 d_diag_data[d_diag_i[j]] = 0.0;
1269 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
1329 if (!RealInteg() && !ImagInteg())
1331 MFEM_ABORT(
"Both Real and Imaginary part of the Sesquilinear form are empty");
1334 if (RealInteg() && ImagInteg())
1340 int n = ess_tdof_list.
Size();
1343 hypre_ParCSRMatrix * Aih = *Ah;
1344 for (
int k = 0; k < n; k++)
1346 int j = ess_tdof_list[k];
1347 Aih->diag->
data[Aih->diag->i[j]] = 0.0;
1353 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
1392 const int vsize = pfes->
GetVSize();
1393 const int tvsize = X.
Size() / 2;
1397 Vector X_i; X_i.
MakeRef(const_cast<Vector&>(X), tvsize, tvsize);
1414 if ( pblfr ) { pblfr->
Update(nfes); }
1415 if ( pblfi ) { pblfi->
Update(nfes); }
1418 #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.
Memory< T > & GetMemory()
Return a reference to the Memory object used by the Array.
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)
Device memory; using CUDA or HIP *Malloc and *Free.
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)
const T * HostRead() const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), false).
Pointer to an Operator of a specified type.
Operator::Type Type() const
Get the currently set operator type id.
HYPRE_BigInt GlobalTrueVSize() const
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)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void SyncAliasMemory(const Vector &v) const
Update the alias memory location of the vector to match v.
Alternate convention for damping operators.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
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.
double f(const Vector &xvec)
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual double * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
virtual void ProjectBdrCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff, Array< int > &attr)
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()
void SyncMemory(const Vector &v) const
Update the memory location of the vector to match v.
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)
HYPRE_BigInt * GetTrueDofOffsets() const
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.
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)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
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.
virtual bool UseDevice() const
Return the device flag of the Memory object used by the Vector.
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.
const T * Read(MemoryClass mc, int size) const
Get read-only access to the memory with the given MemoryClass.
virtual const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
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.
ParFiniteElementSpace * ParFESpace() const
void HypreReadWrite()
Update the internal hypre_ParCSRMatrix object, A, to be in hypre memory space.