12 #ifndef MFEM_COEFFICIENT
13 #define MFEM_COEFFICIENT
15 #include "../config/config.hpp"
16 #include "../linalg/linalg.hpp"
143 { GridF = gf; Component = comp; }
156 double (*Transform1)(double);
157 double (*Transform2)(double,double);
161 : Q1(q), Transform1(F) { Q2 = 0; Transform2 = 0; }
163 double (*F)(
double,
double))
164 : Q1(q1), Q2(q2), Transform2(F) { Transform1 = 0; }
173 double center[3], scale, tol;
179 { center[0] = x; center[1] = y; center[2] = 0.; scale = s; tol = 1e-12;
182 { center[0] = x; center[1] = y; center[2] = z; scale = s; tol = 1e-12;
186 const double *
Center() {
return center; }
188 double Tol() {
return tol; }
191 {
mfem_error(
"DeltaCoefficient::Eval");
return 0.; }
204 { c = &_c; attr.
Copy(active_attr); }
302 {
return Coeff[i]->Eval(T, ip,
GetTime()); }
340 { c = &vc; attr.
Copy(active_attr); }
424 double ComputeLpNorm(
double p, Coefficient &coeff, Mesh &mesh,
425 const IntegrationRule *irs[]);
429 double ComputeLpNorm(
double p, VectorCoefficient &coeff, Mesh &mesh,
430 const IntegrationRule *irs[]);
436 const IntegrationRule *irs[]);
441 const IntegrationRule *irs[]);
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
double Eval(ElementTransformation &T, const IntegrationPoint &ip, double t)
Class for integration rule.
Vector coefficient defined by an array of scalar coefficients.
MatrixFunctionCoefficient(int dim, void(*F)(const Vector &, DenseMatrix &))
Construct a time-independent matrix coefficient from a C-function.
Class for grid function - Vector with associated FE space.
PWConstCoefficient(Vector &c)
void SetWeight(Coefficient *w)
Subclass constant coefficient.
Coefficient ** GetCoeffs()
VectorGridFunctionCoefficient(GridFunction *gf)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
virtual ~MatrixCoefficient()
virtual ~VectorFunctionCoefficient()
void SetSize(int s)
Resizes the vector if the new size is different.
FunctionCoefficient(double(*f)(Vector &))
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.
Delta function coefficient.
int Size() const
Returns the size of the vector.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Coefficient & GetCoeff(int i, int j)
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)
DeltaCoefficient(double x, double y, double z, double s)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate coefficient.
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
VectorCoefficient defined on a subset of domain or boundary attributes.
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
Coefficient defined on a subset of domain or boundary attributes.
virtual ~VectorCoefficient()
virtual ~DeltaCoefficient()
double Eval(int i, int j, ElementTransformation &T, IntegrationPoint &ip)
virtual ~VectorArrayCoefficient()
Destroys vector coefficient.
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.
double(* Function)(Vector &)
double Eval(int i, ElementTransformation &T, IntegrationPoint &ip)
Evaluates i'th component of the vector.
Base class Coefficient that may optionally depend on time.
void mfem_error(const char *msg)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient function.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
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.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
MatrixArrayCoefficient(int dim)
class for piecewise constant coefficient
Class for integration point with weight.
FunctionCoefficient(double(*tdf)(Vector &, double))
Define a time-dependent coefficient from a C-function.
VectorCoefficient(int vd)
int GetNConst()
Returns the number of constants.
Coefficient & GetCoeff(int i)
Returns i'th coefficient.
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
MatrixFunctionCoefficient(int dim, void(*TDF)(const Vector &, double, DenseMatrix &))
Construct a time-dependent matrix coefficient from a C-function.
Vector coefficient defined by a vector GridFunction.
MatrixCoefficient(int dim)
VectorRestrictedCoefficient(VectorCoefficient &vc, Array< int > &attr)
GridFunctionCoefficient(GridFunction *gf, int comp=1)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
virtual ~MatrixFunctionCoefficient()
void Set(int i, Coefficient *c)
Sets coefficient in the vector.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
double(* TDFunction)(Vector &, double)
RestrictedCoefficient(Coefficient &_c, Array< int > &attr)