12 #ifndef MFEM_COEFFICIENT
13 #define MFEM_COEFFICIENT
17 #include "../config/config.hpp"
18 #include "../linalg/linalg.hpp"
161 std::map<int, Coefficient*> pieces;
186 { InitMap(attr, coefs); }
194 { InitMap(attr, coefs); }
198 { pieces[attr] = &coef; }
202 { pieces.erase(attr); }
266 { GridF = gf; Component = comp; }
291 double (*Transform1)(double);
292 double (*Transform2)(double,double);
296 : Q1(q), Transform1(F) { Q2 = 0; Transform2 = 0; }
298 double (*F)(
double,
double))
299 : Q1(q1), Q2(q2), Transform2(F) { Transform1 = 0; }
404 {
mfem_error(
"DeltaCoefficient::Eval");
return 0.; }
421 { c = &c_; attr.
Copy(active_attr); }
531 std::map<int, VectorCoefficient*> pieces;
565 { InitMap(attr, coefs); }
572 { pieces.erase(attr); }
584 std::function<void(const Vector &, Vector &)> Function;
585 std::function<void(const Vector &, double, Vector &)> TDFunction;
604 std::function<
void(
const Vector &,
double,
Vector &)> TDF,
647 {
return Coeff[i] ? Coeff[i]->Eval(T, ip,
GetTime()) : 0.0; }
839 {
mfem_error(
"VectorDeltaCoefficient::Eval"); }
857 { c = &vc; attr.
Copy(active_attr); }
927 {
mfem_error(
"MatrixCoefficient::EvalSymmetric"); }
983 std::map<int, MatrixCoefficient*> pieces;
1041 { InitMap(attr, coefs); }
1048 { pieces.erase(attr); }
1061 std::function<void(const Vector &, DenseMatrix &)> Function;
1062 std::function<void(const Vector &, Vector &)> SymmFunction;
1063 std::function<void(const Vector &, double, DenseMatrix &)> TDFunction;
1176 { c = &mc; attr.
Copy(active_attr); }
1203 double alpha_ = 1.0,
double beta_ = 1.0)
1204 : aConst(A), a(NULL), b(&B), alpha(alpha_), beta(beta_) { }
1208 double alpha_ = 1.0,
double beta_ = 1.0)
1209 : aConst(0.0), a(&A), b(&B), alpha(alpha_), beta(beta_) { }
1243 return alpha * ((a == NULL ) ? aConst : a->Eval(T, ip) )
1244 + beta * b->
Eval(T, ip);
1259 { dim = dimension;
time = 0.; }
1305 std::function<void(const Vector &, DenseSymmetricMatrix &)> Function;
1306 std::function<void(const Vector &, double, DenseSymmetricMatrix &)> TDFunction;
1363 : aConst(A), a(NULL), b(&B) { }
1367 : aConst(0.0), a(&A), b(&B) { }
1390 {
return ((a == NULL ) ? aConst : a->
Eval(T, ip) ) * b->
Eval(T, ip); }
1407 : aConst(A), bConst(1.0), a(NULL), b(&B) { }
1411 : aConst(0.0), bConst(1.0), a(&A), b(&B) { }
1415 : aConst(0.0), bConst(B), a(&A), b(NULL) { }
1444 double den = (b == NULL ) ? bConst : b->
Eval(T, ip);
1445 MFEM_ASSERT(den != 0.0,
"Division by zero in RatioCoefficient");
1446 return ((a == NULL ) ? aConst : a->
Eval(T, ip) ) / den;
1479 {
return pow(a->
Eval(T, ip), p); }
1597 double alpha_ = 1.0,
double beta_ = 1.0);
1638 void SetAlpha(
double alpha_) { alpha = alpha_; alphaCoef = NULL; }
1643 void SetBeta(
double beta_) { beta = beta_; betaCoef = NULL; }
1824 double alpha_ = 1.0,
double beta_ = 1.0);
2044 class QuadratureFunction;
2095 const IntegrationRule *irs[]);
2099 double ComputeLpNorm(
double p, VectorCoefficient &coeff, Mesh &mesh,
2100 const IntegrationRule *irs[]);
2106 const IntegrationRule *irs[]);
2111 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.
Matrix coefficient defined as the product of two matrices.
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.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
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.
A piecewise coefficient with the pieces keyed off the element attribute numbers.
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.
void UpdateCoefficients(const Array< int > &attr, const Array< VectorCoefficient * > &coefs)
Replace a set of coefficients.
void SetBCoef(VectorCoefficient &B_)
Reset the second vector coefficient.
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.
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.
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.
void SetTime(double t)
Set the time for internally stored coefficients.
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.
void SetTime(double t)
Set the time for internally stored coefficients.
void UpdateCoefficients(const Array< int > &attr, const Array< Coefficient * > &coefs)
Replace a set of coefficients.
void SetTime(double t)
Set the time for internally stored coefficients.
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 ...
PWVectorCoefficient(int vd, const Array< int > &attr, const Array< VectorCoefficient * > &coefs)
Construct the coefficient using arrays describing the pieces.
Scalar coefficient defined as the product of two scalar coefficients or a scalar and a scalar coeffic...
void SetTime(double t)
Set the time for internally stored coefficients.
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 SetTime(double t)
Set the time for internally stored coefficients.
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.
MatrixCoefficient * GetACoef() const
Return the first matrix coefficient.
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.
void SetAlphaCoef(Coefficient &A_)
Reset the factor in front of the first vector coefficient.
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...
void UpdateCoefficient(int attr, VectorCoefficient &coef)
Replace a single Coefficient for a particular attribute.
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.
void SetBCoef(MatrixCoefficient &B)
Reset the second matrix coefficient.
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.
virtual ~MatrixArrayCoefficient()
MatrixCoefficient * GetBCoef() const
Return the second matrix coefficient.
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.
virtual 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)
void SetTime(double t)
Set the time for internally stored coefficients.
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.
void UpdateCoefficients(const Array< int > &attr, const Array< MatrixCoefficient * > &coefs)
Replace a set of coefficients.
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.
void ZeroCoefficient(int attr)
Remove a single VectorCoefficient for a particular attribute.
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.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
PWVectorCoefficient(int vd)
Constructs a piecewise vector coefficient of dimension vd.
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 .
void SetTime(double t)
Set the time for internally stored coefficients.
Coefficient * GetACoef() const
Return the first term in the linear combination.
void SetTime(double t)
Set the time for internally stored coefficients.
MatrixCoefficient(int dim, bool symm=false)
Construct a dim x dim matrix coefficient.
void SetTime(double t)
Set the time for internally stored coefficients.
void SetTime(double t)
Set the time for internally stored coefficients.
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.
void SetTime(double t)
Set the time for internally stored coefficients.
void UpdateCoefficient(int attr, Coefficient &coef)
Replace a single Coefficient for a particular attribute.
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
void SetTime(double t)
Set the time for internally stored coefficients.
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 SetTime(double t)
Set the time for internally stored coefficients.
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.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the 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 ZeroCoefficient(int attr)
Remove a single MatrixCoefficient for a particular attribute.
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.
void UpdateCoefficient(int attr, MatrixCoefficient &coef)
Replace a single coefficient for a particular attribute.
virtual ~VectorArrayCoefficient()
Destroys vector coefficient.
void SetTime(double t)
Set the time for internally stored coefficients.
void SetACoef(VectorCoefficient &A_)
Reset the first vector coefficient.
void SetTime(double t)
Set the time for internally stored coefficients.
void SetBeta(double beta_)
Reset the factor in front of the second vector coefficient as a constant.
void SetTime(double t)
Set the time for internally stored coefficients.
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.
PWMatrixCoefficient(int dim, bool symm=false)
Constructs a piecewise matrix coefficient of dimension dim by dim.
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...
void SetTime(double t)
Set the time for internally stored coefficients.
const GridFunction * GetGridFunction() const
Get the vector grid function.
void SetComponent(int index_, int length_)
void SetBCoef(VectorCoefficient &B)
Reset the vector factor.
void operator=(double c)
Set the constants for all attributes to constant c.
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
FDualNumber< tbase > pow(const FDualNumber< tbase > &a, const FDualNumber< tbase > &b)
pow([dual number],[dual number])
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.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
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.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
void SetBetaCoef(Coefficient &B_)
Reset the factor in front of the second vector coefficient.
Base class for Matrix Coefficients that optionally depend on time and space.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
Coefficient * GetCoeff(int i)
Returns i'th coefficient.
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...
MatrixProductCoefficient(MatrixCoefficient &A, MatrixCoefficient &B)
Construct with the two coefficients. Result is A * B.
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.
PowerCoefficient(Coefficient &A, double p_)
Construct with a coefficient and a constant power p_. Result is A^p.
PWMatrixCoefficient(int h, int w, bool symm=false)
Constructs a piecewise matrix coefficient of dimension h by w.
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.
A piecewise matrix-valued coefficient with the pieces keyed off the element attribute numbers...
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.
PWCoefficient()
Constructs a piecewise coefficient.
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.
PWCoefficient(const Array< int > &attr, const Array< Coefficient * > &coefs)
Construct the coefficient using arrays describing the pieces.
VectorCoefficient * GetBCoef() const
Return the vector coefficient.
void SetTime(double t)
Set the time for internally stored coefficients.
virtual ~GradientGridFunctionCoefficient()
virtual void SetTime(double t)
Set the time for time dependent coefficients.
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.
PWMatrixCoefficient(int h, int w, const Array< int > &attr, const Array< MatrixCoefficient * > &coefs, bool symm=false)
Construct the coefficient using arrays describing the pieces.
const Vector & GetB() const
Return the second vector constant.
Base class for symmetric matrix coefficients that optionally depend on time and space.
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.
void SetTime(double t)
Set the time for internally stored coefficients.
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
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 ZeroCoefficient(int attr)
Remove a single Coefficient for a particular attribute.
A piecewise vector-valued coefficient with the pieces keyed off the element attribute numbers...
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.
PWMatrixCoefficient(int dim, const Array< int > &attr, const Array< MatrixCoefficient * > &coefs, bool symm=false)
Construct the coefficient using arrays describing the pieces.
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)
void SetTime(double t)
Set the time for internally stored coefficients.
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.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
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...
void SetTime(double t)
Set the time for internally stored coefficients.
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.
void SetTime(double t)
Set the time for internally stored coefficients.
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.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
void SetBCoef(Coefficient &B)
Reset the denominator in the ratio.
void SetTime(double t)
Set the time for internally stored coefficients.
virtual ~VectorDeltaCoefficient()
void SetACoef(MatrixCoefficient &A)
Reset the first matrix coefficient.
InverseMatrixCoefficient(MatrixCoefficient &A)
Construct with the matrix coefficient. Result is .
void SetTime(double t)
Set the time for internally stored coefficients.
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...
void SetTime(double t)
Set the time for internally stored coefficients.
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.
void SetTime(double t)
Set the time for internally stored coefficients.
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...
void SetTime(double t)
Set the time for internally stored coefficients.