MOAB: Mesh Oriented datABase  (version 5.2.1)
TriLagrangeShapeTest Class Reference
+ Inheritance diagram for TriLagrangeShapeTest:
+ Collaboration diagram for TriLagrangeShapeTest:

Public Member Functions

void test_coeff_corners ()
void test_coeff_edges ()
void test_coeff_center ()
void test_deriv_corners ()
void test_deriv_edges ()
void test_deriv_center ()
void test_ideal_jacobian ()

Private Member Functions

 CPPUNIT_TEST_SUITE (TriLagrangeShapeTest)
 CPPUNIT_TEST (test_coeff_corners)
 CPPUNIT_TEST (test_coeff_edges)
 CPPUNIT_TEST (test_coeff_center)
 CPPUNIT_TEST (test_deriv_corners)
 CPPUNIT_TEST (test_deriv_edges)
 CPPUNIT_TEST (test_deriv_center)
 CPPUNIT_TEST (test_ideal_jacobian)
 CPPUNIT_TEST_SUITE_END ()
void test_corner_coeff (int corner, NodeSet nodeset)
void test_edge_coeff (int edge, NodeSet nodeset)
void test_mid_coeff (NodeSet nodeset)
void test_corner_derivs (int corner, NodeSet nodeset)
void test_edge_derivs (int edge, NodeSet nodeset)
void test_mid_derivs (NodeSet nodeset)

Private Attributes

TriLagrangeShape sf

Detailed Description

Definition at line 82 of file TriLagrangeShapeTest.cpp.


Member Function Documentation

void TriLagrangeShapeTest::test_corner_coeff ( int  corner,
NodeSet  nodeset 
) [private]

Definition at line 319 of file TriLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, get_coeff(), and rs_corner.

{
    MsqPrintError err( std::cout );

    double expected[6];
    get_coeff( nodebits, rs_corner[corner], expected );

    double coeff[27];
    size_t num_coeff = 17, indices[27];
    sf.coefficients( Sample( 0, corner ), nodebits, coeff, indices, num_coeff, err );
    CPPUNIT_ASSERT( !err );

    compare_coefficients( coeff, indices, expected, num_coeff, corner, nodebits );
}
void TriLagrangeShapeTest::test_corner_derivs ( int  corner,
NodeSet  nodeset 
) [private]

Definition at line 364 of file TriLagrangeShapeTest.cpp.

References compare_derivatives(), CPPUNIT_ASSERT, get_derivs(), n, and rs_corner.

{
    MsqPrintError err( std::cout );

    double expected[12];
    get_derivs( nodebits, rs_corner[corner], expected );

    size_t n = 19, vertices[100];
    MsqVector< 2 > derivs[100];
    sf.derivatives( Sample( 0, corner ), nodebits, vertices, derivs, n, err );
    CPPUNIT_ASSERT( !err );

    compare_derivatives( vertices, n, derivs, expected, corner, nodebits );
}
void TriLagrangeShapeTest::test_edge_coeff ( int  edge,
NodeSet  nodeset 
) [private]

Definition at line 334 of file TriLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, get_coeff(), and rs_edge.

{
    MsqPrintError err( std::cout );

    double expected[6];
    get_coeff( nodebits, rs_edge[edge], expected );

    double coeff[27];
    size_t num_coeff = 17, indices[27];
    sf.coefficients( Sample( 1, edge ), nodebits, coeff, indices, num_coeff, err );
    CPPUNIT_ASSERT( !err );

    compare_coefficients( coeff, indices, expected, num_coeff, edge + 3, nodebits );
}
void TriLagrangeShapeTest::test_edge_derivs ( int  edge,
NodeSet  nodeset 
) [private]

Definition at line 379 of file TriLagrangeShapeTest.cpp.

References compare_derivatives(), CPPUNIT_ASSERT, get_derivs(), n, and rs_edge.

{
    MsqPrintError err( std::cout );

    double expected[12];
    get_derivs( nodebits, rs_edge[edge], expected );

    size_t n = 19, vertices[100];
    MsqVector< 2 > derivs[100];
    sf.derivatives( Sample( 1, edge ), nodebits, vertices, derivs, n, err );
    CPPUNIT_ASSERT( !err );

    compare_derivatives( vertices, n, derivs, expected, edge + 3, nodebits );
}

Definition at line 645 of file TriLagrangeShapeTest.cpp.

References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, MBMesquite::MsqMatrix< R, C >::data(), MBMesquite::det(), MBMesquite::JacobianCalculator::get_Jacobian_2D(), MBMesquite::inverse(), moab::R, MBMesquite::transpose(), MBMesquite::TRIANGLE, and MBMesquite::unit_edge_element().

{
    MsqError err;
    MsqMatrix< 3, 2 > J_prime;
    sf.ideal( Sample( 2, 0 ), J_prime, err );
    ASSERT_NO_ERROR( err );

    // for this test that everything is in the xy-plane
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, J_prime( 2, 0 ), 1e-12 );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, J_prime( 2, 1 ), 1e-12 );
    MsqMatrix< 2, 2 > J_act( J_prime.data() );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, det( J_act ), 1e-6 );

    const Vector3D* verts = unit_edge_element( TRIANGLE );
    CPPUNIT_ASSERT( verts );

    JacobianCalculator jc;
    jc.get_Jacobian_2D( &sf, NodeSet(), Sample( 2, 0 ), verts, 3, J_prime, err );
    ASSERT_NO_ERROR( err );

    // for this test that everything is in the xy-plane
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, J_prime( 2, 0 ), 1e-12 );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, J_prime( 2, 1 ), 1e-12 );
    MsqMatrix< 2, 2 > J_exp( J_prime.data() );
    J_exp /= sqrt( det( J_exp ) );

    // Matrices should be a rotation of each other.
    // First, calculate tentative rotation matrix
    MsqMatrix< 2, 2 > R = inverse( J_exp ) * J_act;
    // next check that it is a rotation
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, det( R ), 1e-6 );          // no scaling
    ASSERT_MATRICES_EQUAL( transpose( R ), inverse( R ), 1e-6 );  // orthogonal
}
void TriLagrangeShapeTest::test_mid_coeff ( NodeSet  nodeset) [private]

Definition at line 349 of file TriLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, get_coeff(), and rs_mid.

{
    MsqPrintError err( std::cout );

    double expected[6];
    get_coeff( nodebits, rs_mid, expected );

    double coeff[27];
    size_t num_coeff = 17, indices[27];
    sf.coefficients( Sample( 2, 0 ), nodebits, coeff, indices, num_coeff, err );
    CPPUNIT_ASSERT( !err );

    compare_coefficients( coeff, indices, expected, num_coeff, 6, nodebits );
}
void TriLagrangeShapeTest::test_mid_derivs ( NodeSet  nodeset) [private]

Definition at line 394 of file TriLagrangeShapeTest.cpp.

References compare_derivatives(), CPPUNIT_ASSERT, get_derivs(), n, and rs_mid.

{
    MsqPrintError err( std::cout );

    double expected[12];
    get_derivs( nodebits, rs_mid, expected );

    size_t n = 19, vertices[100];
    MsqVector< 2 > derivs[100];
    sf.derivatives( Sample( 2, 0 ), nodebits, vertices, derivs, n, err );
    CPPUNIT_ASSERT( !err );

    compare_derivatives( vertices, n, derivs, expected, 6, nodebits );
}

Member Data Documentation

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