12#ifndef MFEM_COMPLEX_FEM
13#define MFEM_COMPLEX_FEM
106 { *gfr = value.real(); *gfi = value.imag();
return *
this; }
150 return sqrt(err_r * err_r + err_i * err_i);
166 return sqrt(err_r * err_r + err_i * err_i);
239 virtual void Save(std::ostream &
out)
const;
243 virtual void Save(
const char *fname,
int precision=16)
const;
292 { *
lfr = value.real(); *
lfi = value.imag();
return *
this; }
296 convention) { conv = convention; }
415 convention) { conv = convention; }
490 int copy_interior = 0);
751 { *pgfr = value.real(); *pgfi = value.imag();
return *
this; }
807 return hypot(err_r, err_i);
824 return hypot(err_r, err_i);
830 void Save(std::ostream &
out)
const;
836 void Save(
const char *fname,
int precision=16)
const;
844std::ostream &
operator<<(std::ostream &
out,
const ParComplexGridFunction &
sol);
889 { *
plfr = value.real(); *
plfi = value.imag();
return *
this; }
893 convention) { conv = convention; }
992 void SetImaginaryEssentialDiagonalToZero(
1017 convention) { conv = convention; }
1098 int copy_interior = 0);
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)
const GridFunction & imag() const
const FiniteElementSpace * FESpace() const
virtual real_t ComputeL2Error(VectorCoefficient &exsolr, VectorCoefficient &exsoli, const IntegrationRule *irs[]=NULL, Array< int > *elems=NULL) const
Returns ||u_ex - u_h||_L2 for complex-valued vector fields.
FiniteElementCollection * fec_owned
Used when the grid function is read from a file. It can also be set explicitly, see MakeOwner().
virtual real_t ComputeLpError(const real_t p, Coefficient &exsolr, Coefficient &exsoli, Coefficient *weight=NULL, const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const
Returns ||u_ex - u_h||_Lp for complex-valued H1 or L2 elements.
void MakeOwner(FiniteElementCollection *fec_)
Make the ComplexGridFunction the owner of fec_owned and fes.
FiniteElementSpace * FESpace()
ComplexGridFunction & operator=(const std::complex< real_t > &value)
Assign constant values to the ComplexGridFunction data.
virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
ComplexGridFunction(FiniteElementSpace *f)
Construct a ComplexGridFunction associated with the FiniteElementSpace *f.
ComplexGridFunction & operator=(const ComplexGridFunction &rhs)
Copy assignment. Only the data of the base class Vector is copied.
virtual void Save(std::ostream &out) const
Save the ComplexGridFunction to an output stream.
const GridFunction & real() const
ComplexGridFunction & operator=(const Vector &v)
Copy the data from v.
virtual real_t ComputeMaxError(Coefficient &exsolr, Coefficient &exsoli, const IntegrationRule *irs[]=NULL) const
Returns Max|u_ex - u_h| error for complex-valued H1 or L2 elements.
virtual real_t ComputeL2Error(Coefficient &exsolr, Coefficient &exsoli, const IntegrationRule *irs[]=NULL) const
Returns ||u_ex - u_h||_L2 for complex-valued scalar fields.
virtual ~ComplexGridFunction()
Destroys the grid function.
FiniteElementCollection * OwnFEC()
Specialization of the ComplexOperator built from a pair of HypreParMatrices.
@ HERMITIAN
Native convention for Hermitian operators.
Specialization of the ComplexOperator built from a pair of Sparse Matrices.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
Class for grid function - Vector with associated FE space.
virtual real_t ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const
Returns ||exsol - u_h||_L2 for scalar or vector H1 or L2 elements.
Wrapper for hypre's parallel vector class.
Class for an integration rule - an Array of IntegrationPoint.
Pointer to an Operator of a specified type.
DiagonalPolicy
Defines operator diagonal policy upon elimination of rows and/or columns.
@ DIAG_ONE
Set the diagonal value to one.
FiniteElementSpace * FESpace()
const ParFiniteElementSpace * ParFESpace() const
const FiniteElementSpace * FESpace() const
void MakeOwner(FiniteElementCollection *fec_)
Make the ParComplexGridFunction the owner of fec_owned and pfes.
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.
ParFiniteElementSpace * ParFESpace()
virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
ParFiniteElementSpace * pfes
const ParGridFunction & real() const
void Distribute(const Vector *tv)
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
virtual real_t ComputeL2Error(Coefficient &exsolr, Coefficient &exsoli, const IntegrationRule *irs[]=NULL, Array< int > *elems=NULL) const
Returns ||u_ex - u_h||_L2 in parallel for complex-valued scalar fields.
virtual ~ParComplexGridFunction()
Destroys grid function.
virtual void ProjectCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff)
ParComplexGridFunction & operator=(const std::complex< real_t > &value)
Assign constant values to the ParComplexGridFunction data.
void Distribute(const Vector &tv)
const ParGridFunction & imag() const
FiniteElementCollection * OwnFEC()
void Save(std::ostream &out) const
Save the local portion of the ParComplexGridFunction.
virtual real_t ComputeL2Error(VectorCoefficient &exsolr, VectorCoefficient &exsoli, const IntegrationRule *irs[]=NULL, Array< int > *elems=NULL) const
Returns ||u_ex - u_h||_L2 in parallel for complex-valued vector fields.
Abstract parallel finite element space.
Class for parallel grid function.
real_t ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const override
Returns ||u_ex - u_h||_L2 in parallel for H1 or L2 elements.
Class for parallel meshes.
Base class for vector Coefficients that optionally depend on time and space.
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.
int Size() const
Returns the size of the vector.
Vector & operator=(const real_t *v)
Copy Size() entries from v.
const int * ess_tdof_list
real_t weight(const Vector &x)
std::ostream & operator<<(std::ostream &os, SparseMatrix const &mat)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
AssemblyLevel
Enumeration defining the assembly level for bilinear and nonlinear form classes derived from Operator...
std::function< real_t(const Vector &)> f(real_t mass_coeff)
constexpr real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
real_t p(const Vector &x, real_t t)
real_t sol(const Vector &x)