MOAB: Mesh Oriented datABase  (version 5.4.1)
NodeSetTest.cpp File Reference
#include "Mesquite.hpp"
#include "NodeSet.hpp"
#include "UnitUtil.hpp"
+ Include dependency graph for NodeSetTest.cpp:

Go to the source code of this file.

Classes

class  NodeSetTest

Functions

 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (NodeSetTest,"NodeSetTest")
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (NodeSetTest,"Unit")
static bool check_all (EntityTopology type, NodeSet set, unsigned dim, bool value)
static bool check_range_set (EntityTopology type, NodeSet set, unsigned dim, bool value=true)

Detailed Description

Author:
Jason Kraftcheck

Definition in file NodeSetTest.cpp.


Function Documentation

static bool check_all ( EntityTopology  type,
NodeSet  set,
unsigned  dim,
bool  value 
) [static]

Definition at line 312 of file NodeSetTest.cpp.

Referenced by NodeSetTest::test_clear_all().

{
    unsigned count = TopologyInfo::adjacent( type, dim );
    for( unsigned i = 0; i < count; ++i )
        if( set.node( Sample( dim, i ) ) != value ) return false;
    return true;
}
static bool check_range_set ( EntityTopology  type,
NodeSet  set,
unsigned  dim,
bool  value = true 
) [static]

Definition at line 320 of file NodeSetTest.cpp.

References dim, MBMesquite::NodeSet::NUM_CORNER_BITS, MBMesquite::NodeSet::NUM_EDGE_BITS, MBMesquite::NodeSet::NUM_FACE_BITS, MBMesquite::NodeSet::NUM_REGION_BITS, and value().

Referenced by NodeSetTest::test_set_all().

{
    const unsigned max_count[] = { NodeSet::NUM_CORNER_BITS, NodeSet::NUM_EDGE_BITS, NodeSet::NUM_FACE_BITS,
                                   NodeSet::NUM_REGION_BITS };

    // test that any bits corresponding to some other dimension are not set.
    for( unsigned d = 0; d <= 3; ++d )
    {
        if( d == dim ) continue;

        for( unsigned i = 0; i < max_count[d]; ++i )
            if( !set.node( Sample( d, i ) ) != value ) return false;
    }

    // test that any bits for this dimension beyond the number for this
    // type are not set
    for( unsigned i = TopologyInfo::adjacent( type, dim ); i < max_count[dim]; ++i )
        if( !set.node( Sample( dim, i ) ) != value ) return false;

    // test that any bits for the type and dimension are set
    for( unsigned i = 0; i < TopologyInfo::adjacent( type, dim ); ++i )
        if( set.node( Sample( dim, i ) ) == value ) return false;

    return true;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines