MOAB: Mesh Oriented datABase  (version 5.3.1)
MBMesquite::TShapeSizeNB3 Class Reference

#include <TShapeSizeNB3.hpp>

+ Inheritance diagram for MBMesquite::TShapeSizeNB3:
+ Collaboration diagram for MBMesquite::TShapeSizeNB3:

Public Member Functions

 TShapeSizeNB3 (double gamma=2.0)
virtual MESQUITE_EXPORT ~TShapeSizeNB3 ()
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.

Private Attributes

double mGamma

Detailed Description

2D: \( |T - adj T^t|^2 + \gamma (\tau - 1)^2 = 2 |T|^2 - 4 \tau + \gamma (\tau - 1)^2 \) 3D: \( 2 |T|^3 - 3 \sqrt{3} \tau + \gamma (\tau - 1)^2 \)

Definition at line 44 of file TShapeSizeNB3.hpp.


Constructor & Destructor Documentation

MBMesquite::TShapeSizeNB3::TShapeSizeNB3 ( double  gamma = 2.0) [inline]

Definition at line 47 of file TShapeSizeNB3.hpp.

: mGamma( gamma ) {}

Definition at line 45 of file TShapeSizeNB3.cpp.

{}

Member Function Documentation

bool MBMesquite::TShapeSizeNB3::evaluate ( const MsqMatrix< 2, 2 > &  T,
double &  result,
MsqError err 
) [virtual]

Evaluate \(\mu(T)\).

Parameters:
T2x2 relative measure matrix (typically A W^-1)
resultOutput: value of function
Returns:
false if function cannot be evaluated for given T (e.g. division by zero, etc.), true otherwise.

Reimplemented from MBMesquite::TMetric.

Definition at line 47 of file TShapeSizeNB3.cpp.

References MBMesquite::det(), mGamma, and MBMesquite::sqr_Frobenius().

{
    const double nT   = sqr_Frobenius( T );
    const double tau  = det( T );
    const double tau1 = tau - 1;
    result            = 2 * nT - 4 * tau + mGamma * tau1 * tau1;
    return true;
}
bool MBMesquite::TShapeSizeNB3::evaluate ( const MsqMatrix< 3, 3 > &  T,
double &  result,
MsqError err 
) [virtual]

Evaluate \(\mu(T)\).

Parameters:
T3x3 relative measure matrix (typically A W^-1)
resultOutput: value of function
Returns:
false if function cannot be evaluated for given T (e.g. division by zero, etc.), true otherwise.

Reimplemented from MBMesquite::TMetric.

Definition at line 92 of file TShapeSizeNB3.cpp.

References MBMesquite::det(), MBMesquite::Frobenius(), mGamma, and MBMesquite::MSQ_SQRT_THREE.

{
    const double nT   = Frobenius( T );
    const double tau  = det( T );
    const double tau1 = tau - 1;
    result            = nT * nT * nT - 3 * MSQ_SQRT_THREE * tau + mGamma * tau1 * tau1;
    return true;
}
bool MBMesquite::TShapeSizeNB3::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.

Parameters:
T2x2 relative measure matrix (typically A W^-1)
resultOutput: value of function
deriv_wrt_TOutput: 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]\]

Returns:
false if function cannot be evaluated for given T (e.g. division by zero, etc.), true otherwise.

Reimplemented from MBMesquite::TMetric.

Definition at line 56 of file TShapeSizeNB3.cpp.

References MBMesquite::det(), mGamma, MBMesquite::sqr_Frobenius(), T, and MBMesquite::transpose_adj().

{
    const double nT   = sqr_Frobenius( T );
    const double tau  = det( T );
    const double tau1 = tau - 1;
    result            = 2 * nT - 4 * tau + mGamma * tau1 * tau1;

    deriv_wrt_T = T;
    deriv_wrt_T *= 4;
    deriv_wrt_T += ( 2 * mGamma * tau1 - 4 ) * transpose_adj( T );

    return true;
}
bool MBMesquite::TShapeSizeNB3::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.

Parameters:
T3x3 relative measure matrix (typically A W^-1)
resultOutput: value of function
deriv_wrt_TOutput: 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]\]

Returns:
false if function cannot be evaluated for given T (e.g. division by zero, etc.), true otherwise.

Reimplemented from MBMesquite::TMetric.

Definition at line 101 of file TShapeSizeNB3.cpp.

References MBMesquite::det(), MBMesquite::Frobenius(), mGamma, MBMesquite::MSQ_SQRT_THREE, T, and MBMesquite::transpose_adj().

{
    const double nT   = Frobenius( T );
    const double tau  = det( T );
    const double tau1 = tau - 1;
    result            = nT * nT * nT - 3 * MSQ_SQRT_THREE * tau + mGamma * tau1 * tau1;

    wrt_T = T;
    wrt_T *= 3 * nT;
    wrt_T -= ( 3 * MSQ_SQRT_THREE - 2 * mGamma * tau1 ) * transpose_adj( T );

    return true;
}
bool MBMesquite::TShapeSizeNB3::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.

Parameters:
T3x3 relative measure matrix (typically A W^-1)
resultOutput: value of function
deriv_wrt_TOutput: partial deriviatve of \(\mu\) wrt each term of T, evaluated at passed T.
second_wrt_TOutput: 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]\]

Returns:
false if function cannot be evaluated for given T (e.g. division by zero, etc.), true otherwise.

Reimplemented from MBMesquite::TMetric.

Definition at line 71 of file TShapeSizeNB3.cpp.

References MBMesquite::det(), mGamma, MBMesquite::pluseq_scaled_2nd_deriv_of_det(), MBMesquite::pluseq_scaled_I(), MBMesquite::set_scaled_outer_product(), MBMesquite::sqr_Frobenius(), T, and MBMesquite::transpose_adj().

{
    const double nT   = sqr_Frobenius( T );
    const double tau  = det( T );
    const double tau1 = tau - 1;
    result            = 2 * nT - 4 * tau + mGamma * tau1 * tau1;

    const double f               = 2 * mGamma * tau1 - 4;
    const MsqMatrix< 2, 2 > adjt = transpose_adj( T );
    deriv_wrt_T                  = T;
    deriv_wrt_T *= 4;
    deriv_wrt_T += f * adjt;

    set_scaled_outer_product( second, 2 * mGamma, adjt );
    pluseq_scaled_I( second, 4 );
    pluseq_scaled_2nd_deriv_of_det( second, f );

    return true;
}
bool MBMesquite::TShapeSizeNB3::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.

Parameters:
T3x3 relative measure matrix (typically A W^-1)
resultOutput: value of function
deriv_wrt_TOutput: partial deriviatve of \(\mu\) wrt each term of T, evaluated at passed T.
second_wrt_TOutput: 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]\]

Returns:
false if function cannot be evaluated for given T (e.g. division by zero, etc.), true otherwise.

Reimplemented from MBMesquite::TMetric.

Definition at line 116 of file TShapeSizeNB3.cpp.

References MBMesquite::det(), MBMesquite::Frobenius(), mGamma, MBMesquite::MSQ_SQRT_THREE, MBMesquite::pluseq_scaled_2nd_deriv_of_det(), MBMesquite::pluseq_scaled_I(), MBMesquite::pluseq_scaled_outer_product(), MBMesquite::set_scaled_outer_product(), T, and MBMesquite::transpose_adj().

{
    const double nT   = Frobenius( T );
    const double tau  = det( T );
    const double tau1 = tau - 1;
    result            = nT * nT * nT - 3 * MSQ_SQRT_THREE * tau + mGamma * tau1 * tau1;

    const double f               = ( 3 * MSQ_SQRT_THREE - 2 * mGamma * tau1 );
    const MsqMatrix< 3, 3 > adjt = transpose_adj( T );
    wrt_T                        = T;
    wrt_T *= 3 * nT;
    wrt_T -= f * adjt;

    set_scaled_outer_product( second, 2 * mGamma, adjt );
    pluseq_scaled_2nd_deriv_of_det( second, -f, T );
    pluseq_scaled_I( second, 3 * nT );
    // Could perturb T a bit if the norm is zero, but that would just
    // result in the coefficent of the outer product being practically
    // zero, so just skip the outer product in that case.
    // Anyway nT approaches zero as T does, so the limit of this term
    // as nT approaches zero is zero.
    if( nT > 1e-100 )  // NOTE: nT is always positive
        pluseq_scaled_outer_product( second, 3 / nT, T );

    return true;
}
std::string MBMesquite::TShapeSizeNB3::get_name ( ) const [virtual]

Reimplemented from MBMesquite::TMetricNonBarrier.

Definition at line 40 of file TShapeSizeNB3.cpp.

{
    return "TShapeSizeNB3";
}

Member Data Documentation

Definition at line 72 of file TShapeSizeNB3.hpp.

Referenced by evaluate(), evaluate_with_grad(), and evaluate_with_hess().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines