MOAB: Mesh Oriented datABase  (version 5.5.0)
partest.cpp
Go to the documentation of this file.
1 #include <cstdio>
2 #include <cstring>
3 #include "moab_mpi.h"
4 #include "iMeshP.h"
5 
6 #define IMESH_ASSERT( ierr ) \
7  if( ( ierr ) != 0 ) printf( "imesh assert\n" );
8 #define IMESH_NULL 0
9 #define STRINGIFY_( X ) #X
10 #define STRINGIFY( X ) STRINGIFY_( X )
11 
12 int main( int argc, char* argv[] )
13 {
14  MPI_Init( &argc, &argv );
15  printf( "Hello\n" );
16 
17  iMesh_Instance imesh;
19  int ierr, num_sets;
20 
22  imesh = IMESH_NULL;
23  iMesh_newMesh( 0, &imesh, &ierr, 0 );
24  IMESH_ASSERT( ierr );
25  iMesh_getRootSet( imesh, &root, &ierr );
26  IMESH_ASSERT( ierr );
27 
28  iMeshP_createPartitionAll( imesh, MPI_COMM_WORLD, &partn, &ierr );
29  IMESH_ASSERT( ierr );
30 
31  const char options[] = " moab:PARALLEL=READ_PART "
32  " moab:PARTITION=PARALLEL_PARTITION "
33  " moab:PARALLEL_RESOLVE_SHARED_ENTS "
34  " moab:PARTITION_DISTRIBUTE ";
35  const char* filename = STRINGIFY( MESHDIR ) "/64bricks_1khex.h5m";
36  ;
37 
38  iMeshP_loadAll( imesh, partn, root, filename, options, &ierr, strlen( filename ), strlen( options ) );
39  IMESH_ASSERT( ierr );
40 
41  iMesh_getNumEntSets( imesh, IMESH_NULL, 1, &num_sets, &ierr );
42  IMESH_ASSERT( ierr );
43  printf( "There's %d entity sets here\n", num_sets );
44 
45  iMesh_dtor( imesh, &ierr );
46  IMESH_ASSERT( ierr );
47 
48  printf( "Done\n" );
49  MPI_Finalize(); // probably the 4th time this is called.. no big deal
50 }