MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <TShapeSizeB1.hpp>
Public Member Functions | |
virtual MESQUITE_EXPORT | ~TShapeSizeB1 () |
virtual MESQUITE_EXPORT std::string | get_name () const |
virtual MESQUITE_EXPORT bool | evaluate (const MsqMatrix< 2, 2 > &T, double &result, MsqError &err) |
Evaluate \(\mu(T)\). | |
virtual MESQUITE_EXPORT bool | evaluate_with_grad (const MsqMatrix< 2, 2 > &T, double &result, MsqMatrix< 2, 2 > &deriv_wrt_T, MsqError &err) |
Gradient of \(\mu(T)\) with respect to components of T. | |
virtual MESQUITE_EXPORT bool | evaluate_with_hess (const MsqMatrix< 2, 2 > &T, double &result, MsqMatrix< 2, 2 > &deriv_wrt_T, MsqMatrix< 2, 2 > second_wrt_T[3], MsqError &err) |
Hessian of \(\mu(T)\) with respect to components of T. | |
virtual MESQUITE_EXPORT bool | evaluate (const MsqMatrix< 3, 3 > &T, double &result, MsqError &err) |
Evaluate \(\mu(T)\). | |
virtual MESQUITE_EXPORT bool | evaluate_with_grad (const MsqMatrix< 3, 3 > &T, double &result, MsqMatrix< 3, 3 > &deriv_wrt_T, MsqError &err) |
Gradient of \(\mu(T)\) with respect to components of T. | |
virtual MESQUITE_EXPORT bool | evaluate_with_hess (const MsqMatrix< 3, 3 > &T, double &result, MsqMatrix< 3, 3 > &deriv_wrt_T, MsqMatrix< 3, 3 > second_wrt_T[6], MsqError &err) |
Hessian of \(\mu(T)\) with respect to components of T. |
|T - T^-t|^2
Definition at line 42 of file TShapeSizeB1.hpp.
MBMesquite::TShapeSizeB1::~TShapeSizeB1 | ( | ) | [virtual] |
Definition at line 45 of file TShapeSizeB1.cpp.
{}
bool MBMesquite::TShapeSizeB1::evaluate | ( | const MsqMatrix< 2, 2 > & | T, |
double & | result, | ||
MsqError & | err | ||
) | [virtual] |
Evaluate \(\mu(T)\).
T | 2x2 relative measure matrix (typically A W^-1) |
result | Output: value of function |
Reimplemented from MBMesquite::TMetric.
Definition at line 47 of file TShapeSizeB1.cpp.
References MBMesquite::det(), MBMesquite::TMetricBarrier::invalid_determinant(), and MBMesquite::sqr_Frobenius().
{ const double tau = det( T ); if( invalid_determinant( tau ) ) { // barrier return false; } const double nT = sqr_Frobenius( T ); const double f = 1 / ( tau * tau ); result = ( 1 + f ) * nT - 4; return true; }
bool MBMesquite::TShapeSizeB1::evaluate | ( | const MsqMatrix< 3, 3 > & | T, |
double & | result, | ||
MsqError & | err | ||
) | [virtual] |
Evaluate \(\mu(T)\).
T | 3x3 relative measure matrix (typically A W^-1) |
result | Output: value of function |
Reimplemented from MBMesquite::TMetric.
Definition at line 61 of file TShapeSizeB1.cpp.
References MBMesquite::det(), MBMesquite::TMetricBarrier::invalid_determinant(), MBMesquite::sqr_Frobenius(), and MBMesquite::transpose_adj().
{ const double tau = det( T ); if( invalid_determinant( tau ) ) { // barrier return false; } const double nT = sqr_Frobenius( T ); const double nadj = sqr_Frobenius( transpose_adj( T ) ); const double f = 1 / ( tau * tau ); result = nT + f * nadj - 6; return true; }
bool MBMesquite::TShapeSizeB1::evaluate_with_grad | ( | const MsqMatrix< 2, 2 > & | T, |
double & | result, | ||
MsqMatrix< 2, 2 > & | deriv_wrt_T, | ||
MsqError & | err | ||
) | [virtual] |
Gradient of \(\mu(T)\) with respect to components of T.
T | 2x2 relative measure matrix (typically A W^-1) |
result | Output: value of function |
deriv_wrt_T | Output: partial deriviatve of \(\mu\) wrt each term of T, evaluated at passed T. \[\left[\begin{array}{cc} \frac{\partial\mu}{\partial T_{0,0}} & \frac{\partial\mu}{\partial T_{0,1}} \\ \frac{\partial\mu}{\partial T_{1,0}} & \frac{\partial\mu}{\partial T_{1,1}} \\ \end{array}\right]\] |
Reimplemented from MBMesquite::TMetric.
Definition at line 76 of file TShapeSizeB1.cpp.
References MBMesquite::MsqError::BARRIER_VIOLATED, MBMesquite::barrier_violated_msg, MBMesquite::det(), MBMesquite::TMetricBarrier::invalid_determinant(), MSQ_SETERR, MBMesquite::sqr_Frobenius(), T, and MBMesquite::transpose_adj().
{ const double tau = det( T ); if( invalid_determinant( tau ) ) { // barrier MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED ); return false; } const MsqMatrix< 2, 2 > adjt = transpose_adj( T ); const double nT = sqr_Frobenius( T ); const double f = 1 / ( tau * tau ); result = ( 1 + f ) * nT - 4; deriv_wrt_T = T; deriv_wrt_T *= 2 + 2 * f; deriv_wrt_T -= 2 * f / tau * nT * adjt; return true; }
bool MBMesquite::TShapeSizeB1::evaluate_with_grad | ( | const MsqMatrix< 3, 3 > & | T, |
double & | result, | ||
MsqMatrix< 3, 3 > & | deriv_wrt_T, | ||
MsqError & | err | ||
) | [virtual] |
Gradient of \(\mu(T)\) with respect to components of T.
T | 3x3 relative measure matrix (typically A W^-1) |
result | Output: value of function |
deriv_wrt_T | Output: partial deriviatve of \(\mu\) wrt each term of T, evaluated at passed T. \[\left[\begin{array}{ccc} \frac{\partial\mu}{\partial T_{0,0}} & \frac{\partial\mu}{\partial T_{0,1}} & \frac{\partial\mu}{\partial T_{0,2}} \\ \frac{\partial\mu}{\partial T_{1,0}} & \frac{\partial\mu}{\partial T_{1,1}} & \frac{\partial\mu}{\partial T_{1,2}} \\ \frac{\partial\mu}{\partial T_{2,0}} & \frac{\partial\mu}{\partial T_{2,1}} & \frac{\partial\mu}{\partial T_{2,2}} \end{array}\right]\] |
Reimplemented from MBMesquite::TMetric.
Definition at line 100 of file TShapeSizeB1.cpp.
References MBMesquite::MsqError::BARRIER_VIOLATED, MBMesquite::barrier_violated_msg, MBMesquite::det(), MBMesquite::TMetricBarrier::invalid_determinant(), MSQ_SETERR, MBMesquite::sqr_Frobenius(), T, MBMesquite::transpose(), and MBMesquite::transpose_adj().
{ const double tau = det( T ); if( invalid_determinant( tau ) ) { // barrier MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED ); return false; } const MsqMatrix< 3, 3 > adjt = transpose_adj( T ); const double nT = sqr_Frobenius( T ); const double nadj = sqr_Frobenius( adjt ); const double f = 1 / ( tau * tau ); result = nT + f * nadj - 6; deriv_wrt_T = T; deriv_wrt_T *= ( 1 + f * nT ); deriv_wrt_T -= f * T * transpose( T ) * T; deriv_wrt_T -= f / tau * nadj * adjt; deriv_wrt_T *= 2; return true; }
bool MBMesquite::TShapeSizeB1::evaluate_with_hess | ( | const MsqMatrix< 2, 2 > & | T, |
double & | result, | ||
MsqMatrix< 2, 2 > & | deriv_wrt_T, | ||
MsqMatrix< 2, 2 > | second_wrt_T[3], | ||
MsqError & | err | ||
) | [virtual] |
Hessian of \(\mu(T)\) with respect to components of T.
T | 3x3 relative measure matrix (typically A W^-1) |
result | Output: value of function |
deriv_wrt_T | Output: partial deriviatve of \(\mu\) wrt each term of T, evaluated at passed T. |
second_wrt_T | Output: 9x9 matrix of second partial deriviatve of \(\mu\) wrt each term of T, in row-major order. The symmetric matrix is decomposed into 3x3 blocks and only the upper diagonal blocks, in row-major order, are returned. \[\left[\begin{array}{cc|cc} \frac{\partial^{2}\mu}{\partial T_{0,0}^2} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial A_{0,1}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial A_{1,0}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial A_{1,1}} \\ \frac{\partial^{2}\mu}{\partial T_{0,0}\partial A_{0,1}} & \frac{\partial^{2}\mu}{\partial T_{0,1}^2} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial A_{1,0}} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial A_{1,1}} \\ \hline & & \frac{\partial^{2}\mu}{\partial T_{1,0}^2} & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial A_{1,1}} \\ & & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial A_{1,1}} & \frac{\partial^{2}\mu}{\partial T_{1,1}^2} \\ \end{array}\right]\] |
Reimplemented from MBMesquite::TMetric.
Definition at line 127 of file TShapeSizeB1.cpp.
References MBMesquite::MsqError::BARRIER_VIOLATED, MBMesquite::barrier_violated_msg, MBMesquite::det(), MBMesquite::TMetricBarrier::invalid_determinant(), MSQ_SETERR, MBMesquite::pluseq_scaled_2nd_deriv_of_det(), MBMesquite::pluseq_scaled_I(), MBMesquite::pluseq_scaled_outer_product(), MBMesquite::set_scaled_sum_outer_product(), MBMesquite::sqr_Frobenius(), T, and MBMesquite::transpose_adj().
{ const double tau = det( T ); if( invalid_determinant( tau ) ) { // barrier MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED ); return false; } const MsqMatrix< 2, 2 > adjt = transpose_adj( T ); const double nT = sqr_Frobenius( T ); const double f = 1 / ( tau * tau ); result = ( 1 + f ) * nT - 4; deriv_wrt_T = T; deriv_wrt_T *= 2 + 2 * f; deriv_wrt_T -= 2 * f / tau * nT * adjt; set_scaled_sum_outer_product( second_wrt_T, -4 * f / tau, T, adjt ); pluseq_scaled_I( second_wrt_T, 2 + 2 * f ); pluseq_scaled_outer_product( second_wrt_T, 6 * nT * f * f, adjt ); pluseq_scaled_2nd_deriv_of_det( second_wrt_T, -2 * nT * f / tau ); return true; }
bool MBMesquite::TShapeSizeB1::evaluate_with_hess | ( | const MsqMatrix< 3, 3 > & | T, |
double & | result, | ||
MsqMatrix< 3, 3 > & | deriv_wrt_T, | ||
MsqMatrix< 3, 3 > | second_wrt_T[6], | ||
MsqError & | err | ||
) | [virtual] |
Hessian of \(\mu(T)\) with respect to components of T.
T | 3x3 relative measure matrix (typically A W^-1) |
result | Output: value of function |
deriv_wrt_T | Output: partial deriviatve of \(\mu\) wrt each term of T, evaluated at passed T. |
second_wrt_T | Output: 9x9 matrix of second partial deriviatve of \(\mu\) wrt each term of T, in row-major order. The symmetric matrix is decomposed into 3x3 blocks and only the upper diagonal blocks, in row-major order, are returned. \[\left[\begin{array}{ccc|ccc|ccc} \frac{\partial^{2}\mu}{\partial T_{0,0}^2} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{0,1}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{0,2}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{1,0}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{1,1}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{1,2}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{2,0}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{2,1}} & \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{2,2}} \\ \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{0,1}} & \frac{\partial^{2}\mu}{\partial T_{0,1}^2} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial T_{0,2}} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial T_{1,0}} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial T_{1,1}} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial T_{1,2}} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial T_{2,0}} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial T_{2,1}} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial T_{2,2}} \\ \frac{\partial^{2}\mu}{\partial T_{0,0}\partial T_{0,2}} & \frac{\partial^{2}\mu}{\partial T_{0,1}\partial T_{0,2}} & \frac{\partial^{2}\mu}{\partial T_{0,2}^2} & \frac{\partial^{2}\mu}{\partial T_{0,2}\partial T_{1,0}} & \frac{\partial^{2}\mu}{\partial T_{0,2}\partial T_{1,1}} & \frac{\partial^{2}\mu}{\partial T_{0,2}\partial T_{1,2}} & \frac{\partial^{2}\mu}{\partial T_{0,2}\partial T_{2,0}} & \frac{\partial^{2}\mu}{\partial T_{0,2}\partial T_{2,1}} & \frac{\partial^{2}\mu}{\partial T_{0,2}\partial T_{2,2}} \\ \hline & & & \frac{\partial^{2}\mu}{\partial T_{1,0}^2} & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial T_{1,1}} & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial T_{1,2}} & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial T_{2,0}} & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial T_{2,1}} & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial T_{2,2}} \\ & & & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial T_{1,1}} & \frac{\partial^{2}\mu}{\partial T_{1,1}^2} & \frac{\partial^{2}\mu}{\partial T_{1,1}\partial T_{1,2}} & \frac{\partial^{2}\mu}{\partial T_{1,1}\partial T_{2,0}} & \frac{\partial^{2}\mu}{\partial T_{1,1}\partial T_{2,1}} & \frac{\partial^{2}\mu}{\partial T_{1,1}\partial T_{2,2}} \\ & & & \frac{\partial^{2}\mu}{\partial T_{1,0}\partial T_{1,2}} & \frac{\partial^{2}\mu}{\partial T_{1,1}\partial T_{1,2}} & \frac{\partial^{2}\mu}{\partial T_{1,2}^2} & \frac{\partial^{2}\mu}{\partial T_{1,2}\partial T_{2,0}} & \frac{\partial^{2}\mu}{\partial T_{1,2}\partial T_{2,1}} & \frac{\partial^{2}\mu}{\partial T_{1,2}\partial T_{2,2}} \\ \hline & & & & & & \frac{\partial^{2}\mu}{\partial T_{2,0}^2} & \frac{\partial^{2}\mu}{\partial T_{2,0}\partial T_{2,1}} & \frac{\partial^{2}\mu}{\partial T_{2,0}\partial T_{2,2}} \\ & & & & & & \frac{\partial^{2}\mu}{\partial T_{2,0}\partial T_{2,1}} & \frac{\partial^{2}\mu}{\partial T_{2,1}^2} & \frac{\partial^{2}\mu}{\partial T_{2,1}\partial T_{2,2}} \\ & & & & & & \frac{\partial^{2}\mu}{\partial T_{2,0}\partial T_{2,2}} & \frac{\partial^{2}\mu}{\partial T_{2,1}\partial T_{2,2}} & \frac{\partial^{2}\mu}{\partial T_{2,2}^2} \\ \end{array}\right]\] |
\( \frac{\partial}{\partial T} |adj T|^2 \)
Reimplemented from MBMesquite::TMetric.
Definition at line 156 of file TShapeSizeB1.cpp.
References MBMesquite::MsqError::BARRIER_VIOLATED, MBMesquite::barrier_violated_msg, MBMesquite::det(), MBMesquite::TMetricBarrier::invalid_determinant(), MSQ_SETERR, MBMesquite::pluseq_scaled_2nd_deriv_of_det(), MBMesquite::pluseq_scaled_I(), MBMesquite::pluseq_scaled_outer_product(), MBMesquite::pluseq_scaled_sum_outer_product(), MBMesquite::set_scaled_2nd_deriv_norm_sqr_adj(), MBMesquite::sqr_Frobenius(), T, MBMesquite::transpose(), and MBMesquite::transpose_adj().
{ const double tau = det( T ); if( invalid_determinant( tau ) ) { // barrier MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED ); return false; } const MsqMatrix< 3, 3 > adjt = transpose_adj( T ); const double nT = sqr_Frobenius( T ); const double nadj = sqr_Frobenius( adjt ); const double f = 1 / ( tau * tau ); result = nT + f * nadj - 6; //! \f$ \frac{\partial}{\partial T} |adj T|^2 \f$ const MsqMatrix< 3, 3 > dNadj_dT = 2 * ( nT * T - T * transpose( T ) * T ); deriv_wrt_T = T; deriv_wrt_T -= f / tau * nadj * adjt; deriv_wrt_T *= 2; deriv_wrt_T += f * dNadj_dT; // calculate negative of 2nd wrt T of (|adj T|^2 / tau^2) (sec 3.2.2) set_scaled_2nd_deriv_norm_sqr_adj( second_wrt_T, f, T ); pluseq_scaled_2nd_deriv_of_det( second_wrt_T, -2 * f * f * nadj * tau, T ); pluseq_scaled_outer_product( second_wrt_T, 6 * f * f * nadj, adjt ); pluseq_scaled_sum_outer_product( second_wrt_T, -2 * f * f * tau, adjt, dNadj_dT ); // calculate 2nd wrt T of this metric pluseq_scaled_I( second_wrt_T, 2.0 ); return true; }
std::string MBMesquite::TShapeSizeB1::get_name | ( | ) | const [virtual] |
Reimplemented from MBMesquite::TMetricBarrier.
Definition at line 40 of file TShapeSizeB1.cpp.
{ return "TShapeSizeB1"; }