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 #ifndef HYPRE_USING_CUDA
1214 for (
int k = 0; k < n; k++)
1216 const int j = ess_tdof_list[k];
1217 Aih->diag->
data[Aih->diag->i[j]] = 0.0;
1221 const int *d_ess_tdof_list =
1223 const int *d_diag_i = Aih->diag->i;
1224 double *d_diag_data = Aih->diag->data;
1225 CuWrap1D(n, [=] MFEM_DEVICE (
int k)
1227 const int j = d_ess_tdof_list[k];
1228 d_diag_data[d_diag_i[j]] = 0.0;
1235 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
1295 if (!RealInteg() && !ImagInteg())
1297 MFEM_ABORT(
"Both Real and Imaginary part of the Sesquilinear form are empty");
1300 if (RealInteg() && ImagInteg())
1306 int n = ess_tdof_list.
Size();
1309 hypre_ParCSRMatrix * Aih = *Ah;
1310 for (
int k = 0; k < n; k++)
1312 int j = ess_tdof_list[k];
1313 Aih->diag->
data[Aih->diag->i[j]] = 0.0;
1319 (mfem::Operator::DiagonalPolicy::DIAG_ZERO);
1358 const int vsize = pfes->
GetVSize();
1359 const int tvsize = X.
Size() / 2;
1363 Vector X_i; X_i.
MakeRef(const_cast<Vector&>(X), tvsize, tvsize);
1380 if ( pblfr ) { pblfr->
Update(nfes); }
1381 if ( pblfi ) { pblfi->
Update(nfes); }
1384 #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. ...
void CuWrap1D(const int N, DBODY &&d_body)
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.