MOAB: Mesh Oriented datABase  (version 5.4.1)
LVQDTargetTest Class Reference
+ Inheritance diagram for LVQDTargetTest:
+ Collaboration diagram for LVQDTargetTest:

Classes

class  ConstantTarget
class  TargetError

Public Member Functions

void setUp ()
void test_LVQD_default_is_I_2D ()
void test_LVQD_default_is_I_3D ()
void test_LVQD_default_is_I_surface ()
void test_LVQD_product_2D ()
void test_LVQD_product_3D ()
void test_LVQD_product_surface ()

Private Member Functions

 CPPUNIT_TEST_SUITE (LVQDTargetTest)
 CPPUNIT_TEST (test_LVQD_default_is_I_2D)
 CPPUNIT_TEST (test_LVQD_default_is_I_surface)
 CPPUNIT_TEST (test_LVQD_default_is_I_3D)
 CPPUNIT_TEST (test_LVQD_product_2D)
 CPPUNIT_TEST (test_LVQD_product_surface)
 CPPUNIT_TEST (test_LVQD_product_3D)
 CPPUNIT_TEST_SUITE_END ()
MsqMatrix< 3, 2 > target (const double *L, const MsqMatrix< 3, 2 > *V, const MsqMatrix< 2, 2 > *Q, const MsqMatrix< 2, 2 > *D)
MsqMatrix< 2, 2 > target (const double *L, const MsqMatrix< 2, 2 > *Q, const MsqMatrix< 2, 2 > *D)
MsqMatrix< 3, 3 > target (const double *L, const MsqMatrix< 3, 3 > *V, const MsqMatrix< 3, 3 > *Q, const MsqMatrix< 3, 3 > *D)

Private Attributes

MsqMatrix< 3, 3 > V3D_Z45
MsqMatrix< 3, 3 > V3D_X90
MsqMatrix< 3, 3 > Q3D_45
MsqMatrix< 3, 3 > D3D_123
MsqMatrix< 3, 3 > I33
MsqMatrix< 3, 2 > V2D_Z45
MsqMatrix< 3, 2 > V2D_X90
MsqMatrix< 3, 2 > I32
MsqMatrix< 2, 2 > Q2D_45
MsqMatrix< 2, 2 > D2D_21
MsqMatrix< 2, 2 > I22
PatchData pd2D
PatchData pd3D

Detailed Description

Definition at line 43 of file LVQDTargetTest.cpp.


Member Function Documentation

Definition at line 197 of file LVQDTargetTest.cpp.

References ASSERT_NO_ERROR, MBMesquite::cbrt(), MBMesquite::create_one_tet_patch(), MBMesquite::create_one_tri_patch(), MBMesquite::det(), and MBMesquite::MSQ_SQRT_TWO.

{
    const double cos45              = MSQ_SQRT_TWO / 2.0;
    const double rotation_3D_Z45[9] = { cos45, -cos45, 0, cos45, cos45, 0, 0, 0, 1 };
    const double rotation_2D_Z45[6] = { cos45, -cos45, cos45, cos45, 0, 0 };

    const double rotation_3D_X90[9] = { 1, 0, 0, 0, 0, -1, 0, 1, 0 };
    const double rotation_2D_X90[6] = { 1, 0, 0, 0, 0, 1 };

    const double rc45          = sqrt( cos45 );
    const double skew_2D_45[4] = { 1 / rc45, rc45, 0, rc45 };
    const double skew_3D_45[9] = { 1, cos45, cos45, 0, cos45, 1 - cos45, 0, 0, sqrt( MSQ_SQRT_TWO - 1 ) };

    const double aspect_2D_2x[4]  = { MSQ_SQRT_TWO, 0, 0, MSQ_SQRT_TWO / 2 };
    const double r6               = MBMesquite::cbrt( 1.0 / 6.0 );
    const double aspect_3D_123[9] = { r6, 0, 0, 0, 2 * r6, 0, 0, 0, 3 * r6 };

    V3D_Z45 = MsqMatrix< 3, 3 >( rotation_3D_Z45 );
    V3D_X90 = MsqMatrix< 3, 3 >( rotation_3D_X90 );
    Q3D_45  = MsqMatrix< 3, 3 >( skew_3D_45 );
    Q3D_45 *= 1 / Mesquite::cbrt( det( Q3D_45 ) );
    D3D_123 = MsqMatrix< 3, 3 >( aspect_3D_123 );

    V2D_Z45 = MsqMatrix< 3, 2 >( rotation_2D_Z45 );
    V2D_X90 = MsqMatrix< 3, 2 >( rotation_2D_X90 );
    Q2D_45  = MsqMatrix< 2, 2 >( skew_2D_45 );
    D2D_21  = MsqMatrix< 2, 2 >( aspect_2D_2x );

    I33 = MsqMatrix< 3, 3 >( 1.0 );
    I32 = MsqMatrix< 3, 2 >( 1.0 );
    I22 = MsqMatrix< 2, 2 >( 1.0 );

    MsqError err;
    create_one_tet_patch( pd3D, err );
    ASSERT_NO_ERROR( err );
    create_one_tri_patch( pd2D, err );
    ASSERT_NO_ERROR( err );
};
MsqMatrix< 3, 2 > LVQDTargetTest::target ( const double *  L,
const MsqMatrix< 3, 2 > *  V,
const MsqMatrix< 2, 2 > *  Q,
const MsqMatrix< 2, 2 > *  D 
) [private]

Definition at line 236 of file LVQDTargetTest.cpp.

References ASSERT_NO_ERROR, CPPUNIT_ASSERT, MBMesquite::LVQDTargetCalculator::get_2D_target(), MBMesquite::LVQDTargetCalculator::get_surface_target(), MBMesquite::MsqMatrix< R, C >::row(), and MBMesquite::MsqMatrix< R, C >::set_row().

{
    ConstantTarget W_size( L ? *L : 1.0, true );
    ConstantTarget W_orient( V ? *V : I32 );
    ConstantTarget W_skew( Q ? *Q : I22 );
    ConstantTarget W_aspect( D ? *D : I22 );
    LVQDTargetCalculator LVQD( L ? &W_size : NULL, V ? &W_orient : NULL, Q ? &W_skew : NULL, D ? &W_aspect : NULL );
    MsqError err;
    MsqMatrix< 3, 2 > W;
    bool v;
    if( !V )
    {
        MsqMatrix< 2, 2 > W_2D;
        v = LVQD.get_2D_target( pd2D, 0, Sample( 0, 0 ), W_2D, err );
        W.set_row( 0, W_2D.row( 0 ) );
        W.set_row( 1, W_2D.row( 1 ) );
        W.set_row( 2, MsqMatrix< 1, 2 >( 0.0 ) );
    }
    else
    {
        v = LVQD.get_surface_target( pd2D, 0, Sample( 0, 0 ), W, err );
    }
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( v );
    return W;
}
MsqMatrix< 2, 2 > LVQDTargetTest::target ( const double *  L,
const MsqMatrix< 2, 2 > *  Q,
const MsqMatrix< 2, 2 > *  D 
) [private]

Definition at line 266 of file LVQDTargetTest.cpp.

References ASSERT_NO_ERROR, CPPUNIT_ASSERT, and MBMesquite::LVQDTargetCalculator::get_2D_target().

{
    ConstantTarget W_size( L ? *L : 1.0, false );
    ConstantTarget W_skew( Q ? *Q : I22 );
    ConstantTarget W_aspect( D ? *D : I22 );
    LVQDTargetCalculator LVQD( L ? &W_size : NULL, NULL, Q ? &W_skew : NULL, D ? &W_aspect : NULL );
    MsqError err;
    MsqMatrix< 2, 2 > W;
    bool v = LVQD.get_2D_target( pd2D, 0, Sample( 0, 0 ), W, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( v );
    return W;
}
MsqMatrix< 3, 3 > LVQDTargetTest::target ( const double *  L,
const MsqMatrix< 3, 3 > *  V,
const MsqMatrix< 3, 3 > *  Q,
const MsqMatrix< 3, 3 > *  D 
) [private]

Definition at line 280 of file LVQDTargetTest.cpp.

References ASSERT_NO_ERROR, CPPUNIT_ASSERT, and MBMesquite::LVQDTargetCalculator::get_3D_target().

{
    ConstantTarget W_size( L ? *L : 1.0, true );
    ConstantTarget W_orient( V ? *V : I33 );
    ConstantTarget W_skew( Q ? *Q : I33 );
    ConstantTarget W_aspect( D ? *D : I33 );
    LVQDTargetCalculator LVQD( L ? &W_size : NULL, V ? &W_orient : NULL, Q ? &W_skew : NULL, D ? &W_aspect : NULL );
    MsqError err;
    MsqMatrix< 3, 3 > W;
    bool v = LVQD.get_3D_target( pd3D, 0, Sample( 0, 0 ), W, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( v );
    return W;
}

Definition at line 298 of file LVQDTargetTest.cpp.

References ASSERT_MATRICES_EQUAL.

{
    double s = 3.2;
    ASSERT_MATRICES_EQUAL( I22, target( 0, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( ( MsqMatrix< 2, 2 >( s ) ), target( &s, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( Q2D_45, target( 0, &Q2D_45, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( D2D_21, target( 0, 0, &D2D_21 ), 1e-8 );
}

Definition at line 319 of file LVQDTargetTest.cpp.

References ASSERT_MATRICES_EQUAL.

{
    double s                  = 2.6;
    MsqMatrix< 3, 3 >* null_V = 0;
    ASSERT_MATRICES_EQUAL( I33, target( 0, null_V, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( ( MsqMatrix< 3, 3 >( s ) ), target( &s, null_V, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V3D_Z45, target( 0, &V3D_Z45, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( s * V3D_Z45, target( &s, &V3D_Z45, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V3D_Z45 * Q3D_45, target( 0, &V3D_Z45, &Q3D_45, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V3D_Z45 * D3D_123, target( 0, &V3D_Z45, 0, &D3D_123 ), 1e-8 );
}

Definition at line 307 of file LVQDTargetTest.cpp.

References ASSERT_MATRICES_EQUAL.

{
    double s                  = 3.2;
    MsqMatrix< 3, 2 >* null_V = 0;
    ASSERT_MATRICES_EQUAL( I32, target( 0, null_V, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( ( MsqMatrix< 3, 2 >( s ) ), target( &s, null_V, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V2D_Z45, target( 0, &V2D_Z45, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( s * V2D_Z45, target( &s, &V2D_Z45, 0, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V2D_Z45 * Q2D_45, target( 0, &V2D_Z45, &Q2D_45, 0 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V2D_Z45 * D2D_21, target( 0, &V2D_Z45, 0, &D2D_21 ), 1e-8 );
}

Definition at line 331 of file LVQDTargetTest.cpp.

References ASSERT_MATRICES_EQUAL.

{
    double s = 3.2;
    double o = 1.0;
    ASSERT_MATRICES_EQUAL( I22, target( &o, &I22, &I22 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( ( MsqMatrix< 2, 2 >( s ) ), target( &s, &I22, &I22 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( Q2D_45, target( &o, &Q2D_45, &I22 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( D2D_21, target( &o, &I22, &D2D_21 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( s * Q2D_45 * D2D_21, target( &s, &Q2D_45, &D2D_21 ), 1e-8 );
}

Definition at line 355 of file LVQDTargetTest.cpp.

References ASSERT_MATRICES_EQUAL.

{
    double s = 2.6;
    double o = 1.0;
    ASSERT_MATRICES_EQUAL( I33, target( &o, &I33, &I33, &I33 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( ( MsqMatrix< 3, 3 >( s ) ), target( &s, &I33, &I33, &I33 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V3D_Z45, target( &o, &V3D_Z45, &I33, &I33 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( s * V3D_Z45, target( &s, &V3D_Z45, &I33, &I33 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V3D_Z45 * Q3D_45, target( &o, &V3D_Z45, &Q3D_45, &I33 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V3D_Z45 * D3D_123, target( &o, &V3D_Z45, &I33, &D3D_123 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( s * V3D_Z45 * Q3D_45 * D3D_123, target( &s, &V3D_Z45, &Q3D_45, &D3D_123 ), 1e-8 );
}

Definition at line 342 of file LVQDTargetTest.cpp.

References ASSERT_MATRICES_EQUAL.

{
    double s = 3.2;
    double o = 1.0;
    ASSERT_MATRICES_EQUAL( I32, target( &o, &I32, &I22, &I22 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( ( MsqMatrix< 3, 2 >( s ) ), target( &s, &I32, &I22, &I22 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V2D_Z45, target( &o, &V2D_Z45, &I22, &I22 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( s * V2D_Z45, target( &s, &V2D_Z45, &I22, &I22 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V2D_Z45 * Q2D_45, target( &o, &V2D_Z45, &Q2D_45, &I22 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( V2D_Z45 * D2D_21, target( &o, &V2D_Z45, &I22, &D2D_21 ), 1e-8 );
    ASSERT_MATRICES_EQUAL( s * V2D_Z45 * Q2D_45 * D2D_21, target( &s, &V2D_Z45, &Q2D_45, &D2D_21 ), 1e-8 );
}

Member Data Documentation

MsqMatrix< 2, 2 > LVQDTargetTest::D2D_21 [private]

Definition at line 65 of file LVQDTargetTest.cpp.

Definition at line 63 of file LVQDTargetTest.cpp.

MsqMatrix< 2, 2 > LVQDTargetTest::I22 [private]

Definition at line 65 of file LVQDTargetTest.cpp.

MsqMatrix< 3, 2 > LVQDTargetTest::I32 [private]

Definition at line 64 of file LVQDTargetTest.cpp.

MsqMatrix< 3, 3 > LVQDTargetTest::I33 [private]

Definition at line 63 of file LVQDTargetTest.cpp.

Definition at line 67 of file LVQDTargetTest.cpp.

Definition at line 67 of file LVQDTargetTest.cpp.

MsqMatrix< 2, 2 > LVQDTargetTest::Q2D_45 [private]

Definition at line 65 of file LVQDTargetTest.cpp.

MsqMatrix< 3, 3 > LVQDTargetTest::Q3D_45 [private]

Definition at line 63 of file LVQDTargetTest.cpp.

Definition at line 64 of file LVQDTargetTest.cpp.

Definition at line 64 of file LVQDTargetTest.cpp.

Definition at line 63 of file LVQDTargetTest.cpp.

Definition at line 63 of file LVQDTargetTest.cpp.

List of all members.


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