12 #include "../mesh/mesh_headers.hpp"
61 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
69 double minDist = std::numeric_limits<double>::max();
73 for (
int i = 0; i < npts; ++i)
75 double dist = pt.
DistanceTo(physPts.GetColumn(i));
88 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
93 double minDist = std::numeric_limits<double>::max();
99 for (
int i = 0; i < npts; ++i)
106 double dist = dr.Norml2();
124 case 0: out <<
", ";
break;
125 case 1: out <<
"Newton: ";
break;
126 case 2: out <<
" ";
break;
131 case 0: out <<
"iter = " << std::setw(2) << int(val);
break;
132 case 1: out <<
"delta_ref = " << std::setw(11) << val;
break;
133 case 2: out <<
" err_phys = " << std::setw(11) << val;
break;
140 case 1: out <<
'\n';
break;
141 case 2: out <<
" (converged)\n";
break;
142 case 3: out <<
" (actual)\n";
break;
152 out << prefix <<
" = (";
153 for (
int j = 0; j < pt.
Size(); j++)
155 out << (j > 0 ?
", " :
"") << pt(j);
157 out <<
')' << suffix;
171 double xd[3], yd[3], dxd[3], dx_norm = -1.0, err_phys, real_dx_norm = -1.0;
172 Vector x(xd, dim), y(yd, sdim), dx(dxd, dim);
173 bool hit_bdr =
false, prev_hit_bdr =
false;
184 for (
int it = 0;
true; )
211 err_phys = y.Normlinf();
212 if (err_phys < phys_tol)
239 prev_xip.
Get(dxd, dim);
246 if (prev_hit_bdr && real_dx_norm <
ref_tol)
257 mfem::out <<
"Newton: *** stuck on boundary!\n";
274 prev_hit_bdr = hit_bdr;
286 default: MFEM_ABORT(
"invalid solver type");
318 mfem::out <<
"Newton: *** iteration did not converge!\n";
327 MFEM_VERIFY(
T != NULL,
"invalid ElementTransformation");
363 MFEM_ABORT(
"invalid initial guess type");
384 MFEM_ABORT(
"unknown Geometry::Type!");
387 int dof = FElem->
GetDof();
390 for (
int j = 0; j < dof; j++)
397 const DenseMatrix &IsoparametricTransformation::EvalJacobian()
403 if (dshape.
Width() > 0)
413 const DenseMatrix &IsoparametricTransformation::EvalHessian()
417 int Dim = FElem->
GetDim();
420 if (d2shape.
Width() > 0)
432 switch (FElem->
Space())
439 MFEM_ABORT(
"unsupported finite element");
446 switch (FElem->
Space())
453 MFEM_ABORT(
"unsupported finite element");
468 return ((k-1)*(d-1)+(l-1));
470 return (k*(d-1)+(l-1));
472 MFEM_ABORT(
"unsupported finite element");
475 MFEM_ABORT(
"incompatible finite elements");
485 FElem -> CalcShape(ip, shape);
486 PointMat.
Mult(shape, trans);
492 int dof, n,
dim, i, j, k;
501 for (j = 0; j < n; j++)
503 FElem -> CalcShape (ir.
IntPoint(j), shape);
504 for (i = 0; i <
dim; i++)
507 for (k = 0; k < dof; k++)
509 tr(i, j) += PointMat(i, k) * shape(k);
524 for (
int j = 0; j < matrix.
Width(); j++)
540 ip2.
Set(vec, v.Size());
549 for (i = 0; i < n; i++)
580 MFEM_VERIFY(mask &
HAVE_ELEM1 &&
Elem1 != NULL,
"The ElementTransformation "
581 "for the element has not been configured for side 1.");
588 MFEM_VERIFY(mask &
HAVE_ELEM2 &&
Elem2 != NULL,
"The ElementTransformation "
589 "for the element has not been configured for side 2.");
596 MFEM_VERIFY(mask &
HAVE_LOC1,
"The IntegrationPointTransformation "
597 "for the element has not been configured for side 1.");
604 MFEM_VERIFY(mask &
HAVE_LOC2,
"The IntegrationPointTransformation "
605 "for the element has not been configured for side 2.");
612 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
613 "for the face has not been configured.");
620 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
621 "for the face has not been configured.");
628 MFEM_VERIFY(mask &
HAVE_FACE,
"The ElementTransformation "
629 "for the face has not been configured.");
642 const bool have_face = (mask & 16);
643 const bool have_el1 = (mask & 1) && (mask & 4);
644 const bool have_el2 = (mask & 2) && (mask & 8) && (
Elem2No >= 0);
645 if (
int(have_face) + int(have_el1) + int(have_el2) < 2)
653 double max_dist = 0.0;
662 out <<
"\nface vertex coordinates (from face transform):\n"
663 <<
"----------------------------------------------\n";
664 coords_base.PrintT(out, coords_base.Height());
673 out <<
"\nface vertex coordinates (from element 1 transform):\n"
674 <<
"---------------------------------------------------\n";
675 coords_el.PrintT(out, coords_el.Height());
679 coords_el -= coords_base;
680 coords_el.Norm2(dist);
681 max_dist = std::max(max_dist, dist.Normlinf());
685 coords_base = coords_el;
694 out <<
"\nface vertex coordinates (from element 2 transform):\n"
695 <<
"---------------------------------------------------\n";
696 coords_el.PrintT(out, coords_el.Height());
698 coords_el -= coords_base;
699 coords_el.Norm2(dist);
700 max_dist = std::max(max_dist, dist.Normlinf());
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for all finite elements.
void Set(const double *p, const int dim)
void Get(double *p, const int dim) const
int GetDim() const
Returns the reference space dimension for the finite element.
void trans(const Vector &u, Vector &x)
Class for an integration rule - an Array of IntegrationPoint.
void SetSize(int s)
Resize the vector to size s.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void CalcAdjugate(const DenseMatrix &a, DenseMatrix &adja)
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Data type dense matrix using column-major storage.
int Size() const
Returns the size of the vector.
int Space() const
Returns the type of FunctionSpace on the element.
double Normlinf() const
Returns the l_infinity norm of the vector.
const IntegrationPoint & GetCenter(int GeomType)
Return the center of the given Geometry::Type, GeomType.
const IntegrationRule * GetVertices(int GeomType)
Return an IntegrationRule consisting of all vertices of the given Geometry::Type, GeomType...
PointFiniteElement PointFE
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().
void SetType(const int t)
Set the Quadrature1D type of points to use for subdivision.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
GeometryRefiner GlobGeometryRefiner
RefinedGeometry * Refine(Geometry::Type Geom, int Times, int ETimes=1)
void GetColumn(int c, Vector &col) const
double DistanceTo(const double *p) const
Compute the Euclidean distance to another vector.
class H1_WedgeElement WedgeFE
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
static bool ProjectPoint(int GeomType, const IntegrationPoint &beg, IntegrationPoint &end)
Project a point end, onto the given Geometry::Type, GeomType.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
void subtract(const Vector &x, const Vector &y, Vector &z)
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...
void GetColumnReference(int c, Vector &col)
Tensor products of polynomials of order k.
class Linear3DFiniteElement TetrahedronFE
Linear2DFiniteElement TriangleFE
Class for integration point with weight.
int GetType() const
Get the Quadrature1D type of points used for subdivision.
BiLinear2DFiniteElement QuadrilateralFE
void Mult(const double *x, double *y) const
Matrix vector multiplication.
static bool CheckPoint(int GeomType, const IntegrationPoint &ip)
Check if the given point is inside the given reference element.
TriLinear3DFiniteElement HexahedronFE
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
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...
Linear1DFiniteElement SegmentFE