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);
80 return (constants(att-1));
83void 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++)
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);
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);
158 return sqrt(transip[0] * transip[0] + transip[1] * transip[1]);
165 return atan2(transip[1], transip[0]);
172 return sqrt(transip * transip);
179 return atan2(transip[1], transip[0]);
186 return atan2(sqrt(transip[0] * transip[0] + transip[1] * transip[1]),
196 return GridF->
GetValue(T, ip, Component);
202 return GridF->
GetValue(*coarse_T, coarse_ip, Component);
240 MFEM_VERIFY(vcenter.
Size() <= 3,
241 "SetDeltaCenter::Maximum number of dim supported is 3")
242 for (
int i = 0; i < vcenter.
Size(); i++) {
center[i] = vcenter[i]; }
283 const int ne = qspace.
GetNE();
286 for (
int iel = 0; iel < ne; ++iel)
291 for (
int iq = 0; iq < ir.
Size(); ++iq)
302void PWVectorCoefficient::InitMap(
const Array<int> & attr,
305 MFEM_VERIFY(attr.
Size() == coefs.
Size(),
306 "PWVectorCoefficient: "
307 "Attribute and coefficient arrays have incompatible "
310 for (
int i=0; i<attr.
Size(); i++)
312 if (coefs[i] != NULL)
322 "PWVectorCoefficient::UpdateCoefficient: "
323 "VectorCoefficient has incompatible dimension.");
324 pieces[attr] = &coef;
331 std::map<int, VectorCoefficient*>::iterator
p = pieces.begin();
332 for (;
p != pieces.end();
p++)
334 if (
p->second != NULL)
336 p->second->SetTime(t);
345 std::map<int, VectorCoefficient*>::const_iterator
p = pieces.find(att);
346 if (
p != pieces.end())
348 if (
p->second != NULL)
350 p->second->Eval(V, T, ip);
377 Function(transip, V);
381 TDFunction(transip,
GetTime(), V);
392 for (
int i = 0; i <
dim; i++)
401 for (
int i = 0; i <
vdim; i++)
403 if (Coeff[i]) { Coeff[i]->SetTime(t); }
410 if (ownCoeff[i]) {
delete Coeff[i]; }
417 for (
int i = 0; i <
vdim; i++)
419 if (ownCoeff[i]) {
delete Coeff[i]; }
427 for (
int i = 0; i <
vdim; i++)
429 V(i) = this->
Eval(i, T, ip);
482 gf -> FESpace() ->
GetMesh() -> SpaceDimension() : 0)
490 gf -> FESpace() ->
GetMesh() -> SpaceDimension() : 0;
632 const int ne = qspace.
GetNE();
634 for (
int iel = 0; iel < ne; ++iel)
639 for (
int iq = 0; iq < ir.
Size(); ++iq)
651void PWMatrixCoefficient::InitMap(
const Array<int> & attr,
654 MFEM_VERIFY(attr.
Size() == coefs.
Size(),
655 "PWMatrixCoefficient: "
656 "Attribute and coefficient arrays have incompatible "
659 for (
int i=0; i<attr.
Size(); i++)
661 if (coefs[i] != NULL)
671 "PWMatrixCoefficient::UpdateCoefficient: "
672 "MatrixCoefficient has incompatible height.");
674 "PWMatrixCoefficient::UpdateCoefficient: "
675 "MatrixCoefficient has incompatible width.");
679 "PWMatrixCoefficient::UpdateCoefficient: "
680 "MatrixCoefficient has incompatible symmetry.");
682 pieces[attr] = &coef;
689 std::map<int, MatrixCoefficient*>::iterator
p = pieces.begin();
690 for (;
p != pieces.end();
p++)
692 if (
p->second != NULL)
694 p->second->SetTime(t);
703 std::map<int, MatrixCoefficient*>::const_iterator
p = pieces.find(att);
704 if (
p != pieces.end())
706 if (
p->second != NULL)
708 p->second->Eval(K, T, ip);
736 "MatrixFunctionCoefficient is not symmetric");
740 SymmFunction(transip, Ksym);
744 for (
int i=0; i<
height; ++i)
746 for (
int j=i; j<
width; ++j)
748 const real_t Kij = Ksym[j - i + os];
750 if (j != i) { K(j,i) = Kij; }
760 Function(transip, K);
764 TDFunction(transip,
GetTime(), K);
783 "MatrixFunctionCoefficient is not symmetric");
794 SymmFunction(transip, K);
806 MFEM_VERIFY(vdim ==
height*(
height+1)/2,
"Wrong sizes.");
809 const int ne = qspace.
GetNE();
813 for (
int iel = 0; iel < ne; ++iel)
818 for (
int iq = 0; iq < ir.
Size(); ++iq)
833 for (
int j = 0; j <
width; ++j)
835 for (
int i = 0; i <
height; ++ i)
861 Function(transip, K);
865 TDFunction(transip,
GetTime(), K);
894 if (Coeff[i]) { Coeff[i]->SetTime(t); }
901 if (ownCoeff[i*
width+j]) {
delete Coeff[i*
width+j]; }
902 Coeff[i*
width+j] = c;
903 ownCoeff[i*
width+j] = own;
910 if (ownCoeff[i]) {
delete Coeff[i]; }
918 for (
int i = 0; i <
height; i++)
920 for (
int j = 0; j <
width; j++)
922 K(i,j) = this->
Eval(i, j, T, ip);
932 for (
int i = 0; i <
height; i++)
941 for (
int i=0; i <
height; i++)
943 if (Coeff[i]) { Coeff[i]->SetTime(t); }
950 MFEM_ASSERT(i < height && i >= 0,
"Row "
951 << i <<
" does not exist. " <<
952 "Matrix height = " <<
height <<
".");
953 if (ownCoeff[i]) {
delete Coeff[i]; }
960 for (
int i=0; i <
height; i++)
962 if (ownCoeff[i]) {
delete Coeff[i]; }
970 MFEM_ASSERT(i < height && i >= 0,
"Row "
971 << i <<
" does not exist. " <<
972 "Matrix height = " <<
height <<
".");
975 Coeff[i] ->
Eval(V, T, ip);
989 for (
int i = 0; i <
height; i++)
991 this->
Eval(i, V, T, ip);
1046 :
a(&A),
b(&B), va(A.GetVDim()), vb(B.GetVDim())
1049 "InnerProductCoefficient: "
1050 "Arguments have incompatible dimensions.");
1070 :
a(&A),
b(&B), va(A.GetVDim()), vb(B.GetVDim())
1073 "VectorRotProductCoefficient: "
1074 "Arguments must have dimension equal to two.");
1089 return va[0] * vb[1] - va[1] * vb[0];
1093 :
a(&A), ma(A.GetHeight(), A.GetWidth())
1096 "DeterminantCoefficient: "
1097 "Argument must be a square matrix.");
1114 :
a(&A), ma(A.GetHeight(), A.GetWidth())
1117 "TraceCoefficient: "
1118 "Argument must be a square matrix.");
1136 ACoef(NULL), BCoef(NULL),
1138 alphaCoef(NULL), betaCoef(NULL),
1148 ACoef(&A_), BCoef(&B_),
1149 A(A_.GetVDim()), B(A_.GetVDim()),
1150 alphaCoef(NULL), betaCoef(NULL),
1154 "VectorSumCoefficient: "
1155 "Arguments must have the same dimension.");
1163 ACoef(&A_), BCoef(&B_),
1171 "VectorSumCoefficient: "
1172 "Arguments must have the same dimension.");
1177 if (ACoef) { ACoef->
SetTime(t); }
1178 if (BCoef) { BCoef->
SetTime(t); }
1179 if (alphaCoef) { alphaCoef->
SetTime(t); }
1180 if (betaCoef) { betaCoef->
SetTime(t); }
1188 if ( ACoef) { ACoef->
Eval(A, T, ip); }
1189 if ( BCoef) { BCoef->
Eval(B, T, ip); }
1190 if (alphaCoef) { alpha = alphaCoef->
Eval(T, ip); }
1191 if ( betaCoef) { beta = betaCoef->
Eval(T, ip); }
1192 add(alpha, A, beta, B, V);
1217 real_t sa = (a == NULL) ? aConst : a->
Eval(T, ip);
1238 V *= (nv > tol) ? (1.0/nv) : 0.0;
1247 "VectorCrossProductCoefficient: "
1248 "Arguments must have dimension equal to three.");
1264 V[0] = va[1] * vb[2] - va[2] * vb[1];
1265 V[1] = va[2] * vb[0] - va[0] * vb[2];
1266 V[2] = va[0] * vb[1] - va[1] * vb[0];
1272 ma(A.GetHeight(), A.GetWidth()), vb(B.GetVDim())
1275 "MatrixVectorProductCoefficient: "
1276 "Arguments have incompatible dimensions.");
1300 for (
int d=0; d<dim; d++) { M(d,d) = 1.0; }
1308 ma(A.GetHeight(), A.GetWidth())
1311 "MatrixSumCoefficient: "
1312 "Arguments must have the same dimensions.");
1326 if ( beta != 1.0 ) { M *= beta; }
1335 ma(A.GetHeight(), A.GetWidth()),
1336 mb(B.GetHeight(), B.GetWidth())
1339 "MatrixProductCoefficient: "
1340 "Arguments must have compatible dimensions.");
1374 real_t sa = (a == NULL) ? aConst : a->
Eval(T, ip);
1401 "InverseMatrixCoefficient: "
1402 "Argument must be a square matrix.");
1423 "ExponentialMatrixCoefficient: "
1424 <<
"Argument must be a square 2x2 matrix."
1446 va(A.GetVDim()), vb(B.GetVDim())
1462 for (
int i=0; i<va.
Size(); i++)
1464 for (
int j=0; j<vb.
Size(); j++)
1466 M(i, j) = va[i] * vb[j];
1496 for (
int i=0; i<vk.Size(); i++)
1499 for (
int j=0; j<vk.Size(); j++)
1501 M(i, j) -= vk[i] * vk[j];
1504 M *= ((a == NULL ) ? aConst : a->
Eval(T, ip) );
1513 for (
int i = 0; i < mesh.
GetNE(); i++)
1520 tr->SetIntPoint(&ip);
1524 norm += ip.
weight * tr->Weight() * pow(val,
p);
1547 for (
int i = 0; i < mesh.
GetNE(); i++)
1554 tr->SetIntPoint(&ip);
1555 coeff.
Eval(vval, *tr, ip);
1558 for (
int idim(0); idim < vdim; ++idim)
1560 norm += ip.
weight * tr->Weight() * pow(fabs( vval(idim) ),
p);
1565 for (
int idim(0); idim < vdim; ++idim)
1567 val = fabs(vval(idim));
1590 norm = -pow(-norm, 1.0/
p);
1594 norm = pow(norm, 1.0/
p);
1611 norm = -pow(-norm, 1.0/
p);
1615 norm = pow(norm, 1.0/
p);
1629 MPI_Comm comm = pmesh.
GetComm();
1637 if (glob_norm < 0.0)
1639 glob_norm = -pow(-glob_norm, 1.0/
p);
1643 glob_norm = pow(glob_norm, 1.0/
p);
1661 MPI_Comm comm = pmesh.
GetComm();
1669 if (glob_norm < 0.0)
1671 glob_norm = -pow(-glob_norm, 1.0/
p);
1675 glob_norm = pow(glob_norm, 1.0/
p);
1694 MFEM_VERIFY(index_ >= 0,
"Index must be >= 0");
1695 MFEM_VERIFY(index_ < QuadF.
GetVDim(),
1696 "Index must be < QuadratureFunction length");
1699 MFEM_VERIFY(length_ > 0,
"Length must be > 0");
1700 MFEM_VERIFY(length_ <= QuadF.
GetVDim() - index,
1701 "Length must be <= (QuadratureFunction length - index)");
1715 if (el_idx < 0) { V = 0.0;
return; }
1728 for (
int i = 0; i <
vdim; i++)
1730 V(i) = temp(index + i);
1745 MFEM_VERIFY(qf.
GetVDim() == 1,
"QuadratureFunction's vdim must be 1");
1756 if (el_idx < 0) {
return 0.0; }
1770 :
Vector(), storage(storage_), vdim(0), qs(qs_), qf(NULL)
1823 MakeRef(qf_coeff->GetQuadFunction());
1841 else if (
auto *qf_coeff =
1844 MakeRef(qf_coeff->GetQuadFunction());
1861 else if (
auto *const_sym_coeff =
1871 const int width = coeff.
GetWidth();
1872 vdim = sym ? height*(height + 1)/2 : width*height;
1876 if (sym) { sym_coeff->ProjectSymmetric(*
qf); }
1891 MFEM_CONTRACT_VAR(qs2);
1892 MFEM_VERIFY(qs2 != NULL,
"Invalid QuadratureSpace.")
1911 for (
int iq = 0; iq < nq; ++iq)
1913 for (
int vd = 0; vd<
vdim; ++vd)
1915 (*this)[vd + iq*
vdim] = constant[vd];
1923 const int width = constant.
Width();
1924 const int height = constant.
Height();
1925 vdim = width*height;
1927 for (
int iq = 0; iq < nq; ++iq)
1929 for (
int j = 0; j < width; ++j)
1931 for (
int i = 0; i < height; ++i)
1933 (*this)[i + j*height + iq*
vdim] = constant(i, j);
1942 const int height = constant.
Height();
1944 vdim = sym ? height*(height + 1)/2 : height*height;
1946 for (
int iq = 0; iq < nq; ++iq)
1948 for (
int vd = 0; vd <
vdim; ++vd)
1950 const real_t value = sym ? constant.
GetData()[vd] : constant(vd % height,
1952 (*this)[vd + iq*
vdim] = value;
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
Class to represent a coefficient evaluated at quadrature points.
void SetConstant(real_t constant)
Set this vector to the given constant.
int vdim
Number of values per quadrature point.
void Project(Coefficient &coeff)
Evaluate the given Coefficient at the quadrature points defined by qs.
int GetVDim() const
Return the number of values per quadrature point.
CoefficientVector(QuadratureSpaceBase &qs_, CoefficientStorage storage_=CoefficientStorage::FULL)
Create an empty CoefficientVector.
QuadratureFunction * qf
Internal QuadratureFunction (owned, may be NULL).
CoefficientStorage storage
Storage optimizations (see CoefficientStorage).
QuadratureSpaceBase & qs
Associated QuadratureSpaceBase.
void ProjectTranspose(MatrixCoefficient &coeff)
Project the transpose of coeff.
void MakeRef(const QuadratureFunction &qf_)
Make this vector a reference to the given QuadratureFunction.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
real_t GetTime()
Get the time for time dependent coefficients.
virtual void SetTime(real_t t)
Set the time for time dependent coefficients.
virtual void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
A coefficient that is constant across space and time.
void Project(QuadratureFunction &qf) override
Fill the QuadratureFunction qf with the constant value.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
CrossCrossCoefficient(real_t A, VectorCoefficient &K)
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
void SetGridFunction(const GridFunction *gf)
Set the vector grid function.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the vector curl coefficient at ip.
const GridFunction * GridFunc
CurlGridFunctionCoefficient(const GridFunction *gf)
Construct the coefficient with a vector grid function gf. The grid function is not owned by the coeff...
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
void GetDeltaCenter(Vector ¢er)
Write the center of the delta function into center.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
real_t Scale()
Return the scale factor times the optional time dependent function. Returns with when not set by th...
void SetDeltaCenter(const Vector ¢er)
Set the center location of the delta function.
virtual real_t EvalDelta(ElementTransformation &T, const IntegrationPoint &ip)
The value of the function assuming we are evaluating at the delta center.
Data type dense matrix using column-major storage.
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
void Transpose()
(*this) = (*this)^t
void SetRow(int r, const real_t *row)
void GetColumnReference(int c, Vector &col)
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
void Invert()
Replaces the current matrix with its inverse.
real_t Trace() const
Trace of a square matrix.
void UseExternalData(real_t *d, int h, int w)
Change the data array and the size of the DenseMatrix.
void Add(const real_t c, const DenseMatrix &A)
Adds the matrix A multiplied by the number c to the matrix.
void SetSize(int s)
Change the size of the DenseSymmetricMatrix to s x s.
void UseExternalData(real_t *d, int s)
Change the data array and the size of the DenseSymmetricMatrix.
real_t * GetData() const
Returns the matrix data array.
DeterminantCoefficient(MatrixCoefficient &A)
Construct with the matrix.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the determinant coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the scalar divergence coefficient at ip.
DivergenceGridFunctionCoefficient(const GridFunction *gf)
Construct the coefficient with a vector grid function gf. The grid function is not owned by the coeff...
const GridFunction * GridFunc
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
ExponentialMatrixCoefficient(MatrixCoefficient &A)
Construct the matrix coefficient. Result is .
Mesh * GetMesh() const
Returns the mesh.
std::function< real_t(const Vector &)> Function
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
std::function< real_t(const Vector &, real_t)> TDFunction
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the gradient vector coefficient at ip.
void SetGridFunction(const GridFunction *gf)
Set the scalar grid function.
GradientGridFunctionCoefficient(const GridFunction *gf)
Construct the coefficient with a scalar grid function gf. The grid function is not owned by the coeff...
const GridFunction * GridFunc
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
void Project(QuadratureFunction &qf) override
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
Class for grid function - Vector with associated FE space.
virtual real_t GetValue(int i, const IntegrationPoint &ip, int vdim=1) const
void GetGradients(ElementTransformation &tr, const IntegrationRule &ir, DenseMatrix &grad) const
Extension of GetGradient(...) for a collection of IntegrationPoints.
FiniteElementSpace * FESpace()
virtual void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const
real_t GetDivergence(ElementTransformation &tr) const
void GetCurl(ElementTransformation &tr, Vector &curl) const
void GetGradient(ElementTransformation &tr, Vector &grad) const
Gradient of a scalar function at a quadrature point.
void GetVectorValues(int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
InnerProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Construct with the two vector coefficients. Result is .
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
InverseMatrixCoefficient(MatrixCoefficient &A)
Construct with the matrix coefficient. Result is .
void SetTime(real_t t) override
Set the time for internally stored coefficients.
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...
MatrixArrayCoefficient(int dim)
Construct a coefficient matrix of dimensions dim * dim. The actual coefficients still need to be adde...
virtual ~MatrixArrayCoefficient()
real_t Eval(int i, int j, ElementTransformation &T, const IntegrationPoint &ip)
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void Eval(int i, Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
MatrixArrayVectorCoefficient(int dim)
Construct a coefficient matrix of dimensions dim * dim. The actual coefficients still need to be adde...
void SetTime(real_t t) override
Set the time for internally stored coefficients.
virtual ~MatrixArrayVectorCoefficient()
void Set(int i, VectorCoefficient *c, bool own=true)
Set the coefficient located at the i-th row of the matrix. By this will take ownership of the Coeffic...
Base class for Matrix Coefficients that optionally depend on time and space.
virtual void Project(QuadratureFunction &qf, bool transpose=false)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points....
virtual void SetTime(real_t t)
Set the time for time dependent coefficients.
real_t 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 ...
int GetWidth() const
Get the width of the matrix.
int GetHeight() const
Get the height of the matrix.
A matrix coefficient that is constant in space and time.
void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
void EvalSymmetric(Vector &K, ElementTransformation &T, const IntegrationPoint &ip) override
(DEPRECATED) Evaluate the symmetric matrix coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
MatrixProductCoefficient(MatrixCoefficient &A, MatrixCoefficient &B)
Construct with the two coefficients. Result is A * B.
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
MatrixSumCoefficient(MatrixCoefficient &A, MatrixCoefficient &B, real_t alpha_=1.0, real_t beta_=1.0)
Construct with the two coefficients. Result is alpha_ * A + beta_ * B.
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
MatrixVectorProductCoefficient(MatrixCoefficient &A, VectorCoefficient &B)
Constructor with two coefficients. Result is A*B.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the vector coefficient at ip.
Element::Type GetElementType(int i) const
Returns the type of element i.
const CoarseFineTransformations & GetRefinementTransforms() const
int GetNE() const
Returns number of elements.
void GetElementTransformation(int i, IsoparametricTransformation *ElTr) const
Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and wi...
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
NormalizedVectorCoefficient(VectorCoefficient &A, real_t tol=1e-6)
Return a vector normalized to a length of one.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void SetTime(real_t t) override
Set the time for internally stored coefficients.
OuterProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Construct with two vector coefficients. Result is .
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient.
void UpdateCoefficient(int attr, Coefficient &coef)
Replace a single Coefficient for a particular attribute.
void SetTime(real_t t) override
Set the time for time dependent coefficients.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient.
void UpdateCoefficient(int attr, MatrixCoefficient &coef)
Replace a single coefficient for a particular attribute.
void SetTime(real_t t) override
Set the time for time dependent coefficients.
void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient.
void UpdateCoefficient(int attr, VectorCoefficient &coef)
Replace a single Coefficient for a particular attribute.
void SetTime(real_t t) override
Set the time for time dependent coefficients.
Class for parallel meshes.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the vector coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
Quadrature function coefficient which requires that the quadrature rules used for this coefficient be...
void Project(QuadratureFunction &qf) override
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient in the element described by T at the point ip.
QuadratureFunctionCoefficient(const QuadratureFunction &qf)
Constructor with a quadrature function as input.
Represents values or vectors of values at quadrature points on a mesh.
void SetVDim(int vdim_)
Set the vector dimension, updating the size by calling Vector::SetSize().
QuadratureSpaceBase * GetSpace()
Get the associated QuadratureSpaceBase object.
void ProjectGridFunction(const GridFunction &gf)
Evaluate a grid function at each quadrature point.
void GetValues(int idx, Vector &values)
Return all values associated with mesh element idx in a Vector.
int GetVDim() const
Get the vector dimension.
Abstract base class for QuadratureSpace and FaceQuadratureSpace.
int GetNE() const
Return the number of entities.
virtual ElementTransformation * GetTransformation(int idx)=0
Get the (element or face) transformation of entity idx.
int GetSize() const
Return the total number of quadrature points.
const IntegrationRule & GetIntRule(int idx) const
Return the IntegrationRule associated with entity idx.
virtual int GetEntityIndex(const ElementTransformation &T) const =0
Returns the index in the quadrature space of the entity associated with the transformation T.
virtual int GetPermutedIndex(int idx, int iq) const =0
Returns the permuted index of the iq quadrature point in entity idx.
int GetOrder() const
Return the order of the quadrature rule(s) used by all elements.
Mesh * GetMesh() const
Returns the mesh.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
ScalarMatrixProductCoefficient(real_t A, MatrixCoefficient &B)
Constructor with one coefficient. Result is A*B.
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
ScalarVectorProductCoefficient(real_t A, VectorCoefficient &B)
Constructor with constant and vector coefficient. Result is A * B.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
Base class for symmetric matrix coefficients that optionally depend on time and space.
virtual void ProjectSymmetric(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
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 ...
DenseSymmetricMatrix mat_aux
Internal matrix used when evaluating this coefficient as a DenseMatrix.
A matrix coefficient that is constant in space and time.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void Eval(DenseSymmetricMatrix &K, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the trace coefficient at ip.
TraceCoefficient(MatrixCoefficient &A)
Construct with the matrix.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
TransposeMatrixCoefficient(MatrixCoefficient &A)
Construct with the matrix coefficient. Result is .
void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the matrix coefficient at ip.
virtual ~VectorArrayCoefficient()
Destroys vector coefficient.
VectorArrayCoefficient(int dim)
Construct vector of dim coefficients. The actual coefficients still need to be added with Set().
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void Set(int i, Coefficient *c, bool own=true)
Sets coefficient in the vector.
real_t Eval(int i, ElementTransformation &T, const IntegrationPoint &ip)
Base class for vector Coefficients that optionally depend on time and space.
int GetVDim()
Returns dimension of the vector.
virtual void SetTime(real_t t)
Set the time for time dependent coefficients.
real_t GetTime()
Get the time for time dependent coefficients.
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 void Project(QuadratureFunction &qf)
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
Vector coefficient that is constant in space and time.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
VectorCrossProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Construct with the two coefficients. Result is A x B.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void SetDirection(const Vector &d_)
virtual void EvalDelta(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Return the specified direction vector multiplied by the value returned by DeltaCoefficient::EvalDelta...
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the vector coefficient at ip.
void Project(QuadratureFunction &qf) override
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
void SetGridFunction(const GridFunction *gf)
Set the grid function for this coefficient. Also sets the Vector dimension to match that of the gf.
const GridFunction * GridFunc
VectorGridFunctionCoefficient()
Construct an empty coefficient. Calling Eval() before the grid function is set will cause a segfault.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the vector coefficient at ip.
Vector quadrature function coefficient which requires that the quadrature rules used for this vector ...
void Project(QuadratureFunction &qf) override
Fill the QuadratureFunction qf by evaluating the coefficient at the quadrature points.
VectorQuadratureFunctionCoefficient(const QuadratureFunction &qf)
Constructor with a quadrature function as input.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
void SetComponent(int index_, int length_)
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the vector coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
VectorRotProductCoefficient(VectorCoefficient &A, VectorCoefficient &B)
Constructor with two vector coefficients. Result is .
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient at ip.
void SetTime(real_t t) override
Set the time for internally stored coefficients.
VectorSumCoefficient(int dim)
virtual const real_t * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
real_t Norml2() const
Returns the l2 norm of the vector.
virtual bool UseDevice() const
Return the device flag of the Memory object used by the Vector.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
virtual real_t * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
Vector & operator=(const real_t *v)
Copy Size() entries from v.
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
int index(int i, int j, int nx, int ny)
real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
real_t ComputeGlobalLpNorm(real_t p, Coefficient &coeff, ParMesh &pmesh, const IntegrationRule *irs[])
Compute the global Lp norm of a function f. .
void add(const Vector &v1, const Vector &v2, Vector &v)
real_t ComputeLpNorm(real_t p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
Compute the Lp norm of a function f. .
CoefficientStorage
Flags that determine what storage optimizations to use in CoefficientVector.
@ SYMMETRIC
Store the triangular part of symmetric matrices.
@ CONSTANTS
Store constants using only vdim entries.
real_t LpNormLoop(real_t p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
ElementTransformation * RefinedToCoarse(Mesh &coarse_mesh, const ElementTransformation &T, const IntegrationPoint &ip, IntegrationPoint &coarse_ip)
real_t p(const Vector &x, real_t t)
Helper struct to convert a C++ type to an MPI type.