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

Public Member Functions

void setUp ()
void tearDown ()
 XYRectangleTest ()
void test_snap_to ()
void test_normal_at ()
void test_closest_point ()
void test_domain_DoF ()

Private Member Functions

 CPPUNIT_TEST_SUITE (XYRectangleTest)
 CPPUNIT_TEST (test_snap_to)
 CPPUNIT_TEST (test_normal_at)
 CPPUNIT_TEST (test_closest_point)
 CPPUNIT_TEST (test_domain_DoF)
 CPPUNIT_TEST_SUITE_END ()

Private Attributes

vector< double > vertCoords
vector< double > invertCoords
vector< int > fixedFlags
vector< unsigned long > triConn
vector< unsigned long > invertConn
ArrayMesh myMesh
XYRectangle myDomain
std::vector< double > mCoords
std::vector< int > mFlags

Detailed Description

Definition at line 45 of file XYRectangleTest.cpp.


Constructor & Destructor Documentation

Definition at line 69 of file XYRectangleTest.cpp.


Member Function Documentation

Definition at line 140 of file XYRectangleTest.cpp.

{}

Definition at line 240 of file XYRectangleTest.cpp.

References MBMesquite::arrptr(), ASSERT_NO_ERROR, and CPPUNIT_ASSERT_VECTORS_EQUAL.

{
    MsqError err;
    std::vector< Mesh::ElementHandle > elems;
    myMesh.get_all_elements( elems, err );
    ASSERT_NO_ERROR( err );

    for( size_t i = 0; i < elems.size(); ++i )
    {
        std::vector< Mesh::VertexHandle > verts;
        std::vector< size_t > junk;
        MsqVertex coords;
        myMesh.elements_get_attached_vertices( &elems[i], 1, verts, junk, err );
        ASSERT_NO_ERROR( err );
        myMesh.vertices_get_coordinates( arrptr( verts ), &coords, 1, err );
        ASSERT_NO_ERROR( err );

        Vector3D offset( coords + Vector3D( 0, 0, 3 ) ), closest, norm;
        myDomain.closest_point( elems[i], offset, closest, norm, err );
        ASSERT_NO_ERROR( err );
        CPPUNIT_ASSERT_VECTORS_EQUAL( coords, closest, 1e-6 );
        CPPUNIT_ASSERT_VECTORS_EQUAL( Vector3D( 0, 0, 1 ), norm, 1e-6 );
    }
}

Definition at line 273 of file XYRectangleTest.cpp.

References MBMesquite::arrptr(), ASSERT_NO_ERROR, CPPUNIT_ASSERT_EQUAL, and dof().

{
    MsqError err;

    std::vector< Mesh::VertexHandle > verts;
    myMesh.get_all_vertices( verts, err );
    ASSERT_NO_ERROR( err );
    std::vector< MsqVertex > coords( verts.size() );
    myMesh.vertices_get_coordinates( arrptr( verts ), arrptr( coords ), verts.size(), err );
    ASSERT_NO_ERROR( err );

    for( size_t i = 0; i < coords.size(); ++i )
    {
        unsigned short exp = dof( coords[i] );
        unsigned short act = 100;
        myDomain.domain_DoF( &verts[i], &act, 1, err );
        ASSERT_NO_ERROR( err );
        CPPUNIT_ASSERT_EQUAL( exp, act );
    }
}

Definition at line 218 of file XYRectangleTest.cpp.

References MBMesquite::arrptr(), ASSERT_NO_ERROR, and CPPUNIT_ASSERT_VECTORS_EQUAL.

{
    MsqError err;
    std::vector< Mesh::VertexHandle > vertices;
    myMesh.get_all_vertices( vertices, err );
    ASSERT_NO_ERROR( err );

    std::vector< MsqVertex > coords( vertices.size() );
    myMesh.vertices_get_coordinates( arrptr( vertices ), arrptr( coords ), vertices.size(), err );
    ASSERT_NO_ERROR( err );

    std::vector< Vector3D > normals( vertices.size() );
    std::copy( coords.begin(), coords.end(), normals.begin() );
    myDomain.vertex_normal_at( arrptr( vertices ), arrptr( normals ), vertices.size(), err );
    ASSERT_NO_ERROR( err );

    for( size_t i = 0; i < normals.size(); ++i )
    {
        CPPUNIT_ASSERT_VECTORS_EQUAL( Vector3D( 0, 0, 1 ), normals[i], 1e-6 );
    }
}

Definition at line 164 of file XYRectangleTest.cpp.

References MBMesquite::arrptr(), ASSERT_NO_ERROR, CPPUNIT_ASSERT, CPPUNIT_ASSERT_VECTORS_EQUAL, and snap_to().

{
    MsqError err;
    Vector3D off, exp, act;

    const Vector3D d1( 0.1, 0.1, 0.0 );
    const Vector3D d2( 0.0, 0.2, 0.0 );
    const Vector3D d3( 0.3, 0.0, 0.0 );
    const Vector3D d4( 0.0, 0.0, 5.0 );
    const Vector3D d5( 0.5, 0.5, 0.5 );

    std::vector< Mesh::VertexHandle > verts;
    myMesh.get_all_vertices( verts, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( !verts.empty() );
    std::vector< MsqVertex > coords( verts.size() );
    myMesh.vertices_get_coordinates( arrptr( verts ), arrptr( coords ), verts.size(), err );
    ASSERT_NO_ERROR( err );

    for( size_t i = 0; i < coords.size(); ++i )
    {

        off = coords[i] + d1;
        exp = snap_to( coords[i], off );
        act = off;
        myDomain.snap_to( verts[i], act );
        CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 );

        off = coords[i] + d2;
        exp = snap_to( coords[i], off );
        act = off;
        myDomain.snap_to( verts[i], act );
        CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 );

        off = coords[i] + d3;
        exp = snap_to( coords[i], off );
        act = off;
        myDomain.snap_to( verts[i], act );
        CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 );

        off = coords[i] + d4;
        exp = snap_to( coords[i], off );
        act = off;
        myDomain.snap_to( verts[i], act );
        CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 );

        off = coords[i] + d5;
        exp = snap_to( coords[i], off );
        act = off;
        myDomain.snap_to( verts[i], act );
        CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 );
    }
}

Member Data Documentation

vector< int > XYRectangleTest::fixedFlags [private]

Definition at line 56 of file XYRectangleTest.cpp.

vector< unsigned long > XYRectangleTest::invertConn [private]

Definition at line 57 of file XYRectangleTest.cpp.

vector< double > XYRectangleTest::invertCoords [private]

Definition at line 55 of file XYRectangleTest.cpp.

std::vector< double > XYRectangleTest::mCoords [private]

Definition at line 61 of file XYRectangleTest.cpp.

std::vector< int > XYRectangleTest::mFlags [private]

Definition at line 62 of file XYRectangleTest.cpp.

Definition at line 60 of file XYRectangleTest.cpp.

Definition at line 59 of file XYRectangleTest.cpp.

vector< unsigned long > XYRectangleTest::triConn [private]

Definition at line 57 of file XYRectangleTest.cpp.

vector< double > XYRectangleTest::vertCoords [private]

Definition at line 55 of file XYRectangleTest.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