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 T.Transform(ip, transip);
151 return transip[comp];
157 T.Transform(ip, transip);
158 return sqrt(transip[0] * transip[0] + transip[1] * transip[1]);
164 T.Transform(ip, transip);
165 return atan2(transip[1], transip[0]);
171 T.Transform(ip, transip);
172 return sqrt(transip * transip);
178 T.Transform(ip, transip);
179 return atan2(transip[1], transip[0]);
185 T.Transform(ip, transip);
186 return atan2(sqrt(transip[0] * transip[0] + transip[1] * transip[1]),
193 Mesh *gf_mesh = GridF->FESpace()->GetMesh();
194 if (T.mesh->GetNE() == gf_mesh->
GetNE())
196 return GridF->GetValue(T, ip, Component);
202 return GridF->GetValue(*coarse_T, coarse_ip, Component);
213 if (Q1) { Q1->SetTime(
t); }
214 if (Q2) { Q2->SetTime(
t); }
223 return (*Transform2)(Q1->Eval(T, ip, GetTime()),
224 Q2->Eval(T, ip, GetTime()));
228 return (*Transform1)(Q1->Eval(T, ip, GetTime()));
234 if (weight) { weight->SetTime(
t); }
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]; }
243 sdim = vcenter.
Size();
256 return weight ? weight->Eval(T, ip, GetTime())*w : w;
261 if (c) { c->SetTime(
t); }
281 MFEM_VERIFY(vdim == qf.
GetVDim(),
"Wrong sizes.");
283 const int ne = qspace.
GetNE();
286 for (
int iel = 0; iel < ne; ++iel)
291 for (
int iq = 0; iq < ir.
Size(); ++iq)
295 const int iq_p = qspace.GetPermutedIndex(iel, iq);
302 void 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)
314 UpdateCoefficient(attr[i], *coefs[i]);
321 MFEM_VERIFY(coef.
GetVDim() == vdim,
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);
344 const int att = T.Attribute;
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);
372 T.Transform(ip, transip);
377 Function(transip, V);
381 TDFunction(transip, GetTime(), V);
385 V *= Q->Eval(T, ip, GetTime());
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);
449 if (T.mesh->GetNE() == gf_mesh->
GetNE())
482 gf -> FESpace() ->
GetMesh() -> SpaceDimension() : 0)
490 gf -> FESpace() ->
GetMesh() -> SpaceDimension() : 0;
497 if (T.mesh->GetNE() == gf_mesh->
GetNE())
538 if (T.mesh->GetNE() == gf_mesh->
GetNE())
560 if (T.mesh->GetNE() == gf_mesh->
GetNE())
602 if (active_attr[T.Attribute-1])
616 if (active_attr[T.Attribute-1])
632 const int ne = qspace.
GetNE();
634 for (
int iel = 0; iel < ne; ++iel)
639 for (
int iq = 0; iq < ir.
Size(); ++iq)
643 const int iq_p = qspace.GetPermutedIndex(iel, iq);
651 void 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);
702 const int att = T.Attribute;
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);
729 T.Transform(ip, transip);
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 double 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");
788 T.Transform(ip, transip);
794 SymmFunction(transip, K);
806 MFEM_VERIFY(vdim ==
height*(
height+1)/2,
"Wrong sizes.");
809 const int ne = qspace.
GetNE();
812 for (
int iel = 0; iel < ne; ++iel)
817 for (
int iq = 0; iq < ir.
Size(); ++iq)
833 for (
int j = 0; j <
width; ++j)
835 for (
int i = 0; i <
height; ++ i)
855 T.Transform(ip, transip);
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);
936 if (active_attr[T.Attribute-1])
977 :
a(&A),
b(&B), va(A.GetVDim()), vb(B.GetVDim())
980 "InnerProductCoefficient: " 981 "Arguments have incompatible dimensions.");
1001 :
a(&A),
b(&B), va(A.GetVDim()), vb(B.GetVDim())
1004 "VectorRotProductCoefficient: " 1005 "Arguments must have dimension equal to two.");
1020 return va[0] * vb[1] - va[1] * vb[0];
1024 :
a(&A), ma(A.GetHeight(), A.GetWidth())
1027 "DeterminantCoefficient: " 1028 "Argument must be a square matrix.");
1046 ACoef(NULL), BCoef(NULL),
1048 alphaCoef(NULL), betaCoef(NULL),
1056 double alpha_,
double beta_)
1058 ACoef(&A_), BCoef(&B_),
1059 A(A_.GetVDim()), B(A_.GetVDim()),
1060 alphaCoef(NULL), betaCoef(NULL),
1064 "VectorSumCoefficient: " 1065 "Arguments must have the same dimension.");
1073 ACoef(&A_), BCoef(&B_),
1081 "VectorSumCoefficient: " 1082 "Arguments must have the same dimension.");
1089 if (alphaCoef) { alphaCoef->
SetTime(
t); }
1090 if (betaCoef) { betaCoef->
SetTime(
t); }
1098 if ( ACoef) { ACoef->
Eval(A, T, ip); }
1099 if ( BCoef) { BCoef->
Eval(B, T, ip); }
1100 if (alphaCoef) { alpha = alphaCoef->
Eval(T, ip); }
1101 if ( betaCoef) { beta = betaCoef->
Eval(T, ip); }
1102 add(alpha, A, beta, B, V);
1127 double sa = (a == NULL) ? aConst : a->
Eval(T, ip);
1148 V *= (nv > tol) ? (1.0/nv) : 0.0;
1157 "VectorCrossProductCoefficient: " 1158 "Arguments must have dimension equal to three.");
1174 V[0] = va[1] * vb[2] - va[2] * vb[1];
1175 V[1] = va[2] * vb[0] - va[0] * vb[2];
1176 V[2] = va[0] * vb[1] - va[1] * vb[0];
1182 ma(A.GetHeight(), A.GetWidth()), vb(B.GetVDim())
1185 "MatrixVectorProductCoefficient: " 1186 "Arguments have incompatible dimensions.");
1210 for (
int d=0; d<dim; d++) { M(d,d) = 1.0; }
1215 double alpha_,
double beta_)
1218 ma(A.GetHeight(), A.GetWidth())
1221 "MatrixSumCoefficient: " 1222 "Arguments must have the same dimensions.");
1236 if ( beta != 1.0 ) { M *= beta; }
1245 ma(A.GetHeight(), A.GetWidth()),
1246 mb(B.GetHeight(), B.GetWidth())
1249 "MatrixProductCoefficient: " 1250 "Arguments must have compatible dimensions.");
1284 double sa = (a == NULL) ? aConst : a->
Eval(T, ip);
1311 "InverseMatrixCoefficient: " 1312 "Argument must be a square matrix.");
1332 va(A.GetVDim()), vb(B.GetVDim())
1348 for (
int i=0; i<va.
Size(); i++)
1350 for (
int j=0; j<vb.
Size(); j++)
1352 M(i, j) = va[i] * vb[j];
1382 for (
int i=0; i<vk.Size(); i++)
1385 for (
int j=0; j<vk.Size(); j++)
1387 M(i, j) -= vk[i] * vk[j];
1390 M *= ((a == NULL ) ? aConst : a->
Eval(T, ip) );
1399 for (
int i = 0; i < mesh.
GetNE(); i++)
1407 double val = fabs(coeff.
Eval(*tr, ip));
1433 for (
int i = 0; i < mesh.
GetNE(); i++)
1441 coeff.
Eval(vval, *tr, ip);
1444 for (
int idim(0); idim < vdim; ++idim)
1446 norm += ip.
weight * tr->
Weight() * pow(fabs( vval(idim) ),
p);
1451 for (
int idim(0); idim < vdim; ++idim)
1453 val = fabs(vval(idim));
1476 norm = -pow(-norm, 1.0/
p);
1480 norm = pow(norm, 1.0/
p);
1497 norm = -pow(-norm, 1.0/
p);
1501 norm = pow(norm, 1.0/
p);
1512 double loc_norm =
LpNormLoop(
p, coeff, pmesh, irs);
1513 double glob_norm = 0;
1515 MPI_Comm comm = pmesh.
GetComm();
1519 MPI_Allreduce(&loc_norm, &glob_norm, 1, MPI_DOUBLE, MPI_SUM, comm);
1522 if (glob_norm < 0.0)
1524 glob_norm = -pow(-glob_norm, 1.0/
p);
1528 glob_norm = pow(glob_norm, 1.0/
p);
1533 MPI_Allreduce(&loc_norm, &glob_norm, 1, MPI_DOUBLE, MPI_MAX, comm);
1542 double loc_norm =
LpNormLoop(
p, coeff, pmesh, irs);
1543 double glob_norm = 0;
1545 MPI_Comm comm = pmesh.
GetComm();
1549 MPI_Allreduce(&loc_norm, &glob_norm, 1, MPI_DOUBLE, MPI_SUM, comm);
1552 if (glob_norm < 0.0)
1554 glob_norm = -pow(-glob_norm, 1.0/
p);
1558 glob_norm = pow(glob_norm, 1.0/
p);
1563 MPI_Allreduce(&loc_norm, &glob_norm, 1, MPI_DOUBLE, MPI_MAX, comm);
1576 MFEM_VERIFY(index_ >= 0,
"Index must be >= 0");
1577 MFEM_VERIFY(index_ < QuadF.
GetVDim(),
1578 "Index must be < QuadratureFunction length");
1581 MFEM_VERIFY(length_ > 0,
"Length must be > 0");
1583 "Length must be <= (QuadratureFunction length - index)");
1606 for (
int i = 0; i <
vdim; i++)
1608 V(i) = temp(index + i);
1623 MFEM_VERIFY(qf.
GetVDim() == 1,
"QuadratureFunction's vdim must be 1");
1645 :
Vector(), storage(storage_), vdim(0), qs(qs_), qf(NULL)
1692 if (
auto *const_coeff = dynamic_cast<ConstantCoefficient*>(&coeff))
1696 else if (
auto *qf_coeff = dynamic_cast<QuadratureFunctionCoefficient*>(&coeff))
1698 MakeRef(qf_coeff->GetQuadFunction());
1712 if (
auto *const_coeff = dynamic_cast<VectorConstantCoefficient*>(&coeff))
1716 else if (
auto *qf_coeff =
1717 dynamic_cast<VectorQuadratureFunctionCoefficient*>(&coeff))
1719 MakeRef(qf_coeff->GetQuadFunction());
1732 if (
auto *const_coeff = dynamic_cast<MatrixConstantCoefficient*>(&coeff))
1736 else if (
auto *const_sym_coeff =
1737 dynamic_cast<SymmetricMatrixConstantCoefficient*>(&coeff))
1746 const int width = coeff.
GetWidth();
1747 vdim = sym ? height*(height + 1)/2 : width*height;
1751 if (sym) { sym_coeff->ProjectSymmetric(*
qf); }
1766 MFEM_CONTRACT_VAR(qs2);
1767 MFEM_VERIFY(qs2 != NULL,
"Invalid QuadratureSpace.")
1786 for (
int iq = 0; iq < nq; ++iq)
1788 for (
int vd = 0; vd<
vdim; ++vd)
1790 (*this)[vd + iq*
vdim] = constant[vd];
1798 const int width = constant.
Width();
1799 const int height = constant.
Height();
1800 vdim = width*height;
1802 for (
int iq = 0; iq < nq; ++iq)
1804 for (
int j = 0; j < width; ++j)
1806 for (
int i = 0; i < height; ++i)
1808 (*this)[i + j*height + iq*
vdim] = constant(i, j);
1817 const int height = constant.
Height();
1819 vdim = sym ? height*(height + 1)/2 : height*height;
1821 for (
int iq = 0; iq < nq; ++iq)
1823 for (
int vd = 0; vd <
vdim; ++vd)
1825 const double value = sym ? constant.
GetData()[vd] : constant(vd % height,
1827 (*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.
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.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
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 double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
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 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)
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.
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.
void GetColumnReference(int c, Vector &col)
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 ...
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.
virtual int GetEntityIndex(const ElementTransformation &T) const =0
Returns the index in the quadrature space of the entity associated with the transformation T...
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.
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 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.