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

Public Member Functions

void test_coeff_corners ()
void test_coeff_edges ()
void test_coeff_faces ()
void test_coeff_center ()
void test_deriv_corners ()
void test_deriv_edges ()
void test_deriv_faces ()
void test_deriv_center ()
void test_mid_elem_node_coeff ()
void test_mid_elem_node_deriv ()
void test_mid_face_node_coeff ()
void test_mid_face_node_deriv ()
void test_ideal_jacobian ()

Private Member Functions

 CPPUNIT_TEST_SUITE (TetLagrangeShapeTest)
 CPPUNIT_TEST (test_coeff_corners)
 CPPUNIT_TEST (test_coeff_edges)
 CPPUNIT_TEST (test_coeff_faces)
 CPPUNIT_TEST (test_coeff_center)
 CPPUNIT_TEST (test_deriv_corners)
 CPPUNIT_TEST (test_deriv_edges)
 CPPUNIT_TEST (test_deriv_faces)
 CPPUNIT_TEST (test_deriv_center)
 CPPUNIT_TEST (test_mid_elem_node_coeff)
 CPPUNIT_TEST (test_mid_elem_node_deriv)
 CPPUNIT_TEST (test_mid_face_node_coeff)
 CPPUNIT_TEST (test_mid_face_node_deriv)
 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_face_coeff (int face, NodeSet nodeset)
void test_mid_coeff (NodeSet nodebits)
void test_corner_derivs (int corner, NodeSet nodeset)
void test_edge_derivs (int edge, NodeSet nodeset)
void test_face_derivs (int face, NodeSet nodeset)
void test_mid_derivs (NodeSet nodeset)
void test_invalid_nodebits_coeff (NodeSet nodeset)
void test_invalid_nodebits_deriv (NodeSet nodeset)

Private Attributes

TetLagrangeShape sf

Detailed Description

Definition at line 86 of file TetLagrangeShapeTest.cpp.


Member Function Documentation

Definition at line 659 of file TetLagrangeShapeTest.cpp.

References nodeset_from_bits().

{
    for( unsigned i = 0; i < 0x40; ++i )
    {
        test_mid_coeff( nodeset_from_bits( i ) );
    }
}

Definition at line 624 of file TetLagrangeShapeTest.cpp.

References nodeset_from_bits().

{
    for( unsigned i = 0; i < 0x40; ++i )
    {
        test_corner_coeff( 0, nodeset_from_bits( i ) );
        test_corner_coeff( 1, nodeset_from_bits( i ) );
        test_corner_coeff( 2, nodeset_from_bits( i ) );
        test_corner_coeff( 3, nodeset_from_bits( i ) );
    }
}

Definition at line 648 of file TetLagrangeShapeTest.cpp.

References nodeset_from_bits().

{
    for( unsigned i = 0; i < 0x40; ++i )
    {
        test_face_coeff( 0, nodeset_from_bits( i ) );
        test_face_coeff( 1, nodeset_from_bits( i ) );
        test_face_coeff( 2, nodeset_from_bits( i ) );
        test_face_coeff( 3, nodeset_from_bits( i ) );
    }
}
void TetLagrangeShapeTest::test_corner_coeff ( int  corner,
NodeSet  nodeset 
) [private]

Definition at line 493 of file TetLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, get_coeff(), n, and rst_corner.

{
    MsqPrintError err( std::cout );

    double expected[10];
    get_coeff( nodebits, rst_corner[corner], expected );

    double coeff[100];
    size_t n = 29, indices[100];
    sf.coefficients( Sample( 0, corner ), nodebits, coeff, indices, n, err );
    CPPUNIT_ASSERT( !err );

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

Definition at line 553 of file TetLagrangeShapeTest.cpp.

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

{
    MsqPrintError err( std::cout );

    MsqVector< 3 > expected[10];
    get_derivs( nodebits, rst_corner[corner], expected );

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

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

Definition at line 702 of file TetLagrangeShapeTest.cpp.

References nodeset_from_bits().

{
    for( unsigned i = 0; i < 0x40; ++i )
    {
        test_mid_derivs( nodeset_from_bits( i ) );
    }
}

Definition at line 667 of file TetLagrangeShapeTest.cpp.

References nodeset_from_bits().

{
    for( unsigned i = 0; i < 0x40; ++i )
    {
        test_corner_derivs( 0, nodeset_from_bits( i ) );
        test_corner_derivs( 1, nodeset_from_bits( i ) );
        test_corner_derivs( 2, nodeset_from_bits( i ) );
        test_corner_derivs( 3, nodeset_from_bits( i ) );
    }
}

Definition at line 691 of file TetLagrangeShapeTest.cpp.

References nodeset_from_bits().

{
    for( unsigned i = 0; i < 0x40; ++i )
    {
        test_face_derivs( 0, nodeset_from_bits( i ) );
        test_face_derivs( 1, nodeset_from_bits( i ) );
        test_face_derivs( 2, nodeset_from_bits( i ) );
        test_face_derivs( 3, nodeset_from_bits( i ) );
    }
}
void TetLagrangeShapeTest::test_edge_coeff ( int  edge,
NodeSet  nodeset 
) [private]

Definition at line 508 of file TetLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, get_coeff(), n, and rst_edge.

{
    MsqPrintError err( std::cout );

    double expected[10];
    get_coeff( nodebits, rst_edge[edge], expected );

    double coeff[100];
    size_t n = 29, indices[100];
    sf.coefficients( Sample( 1, edge ), nodebits, coeff, indices, n, err );
    CPPUNIT_ASSERT( !err );

    compare_coefficients( coeff, indices, expected, n, edge + 4, nodebits );
}
void TetLagrangeShapeTest::test_edge_derivs ( int  edge,
NodeSet  nodeset 
) [private]

Definition at line 568 of file TetLagrangeShapeTest.cpp.

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

{
    MsqPrintError err( std::cout );

    MsqVector< 3 > expected[10];
    get_derivs( nodebits, rst_edge[edge], expected );

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

    compare_derivatives( vertices, n, derivs, expected, edge + 4, nodebits );
}
void TetLagrangeShapeTest::test_face_coeff ( int  face,
NodeSet  nodeset 
) [private]

Definition at line 523 of file TetLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, get_coeff(), n, and rst_face.

{
    MsqPrintError err( std::cout );

    double expected[10];
    get_coeff( nodebits, rst_face[face], expected );

    double coeff[100];
    size_t n = 29, indices[100];
    sf.coefficients( Sample( 2, face ), nodebits, coeff, indices, n, err );
    CPPUNIT_ASSERT( !err );

    compare_coefficients( coeff, indices, expected, n, face + 10, nodebits );
}
void TetLagrangeShapeTest::test_face_derivs ( int  face,
NodeSet  nodeset 
) [private]

Definition at line 583 of file TetLagrangeShapeTest.cpp.

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

{
    MsqPrintError err( std::cout );

    MsqVector< 3 > expected[10];
    get_derivs( nodebits, rst_face[face], expected );

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

    compare_derivatives( vertices, n, derivs, expected, face + 10, nodebits );
}

Definition at line 824 of file TetLagrangeShapeTest.cpp.

References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, MBMesquite::cbrt(), CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, MBMesquite::det(), MBMesquite::JacobianCalculator::get_Jacobian_3D(), MBMesquite::inverse(), moab::R, MBMesquite::TETRAHEDRON, MBMesquite::transpose(), and MBMesquite::unit_edge_element().

{
    MsqError err;
    MsqMatrix< 3, 3 > J_act, J_exp;
    sf.ideal( Sample( 3, 0 ), J_act, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, det( J_act ), 1e-6 );

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

    JacobianCalculator jc;
    jc.get_Jacobian_3D( &sf, NodeSet(), Sample( 2, 0 ), verts, 4, J_exp, err );
    ASSERT_NO_ERROR( err );
    J_exp /= MBMesquite::cbrt( det( J_exp ) );

    // Matrices should be a rotation of each other.
    // First, calculate tentative rotation matrix
    MsqMatrix< 3, 3 > 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
}

Definition at line 710 of file TetLagrangeShapeTest.cpp.

References CPPUNIT_ASSERT, and n.

{
    MsqError err;
    double coeff[100];
    size_t n, indices[100];

    sf.coefficients( Sample( 0, 0 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 0, 1 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 0, 2 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 0, 3 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );

    sf.coefficients( Sample( 1, 0 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 1, 1 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 1, 2 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 1, 3 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 1, 4 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 1, 5 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );

    sf.coefficients( Sample( 2, 0 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 2, 1 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 2, 2 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
    sf.coefficients( Sample( 2, 3 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );

    sf.coefficients( Sample( 3, 0 ), bits, coeff, indices, n, err );
    CPPUNIT_ASSERT( err );
}

Definition at line 751 of file TetLagrangeShapeTest.cpp.

References CPPUNIT_ASSERT, and n.

{
    MsqError err;
    size_t verts[100], n;
    MsqVector< 3 > derivs[100];

    sf.derivatives( Sample( 0, 0 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 0, 1 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 0, 2 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 0, 3 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );

    sf.derivatives( Sample( 1, 0 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 1, 1 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 1, 2 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 1, 3 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 1, 4 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 1, 5 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );

    sf.derivatives( Sample( 2, 0 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 2, 1 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 2, 2 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
    sf.derivatives( Sample( 2, 3 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );

    sf.derivatives( Sample( 3, 0 ), bits, verts, derivs, n, err );
    CPPUNIT_ASSERT( err );
}
void TetLagrangeShapeTest::test_mid_coeff ( NodeSet  nodebits) [private]

Definition at line 538 of file TetLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, get_coeff(), n, and rst_mid.

{
    MsqPrintError err( std::cout );

    double expected[10];
    get_coeff( nodebits, rst_mid, expected );

    double coeff[100];
    size_t n = 29, indices[100];
    sf.coefficients( Sample( 3, 0 ), nodebits, coeff, indices, n, err );
    CPPUNIT_ASSERT( !err );

    compare_coefficients( coeff, indices, expected, n, 14, nodebits );
}
void TetLagrangeShapeTest::test_mid_derivs ( NodeSet  nodeset) [private]

Definition at line 598 of file TetLagrangeShapeTest.cpp.

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

{
    MsqPrintError err( std::cout );

    MsqVector< 3 > expected[10];
    get_derivs( nodebits, rst_mid, expected );

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

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

Definition at line 806 of file TetLagrangeShapeTest.cpp.

References MBMesquite::NodeSet::set_mid_face_node().

{
    NodeSet nodeset1, nodeset2;
    nodeset1.set_mid_face_node( 0 );
    test_invalid_nodebits_coeff( nodeset1 );
    nodeset2.set_mid_face_node( 2 );
    test_invalid_nodebits_coeff( nodeset2 );
}

Definition at line 815 of file TetLagrangeShapeTest.cpp.

References MBMesquite::NodeSet::set_mid_face_node().

{
    NodeSet nodeset1, nodeset2;
    nodeset1.set_mid_face_node( 0 );
    test_invalid_nodebits_deriv( nodeset1 );
    nodeset2.set_mid_face_node( 2 );
    test_invalid_nodebits_deriv( nodeset2 );
}

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