74 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
82 real_t minDist = std::numeric_limits<real_t>::max();
86 for (
int i = 0; i < npts; ++i)
101 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
106 real_t minDist = std::numeric_limits<real_t>::max();
112 for (
int i = 0; i < npts; ++i)
137 case 0: os <<
", ";
break;
138 case 1: os <<
"Newton: ";
break;
139 case 2: os <<
" ";
break;
144 case 0: os <<
"iter = " << std::setw(2) << int(val);
break;
145 case 1: os <<
"delta_ref = " << std::setw(11) << val;
break;
146 case 2: os <<
" err_phys = " << std::setw(11) << val;
break;
153 case 1: os <<
'\n';
break;
154 case 2: os <<
" (converged)\n";
break;
155 case 3: os <<
" (actual)\n";
break;
165 os << prefix <<
" = (";
166 for (
int j = 0; j < pt.
Size(); j++)
168 os << (j > 0 ?
", " :
"") << pt(j);
184 real_t xd[3], yd[3], dxd[3], dxpd[3], dx_norm = -1.0, err_phys,
187 bool hit_bdr =
false, prev_hit_bdr =
false;
198 for (
int it = 0;
true; )
225 err_phys = y.Normlinf();
226 if (err_phys < phys_tol)
255 real_dx_norm = dx.Normlinf();
260 if (prev_hit_bdr && real_dx_norm <
ref_tol)
271 mfem::out <<
"Newton: *** stuck on boundary!\n";
288 prev_hit_bdr = hit_bdr;
300 default: MFEM_ABORT(
"invalid solver type");
310 dx_norm = dx.Normlinf();
332 mfem::out <<
"Newton: *** iteration did not converge!\n";
341 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
386 for (
int i = 0; i < npts; ++i)
388 ip0 = ir.IntPoint(i);
409 MFEM_ABORT(
"invalid initial guess type");
431 MFEM_ABORT(
"unknown Geometry::Type!");
434 int dof = FElem->
GetDof();
437 for (
int j = 0; j < dof; j++)
439 nodes.IntPoint(j).Get(&PointMat(0,j),
dim);
444const DenseMatrix &IsoparametricTransformation::EvalJacobian()
450 if (dshape.
Width() > 0)
460const DenseMatrix &IsoparametricTransformation::EvalHessian()
464 int Dim = FElem->
GetDim();
467 if (d2shape.
Width() > 0)
479 switch (FElem->
Space())
488 MFEM_ABORT(
"unsupported finite element");
495 switch (FElem->
Space())
504 MFEM_ABORT(
"unsupported finite element");
519 return ((k-1)*(d-1)+(l-1));
521 return (k*(d-1)+(l-1));
523 return (k*(d-1)+(l-1));
525 MFEM_ABORT(
"unsupported finite element");
528 MFEM_ABORT(
"incompatible finite elements");
535 MFEM_ASSERT(FElem !=
nullptr,
"Must provide a valid FiniteElement object!");
539 FElem -> CalcShape(ip, shape);
546 int dof, n,
dim, i, j, k;
555 for (j = 0; j < n; j++)
557 FElem -> CalcShape (ir.
IntPoint(j), shape);
558 for (i = 0; i <
dim; i++)
561 for (k = 0; k < dof; k++)
563 tr(i, j) += PointMat(i, k) * shape(k);
578 for (
int j = 0; j < matrix.
Width(); j++)
603 for (i = 0; i < n; i++)
634 MFEM_VERIFY(mask &
HAVE_ELEM1 &&
Elem1 != NULL,
"The ElementTransformation "
635 "for the element has not been configured for side 1.");
642 MFEM_VERIFY(mask &
HAVE_ELEM2 &&
Elem2 != NULL,
"The ElementTransformation "
643 "for the element has not been configured for side 2.");
650 MFEM_VERIFY(mask &
HAVE_LOC1,
"The IntegrationPointTransformation "
651 "for the element has not been configured for side 1.");
658 MFEM_VERIFY(mask &
HAVE_LOC2,
"The IntegrationPointTransformation "
659 "for the element has not been configured for side 2.");
666 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
667 "for the face has not been configured.");
674 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
675 "for the face has not been configured.");
682 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
683 "for the face has not been configured.");
696 const bool have_face = (mask & 16);
697 const bool have_el1 = (mask & 1) && (mask & 4);
698 const bool have_el2 = (mask & 2) && (mask & 8) && (
Elem2No >= 0);
699 if (
int(have_face) + int(have_el1) + int(have_el2) < 2)
716 os <<
"\nface vertex coordinates (from face transform):\n"
717 <<
"----------------------------------------------\n";
727 os <<
"\nface vertex coordinates (from element 1 transform):\n"
728 <<
"---------------------------------------------------\n";
733 coords_el -= coords_base;
734 coords_el.
Norm2(dist);
735 max_dist = std::max(max_dist, dist.
Normlinf());
739 coords_base = coords_el;
748 os <<
"\nface vertex coordinates (from element 2 transform):\n"
749 <<
"---------------------------------------------------\n";
752 coords_el -= coords_base;
753 coords_el.
Norm2(dist);
754 max_dist = std::max(max_dist, dist.
Normlinf());
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 GetColumnReference(int c, Vector &col)
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual void PrintT(std::ostream &out=mfem::out, int width_=4) const
Prints the transpose matrix to stream out.
void GetColumn(int c, Vector &col) const
void Norm2(real_t *v) const
Take the 2-norm of the columns of A and store in v.
Abstract class for all finite elements.
virtual void CalcHessian(const IntegrationPoint &ip, DenseMatrix &Hessian) const
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
int GetDim() const
Returns the reference space dimension for the finite element.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
int Space() const
Returns the type of FunctionSpace on the element.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
@ Pk
Polynomials of order k.
@ Qk
Tensor products of polynomials of order k.
@ Uk
Rational polynomials of order k.
RefinedGeometry * Refine(Geometry::Type Geom, int Times, int ETimes=1)
const IntegrationRule * EdgeScan(Geometry::Type Geom, int NPts1d)
Get an integration rule which scans along the r/s/t=0 edges of the element.
const IntegrationPoint & GetCenter(int GeomType) const
Return the center of the given Geometry::Type, GeomType.
const IntegrationRule * GetVertices(int GeomType) const
Return an IntegrationRule consisting of all vertices of the given Geometry::Type, GeomType.
static bool CheckPoint(int GeomType, const IntegrationPoint &ip)
Check if the given point is inside the given reference element.
static bool ProjectPoint(int GeomType, const IntegrationPoint &beg, IntegrationPoint &end)
Project a point end, onto the given Geometry::Type, GeomType.
Class for integration point with weight.
void Get(real_t *p, const int dim) const
void Set(const real_t *p, const int dim)
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.
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().
real_t Normlinf() const
Returns the l_infinity norm of the vector.
real_t Norml2() const
Returns the l2 norm of the vector.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
real_t DistanceTo(const real_t *p) const
Compute the Euclidean distance to another vector.
void trans(const Vector &u, Vector &x)
Linear1DFiniteElement SegmentFE
PointFiniteElement PointFE
TriLinear3DFiniteElement HexahedronFE
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void CalcAdjugateTranspose(const DenseMatrix &a, DenseMatrix &adjat)
Calculate the transposed adjugate of a matrix (for NxN matrices, N=1,2,3)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
MFEM_EXPORT class Linear3DFiniteElement TetrahedronFE
MFEM_EXPORT class LinearWedgeFiniteElement WedgeFE
void CalcAdjugate(const DenseMatrix &a, DenseMatrix &adja)
BiLinear2DFiniteElement QuadrilateralFE
void subtract(const Vector &x, const Vector &y, Vector &z)
MFEM_EXPORT class LinearPyramidFiniteElement PyramidFE
MFEM_EXPORT Linear2DFiniteElement TriangleFE
std::array< int, NCMesh::MaxFaceNodes > nodes