- Examples
- GetEntities.cpp.
Definition at line 23 of file GetEntities.cpp.
24 {
25 if( argc > 1 )
26 {
27
28 test_file_name = argv[1];
29 }
30
31
32 Core* mb = new( std::nothrow ) Core;
33 if( NULL == mb ) return 1;
34 ErrorCode rval = mb->load_mesh( test_file_name.c_str() );MB_CHK_ERR( rval );
35
36 Range ents;
37
38
39 rval = mb->get_entities_by_handle( 0, ents );MB_CHK_ERR( rval );
40
41 for( Range::iterator it = ents.begin(); it != ents.end(); ++it )
42 {
43 if( MBVERTEX == mb->type_from_handle( *it ) )
44 {
45 Range adjs;
46 rval = mb->get_adjacencies( &( *it ), 1, 3, false, adjs );MB_CHK_ERR( rval );
47 cout << "Vertex " << mb->id_from_handle( *it ) << " adjacencies:" << endl;
48 adjs.print();
49 }
50 else if( mb->type_from_handle( *it ) < MBENTITYSET )
51 {
52 const EntityHandle* connect;
53 int num_connect;
54 rval = mb->get_connectivity( *it, connect, num_connect );MB_CHK_ERR( rval );
55 cout << CN::EntityTypeName( mb->type_from_handle( *it ) ) << " " << mb->id_from_handle( *it )
56 << " vertex connectivity is: ";
57 for( int i = 0; i < num_connect; i++ )
58 cout << mb->id_from_handle( connect[i] ) << " ";
59 cout << endl;
60 }
61 }
62
63 delete mb;
64
65 return 0;
66 }
References moab::Range::begin(), moab::Range::end(), moab::CN::EntityTypeName(), ErrorCode, moab::Core::get_adjacencies(), moab::Core::get_connectivity(), moab::Core::get_entities_by_handle(), moab::Core::id_from_handle(), moab::Core::load_mesh(), mb, MB_CHK_ERR, MBENTITYSET, MBVERTEX, moab::Range::print(), test_file_name, and moab::Core::type_from_handle().