MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite::TShape2DNB2 Class Reference

#include <TShape2DNB2.hpp>

+ Inheritance diagram for MBMesquite::TShape2DNB2:
+ Collaboration diagram for MBMesquite::TShape2DNB2:

Public Member Functions

virtual MESQUITE_EXPORT ~TShape2DNB2 ()
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.

Detailed Description

\( |T^t T - \tau I|^2 \)

Definition at line 42 of file TShape2DNB2.hpp.


Constructor & Destructor Documentation

Definition at line 45 of file TShape2DNB2.cpp.

{}

Member Function Documentation

bool MBMesquite::TShape2DNB2::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 TShape2DNB2.cpp.

References MBMesquite::det(), MBMesquite::sqr_Frobenius(), T, and MBMesquite::transpose().

{
    const double tau     = det( T );
    MsqMatrix< 2, 2 > TT = transpose( T ) * T;
    TT( 0, 0 ) -= tau;
    TT( 1, 1 ) -= tau;
    result = sqr_Frobenius( TT );
    return true;
}
bool MBMesquite::TShape2DNB2::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 57 of file TShape2DNB2.cpp.

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

{
    const MsqMatrix< 2, 2 > TtT = transpose( T ) * T;
    const double tau            = det( T );
    const double nTtT           = sqr_Frobenius( TtT );
    const double nT             = sqr_Frobenius( T );
    result                      = nTtT + 2 * tau * ( tau - nT );

    deriv_wrt_T = T * TtT;
    deriv_wrt_T -= tau * T;
    deriv_wrt_T += ( tau - 0.5 * nT ) * transpose_adj( T );
    deriv_wrt_T *= 4;

    return true;
}
bool MBMesquite::TShape2DNB2::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 76 of file TShape2DNB2.cpp.

References MBMesquite::det(), 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_outer_product(), MBMesquite::sqr_Frobenius(), T, MBMesquite::transpose(), and MBMesquite::transpose_adj().

{
    const MsqMatrix< 2, 2 > TtT = transpose( T ) * T;
    const double tau            = det( T );
    const double nTtT           = sqr_Frobenius( TtT );
    const double nT             = sqr_Frobenius( T );
    result                      = nTtT + 2 * tau * ( tau - nT );

    const MsqMatrix< 2, 2 > adjt = transpose_adj( T );
    deriv_wrt_T                  = T * TtT;
    deriv_wrt_T -= tau * T;
    deriv_wrt_T += ( tau - 0.5 * nT ) * adjt;
    deriv_wrt_T *= 4;

    set_scaled_outer_product( second_wrt_T, 1, T );
    second_wrt_T[1] = transpose( second_wrt_T[1] );
    second_wrt_T[0] += TtT;
    second_wrt_T[2] += TtT;
    const MsqMatrix< 2, 2 > TTt = T * transpose( T );
    second_wrt_T[0]( 0, 0 ) += TTt( 0, 0 );
    second_wrt_T[0]( 1, 1 ) += TTt( 0, 0 );
    second_wrt_T[1]( 0, 0 ) += TTt( 0, 1 );
    second_wrt_T[1]( 1, 1 ) += TTt( 0, 1 );
    second_wrt_T[2]( 0, 0 ) += TTt( 1, 1 );
    second_wrt_T[2]( 1, 1 ) += TTt( 1, 1 );

    pluseq_scaled_I( second_wrt_T, -tau );
    pluseq_scaled_2nd_deriv_of_det( second_wrt_T, -0.5 * nT );
    pluseq_scaled_sum_outer_product( second_wrt_T, -1, T, adjt );

    pluseq_scaled_2nd_deriv_of_det( second_wrt_T, tau );
    pluseq_scaled_outer_product( second_wrt_T, 1, adjt );

    second_wrt_T[1] *= 4;
    second_wrt_T[0] *= 4;
    second_wrt_T[2] *= 4;

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

Implements MBMesquite::TMetric.

Definition at line 40 of file TShape2DNB2.cpp.

{
    return "TShape2DNB2";
}

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