MOAB: Mesh Oriented datABase
(version 5.4.1)
|
00001 /*This function profiles the performance of the AHF datastructure */ 00002 #include <iostream> 00003 #include <cassert> 00004 #include <ctime> 00005 #include <vector> 00006 #include "moab/Core.hpp" 00007 #include "moab/Range.hpp" 00008 #include "moab/MeshTopoUtil.hpp" 00009 #include "moab/HalfFacetRep.hpp" 00010 #include "../TestUtil.hpp" 00011 #include "moab/CpuTimer.hpp" 00012 00013 #ifdef MOAB_HAVE_MPI 00014 #include "moab/ParallelComm.hpp" 00015 #include "MBParallelConventions.h" 00016 #include "moab/FileOptions.hpp" 00017 #include "MBTagConventions.hpp" 00018 #include "moab_mpi.h" 00019 #endif 00020 00021 using namespace moab; 00022 00023 #ifdef MOAB_HAVE_MPI 00024 std::string read_options; 00025 #endif 00026 00027 int number_tests_successful = 0; 00028 int number_tests_failed = 0; 00029 00030 struct query_time 00031 { 00032 double ds_construction; 00033 double vertex_to_edges_total; 00034 double vertex_to_edges_avg; 00035 double edge_to_edges_total; 00036 double edge_to_edges_avg; 00037 double vertex_to_faces_total; 00038 double vertex_to_faces_avg; 00039 double edge_to_faces_total; 00040 double edge_to_faces_avg; 00041 double face_to_faces_total; 00042 double face_to_faces_avg; 00043 double face_to_edges_total; 00044 double face_to_edges_avg; 00045 double vertex_to_cells_total; 00046 double vertex_to_cells_avg; 00047 double edge_to_cells_total; 00048 double edge_to_cells_avg; 00049 double face_to_cells_total; 00050 double face_to_cells_avg; 00051 double cell_to_cells_total; 00052 double cell_to_cells_avg; 00053 double cell_to_edges_total; 00054 double cell_to_edges_avg; 00055 double cell_to_faces_total; 00056 double cell_to_faces_avg; 00057 }; 00058 00059 struct mesh_mem 00060 { 00061 unsigned long long total_storage[2]; 00062 unsigned long long amortized_total_storage[2]; 00063 unsigned long long entity_storage[2]; 00064 unsigned long long amortized_entity_storage[2]; 00065 unsigned long long adjacency_storage[2]; 00066 unsigned long long amortized_adjacency_storage[2]; 00067 unsigned long long tag_storage[2]; 00068 unsigned long long amortized_tag_storage[2]; 00069 }; 00070 00071 void handle_error_code( ErrorCode rv, int& number_failed, int& number_successful ) 00072 { 00073 if( rv == MB_SUCCESS ) 00074 { 00075 #ifdef MOAB_HAVE_MPI 00076 int rank = 0; 00077 MPI_Comm_rank( MPI_COMM_WORLD, &rank ); 00078 if( rank == 0 ) std::cout << "Success"; 00079 #else 00080 std::cout << "Success"; 00081 #endif 00082 number_successful++; 00083 } 00084 else 00085 { 00086 std::cout << "Failure"; 00087 number_failed++; 00088 } 00089 } 00090 00091 ErrorCode adj_perf( const char* filename ) 00092 { 00093 ErrorCode error; 00094 Core moab; 00095 Interface* mbImpl = &moab; 00096 MeshTopoUtil mtu( mbImpl ); 00097 00098 struct query_time qtime; 00099 struct mesh_mem qmem; 00100 00101 #ifdef MOAB_HAVE_MPI 00102 int procs = 1; 00103 MPI_Comm_size( MPI_COMM_WORLD, &procs ); 00104 00105 if( procs > 1 ) 00106 { 00107 read_options = "PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS"; 00108 00109 error = mbImpl->load_file( filename, 0, read_options.c_str() );CHECK_ERR( error ); 00110 } 00111 else if( procs == 1 ) 00112 { 00113 #endif 00114 error = mbImpl->load_file( filename );CHECK_ERR( error ); 00115 #ifdef MOAB_HAVE_MPI 00116 } 00117 #endif 00118 00119 // Storage Costs before any call to adjacencies 00120 unsigned long long sTotS, sTAS, sES, sAES, sAS, sAAS, sTS, sATS; 00121 sTotS = sTAS = sES = sAES = sAS = sAAS = sTS = sATS = 0; 00122 mbImpl->estimated_memory_use( NULL, 0, &sTotS, &sTAS, &sES, &sAES, &sAS, &sAAS, NULL, 0, &sTS, &sATS ); 00123 00124 qmem.total_storage[0] = sTotS; 00125 qmem.amortized_total_storage[0] = sTAS; 00126 qmem.entity_storage[0] = sES; 00127 qmem.amortized_entity_storage[0] = sAES; 00128 qmem.adjacency_storage[0] = sAS; 00129 qmem.amortized_adjacency_storage[0] = sAAS; 00130 qmem.tag_storage[0] = sTS; 00131 qmem.amortized_tag_storage[0] = sATS; 00132 00133 // Create ranges for handles of explicit elements of the mixed mesh 00134 Range verts, edges, faces, cells; 00135 error = mbImpl->get_entities_by_dimension( 0, 0, verts ); 00136 error = mbImpl->get_entities_by_dimension( 0, 1, edges ); 00137 error = mbImpl->get_entities_by_dimension( 0, 2, faces ); 00138 error = mbImpl->get_entities_by_dimension( 0, 3, cells ); 00139 00140 int nverts = verts.size(); 00141 int nedges = edges.size(); 00142 int nfaces = faces.size(); 00143 int ncells = cells.size(); 00144 00145 std::cout << "MESH SIZE :: " 00146 << "NV = " << nverts << ", NE = " << nedges << ", NF = " << nfaces << ", NC = " << ncells << std::endl; 00147 00148 CpuTimer* mt = new CpuTimer; 00149 double time_start, time_avg, time_total; 00150 00151 // Perform queries 00152 std::vector< EntityHandle > adjents; 00153 Range ngbents; 00154 00155 // This call should create all the necessary ahf maps or adjacency lists 00156 time_start = mt->time_elapsed(); 00157 error = mbImpl->get_adjacencies( &*verts.begin(), 1, 1, false, adjents ); 00158 time_total = mt->time_elapsed() - time_start; 00159 qtime.ds_construction = time_total; 00160 00161 // 1D Queries 00162 00163 std::cout << "1D QUERIES Start" << std::endl; 00164 00165 // IQ1: For every vertex, obtain incident edges 00166 time_start = mt->time_elapsed(); 00167 for( Range::iterator i = verts.begin(); i != verts.end(); ++i ) 00168 { 00169 adjents.clear(); 00170 error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents ); 00171 } 00172 time_total = mt->time_elapsed() - time_start; 00173 time_avg = time_total / (double)verts.size(); 00174 00175 qtime.vertex_to_edges_total = time_total; 00176 qtime.vertex_to_edges_avg = time_avg; 00177 00178 // NQ1: For every edge, obtain neighbor edges 00179 #ifdef MOAB_HAVE_AHF 00180 time_start = mt->time_elapsed(); 00181 for( Range::iterator i = edges.begin(); i != edges.end(); ++i ) 00182 { 00183 adjents.clear(); 00184 error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents ); 00185 } 00186 time_total = mt->time_elapsed() - time_start; 00187 time_avg = time_total / (double)edges.size(); 00188 #else 00189 error = mtu.get_bridge_adjacencies( *edges.begin(), 0, 1, ngbents ); 00190 time_start = mt->time_elapsed(); 00191 for( Range::iterator i = edges.begin(); i != edges.end(); ++i ) 00192 { 00193 ngbents.clear(); 00194 error = mtu.get_bridge_adjacencies( *i, 0, 1, ngbents ); 00195 } 00196 time_total = mt->time_elapsed() - time_start; 00197 time_avg = time_total / (double)edges.size(); 00198 #endif 00199 00200 qtime.edge_to_edges_total = time_total; 00201 qtime.edge_to_edges_avg = time_avg; 00202 00203 std::cout << "1D QUERIES End" << std::endl; 00204 00205 // 2D Queries 00206 00207 std::cout << "2D QUERIES Start" << std::endl; 00208 00209 // IQ21: For every vertex, obtain incident faces 00210 time_start = mt->time_elapsed(); 00211 for( Range::iterator i = verts.begin(); i != verts.end(); ++i ) 00212 { 00213 adjents.clear(); 00214 error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents ); 00215 } 00216 time_total = mt->time_elapsed() - time_start; 00217 time_avg = time_total / (double)verts.size(); 00218 00219 qtime.vertex_to_faces_total = time_total; 00220 qtime.vertex_to_faces_avg = time_avg; 00221 00222 // IQ22: For every edge, obtain incident faces 00223 time_start = mt->time_elapsed(); 00224 for( Range::iterator i = edges.begin(); i != edges.end(); ++i ) 00225 { 00226 adjents.clear(); 00227 error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents ); 00228 } 00229 time_total = mt->time_elapsed() - time_start; 00230 time_avg = time_total / (double)edges.size(); 00231 00232 qtime.edge_to_faces_total = time_total; 00233 qtime.edge_to_faces_avg = time_avg; 00234 00235 // NQ2: For every face, obtain neighbor faces 00236 #ifdef MOAB_HAVE_AHF 00237 time_start = mt->time_elapsed(); 00238 for( Range::iterator i = faces.begin(); i != faces.end(); ++i ) 00239 { 00240 adjents.clear(); 00241 error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents ); 00242 } 00243 time_total = mt->time_elapsed() - time_start; 00244 time_avg = time_total / (double)faces.size(); 00245 #else 00246 error = mtu.get_bridge_adjacencies( *faces.begin(), 1, 2, ngbents ); 00247 time_start = mt->time_elapsed(); 00248 for( Range::iterator i = faces.begin(); i != faces.end(); ++i ) 00249 { 00250 ngbents.clear(); 00251 error = mtu.get_bridge_adjacencies( *i, 1, 2, ngbents ); 00252 } 00253 time_total = mt->time_elapsed() - time_start; 00254 time_avg = time_total / (double)faces.size(); 00255 #endif 00256 00257 qtime.face_to_faces_total = time_total; 00258 qtime.face_to_faces_avg = time_avg; 00259 00260 // DQ2: For every face, obtain its edges 00261 time_start = mt->time_elapsed(); 00262 for( Range::iterator i = faces.begin(); i != faces.end(); ++i ) 00263 { 00264 adjents.clear(); 00265 error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents ); 00266 } 00267 time_total = mt->time_elapsed() - time_start; 00268 time_avg = time_total / (double)faces.size(); 00269 00270 qtime.face_to_edges_total = time_total; 00271 qtime.face_to_edges_avg = time_avg; 00272 00273 std::cout << "2D QUERIES End" << std::endl; 00274 00275 // 3D Queries 00276 00277 std::cout << "3D QUERIES Start " << std::endl; 00278 00279 // IQ31: For every vertex, obtain incident cells 00280 time_start = mt->time_elapsed(); 00281 for( Range::iterator i = verts.begin(); i != verts.end(); ++i ) 00282 { 00283 adjents.clear(); 00284 error = mbImpl->get_adjacencies( &*i, 1, 3, false, adjents ); 00285 } 00286 time_total = mt->time_elapsed() - time_start; 00287 time_avg = time_total / (double)verts.size(); 00288 00289 qtime.vertex_to_cells_total = time_total; 00290 qtime.vertex_to_cells_avg = time_avg; 00291 00292 // IQ 32: For every edge, obtain incident cells 00293 time_start = mt->time_elapsed(); 00294 for( Range::iterator i = edges.begin(); i != edges.end(); ++i ) 00295 { 00296 adjents.clear(); 00297 error = mbImpl->get_adjacencies( &*i, 1, 3, false, adjents ); 00298 } 00299 time_total = mt->time_elapsed() - time_start; 00300 time_avg = time_total / (double)edges.size(); 00301 00302 qtime.edge_to_cells_total = time_total; 00303 qtime.edge_to_cells_avg = time_avg; 00304 00305 // IQ32: For every face, obtain incident cells 00306 time_start = mt->time_elapsed(); 00307 for( Range::iterator i = faces.begin(); i != faces.end(); ++i ) 00308 { 00309 adjents.clear(); 00310 error = mbImpl->get_adjacencies( &*i, 1, 3, false, adjents ); 00311 } 00312 time_total = mt->time_elapsed() - time_start; 00313 time_avg = time_total / (double)faces.size(); 00314 00315 qtime.face_to_cells_total = time_total; 00316 qtime.face_to_cells_avg = time_avg; 00317 00318 // NQ3: For every cell, obtain neighbor cells 00319 #ifdef MOAB_HAVE_AHF 00320 time_start = mt->time_elapsed(); 00321 for( Range::iterator i = cells.begin(); i != cells.end(); ++i ) 00322 { 00323 adjents.clear(); 00324 error = mbImpl->get_adjacencies( &*i, 1, 3, false, adjents ); 00325 } 00326 time_total = mt->time_elapsed() - time_start; 00327 time_avg = time_total / (double)cells.size(); 00328 #else 00329 error = mtu.get_bridge_adjacencies( *cells.begin(), 2, 3, ngbents ); 00330 time_start = mt->time_elapsed(); 00331 for( Range::iterator i = cells.begin(); i != cells.end(); ++i ) 00332 { 00333 ngbents.clear(); 00334 error = mtu.get_bridge_adjacencies( *i, 2, 3, ngbents ); 00335 } 00336 time_total = mt->time_elapsed() - time_start; 00337 time_avg = time_total / (double)cells.size(); 00338 #endif 00339 00340 qtime.cell_to_cells_total = time_total; 00341 qtime.cell_to_cells_avg = time_avg; 00342 00343 // DQ31: For every cell, obtain its edges 00344 time_start = mt->time_elapsed(); 00345 for( Range::iterator i = cells.begin(); i != cells.end(); ++i ) 00346 { 00347 adjents.clear(); 00348 error = mbImpl->get_adjacencies( &*i, 1, 1, false, adjents ); 00349 } 00350 time_total = mt->time_elapsed() - time_start; 00351 time_avg = time_total / (double)cells.size(); 00352 00353 qtime.cell_to_edges_total = time_total; 00354 qtime.cell_to_edges_avg = time_avg; 00355 00356 // DQ32: For every cell, obtain its faces 00357 time_start = mt->time_elapsed(); 00358 for( Range::iterator i = cells.begin(); i != cells.end(); ++i ) 00359 { 00360 adjents.clear(); 00361 error = mbImpl->get_adjacencies( &*i, 1, 2, false, adjents ); 00362 } 00363 time_total = mt->time_elapsed() - time_start; 00364 time_avg = time_total / (double)cells.size(); 00365 00366 qtime.cell_to_faces_total = time_total; 00367 qtime.cell_to_faces_avg = time_avg; 00368 00369 std::cout << "3D QUERIES End" << std::endl; 00370 00371 // Storage Costs after calling ahf deinitialize 00372 unsigned long long eTotS, eTAS, eES, eAES, eAS, eAAS, eTS, eATS; 00373 eTotS = eTAS = eES = eAES = eAS = eAAS = eTS = eATS = 0; 00374 mbImpl->estimated_memory_use( NULL, 0, &eTotS, &eTAS, &eES, &eAES, &eAS, &eAAS, NULL, 0, &eTS, &eATS ); 00375 00376 qmem.total_storage[1] = eTotS; 00377 qmem.amortized_total_storage[1] = eTAS; 00378 qmem.entity_storage[1] = eES; 00379 qmem.amortized_entity_storage[1] = eAES; 00380 qmem.adjacency_storage[1] = eAS; 00381 qmem.amortized_adjacency_storage[1] = eAAS; 00382 qmem.tag_storage[1] = eTS; 00383 qmem.amortized_tag_storage[1] = eATS; 00384 00385 // Print times 00386 std::cout << std::endl; 00387 std::cout << " Data Structure Construction Time = " << qtime.ds_construction << " Secs" << std::endl; 00388 std::cout << std::endl; 00389 std::cout << "Query times in Seconds" << std::endl; 00390 #ifdef MOAB_HAVE_AHF 00391 std::cout << "QUERY: Vertex -> Edges :: MOAB_AHF: Average time = " << qtime.vertex_to_edges_avg; 00392 std::cout << ", Total time = " << qtime.vertex_to_edges_total << std::endl; 00393 std::cout << std::endl; 00394 #else 00395 std::cout << "QUERY: Vertex -> Edges :: MOAB: Average time = " << qtime.vertex_to_edges_avg; 00396 std::cout << ", Total time = " << qtime.vertex_to_edges_total << std::endl; 00397 std::cout << std::endl; 00398 #endif 00399 00400 #ifdef MOAB_HAVE_AHF 00401 std::cout << "QUERY: Edge -> Edges :: MOAB_AHF: Average time = " << qtime.edge_to_edges_avg; 00402 std::cout << ", Total time = " << qtime.edge_to_edges_total << std::endl; 00403 std::cout << std::endl; 00404 #else 00405 std::cout << "QUERY: Edge -> Edges :: MOAB: Average time = " << qtime.edge_to_edges_avg; 00406 std::cout << ", Total time = " << qtime.edge_to_edges_total << std::endl; 00407 std::cout << std::endl; 00408 #endif 00409 00410 #ifdef MOAB_HAVE_AHF 00411 std::cout << "QUERY: Vertex -> Faces :: MOAB_AHF: Average time = " << qtime.vertex_to_faces_avg; 00412 std::cout << ", Total time = " << qtime.vertex_to_faces_total << std::endl; 00413 std::cout << std::endl; 00414 #else 00415 std::cout << "QUERY: Vertex -> Faces :: MOAB: Average time = " << qtime.vertex_to_faces_avg; 00416 std::cout << ", Total time = " << qtime.vertex_to_faces_total << std::endl; 00417 std::cout << std::endl; 00418 #endif 00419 00420 #ifdef MOAB_HAVE_AHF 00421 std::cout << "QUERY: Edge -> Faces :: MOAB_AHF: Average time = " << qtime.edge_to_faces_avg; 00422 std::cout << ", Total time = " << qtime.edge_to_faces_total << std::endl; 00423 std::cout << std::endl; 00424 #else 00425 std::cout << "QUERY: Edge -> Faces :: MOAB: Average time = " << qtime.edge_to_faces_avg; 00426 std::cout << ", Total time = " << qtime.edge_to_faces_total << std::endl; 00427 std::cout << std::endl; 00428 #endif 00429 00430 #ifdef MOAB_HAVE_AHF 00431 std::cout << "QUERY: Face -> Faces :: MOAB_AHF: Average time = " << qtime.face_to_faces_avg; 00432 std::cout << ", Total time = " << qtime.face_to_faces_total << std::endl; 00433 std::cout << std::endl; 00434 #else 00435 std::cout << "QUERY: Face -> Faces :: MOAB: Average time = " << qtime.face_to_faces_avg; 00436 std::cout << ", Total time = " << qtime.face_to_faces_total << std::endl; 00437 std::cout << std::endl; 00438 #endif 00439 00440 #ifdef MOAB_HAVE_AHF 00441 std::cout << "QUERY: Face -> Edges :: MOAB_AHF: Average time = " << qtime.face_to_edges_avg; 00442 std::cout << ", Total time = " << qtime.face_to_edges_total << std::endl; 00443 std::cout << std::endl; 00444 #else 00445 std::cout << "QUERY: Face -> Edges :: MOAB: Average time = " << qtime.face_to_edges_avg; 00446 std::cout << ", Total time = " << qtime.face_to_edges_total << std::endl; 00447 std::cout << std::endl; 00448 #endif 00449 00450 #ifdef MOAB_HAVE_AHF 00451 std::cout << "QUERY: Vertex -> Cells :: MOAB_AHF: Average time = " << qtime.vertex_to_cells_avg; 00452 std::cout << ", Total time = " << qtime.vertex_to_cells_total << std::endl; 00453 std::cout << std::endl; 00454 #else 00455 std::cout << "QUERY: Vertex -> Cells :: MOAB: Average time = " << qtime.vertex_to_cells_avg; 00456 std::cout << ", Total time = " << qtime.vertex_to_cells_total << std::endl; 00457 std::cout << std::endl; 00458 #endif 00459 00460 #ifdef MOAB_HAVE_AHF 00461 std::cout << "QUERY: Edge -> Cells :: MOAB_AHF: Average time = " << qtime.edge_to_cells_avg; 00462 std::cout << ", Total time = " << qtime.edge_to_cells_total << std::endl; 00463 std::cout << std::endl; 00464 #else 00465 std::cout << "QUERY: Edge -> Cells :: MOAB: Average time = " << qtime.edge_to_cells_avg; 00466 std::cout << ", Total time = " << qtime.edge_to_cells_total << std::endl; 00467 std::cout << std::endl; 00468 #endif 00469 00470 #ifdef MOAB_HAVE_AHF 00471 std::cout << "QUERY: Face -> Cells :: MOAB_AHF: Average time = " << qtime.face_to_cells_avg; 00472 std::cout << ", Total time = " << qtime.face_to_cells_total << std::endl; 00473 std::cout << std::endl; 00474 #else 00475 std::cout << "QUERY: Face -> Cells :: MOAB: Average time = " << qtime.face_to_cells_avg; 00476 std::cout << ", Total time = " << qtime.face_to_cells_total << std::endl; 00477 std::cout << std::endl; 00478 #endif 00479 00480 #ifdef MOAB_HAVE_AHF 00481 std::cout << "QUERY: Cell -> Cells :: MOAB_AHF: Average time = " << qtime.cell_to_cells_avg; 00482 std::cout << ", Total time = " << qtime.cell_to_cells_total << std::endl; 00483 std::cout << std::endl; 00484 #else 00485 std::cout << "QUERY: Cell -> Cells :: MOAB: Average time = " << qtime.cell_to_cells_avg; 00486 std::cout << ", Total time = " << qtime.cell_to_cells_total << std::endl; 00487 std::cout << std::endl; 00488 #endif 00489 00490 #ifdef MOAB_HAVE_AHF 00491 std::cout << "QUERY: Cell -> Edges :: MOAB_AHF: Average time = " << qtime.cell_to_edges_avg; 00492 std::cout << ", Total time = " << qtime.cell_to_edges_total << std::endl; 00493 std::cout << std::endl; 00494 #else 00495 std::cout << "QUERY: Cell -> Edges :: MOAB: Average time = " << qtime.cell_to_edges_avg; 00496 std::cout << ", Total time = " << qtime.cell_to_edges_total << std::endl; 00497 std::cout << std::endl; 00498 #endif 00499 00500 #ifdef MOAB_HAVE_AHF 00501 std::cout << "QUERY: Cell -> Faces :: MOAB_AHF: Average time = " << qtime.cell_to_faces_avg; 00502 std::cout << ", Total time = " << qtime.cell_to_faces_total << std::endl; 00503 std::cout << std::endl; 00504 #else 00505 std::cout << "QUERY: Cell -> Faces :: MOAB: Average time = " << qtime.cell_to_faces_avg; 00506 std::cout << ", Total time = " << qtime.cell_to_faces_total << std::endl; 00507 std::cout << std::endl; 00508 #endif 00509 00510 // Print Storage 00511 std::cout << std::endl; 00512 for( int i = 0; i < 2; i++ ) 00513 { 00514 if( i == 0 ) 00515 std::cout << "STORAGE BEFORE CALLING ADJACENCIES" << std::endl; 00516 else 00517 std::cout << "STORAGE AFTER CALLING ADJACENCIES" << std::endl; 00518 00519 std::cout << "Total storage = " << qmem.total_storage[i] << std::endl; 00520 std::cout << "Total amortized storage = " << qmem.amortized_total_storage[i] << std::endl; 00521 std::cout << std::endl; 00522 00523 std::cout << "Entity storage = " << qmem.entity_storage[i] << std::endl; 00524 std::cout << "Amortized entity storage = " << qmem.amortized_entity_storage[i] << std::endl; 00525 std::cout << std::endl; 00526 00527 std::cout << "Adjacency storage = " << qmem.adjacency_storage[i] << std::endl; 00528 std::cout << "Amortized adjacency storage = " << qmem.amortized_adjacency_storage[i] << std::endl; 00529 std::cout << std::endl; 00530 00531 std::cout << "Tag storage = " << qmem.tag_storage[i] << std::endl; 00532 std::cout << "Amortized tag storage = " << qmem.amortized_tag_storage[i] << std::endl; 00533 std::cout << std::endl; 00534 } 00535 00536 double total_time = qtime.vertex_to_edges_total + qtime.edge_to_edges_total + qtime.vertex_to_faces_total + 00537 qtime.edge_to_faces_total + qtime.face_to_faces_total + qtime.face_to_edges_total + 00538 qtime.vertex_to_cells_total + qtime.edge_to_cells_total + qtime.face_to_cells_total + 00539 qtime.cell_to_cells_total + qtime.cell_to_edges_total + qtime.cell_to_faces_total; 00540 00541 // Print values in a line to aid data copying later 00542 std::cout << qtime.ds_construction << " " << total_time << " " << qmem.entity_storage[1] << " " 00543 << qmem.adjacency_storage[1] << " " << qtime.vertex_to_edges_avg << " " << qtime.edge_to_edges_avg 00544 << " " << qtime.vertex_to_faces_avg << " " << qtime.edge_to_faces_avg << " " << qtime.face_to_faces_avg 00545 << " " << qtime.face_to_edges_avg << " " << qtime.vertex_to_cells_avg << " " << qtime.edge_to_cells_avg 00546 << " " << qtime.face_to_cells_avg << " " << qtime.cell_to_cells_avg << " " << qtime.cell_to_edges_avg 00547 << " " << qtime.cell_to_faces_avg << std::endl; 00548 00549 delete mt; 00550 return MB_SUCCESS; 00551 } 00552 00553 int main( int argc, char* argv[] ) 00554 { 00555 00556 #ifdef MOAB_HAVE_MPI 00557 MPI_Init( &argc, &argv ); 00558 00559 int nprocs, rank; 00560 MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); 00561 MPI_Comm_rank( MPI_COMM_WORLD, &rank ); 00562 #endif 00563 00564 std::string filename; 00565 #ifdef MOAB_HAVE_HDF5 00566 filename = TestDir + "unittest/32hex_ef.h5m"; 00567 #else 00568 filename = TestDir + "unittest/hexes_mixed.vtk"; 00569 #endif 00570 00571 if( argc == 1 ) 00572 { 00573 #ifdef MOAB_HAVE_MPI 00574 if( rank == 0 ) std::cout << "Using default input file:" << filename << std::endl; 00575 #else 00576 std::cout << "Using default input file:" << filename << std::endl; 00577 #endif 00578 } 00579 00580 else if( argc == 2 ) 00581 filename = argv[1]; 00582 else 00583 { 00584 std::cerr << "Usage: " << argv[0] << " [filename]" << std::endl; 00585 return 1; 00586 } 00587 00588 ErrorCode result; 00589 00590 #ifdef MOAB_HAVE_MPI 00591 if( rank == 0 ) std::cout << " para_adj_perf: "; 00592 #else 00593 std::cout << "adj_perf:"; 00594 #endif 00595 00596 result = adj_perf( filename.c_str() ); 00597 handle_error_code( result, number_tests_failed, number_tests_successful ); 00598 std::cout << "\n"; 00599 00600 #ifdef MOAB_HAVE_MPI 00601 MPI_Finalize(); 00602 #endif 00603 00604 return number_tests_failed; 00605 }