12 #ifndef MFEM_COEFFICIENT
13 #define MFEM_COEFFICIENT
15 #include "../config/config.hpp"
16 #include "../linalg/linalg.hpp"
156 { GridF = gf; Component = comp; }
170 double (*Transform1)(double);
171 double (*Transform2)(double,double);
175 : Q1(q), Transform1(F) { Q2 = 0; Transform2 = 0; }
177 double (*F)(
double,
double))
178 : Q1(q1), Q2(q2), Transform2(F) { Transform1 = 0; }
242 {
mfem_error(
"DeltaCoefficient::Eval");
return 0.; }
255 { c = &_c; attr.
Copy(active_attr); }
353 {
return Coeff[i] ? Coeff[i]->Eval(T, ip,
GetTime()) : 0.0; }
422 {
mfem_error(
"VectorDeltaCoefficient::Eval"); }
436 { c = &vc; attr.
Copy(active_attr); }
560 { c = &mc; attr.
Copy(active_attr); }
568 double ComputeLpNorm(
double p, Coefficient &coeff, Mesh &mesh,
569 const IntegrationRule *irs[]);
573 double ComputeLpNorm(
double p, VectorCoefficient &coeff, Mesh &mesh,
574 const IntegrationRule *irs[]);
580 const IntegrationRule *irs[]);
585 const IntegrationRule *irs[]);
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
double Eval(ElementTransformation &T, const IntegrationPoint &ip, double t)
void GetDeltaCenter(Vector ¢er)
void SetTol(double _tol)
Set the tolerance used during projection onto GridFunction to identifying the Mesh vertex where the C...
Class for an integration rule - an Array of IntegrationPoint.
Vector coefficient defined by an array of scalar coefficients.
Class for grid function - Vector with associated FE space.
GridFunction * GetGridFunction() const
PWConstCoefficient(Vector &c)
void SetWeight(Coefficient *w)
Set a weight Coefficient that multiplies the DeltaCoefficient.
Subclass constant coefficient.
Coefficient ** GetCoeffs()
VectorGridFunctionCoefficient(GridFunction *gf)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
virtual ~MatrixCoefficient()
FunctionCoefficient(double(*tdf)(const Vector &, double))
Define a time-dependent coefficient from a C-function.
virtual ~VectorFunctionCoefficient()
void SetSize(int s)
Resize the vector to size s.
double Eval(int i, ElementTransformation &T, const IntegrationPoint &ip)
Evaluates i'th component of the vector.
void SetDeltaCenter(const Vector ¢er)
double Scale()
Return the scale set by SetScale() multiplied by the time-dependent function specified by SetFunction...
FunctionCoefficient(double(*f)(Vector &))
(DEPRECATED) Define a time-independent coefficient from a C-function
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)=0
void Copy(Array ©) const
Create a copy of the current array.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
double & operator()(int i)
Member function to access or modify the value of the i-th constant.
Data type dense matrix using column-major storage.
Delta function coefficient.
int Size() const
Returns the size of the vector.
void SetFunction(double(*f)(double))
Set a time-dependent function that multiplies the Scale().
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
double Tol()
See SetTol() for description of the tolerance parameter.
GridFunction * GetGridFunction() const
virtual ~MatrixArrayCoefficient()
void Set(int i, int j, Coefficient *c)
VectorFunctionCoefficient(int dim, void(*TDF)(const Vector &, double, Vector &), Coefficient *q=NULL)
Construct a time-dependent vector coefficient from a C-function.
virtual ~VectorGridFunctionCoefficient()
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
A DeltaFunction cannot be evaluated. Calling this method will cause an MFEM error, terminating the application.
VectorDeltaCoefficient(const Vector &_dir, double x, double y, double s)
DeltaCoefficient(double x, double y, double z, double s)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate coefficient.
DeltaCoefficient & GetDeltaCoefficient()
Return the associated scalar DeltaCoefficient.
DeltaCoefficient(double x, double s)
double(* Function)(const Vector &)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
A VectorDeltaFunction cannot be evaluated. Calling this method will cause an MFEM error...
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
Coefficient * GetCoeff(int i, int j)
double Eval(int i, int j, ElementTransformation &T, const IntegrationPoint &ip)
VectorCoefficient defined on a subset of domain or boundary attributes.
MatrixFunctionCoefficient(int dim, void(*F)(const Vector &, DenseMatrix &), Coefficient *q=NULL)
Construct a time-independent square matrix coefficient from a C-function.
double ComputeLpNorm(double p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
VectorConstantCoefficient(const Vector &v)
ConstantCoefficient(double c=1.0)
c is value of constant function
VectorDeltaCoefficient(int _vdim)
Coefficient defined on a subset of domain or boundary attributes.
virtual ~VectorCoefficient()
Coefficient * Weight()
See SetWeight() for description of the weight Coefficient.
VectorDeltaCoefficient(const Vector &_dir)
MatrixRestrictedCoefficient(MatrixCoefficient &mc, Array< int > &attr)
void SetDirection(const Vector &_d)
VectorDeltaCoefficient(const Vector &_dir, double x, double y, double z, double s)
MatrixFunctionCoefficient(int dim, void(*TDF)(const Vector &, double, DenseMatrix &), Coefficient *q=NULL)
Construct a time-dependent square matrix coefficient from a C-function.
void SetDeltaCoefficient(const DeltaCoefficient &_d)
Replace the associated DeltaCoeficient with a new DeltaCoeficient.
virtual ~DeltaCoefficient()
virtual ~VectorArrayCoefficient()
Destroys vector coefficient.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
int GetVDim()
Returns dimension of the vector.
void operator=(double c)
Set domain constants equal to the same constant c.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
void GetDeltaCenter(Vector ¢er)
MatrixFunctionCoefficient(const DenseMatrix &m, Coefficient &q)
Construct a constant matrix coefficient times a scalar Coefficient.
Base class Coefficient that may optionally depend on time.
void mfem_error(const char *msg)
FunctionCoefficient(double(*f)(const Vector &))
Define a time-independent coefficient from a C-function.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient function.
Coefficient * GetCoeff(int i)
Returns i'th coefficient.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
void EvalDelta(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Return the specified direction vector multiplied by the value returned by DeltaCoefficient::EvalDelta...
double ComputeGlobalLpNorm(double p, Coefficient &coeff, ParMesh &pmesh, const IntegrationRule *irs[])
void SetGridFunction(GridFunction *gf)
PWConstCoefficient(int NumOfSubD=0)
Constructs a piecewise constant coefficient in NumOfSubD subdomains.
double EvalDelta(ElementTransformation &T, const IntegrationPoint &ip)
Return the Scale() multiplied by the weight Coefficient, if any.
MatrixCoefficient defined on a subset of domain or boundary attributes.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
void SetGridFunction(GridFunction *gf)
VectorDeltaCoefficient: DeltaCoefficient with a direction.
MatrixArrayCoefficient(int dim)
class for piecewise constant coefficient
Class for integration point with weight.
FunctionCoefficient(double(*tdf)(Vector &, double))
(DEPRECATED) Define a time-dependent coefficient from a C-function
VectorCoefficient(int vd)
int GetNConst()
Returns the number of constants.
VectorDeltaCoefficient(const Vector &_dir, double x, double s)
DeltaCoefficient(double x, double y, double s)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
VectorArrayCoefficient(int dim)
Construct vector of dim coefficients.
VectorFunctionCoefficient(int dim, void(*F)(const Vector &, Vector &), Coefficient *q=NULL)
Construct a time-independent vector coefficient from a C-function.
class for C-function coefficient
Vector coefficient defined by a vector GridFunction.
MatrixCoefficient(int dim)
VectorRestrictedCoefficient(VectorCoefficient &vc, Array< int > &attr)
MatrixConstantCoefficient(const DenseMatrix &m)
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
GridFunctionCoefficient(GridFunction *gf, int comp=1)
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
double(* TDFunction)(const Vector &, double)
virtual ~VectorDeltaCoefficient()
MatrixCoefficient(int h, int w)
virtual ~MatrixFunctionCoefficient()
void Set(int i, Coefficient *c)
Sets coefficient in the vector.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
RestrictedCoefficient(Coefficient &_c, Array< int > &attr)