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

Public Member Functions

void test_init ()
void test_clear ()
void test_set_get_clear_simple ()
void test_set_get_clear_dim ()
void test_set_node ()
void test_clear_node ()
void test_num_nodes ()
void test_have_any ()
void test_set_all ()
void test_clear_all ()
void test_num_before ()

Private Member Functions

 CPPUNIT_TEST_SUITE (NodeSetTest)
 CPPUNIT_TEST (test_init)
 CPPUNIT_TEST (test_clear)
 CPPUNIT_TEST (test_set_get_clear_simple)
 CPPUNIT_TEST (test_set_get_clear_dim)
 CPPUNIT_TEST (test_set_node)
 CPPUNIT_TEST (test_clear_node)
 CPPUNIT_TEST (test_num_nodes)
 CPPUNIT_TEST (test_have_any)
 CPPUNIT_TEST (test_set_all)
 CPPUNIT_TEST (test_clear_all)
 CPPUNIT_TEST (test_num_before)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 39 of file NodeSetTest.cpp.


Member Function Documentation

Definition at line 79 of file NodeSetTest.cpp.

References CPPUNIT_ASSERT, and MBMesquite::NodeSet::set_corner_node().

{
    NodeSet set;
    set.set_corner_node( 1 );
    set.clear();
    CPPUNIT_ASSERT( !set.get_bits() );
    set.set_mid_edge_node( 2 );
    set.clear();
    CPPUNIT_ASSERT( !set.get_bits() );
    set.set_mid_region_node();
    set.clear();
    CPPUNIT_ASSERT( !set.get_bits() );
}

Definition at line 368 of file NodeSetTest.cpp.

References check_all(), CPPUNIT_ASSERT, MBMesquite::HEXAHEDRON, and MBMesquite::NodeSet::set_all_nodes().

{
    const EntityTopology type = HEXAHEDRON;
    NodeSet set;
    set.set_all_nodes( type );
    set.clear_all_corner_nodes();
    CPPUNIT_ASSERT( check_all( type, set, 0, false ) );
    CPPUNIT_ASSERT( check_all( type, set, 1, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 2, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 3, true ) );
    set.set_all_nodes( type );
    set.clear_all_mid_edge_nodes();
    CPPUNIT_ASSERT( check_all( type, set, 0, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 1, false ) );
    CPPUNIT_ASSERT( check_all( type, set, 2, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 3, true ) );
    set.set_all_nodes( type );
    set.clear_all_mid_face_nodes();
    CPPUNIT_ASSERT( check_all( type, set, 0, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 1, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 2, false ) );
    CPPUNIT_ASSERT( check_all( type, set, 3, true ) );
    set.set_all_nodes( type );
    set.clear_all_mid_region_nodes();
    CPPUNIT_ASSERT( check_all( type, set, 0, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 1, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 2, true ) );
    CPPUNIT_ASSERT( check_all( type, set, 3, false ) );
}

Definition at line 196 of file NodeSetTest.cpp.

References MBMesquite::NodeSet::CORNER_OFFSET, corners, CPPUNIT_ASSERT_EQUAL, MBMesquite::NodeSet::EDGE_OFFSET, MBMesquite::edges, MBMesquite::NodeSet::FACE_OFFSET, MBMesquite::faces, MBMesquite::HEXAHEDRON, MBMesquite::NodeSet::REGION_OFFSET, MBMesquite::NodeSet::set_all_nodes(), and u.

{
    const EntityTopology type = HEXAHEDRON;
    NodeSet set;
    NodeSet::BitSet expected;
    for( unsigned i = 0; i < TopologyInfo::corners( type ); ++i )
    {
        set.set_all_nodes( type );
        expected = set.get_bits() & ~( 1u << ( NodeSet::CORNER_OFFSET + i ) );
        set.clear_corner_node( i );
        CPPUNIT_ASSERT_EQUAL( expected, set.get_bits() );
    }
    for( unsigned i = 0; i < TopologyInfo::edges( type ); ++i )
    {
        set.set_all_nodes( type );
        expected = set.get_bits() & ~( 1u << ( NodeSet::EDGE_OFFSET + i ) );
        set.clear_mid_edge_node( i );
        CPPUNIT_ASSERT_EQUAL( expected, set.get_bits() );
    }
    for( unsigned i = 0; i < TopologyInfo::faces( type ); ++i )
    {
        set.set_all_nodes( type );
        expected = set.get_bits() & ~( 1u << ( NodeSet::FACE_OFFSET + i ) );
        set.clear_mid_face_node( i );
        CPPUNIT_ASSERT_EQUAL( expected, set.get_bits() );
    }

    set.set_all_nodes( type );
    expected = set.get_bits() & ~( 1u << ( NodeSet::REGION_OFFSET ) );
    set.clear_mid_region_node( 0 );
    CPPUNIT_ASSERT_EQUAL( expected, set.get_bits() );
}

Definition at line 261 of file NodeSetTest.cpp.

References MBMesquite::NodeSet::clear(), CPPUNIT_ASSERT, MBMesquite::NodeSet::NUM_CORNER_BITS, MBMesquite::NodeSet::NUM_EDGE_BITS, MBMesquite::NodeSet::NUM_FACE_BITS, and MBMesquite::NodeSet::NUM_REGION_BITS.

{
    NodeSet set;
    set.clear();

    CPPUNIT_ASSERT( !set.have_any_corner_node() );
    set.set_corner_node( 0 );
    CPPUNIT_ASSERT( set.have_any_corner_node() );
    set.clear_corner_node( 0 );
    CPPUNIT_ASSERT( !set.have_any_corner_node() );
    set.set_corner_node( NodeSet::NUM_CORNER_BITS - 1 );
    CPPUNIT_ASSERT( set.have_any_corner_node() );
    CPPUNIT_ASSERT( !set.have_any_mid_node() );

    CPPUNIT_ASSERT( !set.have_any_mid_edge_node() );
    set.set_mid_edge_node( 0 );
    CPPUNIT_ASSERT( set.have_any_mid_edge_node() );
    CPPUNIT_ASSERT( set.have_any_mid_node() );
    set.clear_mid_edge_node( 0 );
    CPPUNIT_ASSERT( !set.have_any_mid_edge_node() );
    CPPUNIT_ASSERT( !set.have_any_mid_node() );
    set.set_mid_edge_node( NodeSet::NUM_EDGE_BITS - 1 );
    CPPUNIT_ASSERT( set.have_any_mid_edge_node() );
    CPPUNIT_ASSERT( set.have_any_mid_node() );
    set.clear();

    CPPUNIT_ASSERT( !set.have_any_mid_face_node() );
    set.set_mid_face_node( 0 );
    CPPUNIT_ASSERT( set.have_any_mid_face_node() );
    CPPUNIT_ASSERT( set.have_any_mid_node() );
    set.clear_mid_face_node( 0 );
    CPPUNIT_ASSERT( !set.have_any_mid_face_node() );
    CPPUNIT_ASSERT( !set.have_any_mid_node() );
    set.set_mid_face_node( NodeSet::NUM_FACE_BITS - 1 );
    CPPUNIT_ASSERT( set.have_any_mid_face_node() );
    CPPUNIT_ASSERT( set.have_any_mid_node() );
    set.clear();

    CPPUNIT_ASSERT( !set.have_any_mid_region_node() );
    set.set_mid_region_node( 0 );
    CPPUNIT_ASSERT( set.have_any_mid_region_node() );
    CPPUNIT_ASSERT( set.have_any_mid_node() );
    set.clear_mid_region_node( 0 );
    CPPUNIT_ASSERT( !set.have_any_mid_region_node() );
    CPPUNIT_ASSERT( !set.have_any_mid_node() );
    set.set_mid_region_node( NodeSet::NUM_REGION_BITS - 1 );
    CPPUNIT_ASSERT( set.have_any_mid_region_node() );
    CPPUNIT_ASSERT( set.have_any_mid_node() );
    set.clear();
}

Definition at line 73 of file NodeSetTest.cpp.

References CPPUNIT_ASSERT.

{
    NodeSet set;
    CPPUNIT_ASSERT( !set.get_bits() );
}

Definition at line 398 of file NodeSetTest.cpp.

References MBMesquite::NodeSet::clear(), corners, CPPUNIT_ASSERT_EQUAL, MBMesquite::HEXAHEDRON, and u.

{
    const EntityTopology type = HEXAHEDRON;
    NodeSet set;
    set.clear();
    set.set_mid_face_node( 2 );
    CPPUNIT_ASSERT_EQUAL( 0u, set.num_before_mid_face( 2 ) );
    CPPUNIT_ASSERT_EQUAL( 1u, set.num_before_mid_face( 3 ) );
    set.set_corner_node( 0 );
    CPPUNIT_ASSERT_EQUAL( 1u, set.num_before_mid_face( 2 ) );
    CPPUNIT_ASSERT_EQUAL( 2u, set.num_before_mid_face( 3 ) );
    CPPUNIT_ASSERT_EQUAL( 0u, set.num_before_corner( 0 ) );
    CPPUNIT_ASSERT_EQUAL( 1u, set.num_before_corner( 1 ) );
    set.set_all_corner_nodes( type );
    CPPUNIT_ASSERT_EQUAL( TopologyInfo::corners( type ), set.num_before_mid_edge( 0 ) );
    CPPUNIT_ASSERT_EQUAL( TopologyInfo::corners( type ) - 1,
                          set.num_before_corner( TopologyInfo::corners( type ) - 1 ) );
    CPPUNIT_ASSERT_EQUAL( 0u, set.num_before_corner( 0 ) );
    CPPUNIT_ASSERT_EQUAL( 1u, set.num_before_corner( 1 ) );
    CPPUNIT_ASSERT_EQUAL( 2u, set.num_before_corner( 2 ) );
    CPPUNIT_ASSERT_EQUAL( 3u, set.num_before_corner( 3 ) );
    CPPUNIT_ASSERT_EQUAL( 4u, set.num_before_corner( 4 ) );

    const unsigned total_nodes = 27;
    set.set_all_nodes( type );
    CPPUNIT_ASSERT_EQUAL( total_nodes - 1, set.num_before_mid_region( 0 ) );
    set.clear_mid_edge_node( 0 );
    CPPUNIT_ASSERT_EQUAL( total_nodes - 2, set.num_before_mid_region( 0 ) );
    set.clear_mid_edge_node( 1 );
    CPPUNIT_ASSERT_EQUAL( total_nodes - 3, set.num_before_mid_region( 0 ) );
}

Definition at line 229 of file NodeSetTest.cpp.

References MBMesquite::NodeSet::clear(), CPPUNIT_ASSERT_EQUAL, MBMesquite::HEXAHEDRON, MBMesquite::PRISM, MBMesquite::PYRAMID, MBMesquite::QUADRILATERAL, MBMesquite::TETRAHEDRON, MBMesquite::TRIANGLE, and u.

{
    NodeSet set;
    set.clear();
    set.set_corner_node( 1 );
    CPPUNIT_ASSERT_EQUAL( 1u, set.num_nodes() );
    set.set_corner_node( 3 );
    CPPUNIT_ASSERT_EQUAL( 2u, set.num_nodes() );
    set.set_mid_region_node( 0 );
    CPPUNIT_ASSERT_EQUAL( 3u, set.num_nodes() );
    set.set_mid_edge_node( 1 );
    set.set_mid_edge_node( 2 );
    CPPUNIT_ASSERT_EQUAL( 5u, set.num_nodes() );
    set.set_all_nodes( HEXAHEDRON );
    CPPUNIT_ASSERT_EQUAL( 27u, set.num_nodes() );
    set.clear();
    set.set_all_nodes( TETRAHEDRON );
    CPPUNIT_ASSERT_EQUAL( 15u, set.num_nodes() );
    set.clear();
    set.set_all_nodes( TRIANGLE );
    CPPUNIT_ASSERT_EQUAL( 7u, set.num_nodes() );
    set.clear();
    set.set_all_nodes( QUADRILATERAL );
    CPPUNIT_ASSERT_EQUAL( 9u, set.num_nodes() );
    set.clear();
    set.set_all_nodes( PYRAMID );
    CPPUNIT_ASSERT_EQUAL( 19u, set.num_nodes() );
    set.clear();
    set.set_all_nodes( PRISM );
    CPPUNIT_ASSERT_EQUAL( 21u, set.num_nodes() );
}

Definition at line 346 of file NodeSetTest.cpp.

References check_range_set(), MBMesquite::HEXAHEDRON, MBMesquite::PRISM, MBMesquite::PYRAMID, MBMesquite::QUADRILATERAL, MBMesquite::NodeSet::set_all_corner_nodes(), MBMesquite::TETRAHEDRON, and MBMesquite::TRIANGLE.

{
    const EntityTopology types[] = { TRIANGLE, QUADRILATERAL, TETRAHEDRON, HEXAHEDRON, PRISM, PYRAMID };
    const int num_types          = sizeof( types ) / sizeof( types[0] );

    for( int i = 0; i < num_types; ++i )
    {
        NodeSet set;
        set.set_all_corner_nodes( types[i] );
        check_range_set( types[i], set, 0 );
        set.clear();
        set.set_all_mid_edge_nodes( types[i] );
        check_range_set( types[i], set, 1 );
        set.clear();
        set.set_all_mid_face_nodes( types[i] );
        check_range_set( types[i], set, 2 );
        set.clear();
        set.set_all_mid_region_nodes( types[i] );
        check_range_set( types[i], set, 3 );
    }
}

Definition at line 130 of file NodeSetTest.cpp.

References CPPUNIT_ASSERT, MBMesquite::NodeSet::NUM_CORNER_BITS, MBMesquite::NodeSet::NUM_EDGE_BITS, MBMesquite::NodeSet::NUM_FACE_BITS, and MBMesquite::NodeSet::NUM_REGION_BITS.

{
    NodeSet set;
    for( unsigned i = 0; i < NodeSet::NUM_CORNER_BITS; ++i )
    {
        CPPUNIT_ASSERT( !set.node( Sample( 0, i ) ) );
        set.set_node( Sample( 0, i ) );
        CPPUNIT_ASSERT( set.node( Sample( 0, i ) ) );
        set.clear_node( Sample( 0, i ) );
        CPPUNIT_ASSERT( !set.node( Sample( 0, i ) ) );
    }
    for( unsigned i = 0; i < NodeSet::NUM_EDGE_BITS; ++i )
    {
        CPPUNIT_ASSERT( !set.node( Sample( 1, i ) ) );
        set.set_node( Sample( 1, i ) );
        CPPUNIT_ASSERT( set.node( Sample( 1, i ) ) );
        set.clear_node( Sample( 1, i ) );
        CPPUNIT_ASSERT( !set.node( Sample( 1, i ) ) );
    }
    for( unsigned i = 0; i < NodeSet::NUM_FACE_BITS; ++i )
    {
        CPPUNIT_ASSERT( !set.node( Sample( 2, i ) ) );
        set.set_node( Sample( 2, i ) );
        CPPUNIT_ASSERT( set.node( Sample( 2, i ) ) );
        set.clear_node( Sample( 2, i ) );
        CPPUNIT_ASSERT( !set.node( Sample( 2, i ) ) );
    }
    for( unsigned i = 0; i < NodeSet::NUM_REGION_BITS; ++i )
    {
        CPPUNIT_ASSERT( !set.node( Sample( 3, i ) ) );
        set.set_node( Sample( 3, i ) );
        CPPUNIT_ASSERT( set.node( Sample( 3, i ) ) );
        set.clear_node( Sample( 3, i ) );
        CPPUNIT_ASSERT( !set.node( Sample( 3, i ) ) );
    }
}

Definition at line 93 of file NodeSetTest.cpp.

References CPPUNIT_ASSERT, MBMesquite::NodeSet::NUM_CORNER_BITS, MBMesquite::NodeSet::NUM_EDGE_BITS, MBMesquite::NodeSet::NUM_FACE_BITS, and MBMesquite::NodeSet::NUM_REGION_BITS.

{
    NodeSet set;
    for( unsigned i = 0; i < NodeSet::NUM_CORNER_BITS; ++i )
    {
        CPPUNIT_ASSERT( !set.corner_node( i ) );
        set.set_corner_node( i );
        CPPUNIT_ASSERT( set.corner_node( i ) );
        set.clear_corner_node( i );
        CPPUNIT_ASSERT( !set.corner_node( i ) );
    }
    for( unsigned i = 0; i < NodeSet::NUM_EDGE_BITS; ++i )
    {
        CPPUNIT_ASSERT( !set.mid_edge_node( i ) );
        set.set_mid_edge_node( i );
        CPPUNIT_ASSERT( set.mid_edge_node( i ) );
        set.clear_mid_edge_node( i );
        CPPUNIT_ASSERT( !set.mid_edge_node( i ) );
    }
    for( unsigned i = 0; i < NodeSet::NUM_FACE_BITS; ++i )
    {
        CPPUNIT_ASSERT( !set.mid_face_node( i ) );
        set.set_mid_face_node( i );
        CPPUNIT_ASSERT( set.mid_face_node( i ) );
        set.clear_mid_face_node( i );
        CPPUNIT_ASSERT( !set.mid_face_node( i ) );
    }
    for( unsigned i = 0; i < NodeSet::NUM_REGION_BITS; ++i )
    {
        CPPUNIT_ASSERT( !set.mid_region_node( i ) );
        set.set_mid_region_node( i );
        CPPUNIT_ASSERT( set.mid_region_node( i ) );
        set.clear_mid_region_node( i );
        CPPUNIT_ASSERT( !set.mid_region_node( i ) );
    }
}

Definition at line 167 of file NodeSetTest.cpp.

References MBMesquite::NodeSet::CORNER_OFFSET, CPPUNIT_ASSERT_EQUAL, MBMesquite::NodeSet::EDGE_OFFSET, MBMesquite::NodeSet::FACE_OFFSET, MBMesquite::NodeSet::NUM_CORNER_BITS, MBMesquite::NodeSet::NUM_EDGE_BITS, MBMesquite::NodeSet::NUM_FACE_BITS, MBMesquite::NodeSet::NUM_REGION_BITS, MBMesquite::NodeSet::REGION_OFFSET, MBMesquite::NodeSet::set_corner_node(), and u.

{
    NodeSet set;
    for( unsigned i = 0; i < NodeSet::NUM_CORNER_BITS; ++i )
    {
        set.set_corner_node( i );
        CPPUNIT_ASSERT_EQUAL( 1u << ( NodeSet::CORNER_OFFSET + i ), set.get_bits() );
        set.clear();
    }
    for( unsigned i = 0; i < NodeSet::NUM_EDGE_BITS; ++i )
    {
        set.set_mid_edge_node( i );
        CPPUNIT_ASSERT_EQUAL( 1u << ( NodeSet::EDGE_OFFSET + i ), set.get_bits() );
        set.clear();
    }
    for( unsigned i = 0; i < NodeSet::NUM_FACE_BITS; ++i )
    {
        set.set_mid_face_node( i );
        CPPUNIT_ASSERT_EQUAL( 1u << ( NodeSet::FACE_OFFSET + i ), set.get_bits() );
        set.clear();
    }
    for( unsigned i = 0; i < NodeSet::NUM_REGION_BITS; ++i )
    {
        set.set_mid_region_node( i );
        CPPUNIT_ASSERT_EQUAL( 1u << ( NodeSet::REGION_OFFSET + i ), set.get_bits() );
        set.clear();
    }
}

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