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

#include <TShapeSizeOrientB2.hpp>

+ Inheritance diagram for MBMesquite::TShapeSizeOrientB2:
+ Collaboration diagram for MBMesquite::TShapeSizeOrientB2:

Public Member Functions

virtual MESQUITE_EXPORT ~TShapeSizeOrientB2 ()
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)
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 > &wrt_T, MsqError &err)
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.

Detailed Description

|T^-t - I|^2

Section 3.3.2 of derivs.tex

Definition at line 45 of file TShapeSizeOrientB2.hpp.


Constructor & Destructor Documentation


Member Function Documentation

bool MBMesquite::TShapeSizeOrientB2::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 48 of file TShapeSizeOrientB2.cpp.

References MBMesquite::adj(), MBMesquite::MsqError::BARRIER_VIOLATED, MBMesquite::barrier_violated_msg, MBMesquite::det(), MBMesquite::TMetric::invalid_determinant(), MSQ_SETERR, MBMesquite::pluseq_scaled_I(), and MBMesquite::sqr_Frobenius().

{
    double d = det( T );
    if( TMetric::invalid_determinant( d ) )
    {
        MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED );
        return false;
    }
    MsqMatrix< 2, 2 > T_inv = 1 / d * adj( T );
    pluseq_scaled_I( T_inv, -1.0 );
    result = sqr_Frobenius( T_inv );
    return true;
}
bool MBMesquite::TShapeSizeOrientB2::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 62 of file TShapeSizeOrientB2.cpp.

References MBMesquite::adj(), MBMesquite::MsqError::BARRIER_VIOLATED, MBMesquite::barrier_violated_msg, MBMesquite::det(), MBMesquite::TMetric::invalid_determinant(), MSQ_SETERR, MBMesquite::pluseq_scaled_I(), and MBMesquite::sqr_Frobenius().

{
    double d = det( T );
    if( TMetric::invalid_determinant( d ) )
    {
        MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED );
        return false;
    }
    MsqMatrix< 3, 3 > T_inv = 1 / d * adj( T );
    pluseq_scaled_I( T_inv, -1.0 );
    result = sqr_Frobenius( T_inv );
    return true;
}
bool MBMesquite::TShapeSizeOrientB2::evaluate_with_grad ( const MsqMatrix< 2, 2 > &  T,
double &  result,
MsqMatrix< 2, 2 > &  deriv_wrt_T,
MsqError err 
) [virtual]

\( \frac{1}{\tau^2}|T|^2 - \frac{2}{\tau}tr(adj T) + 2 \)

Reimplemented from MBMesquite::TMetric.

Definition at line 77 of file TShapeSizeOrientB2.cpp.

References MBMesquite::MsqError::BARRIER_VIOLATED, MBMesquite::barrier_violated_msg, MBMesquite::det(), MBMesquite::TMetricBarrier::invalid_determinant(), MSQ_SETERR, MBMesquite::sqr_Frobenius(), T, MBMesquite::trace(), and MBMesquite::transpose_adj().

{
    const double tau = det( T );
    if( invalid_determinant( tau ) )
    {
        MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED );
        return false;
    }

    const MsqMatrix< 2, 2 > adjt = transpose_adj( T );
    const double it              = 1.0 / tau;
    result                       = it * ( it * sqr_Frobenius( T ) - 2.0 * trace( T ) ) + 2.0;
    deriv_wrt_T                  = T;
    deriv_wrt_T *= it * it;
    deriv_wrt_T( 0, 0 ) -= it;
    deriv_wrt_T( 1, 1 ) -= it;
    deriv_wrt_T += it * it * ( trace( T ) - it * sqr_Frobenius( T ) ) * adjt;
    deriv_wrt_T *= 2.0;
    return true;
}
bool MBMesquite::TShapeSizeOrientB2::evaluate_with_grad ( const MsqMatrix< 3, 3 > &  T,
double &  result,
MsqMatrix< 3, 3 > &  deriv_wrt_T,
MsqError err 
) [virtual]

\( \frac{1}{\tau^2}|adj T|^2 - \frac{2}{\tau}tr(adj T) + 3 \)

Reimplemented from MBMesquite::TMetric.

Definition at line 100 of file TShapeSizeOrientB2.cpp.

References MBMesquite::adj(), MBMesquite::MsqError::BARRIER_VIOLATED, MBMesquite::barrier_violated_msg, MBMesquite::det(), MBMesquite::TMetricBarrier::invalid_determinant(), MSQ_SETERR, MBMesquite::sqr_Frobenius(), T, MBMesquite::trace(), and MBMesquite::transpose().

{
    const double tau = det( T );
    if( invalid_determinant( tau ) )
    {
        MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED );
        return false;
    }

    const MsqMatrix< 3, 3 > adjt = adj( T );
    const double it              = 1.0 / tau;
    result                       = it * ( it * sqr_Frobenius( adjt ) - 2.0 * trace( adjt ) ) + 3.0;

    deriv_wrt_T = T;
    deriv_wrt_T *= sqr_Frobenius( T );
    deriv_wrt_T -= T * transpose( T ) * T;
    deriv_wrt_T *= it * it;

    deriv_wrt_T += it * it * ( trace( adjt ) - it * sqr_Frobenius( adjt ) ) * transpose( adjt );

    double f = trace( T ) * it;
    deriv_wrt_T( 0, 0 ) -= f;
    deriv_wrt_T( 1, 1 ) -= f;
    deriv_wrt_T( 2, 2 ) -= f;

    deriv_wrt_T += it * transpose( T );

    deriv_wrt_T *= 2.0;
    return true;
}
bool MBMesquite::TShapeSizeOrientB2::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 132 of file TShapeSizeOrientB2.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_sum_outer_product(), MBMesquite::pluseq_scaled_sum_outer_product_I(), MBMesquite::set_scaled_outer_product(), MBMesquite::sqr_Frobenius(), T, MBMesquite::trace(), and MBMesquite::transpose_adj().

{
    const double tau = det( T );
    if( invalid_determinant( tau ) )
    {
        MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED );
        return false;
    }

    const MsqMatrix< 2, 2 > adjt = transpose_adj( T );
    const double it              = 1.0 / tau;
    result                       = it * ( it * sqr_Frobenius( T ) - 2.0 * trace( T ) ) + 2.0;
    deriv_wrt_T                  = T;
    deriv_wrt_T *= it * it;
    deriv_wrt_T( 0, 0 ) -= it;
    deriv_wrt_T( 1, 1 ) -= it;
    deriv_wrt_T += it * it * ( trace( T ) - it * sqr_Frobenius( T ) ) * adjt;
    deriv_wrt_T *= 2.0;

    set_scaled_outer_product( second, it * it * it * ( 6 * it * sqr_Frobenius( T ) - 4 * trace( T ) ), adjt );
    pluseq_scaled_I( second, 2 * it * it );
    pluseq_scaled_2nd_deriv_of_det( second, 2 * it * it * ( trace( T ) - it * sqr_Frobenius( T ) ) );
    pluseq_scaled_sum_outer_product( second, -4 * it * it * it, T, adjt );
    pluseq_scaled_sum_outer_product_I( second, 2 * it * it, adjt );

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

References MBMesquite::adj(), 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_2nd_deriv_tr_adj(), MBMesquite::pluseq_scaled_outer_product(), MBMesquite::pluseq_scaled_sum_outer_product(), MBMesquite::set_scaled_2nd_deriv_norm_sqr_adj(), MBMesquite::sqr_Frobenius(), T, MBMesquite::trace(), and MBMesquite::transpose().

{
    const double tau = det( T );
    if( invalid_determinant( tau ) )
    {
        MSQ_SETERR( err )( barrier_violated_msg, MsqError::BARRIER_VIOLATED );
        return false;
    }

    const MsqMatrix< 3, 3 > adjt = adj( T );
    const double it              = 1.0 / tau;
    const double nadjt           = sqr_Frobenius( adjt );
    const double nT              = sqr_Frobenius( T );
    const double tadjT           = trace( adjt );
    result                       = it * ( it * nadjt - 2.0 * tadjT ) + 3.0;

    const MsqMatrix< 3, 3 > TTtT = T * transpose( T ) * T;
    deriv_wrt_T                  = T;
    deriv_wrt_T *= nT;
    deriv_wrt_T -= TTtT;
    deriv_wrt_T *= it * it;

    deriv_wrt_T += it * it * ( tadjT - it * nadjt ) * transpose( adjt );

    const double tT = trace( T );
    double f        = tT * it;
    deriv_wrt_T( 0, 0 ) -= f;
    deriv_wrt_T( 1, 1 ) -= f;
    deriv_wrt_T( 2, 2 ) -= f;

    deriv_wrt_T += it * transpose( T );

    deriv_wrt_T *= 2.0;

    set_scaled_2nd_deriv_norm_sqr_adj( second, it * it, T );

    const double yf = -it * it * it * it;
    const double sf = -2;
    const double zf = -it * it * sf;

    pluseq_scaled_2nd_deriv_of_det( second, yf * 2 * nadjt * tau + zf * tadjT, T );
    pluseq_scaled_outer_product( second, yf * -6 * nadjt - 2 * zf * tadjT * it, transpose( adjt ) );
    MsqMatrix< 3, 3 > dnadj_dT = 2 * ( nT * T - TTtT );
    pluseq_scaled_sum_outer_product( second, yf * 2 * tau, dnadj_dT, transpose( adjt ) );
    pluseq_scaled_2nd_deriv_tr_adj( second, sf * it );
    MsqMatrix< 3, 3 > dtradj_dT = -transpose( T );
    dtradj_dT( 0, 0 ) += tT;
    dtradj_dT( 1, 1 ) += tT;
    dtradj_dT( 2, 2 ) += tT;
    pluseq_scaled_sum_outer_product( second, zf, dtradj_dT, transpose( adjt ) );

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

Reimplemented from MBMesquite::TMetricBarrier.

Definition at line 41 of file TShapeSizeOrientB2.cpp.

{
    return "TShapeSizeOrientB2";
}

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