MOAB: Mesh Oriented datABase  (version 5.5.0)
read_gcrm_nc.cpp
Go to the documentation of this file.
1 #include "TestUtil.hpp"
2 #include "moab/Core.hpp"
3 #include "moab/ReadUtilIface.hpp"
4 #include "MBTagConventions.hpp"
5 
6 using namespace moab;
7 
8 std::string example = TestDir + "unittest/io/gcrm_r3.nc";
9 
10 #ifdef MOAB_HAVE_MPI
11 #include "moab_mpi.h"
12 #include "moab/ParallelComm.hpp"
13 #endif
14 
15 void test_read_all();
16 void test_read_onevar();
18 void test_read_nomesh();
19 void test_read_novars();
20 void test_read_no_edges(); // Test read option NO_EDGES
21 void test_gather_onevar(); // Test gather set with one variable
22 
23 void get_options( std::string& opts );
24 
25 const double eps = 1e-6;
26 const int layers = 3;
27 const int interfaces = 3;
28 
29 int main( int argc, char* argv[] )
30 {
31  int result = 0;
32 
33 #ifdef MOAB_HAVE_MPI
34  int fail = MPI_Init( &argc, &argv );
35  if( fail ) return 1;
36 #else
37  argv[0] = argv[argc - argc]; // To remove the warnings in serial mode about unused variables
38 #endif
39 
40  result += RUN_TEST( test_read_all );
41  result += RUN_TEST( test_read_onevar );
42  result += RUN_TEST( test_read_onetimestep );
43  result += RUN_TEST( test_read_nomesh );
44  result += RUN_TEST( test_read_novars );
45  result += RUN_TEST( test_read_no_edges );
46  result += RUN_TEST( test_gather_onevar );
47 
48 #ifdef MOAB_HAVE_MPI
49  fail = MPI_Finalize();
50  if( fail ) return 1;
51 #endif
52 
53  return result;
54 }
55 
57 {
58  Core moab;
59  Interface& mb = moab;
60 
61  std::string opts;
62  get_options( opts );
63 
64  // Read mesh and read all variables at all timesteps
65  ErrorCode rval = mb.load_file( example.c_str(), 0, opts.c_str() );CHECK_ERR( rval );
66 
67 #ifdef MOAB_HAVE_MPI
68  ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
69  int procs = pcomm->proc_config().proc_size();
70 #else
71  int procs = 1;
72 #endif
73 
74  // Make check runs this test on one processor
75  if( 1 == procs )
76  {
77  // For u, wind and vorticity, check tag values on two entities
78  double val[2 * layers];
79 
80  // Check tags for vertex variable u
81  Tag u_tag0, u_tag1;
82  rval = mb.tag_get_handle( "u0", layers, MB_TYPE_DOUBLE, u_tag0 );CHECK_ERR( rval );
83  rval = mb.tag_get_handle( "u1", layers, MB_TYPE_DOUBLE, u_tag1 );CHECK_ERR( rval );
84 
85  // Get vertices (1280 vertices)
86  Range verts;
87  rval = mb.get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
88  CHECK_EQUAL( (size_t)1280, verts.size() );
89  CHECK_EQUAL( (size_t)1, verts.psize() );
90 
91  // Check u tag values on first and last vertices
92  EntityHandle vert_ents[] = { verts[0], verts[1279] };
93 
94  // Only check first two layers
95  // Timestep 0
96  rval = mb.tag_get_data( u_tag0, vert_ents, 2, val );CHECK_ERR( rval );
97  // Layer 0
98  CHECK_REAL_EQUAL( -4.839992, val[0 * layers], eps );
99  CHECK_REAL_EQUAL( -3.699257, val[1 * layers], eps );
100  // Layer 1
101  CHECK_REAL_EQUAL( -4.839925, val[0 * layers + 1], eps );
102  CHECK_REAL_EQUAL( -3.699206, val[1 * layers + 1], eps );
103 
104  // Timestep 1
105  rval = mb.tag_get_data( u_tag1, vert_ents, 2, val );CHECK_ERR( rval );
106  // Layer 0
107  CHECK_REAL_EQUAL( -4.712473, val[0 * layers], eps );
108  CHECK_REAL_EQUAL( -3.601793, val[1 * layers], eps );
109  // Layer 1
110  CHECK_REAL_EQUAL( -4.712409, val[0 * layers + 1], eps );
111  CHECK_REAL_EQUAL( -3.601743, val[1 * layers + 1], eps );
112 
113  // Check tags for edge variable wind
114  Tag wind_tag0, wind_tag1;
115  rval = mb.tag_get_handle( "wind0", layers, MB_TYPE_DOUBLE, wind_tag0 );CHECK_ERR( rval );
116  rval = mb.tag_get_handle( "wind1", layers, MB_TYPE_DOUBLE, wind_tag1 );CHECK_ERR( rval );
117 
118  // Get edges (1920 edges)
119  Range edges;
120  rval = mb.get_entities_by_type( 0, MBEDGE, edges );CHECK_ERR( rval );
121  CHECK_EQUAL( (size_t)1920, edges.size() );
122  CHECK_EQUAL( (size_t)1, edges.psize() );
123 
124  // Check wind tag values on first and last edges
125  EntityHandle edge_ents[] = { edges[0], edges[1919] };
126 
127  // Only check first two layers
128  // Timestep 0
129  rval = mb.tag_get_data( wind_tag0, edge_ents, 2, val );CHECK_ERR( rval );
130  // Layer 0
131  CHECK_REAL_EQUAL( -5.081991, val[0 * layers], eps );
132  CHECK_REAL_EQUAL( -6.420274, val[1 * layers], eps );
133  // Layer 1
134  CHECK_REAL_EQUAL( -5.081781, val[0 * layers + 1], eps );
135  CHECK_REAL_EQUAL( -6.419831, val[1 * layers + 1], eps );
136 
137  // Timestep 1
138  rval = mb.tag_get_data( wind_tag1, edge_ents, 2, val );CHECK_ERR( rval );
139  // Layer 0
140  CHECK_REAL_EQUAL( -4.948097, val[0 * layers], eps );
141  CHECK_REAL_EQUAL( -6.251121, val[1 * layers], eps );
142  // Layer 1
143  CHECK_REAL_EQUAL( -4.947892, val[0 * layers + 1], eps );
144  CHECK_REAL_EQUAL( -6.250690, val[1 * layers + 1], eps );
145 
146  // Check tags for cell variable vorticity
147  Tag vorticity_tag0, vorticity_tag1;
148  rval = mb.tag_get_handle( "vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0 );CHECK_ERR( rval );
149  rval = mb.tag_get_handle( "vorticity1", layers, MB_TYPE_DOUBLE, vorticity_tag1 );CHECK_ERR( rval );
150 
151  // Get cells (12 pentagons and 630 hexagons)
152  Range cells;
153  rval = mb.get_entities_by_type( 0, MBPOLYGON, cells );CHECK_ERR( rval );
154  CHECK_EQUAL( (size_t)642, cells.size() );
155 
156  // GCRM pentagons are always padded to hexagons
157  CHECK_EQUAL( (size_t)1, cells.psize() );
158 
159  // Check vorticity tag values on first and last cells
160  EntityHandle cell_ents[] = { cells[0], cells[641] };
161 
162  // Only check first two layers
163  // Timestep 0
164  rval = mb.tag_get_data( vorticity_tag0, cell_ents, 2, val );CHECK_ERR( rval );
165  // Layer 0
166  CHECK_REAL_EQUAL( 3.629994, val[0 * layers], eps );
167  CHECK_REAL_EQUAL( -0.554888, val[1 * layers], eps );
168  // Layer 1
169  CHECK_REAL_EQUAL( 3.629944, val[0 * layers + 1], eps );
170  CHECK_REAL_EQUAL( -0.554881, val[1 * layers + 1], eps );
171 
172  // Timestep 1
173  rval = mb.tag_get_data( vorticity_tag1, cell_ents, 2, val );CHECK_ERR( rval );
174  // Layer 0
175  CHECK_REAL_EQUAL( 3.534355, val[0 * layers], eps );
176  CHECK_REAL_EQUAL( -0.540269, val[1 * layers], eps );
177  // Layer 1
178  CHECK_REAL_EQUAL( 3.534306, val[0 * layers + 1], eps );
179  CHECK_REAL_EQUAL( -0.540262, val[1 * layers + 1], eps );
180 
181  // Check tags for cell variable pressure
182  Tag pressure_tag0, pressure_tag1;
183  rval = mb.tag_get_handle( "pressure0", interfaces, MB_TYPE_DOUBLE, pressure_tag0 );CHECK_ERR( rval );
184  rval = mb.tag_get_handle( "pressure1", interfaces, MB_TYPE_DOUBLE, pressure_tag1 );CHECK_ERR( rval );
185 
186  // For pressure, check tag values on two cells
187  double pressure_val[2 * interfaces];
188 
189  // Check pressure tag values on first and last cells
190  // Only check first two interfaces
191  // Timestep 0
192  rval = mb.tag_get_data( pressure_tag0, cell_ents, 2, pressure_val );CHECK_ERR( rval );
193  // Interface 0
194  CHECK_REAL_EQUAL( 4.44234e-06, pressure_val[0 * interfaces], 1e-11 );
195  CHECK_REAL_EQUAL( 0.2486804, pressure_val[1 * interfaces], 1e-7 );
196  // Interface 1
197  CHECK_REAL_EQUAL( 4.44234e-06, pressure_val[0 * interfaces + 1], 1e-11 );
198  CHECK_REAL_EQUAL( 0.2486804, pressure_val[1 * interfaces + 1], 1e-7 );
199 
200  // Timestep 1
201  rval = mb.tag_get_data( pressure_tag1, cell_ents, 2, pressure_val );CHECK_ERR( rval );
202  // Interface 0
203  CHECK_REAL_EQUAL( 2.365176e-07, pressure_val[0 * interfaces], 1e-13 );
204  CHECK_REAL_EQUAL( 0.02234409, pressure_val[1 * interfaces], 1e-8 );
205  // Interface 1
206  CHECK_REAL_EQUAL( 2.365176e-07, pressure_val[0 * interfaces + 1], 1e-13 );
207  CHECK_REAL_EQUAL( 0.02234409, pressure_val[1 * interfaces + 1], 1e-8 );
208  }
209 }
210 
212 {
213  Core moab;
214  Interface& mb = moab;
215 
216  std::string opts;
217  get_options( opts );
218 
219  // Read mesh and read cell variable vorticity at all timesteps
220  opts += ";VARIABLE=vorticity";
221  ErrorCode rval = mb.load_file( example.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
222 
223 #ifdef MOAB_HAVE_MPI
224  ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
225  int procs = pcomm->proc_config().proc_size();
226 #else
227  int procs = 1;
228 #endif
229 
230  // Make check runs this test on one processor
231  if( 1 == procs )
232  {
233  // Check vorticity tags
234  Tag vorticity_tag0, vorticity_tag1;
235  rval = mb.tag_get_handle( "vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0 );CHECK_ERR( rval );
236  rval = mb.tag_get_handle( "vorticity1", layers, MB_TYPE_DOUBLE, vorticity_tag1 );CHECK_ERR( rval );
237 
238  // Get cells (12 pentagons and 630 hexagons)
239  Range cells;
240  rval = mb.get_entities_by_type( 0, MBPOLYGON, cells );CHECK_ERR( rval );
241  CHECK_EQUAL( (size_t)642, cells.size() );
242 
243  // GCRM pentagons are always padded to hexagons
244  CHECK_EQUAL( (size_t)1, cells.psize() );
245 
246  // Check vorticity tag values on 4 cells: first cell, two median cells, and last cell
247  EntityHandle cell_ents[] = { cells[0], cells[320], cells[321], cells[641] };
248  double vorticity_val[4 * layers];
249 
250  // Only check first two layers
251  // Timestep 0
252  rval = mb.tag_get_data( vorticity_tag0, cell_ents, 4, vorticity_val );CHECK_ERR( rval );
253  // Layer 0
254  CHECK_REAL_EQUAL( 3.629994, vorticity_val[0 * layers], eps );
255  CHECK_REAL_EQUAL( 0.131688, vorticity_val[1 * layers], eps );
256  CHECK_REAL_EQUAL( -0.554888, vorticity_val[2 * layers], eps );
257  CHECK_REAL_EQUAL( -0.554888, vorticity_val[3 * layers], eps );
258  // Layer 1
259  CHECK_REAL_EQUAL( 3.629944, vorticity_val[0 * layers + 1], eps );
260  CHECK_REAL_EQUAL( 0.131686, vorticity_val[1 * layers + 1], eps );
261  CHECK_REAL_EQUAL( -0.554881, vorticity_val[2 * layers + 1], eps );
262  CHECK_REAL_EQUAL( -0.554881, vorticity_val[3 * layers + 1], eps );
263 
264  // Timestep 1
265  rval = mb.tag_get_data( vorticity_tag1, cell_ents, 4, vorticity_val );CHECK_ERR( rval );
266  // Layer 0
267  CHECK_REAL_EQUAL( 3.534355, vorticity_val[0 * layers], eps );
268  CHECK_REAL_EQUAL( 0.128218, vorticity_val[1 * layers], eps );
269  CHECK_REAL_EQUAL( -0.540269, vorticity_val[2 * layers], eps );
270  CHECK_REAL_EQUAL( -0.540269, vorticity_val[3 * layers], eps );
271  // Layer 1
272  CHECK_REAL_EQUAL( 3.534306, vorticity_val[0 * layers + 1], eps );
273  CHECK_REAL_EQUAL( 0.128216, vorticity_val[1 * layers + 1], eps );
274  CHECK_REAL_EQUAL( -0.540262, vorticity_val[2 * layers + 1], eps );
275  CHECK_REAL_EQUAL( -0.540262, vorticity_val[3 * layers + 1], eps );
276  }
277 }
278 
280 {
281  Core moab;
282  Interface& mb = moab;
283 
284  std::string opts;
285  get_options( opts );
286 
287  // Read mesh and read all variables at 2nd timestep
288  opts += ";TIMESTEP=1";
289  ErrorCode rval = mb.load_file( example.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
290 
291  // Check vorticity tags
292  Tag vorticity_tag0, vorticity_tag1;
293  rval = mb.tag_get_handle( "vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0 );
294  // Tag vorticity0 should not exist
295  CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
296  rval = mb.tag_get_handle( "vorticity1", layers, MB_TYPE_DOUBLE, vorticity_tag1 );CHECK_ERR( rval );
297 }
298 
300 {
301  Core moab;
302  Interface& mb = moab;
303 
304  // Need a file set for nomesh to work right
305  EntityHandle file_set;
306  ErrorCode rval = mb.create_meshset( MESHSET_SET, file_set );CHECK_ERR( rval );
307 
308  std::string orig, opts;
309  get_options( orig );
310 
311  // Read mesh and read all variables at 1st timestep
312  opts = orig + ";TIMESTEP=0";
313  rval = mb.load_file( example.c_str(), &file_set, opts.c_str() );CHECK_ERR( rval );
314 
315  // Check u tags
316  Tag u_tag0, u_tag1;
317  rval = mb.tag_get_handle( "u0", layers, MB_TYPE_DOUBLE, u_tag0 );CHECK_ERR( rval );
318  // Tag u1 should not exist
319  rval = mb.tag_get_handle( "u1", layers, MB_TYPE_DOUBLE, u_tag1 );
320  CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
321 
322  // Read all variables at 2nd timestep 0, no need to read mesh
323  opts = orig + ";TIMESTEP=1;NOMESH";
324  rval = mb.load_file( example.c_str(), &file_set, opts.c_str() );CHECK_ERR( rval );
325 
326  // Check tag u1 again
327  rval = mb.tag_get_handle( "u1", layers, MB_TYPE_DOUBLE, u_tag1 );
328  // Tag u1 should exist at this time
329  CHECK_ERR( rval );
330 }
331 
333 {
334  Core moab;
335  Interface& mb = moab;
336 
337  // Need a file set for nomesh to work right
338  EntityHandle file_set;
339  ErrorCode rval = mb.create_meshset( MESHSET_SET, file_set );CHECK_ERR( rval );
340 
341  std::string orig, opts;
342  get_options( orig );CHECK_ERR( rval );
343 
344  // Read header info only, no mesh, no variables
345  opts = orig + ";NOMESH;VARIABLE=";
346  rval = mb.load_file( example.c_str(), &file_set, opts.c_str() );CHECK_ERR( rval );
347 
348  // Read mesh, but still no variables
349  opts = orig + ";VARIABLE=";
350  rval = mb.load_file( example.c_str(), &file_set, opts.c_str() );CHECK_ERR( rval );
351 
352  // Check vorticity tags
353  Tag vorticity_tag0, vorticity_tag1;
354  rval = mb.tag_get_handle( "vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0 );
355  // Tag vorticity0 should not exist
356  CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
357  rval = mb.tag_get_handle( "vorticity1", layers, MB_TYPE_DOUBLE, vorticity_tag1 );
358  // Tag vorticity1 should not exist
359  CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
360 
361  // Read vorticity at 1st timestep, no need to read mesh
362  opts = orig + ";VARIABLE=vorticity;TIMESTEP=0;NOMESH";
363  rval = mb.load_file( example.c_str(), &file_set, opts.c_str() );CHECK_ERR( rval );
364 
365  // Check vorticity tags again
366  rval = mb.tag_get_handle( "vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0 );
367  // Tag vorticity0 should exist at this time
368  CHECK_ERR( rval );
369  // Tag vorticity1 should still not exist
370  rval = mb.tag_get_handle( "vorticity1", layers, MB_TYPE_DOUBLE, vorticity_tag1 );
371  CHECK_EQUAL( rval, MB_TAG_NOT_FOUND );
372 
373  // Read vorticity at 2nd timestep, no need to read mesh
374  opts = orig + ";VARIABLE=vorticity;TIMESTEP=1;NOMESH";
375  rval = mb.load_file( example.c_str(), &file_set, opts.c_str() );CHECK_ERR( rval );
376 
377  // Check tag vorticity1 again
378  rval = mb.tag_get_handle( "vorticity1", layers, MB_TYPE_DOUBLE, vorticity_tag1 );
379  // Tag vorticity1 should exist at this time
380  CHECK_ERR( rval );
381 
382 #ifdef MOAB_HAVE_MPI
383  ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
384  int procs = pcomm->proc_config().proc_size();
385 #else
386  int procs = 1;
387 #endif
388 
389  // Make check runs this test on one processor
390  if( 1 == procs )
391  {
392  // Get cells (12 pentagons and 630 hexagons)
393  Range cells;
394  rval = mb.get_entities_by_type( file_set, MBPOLYGON, cells );CHECK_ERR( rval );
395  CHECK_EQUAL( (size_t)642, cells.size() );
396 
397  // GCRM pentagons are always padded to hexagons
398  CHECK_EQUAL( (size_t)1, cells.psize() );
399 
400  // Check vorticity tag values on 4 cells: first cell, two median cells, and last cell
401  EntityHandle cell_ents[] = { cells[0], cells[320], cells[321], cells[641] };
402  double vorticity_val[4 * layers];
403 
404  // Only check first two layers
405  // Timestep 0
406  rval = mb.tag_get_data( vorticity_tag0, cell_ents, 4, vorticity_val );CHECK_ERR( rval );
407  // Layer 0
408  CHECK_REAL_EQUAL( 3.629994, vorticity_val[0 * layers], eps );
409  CHECK_REAL_EQUAL( 0.131688, vorticity_val[1 * layers], eps );
410  CHECK_REAL_EQUAL( -0.554888, vorticity_val[2 * layers], eps );
411  CHECK_REAL_EQUAL( -0.554888, vorticity_val[3 * layers], eps );
412  // Layer 1
413  CHECK_REAL_EQUAL( 3.629944, vorticity_val[0 * layers + 1], eps );
414  CHECK_REAL_EQUAL( 0.131686, vorticity_val[1 * layers + 1], eps );
415  CHECK_REAL_EQUAL( -0.554881, vorticity_val[2 * layers + 1], eps );
416  CHECK_REAL_EQUAL( -0.554881, vorticity_val[3 * layers + 1], eps );
417 
418  // Timestep 1
419  rval = mb.tag_get_data( vorticity_tag1, cell_ents, 4, vorticity_val );CHECK_ERR( rval );
420  // Layer 0
421  CHECK_REAL_EQUAL( 3.534355, vorticity_val[0 * layers], eps );
422  CHECK_REAL_EQUAL( 0.128218, vorticity_val[1 * layers], eps );
423  CHECK_REAL_EQUAL( -0.540269, vorticity_val[2 * layers], eps );
424  CHECK_REAL_EQUAL( -0.540269, vorticity_val[3 * layers], eps );
425  // Layer 1
426  CHECK_REAL_EQUAL( 3.534306, vorticity_val[0 * layers + 1], eps );
427  CHECK_REAL_EQUAL( 0.128216, vorticity_val[1 * layers + 1], eps );
428  CHECK_REAL_EQUAL( -0.540262, vorticity_val[2 * layers + 1], eps );
429  CHECK_REAL_EQUAL( -0.540262, vorticity_val[3 * layers + 1], eps );
430  }
431 }
432 
434 {
435  Core moab;
436  Interface& mb = moab;
437 
438  std::string opts;
439  get_options( opts );
440 
441  opts += ";NO_EDGES;VARIABLE=";
442  ErrorCode rval = mb.load_file( example.c_str(), NULL, opts.c_str() );CHECK_ERR( rval );
443 
444  // Get edges
445  Range edges;
446  rval = mb.get_entities_by_type( 0, MBEDGE, edges );CHECK_ERR( rval );
447  CHECK_EQUAL( (size_t)0, edges.size() );
448 }
449 
451 {
452  Core moab;
453  Interface& mb = moab;
454 
455  EntityHandle file_set;
456  ErrorCode rval = mb.create_meshset( MESHSET_SET, file_set );CHECK_ERR( rval );
457 
458  std::string opts;
459  get_options( opts );
460 
461  // Read cell variable vorticity and create gather set on processor 0
462  opts += ";VARIABLE=vorticity;GATHER_SET=0";
463  rval = mb.load_file( example.c_str(), &file_set, opts.c_str() );CHECK_ERR( rval );
464 
465 #ifdef MOAB_HAVE_MPI
466  ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
467  int rank = pcomm->proc_config().proc_rank();
468 
469  Range cells, cells_owned;
470  rval = mb.get_entities_by_type( file_set, MBPOLYGON, cells );CHECK_ERR( rval );
471 
472  // Get local owned cells
473  rval = pcomm->filter_pstatus( cells, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1, &cells_owned );CHECK_ERR( rval );
474 
475  EntityHandle gather_set = 0;
476  if( 0 == rank )
477  {
478  // Get gather set
479  ReadUtilIface* readUtilIface;
480  mb.query_interface( readUtilIface );
481  rval = readUtilIface->get_gather_set( gather_set );CHECK_ERR( rval );
482  assert( gather_set != 0 );
483  }
484 
485  Tag vorticity_tag0, gid_tag;
486  rval = mb.tag_get_handle( "vorticity0", layers, MB_TYPE_DOUBLE, vorticity_tag0, MB_TAG_DENSE );CHECK_ERR( rval );
487 
488  gid_tag = mb.globalId_tag();
489 
490  pcomm->gather_data( cells_owned, vorticity_tag0, gid_tag, gather_set, 0 );
491 
492  if( 0 == rank )
493  {
494  // Get gather set cells
495  Range gather_set_cells;
496  rval = mb.get_entities_by_type( gather_set, MBPOLYGON, gather_set_cells );CHECK_ERR( rval );
497  CHECK_EQUAL( (size_t)642, gather_set_cells.size() );
498  CHECK_EQUAL( (size_t)1, gather_set_cells.psize() );
499 
500  // Check vorticity0 tag values on 4 gather set cells: first cell, two median cells, and last
501  // cell
502  EntityHandle cell_ents[] = { gather_set_cells[0], gather_set_cells[320], gather_set_cells[321],
503  gather_set_cells[641] };
504  double vorticity0_val[4 * layers];
505  rval = mb.tag_get_data( vorticity_tag0, cell_ents, 4, vorticity0_val );CHECK_ERR( rval );
506 
507  // Only check first two layers
508  // Layer 0
509  CHECK_REAL_EQUAL( 3.629994, vorticity0_val[0 * layers], eps );
510  CHECK_REAL_EQUAL( 0.131688, vorticity0_val[1 * layers], eps );
511  CHECK_REAL_EQUAL( -0.554888, vorticity0_val[2 * layers], eps );
512  CHECK_REAL_EQUAL( -0.554888, vorticity0_val[3 * layers], eps );
513  // Layer 1
514  CHECK_REAL_EQUAL( 3.629944, vorticity0_val[0 * layers + 1], eps );
515  CHECK_REAL_EQUAL( 0.131686, vorticity0_val[1 * layers + 1], eps );
516  CHECK_REAL_EQUAL( -0.554881, vorticity0_val[2 * layers + 1], eps );
517  CHECK_REAL_EQUAL( -0.554881, vorticity0_val[3 * layers + 1], eps );
518  }
519 #endif
520 }
521 
522 void get_options( std::string& opts )
523 {
524 #ifdef MOAB_HAVE_MPI
525  // Use parallel options
526  opts = std::string( ";;PARALLEL=READ_PART;PARTITION_METHOD=TRIVIAL" );
527 #else
528  opts = std::string( ";;" );
529 #endif
530 }