moab
|
00001 #include "moab/Core.hpp" 00002 #include "moab/Range.hpp" 00003 #include "moab/CN.hpp" 00004 00005 #include <iostream> 00006 #include <iomanip> 00007 #include <sstream> 00008 #include <string> 00009 #include <cstdio> 00010 #include <cstdlib> 00011 00012 #ifndef _MSC_VER 00013 #include <sys/times.h> 00014 #include <sys/resource.h> 00015 #include <unistd.h> 00016 #endif 00017 00018 static void usage( const char* argv0, bool help = false ) 00019 { 00020 std::ostream& str = help ? std::cout : std::cerr; 00021 str << "Usage: " << argv0 << " [-H|-b|-k|-m] <filename> [<filename> ...]" << std::endl 00022 << " " << argv0 << " [-H|-b|-k|-m] -T" << std::endl; 00023 if (!help) { 00024 str << " " << argv0 << " -h" << std::endl; 00025 std::exit(1); 00026 } 00027 00028 std::cerr << " -H : human readable units" << std::endl 00029 << " -b : bytes" << std::endl 00030 << " -k : kilobytes (1 kB == 1024 bytes)" << std::endl 00031 << " -m : megabytes (1 MB == 1024 kB)" << std::endl 00032 << " -g : gigabytes (1 GB == 1024 MB)" << std::endl 00033 << " -T : test mode" << std::endl 00034 << std::endl; 00035 std::exit(0); 00036 } 00037 00038 enum Units { HUMAN, BYTES, KILOBYTES, MEGABYTES, GIGABYTES }; 00039 Units UNITS = HUMAN; 00040 00041 // The core functionality of this example 00042 static void print_memory_stats( moab::Interface& mb, 00043 bool per_type = true, 00044 bool per_tag = true, 00045 bool totals = true, 00046 bool sysstats = true ); 00047 00048 // Generate a series of meshes for testing 00049 static void do_test_mode(); 00050 00051 // main routine: read any specified files and call print_memory_stats 00052 int main( int argc, char* argv[] ) 00053 { 00054 moab::ErrorCode rval; 00055 bool no_more_flags = false; 00056 bool test_mode = false; 00057 std::vector<int> input_file_list; 00058 00059 // load each file specified on command line 00060 for (int i = 1; i < argc; ++i) { 00061 if (!no_more_flags && argv[i][0] == '-') { 00062 if (!strcmp(argv[i],"-H")) 00063 UNITS = HUMAN; 00064 else if(!strcmp(argv[i],"-b")) 00065 UNITS = BYTES; 00066 else if(!strcmp(argv[i],"-k")) 00067 UNITS = KILOBYTES; 00068 else if(!strcmp(argv[i],"-m")) 00069 UNITS = MEGABYTES; 00070 else if(!strcmp(argv[i],"-g")) 00071 UNITS = GIGABYTES; 00072 else if(!strcmp(argv[i],"-T")) 00073 test_mode = true; 00074 else if(!strcmp(argv[i],"-h")) 00075 usage(argv[0],true); 00076 else if(!strcmp(argv[i],"--")) 00077 no_more_flags = true; 00078 else { 00079 std::cerr << argv[0] << ": Invalid flag: \"" << argv[i] << "\"." << std::endl << std::endl; 00080 usage(argv[0]); 00081 } 00082 } 00083 else { 00084 input_file_list.push_back(i); 00085 } 00086 } 00087 00088 if (test_mode) { 00089 do_test_mode(); 00090 if (input_file_list.empty()) 00091 return 0; 00092 } 00093 00094 moab::Core mbcore; 00095 moab::Interface& mb = mbcore; 00096 for (std::vector<int>::iterator it = input_file_list.begin(); 00097 it != input_file_list.end(); ++it) { 00098 rval = mb.load_file(argv[*it]); 00099 00100 // if file load failed, print some info and exit 00101 if (moab::MB_SUCCESS != rval) { 00102 std::string message; 00103 mb.get_last_error( message ); 00104 std::cerr << mb.get_error_string(rval) << ": " << message << std::endl 00105 << argv[*it] << ": Failed to read file." << std::endl; 00106 return 1; 00107 } 00108 00109 std::cout << "Loaded file: " << argv[*it] << std::endl; 00110 } 00111 00112 // print summary of MOAB's memory use 00113 print_memory_stats(mb); 00114 return 0; 00115 } 00116 00117 // struct to store memory stats 00118 struct MemStats { 00119 unsigned long total_storage; 00120 unsigned long total_amortized; 00121 unsigned long entity_storage; 00122 unsigned long entity_amortized; 00123 unsigned long adjacency_storage; 00124 unsigned long adjacency_amortized; 00125 unsigned long tag_storage; 00126 unsigned long tag_amortized; 00127 }; 00128 00129 // test if MemStats object indicates no memory 00130 static bool is_zero( const MemStats& stats ); 00131 00132 // populdate a MemStats structg by calling 00133 // moab::Interface::estimated_memory_use 00134 static void get_mem_stats( moab::Interface& mb, 00135 MemStats& data, 00136 moab::EntityType type = moab::MBMAXTYPE ); 00137 00138 // Formatted string representation of memory size value 00139 static std::string memstr( unsigned long val ); 00140 00141 // Get string describing tag data type 00142 static std::string tag_type_string( moab::Interface& mb, moab::Tag tag ); 00143 00144 // Get string representation of tag storage type 00145 static std::string tag_storage_string( moab::Interface& mb, moab::Tag tag ); 00146 00147 // Center 00148 static std::string center( const char* str, size_t width ); 00149 00150 void print_memory_stats( moab::Interface& mb, 00151 bool per_type, 00152 bool per_tag, 00153 bool totals, 00154 bool sysstats ) 00155 { 00156 moab::ErrorCode rval; 00157 const char ANON_TAG_NAME[] = "(anonymous)"; 00158 const int TYPE_WIDTH = 10; 00159 const int MEM_WIDTH = 7; 00160 const int MEM2_WIDTH = 2*MEM_WIDTH+1; 00161 const int MIN_TAG_NAME_WIDTH = strlen(ANON_TAG_NAME); 00162 const int DTYPE_WIDTH = 12; 00163 const int STORAGE_WIDTH = 8; 00164 00165 // per-entity-type table header 00166 MemStats stats; 00167 00168 if (per_type) { 00169 00170 std::cout.fill(' '); 00171 std::cout << std::left << std::setw(TYPE_WIDTH) << "Type" << ' ' 00172 << center("Total",MEM2_WIDTH) << ' ' 00173 << center("Entity",MEM2_WIDTH) << ' ' 00174 << center("Adjacency",MEM2_WIDTH) << ' ' 00175 << center("Tag",MEM2_WIDTH) << ' ' 00176 << std::endl << std::setw(TYPE_WIDTH) << " "; 00177 for (int i = 0; i < 4; ++i) 00178 std::cout << ' ' << std::left << std::setw(MEM_WIDTH) << "Used" 00179 << ' ' << std::left << std::setw(MEM_WIDTH) << "Alloc"; 00180 std::cout << std::endl; 00181 std::cout.fill('-'); 00182 std::cout << std::setw(TYPE_WIDTH) << '-'; 00183 for (int i = 0; i < 8; ++i) 00184 std::cout << ' ' << std::setw(MEM_WIDTH) << '-'; 00185 std::cout.fill(' '); 00186 std::cout << std::endl; 00187 00188 // per-entity-type memory use 00189 for (moab::EntityType t = moab::MBVERTEX; t != moab::MBMAXTYPE; ++t) { 00190 get_mem_stats( mb, stats, t ); 00191 if (is_zero(stats)) continue; // skip types with no allocated memory 00192 00193 std::cout << std::left << std::setw(TYPE_WIDTH) << moab::CN::EntityTypeName(t) << ' ' 00194 << std::right << std::setw(MEM_WIDTH) << memstr(stats.total_storage) << ' ' 00195 << std::right << std::setw(MEM_WIDTH) << memstr(stats.total_amortized) << ' ' 00196 << std::right << std::setw(MEM_WIDTH) << memstr(stats.entity_storage) << ' ' 00197 << std::right << std::setw(MEM_WIDTH) << memstr(stats.entity_amortized) << ' ' 00198 << std::right << std::setw(MEM_WIDTH) << memstr(stats.adjacency_storage) << ' ' 00199 << std::right << std::setw(MEM_WIDTH) << memstr(stats.adjacency_amortized) << ' ' 00200 << std::right << std::setw(MEM_WIDTH) << memstr(stats.tag_storage) << ' ' 00201 << std::right << std::setw(MEM_WIDTH) << memstr(stats.tag_amortized) << std::endl; 00202 } 00203 } // end per_type 00204 00205 if (per_tag) { 00206 // get list of tags 00207 std::vector<moab::Tag> tags; 00208 std::vector<moab::Tag>::const_iterator ti; 00209 mb.tag_get_tags( tags ); 00210 00211 // figure out required field with to fit longest tag name 00212 unsigned maxlen = MIN_TAG_NAME_WIDTH; 00213 for (ti = tags.begin(); ti != tags.end(); ++ti) { 00214 std::string name; 00215 rval = mb.tag_get_name( *ti, name ); 00216 if (moab::MB_SUCCESS != rval) 00217 continue; 00218 if (name.size() > maxlen) 00219 maxlen = name.size(); 00220 } 00221 00222 // print header for per-tag data 00223 if (!tags.empty()) { 00224 std::cout.fill(' '); 00225 std::cout << std::endl 00226 << std::left << std::setw(maxlen) << "Tag Name" << ' ' 00227 << std::left << std::setw(DTYPE_WIDTH) << "Type" << ' ' 00228 << std::left << std::setw(STORAGE_WIDTH) << "Storage" << ' ' 00229 << std::left << std::setw(MEM_WIDTH) << "Used" << ' ' 00230 << std::left << std::setw(MEM_WIDTH) << "Alloc" << std::endl; 00231 std::cout.fill('-'); 00232 std::cout << std::setw(maxlen) << '-' << ' ' 00233 << std::setw(DTYPE_WIDTH) << '-' << ' ' 00234 << std::setw(STORAGE_WIDTH) << '-' << ' ' 00235 << std::setw(MEM_WIDTH) << '-' << ' ' 00236 << std::setw(MEM_WIDTH) << '-' << std::endl; 00237 std::cout.fill(' '); 00238 } 00239 00240 // print per-tag memory use 00241 for (ti = tags.begin(); ti != tags.end(); ++ti) { 00242 std::string name; 00243 rval = mb.tag_get_name( *ti, name ); 00244 if (moab::MB_SUCCESS != rval || name.empty()) 00245 name = ANON_TAG_NAME; 00246 00247 unsigned long occupied, allocated; 00248 mb.estimated_memory_use( 0, 0, 0, 0, 0, 0, 0, 0, &*ti, 1, &occupied, &allocated ); 00249 00250 std::cout << std::left << std::setw(maxlen) << name << ' ' 00251 << std::right << std::setw(DTYPE_WIDTH) << tag_type_string(mb,*ti) << ' ' 00252 << std::right << std::setw(STORAGE_WIDTH) << tag_storage_string(mb,*ti) << ' ' 00253 << std::right << std::setw(MEM_WIDTH) << memstr(occupied) << ' ' 00254 << std::right << std::setw(MEM_WIDTH) << memstr(allocated) << std::endl; 00255 } 00256 } // end per_tag 00257 00258 if (totals) { 00259 // print summary of overall memory use 00260 get_mem_stats( mb, stats ); 00261 std::cout << std::endl 00262 << "TOTAL: (Used/Allocated)" << std::endl 00263 << "memory: " << memstr(stats.total_storage) << "/" << memstr(stats.total_amortized) << std::endl 00264 << "entity: " << memstr(stats.entity_storage) << "/" << memstr(stats.entity_amortized) << std::endl 00265 << "adjacency: " << memstr(stats.adjacency_storage) << "/" << memstr(stats.adjacency_amortized) << std::endl 00266 << "tag: " << memstr(stats.tag_storage) << "/" << memstr(stats.tag_amortized) << std::endl 00267 << std::endl; 00268 00269 } // end totals 00270 00271 if (sysstats) { 00272 std::FILE* filp = std::fopen("/proc/self/stat", "r"); 00273 unsigned long vsize; 00274 long rss; 00275 if (filp && 2 == std::fscanf(filp, 00276 "%*d " // pid 00277 "%*s " // comm 00278 "%*c " // state 00279 "%*d " // ppid 00280 "%*d " // pgrp 00281 "%*d " // session 00282 "%*d " // tty_nr 00283 "%*d " // tpgid 00284 "%*u " // flags 00285 "%*u " // minflt 00286 "%*u " // cminflt 00287 "%*u " // majflt 00288 "%*u " // cmajflt 00289 "%*u " // utime 00290 "%*u " // stime 00291 "%*d " // cutime 00292 "%*d " // cstime 00293 "%*d " // priority 00294 "%*d " // nice 00295 "%*d " // num_threads 00296 "%*d " // itrealvalue 00297 "%*u " // starttime 00298 "%lu " // vsize 00299 "%ld", // rss 00300 &vsize, &rss )) { 00301 #ifndef _MSC_VER 00302 rss *= getpagesize(); 00303 #endif 00304 std::cout << std::endl << "SYSTEM:" 00305 << std::endl << "Virtual memory: " << memstr(vsize) 00306 << std::endl << "Resident set size: " << memstr(rss) 00307 << std::endl; 00308 } 00309 else { 00310 #ifndef _MSC_VER 00311 struct rusage sysdata; 00312 if (getrusage( RUSAGE_SELF, &sysdata )) { 00313 std::cerr << "getrusage failed" << std::endl; 00314 } 00315 else { 00316 long int tmp_rss = sysdata.ru_maxrss; 00317 rss *= getpagesize(); 00318 std::cerr << std::endl << "SYSTEM:" 00319 << std::endl << "Resident set size: " << memstr(tmp_rss) 00320 << std::endl; 00321 } 00322 #endif 00323 } 00324 } // end sysstats 00325 } 00326 00327 00328 bool is_zero( const MemStats& stats ) { return stats.total_amortized == 0; } 00329 00330 void get_mem_stats( moab::Interface& mb, 00331 MemStats& data, 00332 moab::EntityType type ) 00333 { 00334 if (type != moab::MBMAXTYPE) { 00335 moab::Range range; 00336 mb.get_entities_by_type( 0, type, range ); 00337 mb.estimated_memory_use( range, 00338 &data.total_storage, 00339 &data.total_amortized, 00340 &data.entity_storage, 00341 &data.entity_amortized, 00342 &data.adjacency_storage, 00343 &data.adjacency_amortized, 00344 0, 0, 00345 &data.tag_storage, 00346 &data.tag_amortized ); 00347 } 00348 else { 00349 mb.estimated_memory_use( 0, 0, 00350 &data.total_storage, 00351 &data.total_amortized, 00352 &data.entity_storage, 00353 &data.entity_amortized, 00354 &data.adjacency_storage, 00355 &data.adjacency_amortized, 00356 0, 0, 00357 &data.tag_storage, 00358 &data.tag_amortized ); 00359 } 00360 } 00361 00362 // rounded division 00363 static unsigned long rdiv( unsigned long num, unsigned long den ) 00364 { 00365 return (num + den/2) / den; 00366 } 00367 00368 std::string memstr( unsigned long val ) 00369 { 00370 const unsigned long kb = 1024; 00371 const unsigned long mb = kb*kb; 00372 const unsigned long gb = kb*mb; 00373 const unsigned long tb = kb*gb; 00374 00375 std::ostringstream s; 00376 if (UNITS == HUMAN) { 00377 if (val >= 10*tb) 00378 s << rdiv( val, tb ) << "TB"; 00379 else if (val >= 10*gb) 00380 s << rdiv( val, gb ) << "GB"; 00381 else if (val >= 10*mb) 00382 s << rdiv( val, mb ) << "MB"; 00383 else if (val >= 10*kb) 00384 s << rdiv( val, kb ) << "kB"; 00385 else if (val > 0) 00386 s << val << " B"; 00387 else 00388 s << "0 "; 00389 } 00390 else { 00391 unsigned long den = 1; 00392 switch (UNITS) { 00393 case BYTES: den = 1; break; 00394 case KILOBYTES: den = kb; break; 00395 case MEGABYTES: den = mb; break; 00396 case GIGABYTES: den = gb; break; 00397 case HUMAN: break; // handled above, list here to suppress warning 00398 } 00399 00400 s << rdiv( val, den ); 00401 } 00402 return s.str(); 00403 } 00404 00405 std::string tag_type_string( moab::Interface& mb, moab::Tag tag ) 00406 { 00407 moab::ErrorCode rval; 00408 std::ostringstream s; 00409 00410 moab::DataType type; 00411 rval = mb.tag_get_data_type( tag, type ); 00412 if (moab::MB_SUCCESS != rval) 00413 return std::string(); 00414 00415 int typesize; 00416 std::string typestr; 00417 switch (type) { 00418 case moab::MB_TYPE_INTEGER: 00419 typestr = "int"; 00420 typesize = sizeof(int); 00421 break; 00422 case moab::MB_TYPE_DOUBLE: 00423 typestr = "double"; 00424 typesize = sizeof(double); 00425 break; 00426 case moab::MB_TYPE_HANDLE: 00427 typestr = "handle"; 00428 typesize = sizeof(moab::EntityHandle); 00429 break; 00430 case moab::MB_TYPE_BIT: 00431 typesize = 1; 00432 typestr = "bits"; 00433 break; 00434 case moab::MB_TYPE_OPAQUE: 00435 typesize = 1; 00436 typestr = "bytes"; 00437 break; 00438 default: 00439 typesize = 1; 00440 typestr = "???"; 00441 break; 00442 } 00443 00444 int size; 00445 rval = mb.tag_get_length( tag, size ); 00446 if (moab::MB_VARIABLE_DATA_LENGTH == rval) 00447 s << "VAR " << typestr; 00448 else if (moab::MB_SUCCESS == rval) 00449 s << size/typesize << " " << typestr; 00450 // else do nothing 00451 00452 return s.str(); 00453 } 00454 00455 std::string tag_storage_string( moab::Interface& mb, moab::Tag tag ) 00456 { 00457 moab::ErrorCode rval; 00458 moab::TagType type; 00459 rval = mb.tag_get_type( tag, type ); 00460 if (moab::MB_SUCCESS != rval) 00461 return std::string(); 00462 00463 switch (type) { 00464 case moab::MB_TAG_DENSE: return "dense"; 00465 case moab::MB_TAG_SPARSE: return "sparse"; 00466 case moab::MB_TAG_BIT: return "bit"; 00467 default: return "(none)"; 00468 } 00469 } 00470 00471 00472 std::string center( const char* str, size_t width ) 00473 { 00474 std::string text(str); 00475 if (text.size() >= width) 00476 return text; 00477 00478 width -= text.size(); 00479 if (1u == width) { 00480 text += " "; 00481 return text; 00482 } 00483 00484 std::ostringstream s; 00485 s << std::setw(width/2) << ' ' << text << std::setw(width/2 + width%2) << ' '; 00486 return s.str(); 00487 } 00488 00489 void do_test_mode() 00490 { 00491 const char prefix[] = "****************"; 00492 moab::Core mbcore; 00493 moab::Interface& mb = mbcore; 00494 moab::ErrorCode rval; 00495 moab::Range handles; 00496 moab::EntityHandle h; 00497 moab::Range::iterator jt, it; 00498 const unsigned N = 1000; 00499 00500 // creating some vertices 00501 double coords[3] = { 1, 2, 3 }; 00502 for (unsigned i = 0; i < N; ++i) 00503 mb.create_vertex( coords, h ); 00504 std::cout << std::endl << prefix << "Created " << N << " vertices" << std::endl; 00505 print_memory_stats( mb, true, false, true, true ); 00506 00507 for (unsigned i = 0; i < N; ++i) 00508 mb.create_vertex( coords, h ); 00509 std::cout << std::endl << prefix << "Created another " << N << " vertices" << std::endl; 00510 print_memory_stats( mb, true, false, true, true ); 00511 00512 for (int i = 0; i < 100; ++i) { 00513 for (unsigned j = 0; j < N; ++j) 00514 mb.create_vertex( coords, h ); 00515 } 00516 std::cout << std::endl << prefix << "Created another " << 100*N << " vertices" << std::endl; 00517 print_memory_stats( mb, true, false, true, true ); 00518 00519 // create some elements 00520 handles.clear(); 00521 mb.get_entities_by_type( 0, moab::MBVERTEX, handles ); 00522 it = handles.begin(); 00523 for (unsigned i = 0; i < N-2; ++i, ++it) { 00524 jt = it; 00525 moab::EntityHandle conn[3]; 00526 conn[0] = *jt; ++jt; 00527 conn[1] = *jt; ++jt; 00528 conn[2] = *jt; ++jt; 00529 mb.create_element( moab::MBTRI, conn, 3, h ); 00530 } 00531 std::cout << std::endl << prefix << "Created " << N-2 << " triangles" << std::endl; 00532 print_memory_stats( mb, true, false, true, true ); 00533 00534 it = handles.begin(); 00535 for (unsigned i = 0; i < N-3; ++i, ++it) { 00536 jt = it; 00537 moab::EntityHandle conn[4]; 00538 conn[0] = *jt; ++jt; 00539 conn[1] = *jt; ++jt; 00540 conn[2] = *jt; ++jt; 00541 conn[3] = *jt; ++jt; 00542 mb.create_element( moab::MBQUAD, conn, 4, h ); 00543 } 00544 std::cout << std::endl << prefix << "Created " << N-3 << " quads" << std::endl; 00545 print_memory_stats( mb, true, false, true, true ); 00546 00547 for (int i = 0; i < 100; ++i) { 00548 it = handles.begin(); 00549 for (unsigned j = 0; j < N-3; ++j, ++it) { 00550 jt = it; 00551 moab::EntityHandle conn[4]; 00552 conn[0] = *jt; ++jt; 00553 conn[1] = *jt; ++jt; 00554 conn[2] = *jt; ++jt; 00555 conn[3] = *jt; ++jt; 00556 mb.create_element( moab::MBQUAD, conn, 4, h ); 00557 } 00558 } 00559 std::cout << std::endl << prefix << "Created another " << 100*(N-3) << " quads" << std::endl; 00560 print_memory_stats( mb, true, false, true, true ); 00561 00562 // set global ID 00563 moab::Tag tag; 00564 rval = mb.tag_get_handle( "GLOBAL_ID", 1, moab::MB_TYPE_INTEGER, tag ); 00565 if (moab::MB_SUCCESS != rval) { 00566 std::cerr << "Failed to get GLOBAL_ID tag handle" << std::endl; 00567 return; 00568 } 00569 handles.clear(); 00570 mb.get_entities_by_type( 0, moab::MBVERTEX, handles ); 00571 int id = 1; 00572 for (it = handles.begin(); it != handles.end(); ++it) { 00573 mb.tag_set_data( tag, &*it, 1, &id ); 00574 ++id; 00575 } 00576 std::cout << std::endl << prefix << "Set global ID tag on " << handles.size() << " vertices" << std::endl; 00577 print_memory_stats( mb, true, true, true, true ); 00578 00579 handles.clear(); 00580 mb.get_entities_by_type( 0, moab::MBQUAD, handles ); 00581 id = 1; 00582 for (it = handles.begin(); it != handles.end(); ++it) { 00583 mb.tag_set_data( tag, &*it, 1, &id ); 00584 ++id; 00585 } 00586 std::cout << std::endl << prefix << "Set global ID tag on " << handles.size() << " quads" << std::endl; 00587 print_memory_stats( mb, true, true, true, true ); 00588 00589 // create and set a sparse tag 00590 mb.tag_get_handle( "mem_test_tag", 3, moab::MB_TYPE_DOUBLE, tag, moab::MB_TAG_SPARSE|moab::MB_TAG_CREAT); 00591 handles.clear(); 00592 mb.get_entities_by_type( 0, moab::MBVERTEX, handles ); 00593 for (it = handles.begin(); it != handles.end(); ++it) { 00594 mb.get_coords( &*it, 1, coords ); 00595 mb.tag_set_data( tag, &*it, 1, coords ); 00596 } 00597 std::cout << std::endl << prefix << "Copied vertex coords to sparse tag for " << handles.size() << " vertices" << std::endl; 00598 print_memory_stats( mb, true, true, true, true ); 00599 00600 // create and set bit tag 00601 mb.tag_get_handle( "mem_test_bit", 1, moab::MB_TYPE_BIT, tag, moab::MB_TAG_CREAT ); 00602 handles.clear(); 00603 mb.get_entities_by_type( 0, moab::MBTRI, handles ); 00604 for (it = handles.begin(); it != handles.end(); ++it) { 00605 char byte = '\001'; 00606 mb.tag_set_data( tag, &*it, 1, &byte ); 00607 } 00608 std::cout << std::endl << prefix << "Set 1-bit tag for " << handles.size() << " triangles" << std::endl; 00609 print_memory_stats( mb, true, true, true, true ); 00610 00611 // create vertex to element adjacency data 00612 handles.clear(); 00613 mb.get_entities_by_type( 0, moab::MBVERTEX, handles ); 00614 std::vector<moab::EntityHandle> adj_vec; 00615 mb.get_adjacencies( &*handles.begin(), 1, 2, false, adj_vec ); 00616 std::cout << std::endl << prefix << "Created vertex-to-element adjacencies" << std::endl; 00617 print_memory_stats( mb, true, false, true, true ); 00618 std::cout << std::endl; 00619 } 00620 00621