16 #include "../general/forall.hpp"
85 MFEM_VERIFY(
Jtr != NULL,
86 "Requires a target Jacobian, use SetTargetJacobian().");
95 const double cos_Jpr = (col1 * col2) / norm_prod,
96 sin_Jpr = fabs(Jpr.
Det()) / norm_prod;
101 const double cos_Jtr = (col1 * col2) / norm_prod,
102 sin_Jtr = fabs(
Jtr->
Det()) / norm_prod;
104 return 0.5 * (1.0 - cos_Jpr * cos_Jtr - sin_Jpr * sin_Jtr);
109 MFEM_VERIFY(
Jtr != NULL,
110 "Requires a target Jacobian, use SetTargetJacobian().");
119 double norm_c1 = col1.
Norml2(),
122 double cos_Jpr_12 = (col1 * col2) / (norm_c1 * norm_c2),
123 cos_Jpr_13 = (col1 * col3) / (norm_c1 * norm_c3),
124 cos_Jpr_23 = (col2 * col3) / (norm_c2 * norm_c3);
125 double sin_Jpr_12 =
std::sqrt(1.0 - cos_Jpr_12 * cos_Jpr_12),
126 sin_Jpr_13 =
std::sqrt(1.0 - cos_Jpr_13 * cos_Jpr_13),
127 sin_Jpr_23 =
std::sqrt(1.0 - cos_Jpr_23 * cos_Jpr_23);
135 double cos_Jtr_12 = (col1 * col2) / (norm_c1 * norm_c2),
136 cos_Jtr_13 = (col1 * col3) / (norm_c1 * norm_c3),
137 cos_Jtr_23 = (col2 * col3) / (norm_c2 * norm_c3);
138 double sin_Jtr_12 =
std::sqrt(1.0 - cos_Jtr_12 * cos_Jtr_12),
139 sin_Jtr_13 =
std::sqrt(1.0 - cos_Jtr_13 * cos_Jtr_13),
140 sin_Jtr_23 =
std::sqrt(1.0 - cos_Jtr_23 * cos_Jtr_23);
142 return (3.0 - cos_Jpr_12 * cos_Jtr_12 - sin_Jpr_12 * sin_Jtr_12
143 - cos_Jpr_13 * cos_Jtr_13 - sin_Jpr_13 * sin_Jtr_13
144 - cos_Jpr_23 * cos_Jtr_23 - sin_Jpr_23 * sin_Jtr_23) / 6.0;
149 MFEM_VERIFY(
Jtr != NULL,
150 "Requires a target Jacobian, use SetTargetJacobian().");
164 return 0.5 * (ratio_Jpr / ratio_Jtr + ratio_Jtr / ratio_Jpr) - 1.0;
169 MFEM_VERIFY(
Jtr != NULL,
170 "Requires a target Jacobian, use SetTargetJacobian().");
179 double norm_c1 = col1.
Norml2(),
182 double ratio_Jpr_1 = norm_c1 /
std::sqrt(norm_c2 * norm_c3),
183 ratio_Jpr_2 = norm_c2 /
std::sqrt(norm_c1 * norm_c3),
184 ratio_Jpr_3 = norm_c3 /
std::sqrt(norm_c1 * norm_c2);
192 double ratio_Jtr_1 = norm_c1 /
std::sqrt(norm_c2 * norm_c3),
193 ratio_Jtr_2 = norm_c2 /
std::sqrt(norm_c1 * norm_c3),
194 ratio_Jtr_3 = norm_c3 /
std::sqrt(norm_c1 * norm_c2);
196 return ( 0.5 * (ratio_Jpr_1 / ratio_Jtr_1 + ratio_Jtr_1 / ratio_Jpr_1) +
197 0.5 * (ratio_Jpr_2 / ratio_Jtr_2 + ratio_Jtr_2 / ratio_Jpr_2) +
198 0.5 * (ratio_Jpr_3 / ratio_Jtr_3 + ratio_Jtr_3 / ratio_Jpr_3) - 3.0
256 const double c2 = weight*c1*c1;
300 MFEM_VERIFY(
Jtr != NULL,
301 "Requires a target Jacobian, use SetTargetJacobian().");
305 Id(0,0) = 1;
Id(0,1) = 0;
306 Id(1,0) = 0;
Id(1,1) = 1;
322 if (d < 0.0 && min_detT == 0.0)
362 const double c2 = weight*c1/2;
363 const double c3 = c1*c2;
379 return 0.5*I1b*I1b - 2.0;
437 return 0.5*(I2b + 1.0/I2b) - 1.0;
467 return I1b*(I1b - 1.0);
495 return 0.5*(I2b*I2b + 1./(I2b*I2b) - 2.);
514 const double I2 =
ie.
Get_I2(), I2inv_sq = 1.0 / (I2 * I2);
522 MFEM_VERIFY(
Jtr != NULL,
523 "Requires a target Jacobian, use SetTargetJacobian().");
529 Id(0,0) = 1;
Id(0,1) = 0;
530 Id(1,0) = 0;
Id(1,1) = 1;
531 Id *= Mat.FNorm()/
pow(2,0.5);
540 MFEM_VERIFY(
Jtr != NULL,
541 "Requires a target Jacobian, use SetTargetJacobian().");
545 Id(0,0) = 1;
Id(0,1) = 0;
546 Id(1,0) = 0;
Id(1,1) = 1;
560 return (I2b - 1.0)*(I2b - 1.0) - I2b +
std::sqrt(I2b*I2b +
eps);
565 MFEM_ABORT(
"Metric not implemented yet. Use metric mu_55 instead.");
573 MFEM_ABORT(
"Metric not implemented yet. Use metric mu_55 instead.");
581 return 0.5*(I2b - 1.0)*(I2b - 1.0)/(I2b -
tau0);
592 const double c = (I2b - 1.0)/(I2b -
tau0);
608 const double c0 = 1.0/(I2b -
tau0);
609 const double c = c0*(I2b - 1.0);
654 double d_I1b_I2b_data[9];
658 const double a = weight/(6*
std::sqrt(I1b_I2b));
692 const double c1 = weight/9;
726 return (I3b - 1.0)*(I3b - 1.0) - I3b +
std::sqrt(I3b*I3b +
eps);
733 const double c = 2*I3b-3+(I3b)/(
std::pow((I3b*I3b+
eps),0.5));
745 const double c0 = I3b*I3b+
eps;
746 const double c1 = 2 + 1/(
pow(c0,0.5)) - I3b*I3b/(
pow(c0,1.5));
747 const double c2 = 2*I3b - 3 + I3b/(
pow(c0,0.5));
758 if (d < 0.0 && min_detT == 0.0)
767 const double c =
std::pow(d, -2.0/3.0);
774 MFEM_ABORT(
"Metric not implemented yet.");
782 MFEM_ABORT(
"Metric not implemented yet.");
819 return 0.5*(I3b + 1.0/I3b) - 1.0;
882 const double c1 = weight*c0*c0;
883 const double c2 = -2*c0*c1;
897 return 0.5*(I3b - 1.0)*(I3b - 1.0)/(I3b -
tau0);
908 const double c = (I3b - 1.0)/(I3b -
tau0);
929 const double c0 = 1.0/(I3b -
tau0);
930 const double c = c0*(I3b - 1.0);
937 MFEM_VERIFY(
Jtr != NULL,
938 "Requires a target Jacobian, use SetTargetJacobian().");
948 DenseMatrix AdjAt(dim), WtW(dim), WRK(dim), Jtrt(dim);
953 Mult(AdjAt, WtW, WRK);
958 return (0.25/alpha)*WRK.
FNorm2();
963 MFEM_VERIFY(
Jtr != NULL,
964 "Requires a target Jacobian, use SetTargetJacobian().");
971 double sqalpha =
pow(Jpr.
Det(), 0.5),
974 return 0.5*
pow(sqalpha/sqomega - sqomega/sqalpha, 2.);
979 MFEM_VERIFY(
Jtr != NULL,
980 "Requires a target Jacobian, use SetTargetJacobian().");
990 return (1./alpha)*(Jpr.
FNorm2());
995 MFEM_VERIFY(
Jtr != NULL,
996 "Requires a target Jacobian, use SetTargetJacobian().");
1004 aw = Jpr.FNorm()/
Jtr->FNorm();
1010 return (0.5/alpha)*Jpr.
FNorm2();
1016 MFEM_VERIFY(
nodes,
"Nodes are not given!");
1017 MFEM_ASSERT(
avg_volume == 0.0,
"The average volume is already computed!");
1020 const int NE = mesh->
GetNE();
1022 double volume = 0.0;
1024 for (
int i = 0; i < NE; i++)
1048 area_NE[0] = volume; area_NE[1] = NE;
1049 MPI_Allreduce(area_NE, area_NE + 2, 2, MPI_DOUBLE, MPI_SUM,
comm);
1068 const int NE = mesh->
GetNE();
1070 if (NE == 0) {
return; }
1073 "mixed meshes are not supported");
1074 MFEM_VERIFY(!fes.
IsVariableOrder(),
"variable orders are not supported");
1076 const int sdim = fes.
GetVDim();
1077 const int nvdofs = sdim*fe.GetDof();
1079 xe.
Size() == NE*nvdofs,
"invalid input Vector 'xe'!");
1089 if (dof_map->
Size() == 0) { dof_map =
nullptr; }
1093 Vector elfun_lex, elfun_nat;
1101 for (
int e = 0; e < NE; e++)
1112 const int ndofs = fe.GetDof();
1113 for (
int d = 0; d < sdim; d++)
1115 for (
int i_lex = 0; i_lex < ndofs; i_lex++)
1117 elfun_nat[(*dof_map)[i_lex]+d*ndofs] =
1118 elfun_lex[i_lex+d*ndofs];
1137 default: MFEM_ABORT(
"TargetType not added to ContainsVolumeInfo.");
1147 MFEM_CONTRACT_VAR(elfun);
1155 MFEM_ASSERT(Wideal.
Width() == Jtr.
SizeJ(),
"");
1161 for (
int i = 0; i < ir.
GetNPoints(); i++) { Jtr(i) = Wideal; }
1173 el_volume =
avg_volume / ncmesh->GetElementSizeReduction(e_id);
1177 1./W.Height()), Wideal);
1178 for (
int i = 0; i < ir.
GetNPoints(); i++) { Jtr(i) = W; }
1201 const double det = Jtr(i).Det();
1202 MFEM_VERIFY(det > 0.0,
"The given mesh is inverted!");
1203 Jtr(i).Set(
std::pow(det / detW, 1./dim), Wideal);
1209 MFEM_ABORT(
"invalid target type!");
1219 MFEM_CONTRACT_VAR(elfun);
1249 "Target type GIVEN_FULL requires a MatrixCoefficient.");
1266 MFEM_ABORT(
"Incompatible target type for analytic adaptation!");
1284 "Target type GIVEN_FULL requires a TMOPMatrixCoefficient.");
1286 for (
int d = 0; d < fe->
GetDim(); d++)
1299 MFEM_ABORT(
"Incompatible target type for analytic adaptation!");
1309 static inline void device_copy(
double *d_dest,
const double *d_src,
int size)
1311 MFEM_FORALL(i, size, d_dest[i] = d_src[i];);
1319 MFEM_VERIFY(
adapt_eval,
"SetAdaptivityEvaluator() has not been called!")
1320 MFEM_VERIFY(
ncomp > 0,
"No target specifications have been set!");
1366 MFEM_VERIFY(ndof ==
tspec.
Size()/
ncomp,
"Inconsistency in SetTspecAtIndex.");
1368 const auto tspec__d = tspec_.
Read();
1370 const int offset = idx*ndof;
1371 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1411 #endif // MFEM_USE_MPI
1428 const auto tspec_temp_d = tspec_temp.
Read();
1430 internal::device_copy(tspec_d, tspec_temp_d, tspec_temp.
Size());
1432 const auto tspec__d = tspec_.
Read();
1433 const int offset = (
ncomp-vdim)*ndof;
1434 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1441 MFEM_VERIFY(ndof ==
tspec.
Size()/
ncomp,
"Inconsistency in SetTargetSpec.");
1443 const auto tspec__d = tspec_.
Read();
1445 const int offset = idx*ndof;
1446 internal::device_copy(tspec_d + offset, tspec__d, ndof*vdim);
1484 MFEM_VERIFY(
adapt_eval,
"SetAdaptivityEvaluator() has not been called!")
1485 MFEM_VERIFY(
ncomp > 0,
"No target specifications have been set!");
1504 if (idx < 0) {
return; }
1508 "Inconsistency in GetSerialDiscreteTargetSpec.");
1510 for (
int i = 0; i < ndof*vdim; i++)
1512 tspec_(i) =
tspec(i + idx*ndof);
1539 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
1554 int dofidx,
int dir,
1557 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
1563 for (
int i = 0; i <
ncomp; i++)
1565 tspec(dofs[dofidx]+i*cnt) = IntData(dofs[dofidx] + i*cnt + dir*cnt*ncomp);
1572 MFEM_VERIFY(
tspec.
Size() > 0,
"Target specification is not set!");
1577 for (
int i = 0; i <
ncomp; i++)
1592 ntspec_dofs = ndofs*
ncomp;
1594 Vector tspec_vals(ntspec_dofs);
1605 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
1622 MFEM_VERIFY(
tspec_fesv,
"No target specifications have been set.");
1637 ntspec_dofs = ndofs*
ncomp;
1639 Vector shape(ndofs), tspec_vals(ntspec_dofs), par_vals,
1640 par_vals_c1, par_vals_c2, par_vals_c3;
1649 MFEM_VERIFY(
amr_el >= 0,
" Target being constructed for an AMR element.");
1650 for (
int i = 0; i <
ncomp; i++)
1652 for (
int j = 0; j < ndofs; j++)
1666 for (
int q = 0; q < nqp; q++)
1671 for (
int d = 0; d < 4; d++)
1680 double min_size = par_vals.
Min();
1687 MFEM_VERIFY(min_size > 0.0,
1688 "Non-positive size propagated in the target definition.");
1690 const double size = std::max(shape * par_vals, min_size);
1691 Jtr(q).Set(
std::pow(size, 1.0/dim), Jtr(q));
1704 const double min_size = par_vals.
Min();
1705 MFEM_VERIFY(min_size > 0.0,
1706 "Non-positive aspect-ratio propagated in the target definition.");
1708 const double aspectratio = shape * par_vals;
1710 D_rho(0,0) = 1./
pow(aspectratio,0.5);
1711 D_rho(1,1) =
pow(aspectratio,0.5);
1721 const double rho1 = shape * par_vals_c1;
1722 const double rho2 = shape * par_vals_c2;
1723 const double rho3 = shape * par_vals_c3;
1725 D_rho(0,0) =
pow(rho1,2./3.);
1726 D_rho(1,1) =
pow(rho2,2./3.);
1727 D_rho(2,2) =
pow(rho3,2./3.);
1732 Mult(D_rho, Temp, Jtr(q));
1742 const double skew = shape * par_vals;
1746 Q_phi(0,1) =
cos(skew);
1747 Q_phi(1,1) =
sin(skew);
1757 const double phi12 = shape * par_vals_c1;
1758 const double phi13 = shape * par_vals_c2;
1759 const double chi = shape * par_vals_c3;
1763 Q_phi(0,1) =
cos(phi12);
1764 Q_phi(0,2) =
cos(phi13);
1766 Q_phi(1,1) =
sin(phi12);
1767 Q_phi(1,2) =
sin(phi13)*
cos(chi);
1769 Q_phi(2,2) =
sin(phi13)*
sin(chi);
1774 Mult(Q_phi, Temp, Jtr(q));
1784 const double theta = shape * par_vals;
1785 R_theta(0,0) =
cos(theta);
1786 R_theta(0,1) = -
sin(theta);
1787 R_theta(1,0) =
sin(theta);
1788 R_theta(1,1) =
cos(theta);
1798 const double theta = shape * par_vals_c1;
1799 const double psi = shape * par_vals_c2;
1800 const double beta = shape * par_vals_c3;
1802 double ct =
cos(theta), st =
sin(theta),
1803 cp =
cos(psi), sp =
sin(psi),
1804 cb =
cos(beta), sb =
sin(beta);
1807 R_theta(0,0) = ct*sp;
1808 R_theta(1,0) = st*sp;
1811 R_theta(0,1) = -st*cb + ct*cp*sb;
1812 R_theta(1,1) = ct*cb + st*cp*sb;
1813 R_theta(2,1) = -sp*sb;
1815 R_theta(0,0) = -st*sb - ct*cp*cb;
1816 R_theta(1,0) = ct*sb - st*cp*cb;
1817 R_theta(2,0) = sp*cb;
1820 Jtrcomp_q = R_theta;
1822 Mult(R_theta, Temp, Jtr(q));
1828 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
1839 MFEM_VERIFY(
tspec_fesv,
"No target specifications have been set.");
1854 ntspec_dofs = ndofs*
ncomp;
1856 Vector shape(ndofs), tspec_vals(ntspec_dofs), par_vals,
1857 par_vals_c1(ndofs), par_vals_c2(ndofs), par_vals_c3(ndofs);
1860 DenseMatrix dD_rho(dim), dQ_phi(dim), dR_theta(dim);
1867 grad_e_c2(ndofs, dim),
1868 grad_e_c3(ndofs, dim);
1869 Vector grad_ptr_c1(grad_e_c1.GetData(), ndofs*
dim),
1870 grad_ptr_c2(grad_e_c2.GetData(), ndofs*
dim),
1889 grad_phys.Mult(par_vals, grad_ptr_c1);
1892 grad_e_c1.MultTranspose(shape, grad_q);
1894 const double min_size = par_vals.
Min();
1895 MFEM_VERIFY(min_size > 0.0,
1896 "Non-positive size propagated in the target definition.");
1897 const double size = std::max(shape * par_vals, min_size);
1898 double dz_dsize = (1./
dim)*
pow(size, 1./dim - 1.);
1900 Mult(Jtrcomp_q, Jtrcomp_d, work1);
1901 Mult(Jtrcomp_r, work1, work2);
1903 for (
int d = 0; d <
dim; d++)
1907 work1.
Set(dz_dsize, work1);
1909 AddMult(work1, work2, dJtr_i);
1922 grad_phys.Mult(par_vals, grad_ptr_c1);
1925 grad_e_c1.MultTranspose(shape, grad_q);
1927 const double aspectratio = shape * par_vals;
1929 dD_rho(0,0) = -0.5*
pow(aspectratio,-1.5);
1930 dD_rho(1,1) = 0.5*
pow(aspectratio,-0.5);
1932 Mult(Jtrcomp_s, Jtrcomp_r, work1);
1933 Mult(work1, Jtrcomp_q, work2);
1935 for (
int d = 0; d <
dim; d++)
1940 AddMult(work2, work1, dJtr_i);
1947 par_vals_c1.SetData(par_vals.
GetData());
1948 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
1951 grad_phys.Mult(par_vals_c1, grad_ptr_c1);
1952 grad_phys.Mult(par_vals_c2, grad_ptr_c2);
1953 grad_phys.Mult(par_vals_c3, grad_ptr_c3);
1954 Vector grad_q1(dim), grad_q2(dim), grad_q3(dim);
1956 grad_e_c1.MultTranspose(shape, grad_q1);
1957 grad_e_c2.MultTranspose(shape, grad_q2);
1960 const double rho1 = shape * par_vals_c1;
1961 const double rho2 = shape * par_vals_c2;
1962 const double rho3 = shape * par_vals_c3;
1964 dD_rho(0,0) = (2./3.)*
pow(rho1,-1./3.);
1965 dD_rho(1,1) = (2./3.)*
pow(rho2,-1./3.);
1966 dD_rho(2,2) = (2./3.)*
pow(rho3,-1./3.);
1968 Mult(Jtrcomp_s, Jtrcomp_r, work1);
1969 Mult(work1, Jtrcomp_q, work2);
1972 for (
int d = 0; d <
dim; d++)
1976 work1(0,0) *= grad_q1(d);
1977 work1(1,2) *= grad_q2(d);
1978 work1(2,2) *= grad_q3(d);
1980 AddMult(work2, work1, dJtr_i);
1992 grad_phys.Mult(par_vals, grad_ptr_c1);
1995 grad_e_c1.MultTranspose(shape, grad_q);
1997 const double skew = shape * par_vals;
2001 dQ_phi(0,1) = -
sin(skew);
2002 dQ_phi(1,1) =
cos(skew);
2004 Mult(Jtrcomp_s, Jtrcomp_r, work2);
2006 for (
int d = 0; d <
dim; d++)
2011 Mult(work1, Jtrcomp_d, work3);
2012 AddMult(work2, work3, dJtr_i);
2019 par_vals_c1.SetData(par_vals.
GetData());
2020 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
2023 grad_phys.Mult(par_vals_c1, grad_ptr_c1);
2024 grad_phys.Mult(par_vals_c2, grad_ptr_c2);
2025 grad_phys.Mult(par_vals_c3, grad_ptr_c3);
2026 Vector grad_q1(dim), grad_q2(dim), grad_q3(dim);
2028 grad_e_c1.MultTranspose(shape, grad_q1);
2029 grad_e_c2.MultTranspose(shape, grad_q2);
2032 const double phi12 = shape * par_vals_c1;
2033 const double phi13 = shape * par_vals_c2;
2034 const double chi = shape * par_vals_c3;
2038 dQ_phi(0,1) = -
sin(phi12);
2039 dQ_phi(1,1) =
cos(phi12);
2042 dQ_phi13(0,2) = -
sin(phi13);
2043 dQ_phi13(1,2) =
cos(phi13)*
cos(chi);
2044 dQ_phi13(2,2) =
cos(phi13)*
sin(chi);
2047 dQ_phichi(1,2) = -
sin(phi13)*
sin(chi);
2048 dQ_phichi(2,2) =
sin(phi13)*
cos(chi);
2050 Mult(Jtrcomp_s, Jtrcomp_r, work2);
2052 for (
int d = 0; d <
dim; d++)
2056 work1 *= grad_q1(d);
2057 work1.Add(grad_q2(d), dQ_phi13);
2058 work1.Add(grad_q3(d), dQ_phichi);
2059 Mult(work1, Jtrcomp_d, work3);
2060 AddMult(work2, work3, dJtr_i);
2072 grad_phys.Mult(par_vals, grad_ptr_c1);
2075 grad_e_c1.MultTranspose(shape, grad_q);
2077 const double theta = shape * par_vals;
2078 dR_theta(0,0) = -
sin(theta);
2079 dR_theta(0,1) = -
cos(theta);
2080 dR_theta(1,0) =
cos(theta);
2081 dR_theta(1,1) = -
sin(theta);
2083 Mult(Jtrcomp_q, Jtrcomp_d, work1);
2084 Mult(Jtrcomp_s, work1, work2);
2085 for (
int d = 0; d <
dim; d++)
2090 AddMult(work1, work2, dJtr_i);
2097 par_vals_c1.SetData(par_vals.
GetData());
2098 par_vals_c2.SetData(par_vals.
GetData()+ndofs);
2101 grad_phys.Mult(par_vals_c1, grad_ptr_c1);
2102 grad_phys.Mult(par_vals_c2, grad_ptr_c2);
2103 grad_phys.Mult(par_vals_c3, grad_ptr_c3);
2104 Vector grad_q1(dim), grad_q2(dim), grad_q3(dim);
2106 grad_e_c1.MultTranspose(shape, grad_q1);
2107 grad_e_c2.MultTranspose(shape, grad_q2);
2110 const double theta = shape * par_vals_c1;
2111 const double psi = shape * par_vals_c2;
2112 const double beta = shape * par_vals_c3;
2114 const double ct =
cos(theta), st =
sin(theta),
2115 cp =
cos(psi), sp =
sin(psi),
2116 cb =
cos(beta), sb =
sin(beta);
2119 dR_theta(0,0) = -st*sp;
2120 dR_theta(1,0) = ct*sp;
2123 dR_theta(0,1) = -ct*cb - st*cp*sb;
2124 dR_theta(1,1) = -st*cb + ct*cp*sb;
2127 dR_theta(0,0) = -ct*sb + st*cp*cb;
2128 dR_theta(1,0) = -st*sb - ct*cp*cb;
2136 dR_beta(0,1) = st*sb + ct*cp*cb;
2137 dR_beta(1,1) = -ct*sb + st*cp*cb;
2138 dR_beta(2,1) = -sp*cb;
2140 dR_beta(0,0) = -st*cb + ct*cp*sb;
2141 dR_beta(1,0) = ct*cb + st*cp*sb;
2145 dR_psi(0,0) = ct*cp;
2146 dR_psi(1,0) = st*cp;
2149 dR_psi(0,1) = 0. - ct*sp*sb;
2150 dR_psi(1,1) = 0. + st*sp*sb;
2151 dR_psi(2,1) = -cp*sb;
2153 dR_psi(0,0) = 0. + ct*sp*cb;
2154 dR_psi(1,0) = 0. + st*sp*cb;
2155 dR_psi(2,0) = cp*cb;
2157 Mult(Jtrcomp_q, Jtrcomp_d, work1);
2158 Mult(Jtrcomp_s, work1, work2);
2159 for (
int d = 0; d <
dim; d++)
2163 work1 *= grad_q1(d);
2164 work1.Add(grad_q2(d), dR_psi);
2165 work1.Add(grad_q3(d), dR_beta);
2166 AddMult(work1, work2, dJtr_i);
2174 MFEM_ABORT(
"Incompatible target type for discrete adaptation!");
2192 for (
int j = 0; j <
dim; j++)
2194 for (
int i = 0; i < cnt; i++) { xtemp(j*cnt+i) += dx; }
2199 for (
int i = 0; i < cnt; i++) { xtemp(j*cnt+i) -= dx; }
2206 double dx,
bool use_flag)
2213 totmix = 1+2*(dim-2);
2222 for (
int j = 0; j <
dim; j++)
2224 for (
int i = 0; i < cnt; i++) { xtemp(j*cnt+i) += 2*dx; }
2229 for (
int i = 0; i < cnt; i++) { xtemp(j*cnt+i) -= 2*dx; }
2234 for (
int k1 = 0; k1 <
dim; k1++)
2236 for (
int k2 = 0; (k1 != k2) && (k2 < dim); k2++)
2238 for (
int i = 0; i < cnt; i++)
2240 xtemp(k1*cnt+i) += dx;
2241 xtemp(k2*cnt+i) += dx;
2247 for (
int i = 0; i < cnt; i++)
2249 xtemp(k1*cnt+i) -= dx;
2250 xtemp(k2*cnt+i) -= dx;
2318 PA.H.GetMemory().DeleteDevice(copy_to_host);
2319 PA.H0.GetMemory().DeleteDevice(copy_to_host);
2320 if (!copy_to_host && !
PA.Jtr.GetMemory().HostIsValid())
2322 PA.Jtr_needs_update =
true;
2324 PA.Jtr.GetMemory().DeleteDevice(copy_to_host);
2333 for (
int i = 0; i <
ElemDer.Size(); i++)
2348 "'dist' must be a scalar GridFunction!");
2438 MFEM_VERIFY(
surf_fit_gf,
"Surface fitting has not been enabled.");
2441 double loc_max = 0.0, loc_sum = 0.0;
2447 loc_max = std::max(loc_max, std::abs((*
surf_fit_gf)(i)));
2451 err_avg = loc_sum / loc_cnt;
2458 MPI_Allreduce(&loc_max, &err_max, 1, MPI_DOUBLE, MPI_MAX, comm);
2459 MPI_Allreduce(&loc_cnt, &glob_cnt, 1, MPI_INT, MPI_SUM, comm);
2460 MPI_Allreduce(&loc_sum, &err_avg, 1, MPI_DOUBLE, MPI_SUM, comm);
2461 err_avg = err_avg / glob_cnt;
2503 const bool surface_fit = (
surf_fit_gf && fd_call_flag ==
false);
2560 Vector adapt_lim_gf_q, adapt_lim_gf0_q;
2561 if (adaptive_limiting)
2574 const double weight = ip.
weight * Jtr_i.
Det();
2594 if (adaptive_limiting)
2596 const double diff = adapt_lim_gf_q(i) - adapt_lim_gf0_q(i);
2600 energy += weight * val;
2612 for (
int s = 0;
s < dofs.
Size();
s++)
2619 sigma_e(
s) * sigma_e(
s);
2643 for (
int e = 0; e < NEsplit; e++)
2650 for (
int i = 0; i < dof; i++)
2652 for (
int d = 0; d <
dim; d++)
2658 elfun_child(i + d*dof) = elfun(i + e*dof + d*dof*NEsplit);
2665 double el_energy = 0;
2693 const double weight = ip.
weight * Jtr_i.
Det();
2702 el_energy += weight * val;
2705 energy += el_energy;
2752 const double weight = ip.
weight * Jtr_i.
Det();
2761 energy += weight * val;
2825 Vector shape,
p, p0, d_vals, grad;
2842 d_vals.
SetSize(nqp); d_vals = 1.0;
2867 for (
int q = 0; q < nqp; q++)
2894 for (
int d = 0; d <
dim; d++)
2898 d_detW_dx(d) = dwdx.
Trace();
2905 for (
int d = 0; d <
dim; d++)
2910 Mult(Amat, work2, work1);
2912 d_Winv_dx(d) = work2.
Trace();
2914 d_Winv_dx *= -weight_m;
2916 d_detW_dx += d_Winv_dx;
2978 d_vals.
SetSize(nqp); d_vals = 1.0;
2995 for (
int q = 0; q < nqp; q++)
3021 for (
int i = 0; i < dof; i++)
3023 const double w_shape_i = weight_m * shape(i);
3024 for (
int j = 0; j < dof; j++)
3026 const double w = w_shape_i * shape(j);
3027 for (
int d1 = 0; d1 <
dim; d1++)
3029 for (
int d2 = 0; d2 <
dim; d2++)
3031 elmat(d1*dof + i, d2*dof + j) += w * hess(d1, d2);
3052 Vector shape(dof), adapt_lim_gf_e, adapt_lim_gf_q, adapt_lim_gf0_q(nqp);
3066 grad_phys.
Mult(adapt_lim_gf_e, grad_ptr);
3070 for (
int q = 0; q < nqp; q++)
3074 adapt_lim_gf_grad_e.
MultTranspose(shape, adapt_lim_gf_grad_q);
3075 adapt_lim_gf_grad_q *= 2.0 * (adapt_lim_gf_q(q) - adapt_lim_gf0_q(q));
3088 Vector shape(dof), adapt_lim_gf_e, adapt_lim_gf_q, adapt_lim_gf0_q(nqp);
3102 grad_phys.
Mult(adapt_lim_gf_e, grad_ptr);
3107 Mult(grad_phys, adapt_lim_gf_grad_e, adapt_lim_gf_hess_e);
3109 adapt_lim_gf_hess_e.
SetSize(dof, dim*dim);
3111 Vector adapt_lim_gf_grad_q(dim);
3114 for (
int q = 0; q < nqp; q++)
3119 adapt_lim_gf_grad_e.
MultTranspose(shape, adapt_lim_gf_grad_q);
3124 for (
int i = 0; i < dof *
dim; i++)
3126 const int idof = i % dof, idim = i / dof;
3127 for (
int j = 0; j <= i; j++)
3129 const int jdof = j % dof, jdim = j / dof;
3130 const double entry =
3131 w * ( 2.0 * adapt_lim_gf_grad_q(idim) * shape(idof) *
3132 adapt_lim_gf_grad_q(jdim) * shape(jdof) +
3133 2.0 * (adapt_lim_gf_q(q) - adapt_lim_gf0_q(q)) *
3134 adapt_lim_gf_hess_q(idim, jdim) * shape(idof) * shape(jdof));
3136 if (i != j) { mat(j, i) += entry; }
3151 for (
int s = 0;
s < dofs.
Size();
s++)
3153 count += ((*surf_fit_marker)[dofs[
s]]) ? 1 : 0;
3155 if (count == 0) {
return; }
3171 grad_phys.Mult(sigma_e, grad_ptr);
3173 Vector shape_x(dof_x), shape_s(dof_s);
3176 surf_fit_grad_s = 0.0;
3178 for (
int s = 0;
s < dof_s;
s++)
3205 for (
int s = 0;
s < dofs.
Size();
s++)
3207 count += ((*surf_fit_marker)[dofs[
s]]) ? 1 : 0;
3209 if (count == 0) {
return; }
3223 grad_phys.Mult(sigma_e, grad_ptr);
3227 surf_fit_hess_e.
SetSize(dof_s*dim, dim);
3228 Mult(grad_phys, surf_fit_grad_e, surf_fit_hess_e);
3229 surf_fit_hess_e.
SetSize(dof_s, dim * dim);
3232 Vector shape_x(dof_x), shape_s(dof_s);
3234 Vector surf_fit_grad_s(dim);
3238 for (
int s = 0;
s < dof_s;
s++)
3254 for (
int i = 0; i < dof_x *
dim; i++)
3256 const int idof = i % dof_x, idim = i / dof_x;
3257 for (
int j = 0; j <= i; j++)
3259 const int jdof = j % dof_x, jdim = j / dof_x;
3260 const double entry =
3261 w * ( 2.0 * surf_fit_grad_s(idim) * shape_x(idof) *
3262 surf_fit_grad_s(jdim) * shape_x(jdof) +
3263 2.0 * sigma_e(
s) * surf_fit_hess_s(idim, jdim) *
3264 shape_x(idof) * shape_x(jdof));
3266 if (i != j) { mat(j, i) += entry; }
3274 Vector &elfun,
const int dofidx,
3275 const int dir,
const double e_fx,
3279 int idx = dir*dof+dofidx;
3283 double dfdx = (e_fxph-e_fx)/
dx;
3317 for (
int j = 0; j <
dim; j++)
3319 for (
int i = 0; i < dof; i++)
3349 for (
int q = 0; q < nqp; q++)
3375 for (
int i = 0; i < dof; i++)
3377 for (
int j = 0; j < i+1; j++)
3379 for (
int k1 = 0; k1 <
dim; k1++)
3381 for (
int k2 = 0; k2 <
dim; k2++)
3383 elfunmod(k2*dof+j) +=
dx;
3410 double e_fx = ElemPertLoc(k2*dof+j);
3413 elfunmod(k2*dof+j) -=
dx;
3414 double e_fpx = ElemDerLoc(k1*dof+i);
3416 elmat(k1*dof+i, k2*dof+j) = (e_fpxph - e_fpx) /
dx;
3417 elmat(k2*dof+j, k1*dof+i) = (e_fpxph - e_fpx) /
dx;
3447 for (
int q = 0; q < nqp; q++)
3464 MFEM_VERIFY(cf,
"Dynamic weight works only with a ConstantCoefficient.");
3465 cf->constant *= factor;
3474 MFEM_VERIFY(cf,
"Dynamic weight works only with a ConstantCoefficient.");
3475 return cf->constant;
3504 double &metric_energy,
3506 double &surf_fit_gf_energy)
3517 metric_energy = 0.0;
3519 surf_fit_gf_energy = 0.0;
3520 for (
int i = 0; i < fes->
GetNE(); i++)
3526 const int dof = fe->
GetDof();
3535 for (
int q = 0; q < nqp; q++)
3540 const double weight = ip.
weight *
Jtr(q).Det();
3547 lim_energy += weight;
3557 for (
int s = 0;
s < dofs.
Size();
s++)
3561 surf_fit_gf_energy += sigma_e(
s) * sigma_e(
s);
3570 lim_energy = fes->
GetNE();
3587 dx = std::numeric_limits<float>::max();
3590 double detv_avg_min = std::numeric_limits<float>::max();
3591 for (
int i = 0; i < NE; i++)
3596 for (
int j = 0; j < nsp; j++)
3600 detv_sum += std::fabs(
Jpr.
Det());
3602 double detv_avg =
pow(detv_sum/nsp, 1./dim);
3603 detv_avg_min = std::min(detv_avg, detv_avg_min);
3612 PA.Jtr_needs_update =
true;
3637 MPI_Allreduce(&
dx, &min_jac_all, 1, MPI_DOUBLE, MPI_MIN, pfes.
GetComm());
3675 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
3677 tmopi[0]->EnableLimiting(n0, dist, w0, lfunc);
3678 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
3685 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
3687 tmopi[0]->EnableLimiting(n0, w0, lfunc);
3688 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
3693 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
3695 tmopi[0]->SetLimitingNodes(n0);
3696 for (
int i = 1; i <
tmopi.Size(); i++) {
tmopi[i]->DisableLimiting(); }
3704 for (
int i = 0; i <
tmopi.Size(); i++)
3706 energy +=
tmopi[i]->GetElementEnergy(el, T, elfun);
3716 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
3718 tmopi[0]->AssembleElementVector(el, T, elfun, elvect);
3719 for (
int i = 1; i <
tmopi.Size(); i++)
3722 tmopi[i]->AssembleElementVector(el, T, elfun, elvect_i);
3732 MFEM_VERIFY(
tmopi.Size() > 0,
"No TMOP_Integrators were added.");
3734 tmopi[0]->AssembleElementGrad(el, T, elfun, elmat);
3735 for (
int i = 1; i <
tmopi.Size(); i++)
3738 tmopi[i]->AssembleElementGrad(el, T, elfun, elmat_i);
3749 for (
int i = 0; i <
tmopi.Size(); i++)
3751 energy +=
tmopi[i]->GetRefinementElementEnergy(el, T, elfun, irule);
3762 for (
int i = 0; i <
tmopi.Size(); i++)
3764 energy +=
tmopi[i]->GetDerefinementElementEnergy(el, T, elfun);
3771 const int cnt =
tmopi.Size();
3772 double total_integral = 0.0;
3773 for (
int i = 0; i < cnt; i++)
3775 tmopi[i]->EnableNormalization(x);
3776 total_integral += 1.0 /
tmopi[i]->metric_normal;
3778 for (
int i = 0; i < cnt; i++)
3780 tmopi[i]->metric_normal = 1.0 / total_integral;
3787 const int cnt =
tmopi.Size();
3788 double total_integral = 0.0;
3789 for (
int i = 0; i < cnt; i++)
3791 tmopi[i]->ParEnableNormalization(x);
3792 total_integral += 1.0 /
tmopi[i]->metric_normal;
3794 for (
int i = 0; i < cnt; i++)
3796 tmopi[i]->metric_normal = 1.0 / total_integral;
3803 for (
int i = 0; i <
tmopi.Size(); i++)
3805 tmopi[i]->AssemblePA(fes);
3812 for (
int i = 0; i <
tmopi.Size(); i++)
3814 tmopi[i]->AssembleGradPA(xe,fes);
3820 for (
int i = 0; i <
tmopi.Size(); i++)
3822 tmopi[i]->AssembleGradDiagonalPA(de);
3828 for (
int i = 0; i <
tmopi.Size(); i++)
3830 tmopi[i]->AddMultPA(xe, ye);
3836 for (
int i = 0; i <
tmopi.Size(); i++)
3838 tmopi[i]->AddMultGradPA(re, ce);
3844 double energy = 0.0;
3845 for (
int i = 0; i <
tmopi.Size(); i++)
3847 energy +=
tmopi[i]->GetLocalStateEnergyPA(xe);
3856 const int NE = mesh.
GetNE();
3859 DenseMatrix Winv(dim), T(dim), A(dim), dshape, pos;
3864 for (
int i = 0; i < NE; i++)
3881 for (
int j = 0; j < nsp; j++)
3892 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.
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...
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).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
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.
void AssembleElemVecSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
void SetSerialMetaInfo(const Mesh &m, const FiniteElementCollection &fec, int num_comp)
Class for an integration rule - an Array of IntegrationPoint.
VectorCoefficient * vector_tspec
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.
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).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
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).
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).
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).
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.
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.
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).
Abstract parallel finite element space.
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
InvariantsEvaluator2D< double > ie
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_)
void UpdateSurfaceFittingWeight(double factor)
Update the surface fitting weight as surf_fit_coeff *= factor;.
struct mfem::TMOP_Integrator::@13 PA
void UpdateGradientTargetSpecification(const Vector &x, double dx, bool use_flag=false)
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.
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).
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
void UpdateTargetSpecification(const Vector &new_x, bool use_flag=false)
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(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...
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
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 UpdateAfterMeshPositionChange(const Vector &new_x)
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
virtual const FiniteElement * GetFE(int i) const
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).
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.
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).
void Add(const double c, const DenseMatrix &A)
Adds the matrix A multiplied by the number c to the matrix.
void ResetRefinementTspecData()
InvariantsEvaluator2D< double > ie
void ClearGeometricFactors()
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
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
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
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).
virtual void SetParDiscreteTargetAspectRatio(const ParGridFunction &tspec_)
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
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.
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
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 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
FDualNumber< tbase > cos(const FDualNumber< tbase > &f)
cos([dual number])
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
FDualNumber< tbase > pow(const FDualNumber< tbase > &a, const FDualNumber< tbase > &b)
pow([dual number],[dual number])
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
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).
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.
FDualNumber< tbase > sin(const FDualNumber< tbase > &f)
sin([dual number])
void UpdateHessianTargetSpecification(const Vector &x, double dx, bool use_flag=false)
void Transpose()
(*this) = (*this)^t
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
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
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.
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).
void ReleasePADeviceMemory(bool copy_to_host=true)
bool UsesPhysicalCoordinates() const
Return true if the methods ComputeElementTargets(), ComputeAllElementTargets(), and ComputeElementTar...
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).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
const scalar_t * Get_dI1b()
void SetDataAndSize(double *d, int s)
Set the Vector data and size.
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
const scalar_t * Get_dI1b()
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
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).
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()
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 * 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.
AdaptivityEvaluator * adapt_eval
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)
const IntegrationRule & EnergyIntegrationRule(const FiniteElement &el) const
const IntegrationRule & GradientIntegrationRule(const FiniteElement &el) const
double GetFDDerivative(const FiniteElement &el, ElementTransformation &T, Vector &elfun, const int nodenum, const int idir, const double baseenergy, bool update_stored)
FDualNumber< tbase > sqrt(const FDualNumber< tbase > &f)
sqrt([dual number])
void SetParMetaInfo(const ParMesh &m, const FiniteElementCollection &fec, int num_comp)
Parallel version of SetSerialMetaInfo.
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).
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).
InvariantsEvaluator2D< 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 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).
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...
GridFunction * surf_fit_gf
virtual double EvalW(const DenseMatrix &Jpt) const
Evaluate the strain energy density function, W = W(Jpt).
void FinalizeParDiscreteTargetSpec(const ParGridFunction &tspec_)
void MultAtB(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &AtB)
Multiply the transpose of a matrix A with a matrix B: At*B.
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
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).
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.
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).
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).
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)
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).
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.
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 ComputeAtNewPosition(const Vector &new_nodes, Vector &new_field)=0
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).
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
FiniteElementSpace * coarse_tspec_fesv
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.