73 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
81 real_t minDist = std::numeric_limits<real_t>::max();
85 for (
int i = 0; i < npts; ++i)
100 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
105 real_t minDist = std::numeric_limits<real_t>::max();
111 for (
int i = 0; i < npts; ++i)
136 case 0: os <<
", ";
break;
137 case 1: os <<
"Newton: ";
break;
138 case 2: os <<
" ";
break;
143 case 0: os <<
"iter = " << std::setw(2) << int(val);
break;
144 case 1: os <<
"delta_ref = " << std::setw(11) << val;
break;
145 case 2: os <<
" err_phys = " << std::setw(11) << val;
break;
152 case 1: os <<
'\n';
break;
153 case 2: os <<
" (converged)\n";
break;
154 case 3: os <<
" (actual)\n";
break;
164 os << prefix <<
" = (";
165 for (
int j = 0; j < pt.
Size(); j++)
167 os << (j > 0 ?
", " :
"") << pt(j);
183 real_t xd[3], yd[3], dxd[3], dx_norm = -1.0, err_phys, real_dx_norm = -1.0;
185 bool hit_bdr =
false, prev_hit_bdr =
false;
196 for (
int it = 0;
true; )
223 err_phys = y.Normlinf();
224 if (err_phys < phys_tol)
258 if (prev_hit_bdr && real_dx_norm <
ref_tol)
269 mfem::out <<
"Newton: *** stuck on boundary!\n";
286 prev_hit_bdr = hit_bdr;
298 default: MFEM_ABORT(
"invalid solver type");
330 mfem::out <<
"Newton: *** iteration did not converge!\n";
339 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
371 MFEM_ABORT(
"invalid initial guess type");
393 MFEM_ABORT(
"unknown Geometry::Type!");
396 int dof = FElem->
GetDof();
399 for (
int j = 0; j < dof; j++)
406const DenseMatrix &IsoparametricTransformation::EvalJacobian()
412 if (dshape.
Width() > 0)
422const DenseMatrix &IsoparametricTransformation::EvalHessian()
426 int Dim = FElem->
GetDim();
429 if (d2shape.
Width() > 0)
441 switch (FElem->
Space())
448 MFEM_ABORT(
"unsupported finite element");
455 switch (FElem->
Space())
462 MFEM_ABORT(
"unsupported finite element");
477 return ((k-1)*(d-1)+(l-1));
479 return (k*(d-1)+(l-1));
481 MFEM_ABORT(
"unsupported finite element");
484 MFEM_ABORT(
"incompatible finite elements");
491 MFEM_ASSERT(FElem !=
nullptr,
"Must provide a valid FiniteElement object!");
495 FElem -> CalcShape(ip, shape);
502 int dof, n,
dim, i, j, k;
511 for (j = 0; j < n; j++)
513 FElem -> CalcShape (ir.
IntPoint(j), shape);
514 for (i = 0; i <
dim; i++)
517 for (k = 0; k < dof; k++)
519 tr(i, j) += PointMat(i, k) * shape(k);
534 for (
int j = 0; j < matrix.
Width(); j++)
559 for (i = 0; i < n; i++)
590 MFEM_VERIFY(mask &
HAVE_ELEM1 &&
Elem1 != NULL,
"The ElementTransformation "
591 "for the element has not been configured for side 1.");
598 MFEM_VERIFY(mask &
HAVE_ELEM2 &&
Elem2 != NULL,
"The ElementTransformation "
599 "for the element has not been configured for side 2.");
606 MFEM_VERIFY(mask &
HAVE_LOC1,
"The IntegrationPointTransformation "
607 "for the element has not been configured for side 1.");
614 MFEM_VERIFY(mask &
HAVE_LOC2,
"The IntegrationPointTransformation "
615 "for the element has not been configured for side 2.");
622 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
623 "for the face has not been configured.");
630 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
631 "for the face has not been configured.");
638 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
639 "for the face has not been configured.");
652 const bool have_face = (mask & 16);
653 const bool have_el1 = (mask & 1) && (mask & 4);
654 const bool have_el2 = (mask & 2) && (mask & 8) && (
Elem2No >= 0);
655 if (
int(have_face) + int(have_el1) + int(have_el2) < 2)
672 os <<
"\nface vertex coordinates (from face transform):\n"
673 <<
"----------------------------------------------\n";
683 os <<
"\nface vertex coordinates (from element 1 transform):\n"
684 <<
"---------------------------------------------------\n";
689 coords_el -= coords_base;
690 coords_el.
Norm2(dist);
691 max_dist = std::max(max_dist, dist.
Normlinf());
695 coords_base = coords_el;
704 os <<
"\nface vertex coordinates (from element 2 transform):\n"
705 <<
"---------------------------------------------------\n";
708 coords_el -= coords_base;
709 coords_el.
Norm2(dist);
710 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.
RefinedGeometry * Refine(Geometry::Type Geom, int Times, int ETimes=1)
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)
class LinearPyramidFiniteElement PyramidFE
MFEM_EXPORT Linear2DFiniteElement TriangleFE