12 #ifndef MFEM_COEFFICIENT
13 #define MFEM_COEFFICIENT
17 #include "../config/config.hpp"
18 #include "../linalg/linalg.hpp"
185 { GridF = gf; Component = comp; }
210 double (*Transform1)(double);
211 double (*Transform2)(double,double);
215 : Q1(q), Transform1(F) { Q2 = 0; Transform2 = 0; }
217 double (*F)(
double,
double))
218 : Q1(q1), Q2(q2), Transform2(F) { Transform1 = 0; }
317 {
mfem_error(
"DeltaCoefficient::Eval");
return 0.; }
334 { c = &c_; attr.
Copy(active_attr); }
411 std::function<void(const Vector &, Vector &)> Function;
412 std::function<void(const Vector &, double, Vector &)> TDFunction;
431 std::function<
void(
const Vector &,
double,
Vector &)> TDF,
471 {
return Coeff[i] ? Coeff[i]->Eval(T, ip,
GetTime()) : 0.0; }
660 {
mfem_error(
"VectorDeltaCoefficient::Eval"); }
678 { c = &vc; attr.
Copy(active_attr); }
745 {
mfem_error(
"MatrixCoefficient::EvalSymmetric"); }
773 std::function<void(const Vector &, DenseMatrix &)> Function;
774 std::function<void(const Vector &, Vector &)> SymmFunction;
775 std::function<void(const Vector &, double, DenseMatrix &)> TDFunction;
882 { c = &mc; attr.
Copy(active_attr); }
906 double alpha_ = 1.0,
double beta_ = 1.0)
907 : aConst(A), a(NULL), b(&B), alpha(alpha_), beta(beta_) { }
911 double alpha_ = 1.0,
double beta_ = 1.0)
912 : aConst(0.0), a(&A), b(&B), alpha(alpha_), beta(beta_) { }
943 return alpha * ((a == NULL ) ? aConst : a->Eval(T, ip) )
944 + beta * b->
Eval(T, ip);
959 { dim = dimension;
time = 0.; }
1005 std::function<void(const Vector &, DenseSymmetricMatrix &)> Function;
1006 std::function<void(const Vector &, double, DenseSymmetricMatrix &)> TDFunction;
1060 : aConst(A), a(NULL), b(&B) { }
1064 : aConst(0.0), a(&A), b(&B) { }
1084 {
return ((a == NULL ) ? aConst : a->
Eval(T, ip) ) * b->
Eval(T, ip); }
1101 : aConst(A), bConst(1.0), a(NULL), b(&B) { }
1105 : aConst(0.0), bConst(1.0), a(&A), b(&B) { }
1109 : aConst(0.0), bConst(B), a(&A), b(NULL) { }
1135 double den = (b == NULL ) ? bConst : b->
Eval(T, ip);
1136 MFEM_ASSERT(den != 0.0,
"Division by zero in RatioCoefficient");
1137 return ((a == NULL ) ? aConst : a->
Eval(T, ip) ) / den;
1167 {
return pow(a->
Eval(T, ip), p); }
1276 double alpha_ = 1.0,
double beta_ = 1.0);
1314 void SetAlpha(
double alpha_) { alpha = alpha_; alphaCoef = NULL; }
1319 void SetBeta(
double beta_) { beta = beta_; betaCoef = NULL; }
1488 double alpha_ = 1.0,
double beta_ = 1.0);
1661 class QuadratureFunction;
1712 const IntegrationRule *irs[]);
1716 double ComputeLpNorm(
double p, VectorCoefficient &coeff, Mesh &mesh,
1717 const IntegrationRule *irs[]);
1723 const IntegrationRule *irs[]);
1728 const IntegrationRule *irs[]);
FunctionCoefficient(std::function< double(const Vector &)> F)
Define a time-independent coefficient from a std function.
Vector coefficient defined as a cross product of two vectors.
double GetAConst() const
Return the first term in the product.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient at ip.
RatioCoefficient(Coefficient &A, Coefficient &B)
A matrix coefficient that is constant in space and time.
void SetACoef(Coefficient &A)
Reset the scalar factor.
double Eval(ElementTransformation &T, const IntegrationPoint &ip, double t)
Evaluate the coefficient in the element described by T at the point ip at time t. ...
void GetDeltaCenter(Vector ¢er)
VectorCoefficient * GetACoef() const
Return the first vector coefficient in the inner product.
void SetACoef(MatrixCoefficient &A)
Reset the matrix coefficient.
Class for an integration rule - an Array of IntegrationPoint.
Vector coefficient defined by an array of scalar coefficients. Coefficients that are not set will eva...
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient at ip.
Class for grid function - Vector with associated FE space.
Coefficient * GetBCoef() const
Return the second term in the product.
MatrixFunctionCoefficient(int dim, std::function< void(const Vector &, double, DenseMatrix &)> TDF, Coefficient *q=nullptr)
Define a time-dependent square matrix coefficient from a std function.
const GridFunction * GridFunc
SymmetricMatrixFunctionCoefficient(int dim, std::function< void(const Vector &, DenseSymmetricMatrix &)> F, Coefficient *q=nullptr)
Define a time-independent symmetric matrix coefficient from a std function.
Coefficient * GetACoef() const
Return the scalar factor.
void Set(int i, int j, Coefficient *c, bool own=true)
Set the coefficient located at (i,j) in the matrix. By default by default this will take ownership of...
IdentityMatrixCoefficient(int d)
Construct with the dimension of the square identity matrix.
VectorCoefficient * GetACoef() const
Return the vector coefficient.
PWConstCoefficient(Vector &c)
Construct the constant coefficient using a vector of constants.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
const GridFunction * GridFunc
void SetWeight(Coefficient *w)
Set a weight Coefficient that multiplies the DeltaCoefficient.
Base class for vector Coefficients that optionally depend on time and space.
A coefficient that is constant across space and time.
Coefficient ** GetCoeffs()
Returns the entire array of coefficients.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector curl coefficient at ip.
void SetAConst(double A)
Reset the first term in the product as a constant.
TransposeMatrixCoefficient(MatrixCoefficient &A)
Construct with the matrix coefficient. Result is .
double GetBConst() const
Return the denominator of the ratio.
void SetBCoef(VectorCoefficient &B)
Reset the second vector coefficient.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
virtual ~MatrixCoefficient()
VectorCrossProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Construct with the two coefficients. Result is A x B.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
Scalar coefficient defined as the inner product of two vector coefficients.
void SetTime(double t)
Set the time for time dependent coefficients.
NormalizedVectorCoefficient(VectorCoefficient &A, double tol=1e-6)
Return a vector normalized to a length of one.
void SetBCoef(MatrixCoefficient &B)
Reset the matrix factor.
virtual ~VectorFunctionCoefficient()
void SetSize(int s)
Resize the vector to size s.
void SetKCoef(VectorCoefficient &K)
Reset the vector factor.
MatrixVectorProductCoefficient(MatrixCoefficient &A, VectorCoefficient &B)
Constructor with two coefficients. Result is A*B.
double Eval(int i, ElementTransformation &T, const IntegrationPoint &ip)
VectorDeltaCoefficient(int vdim_)
Construct with a vector of dimension vdim_.
void SetDeltaCenter(const Vector ¢er)
Set the center location of the delta function.
MatrixCoefficient(int h, int w, bool symm=false)
Construct a h x w matrix coefficient.
double Scale()
Return the scale factor times the optional time dependent function. Returns with when not set by th...
MatrixCoefficient * GetBCoef() const
Return the matrix factor.
Vector quadrature function coefficient which requires that the quadrature rules used for this vector ...
void SetACoef(Coefficient &A)
Reset the numerator in the ratio.
Vector coefficient that is constant in space and time.
Scalar coefficient defined as a cross product of two vectors in the xy-plane.
double GetTime()
Get the time for time dependent coefficients.
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the matrix coefficient in the element described by T at the point ip, storing the result in ...
Scalar coefficient defined as the product of two scalar coefficients or a scalar and a scalar coeffic...
void SetBCoef(VectorCoefficient &B)
Reset the second term in the product.
void Copy(Array ©) const
Create a copy of the internal array to the provided copy.
void SetBeta(double beta_)
Reset the factor in front of the second matrix coefficient.
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
Coefficient * GetBCoef() const
Return the denominator of the ratio.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
double & operator()(int i)
Return a reference to the i-th constant.
Data type dense matrix using column-major storage.
Delta function coefficient optionally multiplied by a weight coefficient and a scaled time dependent ...
int Size() const
Returns the size of the vector.
virtual ~CurlGridFunctionCoefficient()
void SetExponent(double p_)
Reset the exponent.
A matrix coefficient with an optional scalar coefficient multiplier q. The matrix function can either...
void SetFunction(double(*f)(double))
Set a time-dependent function that multiplies the Scale().
Scalar coefficient defined as the ratio of two scalars where one or both scalars are scalar coefficie...
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient at ip.
CurlGridFunctionCoefficient(const GridFunction *gf)
Construct the coefficient with a vector grid function gf. The grid function is not owned by the coeff...
Matrix coefficient defined by a matrix of scalar coefficients. Coefficients that are not set will eva...
GradientGridFunctionCoefficient(const GridFunction *gf)
Construct the coefficient with a scalar grid function gf. The grid function is not owned by the coeff...
CrossCrossCoefficient(double A, VectorCoefficient &K)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
void SetB(const Vector &B_)
Reset the second vector as a constant.
virtual ~QuadratureFunctionCoefficient()
void SetDeltaCoefficient(const DeltaCoefficient &d_)
Replace the associated DeltaCoefficient with a new DeltaCoefficient.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
double Tol()
Return the tolerance used to identify the mesh vertices.
SymmetricMatrixFunctionCoefficient(const DenseSymmetricMatrix &m, Coefficient &q)
Define a constant matrix coefficient times a scalar Coefficient.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
void SetGridFunction(const GridFunction *gf)
Set the vector grid function.
Vector coefficient defined as the linear combination of two vectors.
void SetACoef(VectorCoefficient &A)
Reset the first vector coefficient.
virtual ~MatrixArrayCoefficient()
MFEM_DEPRECATED FunctionCoefficient(double(*f)(Vector &))
(DEPRECATED) Define a time-independent coefficient from a C-function
Matrix coefficient defined as a product of a scalar coefficient and a matrix coefficient.
virtual ~VectorGridFunctionCoefficient()
virtual void Eval(DenseSymmetricMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
A DeltaFunction cannot be evaluated. Calling this method will cause an MFEM error, terminating the application.
Coefficient * GetACoef() const
Return the scalar factor.
VectorCoefficient * GetKCoef() const
Return the vector factor.
void SetTime(double t)
Set the time for time dependent coefficients.
void SetBCoef(VectorCoefficient &B)
Reset the second vector in the inner product.
virtual void EvalSymmetric(Vector &K, ElementTransformation &T, const IntegrationPoint &ip)
(DEPRECATED) Evaluate a symmetric matrix coefficient.
Matrix coefficient defined as -a k x k x, for a vector k and scalar a.
DeltaCoefficient(double x, double y, double z, double s)
Construct a delta function scaled by s and centered at (x,y,z)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
double GetBeta() const
Return the factor in front of the second matrix coefficient.
MatrixFunctionCoefficient(int dim, std::function< void(const Vector &, DenseMatrix &)> F, Coefficient *q=nullptr)
Define a time-independent square matrix coefficient from a std function.
RestrictedCoefficient(Coefficient &c_, Array< int > &attr)
Construct with a parent coefficient and an array with ones marking the attributes on which this coeff...
Matrix coefficient defined as the linear combination of two matrices.
DeltaCoefficient & GetDeltaCoefficient()
Return the associated scalar DeltaCoefficient.
void SetACoef(MatrixCoefficient &A)
Reset the matrix coefficient.
DeltaCoefficient(double x, double s)
Construct a delta function scaled by s and centered at (x,0.0,0.0)
DeterminantCoefficient(MatrixCoefficient &A)
Construct with the matrix.
VectorCoefficient * GetBCoef() const
Return the vector factor.
SumCoefficient(double A, Coefficient &B, double alpha_=1.0, double beta_=1.0)
Constructor with one coefficient. Result is alpha_ * A + beta_ * B.
Matrix coefficient defined as the inverse a matrix coefficient.
void SetACoef(Coefficient &A)
Reset the first term in the product.
ScalarMatrixProductCoefficient(double A, MatrixCoefficient &B)
Constructor with one coefficient. Result is A*B.
FunctionCoefficient(std::function< double(const Vector &, double)> TDF)
Define a time-dependent coefficient from a std function.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
A VectorDeltaFunction cannot be evaluated. Calling this method will cause an MFEM error...
Coefficient * GetACoef() const
Return the first term in the product.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
int GetHeight() const
Get the height of the matrix.
RatioCoefficient(double A, Coefficient &B)
Coefficient * GetCoeff(int i, int j)
Get the coefficient located at (i,j) in the matrix.
Matrix coefficient defined as the outer product of two vector coefficients.
void SetBCoef(Coefficient &B)
Reset the second term in the product.
MFEM_DEPRECATED FunctionCoefficient(double(*tdf)(Vector &, double))
(DEPRECATED) Define a time-dependent coefficient from a C-function
void SetACoef(MatrixCoefficient &A)
Reset the first matrix coefficient.
int GetSize() const
Get the size of the matrix.
double Eval(int i, int j, ElementTransformation &T, const IntegrationPoint &ip)
void SetAConst(double A)
Reset the scalar factor as a constant.
Derived vector coefficient that has the value of the parent vector where it is active and is zero oth...
Coefficient * GetACoef() const
Return the scalar factor.
virtual ~SymmetricMatrixFunctionCoefficient()
double GetAConst() const
Return the scalar factor.
InnerProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Construct with the two vector coefficients. Result is .
Coefficient * GetACoef() const
Return the first term in the linear combination.
MatrixCoefficient(int dim, bool symm=false)
Construct a dim x dim matrix coefficient.
Quadrature function coefficient which requires that the quadrature rules used for this coefficient be...
void SetAConst(double A)
Reset the scalar factor as a constant.
VectorCoefficient * GetBCoef() const
Return the second vector coefficient in the outer product.
double ComputeLpNorm(double p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
Compute the Lp norm of a function f. .
std::function< double(const Vector &, double)> TDFunction
double f(const Vector &xvec)
VectorConstantCoefficient(const Vector &v)
Construct the coefficient with constant vector v.
ConstantCoefficient(double c=1.0)
c is value of constant function
VectorCoefficient * GetBCoef() const
Return the second vector coefficient.
void SetBCoef(VectorCoefficient &B)
Reset the vector coefficient.
void SetBCoef(VectorCoefficient &B)
Reset the second vector in the outer product.
const QuadratureFunction & GetQuadFunction() const
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
A matrix coefficient with an optional scalar coefficient multiplier q. The matrix function can either...
double GetTime()
Get the time for time dependent coefficients.
VectorCoefficient * GetACoef() const
Return the first vector of the product.
void SetA(const Vector &A_)
Reset the first vector as a constant.
Derived coefficient that takes the value of the parent coefficient for the active attributes and is z...
virtual ~VectorCoefficient()
QuadratureFunctionCoefficient(QuadratureFunction &qf)
Constructor with a quadrature function as input.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
void SetDeltaCenter(const Vector ¢er)
Coefficient * Weight()
See SetWeight() for description of the weight Coefficient.
RatioCoefficient(Coefficient &A, double B)
MatrixFunctionCoefficient(int dim, std::function< void(const Vector &, Vector &)> SymmF, Coefficient *q=NULL)
Define a time-independent symmetric square matrix coefficient from a std function.
const Vector & GetVec()
Return a reference to the constant vector in this class.
MatrixRestrictedCoefficient(MatrixCoefficient &mc, Array< int > &attr)
Construct with a parent matrix coefficient and an array of zeros and ones representing the attributes...
std::function< double(const Vector &)> Function
Coefficient * GetBetaCoef() const
Return the factor in front of the second vector coefficient.
Vector coefficient defined as the Gradient of a scalar GridFunction.
Vector coefficient defined as the Curl of a vector GridFunction.
OuterProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Construct with two vector coefficients. Result is .
const GridFunction * GetGridFunction() const
Get the internal GridFunction.
void SetGridFunction(const GridFunction *gf)
Set the vector grid function.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
void Set(int i, Coefficient *c, bool own=true)
Sets coefficient in the vector.
void SetBeta(double beta_)
Reset the factor in front of the second term in the linear combination.
DeltaCoefficient()
Construct a unit delta function centered at (0.0,0.0,0.0)
void SetTol(double tol_)
Set the tolerance used during projection onto GridFunction to identify the Mesh vertex where the Cent...
void SetACoef(VectorCoefficient &A)
Reset the first vector in the inner product.
virtual ~DeltaCoefficient()
void SetAlpha(double alpha_)
Reset the factor in front of the first matrix coefficient.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
virtual ~VectorArrayCoefficient()
Destroys vector coefficient.
void SetBeta(double beta_)
Reset the factor in front of the second vector coefficient as a constant.
VectorFunctionCoefficient(int dim, std::function< void(const Vector &, Vector &)> F, Coefficient *q=nullptr)
Define a time-independent vector coefficient from a std function.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
int GetVDim()
Returns dimension of the vector.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
void SetACoef(Coefficient &A)
Reset the scalar factor.
VectorCoefficient * GetACoef() const
Return the first vector coefficient in the outer product.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
void SetACoef(VectorCoefficient &A)
Reset the first term in the product.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
const GridFunction * GridFunc
virtual ~VectorQuadratureFunctionCoefficient()
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the determinant coefficient at ip.
VectorDeltaCoefficient(const Vector &dir_)
Construct with a Vector object representing the direction and a unit delta function centered at (0...
const GridFunction * GetGridFunction() const
Get the vector grid function.
void SetComponent(int index_, int length_)
void SetBCoef(VectorCoefficient &B)
Reset the vector factor.
void SetTime(double t)
Set the time for time dependent coefficients.
void operator=(double c)
Set the constants for all attributes to constant c.
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
VectorCoefficient DiagonalMatrixCoefficient
A general vector function coefficient.
const GridFunction * GetGridFunction() const
Returns a pointer to the grid function in this Coefficient.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
Coefficient * GetAlphaCoef() const
Return the factor in front of the first vector coefficient.
VectorCoefficient * GetBCoef() const
Return the second term in the product.
void GetDeltaCenter(Vector ¢er)
Write the center of the delta function into center.
MatrixFunctionCoefficient(const DenseMatrix &m, Coefficient &q)
Define a constant matrix coefficient times a scalar Coefficient.
Scalar coefficient defined as the Divergence of a vector GridFunction.
MatrixVectorProductCoefficient MatVecCoefficient
Convenient alias for the MatrixVectorProductCoefficient.
void SetACoef(Coefficient &A)
Reset the base coefficient.
void SetACoef(MatrixCoefficient &A)
Reset the matrix coefficient.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
double p(const Vector &x, double t)
VectorDeltaCoefficient(const Vector &dir_, double x, double y, double z, double s)
Construct with a Vector object representing the direction and a delta function scaled by s and center...
void SetGridFunction(const GridFunction *gf)
Set the scalar grid function.
VectorDeltaCoefficient(const Vector &dir_, double x, double s)
Construct with a Vector object representing the direction and a delta function scaled by s and center...
const GridFunction * GetGridFunction() const
Get the scalar grid function.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
void SetBCoef(VectorCoefficient &B)
Reset the second vector in the product.
VectorQuadratureFunctionCoefficient(QuadratureFunction &qf)
Constructor with a quadrature function as input.
Vector coefficient defined as a product of scalar and vector coefficients.
MatrixCoefficient * GetACoef() const
Return the first matrix coefficient.
double GetAConst() const
Return the first term in the linear combination.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
void UpdateConstants(Vector &c)
Update the constants with vector c.
Base class for Matrix Coefficients that optionally depend on time and space.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
Coefficient * GetCoeff(int i)
Returns i'th coefficient.
void SetTime(double t)
Set the time for time dependent coefficients.
virtual void Eval(DenseSymmetricMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the matrix coefficient in the element described by T at the point ip, storing the result in ...
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient at ip.
virtual void EvalDelta(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Return the specified direction vector multiplied by the value returned by DeltaCoefficient::EvalDelta...
const GridFunction * GridFunc
double ComputeGlobalLpNorm(double p, Coefficient &coeff, ParMesh &pmesh, const IntegrationRule *irs[])
Compute the global Lp norm of a function f. .
void SetAConst(double A)
Reset the first term in the linear combination as a constant.
PWConstCoefficient(int NumOfSubD=0)
Constructs a piecewise constant coefficient in NumOfSubD subdomains.
void SetAlphaCoef(Coefficient &A)
Reset the factor in front of the first vector coefficient.
PowerCoefficient(Coefficient &A, double p_)
Construct with a coefficient and a constant power p_. Result is A^p.
Coefficient * GetACoef() const
Return the numerator of the ratio.
virtual double EvalDelta(ElementTransformation &T, const IntegrationPoint &ip)
The value of the function assuming we are evaluating at the delta center.
SymmetricMatrixFunctionCoefficient(int dim, std::function< void(const Vector &, double, DenseSymmetricMatrix &)> TDF, Coefficient *q=nullptr)
Define a time-dependent square matrix coefficient from a std function.
SymmetricMatrixConstantCoefficient(const DenseSymmetricMatrix &m)
Construct using matrix m for the constant.
Vector coefficient defined as a product of a matrix coefficient and a vector coefficient.
virtual ~DivergenceGridFunctionCoefficient()
VectorCoefficient * GetACoef() const
Return the first vector coefficient.
const QuadratureFunction & GetQuadFunction() const
Derived matrix coefficient that has the value of the parent matrix coefficient where it is active and...
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
virtual ~SymmetricMatrixCoefficient()
Vector coefficient defined by a scalar DeltaCoefficient and a constant vector direction.
int GetVDim() const
For backward compatibility get the width of the matrix.
MatrixCoefficient * GetBCoef() const
Return the second matrix coefficient.
MatrixArrayCoefficient(int dim)
Construct a coefficient matrix of dimensions dim * dim. The actual coefficients still need to be adde...
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the gradient vector coefficient at ip.
A piecewise constant coefficient with the constants keyed off the element attribute numbers...
void SetACoef(VectorCoefficient &A)
Reset the vector coefficient.
void SetACoef(MatrixCoefficient &A)
Reset the matrix coefficient.
Class for integration point with weight.
VectorCoefficient * GetBCoef() const
Return the vector coefficient.
virtual ~GradientGridFunctionCoefficient()
double GetAConst() const
Return the scalar factor.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the scalar divergence coefficient at ip.
double GetTime()
Get the time for time dependent coefficients.
void SetAlpha(double alpha_)
Reset the factor in front of the first vector coefficient as a constant.
double GetBeta() const
Return the factor in front of the second term in the linear combination.
double GetAlpha() const
Return the factor in front of the first vector coefficient.
void SetAConst(double A)
Reset the numerator in the ratio as a constant.
void SetScale(double s_)
Set the scale value multiplying the delta function.
const Vector & GetB() const
Return the second vector constant.
Base class for symmetric matrix coefficients that optionally depend on time and space.
void SetBetaCoef(Coefficient &B)
Reset the factor in front of the second vector coefficient.
DivergenceGridFunctionCoefficient(const GridFunction *gf)
Construct the coefficient with a vector grid function gf. The grid function is not owned by the coeff...
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
SymmetricMatrixCoefficient(int dimension)
Construct a dim x dim matrix coefficient.
Coefficient * GetBCoef() const
Return the second term in the linear combination.
const GridFunction * GetGridFunction() const
Get the vector grid function.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
Vector coefficient defined as a normalized vector field (returns v/|v|)
VectorCoefficient(int vd)
Initialize the VectorCoefficient with vector dimension vd.
int GetNConst()
Returns the number of constants representing different attributes.
void SetDirection(const Vector &d_)
void SetAConst(double A)
Reset the scalar factor as a constant.
VectorFunctionCoefficient(int dim, std::function< void(const Vector &, double, Vector &)> TDF, Coefficient *q=nullptr)
Define a time-dependent vector coefficient from a std function.
void SetACoef(VectorCoefficient &A)
Reset the first vector in the product.
VectorSumCoefficient(int dim)
void SetGridFunction(const GridFunction *gf)
Set the grid function for this coefficient. Also sets the Vector dimension to match that of the gf...
Matrix coefficient defined as the transpose a matrix coefficient.
GridFunctionCoefficient()
void SetBConst(double B)
Reset the denominator in the ratio as a constant.
void SetBCoef(Coefficient &B)
Reset the second term in the linear combination.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
A matrix coefficient that is constant in space and time.
VectorCoefficient * GetBCoef() const
Return the second vector coefficient in the inner product.
double GetAConst() const
Return the scalar factor.
DeltaCoefficient(double x, double y, double s)
Construct a delta function scaled by s and centered at (x,y,0.0)
MatrixSumCoefficient(MatrixCoefficient &A, MatrixCoefficient &B, double alpha_=1.0, double beta_=1.0)
Construct with the two coefficients. Result is alpha_ * A + beta_ * B.
Scalar coefficient defined as a scalar raised to a power.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
VectorArrayCoefficient(int dim)
Construct vector of dim coefficients. The actual coefficients still need to be added with Set()...
virtual void Eval(DenseSymmetricMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
double GetTime()
Get the time for time dependent coefficients.
Scalar coefficient defined as the determinant of a matrix coefficient.
A general function coefficient.
void SetACoef(VectorCoefficient &A)
Reset the first vector in the outer product.
ProductCoefficient(Coefficient &A, Coefficient &B)
Constructor with two coefficients. Result is A * B.
GridFunctionCoefficient(const GridFunction *gf, int comp=1)
Vector coefficient defined by a vector GridFunction.
int GetWidth() const
Get the width of the matrix.
VectorRestrictedCoefficient(VectorCoefficient &vc, Array< int > &attr)
Construct with a parent vector coefficient and an array of zeros and ones representing the attributes...
VectorRotProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Constructor with two vector coefficients. Result is .
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
void SetACoef(Coefficient &A)
Reset the scalar factor.
MatrixConstantCoefficient(const DenseMatrix &m)
Construct using matrix m for the constant.
double GetAlpha() const
Return the factor in front of the first term in the linear combination.
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
double GetAlpha() const
Return the factor in front of the first matrix coefficient.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
VectorCoefficient * GetACoef() const
Return the first term in the product.
void SetAlpha(double alpha_)
Reset the factor in front of the first term in the linear combination.
double GetAConst() const
Return the numerator of the ratio.
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
Constant matrix coefficient defined as the identity of dimension d.
double GetExponent() const
Return the exponent.
virtual void EvalSymmetric(Vector &K, ElementTransformation &T, const IntegrationPoint &ip)
(DEPRECATED) Evaluate the symmetric matrix coefficient at ip.
Coefficient * GetACoef() const
Return the base coefficient.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient at ip.
void SetGridFunction(const GridFunction *gf)
Set the internal GridFunction.
void SetBCoef(Coefficient &B)
Reset the denominator in the ratio.
virtual ~VectorDeltaCoefficient()
InverseMatrixCoefficient(MatrixCoefficient &A)
Construct with the matrix coefficient. Result is .
Scalar coefficient defined as the linear combination of two scalar coefficients or a scalar and a sca...
ProductCoefficient(double A, Coefficient &B)
Constructor with one coefficient. Result is A * B.
Class representing a function through its values (scalar or vector) at quadrature points...
virtual ~MatrixFunctionCoefficient()
VectorDeltaCoefficient(const Vector &dir_, double x, double y, double s)
Construct with a Vector object representing the direction and a delta function scaled by s and center...
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
const Vector & GetA() const
Return the first vector constant.
VectorCoefficient * GetBCoef() const
Return the second vector of the product.
void SetACoef(Coefficient &A)
Reset the first term in the linear combination.
double GetBeta() const
Return the factor in front of the second vector coefficient.
void SetBCoef(MatrixCoefficient &B)
Reset the second matrix coefficient.
SumCoefficient(Coefficient &A, Coefficient &B, double alpha_=1.0, double beta_=1.0)
Constructor with two coefficients. Result is alpha_ * A + beta_ * B.
ScalarVectorProductCoefficient(double A, VectorCoefficient &B)
Constructor with constant and vector coefficient. Result is A * B.
VectorGridFunctionCoefficient()
Construct an empty coefficient. Calling Eval() before the grid function is set will cause a segfault...