82 Vector products_no_m(m_cnt); products_no_m = 1.0;
83 for (
int m_p = 0; m_p < m_cnt; m_p++)
85 for (
int m_a = 0; m_a < m_cnt; m_a++)
87 if (m_p != m_a) { products_no_m(m_p) *= averages(m_a); }
90 const real_t pnm_sum = products_no_m.
Sum();
92 if (pnm_sum == 0.0) { weights = 1.0 / m_cnt;
return; }
93 for (
int m = 0; m < m_cnt; m++) { weights(m) = products_no_m(m) / pnm_sum; }
95 MFEM_ASSERT(fabs(weights.
Sum() - 1.0) < 1e-14,
96 "Error: sum should be 1 always: " << weights.
Sum());
113 for (
int e = 0; e < NE; e++)
132 for (
int q = 0; q < nsp; q++)
143 for (
int m = 0; m < m_cnt; m++)
146 averages(m) +=
tmop_q_arr[m]->EvalW(T) * w_detA;
157 MPI_Allreduce(MPI_IN_PLACE, averages.
GetData(), m_cnt,
160 par_nodes->ParFESpace()->GetComm());
171 real_t metric = metric_tilde;
174 metric = std::pow(metric_tilde,
exponent);
179 metric = metric_tilde/(
beta-metric_tilde);
224 MFEM_VERIFY(
Jtr != NULL,
225 "Requires a target Jacobian, use SetTargetJacobian().");
234 const real_t cos_Jpr = (col1 * col2) / norm_prod,
235 sin_Jpr = fabs(Jpr.
Det()) / norm_prod;
240 const real_t cos_Jtr = (col1 * col2) / norm_prod,
241 sin_Jtr = fabs(
Jtr->
Det()) / norm_prod;
243 return 0.5 * (1.0 - cos_Jpr * cos_Jtr - sin_Jpr * sin_Jtr);
248 MFEM_VERIFY(
Jtr != NULL,
249 "Requires a target Jacobian, use SetTargetJacobian().");
261 real_t cos_Jpr_12 = (col1 * col2) / (norm_c1 * norm_c2),
262 cos_Jpr_13 = (col1 * col3) / (norm_c1 * norm_c3),
263 cos_Jpr_23 = (col2 * col3) / (norm_c2 * norm_c3);
264 real_t sin_Jpr_12 = std::sqrt(1.0 - cos_Jpr_12 * cos_Jpr_12),
265 sin_Jpr_13 = std::sqrt(1.0 - cos_Jpr_13 * cos_Jpr_13),
266 sin_Jpr_23 = std::sqrt(1.0 - cos_Jpr_23 * cos_Jpr_23);
274 real_t cos_Jtr_12 = (col1 * col2) / (norm_c1 * norm_c2),
275 cos_Jtr_13 = (col1 * col3) / (norm_c1 * norm_c3),
276 cos_Jtr_23 = (col2 * col3) / (norm_c2 * norm_c3);
277 real_t sin_Jtr_12 = std::sqrt(1.0 - cos_Jtr_12 * cos_Jtr_12),
278 sin_Jtr_13 = std::sqrt(1.0 - cos_Jtr_13 * cos_Jtr_13),
279 sin_Jtr_23 = std::sqrt(1.0 - cos_Jtr_23 * cos_Jtr_23);
281 return (3.0 - cos_Jpr_12 * cos_Jtr_12 - sin_Jpr_12 * sin_Jtr_12
282 - cos_Jpr_13 * cos_Jtr_13 - sin_Jpr_13 * sin_Jtr_13
283 - cos_Jpr_23 * cos_Jtr_23 - sin_Jpr_23 * sin_Jtr_23) / 6.0;
288 MFEM_VERIFY(
Jtr != NULL,
289 "Requires a target Jacobian, use SetTargetJacobian().");
303 return 0.5 * (ratio_Jpr / ratio_Jtr + ratio_Jtr / ratio_Jpr) - 1.0;
308 MFEM_VERIFY(
Jtr != NULL,
309 "Requires a target Jacobian, use SetTargetJacobian().");
321 real_t ratio_Jpr_1 = norm_c1 / std::sqrt(norm_c2 * norm_c3),
322 ratio_Jpr_2 = norm_c2 / std::sqrt(norm_c1 * norm_c3),
323 ratio_Jpr_3 = norm_c3 / std::sqrt(norm_c1 * norm_c2);
331 real_t ratio_Jtr_1 = norm_c1 / std::sqrt(norm_c2 * norm_c3),
332 ratio_Jtr_2 = norm_c2 / std::sqrt(norm_c1 * norm_c3),
333 ratio_Jtr_3 = norm_c3 / std::sqrt(norm_c1 * norm_c2);
335 return ( 0.5 * (ratio_Jpr_1 / ratio_Jtr_1 + ratio_Jtr_1 / ratio_Jpr_1) +
336 0.5 * (ratio_Jpr_2 / ratio_Jtr_2 + ratio_Jtr_2 / ratio_Jpr_2) +
337 0.5 * (ratio_Jpr_3 / ratio_Jtr_3 + ratio_Jtr_3 / ratio_Jpr_3) - 3.0
343 return 0.5 * Jpt.
FNorm2() / Jpt.
Det() - 1.0;
424 const real_t c2 = weight*c1*c1;
489 for (
int i = 0; i < Jpt.
Size(); i++)
491 JptMinusId(i, i) -= 1.0;
504 for (
int i = 0; i < Jpt.
Size(); i++)
506 JptMinusId(i, i) -= 1.0;
561 const real_t c2 = weight*c1/2;
578 return 0.5 * JtJ.
FNorm2()/(det*det) - 1.0;
589 return 0.5*I1b*I1b - 2.0;
646 return 0.5 * (d + 1.0 / d) - 1.0;
654 return 0.5*(I2b + 1.0/I2b) - 1.0;
687 return JtJ.
FNorm2()/(det*det) - 2*Jpt.
FNorm2()/det + 2.0;
695 return I1b*(I1b - 2.0);
723 return 0.5 * (d*d + 1.0/(d*d)) - 1.0;
730 return 0.5*(I2 + 1.0/I2) - 1.0;
757 MFEM_VERIFY(
Jtr != NULL,
758 "Requires a target Jacobian, use SetTargetJacobian().");
764 Id(0,0) = 1;
Id(0,1) = 0;
765 Id(1,0) = 0;
Id(1,1) = 1;
766 Id *= Mat.FNorm()/pow(2,0.5);
775 MFEM_VERIFY(
Jtr != NULL,
776 "Requires a target Jacobian, use SetTargetJacobian().");
780 Id(0,0) = 1;
Id(0,1) = 0;
781 Id(1,0) = 0;
Id(1,1) = 1;
786 return Mat.FNorm2()/
Jtr->
Det();
795 return (I2b - 1.0)*(I2b - 1.0) - I2b + std::sqrt(I2b*I2b +
eps);
800 MFEM_ABORT(
"Metric not implemented yet. Use metric mu_55 instead.");
808 MFEM_ABORT(
"Metric not implemented yet. Use metric mu_55 instead.");
816 return 0.5*(I2b - 1.0)*(I2b - 1.0)/(I2b -
tau0);
844 const real_t c = c0*(I2b - 1.0);
855 return Jpt.FNorm() * inv.FNorm() / 3.0 - 1.0;
903 const real_t a = weight/(6*std::sqrt(I1b_I2b));
915 return Jpt.
FNorm2() * inv.FNorm2() / 9.0 - 1.0;
946 const real_t c1 = weight/9;
956 return Jpt.
FNorm2() / 3.0 / pow(Jpt.
Det(), 2.0 / 3.0) - 1.0;
989 const real_t fnorm = Jpt.FNorm();
990 return fnorm * fnorm * fnorm / pow(3.0, 1.5) / Jpt.
Det() - 1.0;
1026 return (I3b - 1.0)*(I3b - 1.0) - I3b + std::sqrt(I3b*I3b +
eps);
1033 const real_t c = 2*I3b-3+(I3b)/(std::pow((I3b*I3b+
eps),0.5));
1046 const real_t c1 = 2 + 1/(pow(c0,0.5)) - I3b*I3b/(pow(c0,1.5));
1047 const real_t c2 = 2*I3b - 3 + I3b/(pow(c0,0.5));
1067 const real_t c = std::pow(d, -2.0/3.0);
1074 MFEM_ABORT(
"Metric not implemented yet.");
1082 MFEM_ABORT(
"Metric not implemented yet.");
1117 return 0.5 * (Jpt.
Det() + 1.0 / Jpt.
Det()) - 1.0;
1125 return 0.5*(I3b + 1.0/I3b) - 1.0;
1154 return 0.5 * (d*d + 1.0 / (d*d)) - 1.0;
1162 return 0.5*(I3 + 1.0/I3) - 1.0;
1193 invt.
Add(-1.0, Jpt);
1235 const real_t c1 = weight*c0*c0;
1236 const real_t c2 = -2*c0*c1;
1251 adj_J_t.
Add(1.0, Jpt);
1252 return 1.0 / 6.0 / Jpt.
Det() * adj_J_t.
FNorm2();
1298 m13 = weight * pow(
ie.
Get_I3b(), -1.0/3.0),
1299 m23 = weight * pow(
ie.
Get_I3b(), -2.0/3.0),
1300 m43 = weight * pow(
ie.
Get_I3b(), -4.0/3.0),
1301 m53 = weight * pow(
ie.
Get_I3b(), -5.0/3.0),
1302 m73 = weight * pow(
ie.
Get_I3b(), -7.0/3.0);
1322 real_t fnorm = Jpt.FNorm();
1323 return fnorm * fnorm * fnorm - 3.0 * sqrt(3.0) * (log(Jpt.
Det()) + 1.0);
1363 return 0.5*(I3b - 1.0)*(I3b - 1.0)/(I3b -
tau0);
1396 const real_t c = c0*(I3b - 1.0);
1407 const real_t fnorm = Jpt.FNorm();
1408 return fnorm * fnorm * fnorm / pow(3.0, 1.5) - Jpt.
Det();
1442 MFEM_VERIFY(
Jtr != NULL,
1443 "Requires a target Jacobian, use SetTargetJacobian().");
1458 Mult(AdjAt, WtW, WRK);
1468 MFEM_VERIFY(
Jtr != NULL,
1469 "Requires a target Jacobian, use SetTargetJacobian().");
1477 sqomega = pow(
Jtr->
Det(), 0.5);
1479 return 0.5*pow(sqalpha/sqomega - sqomega/sqalpha, 2.);
1484 MFEM_VERIFY(
Jtr != NULL,
1485 "Requires a target Jacobian, use SetTargetJacobian().");
1500 MFEM_VERIFY(
Jtr != NULL,
1501 "Requires a target Jacobian, use SetTargetJacobian().");
1509 aw = Jpr.FNorm()/
Jtr->FNorm();
1521 MFEM_VERIFY(
nodes,
"Nodes are not given!");
1522 MFEM_ASSERT(
avg_volume == 0.0,
"The average volume is already computed!");
1525 const int NE = mesh->
GetNE();
1529 for (
int i = 0; i < NE; i++)
1553 area_NE[0] = volume; area_NE[1] = NE;
1574 const int NE = mesh->
GetNE();
1576 if (NE == 0) {
return; }
1579 "mixed meshes are not supported");
1580 MFEM_VERIFY(!fes.
IsVariableOrder(),
"variable orders are not supported");
1582 const int sdim = fes.
GetVDim();
1583 const int nvdofs = sdim*fe.
GetDof();
1585 xe.
Size() == NE*nvdofs,
"invalid input Vector 'xe'!");
1595 if (dof_map->
Size() == 0) { dof_map =
nullptr; }
1599 Vector elfun_lex, elfun_nat;
1607 for (
int e = 0; e < NE; e++)
1618 const int ndofs = fe.
GetDof();
1619 for (
int d = 0; d < sdim; d++)
1621 for (
int i_lex = 0; i_lex < ndofs; i_lex++)
1623 elfun_nat[(*dof_map)[i_lex]+d*ndofs] =
1624 elfun_lex[i_lex+d*ndofs];
1643 default: MFEM_ABORT(
"TargetType not added to ContainsVolumeInfo.");
1653 MFEM_CONTRACT_VAR(elfun);
1661 MFEM_ASSERT(Wideal.
Width() == Jtr.
SizeJ(),
"");
1667 for (
int i = 0; i < ir.
GetNPoints(); i++) { Jtr(i) = Wideal; }
1684 for (
int i = 0; i < ir.
GetNPoints(); i++) { Jtr(i) = W; }
1707 const real_t det = Jtr(i).Det();
1708 MFEM_VERIFY(det > 0.0,
"The given mesh is inverted!");
1709 Jtr(i).Set(std::pow(det / detW, 1./
dim), Wideal);
1715 MFEM_ABORT(
"invalid target type!");
1725 MFEM_CONTRACT_VAR(elfun);
1755 "Target type GIVEN_FULL requires a MatrixCoefficient.");
1772 MFEM_ABORT(
"Incompatible target type for analytic adaptation!");
1790 "Target type GIVEN_FULL requires a TMOPMatrixCoefficient.");
1792 for (
int d = 0; d < fe->
GetDim(); d++)
1805 MFEM_ABORT(
"Incompatible target type for analytic adaptation!");
1815static inline void device_copy(
real_t *d_dest,
const real_t *d_src,
int size)
1817 mfem::forall(size, [=] MFEM_HOST_DEVICE (
int i) { d_dest[i] = d_src[i]; });
1825 MFEM_VERIFY(
adapt_eval,
"SetAdaptivityEvaluator() has not been called!")
1826 MFEM_VERIFY(
ncomp > 0,
"No target specifications have been set!");
1870 MFEM_VERIFY(ndof ==
tspec.
Size()/
ncomp,
"Inconsistency in SetTspecAtIndex.");
1872 const auto tspec__d = tspec_.
Read();
1874 const int offset = idx*ndof;
1875 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1882 "Discrete target size should be ordered byNodes.");
1892 "Discrete target skewness should be ordered byNodes.");
1902 "Discrete target aspect ratio should be ordered byNodes.");
1912 "Discrete target orientation should be ordered byNodes.");
1940 const auto tspec_temp_d = tspec_temp.
Read();
1942 internal::device_copy(tspec_d, tspec_temp_d, tspec_temp.
Size());
1944 const auto tspec__d = tspec_.
Read();
1945 const int offset = (
ncomp-vdim)*ndof;
1946 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1953 MFEM_VERIFY(ndof ==
tspec.
Size()/
ncomp,
"Inconsistency in SetTargetSpec.");
1955 const auto tspec__d = tspec_.
Read();
1957 const int offset = idx*ndof;
1958 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1965 "Discrete target size should be ordered byNodes.");
1975 "Discrete target skewness should be ordered byNodes.");
1985 "Discrete target aspect ratio should be ordered byNodes.");
1995 "Discrete target orientation should be ordered byNodes.");
2004 MFEM_VERIFY(
adapt_eval,
"SetAdaptivityEvaluator() has not been called!")
2005 MFEM_VERIFY(
ncomp > 0,
"No target specifications have been set!");
2025 if (idx < 0) {
return; }
2029 "Inconsistency in GetSerialDiscreteTargetSpec.");
2031 for (
int i = 0; i < ndof*vdim; i++)
2033 tspec_(i) =
tspec(i + idx*ndof);
2060 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
2076 int dofidx,
int dir,
2079 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
2085 for (
int i = 0; i <
ncomp; i++)
2087 tspec(dofs[dofidx]+i*cnt) = IntData(dofs[dofidx] + i*cnt + dir*cnt*
ncomp);
2094 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
2099 for (
int i = 0; i <
ncomp; i++)
2114 ntspec_dofs = ndofs*
ncomp;
2116 Vector tspec_vals(ntspec_dofs);
2127 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
2144 MFEM_VERIFY(
tspec_fesv,
"No target specifications have been set.");
2159 ntspec_dofs = ndofs*
ncomp;
2161 Vector shape(ndofs), tspec_vals(ntspec_dofs), par_vals,
2162 par_vals_c1, par_vals_c2, par_vals_c3;
2171 MFEM_VERIFY(
amr_el >= 0,
" Target being constructed for an AMR element.");
2172 for (
int i = 0; i <
ncomp; i++)
2174 for (
int j = 0; j < ndofs; j++)
2188 for (
int q = 0; q < nqp; q++)
2193 for (
int d = 0; d < 4; d++)
2204 MFEM_VERIFY(min_size > 0.0,
2205 "Non-positive size propagated in the target definition.");
2207 real_t size = std::max(shape * par_vals, min_size);
2213 Jtr(q).Set(std::pow(size, 1.0/
dim), Jtr(q));
2227 MFEM_VERIFY(min_size > 0.0,
2228 "Non-positive aspect-ratio propagated in the target definition.");
2230 const real_t aspectratio = shape * par_vals;
2232 D_rho(0,0) = 1./pow(aspectratio,0.5);
2233 D_rho(1,1) = pow(aspectratio,0.5);
2243 const real_t rho1 = shape * par_vals_c1;
2244 const real_t rho2 = shape * par_vals_c2;
2245 const real_t rho3 = shape * par_vals_c3;
2247 D_rho(0,0) = pow(rho1,2./3.);
2248 D_rho(1,1) = pow(rho2,2./3.);
2249 D_rho(2,2) = pow(rho3,2./3.);
2254 Mult(D_rho, Temp, Jtr(q));
2264 const real_t skew = shape * par_vals;
2268 Q_phi(0,1) = cos(skew);
2269 Q_phi(1,1) = sin(skew);
2279 const real_t phi12 = shape * par_vals_c1;
2280 const real_t phi13 = shape * par_vals_c2;
2281 const real_t chi = shape * par_vals_c3;
2285 Q_phi(0,1) = cos(phi12);
2286 Q_phi(0,2) = cos(phi13);
2288 Q_phi(1,1) = sin(phi12);
2289 Q_phi(1,2) = sin(phi13)*cos(chi);
2291 Q_phi(2,2) = sin(phi13)*sin(chi);
2296 Mult(Q_phi, Temp, Jtr(q));
2306 const real_t theta = shape * par_vals;
2307 R_theta(0,0) = cos(theta);
2308 R_theta(0,1) = -sin(theta);
2309 R_theta(1,0) = sin(theta);
2310 R_theta(1,1) = cos(theta);
2320 const real_t theta = shape * par_vals_c1;
2321 const real_t psi = shape * par_vals_c2;
2324 real_t ct = cos(theta), st = sin(theta),
2325 cp = cos(psi), sp = sin(psi),
2329 R_theta(0,0) = ct*sp;
2330 R_theta(1,0) = st*sp;
2333 R_theta(0,1) = -st*cb + ct*cp*sb;
2334 R_theta(1,1) = ct*cb + st*cp*sb;
2335 R_theta(2,1) = -sp*sb;
2337 R_theta(0,0) = -st*sb - ct*cp*cb;
2338 R_theta(1,0) = ct*sb - st*cp*cb;
2339 R_theta(2,0) = sp*cb;
2342 Jtrcomp_q = R_theta;
2344 Mult(R_theta, Temp, Jtr(q));
2350 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
2361 MFEM_VERIFY(
tspec_fesv,
"No target specifications have been set.");
2376 ntspec_dofs = ndofs*
ncomp;
2378 Vector shape(ndofs), tspec_vals(ntspec_dofs), par_vals,
2379 par_vals_c1(ndofs), par_vals_c2(ndofs), par_vals_c3(ndofs);
2389 grad_e_c2(ndofs,
dim),
2390 grad_e_c3(ndofs,
dim);
2391 Vector grad_ptr_c1(grad_e_c1.GetData(), ndofs*
dim),
2392 grad_ptr_c2(grad_e_c2.GetData(), ndofs*
dim),
2411 grad_phys.
Mult(par_vals, grad_ptr_c1);
2414 grad_e_c1.MultTranspose(shape, grad_q);
2417 MFEM_VERIFY(min_size > 0.0,
2418 "Non-positive size propagated in the target definition.");
2419 const real_t size = std::max(shape * par_vals, min_size);
2422 Mult(Jtrcomp_q, Jtrcomp_d, work1);
2423 Mult(Jtrcomp_r, work1, work2);
2425 for (
int d = 0; d <
dim; d++)
2429 work1.
Set(dz_dsize, work1);
2431 AddMult(work1, work2, dJtr_i);
2444 grad_phys.
Mult(par_vals, grad_ptr_c1);
2447 grad_e_c1.MultTranspose(shape, grad_q);
2449 const real_t aspectratio = shape * par_vals;
2451 dD_rho(0,0) = -0.5*pow(aspectratio,-1.5);
2452 dD_rho(1,1) = 0.5*pow(aspectratio,-0.5);
2454 Mult(Jtrcomp_s, Jtrcomp_r, work1);
2455 Mult(work1, Jtrcomp_q, work2);
2457 for (
int d = 0; d <
dim; d++)
2462 AddMult(work2, work1, dJtr_i);
2469 par_vals_c1.SetData(par_vals.
GetData());
2470 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
2473 grad_phys.
Mult(par_vals_c1, grad_ptr_c1);
2474 grad_phys.
Mult(par_vals_c2, grad_ptr_c2);
2475 grad_phys.
Mult(par_vals_c3, grad_ptr_c3);
2478 grad_e_c1.MultTranspose(shape, grad_q1);
2479 grad_e_c2.MultTranspose(shape, grad_q2);
2482 const real_t rho1 = shape * par_vals_c1;
2483 const real_t rho2 = shape * par_vals_c2;
2484 const real_t rho3 = shape * par_vals_c3;
2486 dD_rho(0,0) = (2./3.)*pow(rho1,-1./3.);
2487 dD_rho(1,1) = (2./3.)*pow(rho2,-1./3.);
2488 dD_rho(2,2) = (2./3.)*pow(rho3,-1./3.);
2490 Mult(Jtrcomp_s, Jtrcomp_r, work1);
2491 Mult(work1, Jtrcomp_q, work2);
2494 for (
int d = 0; d <
dim; d++)
2498 work1(0,0) *= grad_q1(d);
2499 work1(1,2) *= grad_q2(d);
2500 work1(2,2) *= grad_q3(d);
2502 AddMult(work2, work1, dJtr_i);
2514 grad_phys.
Mult(par_vals, grad_ptr_c1);
2517 grad_e_c1.MultTranspose(shape, grad_q);
2519 const real_t skew = shape * par_vals;
2523 dQ_phi(0,1) = -sin(skew);
2524 dQ_phi(1,1) = cos(skew);
2526 Mult(Jtrcomp_s, Jtrcomp_r, work2);
2528 for (
int d = 0; d <
dim; d++)
2533 Mult(work1, Jtrcomp_d, work3);
2534 AddMult(work2, work3, dJtr_i);
2541 par_vals_c1.SetData(par_vals.
GetData());
2542 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
2545 grad_phys.
Mult(par_vals_c1, grad_ptr_c1);
2546 grad_phys.
Mult(par_vals_c2, grad_ptr_c2);
2547 grad_phys.
Mult(par_vals_c3, grad_ptr_c3);
2550 grad_e_c1.MultTranspose(shape, grad_q1);
2551 grad_e_c2.MultTranspose(shape, grad_q2);
2554 const real_t phi12 = shape * par_vals_c1;
2555 const real_t phi13 = shape * par_vals_c2;
2556 const real_t chi = shape * par_vals_c3;
2560 dQ_phi(0,1) = -sin(phi12);
2561 dQ_phi(1,1) = cos(phi12);
2564 dQ_phi13(0,2) = -sin(phi13);
2565 dQ_phi13(1,2) = cos(phi13)*cos(chi);
2566 dQ_phi13(2,2) = cos(phi13)*sin(chi);
2569 dQ_phichi(1,2) = -sin(phi13)*sin(chi);
2570 dQ_phichi(2,2) = sin(phi13)*cos(chi);
2572 Mult(Jtrcomp_s, Jtrcomp_r, work2);
2574 for (
int d = 0; d <
dim; d++)
2578 work1 *= grad_q1(d);
2579 work1.Add(grad_q2(d), dQ_phi13);
2580 work1.Add(grad_q3(d), dQ_phichi);
2581 Mult(work1, Jtrcomp_d, work3);
2582 AddMult(work2, work3, dJtr_i);
2594 grad_phys.
Mult(par_vals, grad_ptr_c1);
2597 grad_e_c1.MultTranspose(shape, grad_q);
2599 const real_t theta = shape * par_vals;
2600 dR_theta(0,0) = -sin(theta);
2601 dR_theta(0,1) = -cos(theta);
2602 dR_theta(1,0) = cos(theta);
2603 dR_theta(1,1) = -sin(theta);
2605 Mult(Jtrcomp_q, Jtrcomp_d, work1);
2606 Mult(Jtrcomp_s, work1, work2);
2607 for (
int d = 0; d <
dim; d++)
2612 AddMult(work1, work2, dJtr_i);
2619 par_vals_c1.SetData(par_vals.
GetData());
2620 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
2623 grad_phys.
Mult(par_vals_c1, grad_ptr_c1);
2624 grad_phys.
Mult(par_vals_c2, grad_ptr_c2);
2625 grad_phys.
Mult(par_vals_c3, grad_ptr_c3);
2628 grad_e_c1.MultTranspose(shape, grad_q1);
2629 grad_e_c2.MultTranspose(shape, grad_q2);
2632 const real_t theta = shape * par_vals_c1;
2633 const real_t psi = shape * par_vals_c2;
2636 const real_t ct = cos(theta), st = sin(theta),
2637 cp = cos(psi), sp = sin(psi),
2641 dR_theta(0,0) = -st*sp;
2642 dR_theta(1,0) = ct*sp;
2645 dR_theta(0,1) = -ct*cb - st*cp*sb;
2646 dR_theta(1,1) = -st*cb + ct*cp*sb;
2649 dR_theta(0,0) = -ct*sb + st*cp*cb;
2650 dR_theta(1,0) = -st*sb - ct*cp*cb;
2658 dR_beta(0,1) = st*sb + ct*cp*cb;
2659 dR_beta(1,1) = -ct*sb + st*cp*cb;
2660 dR_beta(2,1) = -sp*cb;
2662 dR_beta(0,0) = -st*cb + ct*cp*sb;
2663 dR_beta(1,0) = ct*cb + st*cp*sb;
2667 dR_psi(0,0) = ct*cp;
2668 dR_psi(1,0) = st*cp;
2671 dR_psi(0,1) = 0. - ct*sp*sb;
2672 dR_psi(1,1) = 0. + st*sp*sb;
2673 dR_psi(2,1) = -cp*sb;
2675 dR_psi(0,0) = 0. + ct*sp*cb;
2676 dR_psi(1,0) = 0. + st*sp*cb;
2677 dR_psi(2,0) = cp*cb;
2679 Mult(Jtrcomp_q, Jtrcomp_d, work1);
2680 Mult(Jtrcomp_s, work1, work2);
2681 for (
int d = 0; d <
dim; d++)
2685 work1 *= grad_q1(d);
2686 work1.Add(grad_q2(d), dR_psi);
2687 work1.Add(grad_q3(d), dR_beta);
2688 AddMult(work1, work2, dJtr_i);
2696 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
2715 for (
int j = 0; j <
dim; j++)
2717 for (
int i = 0; i < cnt; i++)
2726 for (
int i = 0; i < cnt; i++)
2738 bool reuse_flag,
int x_ordering)
2745 totmix = 1+2*(
dim-2);
2754 for (
int j = 0; j <
dim; j++)
2756 for (
int i = 0; i < cnt; i++)
2765 for (
int i = 0; i < cnt; i++)
2774 for (
int k1 = 0; k1 <
dim; k1++)
2776 for (
int k2 = 0; (k1 != k2) && (k2 <
dim); k2++)
2778 for (
int i = 0; i < cnt; i++)
2789 for (
int i = 0; i < cnt; i++)
2820 f.GetVDim(),
f.GetOrdering());
2831 f.GetVDim(),
f.GetOrdering());
2858 PA.H.GetMemory().DeleteDevice(copy_to_host);
2859 PA.H0.GetMemory().DeleteDevice(copy_to_host);
2860 if (!copy_to_host && !
PA.Jtr.GetMemory().HostIsValid())
2862 PA.Jtr_needs_update =
true;
2864 PA.Jtr.GetMemory().DeleteDevice(copy_to_host);
2876 for (
int i = 0; i <
ElemDer.Size(); i++)
2891 "'dist' must be a scalar GridFunction!");
2950 "Using both fitting approaches is not supported.");
2971 "Using both fitting approaches is not supported.");
2973 "Positions on a mesh without Nodes is not supported.");
2976 "Incompatible ordering of spaces!");
2994 "Using both fitting approaches is not supported.");
3018#ifndef MFEM_USE_GSLIB
3019 MFEM_ABORT(
"Surface fitting from source requires GSLIB!");
3039 "Nodal ordering for gridfunction on source mesh and current mesh"
3040 "should be the same.");
3054 "Nodal ordering for gridfunction on source mesh and current mesh"
3055 "should be the same.");
3082 MFEM_VERIFY(
surf_fit_marker,
"Surface fitting has not been enabled.");
3088 bool parallel = (pfes) ?
true :
false;
3096 for (
int i = 0; i < node_cnt; i++)
3103 const int dof_i = pfes->DofToVDof(i, 0);
3104 if (parallel && pfes->GetLocalTDofNumber(dof_i) < 0) {
continue; }
3113 for (
int d = 0; d <
dim; d++)
3116 pos(d*node_cnt + i) : pos(i*
dim + d);
3119 : (*surf_fit_pos)(i*
dim + d);
3121 sigma_s = pos_s.DistanceTo(pos_s_target);
3124 err_max = std::max(err_max, sigma_s);
3131 MPI_Comm comm = pfes->GetComm();
3134 MPI_Allreduce(MPI_IN_PLACE, &dof_cnt, 1, MPI_INT, MPI_SUM, comm);
3140 err_avg = (dof_cnt > 0) ? err_sum / dof_cnt : 0.0;
3238 Vector adapt_lim_gf_q, adapt_lim_gf0_q;
3239 if (adaptive_limiting)
3272 if (adaptive_limiting)
3274 const real_t diff = adapt_lim_gf_q(i) - adapt_lim_gf0_q(i);
3278 energy += weight * val;
3294 for (
int s = 0;
s < dof;
s++)
3297 const int scalar_dof_id = fes_fit->
VDofToDof(vdofs[
s]);
3306 sigma_e(
s) * sigma_e(
s);
3312 for (
int d = 0; d <
dim; d++)
3315 pos_target(d) = (*surf_fit_pos)(vdofs[d*dof +
s]);
3342 for (
int e = 0; e < NEsplit; e++)
3349 for (
int i = 0; i < dof; i++)
3351 for (
int d = 0; d <
dim; d++)
3357 elfun_child(i + d*dof) = elfun(i + e*dof + d*dof*NEsplit);
3401 el_energy += weight * val;
3404 energy += el_energy;
3460 energy += weight * val;
3524 Vector shape,
p, p0, d_vals, grad;
3541 d_vals.
SetSize(nqp); d_vals = 1.0;
3566 for (
int q = 0; q < nqp; q++)
3592 for (
int d = 0; d <
dim; d++)
3596 d_detW_dx(d) = dwdx.
Trace();
3603 for (
int d = 0; d <
dim; d++)
3608 Mult(Amat, work2, work1);
3610 d_Winv_dx(d) = work2.
Trace();
3612 d_Winv_dx *= -weight_m;
3614 d_detW_dx += d_Winv_dx;
3676 d_vals.
SetSize(nqp); d_vals = 1.0;
3693 for (
int q = 0; q < nqp; q++)
3719 for (
int i = 0; i < dof; i++)
3721 const real_t w_shape_i = weight_m * shape(i);
3722 for (
int j = 0; j < dof; j++)
3724 const real_t w = w_shape_i * shape(j);
3725 for (
int d1 = 0; d1 <
dim; d1++)
3727 for (
int d2 = 0; d2 <
dim; d2++)
3729 elmat(d1*dof + i, d2*dof + j) += w * hess(d1, d2);
3750 Vector shape(dof), adapt_lim_gf_e, adapt_lim_gf_q, adapt_lim_gf0_q(nqp);
3764 grad_phys.
Mult(adapt_lim_gf_e, grad_ptr);
3768 for (
int q = 0; q < nqp; q++)
3772 adapt_lim_gf_grad_e.
MultTranspose(shape, adapt_lim_gf_grad_q);
3773 adapt_lim_gf_grad_q *= 2.0 * (adapt_lim_gf_q(q) - adapt_lim_gf0_q(q));
3786 Vector shape(dof), adapt_lim_gf_e, adapt_lim_gf_q, adapt_lim_gf0_q(nqp);
3800 grad_phys.
Mult(adapt_lim_gf_e, grad_ptr);
3805 Mult(grad_phys, adapt_lim_gf_grad_e, adapt_lim_gf_hess_e);
3812 for (
int q = 0; q < nqp; q++)
3817 adapt_lim_gf_grad_e.
MultTranspose(shape, adapt_lim_gf_grad_q);
3822 for (
int i = 0; i < dof *
dim; i++)
3824 const int idof = i % dof, idim = i / dof;
3825 for (
int j = 0; j <= i; j++)
3827 const int jdof = j % dof, jdim = j / dof;
3829 w * ( 2.0 * adapt_lim_gf_grad_q(idim) * shape(idof) *
3830 adapt_lim_gf_grad_q(jdim) * shape(jdof) +
3831 2.0 * (adapt_lim_gf_q(q) - adapt_lim_gf0_q(q)) *
3832 adapt_lim_gf_hess_q(idim, jdim) * shape(idof) * shape(jdof));
3834 if (i != j) { mat(j, i) += entry; }
3856 for (
int s = 0;
s < dof_s;
s++)
3859 const int scalar_dof_id = fes_fit->
VDofToDof(vdofs[
s]);
3860 count += ((*surf_fit_marker)[scalar_dof_id]) ? 1 : 0;
3862 if (count == 0) {
return; }
3882 grad_phys.
Mult(sigma_e, grad_ptr);
3889 for (
int s = 0;
s < dof_s;
s++)
3892 const int scalar_dof_id = fes_fit->
VDofToDof(vdofs[
s]);
3904 for (
int d = 0; d <
dim; d++)
3907 pos_target(d) = (*surf_fit_pos)(vdofs[d*dof_s +
s]);
3911 for (
int d = 0; d <
dim; d++) { surf_fit_grad_e(
s, d) = grad_s(d); }
3914 for (
int d = 0; d <
dim; d++)
3916 mat(
s, d) += w * surf_fit_grad_e(
s, d);
3937 for (
int s = 0;
s < dof_s;
s++)
3940 const int scalar_dof_id = fes_fit->
VDofToDof(vdofs[
s]);
3941 count += ((*surf_fit_marker)[scalar_dof_id]) ? 1 : 0;
3943 if (count == 0) {
return; }
3964 grad_phys.
Mult(sigma_e, grad_ptr);
3978 Mult(grad_phys, surf_fit_grad_e, surf_fit_hess_e);
3987 for (
int s = 0;
s < dof_s;
s++)
3990 const int scalar_dof_id = fes_fit->
VDofToDof(vdofs[
s]);
4000 surf_fit_hess_e.
GetRow(
s, gg_ptr);
4006 for (
int d = 0; d <
dim; d++)
4009 pos_target(d) = (*surf_fit_pos)(vdofs[d*dof_s +
s]);
4014 for (
int d = 0; d <
dim; d++) { surf_fit_grad_e(
s, d) = 0.0; }
4019 for (
int idim = 0; idim <
dim; idim++)
4021 for (
int jdim = 0; jdim <= idim; jdim++)
4023 real_t entry = w * ( surf_fit_grad_e(
s, idim) *
4024 surf_fit_grad_e(
s, jdim) +
4025 sigma_e(
s) * surf_fit_hess_s(idim, jdim));
4027 int idx =
s + idim*dof_s;
4028 int jdx =
s + jdim*dof_s;
4029 mat(idx, jdx) += entry;
4030 if (idx != jdx) { mat(jdx, idx) += entry; }
4038 Vector &elfun,
const int dofidx,
4039 const int dir,
const real_t e_fx,
4043 int idx = dir*dof+dofidx;
4081 for (
int j = 0; j <
dim; j++)
4083 for (
int i = 0; i < dof; i++)
4113 for (
int q = 0; q < nqp; q++)
4141 for (
int i = 0; i < dof; i++)
4143 for (
int j = 0; j < i+1; j++)
4145 for (
int k1 = 0; k1 <
dim; k1++)
4147 for (
int k2 = 0; k2 <
dim; k2++)
4149 elfunmod(k2*dof+j) +=
dx;
4176 real_t e_fx = ElemPertLoc(k2*dof+j);
4179 elfunmod(k2*dof+j) -=
dx;
4180 real_t e_fpx = ElemDerLoc(k1*dof+i);
4182 elmat(k1*dof+i, k2*dof+j) = (e_fpxph - e_fpx) /
dx;
4183 elmat(k2*dof+j, k1*dof+i) = (e_fpxph - e_fpx) /
dx;
4213 for (
int q = 0; q < nqp; q++)
4232 MFEM_VERIFY(cf,
"Dynamic weight works only with a ConstantCoefficient.");
4233 cf->constant *= factor;
4242 MFEM_VERIFY(cf,
"Dynamic weight works only with a ConstantCoefficient.");
4243 return cf->constant;
4275 real_t &surf_fit_gf_energy)
4286 metric_energy = 0.0;
4288 surf_fit_gf_energy = 0.0;
4289 for (
int i = 0; i <
fes->
GetNE(); i++)
4295 const int dof = fe->
GetDof();
4304 for (
int q = 0; q < nqp; q++)
4317 lim_energy += weight;
4327 for (
int s = 0;
s < dofs.
Size();
s++)
4331 surf_fit_gf_energy += sigma_e(
s) * sigma_e(
s);
4358 dx = std::numeric_limits<float>::max();
4361 real_t detv_avg_min = std::numeric_limits<float>::max();
4362 for (
int i = 0; i < NE; i++)
4367 for (
int j = 0; j < nsp; j++)
4371 detv_sum += std::fabs(
Jpr.
Det());
4373 real_t detv_avg = pow(detv_sum/nsp, 1./
dim);
4374 detv_avg_min = std::min(detv_avg, detv_avg_min);
4383 if (
discr_tc) {
PA.Jtr_needs_update =
true; }
4417 const int total_cnt = x_new.
Size()/
dim;
4421 for (
int d = 0; d <
dim; d++)
4423 for (
int i = 0; i < cnt; i++)
4426 new_x_sorted(i + d*cnt) = x_new(dof_index + d*total_cnt);
4432 for (
int i = 0; i < cnt; i++)
4435 for (
int d = 0; d <
dim; d++)
4437 new_x_sorted(d + i*
dim) = x_new(d + dof_index*
dim);
4442 Vector surf_fit_gf_int, surf_fit_grad_int, surf_fit_hess_int;
4444 new_x_sorted, surf_fit_gf_int, ordering);
4445 for (
int i = 0; i < cnt; i++)
4448 (*surf_fit_gf)[dof_index] = surf_fit_gf_int(i);
4452 new_x_sorted, surf_fit_grad_int, ordering);
4458 for (
int d = 0; d < grad_dim; d++)
4460 for (
int i = 0; i < cnt; i++)
4463 (*surf_fit_grad)[dof_index + d*grad_cnt] =
4464 surf_fit_grad_int(i + d*cnt);
4470 for (
int i = 0; i < cnt; i++)
4473 for (
int d = 0; d < grad_dim; d++)
4475 (*surf_fit_grad)[dof_index*
dim + d] =
4476 surf_fit_grad_int(i*
dim + d);
4482 new_x_sorted, surf_fit_hess_int, ordering);
4488 for (
int d = 0; d < hess_dim; d++)
4490 for (
int i = 0; i < cnt; i++)
4493 (*surf_fit_hess)[dof_index + d*hess_cnt] =
4494 surf_fit_hess_int(i + d*cnt);
4500 for (
int i = 0; i < cnt; i++)
4503 for (
int d = 0; d < hess_dim; d++)
4505 (*surf_fit_hess)[dof_index*
dim + d] =
4506 surf_fit_hess_int(i*
dim + d);
4542#ifdef MFEM_USE_GSLIB
4546 MFEM_ABORT(
"Using GSLIB-based interpolation with finite differences"
4547 "requires careful consideration. Contact TMOP team.");
4564#ifdef MFEM_USE_GSLIB
4568 MFEM_ABORT(
"Using GSLIB-based interpolation with finite differences"
4569 "requires careful consideration. Contact TMOP team.");
4582 real_t min_detT = std::numeric_limits<real_t>::infinity();
4590 for (
int i = 0; i < NE; i++)
4606 for (
int q = 0; q < nsp; q++)
4615 min_detT = std::min(min_detT, detT);
4624 real_t max_muT = -std::numeric_limits<real_t>::infinity();
4641 for (
int i = 0; i < NE; i++)
4660 for (
int q = 0; q < nsp; q++)
4677 max_muT = std::max(max_muT, metric_val);
4689 if (!wcuo) {
return; }
4700 real_t min_detT_all = min_detT;
4709 if (wcuo) { wcuo->
SetMinDetT(min_detT_all); }
4713 real_t max_muT_all = max_muT;
4729 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4731 tmopi[0]->EnableLimiting(n0, dist, w0, lfunc);
4732 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
4739 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4741 tmopi[0]->EnableLimiting(n0, w0, lfunc);
4742 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
4747 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4749 tmopi[0]->SetLimitingNodes(n0);
4750 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
4758 for (
int i = 0; i <
tmopi.Size(); i++)
4760 energy +=
tmopi[i]->GetElementEnergy(el, T, elfun);
4770 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4772 tmopi[0]->AssembleElementVector(el, T, elfun, elvect);
4773 for (
int i = 1; i <
tmopi.Size(); i++)
4776 tmopi[i]->AssembleElementVector(el, T, elfun, elvect_i);
4786 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4788 tmopi[0]->AssembleElementGrad(el, T, elfun, elmat);
4789 for (
int i = 1; i <
tmopi.Size(); i++)
4792 tmopi[i]->AssembleElementGrad(el, T, elfun, elmat_i);
4803 for (
int i = 0; i <
tmopi.Size(); i++)
4805 energy +=
tmopi[i]->GetRefinementElementEnergy(el, T, elfun, irule);
4816 for (
int i = 0; i <
tmopi.Size(); i++)
4818 energy +=
tmopi[i]->GetDerefinementElementEnergy(el, T, elfun);
4826 real_t total_integral = 0.0;
4827 for (
int i = 0; i < cnt; i++)
4829 tmopi[i]->EnableNormalization(x);
4830 total_integral += 1.0 /
tmopi[i]->metric_normal;
4832 for (
int i = 0; i < cnt; i++)
4834 tmopi[i]->metric_normal = 1.0 / total_integral;
4841 const int cnt =
tmopi.Size();
4842 real_t total_integral = 0.0;
4843 for (
int i = 0; i < cnt; i++)
4845 tmopi[i]->ParEnableNormalization(x);
4846 total_integral += 1.0 /
tmopi[i]->metric_normal;
4848 for (
int i = 0; i < cnt; i++)
4850 tmopi[i]->metric_normal = 1.0 / total_integral;
4857 for (
int i = 0; i <
tmopi.Size(); i++)
4859 tmopi[i]->AssemblePA(fes);
4866 for (
int i = 0; i <
tmopi.Size(); i++)
4868 tmopi[i]->AssembleGradPA(xe,fes);
4874 for (
int i = 0; i <
tmopi.Size(); i++)
4876 tmopi[i]->AssembleGradDiagonalPA(de);
4882 for (
int i = 0; i <
tmopi.Size(); i++)
4884 tmopi[i]->AddMultPA(xe, ye);
4890 for (
int i = 0; i <
tmopi.Size(); i++)
4892 tmopi[i]->AddMultGradPA(re, ce);
4899 for (
int i = 0; i <
tmopi.Size(); i++)
4901 energy +=
tmopi[i]->GetLocalStateEnergyPA(xe);
4910 const int NE = mesh.
GetNE();
4918 for (
int i = 0; i < NE; i++)
4935 for (
int j = 0; j < nsp; j++)
4946 metric_gf(gf_dofs[j]) = metric.
EvalW(T);
virtual ~AdaptivityEvaluator()
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)
void SetParMetaInfo(const ParMesh &m, const ParFiniteElementSpace &f)
Parallel version of SetSerialMetaInfo.
void ClearGeometricFactors()
ParFiniteElementSpace * pfes
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...
Coefficient * scalar_tspec
virtual void SetAnalyticTargetSpec(Coefficient *sspec, VectorCoefficient *vspec, TMOPMatrixCoefficient *mspec)
TMOPMatrixCoefficient * matrix_tspec
VectorCoefficient * vector_tspec
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
A coefficient that is constant across space and time.
Data type dense matrix using column-major storage.
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
void Set(real_t alpha, const real_t *A)
Set the matrix to alpha * A, assuming that A has the same dimensions as the matrix and uses column-ma...
void MultTranspose(const real_t *x, real_t *y) const
Multiply a vector with the transpose matrix.
void Transpose()
(*this) = (*this)^t
real_t * Data() const
Returns the matrix data array.
real_t * GetData() const
Returns the matrix data array.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
real_t Trace() const
Trace of a square matrix.
void UseExternalData(real_t *d, int h, int w)
Change the data array and the size of the DenseMatrix.
void Add(const real_t c, const DenseMatrix &A)
Adds the matrix A multiplied by the number c to the matrix.
void GetColumn(int c, Vector &col) const
int Size() const
For backward compatibility define Size to be synonym of Width()
real_t FNorm2() const
Compute the square of the Frobenius norm of the matrix.
void GetRow(int r, Vector &row) const
Rank 3 tensor (array of matrices)
real_t * HostWrite()
Shortcut for mfem::Write(GetMemory(), TotalSize(), false).
void SetSize(int i, int j, int k, MemoryType mt_=MemoryType::PRESERVE)
void UseExternalData(real_t *ext_data, int i, int j, int k)
const Vector & GetTspecPert1H()
void UpdateTargetSpecification(const Vector &new_x, bool reuse_flag=false, int new_x_ordering=Ordering::byNODES)
virtual void SetSerialDiscreteTargetSkew(const GridFunction &tspec_)
virtual void SetParDiscreteTargetAspectRatio(const ParGridFunction &tspec_)
ParGridFunction * tspec_pgf
virtual void SetSerialDiscreteTargetAspectRatio(const GridFunction &tspec_)
const AdaptivityEvaluator * GetAdaptivityEvaluator() const
void SetTspecDataForDerefinement(FiniteElementSpace *fes)
Computes target specification data with respect to the coarse FE space.
const Vector & GetTspecPertMixH()
virtual void SetParDiscreteTargetSpec(const ParGridFunction &tspec_)
AdaptivityEvaluator * adapt_eval
void FinalizeSerialDiscreteTargetSpec(const GridFunction &tspec_)
void FinalizeParDiscreteTargetSpec(const ParGridFunction &tspec_)
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
ParFiniteElementSpace * ptspec_fesv
FiniteElementSpace * coarse_tspec_fesv
virtual ~DiscreteAdaptTC()
virtual void SetSerialDiscreteTargetSize(const GridFunction &tspec_)
virtual void SetParDiscreteTargetSize(const ParGridFunction &tspec_)
const Vector & GetTspecPert2H()
void UpdateAfterMeshTopologyChange()
Update all discrete fields based on tspec and update for AMR.
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...
virtual void SetSerialDiscreteTargetSpec(const GridFunction &tspec_)
virtual void SetParDiscreteTargetOrientation(const ParGridFunction &tspec_)
void ResetRefinementTspecData()
virtual void SetParDiscreteTargetSkew(const ParGridFunction &tspec_)
void ParUpdateAfterMeshTopologyChange()
void UpdateTargetSpecificationAtNode(const FiniteElement &el, ElementTransformation &T, int nodenum, int idir, const Vector &IntData)
void RestoreTargetSpecificationAtNode(ElementTransformation &T, int nodenum)
FiniteElementSpace * tspec_fesv
virtual void SetSerialDiscreteTargetOrientation(const GridFunction &tspec_)
void SetTspecAtIndex(int idx, const GridFunction &tspec_)
void SetRefinementSubElement(int amr_el_)
void GetDiscreteTargetSpec(GridFunction &tspec_, int idx)
Get one of the discrete fields from tspec.
void UpdateHessianTargetSpecification(const Vector &x, real_t dx, bool reuse_flag=false, int x_ordering=Ordering::byNODES)
void SetDiscreteTargetBase(const GridFunction &tspec_)
void UpdateGradientTargetSpecification(const Vector &x, real_t dx, bool reuse_flag=false, int x_ordering=Ordering::byNODES)
void SetTspecFromIntRule(int e_id, const IntegrationRule &intrule)
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
DofTransformation * GetElementDofs(int elem, Array< int > &dofs) const
Returns indices of degrees of freedom of element 'elem'. The returned indices are offsets into an ldo...
int GetNDofs() const
Returns number of degrees of freedom. This is the number of Local Degrees of Freedom.
int VDofToDof(int vdof) const
Compute the inverse of the Dof to VDof mapping for a single index vdof.
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for the i'th element. The returned indices are offsets into an ...
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Ordering::Type GetOrdering() const
Return the ordering method.
int GetNE() const
Returns number of elements in the mesh.
virtual void Update(bool want_transform=true)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
const FiniteElementCollection * FEColl() const
Mesh * GetMesh() const
Returns the mesh.
int GetVDim() const
Returns vector dimension.
const Operator * GetUpdateOperator()
Get the GridFunction update operator.
Abstract class for all finite elements.
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
virtual void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement....
int GetDim() const
Returns the reference space dimension for the finite element.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
const DenseMatrix & GetGeomToPerfGeomJac(int GeomType) const
Class for grid function - Vector with associated FE space.
virtual void CountElementsPerVDof(Array< int > &elem_per_vdof) const
For each vdof, counts how many elements contain the vdof, as containment is determined by FiniteEleme...
void GetValues(int i, const IntegrationRule &ir, Vector &vals, int vdim=1) const
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
FiniteElementSpace * FESpace()
void GetVectorValues(int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
const scalar_t * Get_dI1b()
void Assemble_ddI1(scalar_t w, scalar_t *A)
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.
void Assemble_ddI1b(scalar_t w, scalar_t *A)
const scalar_t * Get_dI2()
void SetDerivativeMatrix(int height, const scalar_t *Deriv)
The Deriv matrix is dof x 2, using column-major storage.
void Assemble_ddI2b(scalar_t w, scalar_t *A)
const scalar_t * Get_dI2b()
void Assemble_TProd(scalar_t w, const scalar_t *X, const scalar_t *Y, scalar_t *A)
void Assemble_ddI2(scalar_t w, scalar_t *A)
const scalar_t * Get_dI1()
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.
const scalar_t * Get_dI2()
const scalar_t * Get_dI2b()
const scalar_t * Get_dI3()
void Assemble_TProd(scalar_t w, const scalar_t *X, const scalar_t *Y, scalar_t *A)
const scalar_t * Get_dI1()
void SetDerivativeMatrix(int height, const scalar_t *Deriv)
The Deriv matrix is dof x 3, using column-major storage.
const scalar_t * Get_dI3b()
void Assemble_ddI1(scalar_t w, scalar_t *A)
void Assemble_ddI2(scalar_t w, scalar_t *A)
const scalar_t * Get_dI1b()
void Assemble_ddI3(scalar_t w, scalar_t *A)
void Assemble_ddI2b(scalar_t w, scalar_t *A)
void Assemble_ddI3b(scalar_t w, scalar_t *A)
void Assemble_ddI1b(scalar_t w, scalar_t *A)
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the matrix coefficient in the element described by T at the point ip, storing the result in ...
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
void GetElementTransformation(int i, IsoparametricTransformation *ElTr) const
Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and wi...
void GetNodes(Vector &node_coord) const
NCMesh * ncmesh
Optional nonconforming mesh extension.
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
Geometry::Type GetElementBaseGeometry(int i) const
void DeleteGeometricFactors()
Destroy all GeometricFactors stored by the Mesh.
A class for non-conforming AMR. The class is not used directly by the user, rather it is an extension...
int GetElementSizeReduction(int i) const
int GetNumRootElements()
Return the number of root elements.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
int NumCols() const
Get the number of columns (size of input) of the Operator. Synonym with Width().
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Abstract parallel finite element space.
ParMesh * GetParMesh() const
void Update(bool want_transform=true) override
Class for parallel grid function.
void CountElementsPerVDof(Array< int > &elem_per_vdof) const override
For each vdof, counts how many elements contain the vdof, as containment is determined by FiniteEleme...
ParFiniteElementSpace * ParFESpace() const
void Update() override
Transform by the Space UpdateMatrix (e.g., on Mesh change).
Class for parallel meshes.
virtual real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
Compute the local energy.
virtual void AddMultGradPA(const Vector &, Vector &) const
Method for partially assembled gradient action.
virtual real_t GetDerefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
virtual real_t GetLocalStateEnergyPA(const Vector &) const
Compute the local (to the MPI rank) energy with partial assembly.
virtual void AssembleGradDiagonalPA(Vector &) const
Method for computing the diagonal of the gradient with partial assembly.
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
void ParEnableNormalization(const ParGridFunction &x)
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.
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator.
virtual real_t GetRefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, const IntegrationRule &irule)
virtual void AssembleGradPA(const Vector &, const FiniteElementSpace &)
Prepare the integrator for partial assembly (PA) gradient evaluations on the given FE space fes at th...
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
Array< TMOP_Integrator * > tmopi
void EnableNormalization(const GridFunction &x)
Normalization factor that considers all integrators in the combination.
void SetLimitingNodes(const GridFunction &n0)
Update the original/reference nodes used for limiting.
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 ...
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,...
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,...
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,...
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,...
void ComputeAvgMetrics(const GridFunction &nodes, const TargetConstructor &tc, Vector &averages) const
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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...
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,...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Array< TMOP_QualityMetric * > tmop_q_arr
void ComputeBalancedWeights(const GridFunction &nodes, const TargetConstructor &tc, Vector &weights) const
real_t ComputeUntanglerMaxMuBarrier(const Vector &x, const FiniteElementSpace &fes)
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
void AssembleElemVecAdaptLim(const FiniteElement &el, IsoparametricTransformation &Tpr, const IntegrationRule &ir, const Vector &weights, DenseMatrix &mat)
void AssembleElemGradAdaptLim(const FiniteElement &el, IsoparametricTransformation &Tpr, const IntegrationRule &ir, const Vector &weights, DenseMatrix &m)
real_t GetFDDerivative(const FiniteElement &el, ElementTransformation &T, Vector &elfun, const int nodenum, const int idir, const real_t baseenergy, bool update_stored)
void ComputeUntangleMetricQuantiles(const Vector &x, const FiniteElementSpace &fes)
TMOP_LimiterFunction * lim_func
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator.
void ParUpdateAfterMeshTopologyChange()
TMOP_QualityMetric * metric
virtual real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
Computes the integral of W(Jacobian(Trt)) over a target zone.
const ParGridFunction * adapt_lim_pgf0
real_t ComputeMinDetT(const Vector &x, const FiniteElementSpace &fes)
AdaptivityEvaluator * surf_fit_eval_bg_hess
AdaptivityEvaluator * surf_fit_eval_bg_grad
AdaptivityEvaluator * surf_fit_eval
void EnableNormalization(const GridFunction &x)
Computes the normalization factors of the metric and limiting integrals using the mesh position given...
void ComputeMinJac(const Vector &x, const FiniteElementSpace &fes)
void AssembleElementVectorFD(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
TMOP_QualityMetric * h_metric
DiscreteAdaptTC * discr_tc
void ComputeFDh(const Vector &x, const FiniteElementSpace &fes)
Determines the perturbation, h, for FD-based approximation.
GridFunction * surf_fit_gf
const GridFunction * lim_dist
void AssembleElementVectorExact(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
void AssembleElementGradExact(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Array< Vector * > ElemPertEnergy
const GridFunction * adapt_lim_gf0
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...
const TargetConstructor * targetC
void ComputeNormalizationEnergies(const GridFunction &x, real_t &metric_energy, real_t &lim_energy, real_t &surf_fit_gf_energy)
const GridFunction * lim_nodes0
const IntegrationRule * ir
TMOP_QuadraticLimiter * surf_fit_limiter
void EnableFiniteDifferences(const GridFunction &x)
Enables FD-based approximation and computes dx.
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.
real_t GetSurfaceFittingWeight()
Get the surface fitting weight.
const GridFunction * surf_fit_pos
Array< int > surf_fit_marker_dof_index
void ParEnableNormalization(const ParGridFunction &x)
Coefficient * adapt_lim_coeff
const FiniteElementSpace * fes
const IntegrationRule & EnergyIntegrationRule(const FiniteElement &el) const
void UpdateAfterMeshPositionChange(const Vector &x_new, const FiniteElementSpace &x_fes)
GridFunction * surf_fit_grad
GridFunction * surf_fit_hess
void ReleasePADeviceMemory(bool copy_to_host=true)
struct mfem::TMOP_Integrator::@23 PA
virtual real_t GetDerefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
void UpdateCoefficientsPA(const Vector &x_loc)
void GetSurfaceFittingErrors(const Vector &pos, real_t &err_avg, real_t &err_max)
const IntegrationRule & GradientIntegrationRule(const FiniteElement &el) const
void EnableAdaptiveLimiting(const GridFunction &z0, Coefficient &coeff, AdaptivityEvaluator &ae)
Restriction of the node positions to certain regions.
Coefficient * metric_coeff
GridFunction * adapt_lim_gf
void UpdateAfterMeshTopologyChange()
Coefficient * surf_fit_coeff
Array< int > surf_fit_dof_count
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.
void AssembleElemGradSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
void UpdateSurfaceFittingWeight(real_t factor)
Update the surface fitting weight as surf_fit_coeff *= factor;.
Array< Vector * > ElemDer
const Array< bool > * surf_fit_marker
const IntegrationRule & ActionIntegrationRule(const FiniteElement &el) const
AdaptivityEvaluator * adapt_lim_eval
void AssembleElemVecSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
void EnableLimiting(const GridFunction &n0, const GridFunction &dist, Coefficient &w0, TMOP_LimiterFunction *lfunc=NULL)
Limiting of the mesh displacements (general version).
void AssembleElementGradFD(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Base class for limiting functions to be used in class TMOP_Integrator.
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 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.
InvariantsEvaluator2D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
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,...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator2D< real_t > ie
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,...
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...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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,...
InvariantsEvaluator2D< real_t > ie
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...
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,...
InvariantsEvaluator2D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
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,...
InvariantsEvaluator2D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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,...
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...
InvariantsEvaluator2D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator2D< real_t > ie
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,...
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...
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,...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator2D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator2D< real_t > ie
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,...
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...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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,...
InvariantsEvaluator2D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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,...
InvariantsEvaluator2D< real_t > ie
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator2D< real_t > ie
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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,...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
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,...
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,...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator2D< real_t > ie
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,...
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...
InvariantsEvaluator2D< real_t > ie
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,...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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,...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator3D< real_t > ie
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...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator3D< real_t > ie
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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,...
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...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator3D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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,...
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,...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator3D< real_t > ie
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...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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,...
InvariantsEvaluator3D< real_t > ie
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...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator3D< real_t > ie
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,...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator3D< real_t > ie
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...
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,...
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...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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,...
InvariantsEvaluator3D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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,...
InvariantsEvaluator3D< real_t > ie
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...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator3D< real_t > ie
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,...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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,...
InvariantsEvaluator3D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
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
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
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,...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
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...
InvariantsEvaluator3D< real_t > ie
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,...
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...
InvariantsEvaluator3D< real_t > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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,...
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...
InvariantsEvaluator3D< real_t > ie
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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,...
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,...
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,...
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,...
Default limiter function in TMOP_Integrator.
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.
virtual real_t Eval(const Vector &x, const Vector &x0, real_t dist) const
Returns the limiting function, f(x, x0, d).
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.
Abstract class for local mesh quality metrics in the target-matrix optimization paradigm (TMOP) by P....
virtual void SetTargetJacobian(const DenseMatrix &Jtr_)
Specify the reference-element -> target-element Jacobian matrix for the point of interest.
virtual int Id() const
Return the metric ID.
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_)
TMOP_QualityMetric & tmop_metric
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,...
virtual WorstCaseType GetWorstCaseType()
virtual BarrierType GetBarrierType()
virtual void SetMinDetT(real_t min_detT_)
virtual real_t EvalWBarrier(const DenseMatrix &Jpt) const
Base class representing target-matrix construction algorithms for mesh optimization via the target-ma...
const TargetType target_type
void ComputeAvgVolume() const
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
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...
bool UsesPhysicalCoordinates() const
Return true if the methods ComputeElementTargets(), ComputeAllElementTargets(), and ComputeElementTar...
const GridFunction * nodes
virtual bool ContainsVolumeInfo() const
Checks if the target matrices contain non-trivial size specification.
void ComputeAllElementTargets_Fallback(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
const Array< int > & GetDofMap() const
Get an Array<int> that maps lexicographically ordered indices to the indices of the respective nodes/...
Base class for vector Coefficients that optionally depend on time and space.
virtual const real_t * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
virtual real_t * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
void SetDataAndSize(real_t *d, int s)
Set the Vector data and size.
real_t Norml2() const
Returns the l2 norm of the vector.
int Size() const
Returns the size of the vector.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
real_t Sum() const
Return the sum of the vector entries.
void SetSize(int s)
Resize the vector to size s.
void NewDataAndSize(real_t *d, int s)
Set the Vector data and size, deleting the old data, if owned.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
real_t Min() const
Returns the minimal element of the vector.
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void CalcAdjugateTranspose(const DenseMatrix &a, DenseMatrix &adjat)
Calculate the transposed adjugate of a matrix (for NxN matrices, N=1,2,3)
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
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.
void AddMultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += v w^t.
void AddMultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += A * B^t.
void MultAAt(const DenseMatrix &a, DenseMatrix &aat)
Calculate the matrix A.At.
void CalcInverseTranspose(const DenseMatrix &a, DenseMatrix &inva)
Calculate the inverse transpose of a matrix (for NxN matrices, N=1,2,3)
ComplexDenseMatrix * MultAtB(const ComplexDenseMatrix &A, const ComplexDenseMatrix &B)
Multiply the complex conjugate transpose of a matrix A with a matrix B. A^H*B.
void AddMult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += B * C.
std::function< real_t(const Vector &)> f(real_t mass_coeff)
void forall(int N, lambda &&body)
void Add(const DenseMatrix &A, const DenseMatrix &B, real_t alpha, DenseMatrix &C)
C = A + alpha*B.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
real_t p(const Vector &x, real_t t)
Helper struct to convert a C++ type to an MPI type.