26 static const char polyg[] =
STRINGIFY( MESHDIR )
"/io/poly8-10.vtk";
27 static const char polyh[] =
STRINGIFY( MESHDIR )
"/io/polyhedra.vtk";
31 static const char ho_file[] =
"ho_test.g";
33 static const char alt_file[] =
"hex_2x2x2_ss.exo";
34 static const char polyg[] =
"poly8-10.vtk";
35 static const char polyh[] =
"polyhedra.vtk";
36 static const char rpolyg[] =
"polyg.exo";
37 static const char rpolyh[] =
"polyh.exo";
47 void test_read_side(
int sideset_id, EntityType sideset_type,
int sideset_nodes_per_elem,
bool shell_side =
false );
191 std::cout <<
"Failed to load input file: " <<
file_one << std::endl;
192 std::string error_reason;
194 std::cout << error_reason << std::endl;
221 const double exp2[] = { 1.5, -1.5, 3.5 };
227 const double exp9[] = { 1, -2, 3.5 };
233 const double exp7[] = { 0.5, -2, 3.5 };
254 std::vector< EntityHandle > conn;
284 std::vector< EntityHandle > conn;
309 std::vector< EntityHandle > conn;
336 std::vector< EntityHandle > conn;
367 std::vector< EntityHandle > conn;
394 std::string file_name =
"mb_write.g";
412 const int negone = -1;
428 iter = temp_range.
begin();
429 end_iter = temp_range.
end();
432 std::vector< EntityHandle > temp_vec;
433 for( ; iter != end_iter; ++iter )
435 if(
ID_FROM_HANDLE( *iter ) % 2 == 0 ) temp_vec.push_back( *iter );
445 iter = temp_range.
begin();
446 for( ; iter != end_iter; ++iter )
449 temp_vec.push_back( *iter );
472 iter = temp_range.
begin();
473 end_iter = temp_range.
end();
477 for( ; iter != end_iter; ++iter )
479 if(
ID_FROM_HANDLE( *iter ) % 2 == 0 ) temp_vec.push_back( *iter );
489 iter = temp_range.
begin();
490 for( ; iter != end_iter; ++iter )
493 temp_vec.push_back( *iter );
509 std::vector< EntityHandle > nodes1, entity_vec;
510 std::copy( temp_range.
begin(), temp_range.
end(), std::back_inserter( entity_vec ) );
512 assert( nodes1.size() == 4 * temp_range.
size() );
514 std::vector< double > coords( 3 * nodes1.size() );
520 if( coords[12 * k] == 2.5 && coords[12 * k + 3] == 2.5 && coords[12 * k + 6] == 2.5 &&
521 coords[12 * k + 9] == 2.5 )
522 temp_vec.push_back( *it );
525 result = MB->
add_entities( meshset_a, ( temp_vec.empty() ) ? NULL : &temp_vec[0], temp_vec.size() );
CHECK_ERR( result );
526 result = MB->
add_entities( block_of_shells, ( temp_vec.empty() ) ? NULL : &temp_vec[0], temp_vec.size() );
CHECK_ERR( result );
536 int reverse_value = -1;
542 iter = temp_range.
begin();
543 end_iter = temp_range.
end();
546 for( ; iter != end_iter; ++iter )
548 std::vector< EntityHandle > nodes;
551 bool not_equal_2_5 =
true;
552 for(
unsigned int ku = 0; ku < nodes.size(); ku++ )
554 double coords2[3] = { 0 };
558 if( coords2[0] == 2.5 )
560 not_equal_2_5 =
false;
565 if( not_equal_2_5 && nodes.size() > 0 )
567 temp_vec.push_back( *iter );
580 MB->
add_entities( meshset_c, &temp_vec[0], temp_vec.size() );
581 MB->
add_entities( block_of_shells, &temp_vec[0], temp_vec.size() );
588 temp_vec.push_back( meshset_a );
589 temp_vec.push_back( meshset_b );
590 temp_vec.push_back( meshset_c );
592 MB->
add_entities( meshset_abc, &temp_vec[0], temp_vec.size() );
617 Range nodes_of_quads;
618 iter = temp_range.
begin();
619 end_iter = temp_range.
end();
621 for( ; iter != end_iter; ++iter )
623 std::vector< EntityHandle > nodes;
626 for(
unsigned int ku = 0; ku < nodes.size(); ku++ )
627 nodes_of_quads.
insert( nodes[ku] );
630 iter = nodes_of_quads.
begin();
631 end_iter = nodes_of_quads.
end();
635 for( ; iter != end_iter; ++iter )
637 if(
ID_FROM_HANDLE( *iter ) % 2 == 0 ) temp_vec.push_back( *iter );
639 MB->
add_entities( nodeset_ms, &temp_vec[0], temp_vec.size() );
647 iter = nodes_of_quads.
begin();
648 end_iter = nodes_of_quads.
end();
649 for( ; iter != end_iter; ++iter )
652 temp_vec.push_back( *iter );
654 MB->
add_entities( ms_of_nodeset_ms, &temp_vec[0], temp_vec.size() );
660 file_name =
"mb_write2.g";
661 std::vector< EntityHandle > output_list;
662 output_list.push_back( block_ms );
663 output_list.push_back( sideset_ms );
664 output_list.push_back( meshset_abc );
665 output_list.push_back( nodeset_ms );
666 output_list.push_back( block_of_shells );
667 result = MB->
write_mesh( file_name.c_str(), &output_list[0], output_list.size() );
CHECK_ERR( result );
680 int has_mid_nodes[4];
743 const int num_types =
sizeof( types ) /
sizeof( types[0] );
744 for(
int i = 0; i < num_types; ++i )
755 const char*
tmp_file =
"exodus_test_tmp.g";
759 int write_set_list_len = 0;
760 rval = write_mb.
write_file(
tmp_file,
"EXODUS", 0, write_set_list, write_set_list_len );
788 std::vector< double > coords( 3 * conn_len );
789 rval =
moab.get_coords( conn, conn_len, &coords[0] );
CHECK_ERR( rval );
802 int sub_dim, sub_num;
805 int sub_conn[8], num_sub;
815 for(
int j = 0; j < num_sub; ++j )
819 double mean[3] = { 0, 0, 0 };
820 for(
int j = 0; j < num_sub; ++j )
822 int co = 3 * sub_conn[j];
823 mean[0] += coords[co];
824 mean[1] += coords[co + 1];
825 mean[2] += coords[co + 2];
841 Tag ho_tag, block_tag;
842 const int negone = -1;
844 const int mids[] = { -1, -1, -1, -1 };
849 Tag tags[2] = { ho_tag, block_tag };
850 const void* vals[2] = { has_mid_nodes, NULL };
857 if( n > 0 )
return *i;
868 const int negone = -1;
871 const void* tag_vals[] = { &sideset_id };
875 return side_sets.
front();
884 Core mb_impl1, mb_impl2;
885 Interface &mb1 = mb_impl1, &mb2 = mb_impl2;
904 void test_read_side(
int id, EntityType sideset_type,
int sideset_nodes_per_elem,
bool shell_side )
920 if( shell_side )
return;
935 void test_read_ids_common(
const char* file_name,
const char* tag_name,
const int* expected_vals,
int num_expected )
941 std::vector< int > values;
944 std::vector< int > expected( expected_vals, expected_vals + num_expected );
945 std::sort( values.begin(), values.end() );
946 std::sort( expected.begin(), expected.end() );
952 const int expected[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
958 const int expected[] = { 1, 2, 3, 4 };
973 const double exp[] = { 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1 };