12 #ifndef MFEM_COEFFICIENT 13 #define MFEM_COEFFICIENT 17 #include "../config/config.hpp" 18 #include "../linalg/linalg.hpp" 26 class QuadratureSpaceBase;
27 class QuadratureFunction;
170 std::map<int, Coefficient*> pieces;
195 { InitMap(attr, coefs); }
203 { InitMap(attr, coefs); }
207 { pieces[attr] = &coef; }
211 { pieces.erase(attr); }
393 { GridF = gf; Component = comp; }
425 double (*Transform1)(double);
426 double (*Transform2)(double,double);
430 : Q1(q), Transform1(F) { Q2 = 0; Transform2 = 0; }
432 double (*F)(
double,
double))
433 : Q1(q1), Q2(q2), Transform2(F) { Transform1 = 0; }
538 {
mfem_error(
"DeltaCoefficient::Eval");
return 0.; }
555 { c = &c_; attr.
Copy(active_attr); }
562 {
return active_attr[T.Attribute-1] ? c->
Eval(T, ip,
GetTime()) : 0.0; }
672 std::map<int, VectorCoefficient*> pieces;
706 { InitMap(attr, coefs); }
713 { pieces.erase(attr); }
741 std::function<void(const Vector &, Vector &)> Function;
742 std::function<void(const Vector &, double, Vector &)> TDFunction;
761 std::function<
void(
const Vector &,
double,
Vector &)> TDF,
804 {
return Coeff[i] ? Coeff[i]->Eval(T, ip,
GetTime()) : 0.0; }
1003 {
mfem_error(
"VectorDeltaCoefficient::Eval"); }
1021 { c = &vc; attr.
Copy(active_attr); }
1099 {
mfem_error(
"MatrixCoefficient::EvalSymmetric"); }
1157 std::map<int, MatrixCoefficient*> pieces;
1215 { InitMap(attr, coefs); }
1222 { pieces.erase(attr); }
1235 std::function<void(const Vector &, DenseMatrix &)> Function;
1236 std::function<void(const Vector &, Vector &)> SymmFunction;
1237 std::function<void(const Vector &, double, DenseMatrix &)> TDFunction;
1352 { c = &mc; attr.
Copy(active_attr); }
1379 double alpha_ = 1.0,
double beta_ = 1.0)
1380 : aConst(A),
a(NULL),
b(&B),
alpha(alpha_),
beta(beta_) { }
1384 double alpha_ = 1.0,
double beta_ = 1.0)
1385 : aConst(0.0),
a(&A),
b(&B),
alpha(alpha_),
beta(beta_) { }
1419 return alpha * ((
a == NULL ) ? aConst :
a->Eval(T, ip) )
1420 +
beta *
b->Eval(T, ip);
1497 std::function<void(const Vector &, DenseSymmetricMatrix &)> Function;
1498 std::function<void(const Vector &, double, DenseSymmetricMatrix &)> TDFunction;
1556 : aConst(A),
a(NULL),
b(&B) { }
1560 : aConst(0.0),
a(&A),
b(&B) { }
1583 {
return ((
a == NULL ) ? aConst :
a->Eval(T, ip) ) *
b->Eval(T, ip); }
1600 : aConst(A), bConst(1.0),
a(NULL),
b(&B) { }
1604 : aConst(0.0), bConst(1.0),
a(&A),
b(&B) { }
1608 : aConst(0.0), bConst(B),
a(&A),
b(NULL) { }
1637 double den = (
b == NULL ) ? bConst :
b->Eval(T, ip);
1638 MFEM_ASSERT(den != 0.0,
"Division by zero in RatioCoefficient");
1639 return ((
a == NULL ) ? aConst :
a->Eval(T, ip) ) / den;
1672 {
return pow(
a->Eval(T, ip),
p); }
1790 double alpha_ = 1.0,
double beta_ = 1.0);
2017 double alpha_ = 1.0,
double beta_ = 1.0);
2303 return int(
a) & int(
b);
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.
int GetHeight() const
Get the height of the matrix.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient at ip.
CoefficientStorage operator|(CoefficientStorage a, CoefficientStorage b)
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. ...
CoefficientStorage
Flags that determine what storage optimizations to use in CoefficientVector.
void GetDeltaCenter(Vector ¢er)
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
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...
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.
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.
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.
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 * GetGridFunction() const
Get the scalar grid function.
void SetBCoef(VectorCoefficient &B_)
Reset the second vector coefficient.
const DenseMatrix & GetMatrix()
Return a reference to the constant matrix.
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.
double GetAConst() const
Return the first term in the product.
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.
const QuadratureFunction & GetQuadFunction() const
TransposeMatrixCoefficient(MatrixCoefficient &A)
Construct with the matrix coefficient. Result is .
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.
int vdim
Number of values per quadrature point.
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...
void SetTime(double t)
Set the time for internally stored coefficients.
int GetSize() const
Get the size of the matrix.
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.
PWCoefficient(const Array< int > &attr, const Array< Coefficient *> &coefs)
Construct the coefficient using arrays describing the pieces.
PWMatrixCoefficient(int h, int w, const Array< int > &attr, const Array< MatrixCoefficient *> &coefs, bool symm=false)
Construct the coefficient using arrays describing the pieces.
void SetTime(double t)
Set the time for internally stored coefficients.
const Vector & GetVec() const
Return a reference to the constant vector in this class.
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 ...
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 SetTime(double t)
Set the time for internally stored coefficients.
MatrixCoefficient * GetACoef() const
Return the first matrix coefficient.
void SetBeta(double beta_)
Reset the factor in front of the second matrix coefficient.
int Size() const
Returns the size of the vector.
MatrixCoefficient * GetBCoef() const
Return the second matrix coefficient.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
double GetAConst() const
Return the first term in the linear combination.
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 ...
virtual ~CurlGridFunctionCoefficient()
void SetExponent(double p_)
Reset the exponent.
Scalar coefficient which returns the y-component of the evaluation point.
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().
Coefficient * GetACoef() const
Return the first term in the linear combination.
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.
double GetAConst() const
Return the scalar factor.
Vector coefficient defined as the linear combination of two vectors.
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.
void SetConstant(double constant)
Set this vector to the given constant.
int operator &(CoefficientStorage a, CoefficientStorage b)
CartesianZCoefficient CylindricalZCoefficient
virtual ~VectorGridFunctionCoefficient()
virtual void Eval(DenseSymmetricMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
VectorCoefficient * GetBCoef() const
Return the second vector coefficient.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
A DeltaFunction cannot be evaluated. Calling this method will cause an MFEM error, terminating the application.
int GetVDim() const
For backward compatibility get the width of the matrix.
virtual void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
Coefficient * GetBCoef() const
Return the denominator of the ratio.
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)
VectorCoefficient * GetKCoef() const
Return the vector factor.
void SetTime(double t)
Set the time for internally stored coefficients.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
MatrixFunctionCoefficient(int dim, std::function< void(const Vector &, DenseMatrix &)> F, Coefficient *q=nullptr)
Define a time-independent square matrix coefficient from a std function.
int GetWidth() const
Get the width of the matrix.
const Vector & GetA() const
Return the first vector constant.
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.
Class to represent a coefficient evaluated at quadrature points.
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.
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...
const QuadratureFunction & GetQuadFunction() const
void ZeroCoefficient(int attr)
Remove a single VectorCoefficient for a particular attribute.
virtual void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
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.
RatioCoefficient(double A, Coefficient &B)
std::function< double(const Vector &)> f(double mass_coeff)
void Project(Coefficient &coeff)
Evaluate the given Coefficient at the quadrature points defined by qs.
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.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
Coefficient * GetACoef() const
Return the first term in the product.
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.
const GridFunction * GetGridFunction() const
Returns a pointer to the grid function in this Coefficient.
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...
virtual ~SymmetricMatrixFunctionCoefficient()
InnerProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Construct with the two vector coefficients. Result is .
void SetTime(double t)
Set the time for internally stored coefficients.
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.
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.
VectorConstantCoefficient(const Vector &v)
Construct the coefficient with constant vector v.
ConstantCoefficient(double c=1.0)
c is value of constant function
void SetTime(double t)
Set the time for internally stored coefficients.
void SetBCoef(VectorCoefficient &B)
Reset the vector coefficient.
Store constants using only vdim entries.
void SetBCoef(VectorCoefficient &B)
Reset the second vector in the outer product.
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.
void SetA(const Vector &A_)
Reset the first vector as a constant.
VectorCoefficient * GetACoef() const
Return the first vector coefficient.
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.
VectorCoefficient * GetBCoef() const
Return the second vector of the product.
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.
MatrixRestrictedCoefficient(MatrixCoefficient &mc, Array< int > &attr)
Construct with a parent matrix coefficient and an array of zeros and ones representing the attributes...
void UpdateCoefficients(const Array< int > &attr, const Array< MatrixCoefficient *> &coefs)
Replace a set of coefficients.
std::function< double(const Vector &)> Function
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
Enable all above compressions.
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 .
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.
PWMatrixCoefficient(int dim, const Array< int > &attr, const Array< MatrixCoefficient *> &coefs, bool symm=false)
Construct the coefficient using arrays describing the pieces.
double GetBeta() const
Return the factor in front of the second matrix coefficient.
void MakeRef(const QuadratureFunction &qf_)
Make this vector a reference to the given QuadratureFunction.
virtual ~DeltaCoefficient()
MatrixCoefficient * GetBCoef() const
Return the second matrix coefficient.
SphericalAzimuthalCoefficient()
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
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.
double GetAlpha() const
Return the factor in front of the first 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.
MatrixCoefficient * GetACoef() const
Return the first matrix coefficient.
Store the triangular part of symmetric matrices.
int GetVDim()
Returns dimension of the vector.
VectorCoefficient * GetBCoef() const
Return the second vector coefficient in the inner product.
VectorCoefficient * GetBCoef() const
Return the second vector coefficient in the outer product.
VectorCoefficient * GetACoef() const
Return the first term in the product.
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 * GetBCoef() const
Return the vector coefficient.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
void SetACoef(VectorCoefficient &A)
Reset the first term in the product.
SphericalRadialCoefficient()
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 ...
VectorCoefficient * GetACoef() const
Return the first vector of the product.
const GridFunction * GridFunc
virtual ~VectorQuadratureFunctionCoefficient()
Coefficient * GetACoef() const
Return the numerator of the ratio.
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.
void SetComponent(int index_, int length_)
void SetBCoef(VectorCoefficient &B)
Reset the vector factor.
virtual ~PositionVectorCoefficient()
void operator=(double c)
Set the constants for all attributes to constant c.
VectorCoefficient DiagonalMatrixCoefficient
A general vector function coefficient.
Abstract base class for QuadratureSpace and FaceQuadratureSpace.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
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.
int GetVDim() const
Return the number of values per quadrature point.
MatrixVectorProductCoefficient MatVecCoefficient
Convenient alias for the MatrixVectorProductCoefficient.
virtual void ProjectSymmetric(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
void SetACoef(Coefficient &A)
Reset the base coefficient.
void SetACoef(MatrixCoefficient &A)
Reset the matrix coefficient.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
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.
Coefficient * GetACoef() const
Return the scalar factor.
Coefficient * GetBCoef() const
Return the second term in the linear combination.
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...
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.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
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.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
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.
CoefficientStorage storage
Storage optimizations (see CoefficientStorage).
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
Coefficient * GetCoeff(int i)
Returns i'th coefficient.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
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 as ...
SphericalPolarCoefficient()
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.
CylindricalRadialCoefficient()
const GridFunction * GridFunc
double GetExponent() const
Return the exponent.
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.
Coefficient * GetACoef() const
Return the scalar factor.
PowerCoefficient(Coefficient &A, double p_)
Construct with a coefficient and a constant power p_. Result is A^p.
MatrixCoefficient * GetBCoef() const
Return the matrix factor.
PWMatrixCoefficient(int h, int w, bool symm=false)
Constructs a piecewise matrix coefficient of dimension h by w.
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()
double GetAlpha() const
Return the factor in front of the first matrix coefficient.
Derived matrix coefficient that has the value of the parent matrix coefficient where it is active and...
virtual void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
virtual ~SymmetricMatrixCoefficient()
virtual void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
Vector coefficient defined by a scalar DeltaCoefficient and a constant vector direction.
VectorCoefficient * GetBCoef() const
Return the vector factor.
PWCoefficient()
Constructs a piecewise coefficient.
PWVectorCoefficient(int vd, const Array< int > &attr, const Array< VectorCoefficient *> &coefs)
Construct the coefficient using arrays describing the pieces.
Store the coefficient as a full QuadratureFunction.
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.
Coefficient * GetACoef() const
Return the base coefficient.
Class for integration point with weight.
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.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the scalar divergence coefficient at ip.
void SetAlpha(double alpha_)
Reset the factor in front of the first vector coefficient as a constant.
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.
CylindricalAzimuthalCoefficient()
Scalar coefficient which returns the x-component of the evaluation point.
void ProjectTranspose(MatrixCoefficient &coeff)
Project the transpose of coeff.
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.
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
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.
const GridFunction * GetGridFunction() const
Get the internal GridFunction.
void SetACoef(VectorCoefficient &A)
Reset the first vector in the product.
const DenseSymmetricMatrix & GetMatrix()
Return a reference to the constant matrix.
VectorCoefficient * GetACoef() const
Return the first vector coefficient in the outer product.
QuadratureFunction * qf
Internal QuadratureFunction (owned, may be NULL).
void UpdateCoefficients(const Array< int > &attr, const Array< Coefficient *> &coefs)
Replace a set of coefficients.
Coefficient * GetBetaCoef() const
Return the factor in front of the second vector coefficient.
double GetAConst() const
Return the scalar factor.
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 Copy(Array ©) const
Create a copy of the internal array to the provided copy.
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...
constexpr int dimension
This example only works in 3D. Kernels for 2D are not implemented.
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.
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.
const GridFunction * GetGridFunction() const
Get the vector grid function.
Coefficient * GetAlphaCoef() const
Return the factor in front of the first vector coefficient.
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 void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
const GridFunction * GetGridFunction() const
Get the vector grid function.
double GetBeta() const
Return the factor in front of the second term in the linear combination.
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.
DenseSymmetricMatrix mat
Internal matrix used when evaluating this coefficient as a DenseMatrix.
CartesianCoefficient(int comp_)
comp_ index of the desired component (0 -> x, 1 -> y, 2 -> z)
MatrixCoefficient * GetACoef() const
Return the matrix coefficient.
Scalar coefficient defined as the determinant of a matrix coefficient.
Scalar coefficient which returns the z-component of the evaluation point.
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 Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
double GetBConst() const
Return the denominator of the ratio.
GridFunctionCoefficient(const GridFunction *gf, int comp=1)
virtual void Project(QuadratureFunction &qf, bool transpose=false)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points. The matrix will be transposed or not according to the boolean argument transpose.
Vector coefficient defined by a vector GridFunction.
VectorCoefficient * GetACoef() const
Return the vector coefficient.
Coefficient * GetBCoef() const
Return the second term in the product.
void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf with the constant value.
const Vector & GetB() const
Return the second vector constant.
CoefficientVector(QuadratureSpaceBase &qs_, CoefficientStorage storage_=CoefficientStorage::FULL)
Create an empty CoefficientVector.
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.
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
QuadratureSpaceBase & qs
Associated QuadratureSpaceBase.
void SetAlpha(double alpha_)
Reset the factor in front of the first term in the linear combination.
Constant matrix coefficient defined as the identity of dimension d.
virtual void EvalSymmetric(Vector &K, ElementTransformation &T, const IntegrationPoint &ip)
(DEPRECATED) Evaluate the symmetric matrix coefficient at ip.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient at ip.
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.
double GetBeta() const
Return the factor in front of the second vector coefficient.
void SetTime(double t)
Set the time for internally stored coefficients.
virtual ~VectorDeltaCoefficient()
double GetAConst() const
Return the scalar factor.
void SetACoef(MatrixCoefficient &A)
Reset the first matrix coefficient.
Class for parallel meshes.
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.
VectorCoefficient * GetACoef() const
Return the first vector coefficient in the inner product.
Represents values or vectors of values at quadrature points on a mesh.
void SetTime(double t)
Set the time for internally stored coefficients.
void UpdateCoefficients(const Array< int > &attr, const Array< VectorCoefficient *> &coefs)
Replace a set of 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.
double GetAConst() const
Return the numerator of the ratio.
void SetACoef(Coefficient &A)
Reset the first term in the linear combination.
double GetAlpha() const
Return the factor in front of the first term in the linear combination.
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.
VectorCoefficient * GetBCoef() const
Return the second term in the product.
Coefficient * GetACoef() const
Return the scalar factor.
PositionVectorCoefficient(int dim)
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.