MOAB: Mesh Oriented datABase  (version 5.4.1)
read_nc.cpp
Go to the documentation of this file.
00001 #include "TestUtil.hpp"
00002 #include "moab/Core.hpp"
00003 
00004 using namespace moab;
00005 
00006 std::string example_eul    = TestDir + "unittest/io/eul3x48x96.t.3.nc";
00007 std::string example_fv     = TestDir + "unittest/io/fv3x46x72.t.3.nc";
00008 std::string example_domain = TestDir + "unittest/io/domain.ocn.ne4np4_oQU240.160614.nc";
00009 std::string example_scrip  = TestDir + "unittest/io/ocean.QU.240km.scrip.151209.nc";
00010 
00011 #ifdef MOAB_HAVE_MPI
00012 #include "moab_mpi.h"
00013 #include "moab/ParallelComm.hpp"
00014 #endif
00015 
00016 // CAM-EUL
00017 void test_read_eul_all();
00018 void test_read_eul_onevar();
00019 void test_read_eul_onetimestep();
00020 void test_read_eul_nomesh();
00021 void test_read_eul_novars();
00022 
00023 // CAM-FV
00024 void test_read_fv_all();
00025 void test_read_fv_onevar();
00026 void test_read_fv_onetimestep();
00027 void test_read_fv_nomesh();
00028 void test_read_fv_novars();
00029 #ifdef MOAB_HAVE_MPI
00030 void test_read_fv_ghosting();
00031 #endif
00032 
00033 // Domain file
00034 void test_read_domain();
00035 // scrip file
00036 void test_read_scrip();
00037 
00038 ErrorCode get_options( std::string& opts );
00039 
00040 const int levels = 3;
00041 
00042 int main( int argc, char* argv[] )
00043 {
00044     int result = 0;
00045 
00046 #ifdef MOAB_HAVE_MPI
00047     int fail = MPI_Init( &argc, &argv );
00048     if( fail ) return 1;
00049 #else
00050     argv[0]   = argv[argc - argc];  // To remove the warnings in serial mode about unused variables
00051 #endif
00052 
00053     result += RUN_TEST( test_read_eul_all );
00054     result += RUN_TEST( test_read_eul_onevar );
00055     result += RUN_TEST( test_read_eul_onetimestep );
00056     result += RUN_TEST( test_read_eul_nomesh );
00057     result += RUN_TEST( test_read_eul_novars );
00058     result += RUN_TEST( test_read_domain );
00059     result += RUN_TEST( test_read_scrip );
00060     // Exclude test_read_fv_all() since reading edge data is not implemented in MOAB yet
00061     // result += RUN_TEST(test_read_fv_all);
00062     result += RUN_TEST( test_read_fv_onevar );
00063     result += RUN_TEST( test_read_fv_onetimestep );
00064     result += RUN_TEST( test_read_fv_nomesh );
00065     result += RUN_TEST( test_read_fv_novars );
00066 
00067 #ifdef MOAB_HAVE_MPI
00068     // Before ghosting issues with ownership were fixed, this test failed on 4 processors
00069     result += RUN_TEST( test_read_fv_ghosting );
00070 #endif
00071 
00072 #ifdef MOAB_HAVE_MPI
00073     fail = MPI_Finalize();
00074     if( fail ) return 1;
00075 #endif
00076 
00077     return result;
00078 }
00079 
00080 void test_read_eul_all()
00081 {
00082     Core moab;
00083     Interface& mb = moab;
00084 
00085     std::string opts;
00086     ErrorCode rval = get_options( opts );CHECK_ERR( rval );
00087 
00088     rval = mb.load_file( example_eul.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
00089 
00090     // Check for proper tags
00091     Tag Ttag0, Ttag1, coordTag;
00092     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );
00093 
00094     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00095 
00096     rval = mb.tag_get_handle( "COORDS", 3, MB_TYPE_DOUBLE, coordTag );CHECK_ERR( rval );
00097 
00098     // Check for some tags with double underscore in the tag name
00099     Tag tempTag;
00100     rval = mb.tag_get_handle( "__lon_LOC_MINMAX", 2, MB_TYPE_INTEGER, tempTag );CHECK_ERR( rval );
00101 
00102     rval = mb.tag_get_handle( "__lon_LOC_VALS", 0, MB_TYPE_DOUBLE, tempTag, MB_TAG_VARLEN );CHECK_ERR( rval );
00103 
00104     rval = mb.tag_get_handle( "__lon_GLOBAL_MINMAX", 2, MB_TYPE_INTEGER, tempTag );CHECK_ERR( rval );
00105 }
00106 
00107 void test_read_eul_onevar()
00108 {
00109     Core moab;
00110     Interface& mb = moab;
00111     std::string opts;
00112     ErrorCode rval = get_options( opts );CHECK_ERR( rval );
00113 
00114     opts += std::string( ";VARIABLE=T" );
00115     rval = mb.load_file( example_eul.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
00116 
00117     // Check for proper tags
00118     Tag Ttag0, Ttag1;
00119     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );
00120 
00121     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00122 
00123     // Check values of tag T0 (first level) at some strategically chosen places below
00124 #ifdef MOAB_HAVE_MPI
00125     ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
00126     int rank            = pcomm->proc_config().proc_rank();
00127     int procs           = pcomm->proc_config().proc_size();
00128 #else
00129     int rank  = 0;
00130     int procs = 1;
00131 #endif
00132 
00133     const double eps = 0.0001;
00134     double val[8 * levels];
00135 
00136     if( 1 == procs )
00137     {
00138         Range global_quads;
00139         rval = mb.get_entities_by_type( 0, MBQUAD, global_quads );CHECK_ERR( rval );
00140         CHECK_EQUAL( (size_t)4608, global_quads.size() );
00141 
00142         EntityHandle gloabl_quad_ents[] = { global_quads[0],    global_quads[2255], global_quads[2304],
00143                                             global_quads[4559], global_quads[48],   global_quads[2303],
00144                                             global_quads[2352], global_quads[4607] };
00145         rval                            = mb.tag_get_data( Ttag0, &gloabl_quad_ents[0], 8, val );
00146 
00147         CHECK_REAL_EQUAL( 252.8529, val[0 * levels], eps );  // First global quad
00148         CHECK_REAL_EQUAL( 234.8390, val[1 * levels], eps );  // 2256th global quad
00149         CHECK_REAL_EQUAL( 232.6458, val[2 * levels], eps );  // 2305th global quad
00150         CHECK_REAL_EQUAL( 205.3905, val[3 * levels], eps );  // 4560th global quad
00151         CHECK_REAL_EQUAL( 252.7116, val[4 * levels], eps );  // 49th global quad
00152         CHECK_REAL_EQUAL( 232.6670, val[5 * levels], eps );  // 2304th global quad
00153         CHECK_REAL_EQUAL( 234.6922, val[6 * levels], eps );  // 2353th global quad
00154         CHECK_REAL_EQUAL( 200.6828, val[7 * levels], eps );  // Last global quad
00155     }
00156     else if( 2 == procs )
00157     {
00158         Range local_quads;
00159         rval = mb.get_entities_by_type( 0, MBQUAD, local_quads );CHECK_ERR( rval );
00160         CHECK_EQUAL( (size_t)2304, local_quads.size() );
00161 
00162         EntityHandle local_quad_ents[] = { local_quads[0], local_quads[1151], local_quads[1152], local_quads[2303] };
00163         rval                           = mb.tag_get_data( Ttag0, &local_quad_ents[0], 4, val );
00164 
00165         if( 0 == rank )
00166         {
00167             CHECK_REAL_EQUAL( 252.8529, val[0 * levels],
00168                               eps );  // First local quad, first global quad
00169             CHECK_REAL_EQUAL( 234.8390, val[1 * levels],
00170                               eps );  // Median local quad, 2256th global quad
00171             CHECK_REAL_EQUAL( 232.6458, val[2 * levels],
00172                               eps );  // Median local quad, 2305th global quad
00173             CHECK_REAL_EQUAL( 205.3905, val[3 * levels],
00174                               eps );  // Last local quad, 4560th global quad
00175         }
00176         else if( 1 == rank )
00177         {
00178             CHECK_REAL_EQUAL( 252.7116, val[0 * levels],
00179                               eps );  // First local quad, 49th global quad
00180             CHECK_REAL_EQUAL( 232.6670, val[1 * levels],
00181                               eps );  // Median local quad, 2304th global quad
00182             CHECK_REAL_EQUAL( 234.6922, val[2 * levels],
00183                               eps );  // Median local quad, 2353th global quad
00184             CHECK_REAL_EQUAL( 200.6828, val[3 * levels],
00185                               eps );  // Last local quad, last global quad
00186         }
00187     }
00188 }
00189 
00190 void test_read_eul_onetimestep()
00191 {
00192     Core moab;
00193     Interface& mb = moab;
00194     std::string opts;
00195     ErrorCode rval = get_options( opts );CHECK_ERR( rval );
00196 
00197     opts += std::string( ";VARIABLE=T;TIMESTEP=1" );
00198     rval = mb.load_file( example_eul.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
00199 
00200     // Check for proper tags
00201     Tag Ttag0, Ttag1;
00202     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );
00203     CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
00204 
00205     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00206 }
00207 
00208 void test_read_eul_nomesh()
00209 {
00210     Core moab;
00211     Interface& mb = moab;
00212 
00213     // Need a set for nomesh to work right
00214     EntityHandle set;
00215     ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );
00216 
00217     std::string orig, opts;
00218     rval = get_options( orig );CHECK_ERR( rval );
00219 
00220     opts = orig + std::string( ";VARIABLE=T;TIMESTEP=0" );
00221     rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00222 
00223     // Check for proper tag
00224     Tag Ttag0, Ttag1;
00225     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );
00226 
00227     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );
00228     CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
00229 
00230     // Now read 2nd timestep with nomesh option
00231     opts = orig + std::string( ";VARIABLE=T;TIMESTEP=1;NOMESH" );
00232     rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00233 
00234     // Check for proper tag
00235     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00236 }
00237 
00238 void test_read_eul_novars()
00239 {
00240     Core moab;
00241     Interface& mb = moab;
00242 
00243     // Need a set for nomesh to work right
00244     EntityHandle set;
00245     ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );
00246 
00247     std::string orig, opts;
00248     rval = get_options( orig );CHECK_ERR( rval );
00249 
00250     opts = orig + std::string( ";NOMESH;VARIABLE=" );
00251     rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00252 
00253     opts = orig + std::string( ";VARIABLE=;TIMESTEP=0" );
00254     rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00255 
00256     // Check for proper tag
00257     Tag Ttag0, Ttag1;
00258     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );
00259     CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
00260 
00261     opts = orig + std::string( ";VARIABLE=T;TIMESTEP=0;NOMESH" );
00262     rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00263 
00264     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );
00265 
00266     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );
00267     CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
00268 
00269     // Now read 2nd timestep with nomesh option
00270     opts = orig + std::string( ";VARIABLE=T;TIMESTEP=1;NOMESH" );
00271     rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00272 
00273     // Check for proper tag
00274     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00275 }
00276 
00277 void test_read_fv_all()
00278 {
00279     Core moab;
00280     Interface& mb = moab;
00281 
00282     std::string opts;
00283     ErrorCode rval = get_options( opts );CHECK_ERR( rval );
00284 
00285     rval = mb.load_file( example_fv.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
00286 
00287     // Check for proper tags
00288     Tag Ttag0, Ttag1, coordTag;
00289     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );
00290 
00291     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00292 
00293     rval = mb.tag_get_handle( "COORDS", 3, MB_TYPE_DOUBLE, coordTag );CHECK_ERR( rval );
00294 }
00295 
00296 void test_read_fv_onevar()
00297 {
00298     Core moab;
00299     Interface& mb = moab;
00300     std::string opts;
00301     ErrorCode rval = get_options( opts );CHECK_ERR( rval );
00302 
00303     opts += std::string( ";VARIABLE=T" );
00304     rval = mb.load_file( example_fv.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
00305 
00306     // Check for proper tags
00307     Tag Ttag0, Ttag1;
00308     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );
00309 
00310     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00311 
00312     // Check values of tag T0 (first level) at some strategically chosen places below
00313 #ifdef MOAB_HAVE_MPI
00314     ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
00315     int rank            = pcomm->proc_config().proc_rank();
00316     int procs           = pcomm->proc_config().proc_size();
00317 #else
00318     int rank  = 0;
00319     int procs = 1;
00320 #endif
00321 
00322     const double eps = 0.0001;
00323     double val[8 * levels];
00324 
00325     if( 1 == procs )
00326     {
00327         Range global_quads;
00328         rval = mb.get_entities_by_type( 0, MBQUAD, global_quads );CHECK_ERR( rval );
00329         CHECK_EQUAL( (size_t)3312, global_quads.size() );
00330 
00331         EntityHandle gloabl_quad_ents[] = { global_quads[0],    global_quads[1619], global_quads[1656],
00332                                             global_quads[3275], global_quads[36],   global_quads[1655],
00333                                             global_quads[1692], global_quads[3311] };
00334         rval                            = mb.tag_get_data( Ttag0, &gloabl_quad_ents[0], 8, val );
00335 
00336         CHECK_REAL_EQUAL( 253.6048, val[0 * levels], eps );  // First global quad
00337         CHECK_REAL_EQUAL( 232.2170, val[1 * levels], eps );  // 1620th global quad
00338         CHECK_REAL_EQUAL( 232.7454, val[2 * levels], eps );  // 1657th global quad
00339         CHECK_REAL_EQUAL( 210.2581, val[3 * levels], eps );  // 3276th global quad
00340         CHECK_REAL_EQUAL( 253.6048, val[4 * levels], eps );  // 37th global quad
00341         CHECK_REAL_EQUAL( 232.9553, val[5 * levels], eps );  // 1656th global quad
00342         CHECK_REAL_EQUAL( 232.1704, val[6 * levels], eps );  // 1693th global quad
00343         CHECK_REAL_EQUAL( 210.2581, val[7 * levels], eps );  // Last global quad
00344     }
00345     else if( 2 == procs )
00346     {
00347         Range local_quads;
00348         rval = mb.get_entities_by_type( 0, MBQUAD, local_quads );CHECK_ERR( rval );
00349         CHECK_EQUAL( (size_t)1656, local_quads.size() );
00350 
00351         EntityHandle local_quad_ents[] = { local_quads[0], local_quads[827], local_quads[828], local_quads[1655] };
00352         rval                           = mb.tag_get_data( Ttag0, &local_quad_ents[0], 4, val );
00353 
00354         if( 0 == rank )
00355         {
00356             CHECK_REAL_EQUAL( 253.6048, val[0 * levels],
00357                               eps );  // First local quad, first global quad
00358             CHECK_REAL_EQUAL( 232.2170, val[1 * levels],
00359                               eps );  // Median local quad, 1620th global quad
00360             CHECK_REAL_EQUAL( 232.7454, val[2 * levels],
00361                               eps );  // Median local quad, 1657th global quad
00362             CHECK_REAL_EQUAL( 210.2581, val[3 * levels],
00363                               eps );  // Last local quad, 3276th global quad
00364         }
00365         else if( 1 == rank )
00366         {
00367             CHECK_REAL_EQUAL( 253.6048, val[0 * levels],
00368                               eps );  // First local quad, 37th global quad
00369             CHECK_REAL_EQUAL( 232.9553, val[1 * levels],
00370                               eps );  // Median local quad, 1656th global quad
00371             CHECK_REAL_EQUAL( 232.1704, val[2 * levels],
00372                               eps );  // Median local quad, 1693th global quad
00373             CHECK_REAL_EQUAL( 210.2581, val[3 * levels],
00374                               eps );  // Last local quad, last global quad
00375         }
00376     }
00377 }
00378 
00379 void test_read_fv_onetimestep()
00380 {
00381     Core moab;
00382     Interface& mb = moab;
00383     std::string opts;
00384     ErrorCode rval = get_options( opts );CHECK_ERR( rval );
00385 
00386     opts += std::string( ";VARIABLE=T;TIMESTEP=1" );
00387     rval = mb.load_file( example_fv.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
00388 
00389     // Check for proper tags
00390     Tag Ttag0, Ttag1;
00391     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );
00392     CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
00393 
00394     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00395 
00396     // Check for some tags with double underscore in the tag name
00397     Tag tempTag;
00398     rval = mb.tag_get_handle( "__lon_LOC_MINMAX", 2, MB_TYPE_INTEGER, tempTag );CHECK_ERR( rval );
00399 
00400     rval = mb.tag_get_handle( "__lon_LOC_VALS", 0, MB_TYPE_DOUBLE, tempTag, MB_TAG_VARLEN );CHECK_ERR( rval );
00401 
00402     rval = mb.tag_get_handle( "__lon_GLOBAL_MINMAX", 2, MB_TYPE_INTEGER, tempTag );CHECK_ERR( rval );
00403 }
00404 
00405 void test_read_fv_nomesh()
00406 {
00407     Core moab;
00408     Interface& mb = moab;
00409 
00410     // Need a set for nomesh to work right
00411     EntityHandle set;
00412     ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );
00413 
00414     std::string orig, opts;
00415     rval = get_options( orig );CHECK_ERR( rval );
00416 
00417     opts = orig + std::string( ";VARIABLE=T;TIMESTEP=0" );
00418     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00419 
00420     // Check for proper tag
00421     Tag Ttag0, Ttag1;
00422     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );
00423 
00424     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );
00425     CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
00426 
00427     // Now read 2nd timestep with nomesh option
00428     opts = orig + std::string( ";VARIABLE=T;TIMESTEP=1;NOMESH" );
00429     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00430 
00431     // Check for proper tag
00432     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00433 }
00434 
00435 void test_read_fv_novars()
00436 {
00437     Core moab;
00438     Interface& mb = moab;
00439 
00440     // Need a set for nomesh to work right
00441     EntityHandle set;
00442     ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );
00443 
00444     std::string orig, opts;
00445     rval = get_options( orig );CHECK_ERR( rval );
00446 
00447     opts = orig + std::string( ";NOMESH;VARIABLE=" );
00448     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00449 
00450     opts = orig + std::string( ";VARIABLE=;TIMESTEP=0" );
00451     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00452 
00453     // Check for proper tag
00454     Tag Ttag0, Ttag1;
00455     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );
00456     CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
00457 
00458     opts = orig + std::string( ";VARIABLE=T;TIMESTEP=0;NOMESH" );
00459     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00460 
00461     rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );
00462 
00463     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );
00464     CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
00465 
00466     // Now read 2nd timestep with nomesh option
00467     opts = orig + std::string( ";VARIABLE=T;TIMESTEP=1;NOMESH" );
00468     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00469 
00470     // Check for proper tag
00471     rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
00472 }
00473 
00474 #ifdef MOAB_HAVE_MPI
00475 void test_read_fv_ghosting()
00476 {
00477     Core moab;
00478     Interface& mb = moab;
00479 
00480     // Need a set for nomesh to work right
00481     EntityHandle set;
00482     ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );
00483 
00484     std::string orig, opts;
00485     rval = get_options( orig );CHECK_ERR( rval );
00486 
00487     opts = std::string( "PARALLEL=READ_PART;PARTITION;PARALLEL_GHOSTS=2.0.1;NOMESH;VARIABLE=;"
00488                         "PARTITION_METHOD=SQIJ" );
00489     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00490 
00491     opts = std::string( "PARALLEL=READ_PART;PARTITION;PARALLEL_RESOLVE_SHARED_ENTS;PARALLEL_GHOSTS="
00492                         "2.0.1;PARTITION_METHOD=SQIJ;VARIABLE=" );
00493     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00494 
00495     opts = std::string( "PARALLEL=READ_PART;PARTITION;PARTITION_METHOD=SQIJ;VARIABLE=TOT_CLD_"
00496                         "VISTAU;NOMESH;TIMESTEP=0;" );
00497     rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00498 }
00499 #endif
00500 
00501 void test_read_domain()
00502 {
00503     Core moab;
00504     Interface& mb = moab;
00505 
00506     // Need a set for nomesh to work right
00507     EntityHandle set;
00508     ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );
00509 
00510     std::string orig, opts;
00511     rval = get_options( orig );CHECK_ERR( rval );
00512 
00513     opts = orig + std::string( ";VARIABLE=" );
00514     rval = mb.load_file( example_domain.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00515 }
00516 
00517 void test_read_scrip()
00518 {
00519     Core moab;
00520     Interface& mb = moab;
00521 
00522     // Need a set for nomesh to work right
00523     EntityHandle set;
00524     ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );
00525 
00526     std::string orig, opts;
00527     rval = get_options( orig );CHECK_ERR( rval );
00528 
00529     opts = orig + std::string( ";VARIABLE=" );
00530     rval = mb.load_file( example_scrip.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
00531 }
00532 
00533 ErrorCode get_options( std::string& opts )
00534 {
00535 #ifdef MOAB_HAVE_MPI
00536     // Use parallel options
00537     opts = std::string( ";;PARALLEL=READ_PART;PARTITION_METHOD=SQIJ;DEBUG_IO=2;" );
00538     return MB_SUCCESS;
00539 #else
00540     opts      = std::string( ";;" );
00541     return MB_SUCCESS;
00542 #endif
00543 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines