31 Mesh &fine_mesh = *T.mesh;
34 int fine_element = T.ElementNo;
36 int coarse_element = cf.
embeddings[fine_element].parent;
54 const int ne = qspace.
GetNE();
56 for (
int iel = 0; iel < ne; ++iel)
61 for (
int iq = 0; iq < ir.
Size(); ++iq)
66 values[iq_p] = Eval(T, ip);
79 int att = T.Attribute;
80 return (constants(att-1));
83 void PWCoefficient::InitMap(
const Array<int> & attr,
86 MFEM_VERIFY(attr.
Size() == coefs.
Size(),
88 "Attribute and coefficient arrays have incompatible " 91 for (
int i=0; i<attr.
Size(); i++)
95 UpdateCoefficient(attr[i], *coefs[i]);
104 std::map<int, Coefficient*>::iterator
p = pieces.begin();
105 for (;
p != pieces.end();
p++)
107 if (
p->second != NULL)
109 p->second->SetTime(
t);
117 const int att = T.Attribute;
118 std::map<int, Coefficient*>::const_iterator
p = pieces.find(att);
119 if (
p != pieces.end())
121 if (
p->second != NULL)
123 return p->second->Eval(T, ip);
135 T.Transform(ip, transip);
139 return Function(transip);
143 return TDFunction(transip, GetTime());
150 Mesh *gf_mesh = GridF->FESpace()->GetMesh();
151 if (T.mesh == gf_mesh)
153 return GridF->GetValue(T, ip, Component);
159 return GridF->GetValue(*coarse_T, coarse_ip, Component);
170 if (Q1) { Q1->SetTime(
t); }
171 if (Q2) { Q2->SetTime(
t); }
180 return (*Transform2)(Q1->Eval(T, ip, GetTime()),
181 Q2->Eval(T, ip, GetTime()));
185 return (*Transform1)(Q1->Eval(T, ip, GetTime()));
191 if (weight) { weight->SetTime(
t); }
197 MFEM_VERIFY(vcenter.
Size() <= 3,
198 "SetDeltaCenter::Maximum number of dim supported is 3")
199 for (
int i = 0; i < vcenter.
Size(); i++) { center[i] = vcenter[i]; }
200 sdim = vcenter.
Size();
213 return weight ? weight->Eval(T, ip, GetTime())*w : w;
218 if (c) { c->SetTime(
t); }
238 MFEM_VERIFY(vdim == qf.
GetVDim(),
"Wrong sizes.");
240 const int ne = qspace.
GetNE();
243 for (
int iel = 0; iel < ne; ++iel)
248 for (
int iq = 0; iq < ir.
Size(); ++iq)
252 const int iq_p = qspace.GetPermutedIndex(iel, iq);
259 void PWVectorCoefficient::InitMap(
const Array<int> & attr,
262 MFEM_VERIFY(attr.
Size() == coefs.
Size(),
263 "PWVectorCoefficient: " 264 "Attribute and coefficient arrays have incompatible " 267 for (
int i=0; i<attr.
Size(); i++)
269 if (coefs[i] != NULL)
271 UpdateCoefficient(attr[i], *coefs[i]);
278 MFEM_VERIFY(coef.
GetVDim() == vdim,
279 "PWVectorCoefficient::UpdateCoefficient: " 280 "VectorCoefficient has incompatible dimension.");
281 pieces[attr] = &coef;
288 std::map<int, VectorCoefficient*>::iterator
p = pieces.begin();
289 for (;
p != pieces.end();
p++)
291 if (
p->second != NULL)
293 p->second->SetTime(
t);
301 const int att = T.Attribute;
302 std::map<int, VectorCoefficient*>::const_iterator
p = pieces.find(att);
303 if (
p != pieces.end())
305 if (
p->second != NULL)
307 p->second->Eval(V, T, ip);
322 T.Transform(ip, transip);
327 Function(transip, V);
331 TDFunction(transip, GetTime(), V);
335 V *= Q->Eval(T, ip, GetTime());
342 for (
int i = 0; i <
dim; i++)
351 for (
int i = 0; i <
vdim; i++)
353 if (Coeff[i]) { Coeff[i]->SetTime(
t); }
360 if (ownCoeff[i]) {
delete Coeff[i]; }
367 for (
int i = 0; i <
vdim; i++)
369 if (ownCoeff[i]) {
delete Coeff[i]; }
377 for (
int i = 0; i <
vdim; i++)
379 V(i) = this->
Eval(i, T, ip);
399 if (T.mesh == gf_mesh)
432 gf -> FESpace() ->
GetMesh() -> SpaceDimension() : 0)
440 gf -> FESpace() ->
GetMesh() -> SpaceDimension() : 0;
447 if (T.mesh == gf_mesh)
488 if (T.mesh == gf_mesh)
510 if (T.mesh == gf_mesh)
552 if (active_attr[T.Attribute-1])
566 if (active_attr[T.Attribute-1])
582 const int ne = qspace.
GetNE();
584 for (
int iel = 0; iel < ne; ++iel)
589 for (
int iq = 0; iq < ir.
Size(); ++iq)
593 const int iq_p = qspace.GetPermutedIndex(iel, iq);
601 void PWMatrixCoefficient::InitMap(
const Array<int> & attr,
604 MFEM_VERIFY(attr.
Size() == coefs.
Size(),
605 "PWMatrixCoefficient: " 606 "Attribute and coefficient arrays have incompatible " 609 for (
int i=0; i<attr.
Size(); i++)
611 if (coefs[i] != NULL)
621 "PWMatrixCoefficient::UpdateCoefficient: " 622 "MatrixCoefficient has incompatible height.");
624 "PWMatrixCoefficient::UpdateCoefficient: " 625 "MatrixCoefficient has incompatible width.");
629 "PWMatrixCoefficient::UpdateCoefficient: " 630 "MatrixCoefficient has incompatible symmetry.");
632 pieces[attr] = &coef;
639 std::map<int, MatrixCoefficient*>::iterator
p = pieces.begin();
640 for (;
p != pieces.end();
p++)
642 if (
p->second != NULL)
644 p->second->SetTime(
t);
652 const int att = T.Attribute;
653 std::map<int, MatrixCoefficient*>::const_iterator
p = pieces.find(att);
654 if (
p != pieces.end())
656 if (
p->second != NULL)
658 p->second->Eval(K, T, ip);
679 T.Transform(ip, transip);
686 "MatrixFunctionCoefficient is not symmetric");
690 SymmFunction(transip, Ksym);
694 for (
int i=0; i<
height; ++i)
696 for (
int j=i; j<
width; ++j)
698 const double Kij = Ksym[j - i + os];
700 if (j != i) { K(j,i) = Kij; }
710 Function(transip, K);
714 TDFunction(transip,
GetTime(), K);
733 "MatrixFunctionCoefficient is not symmetric");
738 T.Transform(ip, transip);
744 SymmFunction(transip, K);
756 MFEM_VERIFY(vdim ==
height*(
height+1)/2,
"Wrong sizes.");
759 const int ne = qspace.
GetNE();
762 for (
int iel = 0; iel < ne; ++iel)
767 for (
int iq = 0; iq < ir.
Size(); ++iq)
783 for (
int j = 0; j <
width; ++j)
785 for (
int i = 0; i <
height; ++ i)
805 T.Transform(ip, transip);
811 Function(transip, K);
815 TDFunction(transip,
GetTime(), K);
844 if (Coeff[i]) { Coeff[i]->SetTime(
t); }
851 if (ownCoeff[i*
width+j]) {
delete Coeff[i*
width+j]; }
852 Coeff[i*
width+j] = c;
853 ownCoeff[i*
width+j] = own;
860 if (ownCoeff[i]) {
delete Coeff[i]; }
868 for (
int i = 0; i <
height; i++)
870 for (
int j = 0; j <
width; j++)
872 K(i,j) = this->
Eval(i, j, T, ip);
886 if (active_attr[T.Attribute-1])
927 :
a(&A),
b(&B), va(A.GetVDim()), vb(B.GetVDim())
930 "InnerProductCoefficient: " 931 "Arguments have incompatible dimensions.");
951 :
a(&A),
b(&B), va(A.GetVDim()), vb(B.GetVDim())
954 "VectorRotProductCoefficient: " 955 "Arguments must have dimension equal to two.");
970 return va[0] * vb[1] - va[1] * vb[0];
974 :
a(&A), ma(A.GetHeight(), A.GetWidth())
977 "DeterminantCoefficient: " 978 "Argument must be a square matrix.");
996 ACoef(NULL), BCoef(NULL),
998 alphaCoef(NULL), betaCoef(NULL),
999 alpha(1.0), beta(1.0)
1006 double alpha_,
double beta_)
1008 ACoef(&A_), BCoef(&B_),
1009 A(A_.GetVDim()), B(A_.GetVDim()),
1010 alphaCoef(NULL), betaCoef(NULL),
1011 alpha(alpha_), beta(beta_)
1014 "VectorSumCoefficient: " 1015 "Arguments must have the same dimension.");
1023 ACoef(&A_), BCoef(&B_),
1028 alpha(0.0), beta(0.0)
1031 "VectorSumCoefficient: " 1032 "Arguments must have the same dimension.");
1039 if (alphaCoef) { alphaCoef->
SetTime(
t); }
1040 if (betaCoef) { betaCoef->
SetTime(
t); }
1048 if ( ACoef) { ACoef->
Eval(A, T, ip); }
1049 if ( BCoef) { BCoef->
Eval(B, T, ip); }
1050 if (alphaCoef) { alpha = alphaCoef->
Eval(T, ip); }
1051 if ( betaCoef) { beta = betaCoef->
Eval(T, ip); }
1052 add(alpha, A, beta, B, V);
1077 double sa = (a == NULL) ? aConst : a->
Eval(T, ip);
1098 V *= (nv > tol) ? (1.0/nv) : 0.0;
1107 "VectorCrossProductCoefficient: " 1108 "Arguments must have dimension equal to three.");
1124 V[0] = va[1] * vb[2] - va[2] * vb[1];
1125 V[1] = va[2] * vb[0] - va[0] * vb[2];
1126 V[2] = va[0] * vb[1] - va[1] * vb[0];
1132 ma(A.GetHeight(), A.GetWidth()), vb(B.GetVDim())
1135 "MatrixVectorProductCoefficient: " 1136 "Arguments have incompatible dimensions.");
1160 for (
int d=0; d<dim; d++) { M(d,d) = 1.0; }
1165 double alpha_,
double beta_)
1167 a(&A),
b(&B),
alpha(alpha_), beta(beta_),
1168 ma(A.GetHeight(), A.GetWidth())
1171 "MatrixSumCoefficient: " 1172 "Arguments must have the same dimensions.");
1186 if ( beta != 1.0 ) { M *= beta; }
1195 ma(A.GetHeight(), A.GetWidth()),
1196 mb(B.GetHeight(), B.GetWidth())
1199 "MatrixProductCoefficient: " 1200 "Arguments must have compatible dimensions.");
1234 double sa = (a == NULL) ? aConst : a->
Eval(T, ip);
1261 "InverseMatrixCoefficient: " 1262 "Argument must be a square matrix.");
1282 va(A.GetVDim()), vb(B.GetVDim())
1298 for (
int i=0; i<va.
Size(); i++)
1300 for (
int j=0; j<vb.
Size(); j++)
1302 M(i, j) = va[i] * vb[j];
1332 for (
int i=0; i<vk.Size(); i++)
1335 for (
int j=0; j<vk.Size(); j++)
1337 M(i, j) -= vk[i] * vk[j];
1340 M *= ((a == NULL ) ? aConst : a->
Eval(T, ip) );
1349 for (
int i = 0; i < mesh.
GetNE(); i++)
1357 double val = fabs(coeff.
Eval(*tr, ip));
1383 for (
int i = 0; i < mesh.
GetNE(); i++)
1391 coeff.
Eval(vval, *tr, ip);
1394 for (
int idim(0); idim < vdim; ++idim)
1396 norm += ip.
weight * tr->
Weight() * pow(fabs( vval(idim) ),
p);
1401 for (
int idim(0); idim < vdim; ++idim)
1403 val = fabs(vval(idim));
1426 norm = -pow(-norm, 1.0/
p);
1430 norm = pow(norm, 1.0/
p);
1447 norm = -pow(-norm, 1.0/
p);
1451 norm = pow(norm, 1.0/
p);
1462 double loc_norm =
LpNormLoop(
p, coeff, pmesh, irs);
1463 double glob_norm = 0;
1465 MPI_Comm comm = pmesh.
GetComm();
1469 MPI_Allreduce(&loc_norm, &glob_norm, 1, MPI_DOUBLE, MPI_SUM, comm);
1472 if (glob_norm < 0.0)
1474 glob_norm = -pow(-glob_norm, 1.0/
p);
1478 glob_norm = pow(glob_norm, 1.0/
p);
1483 MPI_Allreduce(&loc_norm, &glob_norm, 1, MPI_DOUBLE, MPI_MAX, comm);
1492 double loc_norm =
LpNormLoop(
p, coeff, pmesh, irs);
1493 double glob_norm = 0;
1495 MPI_Comm comm = pmesh.
GetComm();
1499 MPI_Allreduce(&loc_norm, &glob_norm, 1, MPI_DOUBLE, MPI_SUM, comm);
1502 if (glob_norm < 0.0)
1504 glob_norm = -pow(-glob_norm, 1.0/
p);
1508 glob_norm = pow(glob_norm, 1.0/
p);
1513 MPI_Allreduce(&loc_norm, &glob_norm, 1, MPI_DOUBLE, MPI_MAX, comm);
1526 MFEM_VERIFY(index_ >= 0,
"Index must be >= 0");
1527 MFEM_VERIFY(index_ < QuadF.
GetVDim(),
1528 "Index must be < QuadratureFunction length");
1531 MFEM_VERIFY(length_ > 0,
"Length must be > 0");
1533 "Length must be <= (QuadratureFunction length - index)");
1553 for (
int i = 0; i <
vdim; i++)
1555 V(i) = temp(index + i);
1570 MFEM_VERIFY(qf.
GetVDim() == 1,
"QuadratureFunction's vdim must be 1");
1590 :
Vector(), storage(storage_), vdim(0), qs(qs_), qf(NULL)
1637 if (
auto *const_coeff = dynamic_cast<ConstantCoefficient*>(&coeff))
1641 else if (
auto *qf_coeff = dynamic_cast<QuadratureFunctionCoefficient*>(&coeff))
1643 MakeRef(qf_coeff->GetQuadFunction());
1657 if (
auto *const_coeff = dynamic_cast<VectorConstantCoefficient*>(&coeff))
1661 else if (
auto *qf_coeff =
1662 dynamic_cast<VectorQuadratureFunctionCoefficient*>(&coeff))
1664 MakeRef(qf_coeff->GetQuadFunction());
1677 if (
auto *const_coeff = dynamic_cast<MatrixConstantCoefficient*>(&coeff))
1681 else if (
auto *const_sym_coeff =
1682 dynamic_cast<SymmetricMatrixConstantCoefficient*>(&coeff))
1691 const int width = coeff.
GetWidth();
1692 vdim = sym ? height*(height + 1)/2 : width*height;
1696 if (sym) { sym_coeff->ProjectSymmetric(*
qf); }
1711 MFEM_CONTRACT_VAR(qs2);
1712 MFEM_VERIFY(qs2 != NULL,
"Invalid QuadratureSpace.")
1731 for (
int iq = 0; iq < nq; ++iq)
1733 for (
int vd = 0; vd<
vdim; ++vd)
1735 (*this)[vd + iq*
vdim] = constant[vd];
1743 const int width = constant.
Width();
1744 const int height = constant.
Height();
1745 vdim = width*height;
1747 for (
int iq = 0; iq < nq; ++iq)
1749 for (
int j = 0; j < width; ++j)
1751 for (
int i = 0; i < height; ++i)
1753 (*this)[i + j*height + iq*
vdim] = constant(i, j);
1762 const int height = constant.
Height();
1764 vdim = sym ? height*(height + 1)/2 : height*height;
1766 for (
int iq = 0; iq < nq; ++iq)
1768 for (
int vd = 0; vd <
vdim; ++vd)
1770 const double value = sym ? constant.
GetData()[vd] : constant(vd % height,
1772 (*this)[vd + iq*
vdim] = value;
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
Flags that determine what storage optimizations to use in CoefficientVector.
int GetNPoints() const
Returns the number of the points in the integration rule.
int GetNE() const
Return the number of entities.
Class for an integration rule - an Array of IntegrationPoint.
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.
const GridFunction * GridFunc
void ProjectGridFunction(const GridFunction &gf)
Evaluate a grid function at each quadrature point.
virtual void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const
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...
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
const GridFunction * GridFunc
Base class for vector Coefficients that optionally depend on time and space.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector curl coefficient at ip.
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 ...
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.
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 SetSize(int s)
Change the size of the DenseSymmetricMatrix to s x s.
void SetSize(int s)
Resize the vector to size s.
MatrixVectorProductCoefficient(MatrixCoefficient &A, VectorCoefficient &B)
Constructor with two coefficients. Result is A*B.
double Eval(int i, ElementTransformation &T, const IntegrationPoint &ip)
void SetDeltaCenter(const Vector ¢er)
Set the center location of the delta function.
virtual const double * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
void SetTime(double t)
Set the time for internally stored coefficients.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void SetTime(double t)
Set the time for internally stored coefficients.
virtual int GetPermutedIndex(int idx, int iq) const =0
Returns the permuted index of the iq quadrature point in entity idx.
void SetTime(double t)
Set the time for internally stored coefficients.
double GetTime()
Get the time for time dependent coefficients.
void GetGradient(ElementTransformation &tr, Vector &grad) const
Gradient of a scalar function at a quadrature point.
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 ...
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void SetTime(double t)
Set the time for internally stored coefficients.
void SetTime(double t)
Set the time for internally stored coefficients.
int Size() const
Returns the size of the vector.
Data type dense matrix using column-major storage.
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...
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 void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
virtual ~MatrixArrayCoefficient()
void SetConstant(double constant)
Set this vector to the given constant.
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.
void SetTime(double t)
Set the time for internally stored coefficients.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
int GetWidth() const
Get the width of the matrix.
Class to represent a coefficient evaluated at quadrature points.
virtual ElementTransformation * GetTransformation(int idx)=0
Get the (element or face) transformation of entity idx.
void add(const Vector &v1, const Vector &v2, Vector &v)
DeterminantCoefficient(MatrixCoefficient &A)
Construct with the matrix.
ScalarMatrixProductCoefficient(double A, MatrixCoefficient &B)
Constructor with one coefficient. Result is A*B.
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.
void Project(Coefficient &coeff)
Evaluate the given Coefficient at the quadrature points defined by qs.
Vector & operator=(const double *v)
Copy Size() entries from v.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
double Eval(int i, int j, ElementTransformation &T, const IntegrationPoint &ip)
InnerProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Construct with the two vector coefficients. Result is .
void SetTime(double t)
Set the time for internally stored coefficients.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
void SetTime(double t)
Set the time for internally stored coefficients.
void SetTime(double t)
Set the time for internally stored coefficients.
void SetTime(double t)
Set the time for internally stored coefficients.
void SetTime(double t)
Set the time for internally stored coefficients.
void GetCurl(ElementTransformation &tr, Vector &curl) const
double ComputeLpNorm(double p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
Compute the Lp norm of a function f. .
void SetTime(double t)
Set the time for internally stored coefficients.
void SetTime(double t)
Set the time for internally stored coefficients.
Store constants using only vdim entries.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
double GetTime()
Get the time for time dependent coefficients.
ElementTransformation * RefinedToCoarse(Mesh &coarse_mesh, const ElementTransformation &T, const IntegrationPoint &ip, IntegrationPoint &coarse_ip)
double LpNormLoop(double p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
QuadratureFunctionCoefficient(QuadratureFunction &qf)
Constructor with a quadrature function as input.
void Add(const double c, const DenseMatrix &A)
Adds the matrix A multiplied by the number c to the matrix.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
int GetVDim() const
Get the vector dimension.
void UseExternalData(double *d, int s)
Change the data array and the size of the DenseSymmetricMatrix.
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 Invert()
Replaces the current matrix with its inverse.
void Set(int i, Coefficient *c, bool own=true)
Sets coefficient in the vector.
Mesh * GetMesh() const
Returns the mesh.
void MakeRef(const QuadratureFunction &qf_)
Make this vector a reference to the given QuadratureFunction.
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.
void SetVDim(int vdim_)
Set the vector dimension, updating the size by calling Vector::SetSize().
virtual ~VectorArrayCoefficient()
Destroys vector coefficient.
void SetTime(double t)
Set the time for internally stored coefficients.
void SetTime(double t)
Set the time for internally stored coefficients.
double * GetData() const
Returns the matrix data array.
void SetTime(double t)
Set the time for internally stored coefficients.
Store the triangular part of symmetric matrices.
double GetDivergence(ElementTransformation &tr) const
int GetVDim()
Returns dimension of the vector.
FiniteElementSpace * FESpace()
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
void Mult(const double *x, double *y) const
Matrix vector multiplication.
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 double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the determinant coefficient at ip.
void SetTime(double t)
Set the time for internally stored coefficients.
void SetComponent(int index_, int length_)
Abstract base class for QuadratureSpace and FaceQuadratureSpace.
void GetDeltaCenter(Vector ¢er)
Write the center of the delta function into center.
int GetVDim() const
Return the number of values per quadrature point.
virtual void ProjectSymmetric(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
Mesh * GetMesh() const
Returns the mesh.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
double p(const Vector &x, double t)
void SetGridFunction(const GridFunction *gf)
Set the scalar grid function.
void Transpose()
(*this) = (*this)^t
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
VectorQuadratureFunctionCoefficient(QuadratureFunction &qf)
Constructor with a quadrature function as input.
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 SetSize(int nsize)
Change the logical size of the array, keep existing entries.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
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.
void GetColumnReference(int c, Vector &col)
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 ...
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient at ip.
const IntegrationRule & GetIntRule(int idx) const
Return the IntegrationRule associated with entity idx.
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. .
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void GetValues(int idx, Vector &values)
Return all values associated with mesh element idx in a Vector.
virtual double EvalDelta(ElementTransformation &T, const IntegrationPoint &ip)
The value of the function assuming we are evaluating at the delta center.
const CoarseFineTransformations & GetRefinementTransforms()
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 void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
int GetNE() const
Returns number of elements.
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.
QuadratureSpaceBase * GetSpace()
Get the associated QuadratureSpaceBase object.
Class for integration point with weight.
Element::Type GetElementType(int i) const
Returns the type of element i.
void SetTime(double t)
Set the time for internally stored coefficients.
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 GetElementTransformation(int i, IsoparametricTransformation *ElTr)
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 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.
void SetDirection(const Vector &d_)
QuadratureFunction * qf
Internal QuadratureFunction (owned, may be NULL).
void GetGradients(ElementTransformation &tr, const IntegrationRule &ir, DenseMatrix &grad) const
Extension of GetGradient(...) for a collection of IntegrationPoints.
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...
int index(int i, int j, int nx, int ny)
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the matrix coefficient at ip.
double infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
double Norml2() const
Returns the l2 norm of the vector.
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.
void GetVectorValues(int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
virtual void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
int Size() const
Return the logical size of the array.
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.
DenseSymmetricMatrix mat
Internal matrix used when evaluating this coefficient as a DenseMatrix.
virtual bool UseDevice() const
Return the device flag of the Memory object used by the Vector.
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.
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
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.
void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf with the constant value.
CoefficientVector(QuadratureSpaceBase &qs_, CoefficientStorage storage_=CoefficientStorage::FULL)
Create an empty CoefficientVector.
void SetTime(double t)
Set the time for internally stored coefficients.
VectorRotProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Constructor with two vector coefficients. Result is .
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 UseExternalData(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
int GetSize() const
Return the total number of quadrature points.
virtual void EvalSymmetric(Vector &K, ElementTransformation &T, const IntegrationPoint &ip)
(DEPRECATED) Evaluate the symmetric matrix coefficient at ip.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
void SetTime(double t)
Set the time for internally stored coefficients.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
void SetTime(double t)
Set the time for internally stored coefficients.
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.
Represents values or vectors of values at quadrature points on a mesh.
void SetTime(double t)
Set the time for internally stored coefficients.
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.
int GetOrder() const
Return the order of the quadrature rule(s) used by all elements.
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.