22 :
Vector(2*(
f->GetVSize())), fes(
f), fec_owned(NULL)
37 :
Vector(), fes(NULL), fec_owned(NULL)
47 if (buff !=
"ComplexGridFunction")
49 MFEM_ABORT(
"unrecognized file header: " << buff);
56 istream::int_type next_char = input.peek();
61 if (buff ==
"NURBS_patches")
63 MFEM_ABORT(
"NURBS not yet supported with ComplexGridFunction objects");
67 MFEM_ABORT(
"unknown section: " << buff);
79 MFEM_ABORT(
"LegacyNCReorder not supported for "
80 "ComplexGridFunction objects");
95 delete gfr;
delete gfi;
143 gfi->
MakeRef(*
this, vsize, vsize);
155 gfi->
MakeRef(*
this, vsize, vsize);
242 os <<
"ComplexGridFunction\n";
259 ofs.precision(precision);
272 :
Vector(2*(fes->GetVSize())),
288 :
Vector(2*(fes->GetVSize())),
399bool SesquilinearForm::RealInteg()
406bool SesquilinearForm::ImagInteg()
430 diag_policy = dpolicy;
533 MFEM_ASSERT(x.
Size() == 2 * vsize,
"Input GridFunction of incorrect size!");
538 MFEM_ASSERT(
b.Size() == 2 * vsize,
"Input LinearForm of incorrect size!");
569 X_r = X_0; B_r = B_0;
573 X_i = X_0; B_i = B_0;
588 else if (ImagInteg())
594 X_r = X_0; B_i = B_0;
596 b_0 = b_r; b_0 *= -1.0;
598 X_i = X_0; B_r = B_0; B_r *= -1.0;
602 MFEM_ABORT(
"Real and Imaginary part of the Sesquilinear form are empty");
605 if (RealInteg() && ImagInteg())
611 const int n = ess_tdof_list.
Size();
612 auto d_B_r = B_r.
Write();
613 auto d_B_i = B_i.
Write();
614 auto d_X_r = X_r.
Read();
615 auto d_X_i = X_i.
Read();
616 auto d_idx = ess_tdof_list.
Read();
619 const int j = d_idx[i];
689 if (!RealInteg() && !ImagInteg())
691 MFEM_ABORT(
"Both Real and Imaginary part of the Sesquilinear form are empty");
694 if (RealInteg() && ImagInteg())
746 const int tvsize = X.
Size() / 2;
767 if ( blfr ) { blfr->
Update(nfes); }
768 if ( blfi ) { blfi->
Update(nfes); }
775 :
Vector(2*(pf->GetVSize())), pfes(pf), fec_owned(NULL)
790 :
Vector(), pfes(NULL), fec_owned(NULL)
798 getline(input, buff);
800 if (buff !=
"ParComplexGridFunction")
802 MFEM_ABORT(
"unrecognized file header: " << buff);
814 istream::int_type next_char = input.peek();
815 if (next_char ==
'N')
817 getline(input, buff);
819 if (buff ==
"NURBS_patches")
821 MFEM_ABORT(
"NURBS not yet supported with ComplexGridFunction objects");
825 MFEM_ABORT(
"unknown section: " << buff);
834 for (
int i = 0; i < vsize; i++)
838 data_[i] = -data_[i];
839 data_[i+vsize] = -data_[i+vsize];
849 MFEM_ABORT(
"LegacyNCReorder not supported for "
850 "ComplexGridFunction objects");
865 delete pgfr;
delete pgfi;
910 pgfr->
MakeRef(*
this, 0, vsize);
911 pgfi->
MakeRef(*
this, vsize, vsize);
922 pgfr->
MakeRef(*
this, 0, vsize);
923 pgfi->
MakeRef(*
this, vsize, vsize);
1049 os <<
"ParComplexGridFunction\n";
1055 for (
int i = 0; i < vsize; i++)
1059 data_[i] = -data_[i];
1060 data_[i+vsize] = -data_[i+vsize];
1073 for (
int i = 0; i < vsize; i++)
1077 data_[i] = -data_[i];
1078 data_[i+vsize] = -data_[i+vsize];
1088 ostringstream fname_with_suffix;
1089 fname_with_suffix << fname <<
"." << setfill(
'0') << setw(6) << rank;
1090 ofstream ofs(fname_with_suffix.str().c_str());
1091 ofs.precision(precision);
1105 :
Vector(2*(pfes->GetVSize())),
1119 int n = (HYPRE_AssumedPartitionCheck()) ? 2 : pfes->
GetNRanks();
1122 for (
int i = 0; i <= n; i++)
1134 :
Vector(2*(pfes->GetVSize())),
1148 int n = (HYPRE_AssumedPartitionCheck()) ? 2 : pfes->
GetNRanks();
1151 for (
int i = 0; i <= n; i++)
1298bool ParSesquilinearForm::RealInteg()
1305bool ParSesquilinearForm::ImagInteg()
1422 const int vsize = pfes->
GetVSize();
1431 MFEM_ASSERT(x.
Size() == 2 * vsize,
"Input GridFunction of incorrect size!");
1436 MFEM_ASSERT(
b.Size() == 2 * vsize,
"Input LinearForm of incorrect size!");
1465 X_r = X_0; B_r = B_0;
1469 X_i = X_0; B_i = B_0;
1482 else if (ImagInteg())
1486 X_r = X_0; B_i = B_0;
1488 b_0 = b_r; b_0 *= -1.0;
1490 X_i = X_0; B_r = B_0; B_r *= -1.0;
1494 MFEM_ABORT(
"Real and Imaginary part of the Sesquilinear form are empty");
1497 if (RealInteg() && ImagInteg())
1500 const int n = ess_tdof_list.
Size();
1501 auto d_B_r = B_r.
Write();
1502 auto d_B_i = B_i.
Write();
1503 auto d_X_r = X_r.
Read();
1504 auto d_X_i = X_i.
Read();
1505 auto d_idx = ess_tdof_list.
Read();
1508 const int j = d_idx[i];
1509 d_B_r[j] = d_X_r[j];
1510 d_B_i[j] = d_X_i[j];
1518 hypre_ParCSRMatrix *Aih = *Ah;
1520 const int *d_ess_tdof_list =
1522 HYPRE_Int *d_diag_i = Aih->diag->i;
1523 real_t *d_diag_data = Aih->diag->data;
1526 const int j = d_ess_tdof_list[k];
1527 d_diag_data[d_diag_i[j]] = 0.0;
1593 if (!RealInteg() && !ImagInteg())
1595 MFEM_ABORT(
"Both Real and Imaginary part of the Sesquilinear form are empty");
1598 if (RealInteg() && ImagInteg())
1604 int n = ess_tdof_list.
Size();
1607 hypre_ParCSRMatrix * Aih = *Ah;
1608 for (
int k = 0; k < n; k++)
1610 int j = ess_tdof_list[k];
1611 Aih->diag->
data[Aih->diag->i[j]] = 0.0;
1656 const int vsize = pfes->
GetVSize();
1657 const int tvsize = X.
Size() / 2;
1678 if ( pblfr ) { pblfr->
Update(nfes); }
1679 if ( pblfi ) { pblfi->
Update(nfes); }
Memory< T > & GetMemory()
Return a reference to the Memory object used by the Array.
int Size() const
Return the logical size of the array.
Memory< T > data
Pointer to data.
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
virtual void ProjectBdrCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff, Array< int > &attr)
virtual void ProjectCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff)
FiniteElementCollection * fec_owned
Used when the grid function is read from a file. It can also be set explicitly, see MakeOwner().
virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
ComplexGridFunction(FiniteElementSpace *f)
Construct a ComplexGridFunction associated with the FiniteElementSpace *f.
virtual void Save(std::ostream &out) const
Save the ComplexGridFunction to an output stream.
Specialization of the ComplexOperator built from a pair of HypreParMatrices.
Mimic the action of a complex operator using two real operators.
@ HERMITIAN
Native convention for Hermitian operators.
@ BLOCK_SYMMETRIC
Alternate convention for damping operators.
Specialization of the ComplexOperator built from a pair of Sparse Matrices.
Square Operator for imposing essential boundary conditions using only the action, Mult(),...
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void Save(std::ostream &out) const
Save finite element space to output stream out.
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
bool Nonconforming() const
FiniteElementCollection * Load(Mesh *m, std::istream &input)
Read a FiniteElementSpace from a stream. The returned FiniteElementCollection is owned by the caller.
Ordering::Type GetOrdering() const
Return the ordering method.
const SparseMatrix * GetConformingProlongation() 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 the vector dimension of the finite element space.
const FiniteElement * GetTypicalFE() const
Return GetFE(0) if the local mesh is not empty; otherwise return a typical FE based on the Geometry t...
const Operator * GetUpdateOperator()
Get the GridFunction update operator.
Abstract class for all finite elements.
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
Class for grid function - Vector with associated FE space.
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual void MakeRef(FiniteElementSpace *f, real_t *v)
Make the GridFunction reference external data on a new FiniteElementSpace.
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, const 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 ProjectBdrCoefficientNormal(VectorCoefficient &vcoeff, const Array< int > &bdr_attr)
void ProjectBdrCoefficient(Coefficient &coeff, const Array< int > &attr)
Project a Coefficient on the GridFunction, modifying only DOFs on the boundary associated with the bo...
Wrapper for hypre's ParCSR matrix class.
void HypreReadWrite()
Update the internal hypre_ParCSRMatrix object, A, to be in hypre memory space.
Wrapper for hypre's parallel vector class.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
NCMesh * ncmesh
Optional nonconforming mesh extension.
bool IsLegacyLoaded() const
I/O: Return true if the mesh was loaded from the legacy v1.1 format.
Pointer to an Operator of a specified type.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get().
bool OwnsOperator() const
Return true if the OperatorHandle owns the held Operator.
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
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 Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
OpType * Is() const
Return the Operator pointer dynamically cast to a specified OpType.
Operator::Type Type() const
Get the currently set operator type id.
void Get(OpType *&A) const
Return the Operator pointer statically cast to a given OpType.
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.
@ DIAG_ZERO
Set the diagonal value to zero.
@ MFEM_SPARSEMAT
ID for class SparseMatrix.
@ Hypre_ParCSR
ID for class HypreParMatrix.
virtual void ProjectBdrCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff, Array< int > &attr)
FiniteElementCollection * fec_owned
Used when the grid function is read from a file. It can also be set explicitly, see MakeOwner().
void ParallelProject(Vector &tv) const
Returns the vector restricted to the true dofs.
ParComplexGridFunction(ParFiniteElementSpace *pf)
Construct a ParComplexGridFunction associated with the ParFiniteElementSpace *pf.
virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
ParFiniteElementSpace * pfes
void Distribute(const Vector *tv)
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
virtual void ProjectCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff)
void Save(std::ostream &out) const
Save the local portion of the ParComplexGridFunction.
Abstract parallel finite element space.
HYPRE_BigInt * GetTrueDofOffsets() const
HYPRE_BigInt GlobalTrueVSize() const
int GetTrueVSize() const override
Return the number of local vector true dofs.
bool Nonconforming() const
const Operator * GetProlongationMatrix() const override
Class for parallel grid function.
void ProjectBdrCoefficient(Coefficient *coeff[], VectorCoefficient *vcoeff, const Array< int > &attr)
void MakeRef(FiniteElementSpace *f, real_t *v) override
Make the ParGridFunction reference external data on a new FiniteElementSpace.
void ProjectCoefficient(Coefficient &coeff) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void ParallelProject(Vector &tv) const
Returns the vector restricted to the true dofs.
void Update() override
Transform by the Space UpdateMatrix (e.g., on Mesh change).
void Distribute(const Vector *tv)
void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, const Array< int > &bdr_attr) override
Project the tangential components of the given VectorCoefficient on the boundary. Only boundary attri...
Class for parallel meshes.
void Mult(const Vector &x, Vector &y) const override
Matrix vector multiplication.
Base class for vector Coefficients that optionally depend on time and space.
virtual const real_t * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
void Print(std::ostream &out=mfem::out, int width=8) const
Prints vector to stream out.
void SyncAliasMemory(const Vector &v) const
Update the alias memory location of the vector to match v.
void SyncMemory(const Vector &v) const
Update the memory location of the vector to match v.
void Load(std::istream **in, int np, int *dim)
Reads a vector from multiple files.
virtual bool UseDevice() const
Return the device flag of the Memory object used by the Vector.
int Size() const
Returns the size of the vector.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
void SetSize(int s)
Resize the vector to size s.
Vector & operator=(const real_t *v)
Copy Size() entries from v.
virtual real_t * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
std::ostream & operator<<(std::ostream &os, SparseMatrix const &mat)
MemoryClass GetHypreForallMemoryClass()
void filter_dos(std::string &line)
Check for, and remove, a trailing '\r' from and std::string.
void hypre_forall(int N, lambda &&body)
std::function< real_t(const Vector &)> f(real_t mass_coeff)
void forall(int N, lambda &&body)
void skip_comment_lines(std::istream &is, const char comment_char)
Check if the stream starts with comment_char. If so skip it.