MOAB: Mesh Oriented datABase  (version 5.4.1)
read_nc.cpp File Reference
#include "TestUtil.hpp"
#include "moab/Core.hpp"
+ Include dependency graph for read_nc.cpp:

Go to the source code of this file.

Functions

void test_read_eul_all ()
void test_read_eul_onevar ()
void test_read_eul_onetimestep ()
void test_read_eul_nomesh ()
void test_read_eul_novars ()
void test_read_fv_all ()
void test_read_fv_onevar ()
void test_read_fv_onetimestep ()
void test_read_fv_nomesh ()
void test_read_fv_novars ()
void test_read_domain ()
void test_read_scrip ()
ErrorCode get_options (std::string &opts)
int main (int argc, char *argv[])

Variables

std::string example_eul = "unittest/io/eul3x48x96.t.3.nc"
std::string example_fv = "unittest/io/fv3x46x72.t.3.nc"
std::string example_domain = "unittest/io/domain.ocn.ne4np4_oQU240.160614.nc"
std::string example_scrip = "unittest/io/ocean.QU.240km.scrip.151209.nc"
const int levels = 3

Function Documentation

ErrorCode get_options ( std::string &  opts)
int main ( int  argc,
char *  argv[] 
)

Definition at line 42 of file read_nc.cpp.

References moab::fail(), RUN_TEST, test_read_domain(), test_read_eul_all(), test_read_eul_nomesh(), test_read_eul_novars(), test_read_eul_onetimestep(), test_read_eul_onevar(), test_read_fv_nomesh(), test_read_fv_novars(), test_read_fv_onetimestep(), test_read_fv_onevar(), and test_read_scrip().

{
    int result = 0;

#ifdef MOAB_HAVE_MPI
    int fail = MPI_Init( &argc, &argv );
    if( fail ) return 1;
#else
    argv[0]   = argv[argc - argc];  // To remove the warnings in serial mode about unused variables
#endif

    result += RUN_TEST( test_read_eul_all );
    result += RUN_TEST( test_read_eul_onevar );
    result += RUN_TEST( test_read_eul_onetimestep );
    result += RUN_TEST( test_read_eul_nomesh );
    result += RUN_TEST( test_read_eul_novars );
    result += RUN_TEST( test_read_domain );
    result += RUN_TEST( test_read_scrip );
    // Exclude test_read_fv_all() since reading edge data is not implemented in MOAB yet
    // result += RUN_TEST(test_read_fv_all);
    result += RUN_TEST( test_read_fv_onevar );
    result += RUN_TEST( test_read_fv_onetimestep );
    result += RUN_TEST( test_read_fv_nomesh );
    result += RUN_TEST( test_read_fv_novars );

#ifdef MOAB_HAVE_MPI
    // Before ghosting issues with ownership were fixed, this test failed on 4 processors
    result += RUN_TEST( test_read_fv_ghosting );
#endif

#ifdef MOAB_HAVE_MPI
    fail = MPI_Finalize();
    if( fail ) return 1;
#endif

    return result;
}
void test_read_domain ( )

Definition at line 501 of file read_nc.cpp.

References CHECK_ERR, moab::Interface::create_meshset(), ErrorCode, example_domain, get_options(), moab::Interface::load_file(), and MESHSET_SET.

Referenced by main().

{
    Core moab;
    Interface& mb = moab;

    // Need a set for nomesh to work right
    EntityHandle set;
    ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );

    std::string orig, opts;
    rval = get_options( orig );CHECK_ERR( rval );

    opts = orig + std::string( ";VARIABLE=" );
    rval = mb.load_file( example_domain.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
}

Definition at line 80 of file read_nc.cpp.

References CHECK_ERR, ErrorCode, example_eul, get_options(), levels, moab::Interface::load_file(), mb, MB_TAG_VARLEN, MB_TYPE_DOUBLE, MB_TYPE_INTEGER, and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;

    std::string opts;
    ErrorCode rval = get_options( opts );CHECK_ERR( rval );

    rval = mb.load_file( example_eul.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tags
    Tag Ttag0, Ttag1, coordTag;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "COORDS", 3, MB_TYPE_DOUBLE, coordTag );CHECK_ERR( rval );

    // Check for some tags with double underscore in the tag name
    Tag tempTag;
    rval = mb.tag_get_handle( "__lon_LOC_MINMAX", 2, MB_TYPE_INTEGER, tempTag );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "__lon_LOC_VALS", 0, MB_TYPE_DOUBLE, tempTag, MB_TAG_VARLEN );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "__lon_GLOBAL_MINMAX", 2, MB_TYPE_INTEGER, tempTag );CHECK_ERR( rval );
}

Definition at line 208 of file read_nc.cpp.

References CHECK_EQUAL, CHECK_ERR, moab::Interface::create_meshset(), ErrorCode, example_eul, get_options(), levels, moab::Interface::load_file(), mb, MB_TAG_NOT_FOUND, MB_TYPE_DOUBLE, MESHSET_SET, and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;

    // Need a set for nomesh to work right
    EntityHandle set;
    ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );

    std::string orig, opts;
    rval = get_options( orig );CHECK_ERR( rval );

    opts = orig + std::string( ";VARIABLE=T;TIMESTEP=0" );
    rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tag
    Tag Ttag0, Ttag1;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );
    CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );

    // Now read 2nd timestep with nomesh option
    opts = orig + std::string( ";VARIABLE=T;TIMESTEP=1;NOMESH" );
    rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tag
    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
}

Definition at line 238 of file read_nc.cpp.

References CHECK_EQUAL, CHECK_ERR, moab::Interface::create_meshset(), ErrorCode, example_eul, get_options(), levels, moab::Interface::load_file(), mb, MB_TAG_NOT_FOUND, MB_TYPE_DOUBLE, MESHSET_SET, and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;

    // Need a set for nomesh to work right
    EntityHandle set;
    ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );

    std::string orig, opts;
    rval = get_options( orig );CHECK_ERR( rval );

    opts = orig + std::string( ";NOMESH;VARIABLE=" );
    rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    opts = orig + std::string( ";VARIABLE=;TIMESTEP=0" );
    rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tag
    Tag Ttag0, Ttag1;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );
    CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );

    opts = orig + std::string( ";VARIABLE=T;TIMESTEP=0;NOMESH" );
    rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );
    CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );

    // Now read 2nd timestep with nomesh option
    opts = orig + std::string( ";VARIABLE=T;TIMESTEP=1;NOMESH" );
    rval = mb.load_file( example_eul.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tag
    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
}

Definition at line 190 of file read_nc.cpp.

References CHECK_EQUAL, CHECK_ERR, ErrorCode, example_eul, get_options(), levels, moab::Interface::load_file(), mb, MB_TAG_NOT_FOUND, MB_TYPE_DOUBLE, and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;
    std::string opts;
    ErrorCode rval = get_options( opts );CHECK_ERR( rval );

    opts += std::string( ";VARIABLE=T;TIMESTEP=1" );
    rval = mb.load_file( example_eul.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tags
    Tag Ttag0, Ttag1;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );
    CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
}

Definition at line 107 of file read_nc.cpp.

References CHECK_EQUAL, CHECK_ERR, CHECK_REAL_EQUAL, eps, ErrorCode, example_eul, moab::Interface::get_entities_by_type(), get_options(), moab::ParallelComm::get_pcomm(), levels, moab::Interface::load_file(), mb, MB_TYPE_DOUBLE, MBQUAD, moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), moab::ProcConfig::proc_size(), rank, moab::Range::size(), moab::Interface::tag_get_data(), and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;
    std::string opts;
    ErrorCode rval = get_options( opts );CHECK_ERR( rval );

    opts += std::string( ";VARIABLE=T" );
    rval = mb.load_file( example_eul.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tags
    Tag Ttag0, Ttag1;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );

    // Check values of tag T0 (first level) at some strategically chosen places below
#ifdef MOAB_HAVE_MPI
    ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
    int rank            = pcomm->proc_config().proc_rank();
    int procs           = pcomm->proc_config().proc_size();
#else
    int rank  = 0;
    int procs = 1;
#endif

    const double eps = 0.0001;
    double val[8 * levels];

    if( 1 == procs )
    {
        Range global_quads;
        rval = mb.get_entities_by_type( 0, MBQUAD, global_quads );CHECK_ERR( rval );
        CHECK_EQUAL( (size_t)4608, global_quads.size() );

        EntityHandle gloabl_quad_ents[] = { global_quads[0],    global_quads[2255], global_quads[2304],
                                            global_quads[4559], global_quads[48],   global_quads[2303],
                                            global_quads[2352], global_quads[4607] };
        rval                            = mb.tag_get_data( Ttag0, &gloabl_quad_ents[0], 8, val );

        CHECK_REAL_EQUAL( 252.8529, val[0 * levels], eps );  // First global quad
        CHECK_REAL_EQUAL( 234.8390, val[1 * levels], eps );  // 2256th global quad
        CHECK_REAL_EQUAL( 232.6458, val[2 * levels], eps );  // 2305th global quad
        CHECK_REAL_EQUAL( 205.3905, val[3 * levels], eps );  // 4560th global quad
        CHECK_REAL_EQUAL( 252.7116, val[4 * levels], eps );  // 49th global quad
        CHECK_REAL_EQUAL( 232.6670, val[5 * levels], eps );  // 2304th global quad
        CHECK_REAL_EQUAL( 234.6922, val[6 * levels], eps );  // 2353th global quad
        CHECK_REAL_EQUAL( 200.6828, val[7 * levels], eps );  // Last global quad
    }
    else if( 2 == procs )
    {
        Range local_quads;
        rval = mb.get_entities_by_type( 0, MBQUAD, local_quads );CHECK_ERR( rval );
        CHECK_EQUAL( (size_t)2304, local_quads.size() );

        EntityHandle local_quad_ents[] = { local_quads[0], local_quads[1151], local_quads[1152], local_quads[2303] };
        rval                           = mb.tag_get_data( Ttag0, &local_quad_ents[0], 4, val );

        if( 0 == rank )
        {
            CHECK_REAL_EQUAL( 252.8529, val[0 * levels],
                              eps );  // First local quad, first global quad
            CHECK_REAL_EQUAL( 234.8390, val[1 * levels],
                              eps );  // Median local quad, 2256th global quad
            CHECK_REAL_EQUAL( 232.6458, val[2 * levels],
                              eps );  // Median local quad, 2305th global quad
            CHECK_REAL_EQUAL( 205.3905, val[3 * levels],
                              eps );  // Last local quad, 4560th global quad
        }
        else if( 1 == rank )
        {
            CHECK_REAL_EQUAL( 252.7116, val[0 * levels],
                              eps );  // First local quad, 49th global quad
            CHECK_REAL_EQUAL( 232.6670, val[1 * levels],
                              eps );  // Median local quad, 2304th global quad
            CHECK_REAL_EQUAL( 234.6922, val[2 * levels],
                              eps );  // Median local quad, 2353th global quad
            CHECK_REAL_EQUAL( 200.6828, val[3 * levels],
                              eps );  // Last local quad, last global quad
        }
    }
}
void test_read_fv_all ( )

Definition at line 277 of file read_nc.cpp.

References CHECK_ERR, ErrorCode, example_fv, get_options(), levels, moab::Interface::load_file(), mb, MB_TYPE_DOUBLE, and moab::Interface::tag_get_handle().

{
    Core moab;
    Interface& mb = moab;

    std::string opts;
    ErrorCode rval = get_options( opts );CHECK_ERR( rval );

    rval = mb.load_file( example_fv.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tags
    Tag Ttag0, Ttag1, coordTag;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "COORDS", 3, MB_TYPE_DOUBLE, coordTag );CHECK_ERR( rval );
}

Definition at line 405 of file read_nc.cpp.

References CHECK_EQUAL, CHECK_ERR, moab::Interface::create_meshset(), ErrorCode, example_fv, get_options(), levels, moab::Interface::load_file(), mb, MB_TAG_NOT_FOUND, MB_TYPE_DOUBLE, MESHSET_SET, and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;

    // Need a set for nomesh to work right
    EntityHandle set;
    ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );

    std::string orig, opts;
    rval = get_options( orig );CHECK_ERR( rval );

    opts = orig + std::string( ";VARIABLE=T;TIMESTEP=0" );
    rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tag
    Tag Ttag0, Ttag1;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );
    CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );

    // Now read 2nd timestep with nomesh option
    opts = orig + std::string( ";VARIABLE=T;TIMESTEP=1;NOMESH" );
    rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tag
    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
}

Definition at line 435 of file read_nc.cpp.

References CHECK_EQUAL, CHECK_ERR, moab::Interface::create_meshset(), ErrorCode, example_fv, get_options(), levels, moab::Interface::load_file(), mb, MB_TAG_NOT_FOUND, MB_TYPE_DOUBLE, MESHSET_SET, and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;

    // Need a set for nomesh to work right
    EntityHandle set;
    ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );

    std::string orig, opts;
    rval = get_options( orig );CHECK_ERR( rval );

    opts = orig + std::string( ";NOMESH;VARIABLE=" );
    rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    opts = orig + std::string( ";VARIABLE=;TIMESTEP=0" );
    rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tag
    Tag Ttag0, Ttag1;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );
    CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );

    opts = orig + std::string( ";VARIABLE=T;TIMESTEP=0;NOMESH" );
    rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );
    CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );

    // Now read 2nd timestep with nomesh option
    opts = orig + std::string( ";VARIABLE=T;TIMESTEP=1;NOMESH" );
    rval = mb.load_file( example_fv.c_str(), &set, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tag
    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );
}

Definition at line 379 of file read_nc.cpp.

References CHECK_EQUAL, CHECK_ERR, ErrorCode, example_fv, get_options(), levels, moab::Interface::load_file(), mb, MB_TAG_NOT_FOUND, MB_TAG_VARLEN, MB_TYPE_DOUBLE, MB_TYPE_INTEGER, and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;
    std::string opts;
    ErrorCode rval = get_options( opts );CHECK_ERR( rval );

    opts += std::string( ";VARIABLE=T;TIMESTEP=1" );
    rval = mb.load_file( example_fv.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tags
    Tag Ttag0, Ttag1;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );
    CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );

    // Check for some tags with double underscore in the tag name
    Tag tempTag;
    rval = mb.tag_get_handle( "__lon_LOC_MINMAX", 2, MB_TYPE_INTEGER, tempTag );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "__lon_LOC_VALS", 0, MB_TYPE_DOUBLE, tempTag, MB_TAG_VARLEN );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "__lon_GLOBAL_MINMAX", 2, MB_TYPE_INTEGER, tempTag );CHECK_ERR( rval );
}

Definition at line 296 of file read_nc.cpp.

References CHECK_EQUAL, CHECK_ERR, CHECK_REAL_EQUAL, eps, ErrorCode, example_fv, moab::Interface::get_entities_by_type(), get_options(), moab::ParallelComm::get_pcomm(), levels, moab::Interface::load_file(), mb, MB_TYPE_DOUBLE, MBQUAD, moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), moab::ProcConfig::proc_size(), rank, moab::Range::size(), moab::Interface::tag_get_data(), and moab::Interface::tag_get_handle().

Referenced by main().

{
    Core moab;
    Interface& mb = moab;
    std::string opts;
    ErrorCode rval = get_options( opts );CHECK_ERR( rval );

    opts += std::string( ";VARIABLE=T" );
    rval = mb.load_file( example_fv.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );

    // Check for proper tags
    Tag Ttag0, Ttag1;
    rval = mb.tag_get_handle( "T0", levels, MB_TYPE_DOUBLE, Ttag0 );CHECK_ERR( rval );

    rval = mb.tag_get_handle( "T1", levels, MB_TYPE_DOUBLE, Ttag1 );CHECK_ERR( rval );

    // Check values of tag T0 (first level) at some strategically chosen places below
#ifdef MOAB_HAVE_MPI
    ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
    int rank            = pcomm->proc_config().proc_rank();
    int procs           = pcomm->proc_config().proc_size();
#else
    int rank  = 0;
    int procs = 1;
#endif

    const double eps = 0.0001;
    double val[8 * levels];

    if( 1 == procs )
    {
        Range global_quads;
        rval = mb.get_entities_by_type( 0, MBQUAD, global_quads );CHECK_ERR( rval );
        CHECK_EQUAL( (size_t)3312, global_quads.size() );

        EntityHandle gloabl_quad_ents[] = { global_quads[0],    global_quads[1619], global_quads[1656],
                                            global_quads[3275], global_quads[36],   global_quads[1655],
                                            global_quads[1692], global_quads[3311] };
        rval                            = mb.tag_get_data( Ttag0, &gloabl_quad_ents[0], 8, val );

        CHECK_REAL_EQUAL( 253.6048, val[0 * levels], eps );  // First global quad
        CHECK_REAL_EQUAL( 232.2170, val[1 * levels], eps );  // 1620th global quad
        CHECK_REAL_EQUAL( 232.7454, val[2 * levels], eps );  // 1657th global quad
        CHECK_REAL_EQUAL( 210.2581, val[3 * levels], eps );  // 3276th global quad
        CHECK_REAL_EQUAL( 253.6048, val[4 * levels], eps );  // 37th global quad
        CHECK_REAL_EQUAL( 232.9553, val[5 * levels], eps );  // 1656th global quad
        CHECK_REAL_EQUAL( 232.1704, val[6 * levels], eps );  // 1693th global quad
        CHECK_REAL_EQUAL( 210.2581, val[7 * levels], eps );  // Last global quad
    }
    else if( 2 == procs )
    {
        Range local_quads;
        rval = mb.get_entities_by_type( 0, MBQUAD, local_quads );CHECK_ERR( rval );
        CHECK_EQUAL( (size_t)1656, local_quads.size() );

        EntityHandle local_quad_ents[] = { local_quads[0], local_quads[827], local_quads[828], local_quads[1655] };
        rval                           = mb.tag_get_data( Ttag0, &local_quad_ents[0], 4, val );

        if( 0 == rank )
        {
            CHECK_REAL_EQUAL( 253.6048, val[0 * levels],
                              eps );  // First local quad, first global quad
            CHECK_REAL_EQUAL( 232.2170, val[1 * levels],
                              eps );  // Median local quad, 1620th global quad
            CHECK_REAL_EQUAL( 232.7454, val[2 * levels],
                              eps );  // Median local quad, 1657th global quad
            CHECK_REAL_EQUAL( 210.2581, val[3 * levels],
                              eps );  // Last local quad, 3276th global quad
        }
        else if( 1 == rank )
        {
            CHECK_REAL_EQUAL( 253.6048, val[0 * levels],
                              eps );  // First local quad, 37th global quad
            CHECK_REAL_EQUAL( 232.9553, val[1 * levels],
                              eps );  // Median local quad, 1656th global quad
            CHECK_REAL_EQUAL( 232.1704, val[2 * levels],
                              eps );  // Median local quad, 1693th global quad
            CHECK_REAL_EQUAL( 210.2581, val[3 * levels],
                              eps );  // Last local quad, last global quad
        }
    }
}
void test_read_scrip ( )

Definition at line 517 of file read_nc.cpp.

References CHECK_ERR, moab::Interface::create_meshset(), ErrorCode, example_scrip, get_options(), moab::Interface::load_file(), and MESHSET_SET.

Referenced by main().

{
    Core moab;
    Interface& mb = moab;

    // Need a set for nomesh to work right
    EntityHandle set;
    ErrorCode rval = mb.create_meshset( MESHSET_SET, set );CHECK_ERR( rval );

    std::string orig, opts;
    rval = get_options( orig );CHECK_ERR( rval );

    opts = orig + std::string( ";VARIABLE=" );
    rval = mb.load_file( example_scrip.c_str(), &set, opts.c_str() );CHECK_ERR( rval );
}

Variable Documentation

std::string example_domain = "unittest/io/domain.ocn.ne4np4_oQU240.160614.nc"

Definition at line 8 of file read_nc.cpp.

Referenced by test_read_domain().

std::string example_scrip = "unittest/io/ocean.QU.240km.scrip.151209.nc"

Definition at line 9 of file read_nc.cpp.

Referenced by test_read_scrip().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines