MOAB: Mesh Oriented datABase
(version 5.4.1)
|
00001 #include "TestUtil.hpp" 00002 #include "moab/Core.hpp" 00003 #include "moab/ParallelComm.hpp" 00004 #include "moab/ProgOptions.hpp" 00005 #include "MBParallelConventions.h" 00006 #include "moab/ReadUtilIface.hpp" 00007 #include "MBTagConventions.hpp" 00008 00009 #include <sstream> 00010 00011 using namespace moab; 00012 00013 std::string example = TestDir + "unittest/io/mpasx1.642.t.2.nc"; 00014 00015 void test_read_onevar_trivial(); 00016 void test_read_onevar_trivial_no_mixed_elements(); 00017 #if defined( MOAB_HAVE_MPI ) && defined( MOAB_HAVE_ZOLTAN ) 00018 void test_read_onevar_rcbzoltan(); 00019 void test_read_onevar_rcbzoltan_no_mixed_elements(); 00020 #endif 00021 00022 void test_read_mesh_parallel_trivial(); 00023 void test_read_mesh_parallel_trivial_no_mixed_elements(); 00024 #if defined( MOAB_HAVE_MPI ) && defined( MOAB_HAVE_ZOLTAN ) 00025 void test_read_mesh_parallel_rcbzoltan(); 00026 void test_read_mesh_parallel_rcbzoltan_no_mixed_elements(); 00027 #endif 00028 00029 void test_gather_onevar_on_rank0(); 00030 void test_gather_onevar_on_rank1(); 00031 00032 void test_multiple_loads_of_same_file(); 00033 void test_multiple_loads_of_same_file_no_mixed_elements(); 00034 00035 // Helper functions 00036 void read_one_cell_var( bool rcbzoltan, bool no_mixed_elements ); 00037 void read_mesh_parallel( bool rcbzoltan, bool no_mixed_elements ); 00038 void gather_one_cell_var( int gather_set_rank ); 00039 void multiple_loads_of_same_file( bool no_mixed_elements ); 00040 00041 std::string read_options; 00042 const double eps = 1e-20; 00043 00044 int main( int argc, char* argv[] ) 00045 { 00046 MPI_Init( &argc, &argv ); 00047 int result = 0; 00048 00049 result += RUN_TEST( test_read_onevar_trivial ); 00050 result += RUN_TEST( test_read_onevar_trivial_no_mixed_elements ); 00051 #if defined( MOAB_HAVE_MPI ) && defined( MOAB_HAVE_ZOLTAN ) 00052 result += RUN_TEST( test_read_onevar_rcbzoltan ); 00053 result += RUN_TEST( test_read_onevar_rcbzoltan_no_mixed_elements ); 00054 #endif 00055 00056 result += RUN_TEST( test_read_mesh_parallel_trivial ); 00057 result += RUN_TEST( test_read_mesh_parallel_trivial_no_mixed_elements ); 00058 #if defined( MOAB_HAVE_MPI ) && defined( MOAB_HAVE_ZOLTAN ) 00059 result += RUN_TEST( test_read_mesh_parallel_rcbzoltan ); 00060 result += RUN_TEST( test_read_mesh_parallel_rcbzoltan_no_mixed_elements ); 00061 #endif 00062 00063 result += RUN_TEST( test_gather_onevar_on_rank0 ); 00064 result += RUN_TEST( test_gather_onevar_on_rank1 ); 00065 00066 result += RUN_TEST( test_multiple_loads_of_same_file ); 00067 result += RUN_TEST( test_multiple_loads_of_same_file_no_mixed_elements ); 00068 00069 MPI_Finalize(); 00070 return result; 00071 } 00072 00073 void test_read_onevar_trivial() 00074 { 00075 read_one_cell_var( false, false ); 00076 } 00077 00078 void test_read_onevar_trivial_no_mixed_elements() 00079 { 00080 read_one_cell_var( false, true ); 00081 } 00082 00083 void test_read_onevar_rcbzoltan() 00084 { 00085 read_one_cell_var( true, false ); 00086 } 00087 00088 void test_read_onevar_rcbzoltan_no_mixed_elements() 00089 { 00090 read_one_cell_var( true, true ); 00091 } 00092 00093 void test_read_mesh_parallel_trivial() 00094 { 00095 read_mesh_parallel( false, false ); 00096 } 00097 00098 void test_read_mesh_parallel_trivial_no_mixed_elements() 00099 { 00100 read_mesh_parallel( false, true ); 00101 } 00102 00103 void test_read_mesh_parallel_rcbzoltan() 00104 { 00105 read_mesh_parallel( true, false ); 00106 } 00107 00108 void test_read_mesh_parallel_rcbzoltan_no_mixed_elements() 00109 { 00110 read_mesh_parallel( true, true ); 00111 } 00112 00113 void test_gather_onevar_on_rank0() 00114 { 00115 gather_one_cell_var( 0 ); 00116 } 00117 00118 void test_gather_onevar_on_rank1() 00119 { 00120 gather_one_cell_var( 1 ); 00121 } 00122 00123 void test_multiple_loads_of_same_file() 00124 { 00125 multiple_loads_of_same_file( false ); 00126 } 00127 00128 void test_multiple_loads_of_same_file_no_mixed_elements() 00129 { 00130 multiple_loads_of_same_file( true ); 00131 } 00132 00133 // Helper functions 00134 void read_one_cell_var( bool rcbzoltan, bool no_mixed_elements ) 00135 { 00136 Core moab; 00137 Interface& mb = moab; 00138 00139 read_options = "PARALLEL=READ_PART;PARTITION_METHOD=TRIVIAL;NO_EDGES;VARIABLE=ke"; 00140 if( rcbzoltan ) read_options = "PARALLEL=READ_PART;PARTITION_METHOD=RCBZOLTAN;NO_EDGES;VARIABLE=ke"; 00141 00142 if( no_mixed_elements ) read_options += ";NO_MIXED_ELEMENTS"; 00143 00144 ErrorCode rval = mb.load_file( example.c_str(), NULL, read_options.c_str() );CHECK_ERR( rval ); 00145 00146 // Get local edges 00147 Range local_edges; 00148 rval = mb.get_entities_by_type( 0, MBEDGE, local_edges );CHECK_ERR( rval ); 00149 CHECK_EQUAL( (size_t)0, local_edges.size() ); 00150 00151 // Get local cells 00152 Range local_cells; 00153 rval = mb.get_entities_by_type( 0, MBPOLYGON, local_cells );CHECK_ERR( rval ); 00154 00155 Tag gid_tag = mb.globalId_tag(); 00156 00157 std::vector< int > gids( local_cells.size() ); 00158 rval = mb.tag_get_data( gid_tag, local_cells, &gids[0] ); 00159 Range local_cell_gids; 00160 std::copy( gids.rbegin(), gids.rend(), range_inserter( local_cell_gids ) ); 00161 00162 ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 ); 00163 int procs = pcomm->proc_config().proc_size(); 00164 int rank = pcomm->proc_config().proc_rank(); 00165 00166 // Make check runs this test on two processors 00167 if( 2 == procs ) 00168 { 00169 CHECK_EQUAL( (size_t)321, local_cells.size() ); 00170 CHECK_EQUAL( (size_t)321, local_cell_gids.size() ); 00171 00172 // Check tag for cell variable ke at timestep 0 00173 Tag ke_tag0; 00174 rval = mb.tag_get_handle( "ke0", 1, MB_TYPE_DOUBLE, ke_tag0 );CHECK_ERR( rval ); 00175 00176 // Check tag for cell variable ke at timestep 1 00177 Tag ke_tag1; 00178 rval = mb.tag_get_handle( "ke1", 1, MB_TYPE_DOUBLE, ke_tag1 );CHECK_ERR( rval ); 00179 00180 // Get ke0 and ke1 tag values on 3 local cells 00181 EntityHandle cell_ents[] = { local_cells[0], local_cells[160], local_cells[320] }; 00182 double ke0_val[3]; 00183 rval = mb.tag_get_data( ke_tag0, cell_ents, 3, ke0_val );CHECK_ERR( rval ); 00184 double ke1_val[3]; 00185 rval = mb.tag_get_data( ke_tag1, cell_ents, 3, ke1_val );CHECK_ERR( rval ); 00186 00187 if( rcbzoltan ) 00188 { 00189 00190 CHECK_EQUAL( (size_t)1, local_cells.psize() ); 00191 CHECK_EQUAL( (size_t)37, local_cell_gids.psize() ); 00192 00193 if( 0 == rank ) 00194 { 00195 CHECK_EQUAL( 1, (int)local_cell_gids[0] ); 00196 CHECK_EQUAL( 284, (int)local_cell_gids[160] ); 00197 CHECK_EQUAL( 630, (int)local_cell_gids[320] ); 00198 00199 CHECK_REAL_EQUAL( 15.001, ke0_val[0], eps ); 00200 CHECK_REAL_EQUAL( 16.284, ke0_val[1], eps ); 00201 CHECK_REAL_EQUAL( 16.630, ke0_val[2], eps ); 00202 CHECK_REAL_EQUAL( 25.001, ke1_val[0], eps ); 00203 CHECK_REAL_EQUAL( 26.284, ke1_val[1], eps ); 00204 CHECK_REAL_EQUAL( 26.630, ke1_val[2], eps ); 00205 } 00206 else if( 1 == rank ) 00207 { 00208 CHECK_EQUAL( 4, (int)local_cell_gids[0] ); 00209 CHECK_EQUAL( 341, (int)local_cell_gids[160] ); 00210 CHECK_EQUAL( 642, (int)local_cell_gids[320] ); 00211 00212 CHECK_REAL_EQUAL( 15.004, ke0_val[0], eps ); 00213 CHECK_REAL_EQUAL( 16.341, ke0_val[1], eps ); 00214 CHECK_REAL_EQUAL( 16.642, ke0_val[2], eps ); 00215 CHECK_REAL_EQUAL( 25.004, ke1_val[0], eps ); 00216 CHECK_REAL_EQUAL( 26.341, ke1_val[1], eps ); 00217 CHECK_REAL_EQUAL( 26.642, ke1_val[2], eps ); 00218 } 00219 } 00220 else 00221 { 00222 CHECK_EQUAL( (size_t)1, local_cell_gids.psize() ); 00223 00224 if( 0 == rank ) 00225 { 00226 CHECK_EQUAL( (size_t)1, local_cells.psize() ); 00227 CHECK_EQUAL( 1, (int)local_cell_gids[0] ); 00228 CHECK_EQUAL( 161, (int)local_cell_gids[160] ); 00229 CHECK_EQUAL( 321, (int)local_cell_gids[320] ); 00230 00231 CHECK_REAL_EQUAL( 15.001, ke0_val[0], eps ); 00232 CHECK_REAL_EQUAL( 16.161, ke0_val[1], eps ); 00233 CHECK_REAL_EQUAL( 16.321, ke0_val[2], eps ); 00234 CHECK_REAL_EQUAL( 25.001, ke1_val[0], eps ); 00235 CHECK_REAL_EQUAL( 26.161, ke1_val[1], eps ); 00236 CHECK_REAL_EQUAL( 26.321, ke1_val[2], eps ); 00237 } 00238 else if( 1 == rank ) 00239 { 00240 CHECK_EQUAL( (size_t)1, local_cells.psize() ); 00241 CHECK_EQUAL( 322, (int)local_cell_gids[0] ); 00242 CHECK_EQUAL( 482, (int)local_cell_gids[160] ); 00243 CHECK_EQUAL( 642, (int)local_cell_gids[320] ); 00244 00245 CHECK_REAL_EQUAL( 16.322, ke0_val[0], eps ); 00246 CHECK_REAL_EQUAL( 16.482, ke0_val[1], eps ); 00247 CHECK_REAL_EQUAL( 16.642, ke0_val[2], eps ); 00248 CHECK_REAL_EQUAL( 26.322, ke1_val[0], eps ); 00249 CHECK_REAL_EQUAL( 26.482, ke1_val[1], eps ); 00250 CHECK_REAL_EQUAL( 26.642, ke1_val[2], eps ); 00251 } 00252 } 00253 } 00254 } 00255 00256 void read_mesh_parallel( bool rcbzoltan, bool no_mixed_elements ) 00257 { 00258 Core moab; 00259 Interface& mb = moab; 00260 00261 read_options = "PARALLEL=READ_PART;PARTITION_METHOD=TRIVIAL;PARALLEL_RESOLVE_SHARED_ENTS;VARIABLE="; 00262 if( rcbzoltan ) 00263 read_options = "PARALLEL=READ_PART;PARTITION_METHOD=RCBZOLTAN;PARALLEL_RESOLVE_SHARED_ENTS;VARIABLE="; 00264 00265 if( no_mixed_elements ) read_options += ";NO_MIXED_ELEMENTS"; 00266 00267 ErrorCode rval = mb.load_file( example.c_str(), NULL, read_options.c_str() );CHECK_ERR( rval ); 00268 00269 ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 ); 00270 int procs = pcomm->proc_config().proc_size(); 00271 int rank = pcomm->proc_config().proc_rank(); 00272 00273 rval = pcomm->check_all_shared_handles();CHECK_ERR( rval ); 00274 00275 // Get local vertices 00276 Range local_verts; 00277 rval = mb.get_entities_by_type( 0, MBVERTEX, local_verts );CHECK_ERR( rval ); 00278 00279 int verts_num = local_verts.size(); 00280 if( 2 == procs ) 00281 { 00282 if( rcbzoltan ) 00283 { 00284 if( 0 == rank ) 00285 CHECK_EQUAL( 685, verts_num ); 00286 else if( 1 == rank ) 00287 CHECK_EQUAL( 685, verts_num ); // Not owned vertices included 00288 } 00289 else 00290 { 00291 if( 0 == rank ) 00292 CHECK_EQUAL( 1120, verts_num ); 00293 else if( 1 == rank ) 00294 CHECK_EQUAL( 1122, verts_num ); // Not owned vertices included 00295 } 00296 } 00297 00298 rval = pcomm->filter_pstatus( local_verts, PSTATUS_NOT_OWNED, PSTATUS_NOT );CHECK_ERR( rval ); 00299 00300 verts_num = local_verts.size(); 00301 if( 2 == procs ) 00302 { 00303 if( rcbzoltan ) 00304 { 00305 if( 0 == rank ) 00306 CHECK_EQUAL( 685, verts_num ); 00307 else if( 1 == rank ) 00308 CHECK_EQUAL( 595, verts_num ); // Not owned vertices excluded 00309 } 00310 else 00311 { 00312 if( 0 == rank ) 00313 CHECK_EQUAL( 1120, verts_num ); 00314 else if( 1 == rank ) 00315 CHECK_EQUAL( 160, verts_num ); // Not owned vertices excluded 00316 } 00317 } 00318 00319 // Get local edges 00320 Range local_edges; 00321 rval = mb.get_entities_by_type( 0, MBEDGE, local_edges );CHECK_ERR( rval ); 00322 00323 int edges_num = local_edges.size(); 00324 if( 2 == procs ) 00325 { 00326 if( rcbzoltan ) 00327 { 00328 if( 0 == rank ) 00329 CHECK_EQUAL( 1005, edges_num ); 00330 else if( 1 == rank ) 00331 CHECK_EQUAL( 1005, edges_num ); // Not owned edges included 00332 } 00333 else 00334 { 00335 if( 0 == rank ) 00336 CHECK_EQUAL( 1438, edges_num ); 00337 else if( 1 == rank ) 00338 CHECK_EQUAL( 1444, edges_num ); // Not owned edges included 00339 } 00340 } 00341 00342 rval = pcomm->filter_pstatus( local_edges, PSTATUS_NOT_OWNED, PSTATUS_NOT );CHECK_ERR( rval ); 00343 00344 edges_num = local_edges.size(); 00345 if( 2 == procs ) 00346 { 00347 if( rcbzoltan ) 00348 { 00349 if( 0 == rank ) 00350 CHECK_EQUAL( 1005, edges_num ); 00351 else if( 1 == rank ) 00352 CHECK_EQUAL( 915, edges_num ); // Not owned edges excluded 00353 } 00354 else 00355 { 00356 if( 0 == rank ) 00357 CHECK_EQUAL( 1438, edges_num ); 00358 else if( 1 == rank ) 00359 CHECK_EQUAL( 482, edges_num ); // Not owned edges excluded 00360 } 00361 } 00362 00363 // Get local cells 00364 Range local_cells; 00365 rval = mb.get_entities_by_type( 0, MBPOLYGON, local_cells );CHECK_ERR( rval ); 00366 00367 int cells_num = local_cells.size(); 00368 if( 2 == procs ) 00369 { 00370 CHECK_EQUAL( 321, cells_num ); 00371 CHECK_EQUAL( (size_t)1, local_cells.psize() ); 00372 } 00373 00374 rval = pcomm->filter_pstatus( local_cells, PSTATUS_NOT_OWNED, PSTATUS_NOT );CHECK_ERR( rval ); 00375 00376 cells_num = local_cells.size(); 00377 if( 2 == procs ) 00378 { 00379 CHECK_EQUAL( 321, cells_num ); 00380 CHECK_EQUAL( (size_t)1, local_cells.psize() ); 00381 } 00382 00383 std::cout << "proc: " << rank << " verts:" << verts_num << "\n"; 00384 00385 int total_verts_num; 00386 MPI_Reduce( &verts_num, &total_verts_num, 1, MPI_INT, MPI_SUM, 0, pcomm->proc_config().proc_comm() ); 00387 if( 0 == rank ) 00388 { 00389 std::cout << "total vertices: " << total_verts_num << "\n"; 00390 CHECK_EQUAL( 1280, total_verts_num ); 00391 } 00392 00393 std::cout << "proc: " << rank << " edges:" << edges_num << "\n"; 00394 00395 int total_edges_num; 00396 MPI_Reduce( &edges_num, &total_edges_num, 1, MPI_INT, MPI_SUM, 0, pcomm->proc_config().proc_comm() ); 00397 if( 0 == rank ) 00398 { 00399 std::cout << "total edges: " << total_edges_num << "\n"; 00400 CHECK_EQUAL( 1920, total_edges_num ); 00401 } 00402 00403 std::cout << "proc: " << rank << " cells:" << cells_num << "\n"; 00404 00405 int total_cells_num; 00406 MPI_Reduce( &cells_num, &total_cells_num, 1, MPI_INT, MPI_SUM, 0, pcomm->proc_config().proc_comm() ); 00407 if( 0 == rank ) 00408 { 00409 std::cout << "total cells: " << total_cells_num << "\n"; 00410 CHECK_EQUAL( 642, total_cells_num ); 00411 } 00412 00413 #ifdef MOAB_HAVE_HDF5_PARALLEL 00414 std::string write_options( "PARALLEL=WRITE_PART;" ); 00415 00416 std::string output_file = "test_mpas"; 00417 if( rcbzoltan ) output_file += "_rcbzoltan"; 00418 if( no_mixed_elements ) output_file += "_no_mixed_elements"; 00419 output_file += ".h5m"; 00420 00421 mb.write_file( output_file.c_str(), NULL, write_options.c_str() ); 00422 #endif 00423 } 00424 00425 void gather_one_cell_var( int gather_set_rank ) 00426 { 00427 Core moab; 00428 Interface& mb = moab; 00429 00430 EntityHandle file_set; 00431 ErrorCode rval = mb.create_meshset( MESHSET_SET, file_set );CHECK_ERR( rval ); 00432 00433 read_options = "PARALLEL=READ_PART;PARTITION_METHOD=TRIVIAL;PARALLEL_RESOLVE_SHARED_ENTS"; 00434 std::ostringstream gather_set_option; 00435 gather_set_option << ";GATHER_SET=" << gather_set_rank; 00436 read_options += gather_set_option.str(); 00437 00438 rval = mb.load_file( example.c_str(), &file_set, read_options.c_str() );CHECK_ERR( rval ); 00439 00440 ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 ); 00441 int procs = pcomm->proc_config().proc_size(); 00442 int rank = pcomm->proc_config().proc_rank(); 00443 00444 // Make sure gather_set_rank is valid 00445 if( gather_set_rank < 0 || gather_set_rank >= procs ) return; 00446 00447 Range cells, cells_owned; 00448 rval = mb.get_entities_by_type( file_set, MBPOLYGON, cells );CHECK_ERR( rval ); 00449 00450 // Get local owned cells 00451 rval = pcomm->filter_pstatus( cells, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1, &cells_owned );CHECK_ERR( rval ); 00452 00453 EntityHandle gather_set = 0; 00454 if( gather_set_rank == rank ) 00455 { 00456 // Get gather set 00457 ReadUtilIface* readUtilIface; 00458 mb.query_interface( readUtilIface ); 00459 rval = readUtilIface->get_gather_set( gather_set );CHECK_ERR( rval ); 00460 assert( gather_set != 0 ); 00461 } 00462 00463 Tag ke_tag0, gid_tag; 00464 rval = mb.tag_get_handle( "ke0", 1, MB_TYPE_DOUBLE, ke_tag0, MB_TAG_DENSE );CHECK_ERR( rval ); 00465 00466 gid_tag = mb.globalId_tag(); 00467 00468 pcomm->gather_data( cells_owned, ke_tag0, gid_tag, gather_set, gather_set_rank ); 00469 00470 if( gather_set_rank == rank ) 00471 { 00472 // Get gather set cells 00473 Range gather_set_cells; 00474 rval = mb.get_entities_by_type( gather_set, MBPOLYGON, gather_set_cells );CHECK_ERR( rval ); 00475 CHECK_EQUAL( (size_t)642, gather_set_cells.size() ); 00476 CHECK_EQUAL( (size_t)1, gather_set_cells.psize() ); 00477 00478 // Check ke0 tag values on 4 gather set cells: first pentagon, last pentagon, 00479 // first hexagon and last hexagon 00480 EntityHandle cell_ents[] = { gather_set_cells[0], gather_set_cells[11], gather_set_cells[12], 00481 gather_set_cells[641] }; 00482 double ke0_val[4]; 00483 rval = mb.tag_get_data( ke_tag0, &cell_ents[0], 4, ke0_val );CHECK_ERR( rval ); 00484 00485 CHECK_REAL_EQUAL( 15.001, ke0_val[0], eps ); 00486 CHECK_REAL_EQUAL( 15.012, ke0_val[1], eps ); 00487 CHECK_REAL_EQUAL( 16.013, ke0_val[2], eps ); 00488 CHECK_REAL_EQUAL( 16.642, ke0_val[3], eps ); 00489 } 00490 } 00491 00492 void multiple_loads_of_same_file( bool no_mixed_elements ) 00493 { 00494 Core moab; 00495 Interface& mb = moab; 00496 00497 // Need a file set for nomesh to work right 00498 EntityHandle file_set; 00499 ErrorCode rval; 00500 rval = mb.create_meshset( MESHSET_SET, file_set );CHECK_ERR( rval ); 00501 00502 // Read first only header information, no mesh, no variable 00503 read_options = "PARALLEL=READ_PART;PARTITION;NOMESH;VARIABLE=;PARTITION_METHOD=TRIVIAL"; 00504 if( no_mixed_elements ) read_options += ";NO_MIXED_ELEMENTS"; 00505 00506 rval = mb.load_file( example.c_str(), &file_set, read_options.c_str() );CHECK_ERR( rval ); 00507 00508 // Create mesh, no variable 00509 read_options = "PARALLEL=READ_PART;PARTITION;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION_METHOD=" 00510 "TRIVIAL;VARIABLE="; 00511 if( no_mixed_elements ) read_options += ";NO_MIXED_ELEMENTS"; 00512 00513 rval = mb.load_file( example.c_str(), &file_set, read_options.c_str() );CHECK_ERR( rval ); 00514 00515 // Read variable ke at timestep 0, no mesh 00516 read_options = "PARALLEL=READ_PART;PARTITION;PARTITION_METHOD=TRIVIAL;NOMESH;VARIABLE=ke;TIMESTEP=0"; 00517 if( no_mixed_elements ) read_options += ";NO_MIXED_ELEMENTS"; 00518 00519 rval = mb.load_file( example.c_str(), &file_set, read_options.c_str() );CHECK_ERR( rval ); 00520 00521 Range local_verts; 00522 rval = mb.get_entities_by_type( file_set, MBVERTEX, local_verts );CHECK_ERR( rval ); 00523 00524 Range local_edges; 00525 rval = mb.get_entities_by_type( file_set, MBEDGE, local_edges );CHECK_ERR( rval ); 00526 00527 Range local_cells; 00528 rval = mb.get_entities_by_type( file_set, MBPOLYGON, local_cells );CHECK_ERR( rval ); 00529 00530 ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 ); 00531 int procs = pcomm->proc_config().proc_size(); 00532 int rank = pcomm->proc_config().proc_rank(); 00533 00534 // Make check runs this test on two processors 00535 if( 2 == procs ) 00536 { 00537 CHECK_EQUAL( (size_t)321, local_cells.size() ); 00538 00539 // Check tag for cell variable ke at timestep 0 00540 Tag ke_tag0; 00541 rval = mb.tag_get_handle( "ke0", 1, MB_TYPE_DOUBLE, ke_tag0 );CHECK_ERR( rval ); 00542 00543 // Get ke0 tag values on 3 local cells 00544 EntityHandle cell_ents[] = { local_cells[0], local_cells[160], local_cells[320] }; 00545 double ke0_val[3]; 00546 rval = mb.tag_get_data( ke_tag0, cell_ents, 3, ke0_val );CHECK_ERR( rval ); 00547 00548 if( 0 == rank ) 00549 { 00550 CHECK_EQUAL( (size_t)1120, local_verts.size() ); 00551 CHECK_EQUAL( (size_t)1438, local_edges.size() ); 00552 CHECK_EQUAL( (size_t)1, local_cells.psize() ); 00553 CHECK_REAL_EQUAL( 15.001, ke0_val[0], eps ); 00554 CHECK_REAL_EQUAL( 16.161, ke0_val[1], eps ); 00555 CHECK_REAL_EQUAL( 16.321, ke0_val[2], eps ); 00556 } 00557 else if( 1 == rank ) 00558 { 00559 CHECK_EQUAL( (size_t)1122, local_verts.size() ); 00560 CHECK_EQUAL( (size_t)1444, local_edges.size() ); 00561 CHECK_EQUAL( (size_t)1, local_cells.psize() ); 00562 00563 CHECK_REAL_EQUAL( 16.322, ke0_val[0], eps ); 00564 CHECK_REAL_EQUAL( 16.482, ke0_val[1], eps ); 00565 CHECK_REAL_EQUAL( 16.642, ke0_val[2], eps ); 00566 } 00567 } 00568 }