12 #ifndef MFEM_COEFFICIENT
13 #define MFEM_COEFFICIENT
15 #include "../config/config.hpp"
16 #include "../linalg/linalg.hpp"
157 { 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; }
187 double center[3], scale, tol;
194 center[0] = x; center[1] = y; center[2] = 0.; scale = s; tol = 1e-12;
199 center[0] = x; center[1] = y; center[2] = z; scale = s; tol = 1e-12;
204 const double *
Center() {
return center; }
206 double Tol() {
return tol; }
209 {
mfem_error(
"DeltaCoefficient::Eval");
return 0.; }
222 { c = &_c; attr.
Copy(active_attr); }
320 {
return Coeff[i]->Eval(T, ip,
GetTime()); }
358 { c = &vc; attr.
Copy(active_attr); }
450 { c = &mc; attr.
Copy(active_attr); }
458 double ComputeLpNorm(
double p, Coefficient &coeff, Mesh &mesh,
459 const IntegrationRule *irs[]);
463 double ComputeLpNorm(
double p, VectorCoefficient &coeff, Mesh &mesh,
464 const IntegrationRule *irs[]);
470 const IntegrationRule *irs[]);
475 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()
FunctionCoefficient(double(*tdf)(const Vector &, double))
Define a time-dependent coefficient from a C-function.
virtual ~VectorFunctionCoefficient()
void SetSize(int s)
Resize the vector if the new size is different.
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.
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.
double(* Function)(const Vector &)
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()
MatrixRestrictedCoefficient(MatrixCoefficient &mc, Array< int > &attr)
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 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)
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.
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.
MatrixCoefficient defined on a subset of domain or boundary attributes.
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))
(DEPRECATED) 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)
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
GridFunctionCoefficient(GridFunction *gf, int comp=1)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
double(* TDFunction)(const Vector &, double)
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)