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

#include <AWUntangleBeta.hpp>

+ Inheritance diagram for MBMesquite::AWUntangleBeta:
+ Collaboration diagram for MBMesquite::AWUntangleBeta:

Public Member Functions

MESQUITE_EXPORT AWUntangleBeta (double gamma=0.5)
virtual MESQUITE_EXPORT ~AWUntangleBeta ()
virtual MESQUITE_EXPORT std::string get_name () const
virtual MESQUITE_EXPORT bool evaluate (const MsqMatrix< 2, 2 > &A, const MsqMatrix< 2, 2 > &W, double &result, MsqError &err)
 Evaluate \(\mu(A,W)\).
virtual MESQUITE_EXPORT bool evaluate (const MsqMatrix< 3, 3 > &A, const MsqMatrix< 3, 3 > &W, double &result, MsqError &err)
 Evaluate \(\mu(A,W)\).
virtual MESQUITE_EXPORT bool evaluate_with_grad (const MsqMatrix< 2, 2 > &A, const MsqMatrix< 2, 2 > &W, double &result, MsqMatrix< 2, 2 > &deriv_wrt_A, MsqError &err)
 Gradient of \(\mu(A,W)\) with respect to components of A.
virtual MESQUITE_EXPORT bool evaluate_with_grad (const MsqMatrix< 3, 3 > &A, const MsqMatrix< 3, 3 > &W, double &result, MsqMatrix< 3, 3 > &deriv_wrt_A, MsqError &err)
 Gradient of \(\mu(A,W)\) with respect to components of A.

Private Member Functions

template<unsigned D>
bool eval (const MsqMatrix< D, D > &A, const MsqMatrix< D, D > &W, double &result)
template<unsigned D>
bool grad (const MsqMatrix< D, D > &A, const MsqMatrix< D, D > &W, double &result, MsqMatrix< D, D > &first)

Private Attributes

double mGamma

Detailed Description

\( \left\{ |\alpha - \gamma \, \omega| - ( \alpha - \gamma \, \omega ) \right\}^p \)

Definition at line 42 of file AWUntangleBeta.hpp.


Constructor & Destructor Documentation

Definition at line 49 of file AWUntangleBeta.hpp.

: mGamma( gamma ) {}

Definition at line 46 of file AWUntangleBeta.cpp.

{}

Member Function Documentation

template<unsigned DIM>
bool MBMesquite::AWUntangleBeta::eval ( const MsqMatrix< DIM, DIM > &  A,
const MsqMatrix< DIM, DIM > &  W,
double &  result 
) [inline, private]

Definition at line 51 of file AWUntangleBeta.cpp.

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

{
    const double alpha = det( A );
    const double omega = det( W );
    double tmp         = alpha - mGamma * omega;
    tmp                = fabs( tmp ) - tmp;
    result             = tmp;
    for( int i = 1; i < P; ++i )
        result *= tmp;

    return true;
}
virtual MESQUITE_EXPORT bool MBMesquite::AWUntangleBeta::evaluate ( const MsqMatrix< 2, 2 > &  A,
const MsqMatrix< 2, 2 > &  W,
double &  result,
MsqError err 
) [virtual]

Evaluate \(\mu(A,W)\).

Parameters:
A2x2 active matrix
W2x2 target matrix
resultOutput: value of function
Returns:
false if function cannot be evaluated for given A and W (e.g. division by zero, etc.), true otherwise.

Reimplemented from MBMesquite::AWMetric.

virtual MESQUITE_EXPORT bool MBMesquite::AWUntangleBeta::evaluate ( const MsqMatrix< 3, 3 > &  A,
const MsqMatrix< 3, 3 > &  W,
double &  result,
MsqError err 
) [virtual]

Evaluate \(\mu(A,W)\).

Parameters:
A3x3 active matrix
W3x3 target matrix
resultOutput: value of function
Returns:
false if function cannot be evaluated for given A and W (e.g. division by zero, etc.), true otherwise.

Reimplemented from MBMesquite::AWMetric.

virtual MESQUITE_EXPORT bool MBMesquite::AWUntangleBeta::evaluate_with_grad ( const MsqMatrix< 2, 2 > &  A,
const MsqMatrix< 2, 2 > &  W,
double &  result,
MsqMatrix< 2, 2 > &  deriv_wrt_A,
MsqError err 
) [virtual]

Gradient of \(\mu(A,W)\) with respect to components of A.

Parameters:
A2x2 active matrix
W2x2 target matrix
resultOutput: value of function
deriv_wrt_AOutput: partial deriviatve of \(\mu\) wrt each term of A, evaluated at passed A.

\[\left[\begin{array}{cc} \frac{\partial\mu}{\partial A_{0,0}} & \frac{\partial\mu}{\partial A_{0,1}} \\ \frac{\partial\mu}{\partial A_{1,0}} & \frac{\partial\mu}{\partial A_{1,1}} \\ \end{array}\right]\]

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

Reimplemented from MBMesquite::AWMetric.

virtual MESQUITE_EXPORT bool MBMesquite::AWUntangleBeta::evaluate_with_grad ( const MsqMatrix< 3, 3 > &  A,
const MsqMatrix< 3, 3 > &  W,
double &  result,
MsqMatrix< 3, 3 > &  deriv_wrt_A,
MsqError err 
) [virtual]

Gradient of \(\mu(A,W)\) with respect to components of A.

Parameters:
A3x3 active matrix
W3x3 target matrix
resultOutput: value of function
deriv_wrt_AOutput: partial deriviatve of \(\mu\) wrt each term of A, evaluated at passed A.

\[\left[\begin{array}{ccc} \frac{\partial\mu}{\partial A_{0,0}} & \frac{\partial\mu}{\partial A_{0,1}} & \frac{\partial\mu}{\partial A_{0,2}} \\ \frac{\partial\mu}{\partial A_{1,0}} & \frac{\partial\mu}{\partial A_{1,1}} & \frac{\partial\mu}{\partial A_{1,2}} \\ \frac{\partial\mu}{\partial A_{2,0}} & \frac{\partial\mu}{\partial A_{2,1}} & \frac{\partial\mu}{\partial A_{2,2}} \end{array}\right]\]

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

Reimplemented from MBMesquite::AWMetric.

std::string MBMesquite::AWUntangleBeta::get_name ( ) const [virtual]

Implements MBMesquite::AWMetric.

Definition at line 41 of file AWUntangleBeta.cpp.

{
    return "AWUntangleBeta";
}
template<unsigned DIM>
bool MBMesquite::AWUntangleBeta::grad ( const MsqMatrix< DIM, DIM > &  A,
const MsqMatrix< DIM, DIM > &  W,
double &  result,
MsqMatrix< DIM, DIM > &  first 
) [inline, private]

Definition at line 65 of file AWUntangleBeta.cpp.

References MBMesquite::det(), mGamma, MBMesquite::P, and MBMesquite::transpose_adj().

{
    const double alpha = det( A );
    const double omega = det( W );
    double tmp         = 2 * ( mGamma * omega - alpha );
    if( tmp < 0.0 )
    {
        result = 0.0;
        deriv  = MsqMatrix< DIM, DIM >( 0.0 );
        return true;
    }

    double prod = 1.0;
    for( int i = 1; i < P; ++i )
        prod *= tmp;
    result = prod * tmp;

    deriv = -2 * P * prod * transpose_adj( A );
    return true;
}

Member Data Documentation

Definition at line 45 of file AWUntangleBeta.hpp.

Referenced by eval(), and grad().

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