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

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 (QuadLagrangeShapeTest)
 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

QuadLagrangeShape sf

Detailed Description

Definition at line 82 of file QuadLagrangeShapeTest.cpp.


Member Function Documentation

Definition at line 613 of file QuadLagrangeShapeTest.cpp.

References nodeset_from_bits(), and u.

{
    // for every possible combination of higher-order nodes
    // (0x1F = 11111 : five possible higher-order nodes in quad)
    for( unsigned j = 0; j <= 0x1Fu; ++j )
        test_mid_coeff( nodeset_from_bits( j ) );
}

Definition at line 593 of file QuadLagrangeShapeTest.cpp.

References nodeset_from_bits(), and u.

{
    // for every possible combination of higher-order nodes
    // (0x1F = 11111 : five possible higher-order nodes in quad)
    for( unsigned j = 0; j <= 0x1Fu; ++j )
        // for every corner
        for( unsigned i = 0; i < 4; ++i )
            test_corner_coeff( i, nodeset_from_bits( j ) );
}

Definition at line 603 of file QuadLagrangeShapeTest.cpp.

References nodeset_from_bits(), and u.

{
    // for every possible combination of higher-order nodes
    // (0x1F = 11111 : five possible higher-order nodes in quad)
    for( unsigned j = 0; j <= 0x1Fu; ++j )
        // for every edge
        for( unsigned i = 0; i < 4; ++i )
            test_edge_coeff( i, nodeset_from_bits( j ) );
}
void QuadLagrangeShapeTest::test_corner_coeff ( int  corner,
NodeSet  nodeset 
) [private]

Definition at line 491 of file QuadLagrangeShapeTest.cpp.

References compare_coefficients(), corners, CPPUNIT_ASSERT, ETA, get_coeffs(), and XI.

{
    MsqPrintError err( std::cout );

    double expected[9];
    get_coeffs( nodebits, corners[corner][XI], corners[corner][ETA], expected );

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

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

Definition at line 536 of file QuadLagrangeShapeTest.cpp.

References compare_derivatives(), corners, CPPUNIT_ASSERT, ETA, get_partial_wrt_eta(), get_partial_wrt_xi(), and XI.

{
    MsqPrintError err( std::cout );

    double expected_dxi[9], expected_deta[9];
    get_partial_wrt_xi( nodebits, corners[corner][XI], corners[corner][ETA], expected_dxi );
    get_partial_wrt_eta( nodebits, corners[corner][XI], corners[corner][ETA], expected_deta );

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

    compare_derivatives( vertices, num_vtx, derivs, expected_dxi, expected_deta, corner, nodebits );
}

Definition at line 641 of file QuadLagrangeShapeTest.cpp.

References nodeset_from_bits(), and u.

{
    // for every possible combination of higher-order nodes
    // (0x1F = 11111 : five possible higher-order nodes in quad)
    for( unsigned j = 0; j <= 0x1Fu; ++j )
        test_mid_derivs( nodeset_from_bits( j ) );
}

Definition at line 621 of file QuadLagrangeShapeTest.cpp.

References nodeset_from_bits(), and u.

{
    // for every possible combination of higher-order nodes
    // (0x1F = 11111 : five possible higher-order nodes in quad)
    for( unsigned j = 0; j <= 0x1Fu; ++j )
        // for every corner
        for( unsigned i = 0; i < 4; ++i )
            test_corner_derivs( i, nodeset_from_bits( j ) );
}

Definition at line 631 of file QuadLagrangeShapeTest.cpp.

References nodeset_from_bits(), and u.

{
    // for every possible combination of higher-order nodes
    // (0x1F = 11111 : five possible higher-order nodes in quad)
    for( unsigned j = 0; j <= 0x1Fu; ++j )
        // for every edge
        for( unsigned i = 0; i < 4; ++i )
            test_edge_derivs( i, nodeset_from_bits( j ) );
}
void QuadLagrangeShapeTest::test_edge_coeff ( int  edge,
NodeSet  nodeset 
) [private]

Definition at line 506 of file QuadLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, ETA, get_coeffs(), midedge, and XI.

{
    MsqPrintError err( std::cout );

    double expected[9];
    get_coeffs( nodebits, midedge[edge][XI], midedge[edge][ETA], expected );

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

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

Definition at line 552 of file QuadLagrangeShapeTest.cpp.

References compare_derivatives(), CPPUNIT_ASSERT, ETA, get_partial_wrt_eta(), get_partial_wrt_xi(), midedge, and XI.

{
    MsqPrintError err( std::cout );

    double expected_dxi[9], expected_deta[9];
    get_partial_wrt_xi( nodebits, midedge[edge][XI], midedge[edge][ETA], expected_dxi );
    get_partial_wrt_eta( nodebits, midedge[edge][XI], midedge[edge][ETA], expected_deta );

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

    compare_derivatives( vertices, num_vtx, derivs, expected_dxi, expected_deta, edge + 4, nodebits );
}

Definition at line 649 of file QuadLagrangeShapeTest.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(), MBMesquite::QUADRILATERAL, moab::R, MBMesquite::transpose(), 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( QUADRILATERAL );
    CPPUNIT_ASSERT( verts );

    JacobianCalculator jc;
    jc.get_Jacobian_2D( &sf, NodeSet(), Sample( 2, 0 ), verts, 4, 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 QuadLagrangeShapeTest::test_mid_coeff ( NodeSet  nodeset) [private]

Definition at line 521 of file QuadLagrangeShapeTest.cpp.

References compare_coefficients(), CPPUNIT_ASSERT, ETA, get_coeffs(), midelem, and XI.

{
    MsqPrintError err( std::cout );

    double expected[9];
    get_coeffs( nodebits, midelem[XI], midelem[ETA], expected );

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

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

Definition at line 568 of file QuadLagrangeShapeTest.cpp.

References compare_derivatives(), CPPUNIT_ASSERT, ETA, get_partial_wrt_eta(), get_partial_wrt_xi(), midelem, and XI.

{
    MsqPrintError err( std::cout );

    double expected_dxi[9], expected_deta[9];
    get_partial_wrt_xi( nodebits, midelem[XI], midelem[ETA], expected_dxi );
    get_partial_wrt_eta( nodebits, midelem[XI], midelem[ETA], expected_deta );

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

    compare_derivatives( vertices, num_vtx, derivs, expected_dxi, expected_deta, 8, 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