Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
TestErrorHandlingPar.cpp File Reference
#include "moab/Core.hpp"
#include <iostream>
+ Include dependency graph for TestErrorHandlingPar.cpp:

Go to the source code of this file.

Functions

ErrorCode TestErrorHandlingPar_1 ()
 
ErrorCode TestErrorHandlingPar_2 ()
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)
Examples
TestErrorHandlingPar.cpp.

Definition at line 59 of file TestErrorHandlingPar.cpp.

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  // Initialize error handler, optional for this example (using moab instances)
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  // Finalize error handler, optional for this example (using moab instances)
91 
92 #ifdef MOAB_HAVE_MPI
93  MPI_Finalize();
94 #endif
95 
96  return 0;
97 }

References ErrorCode, MB_CHK_ERR, MB_SUCCESS, moab::MBErrorHandler_Finalize(), moab::MBErrorHandler_Init(), TestErrorHandlingPar_1(), and TestErrorHandlingPar_2().

◆ TestErrorHandlingPar_1()

ErrorCode TestErrorHandlingPar_1 ( )
Examples
TestErrorHandlingPar.cpp.

Definition at line 19 of file TestErrorHandlingPar.cpp.

20 {
21  Core moab;
22  Interface& mb = moab;
23 
24  string opts = ";;";
25 #ifdef MOAB_HAVE_MPI
26  // Use parallel options
27  opts += "PARALLEL=READ_PART;PARTITION_METHOD=SQIJ";
28 #endif
29 
30  // Load a CAM-FV file and read a variable on edges (not supported yet)
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 }

References ErrorCode, moab::Core::load_file(), mb, MB_CHK_ERR, MB_SUCCESS, and MESH_DIR.

Referenced by main().

◆ TestErrorHandlingPar_2()

ErrorCode TestErrorHandlingPar_2 ( )
Examples
TestErrorHandlingPar.cpp.

Definition at line 40 of file TestErrorHandlingPar.cpp.

41 {
42  Core moab;
43  Interface& mb = moab;
44 
45  string opts = ";;";
46 #ifdef MOAB_HAVE_MPI
47  // Use parallel options
48  opts += "PARALLEL=READ_PART;PARTITION_METHOD=UNKNOWN";
49 #endif
50 
51  // Load a CAM-FV file with an unknown partition method specified
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 }

References ErrorCode, moab::Core::load_file(), mb, MB_CHK_ERR, MB_SUCCESS, and MESH_DIR.

Referenced by main().