MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite::NodeSet Class Reference

#include <NodeSet.hpp>

Public Types

typedef unsigned BitSet

Public Member Functions

 NodeSet ()
void clear ()
 Clear all values.
void set_all_nodes (EntityTopology type)
 Set all marks/flags.
unsigned num_nodes () const
 Number of marked/flagged nodes.
BitSet have_any_mid_node () const
 Check if any mid-nodes (higher-order nodes) are flaged.
BitSet have_any_corner_node () const
 Check if any corner nodes are present.
BitSet have_any_mid_edge_node () const
 Check if any mid-edge nodes are present.
BitSet have_any_mid_face_node () const
 Check if any mid-face nodes are present.
BitSet have_any_mid_region_node () const
 Check if any mid-region nodes are present.
void set_corner_node (unsigned num)
 Mark/flag corner node.
void set_mid_edge_node (unsigned num)
 Mark/flag mid-edge node.
void set_mid_face_node (unsigned num)
 Mark/flag mid-face node.
void set_mid_region_node (unsigned num=0)
 Mark/flag mid-region node.
void set_node (Sample sample)
 Mark/flag node.
void clear_corner_node (unsigned num)
 un-mark (clear flag for) corner node
void clear_mid_edge_node (unsigned num)
 un-mark (clear flag for) mid-edge node
void clear_mid_face_node (unsigned num)
 un-mark (clear flag for) mid-face node
void clear_mid_region_node (unsigned num=0)
 un-mark (clear flag for) mid-region node
void clear_node (Sample sample)
 un-mark (clear flag for) node
bool corner_node (unsigned num) const
 Get mark/flag for corner node.
bool mid_edge_node (unsigned num) const
 Get mark/flag for mid-edge node.
bool both_edge_nodes (unsigned num1, unsigned num2) const
 Test if two mid-edge nodes are both present.
bool mid_face_node (unsigned num) const
 Get mark/flag for mid-face node.
bool mid_region_node (unsigned num=0) const
 Get mark/flag for mid-region node.
bool node (Sample sample) const
 Get mark/flag for node.
void set_all_corner_nodes (EntityTopology type)
 Set all corner nodes.
void set_all_mid_edge_nodes (EntityTopology type)
 Set all mid-edge nodes.
void set_all_mid_face_nodes (EntityTopology type)
 Set all mid-face nodes.
void set_all_mid_region_nodes (EntityTopology type)
 Set all mid-region nodes.
void clear_all_mid_nodes ()
 Clear all mid-nodes.
void clear_all_corner_nodes ()
 Clear all corner nodes.
void clear_all_mid_edge_nodes ()
 Clear all mid-edge nodes.
void clear_all_mid_face_nodes ()
 Clear all mid-face nodes.
void clear_all_mid_region_nodes ()
 Clear all mid-region nodes.
unsigned num_before_corner (unsigned num) const
 Get number of marked/flagged nodes preceeding a specified corner node in the list.
unsigned num_before_mid_edge (unsigned num) const
 Get number of marked/flagged nodes preceeding a specified mid-edge node in the list.
unsigned num_before_mid_face (unsigned num) const
 Get number of marked/flagged nodes preceeding a specified mid-face node in the list.
unsigned num_before_mid_region (unsigned num) const
 Get number of marked/flagged nodes preceeding a specified mid-region node in the list.
unsigned num_before (Sample sample) const
 Get number of marked/flagged nodes preceeding a specified node in the list.
unsigned get_bits () const

Static Public Member Functions

static unsigned corner_node_position (unsigned num)
 Position of a corner node in the list.
static unsigned mid_edge_node_position (unsigned num)
 Position of a mid-edge node in the list.
static unsigned mid_face_node_position (unsigned num)
 Position of a mid-face node in the list.
static unsigned mid_region_node_position (unsigned num=0)
 Position of a mid-region node in the list.
static unsigned position (Sample sample)
 Position of a node in the list.

Static Public Attributes

static const BitSet NUM_TOTAL_BITS = 8 * sizeof( BitSet )
static const BitSet MSB_POS = NUM_TOTAL_BITS - 1
static const BitSet NUM_CORNER_BITS = 8
 Maximum number of corner nodes.
static const BitSet NUM_EDGE_BITS = 16
 Maximum number of mid-edge nodes.
static const BitSet NUM_REGION_BITS = 1
 Maximum number of mid-volume nodes.
static const BitSet NUM_FACE_BITS = NUM_TOTAL_BITS - ( NUM_CORNER_BITS + NUM_EDGE_BITS + NUM_REGION_BITS )
 Maximum number of mid-face nodes.
static const BitSet CORNER_OFFSET = 0
 LSB of corner node storage.
static const BitSet EDGE_OFFSET = CORNER_OFFSET + NUM_CORNER_BITS
 LSB of mid-edgee storage.
static const BitSet FACE_OFFSET = EDGE_OFFSET + NUM_EDGE_BITS
 LSB of mid-face storage.
static const BitSet REGION_OFFSET = FACE_OFFSET + NUM_FACE_BITS
 LSB of mid-region storage.
static const BitSet MID_NODE_MASK = ( ~0u ) << NUM_CORNER_BITS
 Bit mask for all non-corner bits.
static const BitSet CORNER_MASK = ~MID_NODE_MASK
 Bit mask for all corner bits.
static const BitSet REGION_MASK = ~( ( ~0u ) >> NUM_REGION_BITS )
 Mid-region mask.
static const BitSet EDGE_MASK
 Bit mask for all mid-edge nodes.
static const BitSet FACE_MASK = ~( CORNER_MASK | EDGE_MASK | REGION_MASK )
 Bit mask for all mid-face nodes.

Private Member Functions

bool bit_to_bool (unsigned num) const
 Return a bool value indicating the state of the specified bit.
void set_bit (unsigned num)
 Set the specified bit to 1.
void set_bits (unsigned start_bit, unsigned count)
void clear_bit (unsigned num)
 Clear the specified bit (set it to zero)
unsigned num_before_bit (unsigned p_position) const

Private Attributes

BitSet bits
 The data, one bit for each possible node location.

Detailed Description

Utility class for storing one boolean mark/flag for each node in an element

Definition at line 51 of file NodeSet.hpp.


Member Typedef Documentation

typedef unsigned MBMesquite::NodeSet::BitSet

Definition at line 54 of file NodeSet.hpp.


Constructor & Destructor Documentation

Definition at line 128 of file NodeSet.hpp.

: bits( 0u ) {}

Member Function Documentation

bool MBMesquite::NodeSet::bit_to_bool ( unsigned  num) const [inline, private]

Return a bool value indicating the state of the specified bit.

Definition at line 97 of file NodeSet.hpp.

References u.

    {
        return static_cast< bool >( ( bits >> num ) & 1u );
    }
bool MBMesquite::NodeSet::both_edge_nodes ( unsigned  num1,
unsigned  num2 
) const [inline]

Test if two mid-edge nodes are both present.

Definition at line 308 of file NodeSet.hpp.

References b.

Referenced by MBMesquite::derivatives_at_mid_elem().

    {
        BitSet b = ( 1 << mid_edge_node_position( num1 ) ) | ( 1 << mid_edge_node_position( num2 ) );
        return ( bits & b ) == b;
    }

Clear all corner nodes.

Definition at line 361 of file NodeSet.hpp.

    {
        bits &= ~CORNER_MASK;
    }

Clear all mid-edge nodes.

Definition at line 366 of file NodeSet.hpp.

    {
        bits &= ~EDGE_MASK;
    }

Clear all mid-face nodes.

Definition at line 371 of file NodeSet.hpp.

    {
        bits &= ~FACE_MASK;
    }

Clear all mid-nodes.

Definition at line 356 of file NodeSet.hpp.

    {
        bits &= ~MID_NODE_MASK;
    }

Clear all mid-region nodes.

Definition at line 376 of file NodeSet.hpp.

    {
        bits &= ~REGION_MASK;
    }
void MBMesquite::NodeSet::clear_bit ( unsigned  num) [inline, private]

Clear the specified bit (set it to zero)

Definition at line 114 of file NodeSet.hpp.

References u.

    {
        bits &= ~( 1u << num );
    }
void MBMesquite::NodeSet::clear_corner_node ( unsigned  num) [inline]

un-mark (clear flag for) corner node

Definition at line 256 of file NodeSet.hpp.

Referenced by MBMesquite::LinearPyramid::sample_points().

void MBMesquite::NodeSet::clear_mid_face_node ( unsigned  num) [inline]

un-mark (clear flag for) mid-face node

Definition at line 266 of file NodeSet.hpp.

void MBMesquite::NodeSet::clear_mid_region_node ( unsigned  num = 0) [inline]

un-mark (clear flag for) mid-region node

Definition at line 271 of file NodeSet.hpp.

void MBMesquite::NodeSet::clear_node ( Sample  sample) [inline]

un-mark (clear flag for) node

Definition at line 276 of file NodeSet.hpp.

References MBMesquite::Sample::dimension, and MBMesquite::Sample::number.

    {
        switch( sample.dimension )
        {
            case 0:
                clear_corner_node( sample.number );
                break;
            case 1:
                clear_mid_edge_node( sample.number );
                break;
            case 2:
                clear_mid_face_node( sample.number );
                break;
            case 3:
                clear_mid_region_node( sample.number );
                break;
            default:
                assert( 0 );
        }
    }
static unsigned MBMesquite::NodeSet::corner_node_position ( unsigned  num) [inline, static]

Position of a corner node in the list.

Definition at line 172 of file NodeSet.hpp.

    {
        assert( num < NUM_CORNER_BITS );
        return num + CORNER_OFFSET;
    }
unsigned MBMesquite::NodeSet::get_bits ( ) const [inline]

Definition at line 424 of file NodeSet.hpp.

    {
        return bits;
    }

Check if any corner nodes are present.

Definition at line 151 of file NodeSet.hpp.

Referenced by MBMesquite::MsqMeshEntity::check_element_orientation(), and MsqMeshEntityTest::test_all_nodes().

    {
        return bits & CORNER_MASK;
    }

Check if any mid-edge nodes are present.

Definition at line 156 of file NodeSet.hpp.

Referenced by MBMesquite::MsqMeshEntity::check_element_orientation(), and MsqMeshEntityTest::test_all_nodes().

    {
        return bits & EDGE_MASK;
    }
static unsigned MBMesquite::NodeSet::mid_edge_node_position ( unsigned  num) [inline, static]

Position of a mid-edge node in the list.

Definition at line 178 of file NodeSet.hpp.

    {
        assert( num < NUM_EDGE_BITS );
        return num + EDGE_OFFSET;
    }
static unsigned MBMesquite::NodeSet::mid_face_node_position ( unsigned  num) [inline, static]

Position of a mid-face node in the list.

Definition at line 184 of file NodeSet.hpp.

    {
        assert( num < NUM_FACE_BITS );
        return num + FACE_OFFSET;
    }
bool MBMesquite::NodeSet::mid_region_node ( unsigned  num = 0) const [inline]

Get mark/flag for mid-region node.

Definition at line 319 of file NodeSet.hpp.

Referenced by MBMesquite::append_elem_samples(), MBMesquite::PatchData::get_samples(), and MBMesquite::populate_data().

    {
        return bit_to_bool( mid_region_node_position( num ) );
    }
static unsigned MBMesquite::NodeSet::mid_region_node_position ( unsigned  num = 0) [inline, static]

Position of a mid-region node in the list.

Definition at line 190 of file NodeSet.hpp.

    {
        assert( num < NUM_REGION_BITS );
        return num + REGION_OFFSET;
    }
bool MBMesquite::NodeSet::node ( Sample  sample) const [inline]

Get mark/flag for node.

Definition at line 324 of file NodeSet.hpp.

References MBMesquite::Sample::dimension, and MBMesquite::Sample::number.

    {
        switch( sample.dimension )
        {
            case 0:
                return corner_node( sample.number );
                break;
            case 1:
                return mid_edge_node( sample.number );
                break;
            case 2:
                return mid_face_node( sample.number );
                break;
            case 3:
                return mid_region_node( sample.number );
                break;
            default:
                assert( 0 );
                return false;
        }
    }
unsigned MBMesquite::NodeSet::num_before ( Sample  sample) const [inline]

Get number of marked/flagged nodes preceeding a specified node in the list.

Definition at line 402 of file NodeSet.hpp.

References MBMesquite::Sample::dimension, MBMesquite::Sample::number, and u.

Referenced by MBMesquite::TargetReader::get_2D_target(), MBMesquite::CachingTargetCalculator::get_2D_target(), MBMesquite::TargetReader::get_3D_target(), MBMesquite::CachingTargetCalculator::get_3D_target(), MBMesquite::TargetReader::get_surface_target(), MBMesquite::CachingTargetCalculator::get_surface_target(), and MBMesquite::WeightReader::get_weight().

    {
        switch( sample.dimension )
        {
            case 0:
                return num_before_corner( sample.number );
                break;
            case 1:
                return num_before_mid_edge( sample.number );
                break;
            case 2:
                return num_before_mid_face( sample.number );
                break;
            case 3:
                return num_before_mid_region( sample.number );
                break;
            default:
                assert( 0 );
                return ~0u;
        }
    }
unsigned MBMesquite::NodeSet::num_before_bit ( unsigned  p_position) const [inline, private]

Count the number of non-zero bits with less significance than the specified bit. (Mask out all bits except those of before the specified position and then count the remaining bits.)

Definition at line 122 of file NodeSet.hpp.

References MBMesquite::popcount(), and u.

    {
        return popcount( bits & ~( ( ~0u ) << p_position ) );
    }
unsigned MBMesquite::NodeSet::num_before_corner ( unsigned  num) const [inline]

Get number of marked/flagged nodes preceeding a specified corner node in the list.

Definition at line 382 of file NodeSet.hpp.

    {
        return num_before_bit( corner_node_position( num ) );
    }
unsigned MBMesquite::NodeSet::num_before_mid_edge ( unsigned  num) const [inline]

Get number of marked/flagged nodes preceeding a specified mid-edge node in the list.

Definition at line 387 of file NodeSet.hpp.

    {
        return num_before_bit( mid_edge_node_position( num ) );
    }
unsigned MBMesquite::NodeSet::num_before_mid_face ( unsigned  num) const [inline]

Get number of marked/flagged nodes preceeding a specified mid-face node in the list.

Definition at line 392 of file NodeSet.hpp.

    {
        return num_before_bit( mid_face_node_position( num ) );
    }
unsigned MBMesquite::NodeSet::num_before_mid_region ( unsigned  num) const [inline]

Get number of marked/flagged nodes preceeding a specified mid-region node in the list.

Definition at line 397 of file NodeSet.hpp.

static unsigned MBMesquite::NodeSet::position ( Sample  sample) [inline, static]

Position of a node in the list.

Definition at line 196 of file NodeSet.hpp.

References MBMesquite::Sample::dimension, MBMesquite::Sample::number, and u.

    {
        switch( sample.dimension )
        {
            case 0:
                return corner_node_position( sample.number );
            case 1:
                return mid_edge_node_position( sample.number );
            case 2:
                return mid_face_node_position( sample.number );
            case 3:
                return mid_region_node_position( sample.number );
        }
        assert( 0 );
        return ~0u;
    }

Set all mid-edge nodes.

Definition at line 440 of file NodeSet.hpp.

References EDGE_OFFSET, edges, and set_bits().

Referenced by MBMesquite::MsqMeshEntity::all_nodes(), MBMesquite::get_nodeset(), and set_all_nodes().

Set all mid-region nodes.

Definition at line 450 of file NodeSet.hpp.

References set_mid_region_node().

Referenced by MBMesquite::MsqMeshEntity::all_nodes().

Set all marks/flags.

Definition at line 455 of file NodeSet.hpp.

References set_all_corner_nodes(), set_all_mid_edge_nodes(), set_all_mid_face_nodes(), and set_mid_region_node().

Referenced by HexLagrangeShapeTest::setUp(), NodeSetTest::test_clear_all(), and NodeSetTest::test_clear_node().

{
    switch( TopologyInfo::dimension( p_type ) )
    {
        case 3:
            set_mid_region_node();
        case 2:
            set_all_mid_face_nodes( p_type );
        case 1:
            set_all_mid_edge_nodes( p_type );
        case 0:
            set_all_corner_nodes( p_type );
    }
}
void MBMesquite::NodeSet::set_bit ( unsigned  num) [inline, private]

Set the specified bit to 1.

Definition at line 103 of file NodeSet.hpp.

References u.

    {
        bits |= ( 1u << num );
    }
void MBMesquite::NodeSet::set_bits ( unsigned  start_bit,
unsigned  count 
) [inline, private]

Definition at line 108 of file NodeSet.hpp.

Referenced by set_all_corner_nodes(), set_all_mid_edge_nodes(), and set_all_mid_face_nodes().

    {
        bits |= ( ~( (BitSet)0 ) >> ( NUM_TOTAL_BITS - count ) ) << start_bit;
    }
void MBMesquite::NodeSet::set_corner_node ( unsigned  num) [inline]

Mark/flag corner node.

Definition at line 214 of file NodeSet.hpp.

References moab::set_bit().

Referenced by NodeSetTest::test_clear(), and NodeSetTest::test_set_node().

    {
        set_bit( corner_node_position( num ) );
    }
void MBMesquite::NodeSet::set_node ( Sample  sample) [inline]

Mark/flag node.

Definition at line 234 of file NodeSet.hpp.

References MBMesquite::Sample::dimension, and MBMesquite::Sample::number.

    {
        switch( sample.dimension )
        {
            case 0:
                set_corner_node( sample.number );
                break;
            case 1:
                set_mid_edge_node( sample.number );
                break;
            case 2:
                set_mid_face_node( sample.number );
                break;
            case 3:
                set_mid_region_node( sample.number );
                break;
            default:
                assert( 0 );
        }
    }

Member Data Documentation

The data, one bit for each possible node location.

Definition at line 94 of file NodeSet.hpp.

Bit mask for all corner bits.

Definition at line 83 of file NodeSet.hpp.

LSB of corner node storage.

Definition at line 72 of file NodeSet.hpp.

Referenced by set_all_corner_nodes(), NodeSetTest::test_clear_node(), and NodeSetTest::test_set_node().

Initial value:

Bit mask for all mid-edge nodes.

Definition at line 87 of file NodeSet.hpp.

Bit mask for all mid-face nodes.

Definition at line 90 of file NodeSet.hpp.

const BitSet MBMesquite::NodeSet::MID_NODE_MASK = ( ~0u ) << NUM_CORNER_BITS [static]

Bit mask for all non-corner bits.

Definition at line 81 of file NodeSet.hpp.

Definition at line 61 of file NodeSet.hpp.

const BitSet MBMesquite::NodeSet::NUM_TOTAL_BITS = 8 * sizeof( BitSet ) [static]

Misc constants. Only NUM_CORNER_BITS, NUM_EDGE_BITS, and NUM_REGION_BITS should be modified. All other contants are a function of those three values and the size of the bit storage.

Definition at line 60 of file NodeSet.hpp.

const BitSet MBMesquite::NodeSet::REGION_MASK = ~( ( ~0u ) >> NUM_REGION_BITS ) [static]

Mid-region mask.

Definition at line 85 of file NodeSet.hpp.

LSB of mid-region storage.

Definition at line 78 of file NodeSet.hpp.

Referenced by NodeSetTest::test_clear_node(), and NodeSetTest::test_set_node().

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