MOAB: Mesh Oriented datABase  (version 5.5.0)
h5portable.cpp
Go to the documentation of this file.
1 /** \file h5portable.cpp
2  * \author Jason Kraftcheck
3  * \date 2010-09-23
4  *
5  * Tests for HDF5 portability because we call H5Tconvert ourselves
6  * to work around parallel performance issues in the HDF5 library.
7  */
8 
9 #include "moab/Core.hpp"
10 #include "moab/Range.hpp"
11 #include "TestRunner.hpp"
12 #include "ReadHDF5.hpp"
13 #include "MBTagConventions.hpp"
14 #include "moab/FileOptions.hpp"
15 #include <vector>
16 #include <cstdlib>
17 #include <iostream>
18 #include <algorithm>
19 #include <limits>
20 
21 using namespace moab;
22 
23 #define FILE_NAME_BASE "portable"
24 #define BASE_NAME STRINGIFY( MESHDIR ) "/h5file/" FILE_NAME_BASE
25 #define NATIVE_NAME FILE_NAME_BASE ".h5m"
26 #define READ_OPTS "BUFFER_SIZE=256"
27 
28 const int default_int_tag[] = { -100, -99 };
29 const int mesh_int_tag[] = { 1134, -1134 };
30 const double default_real_tag[] = { -1, -2, -3, -4, -5, -6, -7, -8 };
31 const double mesh_real_tag[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
32 
33 const size_t INTERVALS = 8;
34 const size_t NUM_VERT = ( INTERVALS + 1 ) * ( INTERVALS + 1 );
35 const size_t NUM_QUAD = INTERVALS * INTERVALS;
36 const double Z = 0.0;
37 const double EPS = std::numeric_limits< double >::epsilon();
38 
39 // This function is not actually called from any test.
40 // It is the utility code used to generate the initial
41 // input file.
42 //
43 // Create a mesh with the following properties:
44 // A 8x8 grid of quadrilateral elements in the Z plane
45 // Lower left vertex is at origin
46 // Vertex coordinates are incremented by 1 in increasing X and Y directions
47 // Each element's connectivity is ordered starting with the lower-left vertex
48 // counter-clockwise about the positive Z axis.
49 // Each element is tagged with the integer value of it's lower-left vertex
50 // coordinates ("int_tag", default = [-100,-99], mesh = [1134,-1134])
51 // Each element is tagged with the array of its vertex coordinates (interleaved)
52 // ("real_tag", default = [-1, -2, -3, -4, -5, -6, -7, -8], mesh = [8, 7, 5, 5, 4, 3, 2, 1])
53 // Each vertex is tagged with the handle of the element for which it is the
54 // lower left vertex ("handle_tag")
55 // A set containing each row of quads that is a child of the row below it
56 // Each set tagged with a bit tag indicating whether it is an even or odd row,
57 // with the first row even. ("bit_tag");
58 // Each set will also be tagged with an integer tag named 'rowset' containing
59 // the same value as the "bit_tag" for use in testing partial reads.
60 //
61 // | | | | | | | | |
62 // | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
63 // | | | | | | | | |
64 // 19-----20-----21-----22-----23-----24-----25-----26-----27
65 // | | | | | | | | |
66 // | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
67 // | | | | | | | | |
68 // 10-----11-----12-----13-----14-----15-----16-----17-----18
69 // | | | | | | | | |
70 // | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
71 // | | | | | | | | |
72 // 1------2------3------4------5------6------7------8------9
73 void create_mesh( const char* filename )
74 {
75  EntityHandle verts[NUM_VERT];
76  EntityHandle quads[NUM_QUAD];
77 
78  ErrorCode rval;
79  Core core;
80  Interface& mb = core;
81  const EntityHandle root = 0;
82 
83  Tag int_tag, real_tag, handle_tag, bit_tag, row_tag;
84 
85  rval = mb.tag_get_handle( "int_tag", 2, MB_TYPE_INTEGER, int_tag, MB_TAG_DENSE | MB_TAG_EXCL, default_int_tag );CHECK_ERR( rval );
86  rval = mb.tag_set_data( int_tag, &root, 1, mesh_int_tag );CHECK_ERR( rval );
87 
88  rval = mb.tag_get_handle( "real_tag", 8, MB_TYPE_DOUBLE, real_tag, MB_TAG_DENSE | MB_TAG_EXCL, default_real_tag );CHECK_ERR( rval );
89  rval = mb.tag_set_data( real_tag, &root, 1, mesh_real_tag );CHECK_ERR( rval );
90 
91  rval = mb.tag_get_handle( "handle_tag", 1, MB_TYPE_HANDLE, handle_tag, MB_TAG_SPARSE | MB_TAG_EXCL );CHECK_ERR( rval );
92 
93  rval = mb.tag_get_handle( "bit_tag", 1, MB_TYPE_BIT, bit_tag, MB_TAG_EXCL );CHECK_ERR( rval );
94 
95  rval = mb.tag_get_handle( "rowset", 1, MB_TYPE_INTEGER, row_tag, MB_TAG_SPARSE | MB_TAG_EXCL );CHECK_ERR( rval );
96 
97  for( size_t i = 0; i < NUM_VERT; ++i )
98  {
99  double coords[] = { static_cast< double >( i % 9 ), static_cast< double >( i / 9 ),
100  static_cast< double >( Z ) };
101  rval = mb.create_vertex( coords, verts[i] );CHECK_ERR( rval );
102  }
103 
104  for( size_t i = 0; i < NUM_QUAD; ++i )
105  {
106  size_t j = ( i / 8 ) * 9 + i % 8;
107  EntityHandle conn[] = { verts[j], verts[j + 1], verts[j + 10], verts[j + 9] };
108  rval = mb.create_element( MBQUAD, conn, 4, quads[i] );CHECK_ERR( rval );
109 
110  double coords[4 * 3];
111  rval = mb.get_coords( conn, 4, coords );CHECK_ERR( rval );
112 
113  int int_val[] = { (int)coords[0], (int)coords[1] };
114  rval = mb.tag_set_data( int_tag, quads + i, 1, int_val );CHECK_ERR( rval );
115 
116  double real_val[] = { coords[0], coords[1], coords[3], coords[4], coords[6], coords[7], coords[9], coords[10] };
117  rval = mb.tag_set_data( real_tag, quads + i, 1, real_val );CHECK_ERR( rval );
118 
119  rval = mb.tag_set_data( handle_tag, conn, 1, quads + i );CHECK_ERR( rval );
120  }
121 
122  EntityHandle prev = 0;
123  for( size_t i = 0; i < INTERVALS; ++i )
124  {
125  EntityHandle set;
126  int flag = i < 4 ? MESHSET_SET : MESHSET_ORDERED;
127  rval = mb.create_meshset( flag, set );CHECK_ERR( rval );
128 
129  rval = mb.add_entities( set, quads + i * INTERVALS, INTERVALS );CHECK_ERR( rval );
130 
131  char bit = i % 2;
132  rval = mb.tag_set_data( bit_tag, &set, 1, &bit );CHECK_ERR( rval );
133 
134  int ival = bit;
135  rval = mb.tag_set_data( row_tag, &set, 1, &ival );CHECK_ERR( rval );
136 
137  if( prev != 0 )
138  {
139  rval = mb.add_parent_child( prev, set );CHECK_ERR( rval );
140  }
141  prev = set;
142  }
143 
144  rval = mb.write_file( filename, "MOAB" );CHECK_ERR( rval );
145 }
146 
147 void test_load_file( const char* filename )
148 {
149  Core core;
150  Interface& mb = core;
151  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
152 }
153 
154 void test_read_vertices( const char* filename )
155 {
156  // load the file
157  Core core;
158  Interface& mb = core;
159  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
160  // get the vertices
161  Range verts;
162  rval = mb.get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
163  CHECK_EQUAL( NUM_VERT, verts.size() );
164  // check vertex coordinates
165  bool seen[INTERVALS + 1][INTERVALS + 1];
166  for( size_t i = 0; i <= INTERVALS; ++i )
167  for( size_t j = 0; j <= INTERVALS; ++j )
168  seen[i][j] = false;
169  for( Range::iterator i = verts.begin(); i != verts.end(); ++i )
170  {
171  double coords[3];
172  rval = mb.get_coords( &*i, 1, coords );CHECK_ERR( rval );
173  CHECK_REAL_EQUAL( Z, coords[2], EPS );
174  size_t x = (size_t)coords[0];
175  size_t y = (size_t)coords[1];
176  CHECK_REAL_EQUAL( (double)x, coords[0], EPS );
177  CHECK_REAL_EQUAL( (double)y, coords[1], EPS );
178  CHECK( x <= INTERVALS );
179  CHECK( y <= INTERVALS );
180  CHECK( !seen[x][y] );
181  seen[x][y] = true;
182  }
183 }
184 
185 void test_elements( Interface& mb, bool odd_only )
186 {
187  // get the elements
188  Range quads;
189  ErrorCode rval = mb.get_entities_by_type( 0, MBQUAD, quads );CHECK_ERR( rval );
190  CHECK_EQUAL( NUM_QUAD / ( 1 + odd_only ), quads.size() );
191  // check quad connectivity
192  bool seen[INTERVALS][INTERVALS];
193  for( size_t i = 0; i < INTERVALS; ++i )
194  for( size_t j = 0; j < INTERVALS; ++j )
195  seen[i][j] = false;
196  for( Range::iterator i = quads.begin(); i != quads.end(); ++i )
197  {
198  const EntityHandle* conn = 0;
199  int len = 0;
200  rval = mb.get_connectivity( *i, conn, len );CHECK_ERR( rval );
201  CHECK_EQUAL( 4, len );
202  double coords[4 * 3];
203  rval = mb.get_coords( conn, len, coords );CHECK_ERR( rval );
204 
205  size_t x = (size_t)coords[0];
206  size_t y = (size_t)coords[1];
207  CHECK_REAL_EQUAL( (double)x, coords[0], EPS );
208  CHECK_REAL_EQUAL( (double)y, coords[1], EPS );
209  CHECK( x < INTERVALS );
210  CHECK( y < INTERVALS );
211 
212  CHECK_REAL_EQUAL( Z, coords[2], EPS );
213  CHECK_REAL_EQUAL( 1.0 + x, coords[3], EPS );
214  CHECK_REAL_EQUAL( 0.0 + y, coords[4], EPS );
215  CHECK_REAL_EQUAL( Z, coords[5], EPS );
216  CHECK_REAL_EQUAL( 1.0 + x, coords[6], EPS );
217  CHECK_REAL_EQUAL( 1.0 + y, coords[7], EPS );
218  CHECK_REAL_EQUAL( Z, coords[8], EPS );
219  CHECK_REAL_EQUAL( 0.0 + x, coords[9], EPS );
220  CHECK_REAL_EQUAL( 1.0 + y, coords[10], EPS );
221  CHECK_REAL_EQUAL( Z, coords[11], EPS );
222  }
223 
224  if( odd_only )
225  {
226  for( size_t i = 0; i < INTERVALS; i += 2 )
227  for( size_t j = 0; j < INTERVALS; ++j )
228  CHECK( !seen[i][j] );
229  }
230 }
231 
232 void test_read_elements( const char* filename )
233 {
234  // load the file
235  Core core;
236  Interface& mb = core;
237  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
238  // check the elements
239  test_elements( mb, false );
240 }
241 
243 {
244  // get the sets
245  Range sets;
246  ErrorCode rval = mb.get_entities_by_type( 0, MBENTITYSET, sets );CHECK_ERR( rval );
247  CHECK_EQUAL( INTERVALS, sets.size() );
248  // check set contents
249  for( Range::iterator i = sets.begin(); i != sets.end(); ++i )
250  {
251  Range contents;
252  rval = mb.get_entities_by_handle( *i, contents );CHECK_ERR( rval );
253  CHECK_EQUAL( INTERVALS, contents.size() );
254  CHECK( contents.all_of_type( MBQUAD ) );
255 
256  const EntityHandle* conn = 0;
257  int len = 0;
258  rval = mb.get_connectivity( contents.front(), conn, len );CHECK_ERR( rval );
259  double coords[3];
260  rval = mb.get_coords( conn, 1, coords );CHECK_ERR( rval );
261 
262  size_t y = (size_t)coords[1];
263  CHECK( y < INTERVALS );
264  rows[y] = *i;
265  }
266 }
267 
268 void test_read_set_contents( const char* filename )
269 {
270  // load the file
271  Core core;
272  Interface& mb = core;
273  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
274  // get the sets
275  EntityHandle rows[INTERVALS];
276  read_sets( mb, rows );
277  // check set contents
278  for( size_t i = 0; i < INTERVALS; ++i )
279  {
280  Range contents;
281  rval = mb.get_entities_by_handle( rows[i], contents );CHECK_ERR( rval );
282  CHECK_EQUAL( INTERVALS, contents.size() );
283  CHECK( contents.all_of_type( MBQUAD ) );
284 
285  for( Range::iterator j = contents.begin(); j != contents.end(); ++j )
286  {
287  const EntityHandle* conn = 0;
288  int len = 0;
289  rval = mb.get_connectivity( *j, conn, len );CHECK_ERR( rval );
290  double coords[3];
291  rval = mb.get_coords( conn, 1, coords );CHECK_ERR( rval );
292 
293  size_t y = (size_t)coords[1];
294  CHECK_EQUAL( i, y );
295  }
296  }
297 }
298 
300 {
301  // load the file
302  Core core;
303  Interface& mb = core;
304  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
305  // get the sets
306  EntityHandle rows[INTERVALS];
307  read_sets( mb, rows );
308  // check set children
309  std::vector< EntityHandle > list;
310  for( size_t i = 0; i < INTERVALS - 1; ++i )
311  {
312  list.clear();
313  rval = mb.get_child_meshsets( rows[i], list );CHECK_ERR( rval );
314  CHECK_EQUAL( (size_t)1, list.size() );
315  CHECK_EQUAL( rows[i + 1], list.front() );
316  }
317  list.clear();
318  rval = mb.get_child_meshsets( rows[INTERVALS - 1], list );CHECK_ERR( rval );
319  CHECK( list.empty() );
320  // check set parents
321  list.clear();
322  rval = mb.get_parent_meshsets( rows[0], list );CHECK_ERR( rval );
323  CHECK( list.empty() );
324  for( size_t i = 1; i < INTERVALS; ++i )
325  {
326  list.clear();
327  rval = mb.get_parent_meshsets( rows[i], list );CHECK_ERR( rval );
328  CHECK_EQUAL( (size_t)1, list.size() );
329  CHECK_EQUAL( rows[i - 1], list.front() );
330  }
331 }
332 
333 void test_read_int_tag( const char* filename )
334 {
335  // load the file
336  Core core;
337  Interface& mb = core;
338  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
339 
340  // get the tag
341  Tag tag;
342  rval = mb.tag_get_handle( "int_tag", 2, MB_TYPE_INTEGER, tag );CHECK_ERR( rval );
343 
344  // check tag properties
345  int size;
346  rval = mb.tag_get_length( tag, size );CHECK_ERR( rval );
347  CHECK_EQUAL( 2, size );
348  TagType storage;
349  rval = mb.tag_get_type( tag, storage );CHECK_ERR( rval );
350  CHECK_EQUAL( MB_TAG_DENSE, storage );
351  DataType type;
352  rval = mb.tag_get_data_type( tag, type );CHECK_ERR( rval );
353  CHECK_EQUAL( MB_TYPE_INTEGER, type );
354 
355  // check default value
356  int value[2];
357  rval = mb.tag_get_default_value( tag, value );CHECK_ERR( rval );
358  CHECK_ARRAYS_EQUAL( default_int_tag, 2, value, 2 );
359 
360  // check mesh value
361  const EntityHandle root = 0;
362  rval = mb.tag_get_data( tag, &root, 1, value );CHECK_ERR( rval );
363  CHECK_ARRAYS_EQUAL( mesh_int_tag, 2, value, 2 );
364 
365  // check entity values
366  Range quads;
367  rval = mb.get_entities_by_type( 0, MBQUAD, quads );CHECK_ERR( rval );
368  for( Range::iterator i = quads.begin(); i != quads.end(); ++i )
369  {
370  const EntityHandle* conn = 0;
371  int len = 0;
372  rval = mb.get_connectivity( *i, conn, len );CHECK_ERR( rval );
373  double coords[3];
374  rval = mb.get_coords( conn, 1, coords );CHECK_ERR( rval );
375  int exp[] = { (int)coords[0], (int)coords[1] };
376 
377  rval = mb.tag_get_data( tag, &*i, 1, value );CHECK_ERR( rval );
378  CHECK_ARRAYS_EQUAL( exp, 2, value, 2 );
379  }
380 }
381 
382 void test_read_real_tag( const char* filename )
383 {
384  // load the file
385  Core core;
386  Interface& mb = core;
387  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
388 
389  // get the tag
390  Tag tag;
391  rval = mb.tag_get_handle( "real_tag", 8, MB_TYPE_DOUBLE, tag );CHECK_ERR( rval );
392 
393  // check tag properties
394  int size;
395  rval = mb.tag_get_length( tag, size );CHECK_ERR( rval );
396  CHECK_EQUAL( 8, size );
397  TagType storage;
398  rval = mb.tag_get_type( tag, storage );CHECK_ERR( rval );
399  CHECK_EQUAL( MB_TAG_DENSE, storage );
400  DataType type;
401  rval = mb.tag_get_data_type( tag, type );CHECK_ERR( rval );
402  CHECK_EQUAL( MB_TYPE_DOUBLE, type );
403 
404  // check default value
405  double value[8];
406  rval = mb.tag_get_default_value( tag, value );CHECK_ERR( rval );
407  CHECK_ARRAYS_EQUAL( default_real_tag, 8, value, 8 );
408 
409  // check mesh value
410  const EntityHandle root = 0;
411  rval = mb.tag_get_data( tag, &root, 1, value );CHECK_ERR( rval );
412  CHECK_ARRAYS_EQUAL( mesh_real_tag, 8, value, 8 );
413 
414  // check entity values
415  Range quads;
416  rval = mb.get_entities_by_type( 0, MBQUAD, quads );CHECK_ERR( rval );
417  for( Range::iterator i = quads.begin(); i != quads.end(); ++i )
418  {
419  const EntityHandle* conn = 0;
420  int len = 0;
421  rval = mb.get_connectivity( *i, conn, len );CHECK_ERR( rval );
422  CHECK_EQUAL( 4, len );
423  double coords[3 * 4];
424  rval = mb.get_coords( conn, len, coords );CHECK_ERR( rval );
425  double exp[] = { coords[0], coords[1], coords[3], coords[4], coords[6], coords[7], coords[9], coords[10] };
426 
427  rval = mb.tag_get_data( tag, &*i, 1, value );CHECK_ERR( rval );
428  CHECK_ARRAYS_EQUAL( exp, 8, value, 8 );
429  }
430 }
431 
432 void test_read_handle_tag( const char* filename )
433 {
434  // load the file
435  Core core;
436  Interface& mb = core;
437  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
438 
439  // get the tag
440  Tag tag;
441  rval = mb.tag_get_handle( "handle_tag", 1, MB_TYPE_HANDLE, tag );CHECK_ERR( rval );
442 
443  // check tag properties
444  int size;
445  rval = mb.tag_get_length( tag, size );CHECK_ERR( rval );
446  CHECK_EQUAL( 1, size );
447  TagType storage;
448  rval = mb.tag_get_type( tag, storage );CHECK_ERR( rval );
449  CHECK_EQUAL( MB_TAG_SPARSE, storage );
450  DataType type;
451  rval = mb.tag_get_data_type( tag, type );CHECK_ERR( rval );
452  CHECK_EQUAL( MB_TYPE_HANDLE, type );
453 
454  // check entity values
455  Range quads;
456  rval = mb.get_entities_by_type( 0, MBQUAD, quads );CHECK_ERR( rval );
457  for( Range::iterator i = quads.begin(); i != quads.end(); ++i )
458  {
459  const EntityHandle* conn = 0;
460  int len = 0;
461  rval = mb.get_connectivity( *i, conn, len );CHECK_ERR( rval );
462 
463  EntityHandle value;
464  rval = mb.tag_get_data( tag, conn, 1, &value );CHECK_ERR( rval );
465  CHECK_EQUAL( *i, value );
466  }
467 }
468 
469 void test_read_bit_tag( const char* filename )
470 {
471  // load the file
472  Core core;
473  Interface& mb = core;
474  ErrorCode rval = mb.load_file( filename, 0, READ_OPTS );CHECK_ERR( rval );
475 
476  // get the tag
477  Tag tag;
478  rval = mb.tag_get_handle( "bit_tag", 1, MB_TYPE_BIT, tag );CHECK_ERR( rval );
479 
480  // check tag properties
481  int size;
482  rval = mb.tag_get_length( tag, size );CHECK_ERR( rval );
483  CHECK_EQUAL( 1, size );
484  TagType storage;
485  rval = mb.tag_get_type( tag, storage );CHECK_ERR( rval );
486  CHECK_EQUAL( MB_TAG_BIT, storage );
487  DataType type;
488  rval = mb.tag_get_data_type( tag, type );CHECK_ERR( rval );
489  CHECK_EQUAL( MB_TYPE_BIT, type );
490 
491  // check entity values
492  EntityHandle sets[INTERVALS];
493  read_sets( mb, sets );
494  char values[INTERVALS], expected[INTERVALS];
495  rval = mb.tag_get_data( tag, sets, INTERVALS, values );CHECK_ERR( rval );
496  for( size_t i = 0; i < INTERVALS; ++i )
497  expected[i] = (char)( i % 2 );
498  CHECK_ARRAYS_EQUAL( expected, INTERVALS, values, INTERVALS );
499 }
500 
501 void test_read_partial( const char* filename )
502 {
503  // load the file
504  Core core;
505  Interface& mb = core;
506  const int odd = 1;
507  ErrorCode rval = mb.load_file( filename, 0, "CHILDREN=NONE;SETS=NONE;" READ_OPTS, "rowset", &odd, 1 );CHECK_ERR( rval );
508  // check the elements
509  test_elements( mb, true );
510 }
511 
512 // Make sure everything works without data conversion just to verify
513 // that the tests themselves are valid
515 {
516  const char* filename = NATIVE_NAME;
527  if( !getenv( "KEEP_FILE" ) ) remove( filename );
528 }
529 
530 #define DEFINE_TEST_SET( NAME ) \
531  void test_load_file_##NAME() \
532  { \
533  test_load_file( BASE_NAME "_" #NAME ".h5m" ); \
534  } \
535  void test_read_vertices_##NAME() \
536  { \
537  test_read_vertices( BASE_NAME "_" #NAME ".h5m" ); \
538  } \
539  void test_read_elements_##NAME() \
540  { \
541  test_read_elements( BASE_NAME "_" #NAME ".h5m" ); \
542  } \
543  void test_read_set_contents_##NAME() \
544  { \
545  test_read_set_contents( BASE_NAME "_" #NAME ".h5m" ); \
546  } \
547  void test_read_set_parent_child_##NAME() \
548  { \
549  test_read_set_parent_child( BASE_NAME "_" #NAME ".h5m" ); \
550  } \
551  void test_read_int_tag_##NAME() \
552  { \
553  test_read_int_tag( BASE_NAME "_" #NAME ".h5m" ); \
554  } \
555  void test_read_real_tag_##NAME() \
556  { \
557  test_read_real_tag( BASE_NAME "_" #NAME ".h5m" ); \
558  } \
559  void test_read_handle_tag_##NAME() \
560  { \
561  test_read_handle_tag( BASE_NAME "_" #NAME ".h5m" ); \
562  } \
563  void test_read_bit_tag_##NAME() \
564  { \
565  test_read_bit_tag( BASE_NAME "_" #NAME ".h5m" ); \
566  } \
567  void test_read_partial_##NAME() \
568  { \
569  test_read_partial( BASE_NAME "_" #NAME ".h5m" ); \
570  }
571 
572 #define REGISTER_TEST_SET( NAME ) \
573  REGISTER_DEP_TEST( test_load_file_##NAME, test_native_read ); \
574  REGISTER_DEP_TEST( test_read_vertices_##NAME, test_load_file_##NAME ); \
575  REGISTER_DEP_TEST( test_read_elements_##NAME, test_read_vertices_##NAME ); \
576  REGISTER_DEP_TEST( test_read_set_contents_##NAME, test_read_elements_##NAME ); \
577  REGISTER_DEP_TEST( test_read_set_parent_child_##NAME, test_read_set_contents_##NAME ); \
578  REGISTER_DEP_TEST( test_read_int_tag_##NAME, test_read_elements_##NAME ); \
579  REGISTER_DEP_TEST( test_read_real_tag_##NAME, test_read_elements_##NAME ); \
580  REGISTER_DEP_TEST( test_read_handle_tag_##NAME, test_read_elements_##NAME ); \
581  REGISTER_DEP_TEST( test_read_bit_tag_##NAME, test_read_set_contents_##NAME ); \
582  REGISTER_DEP_TEST( test_read_partial_##NAME, test_read_elements_##NAME );
583 
584 DEFINE_TEST_SET( x86_64 )
585 DEFINE_TEST_SET( x86_32 )
586 DEFINE_TEST_SET( power_32 )
587 
588 int main( int argc, char* argv[] )
589 {
590 #ifdef MOAB_HAVE_MPI
591  int fail = MPI_Init( &argc, &argv );
592  if( fail ) return fail;
593 #endif
595  REGISTER_TEST_SET( x86_64 );
596  REGISTER_TEST_SET( x86_32 );
597  REGISTER_TEST_SET( power_32 );
598  int result = RUN_TESTS( argc, argv );
599 #ifdef MOAB_HAVE_MPI
600  fail = MPI_Finalize();
601  if( fail ) return fail;
602 #endif
603  return result;
604 }