24 code =
mb.get_error_string( err );
25 std::cerr <<
"Error: " << code << std::endl;
26 if( !message.empty() ) std::cerr <<
" " << message << std::endl;
30 #define CHKERR( err ) \
33 if( moab::MB_SUCCESS != ( err ) ) \
35 print_error( mb, ( err ) ); \
36 std::cerr << "Unexpected failure at: " << __FILE__ << ":" << __LINE__ << std::endl; \
53 std::cout <<
"Hex mesh file name: ";
60 rval =
mb.load_file( filename.c_str() );
64 std::cerr << filename <<
": file load failed" << std::endl;
73 std::cerr << filename <<
": file containd no hexahedra" << std::endl;
88 std::cout <<
"Point coordinates: ";
89 if( !( std::cin >> point[0] >> point[1] >> point[2] ) )
break;
92 rval = tool.leaf_containing_point( tree_root, point, leaf );
CHKERR( rval );
95 std::cout <<
"Point is not contained in any hexahedron." << std::endl;
112 std::vector< moab::EntityHandle > hexes;
116 std::vector< moab::EntityHandle >::const_iterator i;
117 for( i = hexes.begin(); i != hexes.end(); ++i )
119 rval =
mb.get_connectivity( *i, conn, conn_len );
CHKERR( rval );
120 rval =
mb.get_coords( conn, 8, &coords[0][0] );
CHKERR( rval );
131 int id =
mb.id_from_handle( hex );
136 mb.get_connectivity( hex, conn, conn_len );
139 double coords[3 * 8];
140 mb.get_coords( conn, 8, coords );
143 std::cout <<
" Point is in hex " <<
id <<
" with corners: " << std::endl;
144 for(
int i = 0; i < 8; ++i )
146 std::cout <<
" (" << coords[3 * i] <<
", " << coords[3 * i + 1] <<
", " << coords[3 * i + 2] <<
")"