16 #include "../general/forall.hpp"
75 double metric = metric_tilde;
78 metric = std::pow(metric_tilde,
exponent);
83 metric = metric_tilde/(beta-metric_tilde);
91 double denominator = 1.0;
98 double detT = Jpt.
Det();
128 MFEM_VERIFY(
Jtr != NULL,
129 "Requires a target Jacobian, use SetTargetJacobian().");
138 const double cos_Jpr = (col1 * col2) / norm_prod,
139 sin_Jpr = fabs(Jpr.
Det()) / norm_prod;
144 const double cos_Jtr = (col1 * col2) / norm_prod,
145 sin_Jtr = fabs(
Jtr->
Det()) / norm_prod;
147 return 0.5 * (1.0 - cos_Jpr * cos_Jtr - sin_Jpr * sin_Jtr);
152 MFEM_VERIFY(
Jtr != NULL,
153 "Requires a target Jacobian, use SetTargetJacobian().");
162 double norm_c1 = col1.
Norml2(),
165 double cos_Jpr_12 = (col1 * col2) / (norm_c1 * norm_c2),
166 cos_Jpr_13 = (col1 * col3) / (norm_c1 * norm_c3),
167 cos_Jpr_23 = (col2 * col3) / (norm_c2 * norm_c3);
168 double sin_Jpr_12 = std::sqrt(1.0 - cos_Jpr_12 * cos_Jpr_12),
169 sin_Jpr_13 = std::sqrt(1.0 - cos_Jpr_13 * cos_Jpr_13),
170 sin_Jpr_23 = std::sqrt(1.0 - cos_Jpr_23 * cos_Jpr_23);
178 double cos_Jtr_12 = (col1 * col2) / (norm_c1 * norm_c2),
179 cos_Jtr_13 = (col1 * col3) / (norm_c1 * norm_c3),
180 cos_Jtr_23 = (col2 * col3) / (norm_c2 * norm_c3);
181 double sin_Jtr_12 = std::sqrt(1.0 - cos_Jtr_12 * cos_Jtr_12),
182 sin_Jtr_13 = std::sqrt(1.0 - cos_Jtr_13 * cos_Jtr_13),
183 sin_Jtr_23 = std::sqrt(1.0 - cos_Jtr_23 * cos_Jtr_23);
185 return (3.0 - cos_Jpr_12 * cos_Jtr_12 - sin_Jpr_12 * sin_Jtr_12
186 - cos_Jpr_13 * cos_Jtr_13 - sin_Jpr_13 * sin_Jtr_13
187 - cos_Jpr_23 * cos_Jtr_23 - sin_Jpr_23 * sin_Jtr_23) / 6.0;
192 MFEM_VERIFY(
Jtr != NULL,
193 "Requires a target Jacobian, use SetTargetJacobian().");
207 return 0.5 * (ratio_Jpr / ratio_Jtr + ratio_Jtr / ratio_Jpr) - 1.0;
212 MFEM_VERIFY(
Jtr != NULL,
213 "Requires a target Jacobian, use SetTargetJacobian().");
222 double norm_c1 = col1.
Norml2(),
225 double ratio_Jpr_1 = norm_c1 / std::sqrt(norm_c2 * norm_c3),
226 ratio_Jpr_2 = norm_c2 / std::sqrt(norm_c1 * norm_c3),
227 ratio_Jpr_3 = norm_c3 / std::sqrt(norm_c1 * norm_c2);
235 double ratio_Jtr_1 = norm_c1 / std::sqrt(norm_c2 * norm_c3),
236 ratio_Jtr_2 = norm_c2 / std::sqrt(norm_c1 * norm_c3),
237 ratio_Jtr_3 = norm_c3 / std::sqrt(norm_c1 * norm_c2);
239 return ( 0.5 * (ratio_Jpr_1 / ratio_Jtr_1 + ratio_Jtr_1 / ratio_Jpr_1) +
240 0.5 * (ratio_Jpr_2 / ratio_Jtr_2 + ratio_Jtr_2 / ratio_Jpr_2) +
241 0.5 * (ratio_Jpr_3 / ratio_Jtr_3 + ratio_Jtr_3 / ratio_Jpr_3) - 3.0
247 return 0.5 * Jpt.
FNorm2() / Jpt.
Det() - 1.0;
328 const double c2 = weight*c1*c1;
372 MFEM_VERIFY(
Jtr != NULL,
373 "Requires a target Jacobian, use SetTargetJacobian().");
377 Id(0,0) = 1;
Id(0,1) = 0;
378 Id(1,0) = 0;
Id(1,1) = 1;
394 if (d < 0.0 && min_detT == 0.0)
434 const double c2 = weight*c1/2;
435 const double c3 = c1*c2;
451 return 0.5*I1b*I1b - 2.0;
509 return 0.5*(I2b + 1.0/I2b) - 1.0;
540 double det = Jpt.
Det();
542 return JtJ.
FNorm2()/(det*det) - 2*Jpt.
FNorm2()/det + 2.0;
550 return I1b*(I1b - 2.0);
578 return 0.5*(I2b*I2b + 1./(I2b*I2b) - 2.);
597 const double I2 =
ie.
Get_I2(), I2inv_sq = 1.0 / (I2 * I2);
605 MFEM_VERIFY(
Jtr != NULL,
606 "Requires a target Jacobian, use SetTargetJacobian().");
612 Id(0,0) = 1;
Id(0,1) = 0;
613 Id(1,0) = 0;
Id(1,1) = 1;
614 Id *= Mat.FNorm()/pow(2,0.5);
623 MFEM_VERIFY(
Jtr != NULL,
624 "Requires a target Jacobian, use SetTargetJacobian().");
628 Id(0,0) = 1;
Id(0,1) = 0;
629 Id(1,0) = 0;
Id(1,1) = 1;
643 return (I2b - 1.0)*(I2b - 1.0) - I2b + std::sqrt(I2b*I2b +
eps);
648 MFEM_ABORT(
"Metric not implemented yet. Use metric mu_55 instead.");
656 MFEM_ABORT(
"Metric not implemented yet. Use metric mu_55 instead.");
664 return 0.5*(I2b - 1.0)*(I2b - 1.0)/(I2b -
tau0);
675 const double c = (I2b - 1.0)/(I2b -
tau0);
691 const double c0 = 1.0/(I2b -
tau0);
692 const double c = c0*(I2b - 1.0);
703 return Jpt.FNorm() * inv.FNorm() / 3.0 - 1.0;
747 double d_I1b_I2b_data[9];
751 const double a = weight/(6*std::sqrt(I1b_I2b));
794 const double c1 = weight/9;
804 return Jpt.
FNorm2() / 3.0 / pow(Jpt.
Det(), 2.0 / 3.0) - 1.0;
837 const double fnorm = Jpt.FNorm();
838 return fnorm * fnorm * fnorm / pow(3.0, 1.5) / Jpt.
Det() - 1.0;
874 return (I3b - 1.0)*(I3b - 1.0) - I3b + std::sqrt(I3b*I3b +
eps);
881 const double c = 2*I3b-3+(I3b)/(std::pow((I3b*I3b+
eps),0.5));
893 const double c0 = I3b*I3b+
eps;
894 const double c1 = 2 + 1/(pow(c0,0.5)) - I3b*I3b/(pow(c0,1.5));
895 const double c2 = 2*I3b - 3 + I3b/(pow(c0,0.5));
906 if (d < 0.0 && min_detT == 0.0)
915 const double c = std::pow(d, -2.0/3.0);
922 MFEM_ABORT(
"Metric not implemented yet.");
930 MFEM_ABORT(
"Metric not implemented yet.");
965 return 0.5 * (Jpt.
Det() + 1.0 / Jpt.
Det()) - 1.0;
973 return 0.5*(I3b + 1.0/I3b) - 1.0;
1004 invt.
Add(-1.0, Jpt);
1032 const double weight,
1046 const double c1 = weight*c0*c0;
1047 const double c2 = -2*c0*c1;
1062 adj_J_t.
Add(1.0, Jpt);
1063 return 1.0 / 6.0 / Jpt.
Det() * adj_J_t.
FNorm2();
1108 const double p13 = weight * pow(
ie.
Get_I3b(), 1.0/3.0),
1109 m13 = weight * pow(
ie.
Get_I3b(), -1.0/3.0),
1110 m23 = weight * pow(
ie.
Get_I3b(), -2.0/3.0),
1111 m43 = weight * pow(
ie.
Get_I3b(), -4.0/3.0),
1112 m53 = weight * pow(
ie.
Get_I3b(), -5.0/3.0),
1113 m73 = weight * pow(
ie.
Get_I3b(), -7.0/3.0);
1133 double fnorm = Jpt.FNorm();
1134 return fnorm * fnorm * fnorm - 3.0 * sqrt(3.0) * (log(Jpt.
Det()) + 1.0);
1174 return 0.5*(I3b - 1.0)*(I3b - 1.0)/(I3b -
tau0);
1185 const double c = (I3b - 1.0)/(I3b -
tau0);
1191 const double weight,
1206 const double c0 = 1.0/(I3b -
tau0);
1207 const double c = c0*(I3b - 1.0);
1218 const double fnorm = Jpt.FNorm();
1219 return fnorm * fnorm * fnorm / pow(3.0, 1.5) - Jpt.
Det();
1253 MFEM_VERIFY(
Jtr != NULL,
1254 "Requires a target Jacobian, use SetTargetJacobian().");
1264 DenseMatrix AdjAt(dim), WtW(dim), WRK(dim), Jtrt(dim);
1269 Mult(AdjAt, WtW, WRK);
1274 return (0.25/alpha)*WRK.
FNorm2();
1279 MFEM_VERIFY(
Jtr != NULL,
1280 "Requires a target Jacobian, use SetTargetJacobian().");
1287 double sqalpha = pow(Jpr.
Det(), 0.5),
1288 sqomega = pow(
Jtr->
Det(), 0.5);
1290 return 0.5*pow(sqalpha/sqomega - sqomega/sqalpha, 2.);
1295 MFEM_VERIFY(
Jtr != NULL,
1296 "Requires a target Jacobian, use SetTargetJacobian().");
1306 return (1./alpha)*(Jpr.
FNorm2());
1311 MFEM_VERIFY(
Jtr != NULL,
1312 "Requires a target Jacobian, use SetTargetJacobian().");
1320 aw = Jpr.FNorm()/
Jtr->FNorm();
1326 return (0.5/alpha)*Jpr.
FNorm2();
1332 MFEM_VERIFY(
nodes,
"Nodes are not given!");
1333 MFEM_ASSERT(
avg_volume == 0.0,
"The average volume is already computed!");
1336 const int NE = mesh->
GetNE();
1338 double volume = 0.0;
1340 for (
int i = 0; i < NE; i++)
1364 area_NE[0] = volume; area_NE[1] = NE;
1365 MPI_Allreduce(area_NE, area_NE + 2, 2, MPI_DOUBLE, MPI_SUM,
comm);
1384 const int NE = mesh->
GetNE();
1386 if (NE == 0) {
return; }
1389 "mixed meshes are not supported");
1390 MFEM_VERIFY(!fes.
IsVariableOrder(),
"variable orders are not supported");
1392 const int sdim = fes.
GetVDim();
1393 const int nvdofs = sdim*fe.GetDof();
1395 xe.
Size() == NE*nvdofs,
"invalid input Vector 'xe'!");
1405 if (dof_map->
Size() == 0) { dof_map =
nullptr; }
1409 Vector elfun_lex, elfun_nat;
1417 for (
int e = 0; e < NE; e++)
1428 const int ndofs = fe.GetDof();
1429 for (
int d = 0; d < sdim; d++)
1431 for (
int i_lex = 0; i_lex < ndofs; i_lex++)
1433 elfun_nat[(*dof_map)[i_lex]+d*ndofs] =
1434 elfun_lex[i_lex+d*ndofs];
1453 default: MFEM_ABORT(
"TargetType not added to ContainsVolumeInfo.");
1463 MFEM_CONTRACT_VAR(elfun);
1471 MFEM_ASSERT(Wideal.
Width() == Jtr.
SizeJ(),
"");
1477 for (
int i = 0; i < ir.
GetNPoints(); i++) { Jtr(i) = Wideal; }
1489 el_volume =
avg_volume / ncmesh->GetElementSizeReduction(e_id);
1493 1./W.Height()), Wideal);
1494 for (
int i = 0; i < ir.
GetNPoints(); i++) { Jtr(i) = W; }
1517 const double det = Jtr(i).Det();
1518 MFEM_VERIFY(det > 0.0,
"The given mesh is inverted!");
1519 Jtr(i).Set(std::pow(det / detW, 1./dim), Wideal);
1525 MFEM_ABORT(
"invalid target type!");
1535 MFEM_CONTRACT_VAR(elfun);
1565 "Target type GIVEN_FULL requires a MatrixCoefficient.");
1582 MFEM_ABORT(
"Incompatible target type for analytic adaptation!");
1600 "Target type GIVEN_FULL requires a TMOPMatrixCoefficient.");
1602 for (
int d = 0; d < fe->
GetDim(); d++)
1615 MFEM_ABORT(
"Incompatible target type for analytic adaptation!");
1625 static inline void device_copy(
double *d_dest,
const double *d_src,
int size)
1627 MFEM_FORALL(i, size, d_dest[i] = d_src[i];);
1635 MFEM_VERIFY(
adapt_eval,
"SetAdaptivityEvaluator() has not been called!")
1636 MFEM_VERIFY(
ncomp > 0,
"No target specifications have been set!");
1680 MFEM_VERIFY(ndof ==
tspec.
Size()/
ncomp,
"Inconsistency in SetTspecAtIndex.");
1682 const auto tspec__d = tspec_.
Read();
1684 const int offset = idx*ndof;
1685 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1692 "Discrete target size should be ordered byNodes.");
1702 "Discrete target skewness should be ordered byNodes.");
1712 "Discrete target aspect ratio should be ordered byNodes.");
1722 "Discrete target orientation should be ordered byNodes.");
1733 #endif // MFEM_USE_MPI
1750 const auto tspec_temp_d = tspec_temp.
Read();
1752 internal::device_copy(tspec_d, tspec_temp_d, tspec_temp.
Size());
1754 const auto tspec__d = tspec_.
Read();
1755 const int offset = (
ncomp-vdim)*ndof;
1756 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1763 MFEM_VERIFY(ndof ==
tspec.
Size()/
ncomp,
"Inconsistency in SetTargetSpec.");
1765 const auto tspec__d = tspec_.
Read();
1767 const int offset = idx*ndof;
1768 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1775 "Discrete target size should be ordered byNodes.");
1785 "Discrete target skewness should be ordered byNodes.");
1795 "Discrete target aspect ratio should be ordered byNodes.");
1805 "Discrete target orientation should be ordered byNodes.");
1814 MFEM_VERIFY(
adapt_eval,
"SetAdaptivityEvaluator() has not been called!")
1815 MFEM_VERIFY(
ncomp > 0,
"No target specifications have been set!");
1835 if (idx < 0) {
return; }
1839 "Inconsistency in GetSerialDiscreteTargetSpec.");
1841 for (
int i = 0; i < ndof*vdim; i++)
1843 tspec_(i) =
tspec(i + idx*ndof);
1870 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
1886 int dofidx,
int dir,
1889 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
1895 for (
int i = 0; i <
ncomp; i++)
1897 tspec(dofs[dofidx]+i*cnt) = IntData(dofs[dofidx] + i*cnt + dir*cnt*ncomp);
1904 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
1909 for (
int i = 0; i <
ncomp; i++)
1924 ntspec_dofs = ndofs*
ncomp;
1926 Vector tspec_vals(ntspec_dofs);
1937 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
1954 MFEM_VERIFY(
tspec_fesv,
"No target specifications have been set.");
1969 ntspec_dofs = ndofs*
ncomp;
1971 Vector shape(ndofs), tspec_vals(ntspec_dofs), par_vals,
1972 par_vals_c1, par_vals_c2, par_vals_c3;
1981 MFEM_VERIFY(
amr_el >= 0,
" Target being constructed for an AMR element.");
1982 for (
int i = 0; i <
ncomp; i++)
1984 for (
int j = 0; j < ndofs; j++)
1998 for (
int q = 0; q < nqp; q++)
2003 for (
int d = 0; d < 4; d++)
2012 double min_size = par_vals.
Min();
2019 MFEM_VERIFY(min_size > 0.0,
2020 "Non-positive size propagated in the target definition.");
2022 const double size = std::max(shape * par_vals, min_size);
2023 Jtr(q).Set(std::pow(size, 1.0/dim), Jtr(q));
2036 const double min_size = par_vals.
Min();
2037 MFEM_VERIFY(min_size > 0.0,
2038 "Non-positive aspect-ratio propagated in the target definition.");
2040 const double aspectratio = shape * par_vals;
2042 D_rho(0,0) = 1./pow(aspectratio,0.5);
2043 D_rho(1,1) = pow(aspectratio,0.5);
2053 const double rho1 = shape * par_vals_c1;
2054 const double rho2 = shape * par_vals_c2;
2055 const double rho3 = shape * par_vals_c3;
2057 D_rho(0,0) = pow(rho1,2./3.);
2058 D_rho(1,1) = pow(rho2,2./3.);
2059 D_rho(2,2) = pow(rho3,2./3.);
2064 Mult(D_rho, Temp, Jtr(q));
2074 const double skew = shape * par_vals;
2078 Q_phi(0,1) = cos(skew);
2079 Q_phi(1,1) = sin(skew);
2089 const double phi12 = shape * par_vals_c1;
2090 const double phi13 = shape * par_vals_c2;
2091 const double chi = shape * par_vals_c3;
2095 Q_phi(0,1) = cos(phi12);
2096 Q_phi(0,2) = cos(phi13);
2098 Q_phi(1,1) = sin(phi12);
2099 Q_phi(1,2) = sin(phi13)*cos(chi);
2101 Q_phi(2,2) = sin(phi13)*sin(chi);
2106 Mult(Q_phi, Temp, Jtr(q));
2116 const double theta = shape * par_vals;
2117 R_theta(0,0) = cos(theta);
2118 R_theta(0,1) = -sin(theta);
2119 R_theta(1,0) = sin(theta);
2120 R_theta(1,1) = cos(theta);
2130 const double theta = shape * par_vals_c1;
2131 const double psi = shape * par_vals_c2;
2132 const double beta = shape * par_vals_c3;
2134 double ct = cos(theta), st = sin(theta),
2135 cp = cos(psi), sp = sin(psi),
2136 cb = cos(beta), sb = sin(beta);
2139 R_theta(0,0) = ct*sp;
2140 R_theta(1,0) = st*sp;
2143 R_theta(0,1) = -st*cb + ct*cp*sb;
2144 R_theta(1,1) = ct*cb + st*cp*sb;
2145 R_theta(2,1) = -sp*sb;
2147 R_theta(0,0) = -st*sb - ct*cp*cb;
2148 R_theta(1,0) = ct*sb - st*cp*cb;
2149 R_theta(2,0) = sp*cb;
2152 Jtrcomp_q = R_theta;
2154 Mult(R_theta, Temp, Jtr(q));
2160 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
2171 MFEM_VERIFY(
tspec_fesv,
"No target specifications have been set.");
2186 ntspec_dofs = ndofs*
ncomp;
2188 Vector shape(ndofs), tspec_vals(ntspec_dofs), par_vals,
2189 par_vals_c1(ndofs), par_vals_c2(ndofs), par_vals_c3(ndofs);
2192 DenseMatrix dD_rho(dim), dQ_phi(dim), dR_theta(dim);
2199 grad_e_c2(ndofs, dim),
2200 grad_e_c3(ndofs, dim);
2201 Vector grad_ptr_c1(grad_e_c1.GetData(), ndofs*
dim),
2202 grad_ptr_c2(grad_e_c2.GetData(), ndofs*
dim),
2221 grad_phys.Mult(par_vals, grad_ptr_c1);
2224 grad_e_c1.MultTranspose(shape, grad_q);
2226 const double min_size = par_vals.
Min();
2227 MFEM_VERIFY(min_size > 0.0,
2228 "Non-positive size propagated in the target definition.");
2229 const double size = std::max(shape * par_vals, min_size);
2230 double dz_dsize = (1./
dim)*pow(size, 1./dim - 1.);
2232 Mult(Jtrcomp_q, Jtrcomp_d, work1);
2233 Mult(Jtrcomp_r, work1, work2);
2235 for (
int d = 0; d <
dim; d++)
2239 work1.
Set(dz_dsize, work1);
2241 AddMult(work1, work2, dJtr_i);
2254 grad_phys.Mult(par_vals, grad_ptr_c1);
2257 grad_e_c1.MultTranspose(shape, grad_q);
2259 const double aspectratio = shape * par_vals;
2261 dD_rho(0,0) = -0.5*pow(aspectratio,-1.5);
2262 dD_rho(1,1) = 0.5*pow(aspectratio,-0.5);
2264 Mult(Jtrcomp_s, Jtrcomp_r, work1);
2265 Mult(work1, Jtrcomp_q, work2);
2267 for (
int d = 0; d <
dim; d++)
2272 AddMult(work2, work1, dJtr_i);
2279 par_vals_c1.SetData(par_vals.
GetData());
2280 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
2283 grad_phys.Mult(par_vals_c1, grad_ptr_c1);
2284 grad_phys.Mult(par_vals_c2, grad_ptr_c2);
2285 grad_phys.Mult(par_vals_c3, grad_ptr_c3);
2286 Vector grad_q1(dim), grad_q2(dim), grad_q3(dim);
2288 grad_e_c1.MultTranspose(shape, grad_q1);
2289 grad_e_c2.MultTranspose(shape, grad_q2);
2292 const double rho1 = shape * par_vals_c1;
2293 const double rho2 = shape * par_vals_c2;
2294 const double rho3 = shape * par_vals_c3;
2296 dD_rho(0,0) = (2./3.)*pow(rho1,-1./3.);
2297 dD_rho(1,1) = (2./3.)*pow(rho2,-1./3.);
2298 dD_rho(2,2) = (2./3.)*pow(rho3,-1./3.);
2300 Mult(Jtrcomp_s, Jtrcomp_r, work1);
2301 Mult(work1, Jtrcomp_q, work2);
2304 for (
int d = 0; d <
dim; d++)
2308 work1(0,0) *= grad_q1(d);
2309 work1(1,2) *= grad_q2(d);
2310 work1(2,2) *= grad_q3(d);
2312 AddMult(work2, work1, dJtr_i);
2324 grad_phys.Mult(par_vals, grad_ptr_c1);
2327 grad_e_c1.MultTranspose(shape, grad_q);
2329 const double skew = shape * par_vals;
2333 dQ_phi(0,1) = -sin(skew);
2334 dQ_phi(1,1) = cos(skew);
2336 Mult(Jtrcomp_s, Jtrcomp_r, work2);
2338 for (
int d = 0; d <
dim; d++)
2343 Mult(work1, Jtrcomp_d, work3);
2344 AddMult(work2, work3, dJtr_i);
2351 par_vals_c1.SetData(par_vals.
GetData());
2352 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
2355 grad_phys.Mult(par_vals_c1, grad_ptr_c1);
2356 grad_phys.Mult(par_vals_c2, grad_ptr_c2);
2357 grad_phys.Mult(par_vals_c3, grad_ptr_c3);
2358 Vector grad_q1(dim), grad_q2(dim), grad_q3(dim);
2360 grad_e_c1.MultTranspose(shape, grad_q1);
2361 grad_e_c2.MultTranspose(shape, grad_q2);
2364 const double phi12 = shape * par_vals_c1;
2365 const double phi13 = shape * par_vals_c2;
2366 const double chi = shape * par_vals_c3;
2370 dQ_phi(0,1) = -sin(phi12);
2371 dQ_phi(1,1) = cos(phi12);
2374 dQ_phi13(0,2) = -sin(phi13);
2375 dQ_phi13(1,2) = cos(phi13)*cos(chi);
2376 dQ_phi13(2,2) = cos(phi13)*sin(chi);
2379 dQ_phichi(1,2) = -sin(phi13)*sin(chi);
2380 dQ_phichi(2,2) = sin(phi13)*cos(chi);
2382 Mult(Jtrcomp_s, Jtrcomp_r, work2);
2384 for (
int d = 0; d <
dim; d++)
2388 work1 *= grad_q1(d);
2389 work1.Add(grad_q2(d), dQ_phi13);
2390 work1.Add(grad_q3(d), dQ_phichi);
2391 Mult(work1, Jtrcomp_d, work3);
2392 AddMult(work2, work3, dJtr_i);
2404 grad_phys.Mult(par_vals, grad_ptr_c1);
2407 grad_e_c1.MultTranspose(shape, grad_q);
2409 const double theta = shape * par_vals;
2410 dR_theta(0,0) = -sin(theta);
2411 dR_theta(0,1) = -cos(theta);
2412 dR_theta(1,0) = cos(theta);
2413 dR_theta(1,1) = -sin(theta);
2415 Mult(Jtrcomp_q, Jtrcomp_d, work1);
2416 Mult(Jtrcomp_s, work1, work2);
2417 for (
int d = 0; d <
dim; d++)
2422 AddMult(work1, work2, dJtr_i);
2429 par_vals_c1.SetData(par_vals.
GetData());
2430 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
2433 grad_phys.Mult(par_vals_c1, grad_ptr_c1);
2434 grad_phys.Mult(par_vals_c2, grad_ptr_c2);
2435 grad_phys.Mult(par_vals_c3, grad_ptr_c3);
2436 Vector grad_q1(dim), grad_q2(dim), grad_q3(dim);
2438 grad_e_c1.MultTranspose(shape, grad_q1);
2439 grad_e_c2.MultTranspose(shape, grad_q2);
2442 const double theta = shape * par_vals_c1;
2443 const double psi = shape * par_vals_c2;
2444 const double beta = shape * par_vals_c3;
2446 const double ct = cos(theta), st = sin(theta),
2447 cp = cos(psi), sp = sin(psi),
2448 cb = cos(beta), sb = sin(beta);
2451 dR_theta(0,0) = -st*sp;
2452 dR_theta(1,0) = ct*sp;
2455 dR_theta(0,1) = -ct*cb - st*cp*sb;
2456 dR_theta(1,1) = -st*cb + ct*cp*sb;
2459 dR_theta(0,0) = -ct*sb + st*cp*cb;
2460 dR_theta(1,0) = -st*sb - ct*cp*cb;
2468 dR_beta(0,1) = st*sb + ct*cp*cb;
2469 dR_beta(1,1) = -ct*sb + st*cp*cb;
2470 dR_beta(2,1) = -sp*cb;
2472 dR_beta(0,0) = -st*cb + ct*cp*sb;
2473 dR_beta(1,0) = ct*cb + st*cp*sb;
2477 dR_psi(0,0) = ct*cp;
2478 dR_psi(1,0) = st*cp;
2481 dR_psi(0,1) = 0. - ct*sp*sb;
2482 dR_psi(1,1) = 0. + st*sp*sb;
2483 dR_psi(2,1) = -cp*sb;
2485 dR_psi(0,0) = 0. + ct*sp*cb;
2486 dR_psi(1,0) = 0. + st*sp*cb;
2487 dR_psi(2,0) = cp*cb;
2489 Mult(Jtrcomp_q, Jtrcomp_d, work1);
2490 Mult(Jtrcomp_s, work1, work2);
2491 for (
int d = 0; d <
dim; d++)
2495 work1 *= grad_q1(d);
2496 work1.Add(grad_q2(d), dR_psi);
2497 work1.Add(grad_q3(d), dR_beta);
2498 AddMult(work1, work2, dJtr_i);
2506 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
2525 for (
int j = 0; j <
dim; j++)
2527 for (
int i = 0; i < cnt; i++)
2536 for (
int i = 0; i < cnt; i++)
2547 double dx,
bool use_flag,
2555 totmix = 1+2*(dim-2);
2564 for (
int j = 0; j <
dim; j++)
2566 for (
int i = 0; i < cnt; i++)
2575 for (
int i = 0; i < cnt; i++)
2584 for (
int k1 = 0; k1 <
dim; k1++)
2586 for (
int k2 = 0; (k1 != k2) && (k2 < dim); k2++)
2588 for (
int i = 0; i < cnt; i++)
2599 for (
int i = 0; i < cnt; i++)
2668 PA.H.GetMemory().DeleteDevice(copy_to_host);
2669 PA.H0.GetMemory().DeleteDevice(copy_to_host);
2670 if (!copy_to_host && !
PA.Jtr.GetMemory().HostIsValid())
2672 PA.Jtr_needs_update =
true;
2674 PA.Jtr.GetMemory().DeleteDevice(copy_to_host);
2683 for (
int i = 0; i <
ElemDer.Size(); i++)
2698 "'dist' must be a scalar GridFunction!");
2788 MFEM_VERIFY(
surf_fit_gf,
"Surface fitting has not been enabled.");
2791 double loc_max = 0.0, loc_sum = 0.0;
2797 loc_max = std::max(loc_max, std::abs((*
surf_fit_gf)(i)));
2801 err_avg = loc_sum / loc_cnt;
2808 MPI_Allreduce(&loc_max, &err_max, 1, MPI_DOUBLE, MPI_MAX, comm);
2809 MPI_Allreduce(&loc_cnt, &glob_cnt, 1, MPI_INT, MPI_SUM, comm);
2810 MPI_Allreduce(&loc_sum, &err_avg, 1, MPI_DOUBLE, MPI_SUM, comm);
2811 err_avg = err_avg / glob_cnt;
2853 const bool surface_fit = (
surf_fit_gf && fd_call_flag ==
false);
2910 Vector adapt_lim_gf_q, adapt_lim_gf0_q;
2911 if (adaptive_limiting)
2924 const double weight = ip.
weight * Jtr_i.
Det();
2944 if (adaptive_limiting)
2946 const double diff = adapt_lim_gf_q(i) - adapt_lim_gf0_q(i);
2950 energy += weight * val;
2962 for (
int s = 0;
s < dofs.
Size();
s++)
2969 sigma_e(
s) * sigma_e(
s);
2993 for (
int e = 0; e < NEsplit; e++)
3000 for (
int i = 0; i < dof; i++)
3002 for (
int d = 0; d <
dim; d++)
3008 elfun_child(i + d*dof) = elfun(i + e*dof + d*dof*NEsplit);
3015 double el_energy = 0;
3043 const double weight = ip.
weight * Jtr_i.
Det();
3052 el_energy += weight * val;
3055 energy += el_energy;
3102 const double weight = ip.
weight * Jtr_i.
Det();
3111 energy += weight * val;
3175 Vector shape,
p, p0, d_vals, grad;
3192 d_vals.
SetSize(nqp); d_vals = 1.0;
3216 for (
int q = 0; q < nqp; q++)
3243 for (
int d = 0; d <
dim; d++)
3247 d_detW_dx(d) = dwdx.
Trace();
3254 for (
int d = 0; d <
dim; d++)
3259 Mult(Amat, work2, work1);
3261 d_Winv_dx(d) = work2.
Trace();
3263 d_Winv_dx *= -weight_m;
3265 d_detW_dx += d_Winv_dx;
3327 d_vals.
SetSize(nqp); d_vals = 1.0;
3344 for (
int q = 0; q < nqp; q++)
3370 for (
int i = 0; i < dof; i++)
3372 const double w_shape_i = weight_m * shape(i);
3373 for (
int j = 0; j < dof; j++)
3375 const double w = w_shape_i * shape(j);
3376 for (
int d1 = 0; d1 <
dim; d1++)
3378 for (
int d2 = 0; d2 <
dim; d2++)
3380 elmat(d1*dof + i, d2*dof + j) += w * hess(d1, d2);
3401 Vector shape(dof), adapt_lim_gf_e, adapt_lim_gf_q, adapt_lim_gf0_q(nqp);
3415 grad_phys.
Mult(adapt_lim_gf_e, grad_ptr);
3419 for (
int q = 0; q < nqp; q++)
3423 adapt_lim_gf_grad_e.
MultTranspose(shape, adapt_lim_gf_grad_q);
3424 adapt_lim_gf_grad_q *= 2.0 * (adapt_lim_gf_q(q) - adapt_lim_gf0_q(q));
3437 Vector shape(dof), adapt_lim_gf_e, adapt_lim_gf_q, adapt_lim_gf0_q(nqp);
3451 grad_phys.
Mult(adapt_lim_gf_e, grad_ptr);
3456 Mult(grad_phys, adapt_lim_gf_grad_e, adapt_lim_gf_hess_e);
3458 adapt_lim_gf_hess_e.
SetSize(dof, dim*dim);
3460 Vector adapt_lim_gf_grad_q(dim);
3463 for (
int q = 0; q < nqp; q++)
3468 adapt_lim_gf_grad_e.
MultTranspose(shape, adapt_lim_gf_grad_q);
3473 for (
int i = 0; i < dof *
dim; i++)
3475 const int idof = i % dof, idim = i / dof;
3476 for (
int j = 0; j <= i; j++)
3478 const int jdof = j % dof, jdim = j / dof;
3479 const double entry =
3480 w * ( 2.0 * adapt_lim_gf_grad_q(idim) * shape(idof) *
3481 adapt_lim_gf_grad_q(jdim) * shape(jdof) +
3482 2.0 * (adapt_lim_gf_q(q) - adapt_lim_gf0_q(q)) *
3483 adapt_lim_gf_hess_q(idim, jdim) * shape(idof) * shape(jdof));
3485 if (i != j) { mat(j, i) += entry; }
3500 for (
int s = 0;
s < dofs.
Size();
s++)
3502 count += ((*surf_fit_marker)[dofs[
s]]) ? 1 : 0;
3504 if (count == 0) {
return; }
3520 grad_phys.Mult(sigma_e, grad_ptr);
3522 Vector shape_x(dof_x), shape_s(dof_s);
3525 surf_fit_grad_s = 0.0;
3527 for (
int s = 0;
s < dof_s;
s++)
3554 for (
int s = 0;
s < dofs.
Size();
s++)
3556 count += ((*surf_fit_marker)[dofs[
s]]) ? 1 : 0;
3558 if (count == 0) {
return; }
3572 grad_phys.Mult(sigma_e, grad_ptr);
3576 surf_fit_hess_e.
SetSize(dof_s*dim, dim);
3577 Mult(grad_phys, surf_fit_grad_e, surf_fit_hess_e);
3578 surf_fit_hess_e.
SetSize(dof_s, dim * dim);
3581 Vector shape_x(dof_x), shape_s(dof_s);
3583 Vector surf_fit_grad_s(dim);
3587 for (
int s = 0;
s < dof_s;
s++)
3603 for (
int i = 0; i < dof_x *
dim; i++)
3605 const int idof = i % dof_x, idim = i / dof_x;
3606 for (
int j = 0; j <= i; j++)
3608 const int jdof = j % dof_x, jdim = j / dof_x;
3609 const double entry =
3610 w * ( 2.0 * surf_fit_grad_s(idim) * shape_x(idof) *
3611 surf_fit_grad_s(jdim) * shape_x(jdof) +
3612 2.0 * sigma_e(
s) * surf_fit_hess_s(idim, jdim) *
3613 shape_x(idof) * shape_x(jdof));
3615 if (i != j) { mat(j, i) += entry; }
3623 Vector &elfun,
const int dofidx,
3624 const int dir,
const double e_fx,
3628 int idx = dir*dof+dofidx;
3632 double dfdx = (e_fxph-e_fx)/
dx;
3666 for (
int j = 0; j <
dim; j++)
3668 for (
int i = 0; i < dof; i++)
3698 for (
int q = 0; q < nqp; q++)
3724 for (
int i = 0; i < dof; i++)
3726 for (
int j = 0; j < i+1; j++)
3728 for (
int k1 = 0; k1 <
dim; k1++)
3730 for (
int k2 = 0; k2 <
dim; k2++)
3732 elfunmod(k2*dof+j) +=
dx;
3759 double e_fx = ElemPertLoc(k2*dof+j);
3762 elfunmod(k2*dof+j) -=
dx;
3763 double e_fpx = ElemDerLoc(k1*dof+i);
3765 elmat(k1*dof+i, k2*dof+j) = (e_fpxph - e_fpx) /
dx;
3766 elmat(k2*dof+j, k1*dof+i) = (e_fpxph - e_fpx) /
dx;
3796 for (
int q = 0; q < nqp; q++)
3813 MFEM_VERIFY(cf,
"Dynamic weight works only with a ConstantCoefficient.");
3814 cf->constant *= factor;
3823 MFEM_VERIFY(cf,
"Dynamic weight works only with a ConstantCoefficient.");
3824 return cf->constant;
3853 double &metric_energy,
3855 double &surf_fit_gf_energy)
3866 metric_energy = 0.0;
3868 surf_fit_gf_energy = 0.0;
3869 for (
int i = 0; i < fes->
GetNE(); i++)
3875 const int dof = fe->
GetDof();
3884 for (
int q = 0; q < nqp; q++)
3889 const double weight = ip.
weight *
Jtr(q).Det();
3896 lim_energy += weight;
3906 for (
int s = 0;
s < dofs.
Size();
s++)
3910 surf_fit_gf_energy += sigma_e(
s) * sigma_e(
s);
3919 lim_energy = fes->
GetNE();
3936 dx = std::numeric_limits<float>::max();
3939 double detv_avg_min = std::numeric_limits<float>::max();
3940 for (
int i = 0; i < NE; i++)
3945 for (
int j = 0; j < nsp; j++)
3949 detv_sum += std::fabs(
Jpr.
Det());
3951 double detv_avg = pow(detv_sum/nsp, 1./dim);
3952 detv_avg_min = std::min(detv_avg, detv_avg_min);
3962 PA.Jtr_needs_update =
true;
3987 MPI_Allreduce(&
dx, &min_jac_all, 1, MPI_DOUBLE, MPI_MIN, pfes->
GetComm());
4032 for (
int i = 0; i < NE; i++)
4048 for (
int q = 0; q < nsp; q++)
4057 min_detT = std::min(min_detT, detT);
4083 for (
int i = 0; i < NE; i++)
4102 for (
int q = 0; q < nsp; q++)
4112 double metric_val = 0.0;
4119 max_muT = std::max(max_muT, metric_val);
4131 if (!wcuo) {
return; }
4142 double min_detT_all = min_detT;
4146 MPI_Allreduce(&min_detT, &min_detT_all, 1, MPI_DOUBLE, MPI_MIN,
4150 if (wcuo) { wcuo->
SetMinDetT(min_detT_all); }
4154 double max_muT_all = max_muT;
4158 MPI_Allreduce(&max_muT, &max_muT_all, 1, MPI_DOUBLE, MPI_MAX,
4170 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4172 tmopi[0]->EnableLimiting(n0, dist, w0, lfunc);
4173 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
4180 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4182 tmopi[0]->EnableLimiting(n0, w0, lfunc);
4183 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
4188 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4190 tmopi[0]->SetLimitingNodes(n0);
4191 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
4199 for (
int i = 0; i <
tmopi.Size(); i++)
4201 energy +=
tmopi[i]->GetElementEnergy(el, T, elfun);
4211 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4213 tmopi[0]->AssembleElementVector(el, T, elfun, elvect);
4214 for (
int i = 1; i <
tmopi.Size(); i++)
4217 tmopi[i]->AssembleElementVector(el, T, elfun, elvect_i);
4227 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
4229 tmopi[0]->AssembleElementGrad(el, T, elfun, elmat);
4230 for (
int i = 1; i <
tmopi.Size(); i++)
4233 tmopi[i]->AssembleElementGrad(el, T, elfun, elmat_i);
4244 for (
int i = 0; i <
tmopi.Size(); i++)
4246 energy +=
tmopi[i]->GetRefinementElementEnergy(el, T, elfun, irule);
4257 for (
int i = 0; i <
tmopi.Size(); i++)
4259 energy +=
tmopi[i]->GetDerefinementElementEnergy(el, T, elfun);
4266 const int cnt =
tmopi.Size();
4267 double total_integral = 0.0;
4268 for (
int i = 0; i < cnt; i++)
4270 tmopi[i]->EnableNormalization(x);
4271 total_integral += 1.0 /
tmopi[i]->metric_normal;
4273 for (
int i = 0; i < cnt; i++)
4275 tmopi[i]->metric_normal = 1.0 / total_integral;
4282 const int cnt =
tmopi.Size();
4283 double total_integral = 0.0;
4284 for (
int i = 0; i < cnt; i++)
4286 tmopi[i]->ParEnableNormalization(x);
4287 total_integral += 1.0 /
tmopi[i]->metric_normal;
4289 for (
int i = 0; i < cnt; i++)
4291 tmopi[i]->metric_normal = 1.0 / total_integral;
4298 for (
int i = 0; i <
tmopi.Size(); i++)
4300 tmopi[i]->AssemblePA(fes);
4307 for (
int i = 0; i <
tmopi.Size(); i++)
4309 tmopi[i]->AssembleGradPA(xe,fes);
4315 for (
int i = 0; i <
tmopi.Size(); i++)
4317 tmopi[i]->AssembleGradDiagonalPA(de);
4323 for (
int i = 0; i <
tmopi.Size(); i++)
4325 tmopi[i]->AddMultPA(xe, ye);
4331 for (
int i = 0; i <
tmopi.Size(); i++)
4333 tmopi[i]->AddMultGradPA(re, ce);
4339 double energy = 0.0;
4340 for (
int i = 0; i <
tmopi.Size(); i++)
4342 energy +=
tmopi[i]->GetLocalStateEnergyPA(xe);
4351 const int NE = mesh.
GetNE();
4354 DenseMatrix Winv(dim), T(dim), A(dim), dshape, pos;
4359 for (
int i = 0; i < NE; i++)
4376 for (
int j = 0; j < nsp; j++)
4387 metric_gf(gf_dofs[j]) = metric.
EvalW(T);
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for all finite elements.
void ComputeUntangleMetricQuantiles(const Vector &x, const FiniteElementSpace &fes)
InvariantsEvaluator2D< double > ie
int Size() const
For backward compatibility define Size to be synonym of Width()
virtual double GetDerefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Ordering::Type GetOrdering() const
Return the ordering method.
virtual int Id() const
Return the metric ID.
virtual void SetParDiscreteTargetSize(const ParGridFunction &tspec_)
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Size() const
Return the logical size of the array.
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
InvariantsEvaluator3D< double > ie
virtual void SetInitialField(const Vector &init_nodes, const Vector &init_field)=0
int GetDim() const
Returns the reference space dimension for the finite element.
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const =0
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void AddMultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += v w^t.
int GetNDofs() const
Returns number of degrees of freedom.
InvariantsEvaluator3D< double > ie
void AssembleElemVecSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
Class for an integration rule - an Array of IntegrationPoint.
VectorCoefficient * vector_tspec
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void GetVectorValues(int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
void EnableFiniteDifferences(const GridFunction &x)
Enables FD-based approximation and computes dx.
void NewDataAndSize(double *d, int s)
Set the Vector data and size, deleting the old data, if owned.
const TargetType target_type
Class for grid function - Vector with associated FE space.
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
void UseExternalData(double *ext_data, int i, int j, int k)
virtual void Update(bool want_transform=true)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
InvariantsEvaluator3D< double > ie
InvariantsEvaluator3D< double > ie
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
void Assemble_ddI2b(scalar_t w, scalar_t *A)
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
double GetSurfaceFittingWeight()
Get the surface fitting weight.
ParMesh * GetParMesh() const
Base class for vector Coefficients that optionally depend on time and space.
A coefficient that is constant across space and time.
void Assemble_ddI2b(scalar_t w, scalar_t *A)
void SetDerivativeMatrix(int height, const scalar_t *Deriv)
The Deriv matrix is dof x 2, using column-major storage.
const GridFunction * lim_dist
virtual void SetSerialDiscreteTargetOrientation(const GridFunction &tspec_)
virtual double GetElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
Compute the local energy.
struct mfem::TMOP_Integrator::@23 PA
virtual void ComputeAtNewPosition(const Vector &new_nodes, Vector &new_field, int new_nodes_ordering=Ordering::byNODES)=0
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 ...
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
InvariantsEvaluator2D< double > ie
void EnableNormalization(const GridFunction &x)
Computes the normalization factors of the metric and limiting integrals using the mesh position given...
const scalar_t * Get_dI3b()
void SetSize(int s)
Resize the vector to size s.
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.
TMOP_QualityMetric * metric
InvariantsEvaluator2D< double > ie
Base class for limiting functions to be used in class TMOP_Integrator.
virtual double EvalW(const DenseMatrix &Jpt) const =0
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual void Eval_d2(const Vector &x, const Vector &x0, double dist, DenseMatrix &d2) const =0
Returns the Hessian of the limiting function f(x, x0, d) with respect to x.
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual void Update(bool want_transform=true)
double Norml2() const
Returns the l2 norm of the vector.
void ParUpdateAfterMeshTopologyChange()
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
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 ...
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
virtual double 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 =0
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator2D< double > ie
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
ParFiniteElementSpace * pfes
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
Data type dense matrix using column-major storage.
void GetSurfaceFittingErrors(double &err_avg, double &err_max)
int Size() const
Returns the size of the vector.
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void EnableAdaptiveLimiting(const GridFunction &z0, Coefficient &coeff, AdaptivityEvaluator &ae)
Restriction of the node positions to certain regions.
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int GetNE() const
Returns number of elements.
void EnableNormalization(const GridFunction &x)
Normalization factor that considers all integrators in the combination.
TMOP_QualityMetric & tmop_metric
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
Abstract parallel finite element space.
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
InvariantsEvaluator2D< double > ie
void SetSerialMetaInfo(const Mesh &m, const FiniteElementSpace &f)
void UpdateGradientTargetSpecification(const Vector &x, double dx, bool use_flag=false, int x_ordering=Ordering::byNODES)
const IntegrationRule * ir
InvariantsEvaluator2D< double > ie
void AssembleElementVectorFD(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
const GridFunction * nodes
virtual void SetSerialDiscreteTargetSkew(const GridFunction &tspec_)
virtual double EvalWBarrier(const DenseMatrix &Jpt) const
void UpdateSurfaceFittingWeight(double factor)
Update the surface fitting weight as surf_fit_coeff *= factor;.
void SetRefinementSubElement(int amr_el_)
void Assemble_TProd(scalar_t w, const scalar_t *X, const scalar_t *Y, scalar_t *A)
void Assemble_ddI1(scalar_t w, scalar_t *A)
double * GetData() const
Returns the matrix data array.
virtual void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
double * GetData() const
Return a pointer to the beginning of the Vector data.
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Default limiter function in TMOP_Integrator.
Geometry::Type GetElementBaseGeometry(int i) const
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
void Set(double alpha, const double *A)
Set the matrix to alpha * A, assuming that A has the same dimensions as the matrix and uses column-ma...
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 quadratur...
void AssembleElementGradExact(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Array< Vector * > ElemDer
const Vector & GetTspecPertMixH()
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 AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void Assemble_ddI2(scalar_t w, scalar_t *A)
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
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 quadratur...
Coefficient * scalar_tspec
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual void SetSerialDiscreteTargetAspectRatio(const GridFunction &tspec_)
const DenseMatrix & GetGeomToPerfGeomJac(int GeomType) const
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual double 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 double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
double ComputeUntanglerMaxMuBarrier(const Vector &x, const FiniteElementSpace &fes)
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual void AddMultGradPA(const Vector &, Vector &) const
Method for partially assembled gradient action.
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
void Add(const DenseMatrix &A, const DenseMatrix &B, double alpha, DenseMatrix &C)
C = A + alpha*B.
int GetNE() const
Returns number of elements in the mesh.
Abstract class for local mesh quality metrics in the target-matrix optimization paradigm (TMOP) by P...
void FinalizeSerialDiscreteTargetSpec(const GridFunction &tspec_)
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
Coefficient * adapt_lim_coeff
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void MultTranspose(const double *x, double *y) const
Multiply a vector with the transpose matrix.
virtual ~AdaptivityEvaluator()
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.
void CalcAdjugateTranspose(const DenseMatrix &a, DenseMatrix &adjat)
Calculate the transposed adjugate of a matrix (for NxN matrices, N=1,2,3)
void Assemble_ddI3b(scalar_t w, scalar_t *A)
InvariantsEvaluator3D< double > ie
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
void SetLimitingNodes(const GridFunction &n0)
Update the original/reference nodes used for limiting.
void SetDiscreteTargetBase(const GridFunction &tspec_)
AdaptivityEvaluator * adapt_lim_eval
double f(const Vector &xvec)
virtual double 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).
void AddMult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += B * C.
DiscreteAdaptTC * discr_tc
void EnableLimiting(const GridFunction &n0, const GridFunction &dist, Coefficient &w0, TMOP_LimiterFunction *lfunc=NULL)
Limiting of the mesh displacements (general version).
virtual double 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()
void UpdateTargetSpecificationAtNode(const FiniteElement &el, ElementTransformation &T, int nodenum, int idir, const Vector &IntData)
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void SetTspecFromIntRule(int e_id, const IntegrationRule &intrule)
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Mesh * GetMesh() const
Returns the mesh.
void UpdateAfterMeshPositionChange(const Vector &new_x, int new_x_ordering=Ordering::byNODES)
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void Add(const double c, const DenseMatrix &A)
Adds the matrix A multiplied by the number c to the matrix.
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void ResetRefinementTspecData()
InvariantsEvaluator2D< double > ie
void ClearGeometricFactors()
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void AssembleElementVectorExact(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
virtual void AssembleGradDiagonalPA(Vector &) const
Method for computing the diagonal of the gradient with partial assembly.
const TargetConstructor * targetC
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
Array< Vector * > ElemPertEnergy
const GridFunction * lim_nodes0
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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...
const ParGridFunction * adapt_lim_pgf0
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
const scalar_t * Get_dI2b()
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator2D< double > ie
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
void SetDerivativeMatrix(int height, const scalar_t *Deriv)
The Deriv matrix is dof x 3, using column-major storage.
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 double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
InvariantsEvaluator3D< double > ie
virtual void SetParDiscreteTargetAspectRatio(const ParGridFunction &tspec_)
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void SetSize(int i, int j, int k, MemoryType mt_=MemoryType::PRESERVE)
void ParEnableNormalization(const ParGridFunction &x)
InvariantsEvaluator2D< double > ie
int GetNumRootElements()
Return the number of root elements.
void GetValues(int i, const IntegrationRule &ir, Vector &vals, int vdim=1) const
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator.
InvariantsEvaluator2D< double > ie
virtual double GetLocalStateEnergyPA(const Vector &) const
Compute the local (to the MPI rank) energy with partial assembly.
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
FiniteElementSpace * tspec_fesv
int GetVDim() const
Returns vector dimension.
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
A class for non-conforming AMR. The class is not used directly by the user, rather it is an extension...
Coefficient * metric_coeff
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void AssembleElemGradSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
FiniteElementSpace * FESpace()
virtual bool ContainsVolumeInfo() const
Checks if the target matrices contain non-trivial size specification.
TMOP_QualityMetric * h_metric
Array< TMOP_QualityMetric * > tmop_q_arr
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
virtual BarrierType GetBarrierType()
void GetColumn(int c, Vector &col) const
void Assemble_ddI1b(scalar_t w, scalar_t *A)
virtual const double * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
void RestoreTargetSpecificationAtNode(ElementTransformation &T, int nodenum)
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
virtual DofTransformation * GetElementDofs(int elem, Array< int > &dofs) const
Returns indices of degrees of freedom of element 'elem'.
void SetTspecAtIndex(int idx, const GridFunction &tspec_)
virtual double GetRefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, const IntegrationRule &irule)
Computes the mean of the energies of the given element's children.
void ComputeAvgVolume() const
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
double Min() const
Returns the minimal element of the vector.
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
AdaptivityEvaluator * surf_fit_eval
double * Data() const
Returns the matrix data array.
double p(const Vector &x, double t)
virtual void SetTargetJacobian(const DenseMatrix &Jtr_)
Specify the reference-element -> target-element Jacobian matrix for the point of interest.
void Transpose()
(*this) = (*this)^t
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 AssembleElemGradAdaptLim(const FiniteElement &el, IsoparametricTransformation &Tpr, const IntegrationRule &ir, const Vector &weights, DenseMatrix &m)
double Trace() const
Trace of a square matrix.
void AddMultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += A * B^t.
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
void Assemble_ddI2(scalar_t w, scalar_t *A)
const scalar_t * Get_dI1()
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
InvariantsEvaluator3D< double > ie
TMOPMatrixCoefficient * matrix_tspec
const scalar_t * Get_dI1()
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 quadratur...
const IntegrationRule & ActionIntegrationRule(const FiniteElement &el) const
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator2D< double > ie
void MultAAt(const DenseMatrix &a, DenseMatrix &aat)
Calculate the matrix A.At.
int NumCols() const
Get the number of columns (size of input) of the Operator. Synonym with Width().
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void ReleasePADeviceMemory(bool copy_to_host=true)
bool UsesPhysicalCoordinates() const
Return true if the methods ComputeElementTargets(), ComputeAllElementTargets(), and ComputeElementTar...
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 double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
double * HostWrite()
Shortcut for mfem::Write(GetMemory(), TotalSize(), false).
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void CalcInverseTranspose(const DenseMatrix &a, DenseMatrix &inva)
Calculate the inverse transpose of a matrix (for NxN matrices, N=1,2,3)
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
const scalar_t * Get_dI1b()
void SetDataAndSize(double *d, int s)
Set the Vector data and size.
void SetParMetaInfo(const ParMesh &m, const ParFiniteElementSpace &f)
Parallel version of SetSerialMetaInfo.
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
const scalar_t * Get_dI1b()
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
const Array< int > & GetDofMap() const
Get an Array<int> that maps lexicographically ordered indices to the indices of the respective nodes/...
virtual double 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 double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double 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).
void UpdateAfterMeshTopologyChange()
virtual void SetMaxMuT(double max_muT_)
virtual void SetMinDetT(double min_detT_)
InvariantsEvaluator3D< double > ie
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void ComputeFDh(const Vector &x, const FiniteElementSpace &fes)
Determines the perturbation, h, for FD-based approximation.
const scalar_t * Get_dI2b()
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
virtual double * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
void ComputeNormalizationEnergies(const GridFunction &x, double &metric_energy, double &lim_energy, double &surf_fit_gf_energy)
virtual double Eval(const Vector &x, const Vector &x0, double d) const =0
Returns the limiting function, f(x, x0, d).
Coefficient * surf_fit_coeff
Class for integration point with weight.
void UpdateHessianTargetSpecification(const Vector &x, double dx, bool use_flag=false, int x_ordering=Ordering::byNODES)
AdaptivityEvaluator * adapt_eval
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
ParFiniteElementSpace * ptspec_fesv
InvariantsEvaluator3D< double > ie
void Assemble_TProd(scalar_t w, const scalar_t *X, const scalar_t *Y, scalar_t *A)
const FiniteElementSpace * fes
Array< TMOP_Integrator * > tmopi
const scalar_t * Get_dI2()
void ComputeMinJac(const Vector &x, const FiniteElementSpace &fes)
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
const IntegrationRule & EnergyIntegrationRule(const FiniteElement &el) const
const IntegrationRule & GradientIntegrationRule(const FiniteElement &el) const
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
double GetFDDerivative(const FiniteElement &el, ElementTransformation &T, Vector &elfun, const int nodenum, const int idir, const double baseenergy, bool update_stored)
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual double GetElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
Computes the integral of W(Jacobian(Trt)) over a target zone.
void AssembleElemVecAdaptLim(const FiniteElement &el, IsoparametricTransformation &Tpr, const IntegrationRule &ir, const Vector &weights, DenseMatrix &mat)
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void ParUpdateAfterMeshTopologyChange()
virtual double GetDerefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
void Assemble_ddI1(scalar_t w, scalar_t *A)
virtual void Eval_d1(const Vector &x, const Vector &x0, double dist, Vector &d1) const =0
Returns the gradient of the limiting function f(x, x0, d) with respect to x.
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
const Operator * GetUpdateOperator()
Get the GridFunction update operator.
void ComputeAllElementTargets_Fallback(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
const Vector & GetTspecPert2H()
const Vector & GetTspecPert1H()
void AssembleElementGradFD(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat)
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
InvariantsEvaluator2D< double > ie
double infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void SetParDiscreteTargetSpec(const ParGridFunction &tspec_)
InvariantsEvaluator2D< double > ie
NCMesh * ncmesh
Optional nonconforming mesh extension.
virtual double 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 double Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
GridFunction * adapt_lim_gf
const scalar_t * Get_dI2()
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
GridFunction * surf_fit_gf
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void FinalizeParDiscreteTargetSpec(const ParGridFunction &tspec_)
ParGridFunction * tspec_pgf
const FiniteElementCollection * FEColl() const
void GetDiscreteTargetSpec(GridFunction &tspec_, int idx)
Get one of the discrete fields from tspec.
void Mult(const double *x, double *y) const
Matrix vector multiplication.
void GetNodes(Vector &node_coord) const
const Array< bool > * surf_fit_marker
virtual double EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator3D< double > ie
void SetTspecDataForDerefinement(FiniteElementSpace *fes)
Computes target specification data with respect to the coarse FE space.
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void UpdateTargetSpecification(const Vector &new_x, bool use_flag=false, int new_x_ordering=Ordering::byNODES)
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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 DeleteGeometricFactors()
Destroy all GeometricFactors stored by the Mesh.
InvariantsEvaluator3D< double > ie
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual double 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 SetSerialDiscreteTargetSpec(const GridFunction &tspec_)
virtual void SetParDiscreteTargetSkew(const ParGridFunction &tspec_)
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual double GetRefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, const IntegrationRule &irule)
virtual void SetParDiscreteTargetOrientation(const ParGridFunction &tspec_)
void UseExternalData(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
Class for parallel grid function.
void Assemble_ddI1b(scalar_t w, scalar_t *A)
Base class representing target-matrix construction algorithms for mesh optimization via the target-ma...
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants...
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual ~DiscreteAdaptTC()
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
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...
virtual void SetAnalyticTargetSpec(Coefficient *sspec, VectorCoefficient *vspec, TMOPMatrixCoefficient *mspec)
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Rank 3 tensor (array of matrices)
Class for parallel meshes.
virtual void SetSerialDiscreteTargetSize(const GridFunction &tspec_)
double FNorm2() const
Compute the square of the Frobenius norm of the matrix.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
TMOP_LimiterFunction * lim_func
virtual double 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< double > ie
const GridFunction * adapt_lim_gf0
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator.
double ComputeMinDetT(const Vector &x, const FiniteElementSpace &fes)
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
void ParEnableNormalization(const ParGridFunction &x)
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 double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void UpdateAfterMeshTopologyChange()
Update all discrete fields based on tspec and update for AMR.
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual double 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 double weight, DenseMatrix &A) const
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
ParFiniteElementSpace * ParFESpace() const
InvariantsEvaluator3D< double > ie
FiniteElementSpace * coarse_tspec_fesv
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.