|
MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Include dependency graph for reorder_test.cpp:Go to the source code of this file.
Functions | |
| void | tag_vals_from_gid (int global_id, std::vector< int > &values) |
| unsigned char | bits_from_gid (int global_id) |
| unsigned char | order_from_gid (int global_id) |
| void | coords_from_gid (int global_id, double coords[3]) |
| void | build_mesh () |
| void | check_order_by_sets_and_adj () |
| void | call_reorder () |
| void | check_order () |
| void | check_node_coords () |
| void | check_quad_conn () |
| void | check_set_meshset () |
| void | check_list_meshset () |
| void | check_big_meshset () |
| void | check_handle_tag () |
| void | check_varlen_tag () |
| void | check_bit_tag () |
| int | main () |
| void | check_order (EntityType type) |
| void | check_meshset_common (bool ordered) |
Variables | |
| const char | GLOBAL_ID_NAME [] = "GLOBAL_ID" |
| const char | SET_IDS_NAME [] = "SET_IDS" |
| const char | SET_HANDLES_NAME [] = "SET_HANDLES" |
| const char | CONN_IDS_NAME [] = "CONN_IDS" |
| const char | CONN_NAME [] = "CONN_HANDLES" |
| const char | VAR_INTS_NAME [] = "VAR_LEN_INTS" |
| const char | BIT_NAME [] = "TEST_BIT_TAG" |
| const int | ENTS_PER_SET = 6 |
| const int | BITS_PER_TAG = 2 |
| Core * | mbcore = 0 |
| Interface * | mb = 0 |
| Tag | order_tag = 0 |
| const size_t | INTERVALS = 6 |
| unsigned char bits_from_gid | ( | int | global_id | ) |
Definition at line 35 of file reorder_test.cpp.
References BITS_PER_TAG.
Referenced by build_mesh(), and check_bit_tag().
{
return global_id % ( 1 << BITS_PER_TAG );
}
| void build_mesh | ( | ) |
Definition at line 98 of file reorder_test.cpp.
References moab::Core::add_entities(), BIT_NAME, bits_from_gid(), BITS_PER_TAG, CHECK_ERR, CONN_IDS_NAME, CONN_NAME, coords_from_gid(), moab::Core::create_element(), moab::Core::create_meshset(), moab::Core::create_vertex(), ENTS_PER_SET, ErrorCode, GLOBAL_ID_NAME, INTERVALS, mb, MB_TAG_CREAT, MB_TAG_DENSE, MB_TAG_SPARSE, MB_TAG_VARLEN, MB_TYPE_BIT, MB_TYPE_HANDLE, MB_TYPE_INTEGER, MBQUAD, MESHSET_SET, MESHSET_TRACK_OWNER, order_from_gid(), order_tag, SET_HANDLES_NAME, SET_IDS_NAME, size, moab::Core::tag_get_handle(), moab::Core::tag_set_by_ptr(), moab::Core::tag_set_data(), tag_vals_from_gid(), and VAR_INTS_NAME.
Referenced by main().
{
const unsigned dense = MB_TAG_CREAT | MB_TAG_DENSE;
const unsigned sparse = MB_TAG_CREAT | MB_TAG_SPARSE;
ErrorCode rval;
// get/create various tags
Tag gid;
rval = mb->tag_get_handle( GLOBAL_ID_NAME, 1, MB_TYPE_INTEGER, gid, dense );CHECK_ERR( rval );
Tag conn_ids;
rval = mb->tag_get_handle( CONN_IDS_NAME, 4, MB_TYPE_INTEGER, conn_ids, dense );CHECK_ERR( rval );
Tag conn_handles;
rval = mb->tag_get_handle( CONN_NAME, 4, MB_TYPE_HANDLE, conn_handles, dense );CHECK_ERR( rval );
Tag set_ids;
rval = mb->tag_get_handle( SET_IDS_NAME, ENTS_PER_SET, MB_TYPE_INTEGER, set_ids, sparse );CHECK_ERR( rval );
Tag set_handles;
rval = mb->tag_get_handle( SET_HANDLES_NAME, ENTS_PER_SET, MB_TYPE_HANDLE, set_handles, sparse );CHECK_ERR( rval );
Tag var_data;
rval = mb->tag_get_handle( VAR_INTS_NAME, 0, MB_TYPE_INTEGER, var_data, dense | MB_TAG_VARLEN );CHECK_ERR( rval );
Tag bit_data;
rval = mb->tag_get_handle( BIT_NAME, BITS_PER_TAG, MB_TYPE_BIT, bit_data, MB_TAG_CREAT );CHECK_ERR( rval );
rval = mb->tag_get_handle( "ORDER", 1, MB_TYPE_INTEGER, order_tag, dense );CHECK_ERR( rval );
// create and tag vertices
std::vector< int > values;
EntityHandle nodes[( INTERVALS + 1 ) * ( INTERVALS + 1 )];
for( size_t i = 0; i <= INTERVALS; ++i )
{
for( size_t j = 0; j <= INTERVALS; ++j )
{
size_t idx = i * ( INTERVALS + 1 ) + j;
double coords[3];
coords_from_gid( idx, coords );
rval = mb->create_vertex( coords, nodes[idx] );CHECK_ERR( rval );
int tagval = idx;
rval = mb->tag_set_data( gid, nodes + idx, 1, &tagval );CHECK_ERR( rval );
tag_vals_from_gid( idx, values );
const void* ptr = &values[0];
const int size = values.size();
rval = mb->tag_set_by_ptr( var_data, nodes + idx, 1, &ptr, &size );CHECK_ERR( rval );
unsigned char bits = bits_from_gid( idx );
rval = mb->tag_set_data( bit_data, nodes + idx, 1, &bits );CHECK_ERR( rval );
int group = order_from_gid( idx );
rval = mb->tag_set_data( order_tag, nodes + idx, 1, &group );CHECK_ERR( rval );
}
}
// create and tag elements
EntityHandle quads[INTERVALS * INTERVALS];
for( size_t i = 0; i < INTERVALS; ++i )
{
for( size_t j = 0; j < INTERVALS; ++j )
{
size_t idx = i * INTERVALS + j;
size_t n0 = i * ( INTERVALS + 1 ) + j;
size_t n1 = ( i + 1 ) * ( INTERVALS + 1 ) + j;
size_t n2 = ( i + 1 ) * ( INTERVALS + 1 ) + j + 1;
size_t n3 = i * ( INTERVALS + 1 ) + j + 1;
EntityHandle conn[4] = { nodes[n0], nodes[n1], nodes[n2], nodes[n3] };
EntityHandle h;
rval = mb->create_element( MBQUAD, conn, 4, h );CHECK_ERR( rval );
int tagval = idx;
rval = mb->tag_set_data( gid, &h, 1, &tagval );CHECK_ERR( rval );
int ids[4] = { static_cast< int >( n0 ), static_cast< int >( n1 ), static_cast< int >( n2 ),
static_cast< int >( n3 ) };
rval = mb->tag_set_data( conn_ids, &h, 1, ids );CHECK_ERR( rval );
rval = mb->tag_set_data( conn_handles, &h, 1, conn );CHECK_ERR( rval );
int group = order_from_gid( idx );
rval = mb->tag_set_data( order_tag, &h, 1, &group );CHECK_ERR( rval );
quads[idx] = h;
}
}
// create a few sets
for( int i = 0; i < 2; ++i )
{
EntityHandle* from = 0;
size_t count;
unsigned flag;
if( i )
{
from = nodes;
count = ( INTERVALS + 1 ) * ( INTERVALS + 1 );
flag = MESHSET_SET;
}
else
{
from = quads;
count = INTERVALS * INTERVALS;
flag = MESHSET_ORDERED;
}
EntityHandle h;
rval = mb->create_meshset( flag | MESHSET_TRACK_OWNER, h );CHECK_ERR( rval );
EntityHandle ents[ENTS_PER_SET];
int gids[ENTS_PER_SET];
for( int j = 0; j < ENTS_PER_SET; ++j )
{
int idx = j + 2;
idx = ( idx * idx ) % count;
ents[j] = from[idx];
gids[j] = idx;
}
rval = mb->add_entities( h, ents, ENTS_PER_SET );CHECK_ERR( rval );
rval = mb->tag_set_data( set_ids, &h, 1, gids );CHECK_ERR( rval );
rval = mb->tag_set_data( set_handles, &h, 1, ents );CHECK_ERR( rval );
}
// create a set containing all vertices
EntityHandle allverts;
rval = mb->create_meshset( MESHSET_SET, allverts );CHECK_ERR( rval );
rval = mb->add_entities( allverts, nodes, ( INTERVALS + 1 ) * ( INTERVALS + 1 ) );CHECK_ERR( rval );
}
| void call_reorder | ( | ) |
Definition at line 233 of file reorder_test.cpp.
References CHECK_ERR, ErrorCode, moab::ReorderTool::handle_order_from_int_tag(), mbcore, order_tag, and moab::ReorderTool::reorder_entities().
Referenced by main().
| void check_big_meshset | ( | ) |
Definition at line 458 of file reorder_test.cpp.
References moab::Range::begin(), CHECK, CHECK_ERR, moab::Range::end(), ErrorCode, moab::Core::get_entities_by_handle(), moab::Core::get_entities_by_type(), mb, MBENTITYSET, and MBVERTEX.
Referenced by main().
{
// Mesh should have a single set that contains all the vertices.
// Find it.
Range sets;
ErrorCode rval = mb->get_entities_by_type( 0, MBENTITYSET, sets );CHECK_ERR( rval );
Range verts;
rval = mb->get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
bool found = false;
for( Range::iterator it = sets.begin(); it != sets.end(); ++it )
{
Range ents;
rval = mb->get_entities_by_handle( *it, ents );CHECK_ERR( rval );
if( ents == verts )
{
found = true;
break;
}
}
CHECK( found );
}
| void check_bit_tag | ( | ) |
Definition at line 558 of file reorder_test.cpp.
References BIT_NAME, bits_from_gid(), BITS_PER_TAG, CHECK_EQUAL, CHECK_ERR, ErrorCode, moab::Core::get_entities_by_type(), GLOBAL_ID_NAME, mb, MB_TYPE_BIT, MB_TYPE_INTEGER, MBVERTEX, moab::Range::size(), moab::Core::tag_get_data(), and moab::Core::tag_get_handle().
Referenced by main().
{
ErrorCode rval;
Tag gid;
rval = mb->tag_get_handle( GLOBAL_ID_NAME, 1, MB_TYPE_INTEGER, gid );CHECK_ERR( rval );
Tag bit_data;
rval = mb->tag_get_handle( BIT_NAME, BITS_PER_TAG, MB_TYPE_BIT, bit_data );CHECK_ERR( rval );
Range verts;
rval = mb->get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
std::vector< int > gids( verts.size() );
rval = mb->tag_get_data( gid, verts, &gids[0] );CHECK_ERR( rval );
std::vector< unsigned char > exp( gids.size() ), act( gids.size() );
for( size_t i = 0; i < exp.size(); ++i )
exp[i] = bits_from_gid( gids[i] );
rval = mb->tag_get_data( bit_data, verts, &act[0] );CHECK_ERR( rval );
CHECK_EQUAL( exp, act );
}
| void check_handle_tag | ( | ) |
Definition at line 482 of file reorder_test.cpp.
References moab::Range::begin(), CHECK, CHECK_EQUAL, CHECK_ERR, CONN_NAME, moab::Range::empty(), moab::Range::end(), ENTS_PER_SET, ErrorCode, moab::Core::get_connectivity(), moab::Core::get_entities_by_handle(), moab::Core::get_entities_by_type(), moab::Core::get_entities_by_type_and_tag(), moab::Core::get_meshset_options(), mb, MB_TYPE_HANDLE, MBENTITYSET, MBQUAD, SET_HANDLES_NAME, moab::Core::tag_get_data(), and moab::Core::tag_get_handle().
Referenced by main().
{
Range::iterator it;
ErrorCode rval;
// first check tag on sets, for which the values should have been
// updated according to the reordering
Tag set_handles;
rval = mb->tag_get_handle( SET_HANDLES_NAME, ENTS_PER_SET, MB_TYPE_HANDLE, set_handles );CHECK_ERR( rval );
Range sets;
rval = mb->get_entities_by_type_and_tag( 0, MBENTITYSET, &set_handles, 0, 1, sets );CHECK_ERR( rval );
CHECK( !sets.empty() );
for( it = sets.begin(); it != sets.end(); ++it )
{
std::vector< EntityHandle > ents;
rval = mb->get_entities_by_handle( *it, ents );CHECK_ERR( rval );
std::vector< EntityHandle > handles( ENTS_PER_SET );
rval = mb->tag_get_data( set_handles, &*it, 1, &handles[0] );CHECK_ERR( rval );
unsigned flags;
rval = mb->get_meshset_options( *it, flags );CHECK_ERR( rval );
if( !( flags & MESHSET_ORDERED ) ) std::sort( handles.begin(), handles.end() );
CHECK_EQUAL( ents, handles );
}
// Now check handle tag on quads. This tag need to both be re-ordered
// and have the contained handles updated.
Tag conn_handles;
rval = mb->tag_get_handle( CONN_NAME, 4, MB_TYPE_HANDLE, conn_handles );CHECK_ERR( rval );
std::vector< EntityHandle > quads;
rval = mb->get_entities_by_type( 0, MBQUAD, quads );CHECK_ERR( rval );
std::vector< EntityHandle > conn;
rval = mb->get_connectivity( &quads[0], quads.size(), conn, true );CHECK_ERR( rval );
std::vector< EntityHandle > tagvals( 4 * quads.size() );
rval = mb->tag_get_data( conn_handles, &quads[0], quads.size(), &tagvals[0] );CHECK_ERR( rval );
CHECK_EQUAL( conn, tagvals );
}
| void check_list_meshset | ( | ) |
Definition at line 453 of file reorder_test.cpp.
References check_meshset_common().
Referenced by main().
{
check_meshset_common( true );
}
| void check_meshset_common | ( | bool | ordered | ) |
Definition at line 395 of file reorder_test.cpp.
References moab::Range::begin(), CHECK, CHECK_ARRAYS_EQUAL, CHECK_EQUAL, CHECK_ERR, moab::Range::empty(), moab::Range::end(), ENTS_PER_SET, ErrorCode, moab::Core::get_adjacencies(), moab::Core::get_entities_by_handle(), moab::Core::get_entities_by_type_and_tag(), moab::Core::get_meshset_options(), GLOBAL_ID_NAME, mb, MB_TYPE_INTEGER, MBENTITYSET, MESHSET_TRACK_OWNER, SET_IDS_NAME, moab::Core::tag_get_data(), and moab::Core::tag_get_handle().
Referenced by check_list_meshset(), and check_set_meshset().
{
ErrorCode rval;
Tag set_ids;
rval = mb->tag_get_handle( SET_IDS_NAME, ENTS_PER_SET, MB_TYPE_INTEGER, set_ids );CHECK_ERR( rval );
Tag gid;
rval = mb->tag_get_handle( GLOBAL_ID_NAME, 1, MB_TYPE_INTEGER, gid );CHECK_ERR( rval );
Range sets;
rval = mb->get_entities_by_type_and_tag( 0, MBENTITYSET, &set_ids, 0, 1, sets );CHECK_ERR( rval );
CHECK( !sets.empty() );
EntityHandle set = 0;
unsigned flags;
for( Range::iterator it = sets.begin(); it != sets.end(); ++it )
{
rval = mb->get_meshset_options( *it, flags );CHECK_ERR( rval );
if( ( ordered && ( flags & MESHSET_ORDERED ) ) || ( !ordered && !( flags & MESHSET_ORDERED ) ) )
{
set = *it;
break;
}
}
CHECK( 0 != set );
std::vector< EntityHandle > ents;
rval = mb->get_entities_by_handle( set, ents );CHECK_ERR( rval );
CHECK_EQUAL( ENTS_PER_SET, (int)ents.size() );
int exp[ENTS_PER_SET], act[ENTS_PER_SET];
rval = mb->tag_get_data( set_ids, &set, 1, exp );CHECK_ERR( rval );
rval = mb->tag_get_data( gid, &ents[0], ENTS_PER_SET, act );CHECK_ERR( rval );
if( !ordered )
{
std::sort( exp, exp + ENTS_PER_SET );
std::sort( act, act + ENTS_PER_SET );
}
CHECK_ARRAYS_EQUAL( exp, ENTS_PER_SET, act, ENTS_PER_SET );
if( !( flags & MESHSET_TRACK_OWNER ) ) return;
for( int i = 0; i < ENTS_PER_SET; ++i )
{
std::vector< EntityHandle > adj;
rval = mb->get_adjacencies( &ents[i], 1, 4, false, adj );CHECK_ERR( rval );
CHECK( std::find( adj.begin(), adj.end(), set ) != adj.end() );
}
}
| void check_node_coords | ( | ) |
Definition at line 348 of file reorder_test.cpp.
References CHECK_EQUAL, CHECK_ERR, coords_from_gid(), ErrorCode, moab::Core::get_coords(), moab::Core::get_entities_by_type(), GLOBAL_ID_NAME, mb, MB_TYPE_INTEGER, MBVERTEX, moab::Range::size(), moab::Core::tag_get_data(), and moab::Core::tag_get_handle().
Referenced by main().
{
ErrorCode rval;
Tag gid;
rval = mb->tag_get_handle( GLOBAL_ID_NAME, 1, MB_TYPE_INTEGER, gid );CHECK_ERR( rval );
Range verts;
rval = mb->get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
std::vector< int > ids( verts.size() );
rval = mb->tag_get_data( gid, verts, &ids[0] );CHECK_ERR( rval );
std::vector< double > coords( 3 * verts.size() );
rval = mb->get_coords( verts, &coords[0] );CHECK_ERR( rval );
std::vector< double > expected( 3 * verts.size() );
for( size_t i = 0; i < ids.size(); ++i )
coords_from_gid( ids[i], &expected[3 * i] );
CHECK_EQUAL( expected, coords );
}
| void check_order | ( | ) |
Definition at line 342 of file reorder_test.cpp.
References MBQUAD, and MBVERTEX.
Referenced by main().
{
check_order( MBVERTEX );
check_order( MBQUAD );
}
| void check_order | ( | EntityType | type | ) |
Definition at line 242 of file reorder_test.cpp.
References CHECK, CHECK_ERR, ErrorCode, moab::Core::get_entities_by_type(), GLOBAL_ID_NAME, mb, MB_TYPE_INTEGER, order_from_gid(), moab::Range::size(), moab::Core::tag_get_data(), and moab::Core::tag_get_handle().
{
ErrorCode rval;
Tag gid;
rval = mb->tag_get_handle( GLOBAL_ID_NAME, 1, MB_TYPE_INTEGER, gid );CHECK_ERR( rval );
Range ents;
rval = mb->get_entities_by_type( 0, type, ents );CHECK_ERR( rval );
std::vector< int > ids( ents.size() );
rval = mb->tag_get_data( gid, ents, &ids[0] );CHECK_ERR( rval );
for( size_t i = 1; i < ids.size(); ++i )
{
CHECK( order_from_gid( ids[i - 1] ) <= order_from_gid( ids[i] ) );
}
}
| void check_order_by_sets_and_adj | ( | ) |
Definition at line 261 of file reorder_test.cpp.
References moab::Core::add_entities(), moab::Range::begin(), CHECK, CHECK_ERR, moab::Core::create_meshset(), moab::Range::end(), ErrorCode, moab::GeomUtil::first(), moab::Core::get_adjacencies(), moab::Core::get_entities_by_dimension(), moab::Core::get_entities_by_type(), moab::ReorderTool::handle_order_from_sets_and_adj(), moab::Range::insert(), mb, mbcore, MBVERTEX, MESHSET_SET, order_tag, moab::Range::size(), and moab::Core::tag_get_data().
Referenced by main().
{
ErrorCode rval;
std::vector< EntityHandle > quads;
rval = mb->get_entities_by_dimension( 0, 2, quads );CHECK_ERR( rval );
CHECK( !quads.empty() );
// group quads by the ordering assigned in build_mesh()
std::map< int, Range > groups;
std::vector< int > group_ids( quads.size() );
rval = mb->tag_get_data( order_tag, &quads[0], quads.size(), &group_ids[0] );CHECK_ERR( rval );
for( size_t i = 0; i < quads.size(); ++i )
groups[group_ids[i]].insert( quads[i] );
// create sets from groups
Range sets;
for( std::map< int, Range >::iterator i = groups.begin(); i != groups.end(); ++i )
{
EntityHandle h;
rval = mb->create_meshset( MESHSET_SET, h );CHECK_ERR( rval );
rval = mb->add_entities( h, i->second );CHECK_ERR( rval );
sets.insert( h );
}
// Get ordering assigned by set containment
Tag neworder = 0;
ReorderTool tool( mbcore );
rval = tool.handle_order_from_sets_and_adj( sets, neworder );CHECK_ERR( rval );
// check that new quad handles are clustered as expected
std::vector< std::pair< EntityHandle, EntityHandle > > ranges;
for( std::map< int, Range >::iterator i = groups.begin(); i != groups.end(); ++i )
{
std::vector< EntityHandle > newh( i->second.size() );
rval = mb->tag_get_data( neworder, i->second, &newh[0] );CHECK_ERR( rval );
std::sort( newh.begin(), newh.end() );
CHECK( newh[0] > 0 ); // zero implies some quad got left out of the reordering
std::pair< EntityHandle, EntityHandle > p( newh[0], newh[newh.size() - 1] );
ranges.push_back( p );
}
std::sort( ranges.begin(), ranges.end() );
for( size_t i = 1; i < ranges.size(); ++i )
{
CHECK( ranges[i - 1].second < ranges[i].first );
}
// group vertices as we expect handles to be grouped
std::map< std::vector< int >, Range > vtxgroups;
Range verts;
rval = mb->get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
for( Range::iterator i = verts.begin(); i != verts.end(); ++i )
{
Range adj;
rval = mb->get_adjacencies( &*i, 1, 2, false, adj );CHECK_ERR( rval );
std::vector< int > ids( adj.size() );
rval = mb->tag_get_data( order_tag, adj, &ids[0] );CHECK_ERR( rval );
std::sort( ids.begin(), ids.end() );
ids.erase( std::unique( ids.begin(), ids.end() ), ids.end() );
vtxgroups[ids].insert( *i );
}
// check that new vertex handles are clustered as expected
ranges.clear();
std::map< std::vector< int >, Range >::iterator j;
for( j = vtxgroups.begin(); j != vtxgroups.end(); ++j )
{
std::vector< EntityHandle > newh( j->second.size() );
rval = mb->tag_get_data( neworder, j->second, &newh[0] );CHECK_ERR( rval );
std::sort( newh.begin(), newh.end() );
CHECK( newh[0] > 0 ); // zero implies some quad got left out of the reordering
std::pair< EntityHandle, EntityHandle > p( newh[0], newh[newh.size() - 1] );
ranges.push_back( p );
}
std::sort( ranges.begin(), ranges.end() );
for( size_t i = 1; i < ranges.size(); ++i )
{
CHECK( ranges[i - 1].second < ranges[i].first );
}
}
| void check_quad_conn | ( | ) |
Definition at line 371 of file reorder_test.cpp.
References CHECK_EQUAL, CHECK_ERR, CONN_IDS_NAME, ErrorCode, moab::Core::get_connectivity(), moab::Core::get_entities_by_type(), GLOBAL_ID_NAME, mb, MB_TYPE_INTEGER, MBQUAD, moab::Core::tag_get_data(), and moab::Core::tag_get_handle().
Referenced by main().
{
ErrorCode rval;
Tag gid;
rval = mb->tag_get_handle( GLOBAL_ID_NAME, 1, MB_TYPE_INTEGER, gid );CHECK_ERR( rval );
Tag conn_ids;
rval = mb->tag_get_handle( CONN_IDS_NAME, 4, MB_TYPE_INTEGER, conn_ids );CHECK_ERR( rval );
std::vector< EntityHandle > quads;
rval = mb->get_entities_by_type( 0, MBQUAD, quads );CHECK_ERR( rval );
std::vector< EntityHandle > conn;
rval = mb->get_connectivity( &quads[0], quads.size(), conn, true );CHECK_ERR( rval );
CHECK_EQUAL( 4 * quads.size(), conn.size() );
std::vector< int > exp_ids( 4 * quads.size() ), act_ids( 4 * quads.size() );
rval = mb->tag_get_data( conn_ids, &quads[0], quads.size(), &exp_ids[0] );CHECK_ERR( rval );
rval = mb->tag_get_data( gid, &conn[0], conn.size(), &act_ids[0] );CHECK_ERR( rval );
CHECK_EQUAL( exp_ids, act_ids );
}
| void check_set_meshset | ( | ) |
Definition at line 448 of file reorder_test.cpp.
References check_meshset_common().
Referenced by main().
{
check_meshset_common( false );
}
| void check_varlen_tag | ( | ) |
Definition at line 530 of file reorder_test.cpp.
References CHECK_ARRAYS_EQUAL, CHECK_ERR, ErrorCode, moab::Core::get_entities_by_type(), GLOBAL_ID_NAME, mb, MB_TYPE_INTEGER, MBVERTEX, moab::Range::size(), sizes, moab::Core::tag_get_by_ptr(), moab::Core::tag_get_data(), moab::Core::tag_get_handle(), tag_vals_from_gid(), and VAR_INTS_NAME.
Referenced by main().
{
ErrorCode rval;
Tag gid;
rval = mb->tag_get_handle( GLOBAL_ID_NAME, 1, MB_TYPE_INTEGER, gid );CHECK_ERR( rval );
Tag var_data;
rval = mb->tag_get_handle( VAR_INTS_NAME, 0, MB_TYPE_INTEGER, var_data );CHECK_ERR( rval );
Range verts;
rval = mb->get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
std::vector< int > gids( verts.size() );
rval = mb->tag_get_data( gid, verts, &gids[0] );CHECK_ERR( rval );
std::vector< const void* > ptrs( verts.size() );
std::vector< int > sizes( verts.size() );
rval = mb->tag_get_by_ptr( var_data, verts, &ptrs[0], &sizes[0] );CHECK_ERR( rval );
for( size_t i = 0; i < gids.size(); ++i )
{
std::vector< int > exp;
tag_vals_from_gid( gids[i], exp );
CHECK_ARRAYS_EQUAL( &exp[0], exp.size(), (const int*)ptrs[i], sizes[i] );
}
}
| void coords_from_gid | ( | int | global_id, |
| double | coords[3] | ||
| ) |
Definition at line 45 of file reorder_test.cpp.
References INTERVALS.
Referenced by build_mesh(), and check_node_coords().
| int main | ( | ) |
Definition at line 67 of file reorder_test.cpp.
References build_mesh(), call_reorder(), check_big_meshset(), check_bit_tag(), check_handle_tag(), check_list_meshset(), check_node_coords(), check_order(), check_order_by_sets_and_adj(), check_quad_conn(), check_set_meshset(), check_varlen_tag(), mb, mbcore, and RUN_TEST.
{
// Define global MOAB instance for use by all tests
Core mcore;
mbcore = &mcore;
mb = &mcore;
// if this fails, don't bother with anything else
if( RUN_TEST( build_mesh ) ) return 1;
// this test needs be be run before reordering the mesh
int errors = 0;
errors += RUN_TEST( check_order_by_sets_and_adj );
// if reorder returned failure, don't bother doing anything else
int tmp = RUN_TEST( call_reorder );
if( tmp ) return tmp + errors;
// test the core stuff
errors += RUN_TEST( check_order );
errors += RUN_TEST( check_node_coords );
errors += RUN_TEST( check_quad_conn );
errors += RUN_TEST( check_set_meshset );
errors += RUN_TEST( check_list_meshset );
errors += RUN_TEST( check_big_meshset );
errors += RUN_TEST( check_handle_tag );
errors += RUN_TEST( check_varlen_tag );
errors += RUN_TEST( check_bit_tag );
return errors;
}
| unsigned char order_from_gid | ( | int | global_id | ) |
Definition at line 40 of file reorder_test.cpp.
Referenced by build_mesh(), and check_order().
{
return global_id % 3;
}
| void tag_vals_from_gid | ( | int | global_id, |
| std::vector< int > & | values | ||
| ) |
Definition at line 25 of file reorder_test.cpp.
References INTERVALS.
Referenced by build_mesh(), and check_varlen_tag().
| const char BIT_NAME[] = "TEST_BIT_TAG" |
Definition at line 14 of file reorder_test.cpp.
Referenced by build_mesh(), and check_bit_tag().
| const int BITS_PER_TAG = 2 |
Definition at line 16 of file reorder_test.cpp.
Referenced by bits_from_gid(), build_mesh(), and check_bit_tag().
| const char CONN_IDS_NAME[] = "CONN_IDS" |
Definition at line 11 of file reorder_test.cpp.
Referenced by build_mesh(), and check_quad_conn().
| const char CONN_NAME[] = "CONN_HANDLES" |
Definition at line 12 of file reorder_test.cpp.
Referenced by build_mesh(), and check_handle_tag().
| const int ENTS_PER_SET = 6 |
Definition at line 15 of file reorder_test.cpp.
Referenced by build_mesh(), check_handle_tag(), and check_meshset_common().
| const char GLOBAL_ID_NAME[] = "GLOBAL_ID" |
Definition at line 8 of file reorder_test.cpp.
Referenced by build_mesh(), check_bit_tag(), check_meshset_common(), check_node_coords(), check_order(), check_quad_conn(), and check_varlen_tag().
| const size_t INTERVALS = 6 |
Definition at line 22 of file reorder_test.cpp.
Definition at line 19 of file reorder_test.cpp.
Definition at line 18 of file reorder_test.cpp.
Referenced by call_reorder(), check_order_by_sets_and_adj(), moab::ScdInterface::construct_box(), create_hexes_and_verts(), moab::ScdInterface::create_scd_sequence(), do_test_mode(), main(), moab::Tqdcfr::read_block(), split_quads_test(), split_test_across(), test_write_invalid_elem(), test_write_read_many_tags(), testA(), and moab::ScdBox::~ScdBox().
Definition at line 20 of file reorder_test.cpp.
Referenced by build_mesh(), call_reorder(), check_order_by_sets_and_adj(), and moab::ReorderTool::handle_order_from_sets_and_adj().
| const char SET_HANDLES_NAME[] = "SET_HANDLES" |
Definition at line 10 of file reorder_test.cpp.
Referenced by build_mesh(), and check_handle_tag().
| const char SET_IDS_NAME[] = "SET_IDS" |
Definition at line 9 of file reorder_test.cpp.
Referenced by build_mesh(), and check_meshset_common().
| const char VAR_INTS_NAME[] = "VAR_LEN_INTS" |
Definition at line 13 of file reorder_test.cpp.
Referenced by build_mesh(), and check_varlen_tag().