MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
tmop.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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
12#ifndef MFEM_TMOP_HPP
13#define MFEM_TMOP_HPP
14
16#include "nonlininteg.hpp"
17
18namespace mfem
19{
20
21/** @brief Abstract class for local mesh quality metrics in the target-matrix
22 optimization paradigm (TMOP) by P. Knupp et al. */
24{
25protected:
26 const DenseMatrix *Jtr; /**< Jacobian of the reference-element to
27 target-element transformation. */
28
29 /** @brief The method HyperelasticModel::SetTransformation() is hidden
30 for TMOP_QualityMetric%s, because it is not used. */
32
33public:
34 TMOP_QualityMetric() : Jtr(NULL) { }
35 virtual ~TMOP_QualityMetric() { }
36
37 /** @brief Specify the reference-element -> target-element Jacobian matrix
38 for the point of interest.
39
40 The specified Jacobian matrix, #Jtr, can be used by metrics that cannot
41 be written just as a function of the target->physical Jacobian matrix,
42 Jpt. */
43 virtual void SetTargetJacobian(const DenseMatrix &Jtr_) { Jtr = &Jtr_; }
44
45 /** @brief Evaluates the metric in matrix form (opposed to invariant form).
46 Used for validating the invariant evaluations. */
47 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
48 { return -1.0; /* not implemented -> checks would fail. */ }
49
50 /** @brief Evaluate the strain energy density function, W = W(Jpt), by using
51 the 2D or 3D matrix invariants, see linalg/invariants.hpp.
52 @param[in] Jpt Represents the target->physical transformation
53 Jacobian matrix. */
54 virtual real_t EvalW(const DenseMatrix &Jpt) const = 0;
55
56 /** @brief Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
57 @param[in] Jpt Represents the target->physical transformation
58 Jacobian matrix.
59 @param[out] P The evaluated 1st Piola-Kirchhoff stress tensor. */
60 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const = 0;
61
62 /** @brief Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor
63 and assemble its contribution to the local gradient matrix 'A'.
64 @param[in] Jpt Represents the target->physical transformation
65 Jacobian matrix.
66 @param[in] DS Gradient of the basis matrix (dof x dim).
67 @param[in] weight Quadrature weight coefficient for the point.
68 @param[in,out] A Local gradient matrix where the contribution from this
69 point will be added.
70
71 Computes weight * d(dW_dxi)_d(xj) at the current point, for all i and j,
72 where x1 ... xn are the FE dofs. This function is usually defined using
73 the matrix invariants and their derivatives. */
74 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
75 const real_t weight, DenseMatrix &A) const = 0;
76
77 /** @brief Return the metric ID. */
78 virtual int Id() const { return 0; }
79};
80
81class TargetConstructor;
82
83/// Abstract class used to define explicit combination of metrics with constant
84/// coefficients.
86{
87protected:
88 Array<TMOP_QualityMetric *> tmop_q_arr; //the metrics are not owned
90
91public:
92 virtual void AddQualityMetric(TMOP_QualityMetric *tq, real_t wt = 1.0)
93 {
94 tmop_q_arr.Append(tq);
95 wt_arr.Append(wt);
96 }
97
98 virtual void SetTargetJacobian(const DenseMatrix &Jtr_)
99 {
100 for (int i = 0; i < tmop_q_arr.Size(); i++)
101 {
102 tmop_q_arr[i]->SetTargetJacobian(Jtr_);
103 }
104 }
105
106 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
107
108 virtual real_t EvalW(const DenseMatrix &Jpt) const;
109
110 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
111
112 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
113 const real_t weight, DenseMatrix &A) const;
114
115 /// Computes the averages of all metrics (integral of metric / volume).
116 /// Works in parallel when called with a ParGridFunction.
117 void ComputeAvgMetrics(const GridFunction &nodes,
118 const TargetConstructor &tc,
119 Vector &averages) const;
120
121 /// Computes weights so that the averages of all metrics are equal, and the
122 /// weights sum to one. Works in parallel when called with a ParGridFunction.
123 void ComputeBalancedWeights(const GridFunction &nodes,
124 const TargetConstructor &tc,
125 Vector &weights) const;
126
127 void GetWeights(Array<real_t> &weights) const { weights = wt_arr; }
128
129 /// Changes the weights of the metrics in the combination.
130 void SetWeights(const Vector &weights)
131 {
132 MFEM_VERIFY(tmop_q_arr.Size() == weights.Size(), "Incorrect #weights");
133 for (int i = 0; i < tmop_q_arr.Size(); i++) { wt_arr[i] = weights(i); }
134 }
135};
136
137/// Simultaneous Untangler + Worst Case Improvement Metric
138/// Uses a base metric mu and is defined as:
139/// mu_tilde = mu_hat, when WorstCaseType = None,
140/// = mu_hat/(beta - mu_hat), when WorstCaseType = Beta,
141/// = mu_hat^p, when WorstCaseType = PMean,
142/// where beta = max(mu_hat) + muT_ep,
143/// and mu_hat = (mu/2phi(tau,ep)) where
144/// 2phi(tau,ep) = 1, when when BarrierType = None,
145/// = 2*(tau - min(alpha*min(tau)-detT_ep,0)), when BarrierType = Shifted
146/// = tau^2 + sqrt(tau^2 + ep^2), when BarrierType = Pseudo
147/// where tau = det(T), and max(mu_hat) and min(tau) are computed over the
148/// entire mesh.
149/// Ultimately, this metric can be used for mesh untangling with the BarrierType
150/// option and for worst case quality improvement with the WorstCaseType option.
152{
153public:
154 enum class BarrierType
155 {
156 None,
157 Shifted,
158 Pseudo
159 };
160 enum class WorstCaseType
161 {
162 None,
163 Beta,
164 PMean
165 };
166
167protected:
168 TMOP_QualityMetric &tmop_metric; // non-barrier metric to use
169 real_t min_detT; // minimum Jacobian in the mesh
170 real_t max_muT; // max mu_k/phi(tau,ep) in the mesh
171 int exponent; // used for p-mean metrics
172 real_t alpha; // scaling factor for min(det(T))
173 real_t detT_ep; // small constant subtracted from min(detT)
174 real_t muT_ep; // small constant added to muT term
177
178public:
180 int exponent_ = 1,
181 real_t alpha_ = 1.5,
182 real_t detT_ep_ = 0.0001,
183 real_t muT_ep_ = 0.0001,
186 tmop_metric(tmop_metric_), exponent(exponent_), alpha(alpha_),
187 detT_ep(detT_ep_), muT_ep(muT_ep_), btype(btype_), wctype(wctype_)
188 {
189 MFEM_VERIFY(wctype == WorstCaseType::None,
190 "Worst-case optimization has not been fully developed!");
192 {
193 const int m_id = tmop_metric.Id();
194 MFEM_VERIFY(m_id == 4 || m_id == 14 || m_id == 66,
195 "Incorrect input barrier metric -- must be 4 / 14 / 66");
196 }
197 }
198
199 virtual real_t EvalW(const DenseMatrix &Jpt) const;
200
201 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
202 { MFEM_ABORT("Not implemented"); }
203
204 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
205 const real_t weight, DenseMatrix &A) const
206 { MFEM_ABORT("Not implemented"); }
207
208 // Compute mu_hat.
209 virtual real_t EvalWBarrier(const DenseMatrix &Jpt) const;
210
211 virtual void SetMinDetT(real_t min_detT_) { min_detT = min_detT_; }
212
213 virtual void SetMaxMuT(real_t max_muT_) { max_muT = max_muT_; }
214
215 virtual BarrierType GetBarrierType() { return btype; }
216
218};
219
220/// 2D non-barrier metric without a type.
222{
223protected:
225
226public:
227 // W = |J|^2.
228 virtual real_t EvalW(const DenseMatrix &Jpt) const;
229
230 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
231
232 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
233 const real_t weight, DenseMatrix &A) const;
234
235 virtual int Id() const { return 1; }
236};
237
238/// 2D non-barrier Skew metric.
240{
241public:
242 // W = 0.5 (1 - cos(angle_Jpr - angle_Jtr)).
243 virtual real_t EvalW(const DenseMatrix &Jpt) const;
244
245 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
246 { MFEM_ABORT("Not implemented"); }
247
248 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
249 const real_t weight, DenseMatrix &A) const
250 { MFEM_ABORT("Not implemented"); }
251};
252
253/// 3D non-barrier Skew metric.
255{
256public:
257 // W = 1/6 (3 - sum_i cos(angle_Jpr_i - angle_Jtr_i)), i = 1..3.
258 virtual real_t EvalW(const DenseMatrix &Jpt) const;
259
260 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
261 { MFEM_ABORT("Not implemented"); }
262
263 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
264 const real_t weight, DenseMatrix &A) const
265 { MFEM_ABORT("Not implemented"); }
266};
267
268/// 2D non-barrier Aspect ratio metric.
270{
271public:
272 // W = 0.5 (ar_Jpr/ar_Jtr + ar_Jtr/ar_Jpr) - 1.
273 virtual real_t EvalW(const DenseMatrix &Jpt) const;
274
275 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
276 { MFEM_ABORT("Not implemented"); }
277
278 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
279 const real_t weight, DenseMatrix &A) const
280 { MFEM_ABORT("Not implemented"); }
281};
282
283/// 3D non-barrier Aspect ratio metric.
285{
286public:
287 // W = 1/3 sum [0.5 (ar_Jpr_i/ar_Jtr_i + ar_Jtr_i/ar_Jpr_i) - 1], i = 1..3.
288 virtual real_t EvalW(const DenseMatrix &Jpt) const;
289
290 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
291 { MFEM_ABORT("Not implemented"); }
292
293 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
294 const real_t weight, DenseMatrix &A) const
295 { MFEM_ABORT("Not implemented"); }
296};
297
298/// 2D barrier shape (S) metric (polyconvex).
299/// Grade - A.
301{
302protected:
304
305public:
306 // W = 0.5 |J|^2 / det(J) - 1.
307 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
308
309 // W = 0.5 I1b - 1.
310 virtual real_t EvalW(const DenseMatrix &Jpt) const;
311
312 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
313
314 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
315 const real_t weight, DenseMatrix &A) const;
316
317 virtual int Id() const { return 2; }
318};
319
320/// 2D non-barrier shape (S) metric.
321/// Grade - F.
323{
324protected:
326
327public:
328 // W = |J|^2 - 2*det(J)
329 virtual real_t EvalW(const DenseMatrix &Jpt) const;
330
331 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
332
333 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
334 const real_t weight, DenseMatrix &A) const;
335
336 virtual int Id() const { return 4; }
337};
338
339/// 2D barrier Shape+Size (VS) metric (not polyconvex).
341{
342protected:
344
345public:
346 // W = |J - J^-t|^2.
347 virtual real_t EvalW(const DenseMatrix &Jpt) const;
348
349 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
350
351 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
352 const real_t weight, DenseMatrix &A) const;
353
354 virtual int Id() const { return 7; }
355};
356
357/// 2D barrier Shape+Size (VS) metric (not polyconvex).
359{
360protected:
362
363public:
364 // W = det(J) * |J - J^-t|^2.
365 virtual real_t EvalW(const DenseMatrix &Jpt) const;
366
367 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
368
369 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
370 const real_t weight, DenseMatrix &A) const;
371};
372
373/// 2D non-barrier Shape+Size+Orientation (VOS) metric (polyconvex).
375{
376protected:
378
379public:
380 // W = |J - I|^2.
381 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
382
383 // W = I1[J-I].
384 virtual real_t EvalW(const DenseMatrix &Jpt) const;
385
386 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
387
388 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
389 const real_t weight, DenseMatrix &A) const;
390};
391
392/// 2D Shifted barrier form of shape metric (mu_2).
394{
395protected:
398
399public:
401
402 // W = 0.5(|J|^2 - 2det(J)) / (det(J) - tau0).
403 virtual real_t EvalW(const DenseMatrix &Jpt) const;
404
405 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
406
407 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
408 const real_t weight, DenseMatrix &A) const;
409};
410
411/// 2D barrier shape metric (polyconvex).
412/// Grade - A.
414{
415protected:
417
418public:
419 // W = 0.5 |J^t J|^2 / det(J)^2 - 1.
420 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
421
422 // W = 0.5 I1b^2 - 2.
423 virtual real_t EvalW(const DenseMatrix &Jpt) const;
424
425 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
426
427 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
428 const real_t weight, DenseMatrix &A) const;
429};
430
431/// 2D non-barrier size (V) metric (not polyconvex).
432/// Grade - F.
434{
435protected:
437
438public:
439 // W = (det(J) - 1)^2.
440 virtual real_t EvalW(const DenseMatrix &Jpt) const;
441
442 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
443
444 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
445 const real_t weight, DenseMatrix &A) const;
446
447};
448
449/// 2D barrier size (V) metric (polyconvex).
450/// Grade - C.
452{
453protected:
455
456public:
457 // W = 0.5 (det(J) + 1 / det(J)) - 1.
458 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
459
460 // W = 0.5 (I2b + 1/I2b) - 1.
461 virtual real_t EvalW(const DenseMatrix &Jpt) const;
462
463 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
464
465 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
466 const real_t weight, DenseMatrix &A) const;
467};
468
469/// 2D barrier shape (S) metric (not polyconvex).
471{
472protected:
474
475public:
476 // W = |J^t J|^2 / det(J)^2 - 2|J|^2 / det(J) + 2
477 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
478
479 // W = I1b (I1b - 2).
480 virtual real_t EvalW(const DenseMatrix &Jpt) const;
481
482 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
483
484 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
485 const real_t weight, DenseMatrix &A) const;
486};
487
488/// 2D non-barrier Shape+Size (VS) metric.
489/// Grade - F.
491{
492protected:
495
496public:
499 {
500 // (1-gamma) mu_4 + gamma mu_55
501 AddQualityMetric(sh_metric, 1.-gamma);
503 }
504 virtual int Id() const { return 66; }
505 real_t GetGamma() const { return wt_arr[1]; }
506
507 virtual ~TMOP_Metric_066() { delete sh_metric; delete sz_metric; }
508};
509
510/// 2D barrier size (V) metric (polyconvex).
511/// Grade - C.
513{
514protected:
516
517public:
518 // W = 0.5 (det(J) - 1 / det(J))^2.
519 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
520
521 // W = 0.5 (I2 + 1 / I2) - 1.0.
522 virtual real_t EvalW(const DenseMatrix &Jpt) const;
523
524 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
525
526 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
527 const real_t weight, DenseMatrix &A) const;
528
529 virtual int Id() const { return 77; }
530};
531
532/// 2D barrier Shape+Size (VS) metric (polyconvex).
533/// Grade - A.
535{
536protected:
539
540public:
543 {
544 // (1-gamma) mu_2 + gamma mu_77
545 AddQualityMetric(sh_metric, 1.0 - gamma);
547 }
548
549 virtual int Id() const { return 80; }
550 real_t GetGamma() const { return wt_arr[1]; }
551
552 virtual ~TMOP_Metric_080() { delete sh_metric; delete sz_metric; }
553};
554
555/// 2D barrier Shape+Orientation (OS) metric (polyconvex).
557{
558public:
559 // W = |T-T'|^2, where T'= |T|*I/sqrt(2).
560 virtual real_t EvalW(const DenseMatrix &Jpt) const;
561
562 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
563 { MFEM_ABORT("Not implemented"); }
564
565 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
566 const real_t weight, DenseMatrix &A) const
567 { MFEM_ABORT("Not implemented"); }
568};
569
570/// 2D compound barrier Shape+Size (VS) metric (balanced).
572{
573protected:
576
577public:
580 {
581 // mu_50 + lambda mu_77.
582 // 1 <= lambda <= 4 should produce best asymptotic balance.
585 }
586
587 virtual int Id() const { return 90; }
588 virtual ~TMOP_Metric_090() { delete sh_metric; delete sz_metric; }
589};
590
591/// 2D compound barrier Shape+Size (VS) metric (balanced).
593{
594protected:
597
598public:
601 {
602 // mu_2 + lambda mu_56.
603 // 1 <= lambda <= 2 should produce best asymptotic balance.
606 }
607
608 virtual int Id() const { return 94; }
609 virtual ~TMOP_Metric_094() { delete sh_metric; delete sz_metric; }
610};
611
612/// 2D barrier Shape+Size+Orientation (VOS) metric (polyconvex).
614{
615public:
616 // W = 1/tau |T-I|^2.
617 virtual real_t EvalW(const DenseMatrix &Jpt) const;
618
619 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
620 { MFEM_ABORT("Not implemented"); }
621
622 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
623 const real_t weight, DenseMatrix &A) const
624 { MFEM_ABORT("Not implemented"); }
625};
626
627/// 2D untangling metric.
629{
630protected:
631 const real_t eps;
633
634public:
636
637 // W = (det(J) - 1)^2 - det(J) + sqrt(det(J)^2 + eps).
638 virtual real_t EvalW(const DenseMatrix &Jpt) const;
639
640 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
641
642 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
643 const real_t weight, DenseMatrix &A) const;
644};
645
646/// Shifted barrier form of metric 56 (area, ideal barrier metric), 2D
648{
649protected:
652
653public:
654 /// Note that @a t0 is stored by reference
656
657 // W = 0.5(det(J) - 1)^2 / (det(J) - tau0).
658 virtual real_t EvalW(const DenseMatrix &Jpt) const;
659
660 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
661
662 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
663 const real_t weight, DenseMatrix &A) const;
664};
665
666/// 3D barrier Shape (S) metric, well-posed (polyconvex & invex).
668{
669protected:
671
672public:
673 // W = 1/3 |J| |J^-1| - 1.
674 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
675
676 // W = 1/3 sqrt(I1b * I2b) - 1
677 virtual real_t EvalW(const DenseMatrix &Jpt) const;
678
679 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
680
681 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
682 const real_t weight, DenseMatrix &A) const;
683};
684
685/// 3D barrier Shape (S) metric, well-posed (polyconvex & invex).
687{
688protected:
690
691public:
692 // W = |J|^2 |J^{-1}|^2 / 9 - 1.
693 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
694
695 // W = I1b * I2b / 9 - 1.
696 virtual real_t EvalW(const DenseMatrix &Jpt) const;
697
698 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
699
700 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
701 const real_t weight, DenseMatrix &A) const;
702
703 virtual int Id() const { return 302; }
704};
705
706/// 3D barrier Shape (S) metric, well-posed (polyconvex & invex).
708{
709protected:
711
712public:
713 // W = |J|^2 / 3 / det(J)^(2/3) - 1.
714 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
715
716 // W = I1b / 3 - 1.
717 virtual real_t EvalW(const DenseMatrix &Jpt) const;
718
719 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
720
721 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
722 const real_t weight, DenseMatrix &A) const;
723
724 virtual int Id() const { return 303; }
725};
726
727/// 3D barrier Shape (S) metric, well-posed (polyconvex & invex).
729{
730protected:
732
733public:
734 // W = |J|^3 / 3^(3/2) / det(J) - 1.
735 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
736
737 // W = (I1b/3)^3/2 - 1.
738 virtual real_t EvalW(const DenseMatrix &Jpt) const;
739
740 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
741
742 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
743 const real_t weight, DenseMatrix &A) const;
744
745 virtual int Id() const { return 304; }
746};
747
748/// 3D Size (V) untangling metric.
750{
751protected:
752 const real_t eps;
754
755public:
757
758 // W = (det(J) - 1)^2 - det(J) + (det(J)^2 + eps)^(1/2).
759 virtual real_t EvalW(const DenseMatrix &Jpt) const;
760
761 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
762
763 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
764 const real_t weight, DenseMatrix &A) const;
765};
766
767/// 3D Shape (S) metric, untangling version of 303.
769{
770protected:
773
774public:
775 TMOP_Metric_313(real_t &mindet) : min_detT(mindet) { }
776
777 // W = 1/3 |J|^2 / [det(J)-tau0]^(-2/3).
778 virtual real_t EvalW(const DenseMatrix &Jpt) const;
779
780 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
781
782 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
783 const real_t weight, DenseMatrix &A) const;
784
785 virtual int Id() const { return 313; }
786};
787
788/// 3D Size (V) metric.
790{
791protected:
793
794public:
795 // W = (det(J) - 1)^2.
796 virtual real_t EvalW(const DenseMatrix &Jpt) const;
797
798 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
799
800 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
801 const real_t weight, DenseMatrix &A) const;
802
803 virtual int Id() const { return 315; }
804};
805
806/// 3D Size (V) metric.
808{
809protected:
811
812public:
813 // W = 0.5 (det(J) + 1/det(J)) - 1.
814 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
815
816 // W = 0.5 (I3b + 1/I3b) - 1.
817 virtual real_t EvalW(const DenseMatrix &Jpt) const;
818
819 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
820
821 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
822 const real_t weight, DenseMatrix &A) const;
823};
824
825/// 3D Size (V) metric.
827{
828protected:
830
831public:
832 // W = 0.5 (det(J)^2 + 1/det(J)^2) - 1.
833 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
834
835 // W = 0.5 (I3 + 1/I3) - 1.
836 virtual real_t EvalW(const DenseMatrix &Jpt) const;
837
838 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
839
840 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
841 const real_t weight, DenseMatrix &A) const;
842
843 virtual int Id() const { return 318; }
844};
845
846/// 3D barrier Shape+Size (VS) metric, well-posed (invex).
848{
849protected:
851
852public:
853 // W = |J - J^-t|^2.
854 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
855
856 // W = I1 + I2/I3 - 6.
857 virtual real_t EvalW(const DenseMatrix &Jpt) const;
858
859 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
860
861 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
862 const real_t weight, DenseMatrix &A) const;
863
864 virtual int Id() const { return 321; }
865};
866
867/// 3D barrier Shape+Size (VS) metric, well-posed (invex).
869{
870protected:
872
873public:
874 // W = |J - adjJ^-t|^2.
875 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
876
877 // W = I1b / (I3b^-1/3) / 6 + I2b (I3b^1/3) / 6 - 1
878 virtual real_t EvalW(const DenseMatrix &Jpt) const;
879
880 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
881
882 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
883 const real_t weight, DenseMatrix &A) const;
884
885 virtual int Id() const { return 322; }
886};
887
888/// 3D barrier Shape+Size (VS) metric, well-posed (invex).
890{
891protected:
893
894public:
895 // W = |J|^3 - 3 sqrt(3) ln(det(J)) - 3 sqrt(3).
896 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
897
898 // W = I1^3/2 - 3 sqrt(3) ln(I3b) - 3 sqrt(3).
899 virtual real_t EvalW(const DenseMatrix &Jpt) const;
900
901 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
902
903 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
904 const real_t weight, DenseMatrix &A) const;
905
906 virtual int Id() const { return 323; }
907};
908
909/// 3D compound barrier Shape+Size (VS) metric (polyconvex, balanced).
911{
912protected:
915
916public:
919 {
920 // lambda mu_301 + mu_316.
921 // 3/8 <= lambda <= 9/8 should produce best asymptotic balance.
924 }
925
926 virtual int Id() const { return 328; }
927 virtual ~TMOP_Metric_328() { delete sh_metric; delete sz_metric; }
928};
929
930/// 3D compound barrier Shape+Size (VS) metric (polyconvex).
932{
933protected:
935
936public:
939 {
940 // (1-gamma) mu_302 + gamma mu_315
941 AddQualityMetric(sh_metric, 1.-gamma);
943 }
944
945 virtual int Id() const { return 332; }
946 real_t GetGamma() const { return wt_arr[1]; }
947
948 virtual ~TMOP_Metric_332() { delete sh_metric; delete sz_metric; }
949};
950
951/// 3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
953{
954protected:
957
958public:
961 {
962 // (1-gamma) mu_302 + gamma mu_316
963 AddQualityMetric(sh_metric, 1.-gamma);
965 }
966
967 virtual ~TMOP_Metric_333() { delete sh_metric; delete sz_metric; }
968};
969
970/// 3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
972{
973protected:
976
977public:
980 {
981 // (1-gamma) mu_303 + gamma mu_316
982 AddQualityMetric(sh_metric, 1.-gamma);
984 }
985
986 virtual int Id() const { return 334; }
987 real_t GetGamma() const { return wt_arr[1]; }
988
989 virtual ~TMOP_Metric_334() { delete sh_metric; delete sz_metric; }
990};
991
992/// 3D compound barrier Shape+Size (VS) metric (polyconvex, balanced).
994{
995protected:
998
999public:
1002 {
1003 // mu_302 + lambda mu_318.
1004 // 4/9 <= lambda <= 3 should produce best asymptotic balance.
1006 AddQualityMetric(sz_metric, 0.5 * (4.0/9.0 + 3.0));
1007 }
1008
1009 virtual int Id() const { return 338; }
1010 virtual ~TMOP_Metric_338() { delete sh_metric; delete sz_metric; }
1011};
1012
1013/// 3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
1015{
1016protected:
1019
1020public:
1023 {
1024 // (1-gamma) mu_304 + gamma mu_316
1025 AddQualityMetric(sh_metric, 1.-gamma);
1027 }
1028
1029 virtual int Id() const { return 347; }
1030 real_t GetGamma() const { return wt_arr[1]; }
1031
1032 virtual ~TMOP_Metric_347() { delete sh_metric; delete sz_metric; }
1033};
1034
1035/// 3D shifted barrier form of metric 316 (not typed).
1037{
1038protected:
1041
1042public:
1044
1045 // W = 0.5(det(J) - 1)^2 / (det(J) - tau0).
1046 virtual real_t EvalW(const DenseMatrix &Jpt) const;
1047
1048 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
1049
1050 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
1051 const real_t weight, DenseMatrix &A) const;
1052};
1053
1054/// 3D non-barrier Shape (S) metric.
1056{
1057protected:
1059
1060public:
1061 // W = |J|^3 / 3^(3/2) - det(J).
1062 virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const;
1063
1064 // W = (I1b/3)^3/2 - 1.
1065 virtual real_t EvalW(const DenseMatrix &Jpt) const;
1066
1067 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const;
1068
1069 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
1070 const real_t weight, DenseMatrix &A) const;
1071
1072 virtual int Id() const { return 360; }
1073};
1074
1075/// A-metrics
1076/// 2D barrier Shape (S) metric (polyconvex).
1078{
1079protected:
1081
1082public:
1083 // (1/4 alpha) | A - (adj A)^t W^t W / omega |^2
1084 virtual real_t EvalW(const DenseMatrix &Jpt) const;
1085
1086 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
1087 { MFEM_ABORT("Not implemented"); }
1088
1089 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
1090 const real_t weight, DenseMatrix &A) const
1091 { MFEM_ABORT("Not implemented"); }
1092};
1093
1094/// 2D barrier Size (V) metric (polyconvex).
1096{
1097protected:
1099
1100public:
1101 // 0.5 * ( sqrt(alpha/omega) - sqrt(omega/alpha) )^2
1102 virtual real_t EvalW(const DenseMatrix &Jpt) const;
1103
1104 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
1105 { MFEM_ABORT("Not implemented"); }
1106
1107 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
1108 const real_t weight, DenseMatrix &A) const
1109 { MFEM_ABORT("Not implemented"); }
1110};
1111
1112/// 2D barrier Shape+Size+Orientation (VOS) metric (polyconvex).
1114{
1115protected:
1117
1118public:
1119 // (1/alpha) | A - W |^2
1120 virtual real_t EvalW(const DenseMatrix &Jpt) const;
1121
1122 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
1123 { MFEM_ABORT("Not implemented"); }
1124
1125 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
1126 const real_t weight, DenseMatrix &A) const
1127 { MFEM_ABORT("Not implemented"); }
1128};
1129
1130/// 2D barrier Shape+Orientation (OS) metric (polyconvex).
1132{
1133protected:
1135
1136public:
1137 // (1/2 alpha) | A - (|A|/|W|) W |^2
1138 virtual real_t EvalW(const DenseMatrix &Jpt) const;
1139
1140 virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
1141 { MFEM_ABORT("Not implemented"); }
1142
1143 virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS,
1144 const real_t weight, DenseMatrix &A) const
1145 { MFEM_ABORT("Not implemented"); }
1146};
1147
1148/// 2D barrier Shape+Size (VS) metric (polyconvex).
1150{
1151protected:
1154
1155public:
1158 {
1159 // (1-gamma) nu_11 + gamma nu_14
1160 AddQualityMetric(sh_metric, 1.-gamma);
1162 }
1163
1164 virtual ~TMOP_AMetric_126() { delete sh_metric; delete sz_metric; }
1165};
1166
1167/// Base class for limiting functions to be used in class TMOP_Integrator.
1168/** This class represents a scalar function f(x, x0, d), where x and x0 are
1169 positions in physical space, and d is a reference physical distance
1170 associated with the point x0. */
1172{
1173public:
1174 /// Returns the limiting function, f(x, x0, d).
1175 virtual real_t Eval(const Vector &x, const Vector &x0, real_t d) const = 0;
1176
1177 /** @brief Returns the gradient of the limiting function f(x, x0, d) with
1178 respect to x. */
1179 virtual void Eval_d1(const Vector &x, const Vector &x0, real_t dist,
1180 Vector &d1) const = 0;
1181
1182 /** @brief Returns the Hessian of the limiting function f(x, x0, d) with
1183 respect to x. */
1184 virtual void Eval_d2(const Vector &x, const Vector &x0, real_t dist,
1185 DenseMatrix &d2) const = 0;
1186
1187 /// Virtual destructor.
1189};
1190
1191/// Default limiter function in TMOP_Integrator.
1193{
1194public:
1195 virtual real_t Eval(const Vector &x, const Vector &x0, real_t dist) const
1196 {
1197 MFEM_ASSERT(x.Size() == x0.Size(), "Bad input.");
1198
1199 return 0.5 * x.DistanceSquaredTo(x0) / (dist * dist);
1200 }
1201
1202 virtual void Eval_d1(const Vector &x, const Vector &x0, real_t dist,
1203 Vector &d1) const
1204 {
1205 MFEM_ASSERT(x.Size() == x0.Size(), "Bad input.");
1206
1207 d1.SetSize(x.Size());
1208 subtract(1.0 / (dist * dist), x, x0, d1);
1209 }
1210
1211 virtual void Eval_d2(const Vector &x, const Vector &x0, real_t dist,
1212 DenseMatrix &d2) const
1213 {
1214 MFEM_ASSERT(x.Size() == x0.Size(), "Bad input.");
1215
1216 d2.Diag(1.0 / (dist * dist), x.Size());
1217 }
1218
1220};
1221
1222/// Exponential limiter function in TMOP_Integrator.
1224{
1225public:
1226 virtual real_t Eval(const Vector &x, const Vector &x0, real_t dist) const
1227 {
1228 MFEM_ASSERT(x.Size() == x0.Size(), "Bad input.");
1229
1230 return exp(10.0*((x.DistanceSquaredTo(x0) / (dist * dist))-1.0));
1231 }
1232
1233 virtual void Eval_d1(const Vector &x, const Vector &x0, real_t dist,
1234 Vector &d1) const
1235 {
1236 MFEM_ASSERT(x.Size() == x0.Size(), "Bad input.");
1237
1238 d1.SetSize(x.Size());
1239 real_t dist_squared = dist*dist;
1240 subtract(20.0*exp(10.0*((x.DistanceSquaredTo(x0) / dist_squared) - 1.0)) /
1241 dist_squared, x, x0, d1);
1242 }
1243
1244 virtual void Eval_d2(const Vector &x, const Vector &x0, real_t dist,
1245 DenseMatrix &d2) const
1246 {
1247 MFEM_ASSERT(x.Size() == x0.Size(), "Bad input.");
1248 Vector tmp;
1249 tmp.SetSize(x.Size());
1250 real_t dist_squared = dist*dist;
1251 real_t dist_squared_squared = dist_squared*dist_squared;
1252 real_t f = exp(10.0*((x.DistanceSquaredTo(x0) / dist_squared)-1.0));
1253
1254 subtract(x,x0,tmp);
1255 d2.SetSize(x.Size());
1256 d2(0,0) = ((400.0*tmp(0)*tmp(0)*f)/dist_squared_squared)+(20.0*f/dist_squared);
1257 d2(1,1) = ((400.0*tmp(1)*tmp(1)*f)/dist_squared_squared)+(20.0*f/dist_squared);
1258 d2(0,1) = (400.0*tmp(0)*tmp(1)*f)/dist_squared_squared;
1259 d2(1,0) = d2(0,1);
1260
1261 if (x.Size() == 3)
1262 {
1263 d2(0,2) = (400.0*tmp(0)*tmp(2)*f)/dist_squared_squared;
1264 d2(1,2) = (400.0*tmp(1)*tmp(2)*f)/dist_squared_squared;
1265 d2(2,0) = d2(0,2);
1266 d2(2,1) = d2(1,2);
1267 d2(2,2) = ((400.0*tmp(2)*tmp(2)*f)/dist_squared_squared)+(20.0*f/dist_squared);
1268 }
1269
1270 }
1271
1273};
1274
1275class FiniteElementCollection;
1276class FiniteElementSpace;
1277class ParFiniteElementSpace;
1278
1280{
1281protected:
1282 // Owned.
1285
1286#ifdef MFEM_USE_MPI
1287 // Owned.
1290#endif
1291
1292public:
1294 {
1295#ifdef MFEM_USE_MPI
1296 pmesh = NULL;
1297 pfes = NULL;
1298#endif
1299 }
1300 virtual ~AdaptivityEvaluator();
1301
1302 /** Specifies the Mesh and FiniteElementSpace of the solution that will
1303 be evaluated. The given mesh will be copied into the internal object. */
1304 void SetSerialMetaInfo(const Mesh &m,
1305 const FiniteElementSpace &f);
1306
1307#ifdef MFEM_USE_MPI
1308 /// Parallel version of SetSerialMetaInfo.
1309 void SetParMetaInfo(const ParMesh &m,
1310 const ParFiniteElementSpace &f);
1311#endif
1312
1313 // TODO use GridFunctions to make clear it's on the ldofs?
1314 virtual void SetInitialField(const Vector &init_nodes,
1315 const Vector &init_field) = 0;
1316
1317 virtual void ComputeAtNewPosition(const Vector &new_nodes,
1318 Vector &new_field,
1319 int new_nodes_ordering = Ordering::byNODES) = 0;
1320
1321 void ClearGeometricFactors();
1322};
1323
1324/** @brief Base class representing target-matrix construction algorithms for
1325 mesh optimization via the target-matrix optimization paradigm (TMOP). */
1326/** This class is used by class TMOP_Integrator to construct the target Jacobian
1327 matrices (reference-element to target-element) at quadrature points. It
1328 supports a set of algorithms chosen by the #TargetType enumeration.
1329
1330 New target-matrix construction algorithms can be defined by deriving new
1331 classes and overriding the methods ComputeElementTargets() and
1332 ContainsVolumeInfo(). */
1334{
1335public:
1336 /// Target-matrix construction algorithms supported by this class.
1338 {
1340 Ideal shape, unit size; the nodes are not used. */
1342 Ideal shape, equal size/volume; the given nodes define the total target
1343 volume; for each mesh element, the target volume is the average volume
1344 multiplied by the volume scale, set with SetVolumeScale(). */
1346 Ideal shape, given size/volume; the given nodes define the target
1347 volume at all quadrature points. */
1349 Given shape, given size/volume; the given nodes define the exact target
1350 Jacobian matrix at all quadrature points. */
1351 GIVEN_FULL /**<
1352 Full target tensor is specified at every quadrature point. */
1354
1355protected:
1356 // Nodes that are used in ComputeElementTargets(), depending on target_type.
1357 const GridFunction *nodes; // not owned
1361 bool uses_phys_coords; // see UsesPhysicalCoordinates()
1362
1363#ifdef MFEM_USE_MPI
1364 MPI_Comm comm;
1365#endif
1366
1367 // should be called only if avg_volume == 0.0, i.e. avg_volume is not
1368 // computed yet
1369 void ComputeAvgVolume() const;
1370
1371 template<int DIM>
1373 const IntegrationRule &ir,
1374 const Vector &xe,
1375 DenseTensor &Jtr) const;
1376
1377 // CPU fallback that uses ComputeElementTargets()
1379 const IntegrationRule &ir,
1380 const Vector &xe,
1381 DenseTensor &Jtr) const;
1382
1383public:
1384 /// Constructor for use in serial
1386 : nodes(NULL), avg_volume(), volume_scale(1.0), target_type(ttype),
1387 uses_phys_coords(false)
1388 {
1389#ifdef MFEM_USE_MPI
1390 comm = MPI_COMM_NULL;
1391#endif
1392 }
1393#ifdef MFEM_USE_MPI
1394 /// Constructor for use in parallel
1395 TargetConstructor(TargetType ttype, MPI_Comm mpicomm)
1396 : nodes(NULL), avg_volume(), volume_scale(1.0), target_type(ttype),
1397 uses_phys_coords(false), comm(mpicomm) { }
1398#endif
1400
1401#ifdef MFEM_USE_MPI
1402 bool Parallel() const { return (comm != MPI_COMM_NULL); }
1403 MPI_Comm GetComm() const { return comm; }
1404#else
1405 bool Parallel() const { return false; }
1406#endif
1407
1408 /** @brief Set the nodes to be used in the target-matrix construction.
1409
1410 This method should be called every time the target nodes are updated
1411 externally and recomputation of the target average volume is needed. The
1412 nodes are used by all target types except IDEAL_SHAPE_UNIT_SIZE. */
1413 void SetNodes(const GridFunction &n) { nodes = &n; avg_volume = 0.0; }
1414
1415 /** @brief Get the nodes to be used in the target-matrix construction. */
1416 const GridFunction *GetNodes() const { return nodes; }
1417
1418 /// Used by target type IDEAL_SHAPE_EQUAL_SIZE. The default volume scale is 1.
1419 void SetVolumeScale(real_t vol_scale) { volume_scale = vol_scale; }
1420
1422
1423 /** @brief Return true if the methods ComputeElementTargets(),
1424 ComputeAllElementTargets(), and ComputeElementTargetsGradient() use the
1425 physical node coordinates provided by the parameters 'elfun', or 'xe'. */
1427
1428 /// Checks if the target matrices contain non-trivial size specification.
1429 virtual bool ContainsVolumeInfo() const;
1430
1431 /** @brief Given an element and quadrature rule, computes ref->target
1432 transformation Jacobians for each quadrature point in the element.
1433 The physical positions of the element's nodes are given by @a elfun. */
1434 virtual void ComputeElementTargets(int e_id, const FiniteElement &fe,
1435 const IntegrationRule &ir,
1436 const Vector &elfun,
1437 DenseTensor &Jtr) const;
1438
1439 /** @brief Computes reference-to-target transformation Jacobians for all
1440 quadrature points in all elements.
1441
1442 @param[in] fes The nodal FE space
1443 @param[in] ir The quadrature rule to use for all elements
1444 @param[in] xe E-vector with the current physical coordinates/positions;
1445 this parameter is used only when needed by the target
1446 constructor, see UsesPhysicalCoordinates()
1447 @param[out] Jtr The computed ref->target Jacobian matrices. */
1448 virtual void ComputeAllElementTargets(const FiniteElementSpace &fes,
1449 const IntegrationRule &ir,
1450 const Vector &xe,
1451 DenseTensor &Jtr) const;
1452
1453 virtual void ComputeElementTargetsGradient(const IntegrationRule &ir,
1454 const Vector &elfun,
1456 DenseTensor &dJtr) const;
1457};
1458
1460{
1461public:
1463
1464 /** @brief Evaluate the derivative of the matrix coefficient with respect to
1465 @a comp in the element described by @a T at the point @a ip, storing the
1466 result in @a K. */
1468 const IntegrationPoint &ip, int comp) = 0;
1469
1471};
1472
1474{
1475protected:
1476 // Analytic target specification.
1480
1481public:
1483 : TargetConstructor(ttype),
1484 scalar_tspec(NULL), vector_tspec(NULL), matrix_tspec(NULL)
1485 { uses_phys_coords = true; }
1486
1487 virtual void SetAnalyticTargetSpec(Coefficient *sspec,
1488 VectorCoefficient *vspec,
1489 TMOPMatrixCoefficient *mspec);
1490
1491 /** @brief Given an element and quadrature rule, computes ref->target
1492 transformation Jacobians for each quadrature point in the element.
1493 The physical positions of the element's nodes are given by @a elfun. */
1494 virtual void ComputeElementTargets(int e_id, const FiniteElement &fe,
1495 const IntegrationRule &ir,
1496 const Vector &elfun,
1497 DenseTensor &Jtr) const;
1498
1499 virtual void ComputeAllElementTargets(const FiniteElementSpace &fes,
1500 const IntegrationRule &ir,
1501 const Vector &xe,
1502 DenseTensor &Jtr) const;
1503
1504 virtual void ComputeElementTargetsGradient(const IntegrationRule &ir,
1505 const Vector &elfun,
1507 DenseTensor &dJtr) const;
1508};
1509
1510#ifdef MFEM_USE_MPI
1511class ParGridFunction;
1512#endif
1513
1515{
1516protected:
1517 // Discrete target specification.
1518 // Data is owned, updated by UpdateTargetSpecification.
1520 Vector tspec; //eta(x) - we enforce Ordering::byNODES
1523 Vector tspec_pert2h; //eta(x+2*h)
1524 Vector tspec_pertmix; //eta(x+h,y+h)
1525 // The order inside these perturbation vectors (e.g. in 2D) is
1526 // eta1(x+h,y), eta2(x+h,y) ... etan(x+h,y), eta1(x,y+h), eta2(x,y+h) ...
1527 // same for tspec_pert2h and tspec_pertmix.
1528
1529 // DenseMatrix to hold target_spec values for the (children of the)
1530 // element being refined to consider for h-refinement.
1532 // Vector to hold the target_spec values for the coarse version of the
1533 // current mesh. Used for derefinement decision with hr-adaptivity.
1535
1536 // Components of Target Jacobian at each quadrature point of an element. This
1537 // is required for computation of the derivative using chain rule.
1539
1540 // Note: do not use the Nodes of this space as they may not be on the
1541 // positions corresponding to the values of tspec.
1543 FiniteElementSpace *coarse_tspec_fesv; //not owned, derefinement FESpace
1544 GridFunction *tspec_gf; //owned, uses tspec and tspec_fes
1545 // discrete adaptivity
1546#ifdef MFEM_USE_MPI
1547 ParFiniteElementSpace *ptspec_fesv; //owned, needed for derefinement to
1548 // get update operator.
1549 ParGridFunction *tspec_pgf; // similar to tspec_gf
1550#endif
1551
1554
1555 // These flags can be used by outside functions to avoid recomputing the
1556 // tspec and tspec_perth fields again on the same mesh.
1558
1559 // Evaluation of the discrete target specification on different meshes.
1560 // Owned.
1562
1563 void SetDiscreteTargetBase(const GridFunction &tspec_);
1564 void SetTspecAtIndex(int idx, const GridFunction &tspec_);
1566#ifdef MFEM_USE_MPI
1567 void SetTspecAtIndex(int idx, const ParGridFunction &tspec_);
1569#endif
1570
1571public:
1573 : TargetConstructor(ttype),
1574 ncomp(0),
1575 sizeidx(-1), skewidx(-1), aspectratioidx(-1), orientationidx(-1),
1578 tspec_fesv(NULL), coarse_tspec_fesv(NULL), tspec_gf(NULL),
1579#ifdef MFEM_USE_MPI
1580 ptspec_fesv(NULL), tspec_pgf(NULL),
1581#endif
1582 amr_el(-1), lim_min_size(-0.1),
1583 good_tspec(false), good_tspec_grad(false), good_tspec_hess(false),
1584 adapt_eval(NULL) { }
1585
1586 virtual ~DiscreteAdaptTC();
1587
1588 /** @name Target specification methods.
1589 The following methods are used to specify geometric parameters of the
1590 targets when these parameters are given by discrete FE functions.
1591 Note that every GridFunction given to the Set methods must use a
1592 H1_FECollection of the same order. The number of components must
1593 correspond to the type of geometric parameter and dimension.
1594
1595 @param[in] tspec_ Input values of a geometric parameter. Note that
1596 the methods in this class support only functions that
1597 use H1_FECollection collection of the same order. */
1598 ///@{
1599 virtual void SetSerialDiscreteTargetSpec(const GridFunction &tspec_);
1600 virtual void SetSerialDiscreteTargetSize(const GridFunction &tspec_);
1601 virtual void SetSerialDiscreteTargetSkew(const GridFunction &tspec_);
1602 virtual void SetSerialDiscreteTargetAspectRatio(const GridFunction &tspec_);
1603 virtual void SetSerialDiscreteTargetOrientation(const GridFunction &tspec_);
1604#ifdef MFEM_USE_MPI
1605 virtual void SetParDiscreteTargetSpec(const ParGridFunction &tspec_);
1606 virtual void SetParDiscreteTargetSize(const ParGridFunction &tspec_);
1607 virtual void SetParDiscreteTargetSkew(const ParGridFunction &tspec_);
1608 virtual void SetParDiscreteTargetAspectRatio(const ParGridFunction &tspec_);
1609 virtual void SetParDiscreteTargetOrientation(const ParGridFunction &tspec_);
1610#endif
1611 ///@}
1612
1613 /// Used in combination with the Update methods to avoid extra computations.
1616
1617 /// Get one of the discrete fields from tspec.
1618 void GetDiscreteTargetSpec(GridFunction &tspec_, int idx);
1619 /// Get the FESpace associated with tspec.
1621 /// Get the entire tspec.
1623 /// Update all discrete fields based on tspec and update for AMR
1625
1626#ifdef MFEM_USE_MPI
1629#endif
1630
1631 /** Used to update the target specification after the mesh has changed. The
1632 new mesh positions are given by new_x. If @a reuse_flag is true,
1633 repeated calls won't do anything until ResetUpdateFlags() is called. */
1634 void UpdateTargetSpecification(const Vector &new_x, bool reuse_flag = false,
1635 int new_x_ordering=Ordering::byNODES);
1636
1637 void UpdateTargetSpecification(Vector &new_x, Vector &IntData,
1638 int new_x_ordering=Ordering::byNODES);
1639
1642 int nodenum, int idir,
1643 const Vector &IntData);
1644
1646
1647 /** Used for finite-difference based computations. Computes the target
1648 specifications after a mesh perturbation in x or y direction.
1649 If @a reuse_flag is true, repeated calls won't do anything until
1650 ResetUpdateFlags() is called. */
1652 bool reuse_flag = false,
1653 int x_ordering = Ordering::byNODES);
1654 /** Used for finite-difference based computations. Computes the target
1655 specifications after two mesh perturbations in x and/or y direction.
1656 If @a reuse_flag is true, repeated calls won't do anything until
1657 ResetUpdateFlags() is called. */
1659 bool reuse_flag = false,
1660 int x_ordering = Ordering::byNODES);
1661
1663 {
1664 if (adapt_eval) { delete adapt_eval; }
1665 adapt_eval = ae;
1666 }
1667
1669 {
1670 return adapt_eval;
1671 }
1672
1676
1677 /** @brief Given an element and quadrature rule, computes ref->target
1678 transformation Jacobians for each quadrature point in the element.
1679 The physical positions of the element's nodes are given by @a elfun.
1680 Note that this function assumes that UpdateTargetSpecification() has
1681 been called with the position vector corresponding to @a elfun. */
1682 virtual void ComputeElementTargets(int e_id, const FiniteElement &fe,
1683 const IntegrationRule &ir,
1684 const Vector &elfun,
1685 DenseTensor &Jtr) const;
1686
1687 virtual void ComputeAllElementTargets(const FiniteElementSpace &fes,
1688 const IntegrationRule &ir,
1689 const Vector &xe,
1690 DenseTensor &Jtr) const;
1691
1692 virtual void ComputeElementTargetsGradient(const IntegrationRule &ir,
1693 const Vector &elfun,
1695 DenseTensor &dJtr) const;
1696
1697 // Generates tspec_vals for target construction using intrule
1698 // Used for the refinement component in hr-adaptivity.
1699 void SetTspecFromIntRule(int e_id, const IntegrationRule &intrule);
1700
1701 // Targets based on discrete functions can result in invalid (negative)
1702 // size at the quadrature points. This method can be used to set a
1703 // minimum target size.
1704 void SetMinSizeForTargets(real_t min_size_) { lim_min_size = min_size_; }
1705
1706 /// Computes target specification data with respect to the coarse FE space.
1708
1709 // Reset refinement data associated with h-adaptivity component.
1711 {
1713 amr_el = -1;
1714 }
1715
1716 // Reset derefinement data associated with h-adaptivity component.
1718 {
1720 coarse_tspec_fesv = NULL;
1721 }
1722
1723 // Used to specify the fine element for determining energy of children of a
1724 // parent element.
1725 void SetRefinementSubElement(int amr_el_) { amr_el = amr_el_; }
1726};
1727
1728class TMOPNewtonSolver;
1729
1730/** @brief A TMOP integrator class based on any given TMOP_QualityMetric and
1731 TargetConstructor.
1732
1733 Represents $ \int W(Jpt) dx $ over a target zone, where W is the
1734 metric's strain energy density function, and Jpt is the Jacobian of the
1735 target->physical coordinates transformation. The virtual target zone is
1736 defined by the TargetConstructor. */
1738{
1739protected:
1740 friend class TMOPNewtonSolver;
1742
1745 const TargetConstructor *targetC; // not owned
1746
1747 // Custom integration rules.
1751
1752 // Weight Coefficient multiplying the quality metric term.
1753 Coefficient *metric_coeff; // not owned, if NULL -> metric_coeff is 1.
1754 // Normalization factor for the metric term.
1756
1757 // Nodes and weight Coefficient used for "limiting" the TMOP_Integrator.
1758 // These are both NULL when there is no limiting.
1759 // The class doesn't own lim_nodes0 and lim_coeff.
1762 // Limiting reference distance. Not owned.
1764 // Limiting function. Owned.
1766 // Normalization factor for the limiting term.
1768
1769 // Adaptive limiting.
1770 const GridFunction *adapt_lim_gf0; // Not owned.
1771#ifdef MFEM_USE_MPI
1773#endif
1774 GridFunction *adapt_lim_gf; // Owned. Updated by adapt_lim_eval.
1777
1778 // Surface fitting.
1779 const Array<bool> *surf_fit_marker; // Not owned. Nodes to fit.
1780 Coefficient *surf_fit_coeff; // Not owned. Fitting term scaling.
1781 // Fitting to a discrete level set.
1782 GridFunction *surf_fit_gf; // Owned. Updated by surf_fit_eval.
1784 // Fitting to given physical positions.
1785 TMOP_QuadraticLimiter *surf_fit_limiter; // Owned. Created internally.
1786 const GridFunction *surf_fit_pos; // Not owned. Positions to fit.
1793
1795
1796 // Parameters for FD-based Gradient & Hessian calculation.
1800 // Specifies that ComputeElementTargets is being called by a FD function.
1801 // It's used to skip terms that have exact derivative calculations.
1803 // Compute the exact action of the Integrator (includes derivative of the
1804 // target with respect to spatial position)
1806
1807 Array <Vector *> ElemDer; //f'(x)
1808 Array <Vector *> ElemPertEnergy; //f(x+h)
1809
1810 // Jrt: the inverse of the ref->target Jacobian, Jrt = Jtr^{-1}.
1811 // Jpr: the ref->physical transformation Jacobian, Jpr = PMatI^t DS.
1812 // Jpt: the target->physical transformation Jacobian, Jpt = Jpr Jrt.
1813 // P: represents dW_d(Jtp) (dim x dim).
1814 // DSh: gradients of reference shape functions (dof x dim).
1815 // DS: gradients of the shape functions in the target configuration,
1816 // DS = DSh Jrt (dof x dim).
1817 // PMatI: current coordinates of the nodes (dof x dim).
1818 // PMat0: reshaped view into the local element contribution to the operator
1819 // output - the result of AssembleElementVector() (dof x dim).
1821
1822 // PA extension
1823 // ------------
1824 // Jtr: all ref->target Jacobians, (dim x dim) Q-Vector as DenseTensor.
1825 // updated when needed, based on Jtr_needs_update.
1826 //
1827 // E: Q-vector for TMOP-energy
1828 // Used as temporary storage when the total energy is computed.
1829 // O: Q-Vector of 1.0, used to compute sums using the dot product kernel.
1830 // X0: E-vector for initial nodal coordinates used for limiting.
1831 // Does not change during the TMOP iteration.
1832 // H: Q-Vector for Hessian associated with the metric term.
1833 // Updated by every call to PANonlinearFormExtension::GetGradient().
1834 // C0: Q-Vector for spatial weight used for the limiting term.
1835 // Updated when the mesh nodes change.
1836 // LD: E-Vector constructed using limiting distance grid function (delta).
1837 // Does not change during the TMOP iteration.
1838 // H0: Q-Vector for Hessian associated with the limiting term.
1839 // Updated by every call to PANonlinearFormExtension::GetGradient().
1840 // MC: Q-Vector for the metric Coefficient.
1841 // Updated when the mesh nodes change.
1842 //
1843 // maps: Dof2Quad map for fes associated with the nodal coordinates.
1844 // maps_lim: Dof2Quad map for fes associated with the limiting dist GridFunc.
1845 //
1846 // Jtr_debug_grad
1847 // We keep track if Jtr was set by AssembleGradPA() in Jtr_debug_grad: it
1848 // is set to true by AssembleGradPA(); any other call to
1849 // ComputeAllElementTargets() will set the flag to false. This flag will
1850 // be used to check that Jtr is the one set by AssembleGradPA() when
1851 // performing operations with the gradient like AddMultGradPA() and
1852 // AssembleGradDiagonalPA().
1853 //
1854 // TODO:
1855 // * Merge LD, C0, H0 into one scalar Q-vector
1856 struct
1857 {
1859 int dim, ne, nq;
1861 mutable bool Jtr_needs_update;
1862 mutable bool Jtr_debug_grad;
1863 mutable Vector E, O, X0, H, C0, LD, H0, MC;
1865 const DofToQuad *maps_lim = nullptr;
1870
1872 real_t &metric_energy, real_t &lim_energy,
1873 real_t &surf_fit_gf_energy);
1874
1877 const Vector &elfun, Vector &elvect);
1878
1881 const Vector &elfun, DenseMatrix &elmat);
1882
1885 const Vector &elfun, Vector &elvect);
1886
1887 // Assumes that AssembleElementVectorFD has been called.
1888 void AssembleElementGradFD(const FiniteElement &el,
1890 const Vector &elfun, DenseMatrix &elmat);
1891
1894 const IntegrationRule &ir,
1895 const Vector &weights, DenseMatrix &mat);
1898 const IntegrationRule &ir,
1899 const Vector &weights, DenseMatrix &m);
1900
1901 // First derivative of the surface fitting term.
1902 void AssembleElemVecSurfFit(const FiniteElement &el_x,
1904 DenseMatrix &mat);
1905
1906 // Second derivative of the surface fitting term.
1907 void AssembleElemGradSurfFit(const FiniteElement &el_x,
1909 DenseMatrix &mat);
1910
1913 Vector &elfun, const int nodenum,const int idir,
1914 const real_t baseenergy, bool update_stored);
1915
1916 /** @brief Determines the perturbation, h, for FD-based approximation. */
1917 void ComputeFDh(const Vector &x, const FiniteElementSpace &fes);
1918 void ComputeMinJac(const Vector &x, const FiniteElementSpace &fes);
1919
1920 void UpdateAfterMeshPositionChange(const Vector &x_new,
1921 const FiniteElementSpace &x_fes);
1922
1924 {
1925 lim_nodes0 = NULL; lim_coeff = NULL; lim_dist = NULL;
1926 delete lim_func; lim_func = NULL;
1927 }
1928
1930 {
1931 if (IntegRules)
1932 {
1933 return IntegRules->Get(el.GetGeomType(), integ_order);
1934 }
1935 return (IntRule) ? *IntRule
1936 /* */ : IntRules.Get(el.GetGeomType(), 2*el.GetOrder() + 3);
1937 }
1939 {
1940 // TODO the energy most likely needs less integration points.
1941 return EnergyIntegrationRule(el);
1942 }
1944 {
1945 // TODO the action and energy most likely need less integration points.
1946 return EnergyIntegrationRule(el);
1947 }
1948
1949 // Auxiliary PA methods
1950 void AssembleGradPA_2D(const Vector&) const;
1951 void AssembleGradPA_3D(const Vector&) const;
1952 void AssembleGradPA_C0_2D(const Vector&) const;
1953 void AssembleGradPA_C0_3D(const Vector&) const;
1954
1959
1960 void AddMultPA_2D(const Vector&, Vector&) const;
1961 void AddMultPA_3D(const Vector&, Vector&) const;
1962 void AddMultPA_C0_2D(const Vector&, Vector&) const;
1963 void AddMultPA_C0_3D(const Vector&, Vector&) const;
1964
1965 void AddMultGradPA_2D(const Vector&, Vector&) const;
1966 void AddMultGradPA_3D(const Vector&, Vector&) const;
1967 void AddMultGradPA_C0_2D(const Vector&, Vector&) const;
1968 void AddMultGradPA_C0_3D(const Vector&, Vector&) const;
1969
1970 void AssembleDiagonalPA_2D(Vector&) const;
1971 void AssembleDiagonalPA_3D(Vector&) const;
1972 void AssembleDiagonalPA_C0_2D(Vector&) const;
1973 void AssembleDiagonalPA_C0_3D(Vector&) const;
1974
1975 void AssemblePA_Limiting();
1976 void ComputeAllElementTargets(const Vector &xe = Vector()) const;
1977 // Updates the Q-vectors for the metric_coeff and lim_coeff, based on the
1978 // new physical positions of the quadrature points.
1979 void UpdateCoefficientsPA(const Vector &x_loc);
1980
1981 // Compute Min(Det(Jpt)) in the mesh, does not reduce over MPI.
1983 // Compute Max(mu_hat) for the TMOP_WorstCaseUntangleOptimizer_Metric,
1984 // does not reduce over MPI.
1986 const FiniteElementSpace &fes);
1987
1988public:
1989 /** @param[in] m TMOP_QualityMetric for r-adaptivity (not owned).
1990 @param[in] tc Target-matrix construction algorithm to use (not owned).
1991 @param[in] hm TMOP_QualityMetric for h-adaptivity (not owned). */
1994 : h_metric(hm), metric(m), targetC(tc), IntegRules(NULL),
1995 integ_order(-1), metric_coeff(NULL), metric_normal(1.0),
1996 lim_nodes0(NULL), lim_coeff(NULL),
1997 lim_dist(NULL), lim_func(NULL), lim_normal(1.0),
1998 adapt_lim_gf0(NULL), adapt_lim_gf(NULL), adapt_lim_coeff(NULL),
1999 adapt_lim_eval(NULL),
2000 surf_fit_marker(NULL), surf_fit_coeff(NULL),
2001 surf_fit_gf(NULL), surf_fit_eval(NULL),
2002 surf_fit_limiter(NULL), surf_fit_pos(NULL),
2003 surf_fit_normal(1.0),
2004 surf_fit_gf_bg(false), surf_fit_grad(NULL), surf_fit_hess(NULL),
2006 discr_tc(dynamic_cast<DiscreteAdaptTC *>(tc)),
2007 fdflag(false), dxscale(1.0e3), fd_call_flag(false), exact_action(false)
2008 { PA.enabled = false; }
2009
2012
2014
2015 /// Release the device memory of large PA allocations. This will copy device
2016 /// memory back to the host before releasing.
2017 void ReleasePADeviceMemory(bool copy_to_host = true);
2018
2019 /// Prescribe a set of integration rules; relevant for mixed meshes.
2020 /** This function has priority over SetIntRule(), if both are called. */
2021 void SetIntegrationRules(IntegrationRules &irules, int order)
2022 {
2023 IntegRules = &irules;
2024 integ_order = order;
2025 }
2026
2027 /// The TMOP integrals can be computed over the reference element or the
2028 /// target elements. This function is used to switch between the two options.
2029 /// By default integration is performed over the target elements.
2030 void IntegrateOverTarget(bool integ_over_target_)
2031 {
2032 MFEM_VERIFY(metric_normal == 1.0 && lim_normal == 1.0,
2033 "This function must be called before EnableNormalization, as "
2034 "the normalization computations must know how to integrate.");
2035
2036 integ_over_target = integ_over_target_;
2037 }
2038
2039 /// Sets a scaling Coefficient for the quality metric term of the integrator.
2040 /** With this addition, the integrator becomes
2041 $ \int w1 W(Jpt) dx $.
2042
2043 Note that the Coefficient is evaluated in the physical configuration and
2044 not in the target configuration which may be undefined. */
2046
2047 /** @brief Limiting of the mesh displacements (general version).
2048
2049 Adds the term $ \int w_0 f(x, x_0, d) dx $, where f is a measure of
2050 the displacement between x and x_0, given the max allowed displacement d.
2051
2052 @param[in] n0 Original mesh node coordinates (x0 above).
2053 @param[in] dist Allowed displacement in physical space (d above).
2054 @param[in] w0 Coefficient scaling the limiting integral.
2055 @param[in] lfunc TMOP_LimiterFunction defining the function f. If
2056 NULL, a TMOP_QuadraticLimiter will be used. The
2057 TMOP_Integrator assumes ownership of this pointer. */
2058 void EnableLimiting(const GridFunction &n0, const GridFunction &dist,
2059 Coefficient &w0, TMOP_LimiterFunction *lfunc = NULL);
2060
2061 /** @brief Adds a limiting term to the integrator with limiting distance
2062 function (@a dist in the general version of the method) equal to 1. */
2063 void EnableLimiting(const GridFunction &n0, Coefficient &w0,
2064 TMOP_LimiterFunction *lfunc = NULL);
2065
2066 /** @brief Restriction of the node positions to certain regions.
2067
2068 Adds the term $ \int c (z(x) - z_0(x_0))^2 $, where z0(x0) is a given
2069 function on the starting mesh, and z(x) is its image on the new mesh.
2070 Minimizing this term means that a node at x0 is allowed to move to a
2071 position x(x0) only if z(x) ~ z0(x0).
2072 Such term can be used for tangential mesh relaxation.
2073
2074 @param[in] z0 Function z0 that controls the adaptive limiting.
2075 @param[in] coeff Coefficient c for the above integral.
2076 @param[in] ae AdaptivityEvaluator to compute z(x) from z0(x0). */
2077 void EnableAdaptiveLimiting(const GridFunction &z0, Coefficient &coeff,
2079#ifdef MFEM_USE_MPI
2080 /// Parallel support for adaptive limiting.
2081 void EnableAdaptiveLimiting(const ParGridFunction &z0, Coefficient &coeff,
2083#endif
2084
2085 /** @brief Fitting of certain DOFs to the zero level set of a function.
2086
2087 Having a level set function s0(x0) on the starting mesh, and a set of
2088 marked nodes (or DOFs), we move these nodes to the zero level set of s0.
2089 If s(x) is the image of s0(x0) on the current mesh, this function adds to
2090 the TMOP functional the term $ \int c \bar{s}(x))^2 $, where
2091 $\bar{s}(x)$ is the restriction of s(x) on the aligned DOFs.
2092 Minimizing this term means that a marked node at x0 is allowed to move to
2093 a position x(x0) only if s(x) ~ 0.
2094 Such term can be used for surface fitting and tangential relaxation.
2095
2096 @param[in] s0 The level set function on the initial mesh.
2097 @param[in] smarker Indicates which DOFs will be aligned.
2098 @param[in] coeff Coefficient c for the above integral.
2099 @param[in] ae AdaptivityEvaluator to compute s(x) from s0(x0). */
2100 void EnableSurfaceFitting(const GridFunction &s0,
2101 const Array<bool> &smarker, Coefficient &coeff,
2103
2104#ifdef MFEM_USE_MPI
2105 /// Parallel support for surface fitting to the zero level set of a function.
2107 const Array<bool> &smarker, Coefficient &coeff,
2109
2110 /** @brief Fitting of certain DOFs in the current mesh to the zero level set
2111 of a function defined on another (finer) source mesh.
2112
2113 Having a level set function s_bg(x_bg) on a source/background mesh,
2114 a set of marked nodes (or DOFs) in the current mesh, we move the marked
2115 nodes to the zero level set of s_bg. This functionality is used for
2116 surface fitting and tangential relaxation.
2117
2118 @param[in] s_bg The level set function on the background mesh.
2119 @param[in] s0 The level set function (automatically) interpolated
2120 on the initial mesh.
2121 @param[in] smarker Marker for aligned DOFs in the current mesh.
2122 @param[in] coeff Coefficient c for the fitting penalty term.
2123 @param[in] ae Interpolates s(x) from s_bg(x_bg).
2124 @param[in] s_bg_grad Gradient of s_bg on the background mesh.
2125 @param[in] s0_grad Gradient of s0 on the initial mesh.
2126 @param[in] age Interpolates s_grad(x) from s_bg_grad(x_bg).
2127 @param[in] s_bg_hess Hessian of s(x) on the background mesh.
2128 @param[in] s0_hess Hessian of s0 on the initial mesh.
2129 @param[in] ahe Interpolates s_hess(x) from s_bg_hess(x_bg).
2130 See the pmesh-fitting miniapp for details on usage. */
2132 ParGridFunction &s0,
2133 const Array<bool> &smarker,
2134 Coefficient &coeff,
2136 const ParGridFunction &s_bg_grad,
2137 ParGridFunction &s0_grad,
2139 const ParGridFunction &s_bg_hess,
2140 ParGridFunction &s0_hess,
2141 AdaptivityEvaluator &ahe);
2142#endif
2143 /** @brief Fitting of certain DOFs to given positions in physical space.
2144
2145 Having a set S of marked nodes (or DOFs) and their target positions in
2146 physical space x_t, we move these nodes to the target positions during
2147 the optimization process.
2148 This function adds to the TMOP functional the term
2149 $ \sum_{i \in S} c \frac{1}{2} (x_i - x_{t,i})^2 $,
2150 where $c$ corresponds to @a coeff below and is evaluated at the
2151 DOF locations.
2152
2153 @param[in] pos The desired positions for the mesh nodes.
2154 @param[in] smarker Indicates which DOFs will be aligned.
2155 @param[in] coeff Coefficient c for the above integral. */
2156 void EnableSurfaceFitting(const GridFunction &pos,
2157 const Array<bool> &smarker, Coefficient &coeff);
2158 void GetSurfaceFittingErrors(const Vector &pos,
2159 real_t &err_avg, real_t &err_max);
2161 {
2162 return surf_fit_gf != NULL || surf_fit_pos != NULL;
2163 }
2164
2165 /// Update the original/reference nodes used for limiting.
2166 void SetLimitingNodes(const GridFunction &n0) { lim_nodes0 = &n0; }
2167
2168 /** @brief Computes the integral of W(Jacobian(Trt)) over a target zone.
2169 @param[in] el Type of FiniteElement.
2170 @param[in] T Mesh element transformation.
2171 @param[in] elfun Physical coordinates of the zone. */
2172 virtual real_t GetElementEnergy(const FiniteElement &el,
2174 const Vector &elfun);
2175
2176 /** @brief Computes the mean of the energies of the given element's children.
2177
2178 In addition to the inputs for GetElementEnergy, this function requires an
2179 IntegrationRule to be specified that will give the decomposition of the
2180 given element based on the refinement type being considered. */
2183 const Vector &elfun,
2184 const IntegrationRule &irule);
2185
2186 /// This function is similar to GetElementEnergy, but ignores components
2187 /// such as limiting etc. to compute the element energy.
2190 const Vector &elfun);
2191
2192 virtual void AssembleElementVector(const FiniteElement &el,
2194 const Vector &elfun, Vector &elvect);
2195
2196 virtual void AssembleElementGrad(const FiniteElement &el,
2198 const Vector &elfun, DenseMatrix &elmat);
2199
2201
2203#ifdef MFEM_USE_MPI
2205#endif
2206
2207 // PA extension
2209 virtual void AssemblePA(const FiniteElementSpace&);
2210
2211 virtual void AssembleGradPA(const Vector&, const FiniteElementSpace&);
2212
2213 virtual real_t GetLocalStateEnergyPA(const Vector&) const;
2214
2215 virtual void AddMultPA(const Vector&, Vector&) const;
2216
2217 virtual void AddMultGradPA(const Vector&, Vector&) const;
2218
2219 virtual void AssembleGradDiagonalPA(Vector&) const;
2220
2222
2223 /** @brief Computes the normalization factors of the metric and limiting
2224 integrals using the mesh position given by @a x. */
2225 void EnableNormalization(const GridFunction &x);
2226#ifdef MFEM_USE_MPI
2228#endif
2229
2230 /** @brief Enables FD-based approximation and computes dx. */
2232#ifdef MFEM_USE_MPI
2234#endif
2235
2236 void SetFDhScale(real_t dxscale_) { dxscale = dxscale_; }
2237 bool GetFDFlag() const { return fdflag; }
2238 real_t GetFDh() const { return dx; }
2239
2240 /** @brief Flag to control if exact action of Integration is effected. */
2241 void SetExactActionFlag(bool flag_) { exact_action = flag_; }
2242
2243 /// Update the surface fitting weight as surf_fit_coeff *= factor;
2245
2246 /// Get the surface fitting weight.
2248
2249 /// Computes quantiles needed for UntangleMetrics. Note that in parallel,
2250 /// the ParFiniteElementSpace must be passed as argument for consistency
2251 /// across MPI ranks.
2253 const FiniteElementSpace &fes);
2254};
2255
2257{
2258protected:
2259 // Integrators in the combination. Owned.
2261
2262public:
2264
2266 {
2267 for (int i = 0; i < tmopi.Size(); i++) { delete tmopi[i]; }
2268 }
2269
2270 /// Adds a new TMOP_Integrator to the combination.
2271 void AddTMOPIntegrator(TMOP_Integrator *ti) { tmopi.Append(ti); }
2272
2274
2275 /// Adds the limiting term to the first integrator. Disables it for the rest.
2276 void EnableLimiting(const GridFunction &n0, const GridFunction &dist,
2277 Coefficient &w0, TMOP_LimiterFunction *lfunc = NULL);
2278
2279 /** @brief Adds the limiting term to the first integrator. Disables it for
2280 the rest (@a dist in the general version of the method) equal to 1. */
2281 void EnableLimiting(const GridFunction &n0, Coefficient &w0,
2282 TMOP_LimiterFunction *lfunc = NULL);
2283
2284 /// Update the original/reference nodes used for limiting.
2285 void SetLimitingNodes(const GridFunction &n0);
2286
2287 virtual real_t GetElementEnergy(const FiniteElement &el,
2289 const Vector &elfun);
2290 virtual void AssembleElementVector(const FiniteElement &el,
2292 const Vector &elfun, Vector &elvect);
2293 virtual void AssembleElementGrad(const FiniteElement &el,
2295 const Vector &elfun, DenseMatrix &elmat);
2296
2299 const Vector &elfun,
2300 const IntegrationRule &irule);
2301
2304 const Vector &elfun);
2305
2306 /// Normalization factor that considers all integrators in the combination.
2307 void EnableNormalization(const GridFunction &x);
2308#ifdef MFEM_USE_MPI
2310#endif
2311
2312 // PA extension
2314 virtual void AssemblePA(const FiniteElementSpace&);
2315 virtual void AssembleGradPA(const Vector&, const FiniteElementSpace&);
2316 virtual real_t GetLocalStateEnergyPA(const Vector&) const;
2317 virtual void AddMultPA(const Vector&, Vector&) const;
2318 virtual void AddMultGradPA(const Vector&, Vector&) const;
2319 virtual void AssembleGradDiagonalPA(Vector&) const;
2320};
2321
2322/// Interpolates the @a metric's values at the nodes of @a metric_gf.
2323/** Assumes that @a metric_gf's FiniteElementSpace is initialized. */
2324void InterpolateTMOP_QualityMetric(TMOP_QualityMetric &metric,
2325 const TargetConstructor &tc,
2326 const Mesh &mesh, GridFunction &metric_gf);
2327}
2328
2329#endif
virtual ~AdaptivityEvaluator()
Definition tmop.cpp:2844
virtual void SetInitialField(const Vector &init_nodes, const Vector &init_field)=0
virtual void ComputeAtNewPosition(const Vector &new_nodes, Vector &new_field, int new_nodes_ordering=Ordering::byNODES)=0
void SetSerialMetaInfo(const Mesh &m, const FiniteElementSpace &f)
Definition tmop.cpp:2813
FiniteElementSpace * fes
Definition tmop.hpp:1284
void SetParMetaInfo(const ParMesh &m, const ParFiniteElementSpace &f)
Parallel version of SetSerialMetaInfo.
Definition tmop.cpp:2824
ParFiniteElementSpace * pfes
Definition tmop.hpp:1289
virtual void ComputeAllElementTargets(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
Computes reference-to-target transformation Jacobians for all quadrature points in all elements.
Definition tmop_pa.cpp:138
AnalyticAdaptTC(TargetType ttype)
Definition tmop.hpp:1482
virtual void ComputeElementTargets(int e_id, const FiniteElement &fe, const IntegrationRule &ir, const Vector &elfun, DenseTensor &Jtr) const
Given an element and quadrature rule, computes ref->target transformation Jacobians for each quadratu...
Definition tmop.cpp:1742
Coefficient * scalar_tspec
Definition tmop.hpp:1477
virtual void SetAnalyticTargetSpec(Coefficient *sspec, VectorCoefficient *vspec, TMOPMatrixCoefficient *mspec)
Definition tmop.cpp:1733
TMOPMatrixCoefficient * matrix_tspec
Definition tmop.hpp:1479
VectorCoefficient * vector_tspec
Definition tmop.hpp:1478
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
Definition tmop.cpp:1776
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Definition array.hpp:769
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Data type dense matrix using column-major storage.
Definition densemat.hpp:24
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
Definition densemat.hpp:105
void Diag(real_t c, int n)
Creates n x n diagonal matrix with diagonal elements c.
void Clear()
Delete the matrix data array (if owned) and reset the matrix state.
Definition densemat.hpp:98
Rank 3 tensor (array of matrices)
const Vector & GetTspecPert1H()
Definition tmop.hpp:1673
void UpdateTargetSpecification(const Vector &new_x, bool reuse_flag=false, int new_x_ordering=Ordering::byNODES)
Definition tmop.cpp:2054
virtual void SetSerialDiscreteTargetSkew(const GridFunction &tspec_)
Definition tmop.cpp:1972
virtual void SetParDiscreteTargetAspectRatio(const ParGridFunction &tspec_)
Definition tmop.cpp:1899
ParGridFunction * tspec_pgf
Definition tmop.hpp:1549
DenseTensor Jtrcomp
Definition tmop.hpp:1538
FiniteElementSpace * GetTSpecFESpace()
Get the FESpace associated with tspec.
Definition tmop.hpp:1620
virtual void SetSerialDiscreteTargetAspectRatio(const GridFunction &tspec_)
Definition tmop.cpp:1982
const AdaptivityEvaluator * GetAdaptivityEvaluator() const
Definition tmop.hpp:1668
void SetTspecDataForDerefinement(FiniteElementSpace *fes)
Computes target specification data with respect to the coarse FE space.
Definition tmop.cpp:2131
void ResetDerefinementTspecData()
Definition tmop.hpp:1717
const Vector & GetTspecPertMixH()
Definition tmop.hpp:1675
void SetMinSizeForTargets(real_t min_size_)
Definition tmop.hpp:1704
virtual void SetParDiscreteTargetSpec(const ParGridFunction &tspec_)
Definition tmop.cpp:1919
AdaptivityEvaluator * adapt_eval
Definition tmop.hpp:1561
void FinalizeSerialDiscreteTargetSpec(const GridFunction &tspec_)
Definition tmop.cpp:2002
void FinalizeParDiscreteTargetSpec(const ParGridFunction &tspec_)
Definition tmop.cpp:1823
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
Definition tmop.cpp:2354
ParFiniteElementSpace * ptspec_fesv
Definition tmop.hpp:1547
GridFunction * tspec_gf
Definition tmop.hpp:1544
FiniteElementSpace * coarse_tspec_fesv
Definition tmop.hpp:1543
virtual ~DiscreteAdaptTC()
Definition tmop.cpp:2803
GridFunction * GetTSpecData()
Get the entire tspec.
Definition tmop.hpp:1622
virtual void SetSerialDiscreteTargetSize(const GridFunction &tspec_)
Definition tmop.cpp:1962
virtual void SetParDiscreteTargetSize(const ParGridFunction &tspec_)
Definition tmop.cpp:1879
const Vector & GetTspecPert2H()
Definition tmop.hpp:1674
void UpdateAfterMeshTopologyChange()
Update all discrete fields based on tspec and update for AMR.
Definition tmop.cpp:2037
virtual void ComputeElementTargets(int e_id, const FiniteElement &fe, const IntegrationRule &ir, const Vector &elfun, DenseTensor &Jtr) const
Given an element and quadrature rule, computes ref->target transformation Jacobians for each quadratu...
Definition tmop.cpp:2139
void SetAdaptivityEvaluator(AdaptivityEvaluator *ae)
Definition tmop.hpp:1662
virtual void SetSerialDiscreteTargetSpec(const GridFunction &tspec_)
Definition tmop.cpp:2048
virtual void SetParDiscreteTargetOrientation(const ParGridFunction &tspec_)
Definition tmop.cpp:1909
void ResetRefinementTspecData()
Definition tmop.hpp:1710
virtual void SetParDiscreteTargetSkew(const ParGridFunction &tspec_)
Definition tmop.cpp:1889
void ParUpdateAfterMeshTopologyChange()
Definition tmop.cpp:1848
void UpdateTargetSpecificationAtNode(const FiniteElement &el, ElementTransformation &T, int nodenum, int idir, const Vector &IntData)
Definition tmop.cpp:2074
void ResetUpdateFlags()
Used in combination with the Update methods to avoid extra computations.
Definition tmop.hpp:1614
void RestoreTargetSpecificationAtNode(ElementTransformation &T, int nodenum)
Definition tmop.cpp:2091
FiniteElementSpace * tspec_fesv
Definition tmop.hpp:1542
virtual void SetSerialDiscreteTargetOrientation(const GridFunction &tspec_)
Definition tmop.cpp:1992
void SetTspecAtIndex(int idx, const GridFunction &tspec_)
Definition tmop.cpp:1949
ParFiniteElementSpace * GetTSpecParFESpace()
Definition tmop.hpp:1627
void SetRefinementSubElement(int amr_el_)
Definition tmop.hpp:1725
virtual void ComputeAllElementTargets(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
Computes reference-to-target transformation Jacobians for all quadrature points in all elements.
void GetDiscreteTargetSpec(GridFunction &tspec_, int idx)
Get one of the discrete fields from tspec.
Definition tmop.cpp:2023
void UpdateHessianTargetSpecification(const Vector &x, real_t dx, bool reuse_flag=false, int x_ordering=Ordering::byNODES)
Definition tmop.cpp:2737
void SetDiscreteTargetBase(const GridFunction &tspec_)
Definition tmop.cpp:1925
DenseMatrix tspec_refine
Definition tmop.hpp:1531
DiscreteAdaptTC(TargetType ttype)
Definition tmop.hpp:1572
void UpdateGradientTargetSpecification(const Vector &x, real_t dx, bool reuse_flag=false, int x_ordering=Ordering::byNODES)
Definition tmop.cpp:2701
void SetTspecFromIntRule(int e_id, const IntegrationRule &intrule)
Definition tmop.cpp:2105
Structure representing the matrices/tensors needed to evaluate (in reference space) the values,...
Definition fe_base.hpp:137
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:220
Abstract class for all finite elements.
Definition fe_base.hpp:239
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition fe_base.hpp:333
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
Definition fe_base.hpp:326
Structure for storing mesh geometric factors: coordinates, Jacobians, and determinants of the Jacobia...
Definition mesh.hpp:2790
Class for grid function - Vector with associated FE space.
Definition gridfunc.hpp:31
Abstract class for hyperelastic models.
Class for integration point with weight.
Definition intrules.hpp:35
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:100
Container class for integration rules.
Definition intrules.hpp:416
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
Auxiliary class for evaluating the 2x2 matrix invariants and their first and second derivatives.
Auxiliary class for evaluating the 3x3 matrix invariants and their first and second derivatives.
A standard isoparametric element transformation.
Definition eltrans.hpp:363
Base class for Matrix Coefficients that optionally depend on time and space.
Mesh data type.
Definition mesh.hpp:56
This class is used to express the local action of a general nonlinear finite element operator....
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
const IntegrationRule * IntRule
Abstract parallel finite element space.
Definition pfespace.hpp:29
Class for parallel grid function.
Definition pgridfunc.hpp:33
Class for parallel meshes.
Definition pmesh.hpp:34
virtual real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
Compute the local energy.
Definition tmop.cpp:4753
virtual void AddMultGradPA(const Vector &, Vector &) const
Method for partially assembled gradient action.
Definition tmop.cpp:4888
virtual real_t GetDerefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
Definition tmop.cpp:4810
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
Definition tmop.cpp:4855
virtual real_t GetLocalStateEnergyPA(const Vector &) const
Compute the local (to the MPI rank) energy with partial assembly.
Definition tmop.cpp:4896
virtual void AssembleGradDiagonalPA(Vector &) const
Method for computing the diagonal of the gradient with partial assembly.
Definition tmop.cpp:4872
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
Definition tmop.cpp:4781
void ParEnableNormalization(const ParGridFunction &x)
Definition tmop.cpp:4839
void EnableLimiting(const GridFunction &n0, const GridFunction &dist, Coefficient &w0, TMOP_LimiterFunction *lfunc=NULL)
Adds the limiting term to the first integrator. Disables it for the rest.
Definition tmop.cpp:4724
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator.
Definition tmop.cpp:4765
virtual real_t GetRefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, const IntegrationRule &irule)
Definition tmop.cpp:4797
virtual void AssembleGradPA(const Vector &, const FiniteElementSpace &)
Prepare the integrator for partial assembly (PA) gradient evaluations on the given FE space fes at th...
Definition tmop.cpp:4863
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
Definition tmop.cpp:4880
Array< TMOP_Integrator * > tmopi
Definition tmop.hpp:2260
void EnableNormalization(const GridFunction &x)
Normalization factor that considers all integrators in the combination.
Definition tmop.cpp:4823
void AddTMOPIntegrator(TMOP_Integrator *ti)
Adds a new TMOP_Integrator to the combination.
Definition tmop.hpp:2271
const Array< TMOP_Integrator * > & GetTMOPIntegrators() const
Definition tmop.hpp:2273
void SetLimitingNodes(const GridFunction &n0)
Update the original/reference nodes used for limiting.
Definition tmop.cpp:4745
virtual ~TMOPMatrixCoefficient()
Definition tmop.hpp:1470
virtual void EvalGrad(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip, int comp)=0
Evaluate the derivative of the matrix coefficient with respect to comp in the element described by T ...
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:1080
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:1089
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:1086
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1440
2D barrier Size (V) metric (polyconvex).
Definition tmop.hpp:1096
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:1107
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:1098
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:1104
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1466
2D barrier Shape+Size+Orientation (VOS) metric (polyconvex).
Definition tmop.hpp:1114
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:1125
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:1122
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1482
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:1116
2D barrier Shape+Orientation (OS) metric (polyconvex).
Definition tmop.hpp:1132
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:1143
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1498
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:1134
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:1140
2D barrier Shape+Size (VS) metric (polyconvex).
Definition tmop.hpp:1150
virtual ~TMOP_AMetric_126()
Definition tmop.hpp:1164
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:1153
TMOP_AMetric_126(real_t gamma)
Definition tmop.hpp:1156
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:1152
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:1153
void ComputeAvgMetrics(const GridFunction &nodes, const TargetConstructor &tc, Vector &averages) const
Definition tmop.cpp:99
void SetWeights(const Vector &weights)
Changes the weights of the metrics in the combination.
Definition tmop.hpp:130
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:23
Array< real_t > wt_arr
Definition tmop.hpp:89
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:55
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:33
void GetWeights(Array< real_t > &weights) const
Definition tmop.hpp:127
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:43
Array< TMOP_QualityMetric * > tmop_q_arr
Definition tmop.hpp:88
virtual void SetTargetJacobian(const DenseMatrix &Jtr_)
Specify the reference-element -> target-element Jacobian matrix for the point of interest.
Definition tmop.hpp:98
virtual void AddQualityMetric(TMOP_QualityMetric *tq, real_t wt=1.0)
Definition tmop.hpp:92
void ComputeBalancedWeights(const GridFunction &nodes, const TargetConstructor &tc, Vector &weights) const
Definition tmop.cpp:70
Exponential limiter function in TMOP_Integrator.
Definition tmop.hpp:1224
virtual void Eval_d2(const Vector &x, const Vector &x0, real_t dist, DenseMatrix &d2) const
Returns the Hessian of the limiting function f(x, x0, d) with respect to x.
Definition tmop.hpp:1244
virtual void Eval_d1(const Vector &x, const Vector &x0, real_t dist, Vector &d1) const
Returns the gradient of the limiting function f(x, x0, d) with respect to x.
Definition tmop.hpp:1233
virtual real_t Eval(const Vector &x, const Vector &x0, real_t dist) const
Returns the limiting function, f(x, x0, d).
Definition tmop.hpp:1226
A TMOP integrator class based on any given TMOP_QualityMetric and TargetConstructor.
Definition tmop.hpp:1738
void SetExactActionFlag(bool flag_)
Flag to control if exact action of Integration is effected.
Definition tmop.hpp:2241
real_t ComputeUntanglerMaxMuBarrier(const Vector &x, const FiniteElementSpace &fes)
Definition tmop.cpp:4621
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
Definition tmop.cpp:3481
DenseMatrix Jpr
Definition tmop.hpp:1820
virtual void AssembleGradPA(const Vector &, const FiniteElementSpace &)
Prepare the integrator for partial assembly (PA) gradient evaluations on the given FE space fes at th...
Definition tmop_pa.cpp:23
void AssembleElemVecAdaptLim(const FiniteElement &el, IsoparametricTransformation &Tpr, const IntegrationRule &ir, const Vector &weights, DenseMatrix &mat)
Definition tmop.cpp:3743
void AssembleElemGradAdaptLim(const FiniteElement &el, IsoparametricTransformation &Tpr, const IntegrationRule &ir, const Vector &weights, DenseMatrix &m)
Definition tmop.cpp:3779
const DofToQuad * maps_lim
Definition tmop.hpp:1865
real_t GetLocalStateEnergyPA_C0_2D(const Vector &) const
real_t GetFDDerivative(const FiniteElement &el, ElementTransformation &T, Vector &elfun, const int nodenum, const int idir, const real_t baseenergy, bool update_stored)
Definition tmop.cpp:4036
void ComputeUntangleMetricQuantiles(const Vector &x, const FiniteElementSpace &fes)
Definition tmop.cpp:4683
TMOP_LimiterFunction * lim_func
Definition tmop.hpp:1765
void ComputeAllElementTargets(const Vector &xe=Vector()) const
Definition tmop_pa.cpp:167
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator.
Definition tmop.cpp:3467
void ParUpdateAfterMeshTopologyChange()
Definition tmop.cpp:3156
DenseMatrix PMatO
Definition tmop.hpp:1820
TMOP_QualityMetric * metric
Definition tmop.hpp:1744
const DofToQuad * maps
Definition tmop.hpp:1864
virtual real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
Computes the integral of W(Jacobian(Trt)) over a target zone.
Definition tmop.cpp:3169
virtual void AddMultGradPA(const Vector &, Vector &) const
Method for partially assembled gradient action.
Definition tmop_pa.cpp:337
const ParGridFunction * adapt_lim_pgf0
Definition tmop.hpp:1772
void AddMultPA_C0_3D(const Vector &, Vector &) const
real_t ComputeMinDetT(const Vector &x, const FiniteElementSpace &fes)
Definition tmop.cpp:4579
virtual void AssembleGradDiagonalPA(Vector &) const
Method for computing the diagonal of the gradient with partial assembly.
Definition tmop_pa.cpp:290
AdaptivityEvaluator * surf_fit_eval_bg_hess
Definition tmop.hpp:1790
AdaptivityEvaluator * surf_fit_eval_bg_grad
Definition tmop.hpp:1790
AdaptivityEvaluator * surf_fit_eval
Definition tmop.hpp:1783
void EnableNormalization(const GridFunction &x)
Computes the normalization factors of the metric and limiting integrals using the mesh position given...
Definition tmop.cpp:4248
void ComputeMinJac(const Vector &x, const FiniteElementSpace &fes)
Definition tmop.cpp:4345
void AssembleElementVectorFD(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
Definition tmop.cpp:4058
real_t GetLocalStateEnergyPA_2D(const Vector &) const
TMOP_QualityMetric * h_metric
Definition tmop.hpp:1743
DiscreteAdaptTC * discr_tc
Definition tmop.hpp:1794
void AssembleDiagonalPA_2D(Vector &) const
void ComputeFDh(const Vector &x, const FiniteElementSpace &fes)
Determines the perturbation, h, for FD-based approximation.
Definition tmop.cpp:4518
Coefficient * lim_coeff
Definition tmop.hpp:1761
GridFunction * surf_fit_gf
Definition tmop.hpp:1782
const GridFunction * lim_dist
Definition tmop.hpp:1763
void AssembleElementVectorExact(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
Definition tmop.cpp:3496
void AssembleDiagonalPA_C0_3D(Vector &) const
void AssembleElementGradExact(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Definition tmop.cpp:3635
virtual real_t GetLocalStateEnergyPA(const Vector &) const
Compute the local (to the MPI rank) energy with partial assembly.
Definition tmop_pa.cpp:362
Array< Vector * > ElemPertEnergy
Definition tmop.hpp:1808
const GridFunction * adapt_lim_gf0
Definition tmop.hpp:1770
void SetCoefficient(Coefficient &w1)
Sets a scaling Coefficient for the quality metric term of the integrator.
Definition tmop.hpp:2045
void AddMultGradPA_2D(const Vector &, Vector &) const
void AssembleGradPA_C0_2D(const Vector &) const
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
Definition tmop_pa.cpp:315
void EnableSurfaceFittingFromSource(const ParGridFunction &s_bg, ParGridFunction &s0, const Array< bool > &smarker, Coefficient &coeff, AdaptivityEvaluator &ae, const ParGridFunction &s_bg_grad, ParGridFunction &s0_grad, AdaptivityEvaluator &age, const ParGridFunction &s_bg_hess, ParGridFunction &s0_hess, AdaptivityEvaluator &ahe)
Fitting of certain DOFs in the current mesh to the zero level set of a function defined on another (f...
Definition tmop.cpp:3010
const TargetConstructor * targetC
Definition tmop.hpp:1745
void ComputeNormalizationEnergies(const GridFunction &x, real_t &metric_energy, real_t &lim_energy, real_t &surf_fit_gf_energy)
Definition tmop.cpp:4272
const GridFunction * lim_nodes0
Definition tmop.hpp:1760
const IntegrationRule * ir
Definition tmop.hpp:1868
TMOP_QuadraticLimiter * surf_fit_limiter
Definition tmop.hpp:1785
void EnableFiniteDifferences(const GridFunction &x)
Enables FD-based approximation and computes dx.
Definition tmop.cpp:4535
virtual real_t GetRefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, const IntegrationRule &irule)
Computes the mean of the energies of the given element's children.
Definition tmop.cpp:3327
real_t GetSurfaceFittingWeight()
Get the surface fitting weight.
Definition tmop.cpp:4237
DenseMatrix DSh
Definition tmop.hpp:1820
void AssembleDiagonalPA_C0_2D(Vector &) const
bool IsSurfaceFittingEnabled()
Definition tmop.hpp:2160
const GridFunction * surf_fit_pos
Definition tmop.hpp:1786
Array< int > surf_fit_marker_dof_index
Definition tmop.hpp:1792
const GeometricFactors * geom
Definition tmop.hpp:1866
real_t GetLocalStateEnergyPA_C0_3D(const Vector &) const
DenseTensor Jtr
Definition tmop.hpp:1860
void ParEnableNormalization(const ParGridFunction &x)
Definition tmop.cpp:4258
void AddMultGradPA_3D(const Vector &, Vector &) const
Coefficient * adapt_lim_coeff
Definition tmop.hpp:1775
real_t GetFDh() const
Definition tmop.hpp:2238
const FiniteElementSpace * fes
Definition tmop.hpp:1867
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
Definition tmop_pa.cpp:215
const IntegrationRule & EnergyIntegrationRule(const FiniteElement &el) const
Definition tmop.hpp:1929
void UpdateAfterMeshPositionChange(const Vector &x_new, const FiniteElementSpace &x_fes)
Definition tmop.cpp:4380
GridFunction * surf_fit_grad
Definition tmop.hpp:1789
GridFunction * surf_fit_hess
Definition tmop.hpp:1789
void ReleasePADeviceMemory(bool copy_to_host=true)
Definition tmop.cpp:2854
void AddMultPA_2D(const Vector &, Vector &) const
struct mfem::TMOP_Integrator::@23 PA
bool GetFDFlag() const
Definition tmop.hpp:2237
virtual real_t GetDerefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
Definition tmop.cpp:3413
void UpdateCoefficientsPA(const Vector &x_loc)
Definition tmop_pa.cpp:179
TMOP_QualityMetric & GetAMRQualityMetric()
Definition tmop.hpp:2200
void AddMultPA_3D(const Vector &, Vector &) const
DenseMatrix PMatI
Definition tmop.hpp:1820
void GetSurfaceFittingErrors(const Vector &pos, real_t &err_avg, real_t &err_max)
Definition tmop.cpp:3079
const IntegrationRule & GradientIntegrationRule(const FiniteElement &el) const
Definition tmop.hpp:1943
void EnableAdaptiveLimiting(const GridFunction &z0, Coefficient &coeff, AdaptivityEvaluator &ae)
Restriction of the node positions to certain regions.
Definition tmop.cpp:2908
void AssembleGradPA_C0_3D(const Vector &) const
void AssembleGradPA_2D(const Vector &) const
void SetLimitingNodes(const GridFunction &n0)
Update the original/reference nodes used for limiting.
Definition tmop.hpp:2166
Coefficient * metric_coeff
Definition tmop.hpp:1753
void SetIntegrationRules(IntegrationRules &irules, int order)
Prescribe a set of integration rules; relevant for mixed meshes.
Definition tmop.hpp:2021
GridFunction * adapt_lim_gf
Definition tmop.hpp:1774
DiscreteAdaptTC * GetDiscreteAdaptTC() const
Definition tmop.hpp:2221
void UpdateAfterMeshTopologyChange()
Definition tmop.cpp:3143
void AddMultGradPA_C0_2D(const Vector &, Vector &) const
IntegrationRules * IntegRules
Definition tmop.hpp:1748
void AssembleDiagonalPA_3D(Vector &) const
DenseMatrix Jrt
Definition tmop.hpp:1820
void AssembleGradPA_3D(const Vector &) const
Coefficient * surf_fit_coeff
Definition tmop.hpp:1780
Array< int > surf_fit_dof_count
Definition tmop.hpp:1791
DenseMatrix Jpt
Definition tmop.hpp:1820
void EnableSurfaceFitting(const GridFunction &s0, const Array< bool > &smarker, Coefficient &coeff, AdaptivityEvaluator &ae)
Fitting of certain DOFs to the zero level set of a function.
Definition tmop.cpp:2943
void AssembleElemGradSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
Definition tmop.cpp:3921
real_t GetLocalStateEnergyPA_3D(const Vector &) const
TMOP_Integrator(TMOP_QualityMetric *m, TargetConstructor *tc)
Definition tmop.hpp:2010
void AddMultPA_C0_2D(const Vector &, Vector &) const
void UpdateSurfaceFittingWeight(real_t factor)
Update the surface fitting weight as surf_fit_coeff *= factor;.
Definition tmop.cpp:4225
Array< Vector * > ElemDer
Definition tmop.hpp:1807
void IntegrateOverTarget(bool integ_over_target_)
Definition tmop.hpp:2030
TMOP_Integrator(TMOP_QualityMetric *m, TargetConstructor *tc, TMOP_QualityMetric *hm)
Definition tmop.hpp:1992
const Array< bool > * surf_fit_marker
Definition tmop.hpp:1779
const IntegrationRule & ActionIntegrationRule(const FiniteElement &el) const
Definition tmop.hpp:1938
void AddMultGradPA_C0_3D(const Vector &, Vector &) const
AdaptivityEvaluator * adapt_lim_eval
Definition tmop.hpp:1776
void AssembleElemVecSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
Definition tmop.cpp:3840
void EnableLimiting(const GridFunction &n0, const GridFunction &dist, Coefficient &w0, TMOP_LimiterFunction *lfunc=NULL)
Limiting of the mesh displacements (general version).
Definition tmop.cpp:2883
void AssembleElementGradFD(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Definition tmop.cpp:4126
void SetFDhScale(real_t dxscale_)
Definition tmop.hpp:2236
Base class for limiting functions to be used in class TMOP_Integrator.
Definition tmop.hpp:1172
virtual real_t Eval(const Vector &x, const Vector &x0, real_t d) const =0
Returns the limiting function, f(x, x0, d).
virtual void Eval_d1(const Vector &x, const Vector &x0, real_t dist, Vector &d1) const =0
Returns the gradient of the limiting function f(x, x0, d) with respect to x.
virtual ~TMOP_LimiterFunction()
Virtual destructor.
Definition tmop.hpp:1188
virtual void Eval_d2(const Vector &x, const Vector &x0, real_t dist, DenseMatrix &d2) const =0
Returns the Hessian of the limiting function f(x, x0, d) with respect to x.
2D non-barrier metric without a type.
Definition tmop.hpp:222
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:224
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:235
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:206
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:212
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:200
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:341
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:303
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:346
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:317
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:358
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:352
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:380
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:336
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:374
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:368
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:325
2D barrier Shape+Size (VS) metric (not polyconvex).
Definition tmop.hpp:341
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:407
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:392
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:343
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:354
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:399
2D barrier Shape+Size (VS) metric (not polyconvex).
Definition tmop.hpp:359
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:449
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:432
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:361
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:440
2D non-barrier Shape+Size+Orientation (VOS) metric (polyconvex).
Definition tmop.hpp:375
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:465
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:474
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:497
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:377
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:485
2D Shifted barrier form of shape metric (mu_2).
Definition tmop.hpp:394
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:543
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:533
TMOP_Metric_022(real_t &t0)
Definition tmop.hpp:400
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:397
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:513
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:600
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:581
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:570
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:416
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:592
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:436
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:613
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:629
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:621
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:665
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:642
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:649
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:454
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:657
2D barrier shape (S) metric (not polyconvex).
Definition tmop.hpp:471
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:690
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:473
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:679
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:706
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:698
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:504
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:494
real_t GetGamma() const
Definition tmop.hpp:505
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:494
virtual ~TMOP_Metric_066()
Definition tmop.hpp:507
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:493
TMOP_Metric_066(real_t gamma)
Definition tmop.hpp:497
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:529
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:515
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:719
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:725
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:733
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:742
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:538
real_t GetGamma() const
Definition tmop.hpp:550
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:537
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:549
virtual ~TMOP_Metric_080()
Definition tmop.hpp:552
TMOP_Metric_080(real_t gamma)
Definition tmop.hpp:541
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:538
2D barrier Shape+Orientation (OS) metric (polyconvex).
Definition tmop.hpp:557
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:755
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:562
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:565
2D compound barrier Shape+Size (VS) metric (balanced).
Definition tmop.hpp:572
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:574
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:575
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:587
virtual ~TMOP_Metric_090()
Definition tmop.hpp:588
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:575
2D compound barrier Shape+Size (VS) metric (balanced).
Definition tmop.hpp:593
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:608
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:596
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:596
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:595
virtual ~TMOP_Metric_094()
Definition tmop.hpp:609
2D barrier Shape+Size+Orientation (VOS) metric (polyconvex).
Definition tmop.hpp:614
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:622
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:773
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:619
2D untangling metric.
Definition tmop.hpp:629
const real_t eps
Definition tmop.hpp:631
TMOP_Metric_211(real_t epsilon=1e-4)
Definition tmop.hpp:635
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:798
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:803
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:632
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:789
Shifted barrier form of metric 56 (area, ideal barrier metric), 2D.
Definition tmop.hpp:648
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:831
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:651
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:811
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:819
TMOP_Metric_252(real_t &t0)
Note that t0 is stored by reference.
Definition tmop.hpp:655
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
Definition tmop.hpp:668
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:858
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:865
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:670
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:874
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:849
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
Definition tmop.hpp:687
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:928
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:936
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:689
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:703
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:909
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:918
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
Definition tmop.hpp:708
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:724
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:974
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:952
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:710
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:966
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:959
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
Definition tmop.hpp:729
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:993
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:745
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:986
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:731
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1008
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1000
3D Size (V) untangling metric.
Definition tmop.hpp:750
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1037
TMOP_Metric_311(real_t epsilon=1e-4)
Definition tmop.hpp:756
const real_t eps
Definition tmop.hpp:752
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1029
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1020
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:753
3D Shape (S) metric, untangling version of 303.
Definition tmop.hpp:769
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1077
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1072
TMOP_Metric_313(real_t &mindet)
Definition tmop.hpp:775
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:785
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:772
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1052
3D Size (V) metric.
Definition tmop.hpp:790
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:803
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1093
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:792
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1101
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1085
3D Size (V) metric.
Definition tmop.hpp:808
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1136
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:1114
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1120
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:810
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1128
3D Size (V) metric.
Definition tmop.hpp:827
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:1150
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1157
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:829
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:843
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1173
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1165
3D barrier Shape+Size (VS) metric, well-posed (invex).
Definition tmop.hpp:848
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1219
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:864
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:850
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1197
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1208
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:1187
3D barrier Shape+Size (VS) metric, well-posed (invex).
Definition tmop.hpp:869
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:1245
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1255
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:871
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1266
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1282
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:885
3D barrier Shape+Size (VS) metric, well-posed (invex).
Definition tmop.hpp:890
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:906
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1326
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1333
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:1319
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1342
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:892
3D compound barrier Shape+Size (VS) metric (polyconvex, balanced).
Definition tmop.hpp:911
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:914
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:926
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:913
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:914
virtual ~TMOP_Metric_328()
Definition tmop.hpp:927
3D compound barrier Shape+Size (VS) metric (polyconvex).
Definition tmop.hpp:932
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:945
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:934
real_t GetGamma() const
Definition tmop.hpp:946
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:934
TMOP_Metric_332(real_t gamma)
Definition tmop.hpp:937
virtual ~TMOP_Metric_332()
Definition tmop.hpp:948
3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
Definition tmop.hpp:953
virtual ~TMOP_Metric_333()
Definition tmop.hpp:967
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:956
TMOP_Metric_333(real_t gamma)
Definition tmop.hpp:959
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:955
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:956
3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
Definition tmop.hpp:972
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:974
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:975
real_t GetGamma() const
Definition tmop.hpp:987
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:986
virtual ~TMOP_Metric_334()
Definition tmop.hpp:989
TMOP_Metric_334(real_t gamma)
Definition tmop.hpp:978
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:975
3D compound barrier Shape+Size (VS) metric (polyconvex, balanced).
Definition tmop.hpp:994
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:997
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:996
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:997
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:1009
virtual ~TMOP_Metric_338()
Definition tmop.hpp:1010
3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
Definition tmop.hpp:1015
TMOP_QualityMetric * sz_metric
Definition tmop.hpp:1018
TMOP_QualityMetric * sh_metric
Definition tmop.hpp:1018
real_t GetGamma() const
Definition tmop.hpp:1030
virtual ~TMOP_Metric_347()
Definition tmop.hpp:1032
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:1029
TMOP_Metric_347(real_t gamma)
Definition tmop.hpp:1021
InvariantsEvaluator2D< real_t > ie
Definition tmop.hpp:1017
3D shifted barrier form of metric 316 (not typed).
Definition tmop.hpp:1037
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1358
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1378
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:1040
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1366
TMOP_Metric_352(real_t &t0)
Definition tmop.hpp:1043
3D non-barrier Shape (S) metric.
Definition tmop.hpp:1056
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:1411
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.cpp:1427
InvariantsEvaluator3D< real_t > ie
Definition tmop.hpp:1058
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.cpp:1404
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.cpp:1418
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:1072
2D non-barrier Aspect ratio metric.
Definition tmop.hpp:270
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:286
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:275
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:278
3D non-barrier Aspect ratio metric.
Definition tmop.hpp:285
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:293
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:290
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:306
2D non-barrier Skew metric.
Definition tmop.hpp:240
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:248
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:245
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:222
3D non-barrier Skew metric.
Definition tmop.hpp:255
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:260
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:246
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:263
Default limiter function in TMOP_Integrator.
Definition tmop.hpp:1193
virtual void Eval_d2(const Vector &x, const Vector &x0, real_t dist, DenseMatrix &d2) const
Returns the Hessian of the limiting function f(x, x0, d) with respect to x.
Definition tmop.hpp:1211
virtual real_t Eval(const Vector &x, const Vector &x0, real_t dist) const
Returns the limiting function, f(x, x0, d).
Definition tmop.hpp:1195
virtual void Eval_d1(const Vector &x, const Vector &x0, real_t dist, Vector &d1) const
Returns the gradient of the limiting function f(x, x0, d) with respect to x.
Definition tmop.hpp:1202
virtual ~TMOP_QuadraticLimiter()
Definition tmop.hpp:1219
Abstract class for local mesh quality metrics in the target-matrix optimization paradigm (TMOP) by P....
Definition tmop.hpp:24
const DenseMatrix * Jtr
Definition tmop.hpp:26
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
Definition tmop.hpp:47
virtual void SetTargetJacobian(const DenseMatrix &Jtr_)
Specify the reference-element -> target-element Jacobian matrix for the point of interest.
Definition tmop.hpp:43
void SetTransformation(ElementTransformation &)
The method HyperelasticModel::SetTransformation() is hidden for TMOP_QualityMetrics,...
Definition tmop.hpp:31
virtual ~TMOP_QualityMetric()
Definition tmop.hpp:35
virtual int Id() const
Return the metric ID.
Definition tmop.hpp:78
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const =0
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const =0
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual real_t EvalW(const DenseMatrix &Jpt) const =0
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
virtual void SetMaxMuT(real_t max_muT_)
Definition tmop.hpp:213
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Definition tmop.hpp:201
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Definition tmop.hpp:204
virtual real_t EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Definition tmop.cpp:167
virtual WorstCaseType GetWorstCaseType()
Definition tmop.hpp:217
TMOP_WorstCaseUntangleOptimizer_Metric(TMOP_QualityMetric &tmop_metric_, int exponent_=1, real_t alpha_=1.5, real_t detT_ep_=0.0001, real_t muT_ep_=0.0001, BarrierType btype_=BarrierType::None, WorstCaseType wctype_=WorstCaseType::None)
Definition tmop.hpp:179
virtual void SetMinDetT(real_t min_detT_)
Definition tmop.hpp:211
virtual real_t EvalWBarrier(const DenseMatrix &Jpt) const
Definition tmop.cpp:184
Base class representing target-matrix construction algorithms for mesh optimization via the target-ma...
Definition tmop.hpp:1334
void SetVolumeScale(real_t vol_scale)
Used by target type IDEAL_SHAPE_EQUAL_SIZE. The default volume scale is 1.
Definition tmop.hpp:1419
const TargetType target_type
Definition tmop.hpp:1360
void SetNodes(const GridFunction &n)
Set the nodes to be used in the target-matrix construction.
Definition tmop.hpp:1413
bool Parallel() const
Definition tmop.hpp:1402
void ComputeAvgVolume() const
Definition tmop.cpp:1519
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
Definition tmop.cpp:1719
virtual void ComputeElementTargets(int e_id, const FiniteElement &fe, const IntegrationRule &ir, const Vector &elfun, DenseTensor &Jtr) const
Given an element and quadrature rule, computes ref->target transformation Jacobians for each quadratu...
Definition tmop.cpp:1648
virtual ~TargetConstructor()
Definition tmop.hpp:1399
bool UsesPhysicalCoordinates() const
Return true if the methods ComputeElementTargets(), ComputeAllElementTargets(), and ComputeElementTar...
Definition tmop.hpp:1426
TargetType GetTargetType() const
Definition tmop.hpp:1421
MPI_Comm GetComm() const
Definition tmop.hpp:1403
const GridFunction * GetNodes() const
Get the nodes to be used in the target-matrix construction.
Definition tmop.hpp:1416
const GridFunction * nodes
Definition tmop.hpp:1357
virtual bool ContainsVolumeInfo() const
Checks if the target matrices contain non-trivial size specification.
Definition tmop.cpp:1634
TargetType
Target-matrix construction algorithms supported by this class.
Definition tmop.hpp:1338
TargetConstructor(TargetType ttype)
Constructor for use in serial.
Definition tmop.hpp:1385
void ComputeAllElementTargets_Fallback(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
Definition tmop.cpp:1562
TargetConstructor(TargetType ttype, MPI_Comm mpicomm)
Constructor for use in parallel.
Definition tmop.hpp:1395
bool ComputeAllElementTargets(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
Base class for vector Coefficients that optionally depend on time and space.
Vector data type.
Definition vector.hpp:80
real_t DistanceSquaredTo(const real_t *p) const
Compute the square of the Euclidean distance to another vector.
Definition vector.hpp:679
void Destroy()
Destroy a vector.
Definition vector.hpp:615
int Size() const
Returns the size of the vector.
Definition vector.hpp:218
void SetSize(int s)
Resize the vector to size s.
Definition vector.hpp:538
int dim
Definition ex24.cpp:53
real_t epsilon
Definition ex25.cpp:141
void InterpolateTMOP_QualityMetric(TMOP_QualityMetric &metric, const TargetConstructor &tc, const Mesh &mesh, GridFunction &metric_gf)
Interpolates the metric's values at the nodes of metric_gf.
Definition tmop.cpp:4906
void subtract(const Vector &x, const Vector &y, Vector &z)
Definition vector.cpp:472
float real_t
Definition config.hpp:43
std::function< real_t(const Vector &)> f(real_t mass_coeff)
Definition lor_mms.hpp:30
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
Definition intrules.hpp:486