MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
eltrans.cpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
13#include "fem.hpp"
15
16#include <cmath>
17
18namespace mfem
19{
20
22 : IntPoint(static_cast<IntegrationPoint *>(NULL)),
23 EvalState(0),
24 geom(Geometry::INVALID),
25 Attribute(-1),
26 ElementNo(-1),
27 mesh(nullptr)
28{ }
29
31{
32 MFEM_ASSERT((EvalState & WEIGHT_MASK) == 0, "");
33 Jacobian();
35 return (Wght = (dFdx.Width() == 0) ? 1.0 : dFdx.Weight());
36}
37
39{
40 MFEM_ASSERT((EvalState & ADJUGATE_MASK) == 0, "");
41 Jacobian();
43 if (dFdx.Width() > 0) { CalcAdjugate(dFdx, adjJ); }
45 return adjJ;
46}
47
58
60{
61 // TODO: compute as invJ = / adjJ/Weight, if J is square,
62 // \ adjJ/Weight^2, otherwise.
63 MFEM_ASSERT((EvalState & INVERSE_MASK) == 0, "");
64 Jacobian();
66 if (dFdx.Width() > 0) { CalcInverse(dFdx, invJ); }
68 return invJ;
69}
70
72 const Vector& pt, const IntegrationRule &ir)
73{
74 MFEM_VERIFY(T != NULL, "invalid ElementTransformation");
75 MFEM_VERIFY(pt.Size() == T->GetSpaceDim(), "invalid point");
76
77 DenseMatrix physPts;
78 T->Transform(ir, physPts);
79
80 // Initialize distance and index of closest point
81 int minIndex = -1;
82 real_t minDist = std::numeric_limits<real_t>::max();
83
84 // Check all integration points in ir
85 const int npts = ir.GetNPoints();
86 for (int i = 0; i < npts; ++i)
87 {
88 real_t dist = pt.DistanceTo(physPts.GetColumn(i));
89 if (dist < minDist)
90 {
91 minDist = dist;
92 minIndex = i;
93 }
94 }
95 return minIndex;
96}
97
99 const Vector& pt, const IntegrationRule &ir)
100{
101 MFEM_VERIFY(T != NULL, "invalid ElementTransformation");
102 MFEM_VERIFY(pt.Size() == T->GetSpaceDim(), "invalid point");
103
104 // Initialize distance and index of closest point
105 int minIndex = -1;
106 real_t minDist = std::numeric_limits<real_t>::max();
107
108 // Check all integration points in ir using the local metric at each point
109 // induced by the transformation.
110 Vector dp(T->GetSpaceDim()), dr(T->GetDimension());
111 const int npts = ir.GetNPoints();
112 for (int i = 0; i < npts; ++i)
113 {
114 const IntegrationPoint &ip = ir.IntPoint(i);
115 T->Transform(ip, dp);
116 dp -= pt;
117 T->SetIntPoint(&ip);
118 T->InverseJacobian().Mult(dp, dr);
119 real_t dist = dr.Norml2();
120 // double dist = dr.Normlinf();
121 if (dist < minDist)
122 {
123 minDist = dist;
124 minIndex = i;
125 }
126 }
127 return minIndex;
128}
129
131{
132 std::ostream &os = mfem::out;
133
134 // separator:
135 switch (mode%3)
136 {
137 case 0: os << ", "; break;
138 case 1: os << "Newton: "; break;
139 case 2: os << " "; break;
140 // "Newton: iter = xx, "
141 }
142 switch ((mode/3)%4)
143 {
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;
147 case 3: break;
148 }
149 // ending:
150 switch ((mode/12)%4)
151 {
152 case 0: break;
153 case 1: os << '\n'; break;
154 case 2: os << " (converged)\n"; break;
155 case 3: os << " (actual)\n"; break;
156 }
157}
158
160 const Vector &pt,
161 const char *suffix)
162{
163 std::ostream &os = mfem::out;
164
165 os << prefix << " = (";
166 for (int j = 0; j < pt.Size(); j++)
167 {
168 os << (j > 0 ? ", " : "") << pt(j);
169 }
170 os << ')' << suffix;
171}
172
175{
176 MFEM_ASSERT(pt.Size() == T->GetSpaceDim(), "invalid point");
177
178 const real_t phys_tol = phys_rtol*pt.Normlinf();
179
180 const int geom = T->GetGeometryType();
181 const int dim = T->GetDimension();
182 const int sdim = T->GetSpaceDim();
183 IntegrationPoint xip, prev_xip;
184 real_t xd[3], yd[3], dxd[3], dxpd[3], dx_norm = -1.0, err_phys,
185 real_dx_norm = -1.0;
186 Vector x(xd, dim), y(yd, sdim), dx(dxd, dim), dx_prev(dxpd, dim);
187 bool hit_bdr = false, prev_hit_bdr = false;
188
189 // Use ip0 as initial guess:
190 xip = ip0;
191 xip.Get(xd, dim); // xip -> x
192 if (print_level >= 3)
193 {
194 NewtonPrint(1, 0.); // iter 0
195 NewtonPrintPoint(", ref_pt", x, "\n");
196 }
197
198 for (int it = 0; true; )
199 {
200 // Remarks:
201 // If f(x) := 1/2 |pt-F(x)|^2, then grad(f)(x) = -J^t(x) [pt-F(x)].
202 // Linearize F(y) at y=x: F(y) ~ L[x](y) := F(x) + J(x) [y-x].
203 // Newton iteration for F(y)=b is given by L[x_old](x_new) = b, i.e.
204 // F(x_old) + J(x_old) [x_new-x_old] = b.
205 //
206 // To minimize: 1/2 |F(y)-b|^2, subject to: l(y) >= 0, we may consider the
207 // iteration: minimize: |L[x_old](x_new)-b|^2, subject to l(x_new) >= 0,
208 // i.e. minimize: |F(x_old) + J(x_old) [x_new-x_old] - b|^2.
209
210 // This method uses:
211 // Newton iteration: x := x + J(x)^{-1} [pt-F(x)]
212 // or when dim != sdim: x := x + [J^t.J]^{-1}.J^t [pt-F(x)]
213
214 // Compute the physical coordinates of the current point:
215 T->Transform(xip, y);
216 if (print_level >= 3)
217 {
218 NewtonPrint(11, 0.); // continuation line
219 NewtonPrintPoint("approx_pt", y, ", ");
220 NewtonPrintPoint("exact_pt", pt, "\n");
221 }
222 subtract(pt, y, y); // y = pt-y
223
224 // Check for convergence in physical coordinates:
225 err_phys = y.Normlinf();
226 if (err_phys < phys_tol)
227 {
228 if (print_level >= 1)
229 {
230 NewtonPrint(1, (real_t)it);
231 NewtonPrint(3, dx_norm);
232 NewtonPrint(30, err_phys);
233 }
234 ip = xip;
235 if (solver_type != Newton) { return Inside; }
236 return Geometry::CheckPoint(geom, ip, ip_tol) ? Inside : Outside;
237 }
238 if (print_level >= 1)
239 {
240 if (it == 0 || print_level >= 2)
241 {
242 NewtonPrint(1, (real_t)it);
243 NewtonPrint(3, dx_norm);
244 NewtonPrint(18, err_phys);
245 }
246 }
247
248 if (hit_bdr)
249 {
250 xip.Get(xd, dim); // xip -> x
251 if (prev_hit_bdr || it == max_iter || print_level >= 2)
252 {
253 prev_xip.Get(dxd, dim); // prev_xip -> dx
254 subtract(x, dx, dx); // dx = xip - prev_xip
255 real_dx_norm = dx.Normlinf();
256 if (print_level >= 2)
257 {
258 NewtonPrint(41, real_dx_norm);
259 }
260 if (prev_hit_bdr && real_dx_norm < ref_tol)
261 {
262 if (print_level >= 0)
263 {
264 if (print_level <= 1)
265 {
266 NewtonPrint(1, (real_t)it);
267 NewtonPrint(3, dx_norm);
268 NewtonPrint(18, err_phys);
269 NewtonPrint(41, real_dx_norm);
270 }
271 mfem::out << "Newton: *** stuck on boundary!\n";
272 }
273 return Outside;
274 }
275 }
276 }
277
278 if (it == max_iter) { break; }
279
280 // Perform a Newton step:
281 T->SetIntPoint(&xip);
282 T->InverseJacobian().Mult(y, dx);
283 x += dx;
284 it++;
285 if (solver_type != Newton)
286 {
287 prev_xip = xip;
288 prev_hit_bdr = hit_bdr;
289 }
290 xip.Set(xd, dim); // x -> xip
291
292 // Perform projection based on solver_type:
293 switch (solver_type)
294 {
295 case Newton: break;
297 hit_bdr = !Geometry::ProjectPoint(geom, prev_xip, xip); break;
299 hit_bdr = !Geometry::ProjectPoint(geom, xip); break;
300 default: MFEM_ABORT("invalid solver type");
301 }
302 if (print_level >= 3)
303 {
304 NewtonPrint(1, real_t(it));
305 xip.Get(xd, dim); // xip -> x
306 NewtonPrintPoint(", ref_pt", x, "\n");
307 }
308
309 // Check for convergence in reference coordinates:
310 dx_norm = dx.Normlinf();
311 if (dx_norm < ref_tol)
312 {
313 if (print_level >= 1)
314 {
315 NewtonPrint(1, (real_t)it);
316 NewtonPrint(27, dx_norm);
317 }
318 ip = xip;
319 if (solver_type != Newton) { return Inside; }
320 return Geometry::CheckPoint(geom, ip, ip_tol) ? Inside : Outside;
321 }
322 }
323 if (print_level >= 0)
324 {
325 if (print_level <= 1)
326 {
328 NewtonPrint(3, dx_norm);
329 NewtonPrint(18, err_phys);
330 if (hit_bdr) { NewtonPrint(41, real_dx_norm); }
331 }
332 mfem::out << "Newton: *** iteration did not converge!\n";
333 }
334 ip = xip;
335 return Unknown;
336}
337
340{
341 MFEM_VERIFY(T != NULL, "invalid ElementTransformation");
342
343 // Select initial guess ...
344 switch (init_guess_type)
345 {
346 case Center:
348 break;
349
350 case ClosestPhysNode:
351 case ClosestRefNode:
352 {
353 const int order = qpts_order >= 0
354 ? qpts_order
355 : std::max(T->Order() + rel_qpts_order, 0);
356 if (order == 0)
357 {
359 }
360 else
361 {
362 RefinedGeometry &RefG = *refiner.Refine(T->GetGeometryType(), order);
363 int closest_idx = (init_guess_type == ClosestPhysNode) ?
364 FindClosestPhysPoint(pt, RefG.RefPts) :
365 FindClosestRefPoint(pt, RefG.RefPts);
366 ip0 = RefG.RefPts.IntPoint(closest_idx);
367 }
368 break;
369 }
370 case EdgeScan:
371 {
372 const int order = qpts_order >= 0
373 ? qpts_order
374 : std::max(T->Order() + rel_qpts_order, 0);
375 if (order == 0)
376 {
378 }
379 else
380 {
381 auto &ir = *refiner.EdgeScan(T->GetGeometryType(), order + 1);
382 int res = Outside;
383 int npts = ir.GetNPoints();
384 // will return Inside if any test point reports Inside, Outside if
385 // all points report Outside, else Unknown
386 for (int i = 0; i < npts; ++i)
387 {
388 ip0 = ir.IntPoint(i);
389 int tmp_res = NewtonSolve(pt, ip);
390 switch (tmp_res)
391 {
392 case Inside:
393 return Inside;
394 case Outside:
395 break;
396 case Unknown:
397 res = Unknown;
398 break;
399 }
400 }
401 return res;
402 }
403 break;
404 }
405 case GivenPoint:
406 break;
407
408 default:
409 MFEM_ABORT("invalid initial guess type");
410 }
411
412 // Call the solver ...
413 return NewtonSolve(pt, ip);
414}
415
416
418 Geometry::Type GeomType)
419{
420 switch (GeomType)
421 {
422 case Geometry::POINT : FElem = &PointFE; break;
423 case Geometry::SEGMENT : FElem = &SegmentFE; break;
424 case Geometry::TRIANGLE : FElem = &TriangleFE; break;
425 case Geometry::SQUARE : FElem = &QuadrilateralFE; break;
426 case Geometry::TETRAHEDRON : FElem = &TetrahedronFE; break;
427 case Geometry::CUBE : FElem = &HexahedronFE; break;
428 case Geometry::PRISM : FElem = &WedgeFE; break;
429 case Geometry::PYRAMID : FElem = &PyramidFE; break;
430 default:
431 MFEM_ABORT("unknown Geometry::Type!");
432 }
433 int dim = FElem->GetDim();
434 int dof = FElem->GetDof();
435 const IntegrationRule &nodes = FElem->GetNodes();
436 PointMat.SetSize(dim, dof);
437 for (int j = 0; j < dof; j++)
438 {
439 nodes.IntPoint(j).Get(&PointMat(0,j), dim);
440 }
441 geom = GeomType;
442}
443
444const DenseMatrix &IsoparametricTransformation::EvalJacobian()
445{
446 MFEM_ASSERT((EvalState & JACOBIAN_MASK) == 0, "");
447
448 dshape.SetSize(FElem->GetDof(), FElem->GetDim());
449 dFdx.SetSize(PointMat.Height(), dshape.Width());
450 if (dshape.Width() > 0)
451 {
452 FElem->CalcDShape(*IntPoint, dshape);
453 Mult(PointMat, dshape, dFdx);
454 }
456
457 return dFdx;
458}
459
460const DenseMatrix &IsoparametricTransformation::EvalHessian()
461{
462 MFEM_ASSERT((EvalState & HESSIAN_MASK) == 0, "");
463
464 int Dim = FElem->GetDim();
465 d2shape.SetSize(FElem->GetDof(), (Dim*(Dim+1))/2);
466 d2Fdx2.SetSize(PointMat.Height(), d2shape.Width());
467 if (d2shape.Width() > 0)
468 {
469 FElem->CalcHessian(*IntPoint, d2shape);
470 Mult(PointMat, d2shape, d2Fdx2);
471 }
473
474 return d2Fdx2;
475}
476
478{
479 switch (FElem->Space())
480 {
482 return (FElem->GetOrder()-1);
484 return (FElem->GetOrder());
486 return (FElem->GetOrder());
487 default:
488 MFEM_ABORT("unsupported finite element");
489 }
490 return 0;
491}
492
494{
495 switch (FElem->Space())
496 {
498 return (FElem->GetOrder() - 1) * FElem->GetDim();
500 return (FElem->GetOrder() * FElem->GetDim() - 1);
502 return (FElem->GetOrder() * FElem->GetDim() - 1);
503 default:
504 MFEM_ABORT("unsupported finite element");
505 }
506 return 0;
507}
508
510{
511 if (FElem->Space() == fe->Space())
512 {
513 int k = FElem->GetOrder();
514 int d = FElem->GetDim();
515 int l = fe->GetOrder();
516 switch (fe->Space())
517 {
519 return ((k-1)*(d-1)+(l-1));
521 return (k*(d-1)+(l-1));
523 return (k*(d-1)+(l-1));
524 default:
525 MFEM_ABORT("unsupported finite element");
526 }
527 }
528 MFEM_ABORT("incompatible finite elements");
529 return 0;
530}
531
533 Vector &trans)
534{
535 MFEM_ASSERT(FElem != nullptr, "Must provide a valid FiniteElement object!");
536 shape.SetSize(FElem->GetDof());
537 trans.SetSize(PointMat.Height());
538
539 FElem -> CalcShape(ip, shape);
540 PointMat.Mult(shape, trans);
541}
542
544 DenseMatrix &tr)
545{
546 int dof, n, dim, i, j, k;
547
548 dim = PointMat.Height();
549 dof = FElem->GetDof();
550 n = ir.GetNPoints();
551
552 shape.SetSize(dof);
553 tr.SetSize(dim, n);
554
555 for (j = 0; j < n; j++)
556 {
557 FElem -> CalcShape (ir.IntPoint(j), shape);
558 for (i = 0; i < dim; i++)
559 {
560 tr(i, j) = 0.0;
561 for (k = 0; k < dof; k++)
562 {
563 tr(i, j) += PointMat(i, k) * shape(k);
564 }
565 }
566 }
567}
568
570 DenseMatrix &result)
571{
572 MFEM_ASSERT(matrix.Height() == GetDimension(), "invalid input");
573 result.SetSize(PointMat.Height(), matrix.Width());
574
576 Vector col;
577
578 for (int j = 0; j < matrix.Width(); j++)
579 {
580 ip.Set(matrix.GetColumn(j), matrix.Height());
581
582 result.GetColumnReference(j, col);
583 Transform(ip, col);
584 }
585}
586
588 IntegrationPoint &ip2)
589{
590 real_t vec[3];
591 Vector v (vec, Transf.GetPointMat().Height());
592
593 Transf.Transform (ip1, v);
594 ip2.Set(vec, v.Size());
595}
596
598 IntegrationRule &ir2)
599{
600 int i, n;
601
602 n = ir1.GetNPoints();
603 for (i = 0; i < n; i++)
604 {
605 Transform (ir1.IntPoint(i), ir2.IntPoint(i));
606 }
607}
608
610{
612
613 if (mask & 4)
614 {
615 Loc1.Transform(*face_ip, eip1);
616 if (Elem1)
617 {
618 Elem1->SetIntPoint(&eip1);
619 }
620 }
621 if (mask & 8)
622 {
623 Loc2.Transform(*face_ip, eip2);
624 if (Elem2)
625 {
626 Elem2->SetIntPoint(&eip2);
627 }
628 }
629}
630
633{
634 MFEM_VERIFY(mask & HAVE_ELEM1 && Elem1 != NULL, "The ElementTransformation "
635 "for the element has not been configured for side 1.");
636 return *Elem1;
637}
638
641{
642 MFEM_VERIFY(mask & HAVE_ELEM2 && Elem2 != NULL, "The ElementTransformation "
643 "for the element has not been configured for side 2.");
644 return *Elem2;
645}
646
649{
650 MFEM_VERIFY(mask & HAVE_LOC1, "The IntegrationPointTransformation "
651 "for the element has not been configured for side 1.");
652 return Loc1;
653}
654
657{
658 MFEM_VERIFY(mask & HAVE_LOC2, "The IntegrationPointTransformation "
659 "for the element has not been configured for side 2.");
660 return Loc2;
661}
662
664 Vector &trans)
665{
666 MFEM_VERIFY(mask & HAVE_FACE, "The ElementTransformation "
667 "for the face has not been configured.");
669}
670
672 DenseMatrix &tr)
673{
674 MFEM_VERIFY(mask & HAVE_FACE, "The ElementTransformation "
675 "for the face has not been configured.");
677}
678
680 DenseMatrix &result)
681{
682 MFEM_VERIFY(mask & HAVE_FACE, "The ElementTransformation "
683 "for the face has not been configured.");
685}
686
688 std::ostream &os)
689{
690 // Check that the face vertices are mapped to the same physical location
691 // when using the following three transformations:
692 // - the face transformation, *this
693 // - Loc1 + Elem1
694 // - Loc2 + Elem2, if present.
695
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)
700 {
701 // need at least two different transformations to perform a check
702 return 0.0;
703 }
704
706
707 real_t max_dist = 0.0;
708 Vector dist(v_ir.GetNPoints());
709 DenseMatrix coords_base, coords_el;
710 IntegrationRule v_eir(v_ir.GetNPoints());
711 if (have_face)
712 {
713 Transform(v_ir, coords_base);
714 if (print_level > 0)
715 {
716 os << "\nface vertex coordinates (from face transform):\n"
717 << "----------------------------------------------\n";
718 coords_base.PrintT(os, coords_base.Height());
719 }
720 }
721 if (have_el1)
722 {
723 Loc1.Transform(v_ir, v_eir);
724 Elem1->Transform(v_eir, coords_el);
725 if (print_level > 0)
726 {
727 os << "\nface vertex coordinates (from element 1 transform):\n"
728 << "---------------------------------------------------\n";
729 coords_el.PrintT(os, coords_el.Height());
730 }
731 if (have_face)
732 {
733 coords_el -= coords_base;
734 coords_el.Norm2(dist);
735 max_dist = std::max(max_dist, dist.Normlinf());
736 }
737 else
738 {
739 coords_base = coords_el;
740 }
741 }
742 if (have_el2)
743 {
744 Loc2.Transform(v_ir, v_eir);
745 Elem2->Transform(v_eir, coords_el);
746 if (print_level > 0)
747 {
748 os << "\nface vertex coordinates (from element 2 transform):\n"
749 << "---------------------------------------------------\n";
750 coords_el.PrintT(os, coords_el.Height());
751 }
752 coords_el -= coords_base;
753 coords_el.Norm2(dist);
754 max_dist = std::max(max_dist, dist.Normlinf());
755 }
756
757 return max_dist;
758}
759}
Data type dense matrix using column-major storage.
Definition densemat.hpp:24
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
Definition densemat.cpp:125
void Transpose()
(*this) = (*this)^t
void GetColumnReference(int c, Vector &col)
Definition densemat.hpp:319
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
Definition densemat.hpp:108
real_t Weight() const
Definition densemat.cpp:573
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.
Definition densemat.cpp:862
virtual int Order() const =0
Return the order of the current element we are using for the transformation.
Geometry::Type GetGeometryType() const
Return the Geometry::Type of the reference element.
Definition eltrans.hpp:175
const DenseMatrix & InverseJacobian()
Return the inverse of the Jacobian matrix of the transformation at the currently set IntegrationPoint...
Definition eltrans.hpp:158
const DenseMatrix & AdjugateJacobian()
Return the adjugate of the Jacobian matrix of the transformation at the currently set IntegrationPoin...
Definition eltrans.hpp:148
const DenseMatrix & EvalAdjugateJ()
Definition eltrans.cpp:38
virtual int GetSpaceDim() const =0
Get the dimension of the target (physical) space.
const IntegrationPoint * IntPoint
Definition eltrans.hpp:30
const DenseMatrix & Jacobian()
Return the Jacobian matrix of the transformation at the currently set IntegrationPoint,...
Definition eltrans.hpp:132
int GetDimension() const
Return the topological dimension of the reference element.
Definition eltrans.hpp:178
const DenseMatrix & EvalInverseJ()
Definition eltrans.cpp:59
void SetIntPoint(const IntegrationPoint *ip)
Set the integration point ip that weights and Jacobians will be evaluated at.
Definition eltrans.hpp:106
const DenseMatrix & EvalTransAdjugateJ()
Definition eltrans.cpp:48
virtual void Transform(const IntegrationPoint &, Vector &)=0
Transform integration point from reference coordinates to physical coordinates and store them in the ...
ElementTransformation * Elem2
Definition eltrans.hpp:791
void SetIntPoint(const IntegrationPoint *face_ip)
Set the integration point in the Face and the two neighboring elements, if present.
Definition eltrans.cpp:609
ElementTransformation * Elem1
Definition eltrans.hpp:791
@ HAVE_ELEM2
Element on side 2 is configured.
Definition eltrans.hpp:783
@ HAVE_LOC1
Point transformation for side 1 is configured.
Definition eltrans.hpp:784
@ HAVE_ELEM1
Element on side 1 is configured.
Definition eltrans.hpp:782
@ HAVE_FACE
Face transformation is configured.
Definition eltrans.hpp:786
@ HAVE_LOC2
Point transformation for side 2 is configured.
Definition eltrans.hpp:785
IntegrationPointTransformation Loc1
Definition eltrans.hpp:793
IntegrationPointTransformation & GetIntPoint1Transformation()
Definition eltrans.cpp:648
ElementTransformation & GetElement1Transformation()
Definition eltrans.cpp:632
void Transform(const IntegrationPoint &, Vector &) override
Transform integration point from reference coordinates to physical coordinates and store them in the ...
Definition eltrans.cpp:663
IntegrationPointTransformation Loc2
Definition eltrans.hpp:793
IntegrationPointTransformation & GetIntPoint2Transformation()
Definition eltrans.cpp:656
real_t CheckConsistency(int print_level=0, std::ostream &out=mfem::out)
Check for self-consistency: compares the result of mapping the reference face vertices to physical co...
Definition eltrans.cpp:687
ElementTransformation & GetElement2Transformation()
Definition eltrans.cpp:640
Abstract class for all finite elements.
Definition fe_base.hpp:244
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...
Definition fe_base.cpp:101
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition fe_base.hpp:338
int GetDim() const
Returns the reference space dimension for the finite element.
Definition fe_base.hpp:321
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
Definition fe_base.hpp:400
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.
Definition fe_base.hpp:348
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Definition fe_base.hpp:334
@ Pk
Polynomials of order k.
Definition fe_base.hpp:230
@ Qk
Tensor products of polynomials of order k.
Definition fe_base.hpp:231
@ Uk
Rational polynomials of order k.
Definition fe_base.hpp:233
RefinedGeometry * Refine(Geometry::Type Geom, int Times, int ETimes=1)
Definition geom.cpp:1136
const IntegrationRule * EdgeScan(Geometry::Type Geom, int NPts1d)
Get an integration rule which scans along the r/s/t=0 edges of the element.
Definition geom.cpp:1670
const IntegrationPoint & GetCenter(int GeomType) const
Return the center of the given Geometry::Type, GeomType.
Definition geom.hpp:75
const IntegrationRule * GetVertices(int GeomType) const
Return an IntegrationRule consisting of all vertices of the given Geometry::Type, GeomType.
Definition geom.cpp:293
static bool CheckPoint(int GeomType, const IntegrationPoint &ip)
Check if the given point is inside the given reference element.
Definition geom.cpp:435
static bool ProjectPoint(int GeomType, const IntegrationPoint &beg, IntegrationPoint &end)
Project a point end, onto the given Geometry::Type, GeomType.
Definition geom.cpp:616
IsoparametricTransformation Transf
Definition eltrans.hpp:733
void Transform(const IntegrationPoint &, IntegrationPoint &)
Definition eltrans.cpp:587
Class for integration point with weight.
Definition intrules.hpp:35
void Get(real_t *p, const int dim) const
Definition intrules.hpp:60
void Set(const real_t *p, const int dim)
Definition intrules.hpp:46
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:100
int GetNPoints() const
Returns the number of the points in the integration rule.
Definition intrules.hpp:256
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
Definition intrules.hpp:259
virtual int Transform(const Vector &pt, IntegrationPoint &ip)
Given a point, pt, in physical space, find its reference coordinates, ip.
Definition eltrans.cpp:338
@ GivenPoint
Use a specific point, set with SetInitialGuess().
Definition eltrans.hpp:214
@ Center
Use the center of the reference element.
Definition eltrans.hpp:205
int FindClosestRefPoint(const Vector &pt, const IntegrationRule &ir)
Find the IntegrationPoint mapped closest to pt, using a norm that approximates the (unknown) distance...
Definition eltrans.cpp:98
void NewtonPrintPoint(const char *prefix, const Vector &pt, const char *suffix)
Definition eltrans.cpp:159
@ Outside
The point is probably outside the element.
Definition eltrans.hpp:245
@ Unknown
The algorithm failed to determine where the point is.
Definition eltrans.hpp:246
@ Inside
The point is inside the element.
Definition eltrans.hpp:244
int FindClosestPhysPoint(const Vector &pt, const IntegrationRule &ir)
Find the IntegrationPoint mapped closest to pt.
Definition eltrans.cpp:71
int NewtonSolve(const Vector &pt, IntegrationPoint &ip)
Definition eltrans.cpp:173
void NewtonPrint(int mode, real_t val)
Definition eltrans.cpp:130
ElementTransformation * T
Definition eltrans.hpp:251
int OrderJ() const override
Return the order of the elements of the Jacobian of the transformation.
Definition eltrans.cpp:477
int OrderGrad(const FiniteElement *fe) const override
Return the order of .
Definition eltrans.cpp:509
void SetIdentityTransformation(Geometry::Type GeomType)
Set the FiniteElement Geometry for the reference elements being used.
Definition eltrans.cpp:417
const DenseMatrix & GetPointMat() const
Return the stored point matrix.
Definition eltrans.hpp:671
void Transform(const IntegrationPoint &, Vector &) override
Transform integration point from reference coordinates to physical coordinates and store them in the ...
Definition eltrans.cpp:532
int OrderW() const override
Return the order of the determinant of the Jacobian (weight) of the transformation.
Definition eltrans.cpp:493
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Definition operator.hpp:66
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Definition operator.hpp:72
IntegrationRule RefPts
Definition geom.hpp:321
Vector data type.
Definition vector.hpp:82
real_t Normlinf() const
Returns the l_infinity norm of the vector.
Definition vector.cpp:972
real_t Norml2() const
Returns the l2 norm of the vector.
Definition vector.cpp:931
int Size() const
Returns the size of the vector.
Definition vector.hpp:226
void SetSize(int s)
Resize the vector to size s.
Definition vector.hpp:558
real_t DistanceTo(const real_t *p) const
Compute the Euclidean distance to another vector.
Definition vector.hpp:710
int dim
Definition ex24.cpp:53
void trans(const Vector &u, Vector &x)
Definition ex27.cpp:412
Linear1DFiniteElement SegmentFE
Definition segment.cpp:52
PointFiniteElement PointFE
Definition point.cpp:42
TriLinear3DFiniteElement HexahedronFE
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Definition table.cpp:548
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...
Definition globals.hpp:66
Geometry Geometries
Definition fe.cpp:49
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
MFEM_EXPORT class Linear3DFiniteElement TetrahedronFE
Definition fe.cpp:36
MFEM_EXPORT class LinearWedgeFiniteElement WedgeFE
Definition fe.cpp:40
void CalcAdjugate(const DenseMatrix &a, DenseMatrix &adja)
BiLinear2DFiniteElement QuadrilateralFE
void subtract(const Vector &x, const Vector &y, Vector &z)
Definition vector.cpp:547
MFEM_EXPORT class LinearPyramidFiniteElement PyramidFE
Definition fe.cpp:44
float real_t
Definition config.hpp:43
MFEM_EXPORT Linear2DFiniteElement TriangleFE
Definition fe.cpp:32
std::array< int, NCMesh::MaxFaceNodes > nodes