Go to the documentation of this file. 1
6
7 #include "moab/Core.hpp"
8 #ifdef MOAB_HAVE_MPI
9 #include "moab_mpi.h"
10 #endif
11
12 #include <iostream>
13
14 using namespace moab;
15 using namespace std;
16
17
18
19 ErrorCode TestErrorHandlingPar_1()
20 {
21 Core moab;
22 Interface& mb = moab;
23
24 string opts = ";;";
25 #ifdef MOAB_HAVE_MPI
26
27 opts += "PARALLEL=READ_PART;PARTITION_METHOD=SQIJ";
28 #endif
29
30
31 string test_file = string( MESH_DIR ) + string( "/io/fv3x46x72.t.3.nc" );
32 opts += ";VARIABLE=US";
33 ErrorCode rval = mb.load_file( test_file.c_str(), NULL, opts.c_str() );MB_CHK_ERR( rval );
34
35 return MB_SUCCESS;
36 }
37
38
39
40 ErrorCode TestErrorHandlingPar_2()
41 {
42 Core moab;
43 Interface& mb = moab;
44
45 string opts = ";;";
46 #ifdef MOAB_HAVE_MPI
47
48 opts += "PARALLEL=READ_PART;PARTITION_METHOD=UNKNOWN";
49 #endif
50
51
52 string test_file = string( MESH_DIR ) + string( "/io/fv3x46x72.t.3.nc" );
53 opts += ";VARIABLE=T";
54 ErrorCode rval = mb.load_file( test_file.c_str(), NULL, opts.c_str() );MB_CHK_ERR( rval );
55
56 return MB_SUCCESS;
57 }
58
59 int main( int argc, char** argv )
60 {
61 if( argc < 2 )
62 {
63 cout << "Usage: " << argv[0] << " <test_case_num(1 to 2>" << endl;
64 return 0;
65 }
66
67 #ifdef MOAB_HAVE_MPI
68 MPI_Init( &argc, &argv );
69 #endif
70
71
72 MBErrorHandler_Init();
73
74 ErrorCode rval = MB_SUCCESS;
75
76 int test_case_num = atoi( argv[1] );
77 switch( test_case_num )
78 {
79 case 1:
80 rval = TestErrorHandlingPar_1();MB_CHK_ERR( rval );
81 break;
82 case 2:
83 rval = TestErrorHandlingPar_2();MB_CHK_ERR( rval );
84 break;
85 default:
86 break;
87 }
88
89
90 MBErrorHandler_Finalize();
91
92 #ifdef MOAB_HAVE_MPI
93 MPI_Finalize();
94 #endif
95
96 return 0;
97 }