80 static const std::string
input_file_1 = std::string( TestDir +
"unittest/io/test.cub" );
81 static const std::string
ho_file = std::string( TestDir +
"unittest/io/ho_test.cub" );
82 static const std::string
cubit12_file = std::string( TestDir +
"unittest/io/cubtest12.cub" );
83 static const std::string
cubit14_file = std::string( TestDir +
"unittest/io/cubtest14.cub" );
211 const double node_coords[] = {
213 5, 5, 5, 5, 0, 5, -5, 5, 5, 0, 5, 5,
214 -5, -5, 5, -5, 0, 5, 0, -5, 5, 0, 0, 5, 5, 5, -5,
215 5, -5, -5, 5, 0, -5, -5, -5, -5, 0, -5, -5, -5, 5, -5,
216 -5, 0, -5, 0, 5, -5, 0, 0, -5, -5, -5, 0, 5, -5, 0,
217 0, -5, 0, -5, 5, 0, -5, 0, 0, 5, 5, 0, 0, 5, 0,
218 5, 0, 0, 0, 0, 0, 15, -5, 5, 15, 5, 5, 15, 0, 5,
219 10, 5, 5, 10, -5, 5, 10, 0, 5, 15, 5, -5, 15, -5, -5,
220 15, 0, -5, 10, -5, -5, 10, 5, -5, 10, 0, -5, 15, -5, 0,
221 10, -5, 0, 15, 5, 0, 10, 5, 0, 15, 0, 0, 10, 0, 0
230 const size_t num_nodes =
sizeof( node_coords ) / ( 3 *
sizeof(
double ) );
238 std::vector< int > ids( num_nodes );
240 std::vector< int > sorted( ids );
241 std::sort( sorted.begin(), sorted.end() );
242 for(
size_t i = 0; i < num_nodes; ++i )
246 std::vector< double > coords( 3 * num_nodes );
248 for(
size_t i = 0; i < num_nodes; ++i )
250 const double* exp = node_coords + 3 * ( ids[i] - 1 );
251 const double* act = &coords[3 * i];
258 void test_element(
const std::string&
filename, EntityType type,
int num_elem,
int node_per_elem,
const int* conn_list )
272 std::vector< int > ids( num_elem );
276 std::vector< int > sorted( ids );
277 std::sort( sorted.begin(), sorted.end() );
278 for(
int i = 0; i < num_elem; ++i )
282 std::vector< int > conn_ids( node_per_elem );
283 std::vector< EntityHandle > conn_h;
285 for(
int i = 0; i < num_elem; ++i, ++j )
291 const int* exp = conn_list + node_per_elem * ( ids[i] - 1 );
292 for(
int k = 0; k < node_per_elem; ++k )
299 const int edge_conn[] = { 1, 3,
300 3, 2, 2, 5, 5, 4, 4, 7, 7, 6, 6, 8, 8, 1, 3, 9, 9, 8,
301 5, 9, 9, 7, 10, 12, 12, 11, 11, 14, 14, 13, 13, 16, 16, 15, 15, 17, 17, 10,
302 12, 18, 18, 17, 14, 18, 18, 16, 6, 19, 19, 13, 1, 20, 20, 11, 19, 21, 21, 8,
303 14, 21, 21, 20, 4, 22, 22, 15, 22, 23, 23, 7, 16, 23, 23, 19, 2, 24, 24, 10,
304 24, 25, 25, 5, 17, 25, 25, 22, 20, 26, 26, 3, 12, 26, 26, 24, 28, 30, 30, 29,
305 29, 31, 31, 2, 1, 32, 32, 28, 30, 33, 33, 32, 31, 33, 33, 3, 34, 36, 36, 35,
306 35, 37, 37, 11, 10, 38, 38, 34, 36, 39, 39, 38, 37, 39, 39, 12, 28, 40, 40, 35,
307 20, 41, 41, 32, 37, 41, 41, 40, 29, 42, 42, 34, 42, 43, 43, 31, 38, 43, 43, 24,
308 40, 44, 44, 30, 36, 44, 44, 42 };
314 const int quad_conn[] = {
316 3, 2, 5, 9, 8, 9, 7, 6, 9, 5, 4, 7, 10, 12, 18, 17, 12, 11, 14, 18,
317 17, 18, 16, 15, 18, 14, 13, 16, 6, 19, 21, 8, 19, 13, 14, 21,
318 8, 21, 20, 1, 21, 14, 11, 20, 4, 22, 23, 7, 22, 15, 16, 23, 7, 23, 19, 6,
319 23, 16, 13, 19, 2, 24, 25, 5, 24, 10, 17, 25, 5, 25, 22, 4, 25, 17, 15, 22,
320 1, 20, 26, 3, 20, 11, 12, 26, 3, 26, 24, 2, 26, 12, 10, 24, 28, 30, 33, 32,
321 30, 29, 31, 33, 32, 33, 3, 1, 33, 31, 2, 3, 34, 36, 39, 38, 36, 35, 37, 39,
322 38, 39, 12, 10, 39, 37, 11, 12, 1, 20, 41, 32, 20, 11, 37, 41, 32, 41, 40, 28,
323 41, 37, 35, 40, 29, 42, 43, 31, 42, 34, 38, 43, 31, 43, 24, 2, 43, 38, 10, 24,
324 28, 40, 44, 30, 40, 35, 36, 44, 30, 44, 42, 29, 44, 36, 34, 42,
331 const int hex_conn[] = { 6, 19, 23, 7, 8, 21, 27, 9, 19, 13, 16, 23, 21, 14, 18, 27, 7, 23, 22, 4, 9, 27,
332 25, 5, 23, 16, 15, 22, 27, 18, 17, 25, 8, 21, 27, 9, 1, 20, 26, 3, 21, 14, 18, 27,
333 20, 11, 12, 26, 9, 27, 25, 5, 3, 26, 24, 2, 27, 18, 17, 25, 26, 12, 10, 24, 1, 20,
334 26, 3, 32, 41, 45, 33, 20, 11, 12, 26, 41, 37, 39, 45, 3, 26, 24, 2, 33, 45, 43, 31,
335 26, 12, 10, 24, 45, 39, 38, 43, 32, 41, 45, 33, 28, 40, 44, 30, 41, 37, 39, 45, 40, 35,
336 36, 44, 33, 45, 43, 31, 30, 44, 42, 29, 45, 39, 38, 43, 44, 36, 34, 42 };
341 std::vector< int >
find_parents(
const int parent_conn[][L],
int num_parent,
int id )
343 std::vector< int > results;
344 for(
int i = 0; i < num_parent; ++i )
346 for(
int j = 0; j < L; ++j )
348 if( parent_conn[i][j] ==
id ) results.push_back( i + 1 );
359 std::vector< int > parents )
366 void* tag_vals[] = { &
dim, &
id };
373 std::vector< int > exp_rel, act_rel;
374 std::vector< EntityHandle >
rel;
378 exp_rel.resize( num_children );
380 std::sort( exp_rel.begin(), exp_rel.end() );
384 act_rel.resize(
rel.size() );
386 std::sort( act_rel.begin(), act_rel.end() );
387 CHECK( exp_rel == act_rel );
390 if( !parents.empty() )
393 std::sort( exp_rel.begin(), exp_rel.end() );
397 act_rel.resize(
rel.size() );
399 std::sort( act_rel.begin(), act_rel.end() );
400 CHECK( exp_rel == act_rel );
412 const int vertex_ids[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14 };
414 const int volume_surfs[2][6] = { { 1, 2, 3, 4, 5, 6 }, { 7, 8, 9, 6, 11, 12 } };
417 const int surf_curves[12][4] = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 6, 10, 4 }, { 11, 7, 9, 3 },
418 { 12, 8, 11, 2 }, { 10, 5, 12, 1 }, { 13, 14, 1, 16 }, { 17, 18, 5, 20 },
419 { 10, 18, 22, 16 }, { 0, 0, 0, 0 },
420 { 24, 20, 12, 14 }, { 22, 17, 24, 13 } };
423 const int curve_verts[24][2] = { { 1, 2 }, { 2, 3 }, { 3, 4 }, { 4, 1 }, { 5, 6 },
424 { 6, 7 }, { 7, 8 }, { 8, 5 }, { 4, 7 }, { 1, 6 },
425 { 3, 8 }, { 2, 5 }, { 9, 10 },
427 { 1, 9 }, { 13, 14 }, { 14, 6 }, { 0, 0 },
433 for(
unsigned i = 0; i < (
sizeof( vertex_ids ) /
sizeof( vertex_ids[0] ) ); ++i )
434 check_geometric_set(
mb, 0, vertex_ids[i], 0, 0, find_parents< 2 >( curve_verts, 24, vertex_ids[i] ) );
437 for(
int i = 1; i <= 24; ++i )
438 if( curve_verts[i - 1][0] )
442 for(
int i = 1; i <= 12; ++i )
443 if( surf_curves[i - 1][0] )
447 std::vector< int > empty;
448 for(
int i = 1; i <= 2; ++i )
463 Range verts, curves, surfs, vols;
468 const void* vals[] = { &
dim };
486 for( i = verts.
begin(); i != verts.
end(); ++i )
495 for( i = curves.
begin(); i != curves.
end(); ++i )
505 for( i = surfs.
begin(); i != surfs.
end(); ++i )
516 for( i = vols.
begin(); i != vols.
end(); ++i )
528 for(
int d = 0; d < 3; ++d )
530 const void* vals1[] = { &d };
533 for( i =
geom.begin(); i !=
geom.end(); ++i )
572 Range block_hexes, mesh_hexes;
575 CHECK( mesh_hexes == block_hexes );
585 void test_bc_sets(
const char* tag_name,
unsigned count,
const int* ids,
const std::vector< int > set_surfs[] )
600 std::vector< EntityHandle > handles( count, 0 );
606 for( idx = 0; idx < count; ++idx )
607 if( ids[idx] ==
id )
break;
608 CHECK( idx != count );
609 CHECK( handles[idx] == 0 );
614 std::vector< Range > exp( count );
617 for(
unsigned i = 0; i < count; ++i )
622 for(
unsigned j = 0; j < set_surfs[i].size(); ++j )
624 const void* vals[] = { &two, &set_surfs[i][j] };
636 for(
unsigned i = 0; i < count; ++i )
640 CHECK( exp[i] == act );
649 int ids[] = { 1, 2 };
650 std::vector< int > surfs[2];
651 surfs[0].push_back( 1 );
652 surfs[0].push_back( 7 );
653 surfs[1].push_back( 5 );
654 surfs[1].push_back( 11 );
660 int ids[] = { 1, 2 };
661 std::vector< int > surfs[2];
662 surfs[0].push_back( 2 );
663 surfs[0].push_back( 8 );
664 surfs[1].push_back( 3 );
665 surfs[1].push_back( 9 );
673 std::vector< EntityHandle > adj;
674 rval =
moab.get_adjacencies( &entity, 1, side_dim,
false, adj );
CHECK_ERR( rval );
676 int sub_ent_indices[4];
683 rval =
moab.get_connectivity( entity, conn, conn_len );
CHECK_ERR( rval );
685 for(
size_t i = 0; i < adj.size(); ++i )
691 rval =
moab.get_connectivity( adj[i], sub_conn, sub_len );
CHECK_ERR( rval );
693 int n = std::find( sub_conn, sub_conn + sub_len, conn[sub_ent_indices[0]] ) - sub_conn;
699 for( j = 1; j < sub_ent_corners; ++j )
700 if( conn[sub_ent_indices[j]] != sub_conn[( j + n ) % sub_ent_corners] )
break;
701 if( j == sub_ent_corners )
return adj[i];
704 for( j = 1; j < sub_ent_corners; ++j )
705 if( conn[sub_ent_indices[j]] != sub_conn[( n + sub_ent_corners - j ) % sub_ent_corners] )
break;
706 if( j == sub_ent_corners )
return adj[i];
724 if( !ho[
dim] )
continue;
729 if( !side )
continue;
733 rval =
moab.get_connectivity( side, side_conn, side_len );
CHECK_ERR( rval );
737 CHECK_EQUAL( side_conn[side_idx], conn[this_idx] );
752 std::vector< double > coords( 3 * conn_len );
753 rval =
moab.get_coords( conn, conn_len, &coords[0] );
CHECK_ERR( rval );
766 int sub_dim, sub_num;
769 int sub_conn[8], num_sub;
779 for(
int j = 0; j < num_sub; ++j )
783 double mean[3] = { 0, 0, 0 };
784 for(
int j = 0; j < num_sub; ++j )
786 int co = 3 * sub_conn[j];
787 mean[0] += coords[co];
788 mean[1] += coords[co + 1];
789 mean[2] += coords[co + 2];
812 Tag ho_tag, block_tag;
820 Tag tags[2] = { ho_tag, block_tag };
821 void* vals[2] = { ho_flags, NULL };
826 for( i = blocks.
begin(); i != blocks.
end(); ++i )
846 Range file1_ents, file2_ents;
851 file2_ents =
subtract( file2_ents, file1_ents );
860 Range file1_verts, file2_verts;
870 Range file1_elems, file2_elems;
880 Range file1_elem_verts, file2_elem_verts;
884 CHECK(
intersect( file1_elem_verts, file1_verts ) == file1_elem_verts );
885 CHECK(
intersect( file2_elem_verts, file2_verts ) == file2_elem_verts );