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

Public Member Functions

void test_unit_tri ()
void test_unit_quad ()
void test_unit_tet ()
void test_unit_pyr ()
void test_unit_wdg ()
void test_unit_hex ()
void test_unit_edge_tri ()
void test_unit_edge_quad ()
void test_unit_edge_tet ()
void test_unit_edge_pyr ()
void test_unit_edge_wdg ()
void test_unit_edge_hex ()
void test_side_height_pyr ()
void test_unit_height_pyr ()

Private Member Functions

 CPPUNIT_TEST_SUITE (IdealElementTest)
 CPPUNIT_TEST (test_unit_tri)
 CPPUNIT_TEST (test_unit_quad)
 CPPUNIT_TEST (test_unit_tet)
 CPPUNIT_TEST (test_unit_pyr)
 CPPUNIT_TEST (test_unit_wdg)
 CPPUNIT_TEST (test_unit_hex)
 CPPUNIT_TEST (test_side_height_pyr)
 CPPUNIT_TEST (test_unit_edge_tri)
 CPPUNIT_TEST (test_unit_edge_quad)
 CPPUNIT_TEST (test_unit_edge_tet)
 CPPUNIT_TEST (test_unit_edge_pyr)
 CPPUNIT_TEST (test_unit_edge_wdg)
 CPPUNIT_TEST (test_unit_edge_hex)
 CPPUNIT_TEST (test_unit_height_pyr)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 41 of file IdealElementTest.cpp.


Member Function Documentation

Definition at line 180 of file IdealElementTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, distance_from_origin(), equal_edge_lengths(), MBMesquite::length(), n, MBMesquite::Vector3D::normalize(), MBMesquite::PYRAMID, MBMesquite::QUADRILATERAL, and MBMesquite::unit_element().

{
    const Vector3D* coords = unit_element( PYRAMID, true );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distance_from_origin( 5, coords ), 1e-6 );
    CPPUNIT_ASSERT( equal_edge_lengths( QUADRILATERAL, coords ) );

    Vector3D p1 = 0.5 * ( coords[0] + coords[1] );
    Vector3D p2 = 0.5 * ( coords[1] + coords[2] );
    Vector3D p3 = 0.5 * ( coords[2] + coords[3] );
    Vector3D p4 = 0.5 * ( coords[3] + coords[0] );
    Vector3D v1 = p1 - p3;
    Vector3D v2 = p2 - p4;
    double area = ( v1 * v2 ).length();

    Vector3D n = ( v1 * v2 );
    n.normalize();
    Vector3D c    = 0.25 * ( coords[0] + coords[1] + coords[2] + coords[3] );
    double height = n % ( coords[4] - c );
    double vol    = area * height / 3.0;
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, vol, 1e-6 );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( height, ( coords[0] - coords[1] ).length(), 1e-6 );
}

Definition at line 245 of file IdealElementTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, distance_from_origin(), MBMesquite::length(), n, MBMesquite::Vector3D::normalize(), MBMesquite::PYRAMID, MBMesquite::QUADRILATERAL, MBMesquite::unit_edge_element(), and unit_edge_lengths().

{
    const Vector3D* coords = unit_edge_element( PYRAMID, true );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distance_from_origin( 5, coords ), 1e-6 );
    CPPUNIT_ASSERT( unit_edge_lengths( QUADRILATERAL, coords ) );

    Vector3D p1 = 0.5 * ( coords[0] + coords[1] );
    Vector3D p2 = 0.5 * ( coords[1] + coords[2] );
    Vector3D p3 = 0.5 * ( coords[2] + coords[3] );
    Vector3D p4 = 0.5 * ( coords[3] + coords[0] );
    Vector3D v1 = p1 - p3;
    Vector3D v2 = p2 - p4;

    Vector3D n = ( v1 * v2 );
    n.normalize();
    Vector3D c    = 0.25 * ( coords[0] + coords[1] + coords[2] + coords[3] );
    double height = n % ( coords[4] - c );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( height, ( coords[0] - coords[1] ).length(), 1e-6 );
}

Definition at line 161 of file IdealElementTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, distance_from_origin(), equal_edge_lengths(), MBMesquite::HEXAHEDRON, and MBMesquite::unit_element().

{
    const Vector3D* coords = unit_element( HEXAHEDRON );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distance_from_origin( 8, coords ), 1e-6 );
    CPPUNIT_ASSERT( equal_edge_lengths( HEXAHEDRON, coords ) );

    Vector3D p1 = 0.25 * ( coords[0] + coords[1] + coords[2] + coords[3] );
    Vector3D p2 = 0.25 * ( coords[4] + coords[5] + coords[6] + coords[7] );
    Vector3D p3 = 0.25 * ( coords[0] + coords[1] + coords[5] + coords[4] );
    Vector3D p4 = 0.25 * ( coords[7] + coords[6] + coords[6] + coords[7] );
    Vector3D p5 = 0.25 * ( coords[0] + coords[3] + coords[4] + coords[7] );
    Vector3D p6 = 0.25 * ( coords[1] + coords[2] + coords[6] + coords[5] );
    Vector3D v1 = p1 - p2;
    Vector3D v2 = p3 - p4;
    Vector3D v3 = p5 - p6;
    double vol  = v3 % ( v1 * v2 );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, vol, 1e-6 );
}

Definition at line 126 of file IdealElementTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, distance_from_origin(), equal_edge_lengths(), MBMesquite::length(), n, MBMesquite::Vector3D::normalize(), MBMesquite::PYRAMID, and MBMesquite::unit_element().

{
    const Vector3D* coords = unit_element( PYRAMID );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distance_from_origin( 5, coords ), 1e-6 );
    CPPUNIT_ASSERT( equal_edge_lengths( PYRAMID, coords ) );

    Vector3D p1 = 0.5 * ( coords[0] + coords[1] );
    Vector3D p2 = 0.5 * ( coords[1] + coords[2] );
    Vector3D p3 = 0.5 * ( coords[2] + coords[3] );
    Vector3D p4 = 0.5 * ( coords[3] + coords[0] );
    Vector3D v1 = p1 - p3;
    Vector3D v2 = p2 - p4;
    double area = ( v1 * v2 ).length();

    Vector3D n = ( v1 * v2 );
    n.normalize();
    Vector3D c    = 0.25 * ( coords[0] + coords[1] + coords[2] + coords[3] );
    double height = n % ( coords[4] - c );
    double vol    = area * height / 3.0;
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, vol, 1e-6 );
}

Definition at line 97 of file IdealElementTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, distance_from_origin(), equal_edge_lengths(), MBMesquite::length(), MBMesquite::QUADRILATERAL, and MBMesquite::unit_element().

{
    const Vector3D* coords = unit_element( QUADRILATERAL );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distance_from_origin( 4, coords ), 1e-6 );
    CPPUNIT_ASSERT( equal_edge_lengths( QUADRILATERAL, coords ) );

    Vector3D p1 = 0.5 * ( coords[0] + coords[1] );
    Vector3D p2 = 0.5 * ( coords[1] + coords[2] );
    Vector3D p3 = 0.5 * ( coords[2] + coords[3] );
    Vector3D p4 = 0.5 * ( coords[3] + coords[0] );
    Vector3D v1 = p1 - p3;
    Vector3D v2 = p2 - p4;
    double area = ( v1 * v2 ).length();
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, area, 1e-6 );
}

Definition at line 113 of file IdealElementTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, distance_from_origin(), equal_edge_lengths(), MBMesquite::TETRAHEDRON, and MBMesquite::unit_element().

{
    const Vector3D* coords = unit_element( TETRAHEDRON );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distance_from_origin( 4, coords ), 1e-6 );
    CPPUNIT_ASSERT( equal_edge_lengths( TETRAHEDRON, coords ) );

    Vector3D v1 = coords[1] - coords[0];
    Vector3D v2 = coords[2] - coords[0];
    Vector3D v3 = coords[3] - coords[0];
    double vol  = ( v3 % ( v1 * v2 ) ) / 6.0;
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, vol, 1e-6 );
}

Definition at line 85 of file IdealElementTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, distance_from_origin(), equal_edge_lengths(), MBMesquite::length(), MBMesquite::TRIANGLE, and MBMesquite::unit_element().

{
    const Vector3D* coords = unit_element( TRIANGLE );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distance_from_origin( 3, coords ), 1e-6 );
    CPPUNIT_ASSERT( equal_edge_lengths( TRIANGLE, coords ) );

    Vector3D v1 = coords[1] - coords[0];
    Vector3D v2 = coords[2] - coords[0];
    double area = 0.5 * ( v1 * v2 ).length();
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, area, 1e-6 );
}

Definition at line 148 of file IdealElementTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, distance_from_origin(), equal_edge_lengths(), MBMesquite::PRISM, and MBMesquite::unit_element().

{
    const Vector3D* coords = unit_element( PRISM );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distance_from_origin( 6, coords ), 1e-6 );
    CPPUNIT_ASSERT( equal_edge_lengths( PRISM, coords ) );

    Vector3D v1 = coords[1] - coords[0];
    Vector3D v2 = coords[2] - coords[0];
    Vector3D v3 = coords[3] - coords[0];
    double vol  = 0.5 * v3 % ( v1 * v2 );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, vol, 1e-6 );
}

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