MOAB: Mesh Oriented datABase  (version 5.5.0)
VtkTest.cpp File Reference
#include "moab/Core.hpp"
#include "moab/Range.hpp"
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include "TestUtil.hpp"
+ Include dependency graph for VtkTest.cpp:

Go to the source code of this file.

Classes

struct  test_data
 

Macros

#define DECLARE_TEST(A)
 
#define CHECK(A)    if( is_error( ( A ) ) ) return do_error( #A, __LINE__ )
 

Typedefs

typedef bool(* test_ptr) ()
 

Functions

int register_test (test_ptr test, const char *name)
 
int main (int argc, char *argv[])
 
static bool do_error (const char *string, int line)
 
static bool is_error (bool b)
 
static bool is_error (ErrorCode b)
 
bool read_file (Interface *iface, const char *file)
 
bool write_and_read (Interface *iface1, Interface *iface2)
 
bool test_read_write_element (const double *coords, unsigned num_coords, const int *vtk_conn, const int *moab_conn, unsigned num_conn, unsigned num_elem, unsigned vtk_type, EntityType moab_type)
 
bool test_edge2 ()
 
bool test_edge3 ()
 
bool test_tri3 ()
 
bool test_tri6 ()
 
bool test_quad4 ()
 
bool test_quad8 ()
 
bool test_quad9 ()
 
bool test_polygon ()
 
bool test_polygon_mix ()
 
bool test_polyhedra ()
 
bool test_tet4 ()
 
bool test_tet10 ()
 
bool test_hex8 ()
 
bool test_hex20 ()
 
bool test_hex27 ()
 
bool test_wedge ()
 
bool test_wedge15 ()
 
bool test_pyramid ()
 
bool test_pyramid13 ()
 
bool test_structured_2d (const char *file)
 
bool test_structured_3d (const char *file)
 
bool test_structured_points_2d ()
 
bool test_free_vertices (const char *file)
 
bool test_free_nodes ()
 
bool test_structured_grid_2d ()
 
bool test_rectilinear_grid_2d ()
 
bool test_structured_points_3d ()
 
bool test_structured_grid_3d ()
 
bool test_rectilinear_grid_3d ()
 
bool test_scalar_attrib (const char *vtk_type, DataType mb_type, int count)
 
bool test_vector_attrib (const char *vtk_type, DataType mb_type)
 
bool test_tensor_attrib (const char *vtk_type, DataType mb_type)
 
bool test_scalar_attrib_1_bit ()
 
bool test_scalar_attrib_1_uchar ()
 
bool test_scalar_attrib_1_char ()
 
bool test_scalar_attrib_1_ushort ()
 
bool test_scalar_attrib_1_short ()
 
bool test_scalar_attrib_1_uint ()
 
bool test_scalar_attrib_1_int ()
 
bool test_scalar_attrib_1_ulong ()
 
bool test_scalar_attrib_1_long ()
 
bool test_scalar_attrib_1_float ()
 
bool test_scalar_attrib_1_double ()
 
bool test_scalar_attrib_4_bit ()
 
bool test_scalar_attrib_4_uchar ()
 
bool test_scalar_attrib_4_char ()
 
bool test_scalar_attrib_4_ushort ()
 
bool test_scalar_attrib_4_short ()
 
bool test_scalar_attrib_4_uint ()
 
bool test_scalar_attrib_4_int ()
 
bool test_scalar_attrib_4_ulong ()
 
bool test_scalar_attrib_4_long ()
 
bool test_scalar_attrib_4_float ()
 
bool test_scalar_attrib_4_double ()
 
bool test_vector_attrib_bit ()
 
bool test_vector_attrib_uchar ()
 
bool test_vector_attrib_char ()
 
bool test_vector_attrib_ushort ()
 
bool test_vector_attrib_short ()
 
bool test_vector_attrib_uint ()
 
bool test_vector_attrib_int ()
 
bool test_vector_attrib_ulong ()
 
bool test_vector_attrib_long ()
 
bool test_vector_attrib_float ()
 
bool test_vector_attrib_double ()
 
bool test_tensor_attrib_uchar ()
 
bool test_tensor_attrib_char ()
 
bool test_tensor_attrib_ushort ()
 
bool test_tensor_attrib_short ()
 
bool test_tensor_attrib_uint ()
 
bool test_tensor_attrib_int ()
 
bool test_tensor_attrib_ulong ()
 
bool test_tensor_attrib_long ()
 
bool test_tensor_attrib_float ()
 
bool test_tensor_attrib_double ()
 
bool compare_connectivity (EntityType, const int *conn1, const int *conn2, unsigned len)
 
bool match_vertices_and_elements (Interface *iface, EntityType moab_type, unsigned num_vert, unsigned num_elem, unsigned vert_per_elem, const double *coords, const int *connectivity, EntityHandle *vert_handles, EntityHandle *elem_handles)
 
bool check_elements (Interface *iface, EntityType moab_type, unsigned num_elem, unsigned vert_per_elem, const double *coords, unsigned num_vert, const int *connectivity)
 
void write_data (char *file, size_t &len, DataType type, unsigned count, const int *vals)
 
bool check_tag_values (Interface *iface, DataType tag_type, int tag_length, int num_entities, const EntityHandle *entities, const int *values)
 
bool check_tag_values (Interface *iface, DataType type, int vals_per_ent)
 
bool check_tag_data (const char *file, DataType type, int vals_per_ent)
 
bool test_subset ()
 
bool test_write_free_nodes ()
 
bool test_unstructured_field ()
 

Variables

std::string poly_example = TestDir + "unittest/io/poly8-10.vtk"
 
std::string polyhedra_example = TestDir + "unittest/io/polyhedra.vtk"
 
size_t num_tests = 0
 
test_datatest_array = 0
 
const double grid_3x3 []
 
const int quad_structured_conn []
 
const double grid_2x2x2 []
 
const int hex_structured_conn []
 
const char two_quad_mesh []
 
const double two_quad_mesh_coords [] = { -1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 1, 0, 0, 1, 0, 1, 1, 0 }
 
const int two_quad_mesh_conn [] = { 0, 1, 4, 3, 1, 2, 5, 4 }
 
const int vertex_values []
 
const int element_values []
 

Macro Definition Documentation

◆ CHECK

#define CHECK (   A)     if( is_error( ( A ) ) ) return do_error( #A, __LINE__ )

Definition at line 189 of file VtkTest.cpp.

◆ DECLARE_TEST

#define DECLARE_TEST (   A)
Value:
bool test_##A(); \
int A##_reg_var = register_test( &test_##A, #A );

Definition at line 20 of file VtkTest.cpp.

Typedef Documentation

◆ test_ptr

typedef bool( * test_ptr) ()

Definition at line 24 of file VtkTest.cpp.

Function Documentation

◆ check_elements()

bool check_elements ( Interface iface,
EntityType  moab_type,
unsigned  num_elem,
unsigned  vert_per_elem,
const double *  coords,
unsigned  num_vert,
const int *  connectivity 
)

Definition at line 926 of file VtkTest.cpp.

933 {
934  std::vector< EntityHandle > junk1( num_vert ), junk2( num_elem );
935  bool rval = match_vertices_and_elements( iface, moab_type, num_vert, num_elem, vert_per_elem, coords, connectivity,
936  &junk1[0], &junk2[0] );
937  CHECK( rval );
938  return true;
939 }

References CHECK, iface, and match_vertices_and_elements().

Referenced by test_read_write_element(), test_structured_2d(), and test_structured_3d().

◆ check_tag_data()

bool check_tag_data ( const char *  file,
DataType  type,
int  vals_per_ent 
)

Definition at line 1151 of file VtkTest.cpp.

1152 {
1153  bool bval;
1154  Core instance1, instance2;
1155 
1156  bval = read_file( &instance1, file );
1157  CHECK( bval );
1158  bval = check_tag_values( &instance1, type, vals_per_ent );
1159  CHECK( bval );
1160  bval = write_and_read( &instance1, &instance2 );
1161  CHECK( bval );
1162  bval = check_tag_values( &instance2, type, vals_per_ent );
1163  CHECK( bval );
1164  return true;
1165 }

References CHECK, check_tag_values(), read_file(), and write_and_read().

Referenced by test_scalar_attrib(), test_tensor_attrib(), and test_vector_attrib().

◆ check_tag_values() [1/2]

bool check_tag_values ( Interface iface,
DataType  tag_type,
int  tag_length,
int  num_entities,
const EntityHandle entities,
const int *  values 
)

Definition at line 1067 of file VtkTest.cpp.

1073 {
1074  Tag tag;
1075  ErrorCode rval = iface->tag_get_handle( "data", tag_length, tag_type, tag );
1076  CHECK( rval );
1077 
1078  int size, *intptr;
1079  double* dblptr;
1080  rval = iface->tag_get_bytes( tag, size );
1081  CHECK( rval );
1082  std::vector< unsigned char > data( size * num_entities );
1083 
1084  switch( tag_type )
1085  {
1086  case MB_TYPE_BIT:
1087  rval = iface->tag_get_length( tag, size );
1088  CHECK( rval );
1089  CHECK( tag_length == size );
1090  for( int i = 0; i < num_entities; ++i )
1091  {
1092  unsigned char val;
1093  rval = iface->tag_get_data( tag, entities + i, 1, &val );
1094  CHECK( rval );
1095  for( int j = 0; j < tag_length; ++j )
1096  {
1097  int bitval = !!( val & ( 1 << j ) );
1098  int expval = abs( *values ) % 2;
1099  CHECK( bitval == expval );
1100  ++values;
1101  }
1102  }
1103  break;
1104  case MB_TYPE_OPAQUE:
1105  rval = iface->tag_get_data( tag, entities, num_entities, &data[0] );
1106  CHECK( rval );
1107  CHECK( tag_length == size );
1108  for( int i = 0; i < num_entities; ++i )
1109  for( int j = 0; j < tag_length; ++j, ++values )
1110  CHECK( (unsigned)( *values % 256 ) == data[i * tag_length + j] );
1111  break;
1112  case MB_TYPE_INTEGER:
1113  rval = iface->tag_get_data( tag, entities, num_entities, &data[0] );
1114  CHECK( rval );
1115  CHECK( tag_length * sizeof( int ) == (unsigned)size );
1116  intptr = reinterpret_cast< int* >( &data[0] );
1117  for( int i = 0; i < num_entities; ++i )
1118  for( int j = 0; j < tag_length; ++j, ++values )
1119  CHECK( *values == intptr[i * tag_length + j] );
1120  break;
1121  case MB_TYPE_DOUBLE:
1122  rval = iface->tag_get_data( tag, entities, num_entities, &data[0] );
1123  CHECK( rval );
1124  CHECK( tag_length * sizeof( double ) == (unsigned)size );
1125  dblptr = reinterpret_cast< double* >( &data[0] );
1126  for( int i = 0; i < num_entities; ++i )
1127  for( int j = 0; j < tag_length; ++j, ++values )
1128  CHECK( *values == dblptr[i * tag_length + j] );
1129  break;
1130  default:
1131  assert( false );
1132  return false;
1133  }
1134  return true;
1135 }

References CHECK, entities, ErrorCode, iface, MB_TYPE_BIT, MB_TYPE_DOUBLE, MB_TYPE_INTEGER, MB_TYPE_OPAQUE, size, moab::Interface::tag_get_bytes(), moab::Interface::tag_get_data(), moab::Interface::tag_get_handle(), and moab::Interface::tag_get_length().

Referenced by check_tag_data(), and check_tag_values().

◆ check_tag_values() [2/2]

bool check_tag_values ( Interface iface,
DataType  type,
int  vals_per_ent 
)

Definition at line 1137 of file VtkTest.cpp.

1138 {
1139  EntityHandle vert_handles[6], elem_handles[2];
1141  vert_handles, elem_handles );
1142  CHECK( rval );
1143 
1144  rval = check_tag_values( iface, type, vals_per_ent, 6, vert_handles, vertex_values );
1145  CHECK( rval );
1146  rval = check_tag_values( iface, type, vals_per_ent, 2, elem_handles, element_values );
1147  CHECK( rval );
1148  return rval;
1149 }

References CHECK, check_tag_values(), element_values, iface, match_vertices_and_elements(), MBQUAD, two_quad_mesh_conn, two_quad_mesh_coords, and vertex_values.

◆ compare_connectivity()

bool compare_connectivity ( EntityType  ,
const int *  conn1,
const int *  conn2,
unsigned  len 
)

Definition at line 818 of file VtkTest.cpp.

819 {
820  for( unsigned i = 0; i < len; ++i )
821  if( conn1[i] != conn2[i] ) return false;
822  return true;
823 }

Referenced by match_vertices_and_elements().

◆ do_error()

static bool do_error ( const char *  string,
int  line 
)
static

Definition at line 191 of file VtkTest.cpp.

192 {
193  fprintf( stderr, "Check failed at line %d: %s\n", line, string );
194  return false;
195 }

◆ is_error() [1/2]

static bool is_error ( bool  b)
inlinestatic

Definition at line 196 of file VtkTest.cpp.

197 {
198  return !b;
199 }

◆ is_error() [2/2]

static bool is_error ( ErrorCode  b)
inlinestatic

Definition at line 208 of file VtkTest.cpp.

209 {
210  return MB_SUCCESS != b;
211 }

References MB_SUCCESS.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 135 of file VtkTest.cpp.

136 {
137  int* test_indices = (int*)malloc( sizeof( int ) * num_tests );
138  int test_count;
139  // if no arguments, do all tests
140  if( argc == 1 )
141  {
142  for( unsigned i = 0; i < num_tests; ++i )
143  test_indices[i] = i;
144  test_count = num_tests;
145  }
146  // otherwise run only specified tests
147  else
148  {
149  test_count = 0;
150  for( int i = 1; i < argc; ++i )
151  for( unsigned j = 0; j < num_tests; ++j )
152  if( !strcmp( test_array[j].name, argv[i] ) ) test_indices[test_count++] = j;
153  }
154 
155  int fail_count = 0;
156  for( int i = 0; i < test_count; ++i )
157  {
158  test_data& test = test_array[test_indices[i]];
159  printf( "Testing %s...\n", test.name );
160  if( !( test.result = test.test() ) ) ++fail_count;
161  }
162 
163  printf( "\n\n" );
164  if( fail_count )
165  {
166  printf( "FAILED TESTS:\n" );
167  for( int i = 0; i < test_count; ++i )
168  {
169  test_data& test = test_array[test_indices[i]];
170  if( !test.result ) printf( "\t%s\n", test.name );
171  }
172  }
173 
174  if( test_count == 0 )
175  printf( "0 VTK tests run\n" );
176  else if( fail_count == 0 )
177  printf( "%d tests passed\n", test_count );
178  else
179  printf( "%d of %d tests failed\n", fail_count, test_count );
180  printf( "\n" );
181 
182  free( test_indices );
183  free( test_array );
184 
185  return fail_count;
186 }

References num_tests, test, and test_array.

◆ match_vertices_and_elements()

bool match_vertices_and_elements ( Interface iface,
EntityType  moab_type,
unsigned  num_vert,
unsigned  num_elem,
unsigned  vert_per_elem,
const double *  coords,
const int *  connectivity,
EntityHandle vert_handles,
EntityHandle elem_handles 
)

Definition at line 825 of file VtkTest.cpp.

834 {
835  ErrorCode rval;
836 
837  // get vertices and check count
838  Range verts;
839  rval = iface->get_entities_by_type( 0, MBVERTEX, verts );
840  CHECK( rval );
841  CHECK( verts.size() == num_vert );
842 
843  // get elements and check count
844  Range elems;
845  rval = iface->get_entities_by_type( 0, moab_type, elems );
846  CHECK( rval );
847  CHECK( elems.size() == num_elem );
848 
849  // get vertex coordinates
850  std::vector< EntityHandle > vert_array( num_vert );
851  std::copy( verts.begin(), verts.end(), vert_array.begin() );
852  std::vector< double > mb_coords( 3 * num_vert );
853  rval = iface->get_coords( &vert_array[0], num_vert, &mb_coords[0] );
854  CHECK( rval );
855 
856  // compare vertex coordinates to construct map from
857  // EntityHandle to index in input coordinate list
858  std::map< EntityHandle, int > vert_map;
859  std::vector< bool > seen( num_vert, false );
860  for( unsigned i = 0; i < num_vert; ++i )
861  {
862  double* vert_coords = &mb_coords[3 * i];
863  bool found = false;
864  for( unsigned j = 0; j < num_vert; ++j )
865  {
866  const double* file_coords = &coords[3 * j];
867  double dsqr = 0;
868  for( unsigned k = 0; k < 3; ++k )
869  {
870  double diff = vert_coords[k] - file_coords[k];
871  dsqr += diff * diff;
872  }
873  if( dsqr < 1e-6 )
874  {
875  CHECK( !seen[j] ); // duplicate vertex
876  seen[j] = found = true;
877  vert_map[vert_array[i]] = j;
878  vert_handles[j] = vert_array[i];
879  break;
880  }
881  }
882  CHECK( found ); // not found?
883  }
884 
885  // check element connectivity
886  seen.clear();
887  seen.resize( num_elem, false );
888  Range::iterator iter = elems.begin();
889  for( unsigned i = 0; i < num_elem; ++i )
890  {
891  // get element connectivity
892  EntityHandle elem = *iter;
893  ++iter;
894  std::vector< EntityHandle > elem_conn;
895  rval = iface->get_connectivity( &elem, 1, elem_conn );
896  CHECK( rval );
897  CHECK( elem_conn.size() == vert_per_elem );
898 
899  // convert to input vertex ordering
900  std::vector< int > elem_conn2( vert_per_elem );
901  for( unsigned j = 0; j < vert_per_elem; ++j )
902  {
903  std::map< EntityHandle, int >::iterator k = vert_map.find( elem_conn[j] );
904  CHECK( k != vert_map.end() );
905  elem_conn2[j] = k->second;
906  }
907 
908  // search input list for matching element
909  bool found = false;
910  for( unsigned j = 0; j < num_elem; ++j )
911  {
912  const int* conn_arr = connectivity + j * vert_per_elem;
913  if( !seen[j] && compare_connectivity( moab_type, conn_arr, &elem_conn2[0], vert_per_elem ) )
914  {
915  seen[j] = found = true;
916  elem_handles[j] = elem;
917  break;
918  }
919  }
920  CHECK( found );
921  }
922 
923  return true;
924 }

References moab::Range::begin(), CHECK, compare_connectivity(), moab::Range::end(), ErrorCode, moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::Interface::get_entities_by_type(), iface, MBVERTEX, and moab::Range::size().

Referenced by check_elements(), check_tag_values(), and test_unstructured_field().

◆ read_file()

bool read_file ( Interface iface,
const char *  file 
)

Definition at line 794 of file VtkTest.cpp.

795 {
796  char fname[] = "tmp_file.vtk";
797  FILE* fptr = fopen( fname, "w" );
798  fputs( file, fptr );
799  fclose( fptr );
800 
801  ErrorCode rval = iface->load_mesh( fname );
802  remove( fname );
803  CHECK( rval );
804  return true;
805 }

References CHECK, ErrorCode, fname, iface, and moab::Interface::load_mesh().

Referenced by check_tag_data(), test_cone_curve_facet(), test_cube_curve_facet(), test_free_vertices(), test_read_write_element(), test_structured_2d(), test_structured_3d(), and test_unstructured_field().

◆ register_test()

int register_test ( test_ptr  test,
const char *  name 
)

Definition at line 33 of file VtkTest.cpp.

34 {
35  test_data* new_test_array = (test_data*)realloc( test_array, sizeof( test_data ) * ( num_tests + 1 ) );
36  if( !new_test_array )
37  {
38  fprintf( stderr, "VtkTest.cpp::regeister_test(): reallocation of test array failed\n" );
39  free( test_array );
40  test_array = NULL;
41  num_tests = 0;
42  return -1;
43  }
44  else
45  test_array = new_test_array;
47  test_array[num_tests].name = name;
48  test_array[num_tests].result = true;
49  ++num_tests;
50  return 0;
51 }

References test_data::name, num_tests, test_data::result, test, test_data::test, and test_array.

◆ test_edge2()

bool test_edge2 ( )

Definition at line 225 of file VtkTest.cpp.

226 {
227  const double coords[] = { 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1 };
228  const int conn[] = { 0, 1, 1, 2, 2, 3, 3, 4, 0, 4 };
229 
230  return test_read_write_element( coords, 5, conn, conn, 10, 5, 3, MBEDGE );
231 }

References MBEDGE, and test_read_write_element().

◆ test_edge3()

bool test_edge3 ( )

Definition at line 233 of file VtkTest.cpp.

234 {
235  const double coords[] = { -1, -1, 2, 1, -1, 2, 1, 1, 2, -1, 1, 2,
236  0.000, -0.707, 2, 0.707, 0.000, 2, 0.000, 0.707, 2, -0.707, 0.000, 2 };
237  const int conn[] = { 0, 1, 4, 1, 2, 5, 2, 3, 6, 3, 0, 7 };
238 
239  return test_read_write_element( coords, 8, conn, conn, 12, 4, 21, MBEDGE );
240 }

References MBEDGE, and test_read_write_element().

◆ test_free_nodes()

bool test_free_nodes ( )

Definition at line 464 of file VtkTest.cpp.

465 {
466  const char file1[] = "# vtk DataFile Version 3.0\n"
467  "MOAB Version 1.00\n"
468  "ASCII\n"
469  "DATASET UNSTRUCTURED_GRID\n"
470  "POINTS 2 double\n"
471  "10.0 0 0\n"
472  "-10.0 0 0\n"
473  "CELLS 2 4\n"
474  "1 0\n"
475  "1 1\n"
476  "CELL_TYPES 2\n"
477  "1\n"
478  "1\n";
479 
480  bool rval1 = test_free_vertices( file1 );
481 
482  const char file2[] = "# vtk DataFile Version 3.0\n"
483  "MOAB Version 1.00\n"
484  "ASCII\n"
485  "DATASET UNSTRUCTURED_GRID\n"
486  "POINTS 5 double\n"
487  "10.0 0 0\n"
488  "-10.0 0 0\n"
489  "-5 2. 2.\n"
490  "-5 2. 0.\n"
491  "-5 4. 2.\n"
492  "CELLS 3 8\n"
493  "1 0\n"
494  "1 1\n"
495  "3 2 3 4\n"
496  "CELL_TYPES 3\n"
497  "1\n"
498  "1\n"
499  "5\n";
500 
501  bool rval2 = test_free_vertices( file2 );
502  return rval1 && rval2;
503 }

References test_free_vertices().

◆ test_free_vertices()

bool test_free_vertices ( const char *  file)

Definition at line 455 of file VtkTest.cpp.

456 {
457  // read VTK file
458  Core instance;
459  bool bval = read_file( &instance, file );
460  CHECK( bval );
461  return true;
462 }

References CHECK, and read_file().

Referenced by test_free_nodes().

◆ test_hex20()

bool test_hex20 ( )

Definition at line 373 of file VtkTest.cpp.

374 {
375  const int vtk_conn[] = { 0, 2, 8, 6, 18, 20, 26, 24, 1, 5, 7, 3, 19, 23, 25, 21, 9, 11, 17, 15 };
376  const int exo_conn[] = { 0, 2, 8, 6, 18, 20, 26, 24, 1, 5, 7, 3, 9, 11, 17, 15, 19, 23, 25, 21 };
377 
378  return test_read_write_element( grid_2x2x2, 27, vtk_conn, exo_conn, 20, 1, 25, MBHEX );
379 }

References grid_2x2x2, MBHEX, and test_read_write_element().

◆ test_hex27()

bool test_hex27 ( )

Definition at line 381 of file VtkTest.cpp.

382 {
383  const int vtk_conn[] = { 0, 2, 8, 6, 18, 20, 26, 24, 1, 5, 7, 3, 19, 23,
384  25, 21, 9, 11, 17, 15, 10, 16, 14, 12, 4, 22, 13 };
385  const int moab_conn[] = { 0, 2, 8, 6, 18, 20, 26, 24, 1, 5, 7, 3, 9, 11,
386  17, 15, 19, 23, 25, 21, 14, 16, 12, 10, 4, 22, 13 };
387 
388  return test_read_write_element( grid_2x2x2, 27, vtk_conn, moab_conn, 27, 1, 29, MBHEX );
389 }

References grid_2x2x2, MBHEX, and test_read_write_element().

◆ test_hex8()

bool test_hex8 ( )

Definition at line 356 of file VtkTest.cpp.

357 {
358  // check vtk hexes
360  CHECK( rval1 );
361 
362  const int conn2[] = { 0, 1, 3, 4, 9, 10, 12, 13, 1, 2, 4, 5, 10, 11, 13, 14, 3, 4, 6, 7, 12, 13,
363  15, 16, 4, 5, 7, 8, 13, 14, 16, 17, 9, 10, 12, 13, 18, 19, 21, 22, 10, 11, 13, 14,
364  19, 20, 22, 23, 12, 13, 15, 16, 21, 22, 24, 25, 13, 14, 16, 17, 22, 23, 25, 26 };
365 
366  // check with vtk voxels
367  bool rval2 = test_read_write_element( grid_2x2x2, 27, conn2, hex_structured_conn, 64, 8, 11, MBHEX );
368  CHECK( rval2 );
369 
370  return true;
371 }

References CHECK, grid_2x2x2, hex_structured_conn, MBHEX, and test_read_write_element().

◆ test_polygon()

bool test_polygon ( )

Definition at line 295 of file VtkTest.cpp.

296 {
297  const double coords[] = { 0, 0, 0, 0, 2, 0, 0, 4, 0, 0, 0, 4, 0, 2, 4, 0, 4, 4, 4, 0,
298  0, 4, 2, 0, 4, 4, 0, 2, 0, 0, 2, 4, 0, 0, 0, 2, 0, 4, 2 };
299  const int conn[] = { 0, 1, 2, 12, 5, 4, 3, 11, 2, 1, 0, 9, 6, 7, 8, 10 };
300 
301  return test_read_write_element( coords, 13, conn, conn, 16, 2, 7, MBPOLYGON );
302 }

References MBPOLYGON, and test_read_write_element().

◆ test_polygon_mix()

bool test_polygon_mix ( )

Definition at line 304 of file VtkTest.cpp.

305 {
306  // just read the polygon file with mixed sequences
307  Core moab;
308  Interface& mb = moab;
309 
310  ErrorCode rval = mb.load_file( poly_example.c_str() );
311  if( MB_SUCCESS != rval ) return false;
312 
313  return true;
314 }

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

◆ test_polyhedra()

bool test_polyhedra ( )

Definition at line 315 of file VtkTest.cpp.

316 {
317  // just read the polyhedra file
318  Core moab;
319  Interface& mb = moab;
320 
321  ErrorCode rval = mb.load_file( polyhedra_example.c_str() );
322  if( MB_SUCCESS != rval ) return false;
323  Range polyhedras;
324  rval = mb.get_entities_by_type( 0, MBPOLYHEDRON, polyhedras );
325  if( MB_SUCCESS != rval ) return false;
326 
327  if( 10 != polyhedras.size() ) return false;
328  return true;
329 }

References ErrorCode, moab::Core::get_entities_by_type(), moab::Core::load_file(), mb, MB_SUCCESS, MBPOLYHEDRON, polyhedra_example, and moab::Range::size().

◆ test_pyramid()

bool test_pyramid ( )

Definition at line 411 of file VtkTest.cpp.

412 {
413  const double coords[] = { 1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 0, 0, -1, 0, 0, 1 };
414  const int conn[] = { 0, 1, 2, 3, 5, 3, 2, 1, 0, 4 };
415 
416  return test_read_write_element( coords, 6, conn, conn, 10, 2, 14, MBPYRAMID );
417 }

References MBPYRAMID, and test_read_write_element().

◆ test_pyramid13()

bool test_pyramid13 ( )

Definition at line 419 of file VtkTest.cpp.

420 {
421  const double coords[] = { 2, -2, 0, 2, 2, 0, -2, 2, 0, -2, -2, 0, 0, 0, -2, 0, 0, 2,
422  2, 0, 0, 0, 2, 0, -2, 0, 0, 0, -2, 0, 1, -1, -1, 1, 1, -1,
423  -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1 };
424  const int conn[] = { 0, 1, 2, 3, 5, 6, 7, 8, 9, 14, 15, 16, 17, 3, 2, 1, 0, 4, 8, 7, 6, 9, 13, 12, 11, 10 };
425 
426  return test_read_write_element( coords, 18, conn, conn, 26, 2, 27, MBPYRAMID );
427 }

References MBPYRAMID, and test_read_write_element().

◆ test_quad4()

bool test_quad4 ( )

Definition at line 264 of file VtkTest.cpp.

265 {
266  // test read as quads
268 
269  // test read as pixels
270  const int conn2[] = { 0, 1, 4, 5, 1, 2, 5, 6, 2, 3, 6, 7, 4, 5, 8, 9, 5, 6,
271  9, 10, 6, 7, 10, 11, 8, 9, 12, 13, 9, 10, 13, 14, 10, 11, 14, 15 };
272  bool rval2 = test_read_write_element( grid_3x3, 16, conn2, quad_structured_conn, 36, 9, 8, MBQUAD );
273 
274  return rval1 && rval2;
275 }

References grid_3x3, MBQUAD, quad_structured_conn, and test_read_write_element().

◆ test_quad8()

bool test_quad8 ( )

Definition at line 277 of file VtkTest.cpp.

278 {
279  const double coords[] = { 0, 0, 0, 0, 2, 0, 0, 4, 0, 0, 0, 4, 0, 2, 4, 0, 4, 4, 4, 0,
280  0, 4, 2, 0, 4, 4, 0, 2, 0, 0, 2, 4, 0, 0, 0, 2, 0, 4, 2 };
281  const int conn[] = { 0, 2, 5, 3, 1, 12, 4, 11, 2, 0, 6, 8, 1, 9, 7, 10 };
282 
283  return test_read_write_element( coords, 13, conn, conn, 16, 2, 23, MBQUAD );
284 }

References MBQUAD, and test_read_write_element().

◆ test_quad9()

bool test_quad9 ( )

Definition at line 286 of file VtkTest.cpp.

287 {
288  const double coords[] = { 0, 0, 0, 0, 2, 0, 0, 4, 0, 0, 0, 4, 0, 2, 4, 0, 4, 4, 4, 0, 0, 4, 2,
289  0, 4, 4, 0, 2, 0, 0, 2, 2, 0, 2, 4, 0, 0, 0, 2, 0, 2, 2, 0, 4, 2 };
290  const int conn[] = { 0, 2, 5, 3, 1, 14, 4, 12, 12, 2, 0, 6, 8, 1, 9, 7, 11, 10 };
291 
292  return test_read_write_element( coords, 15, conn, conn, 18, 2, 28, MBQUAD );
293 }

References MBQUAD, and test_read_write_element().

◆ test_read_write_element()

bool test_read_write_element ( const double *  coords,
unsigned  num_coords,
const int *  vtk_conn,
const int *  moab_conn,
unsigned  num_conn,
unsigned  num_elem,
unsigned  vtk_type,
EntityType  moab_type 
)

Definition at line 941 of file VtkTest.cpp.

950 {
951  // construct VTK file
952  char file[4096] = "# vtk DataFile Version 3.0\n"
953  "MOAB Version 1.00\n"
954  "ASCII\n"
955  "DATASET UNSTRUCTURED_GRID\n";
956  size_t len = strlen( file );
957 
958  len += sprintf( file + len, "POINTS %u double\n", num_verts );
959  for( unsigned i = 0; i < num_verts; ++i )
960  len += sprintf( file + len, "%f %f %f\n", coords[3 * i], coords[3 * i + 1], coords[3 * i + 2] );
961 
962  len += sprintf( file + len, "CELLS %u %u\n", num_elem, num_conn + num_elem );
963  assert( num_conn % num_elem == 0 );
964  unsigned conn_len = num_conn / num_elem;
965  for( unsigned i = 0; i < num_elem; ++i )
966  {
967  len += sprintf( file + len, "%u", conn_len );
968  for( unsigned j = 0; j < conn_len; ++j )
969  len += sprintf( file + len, " %u", vtk_conn[conn_len * i + j] );
970  len += sprintf( file + len, "\n" );
971  }
972 
973  len += sprintf( file + len, "CELL_TYPES %u\n", num_elem );
974  for( unsigned i = 0; i < num_elem; ++i )
975  len += sprintf( file + len, "%u\n", vtk_type );
976 
977  // read VTK file and check results
978  Core instance1, instance2;
979  bool bval = read_file( &instance1, file );
980  CHECK( bval );
981  bval = check_elements( &instance1, moab_type, num_elem, conn_len, coords, num_verts, moab_conn );
982  CHECK( bval );
983 
984  // write, re-read, and check results
985  bval = write_and_read( &instance1, &instance2 );
986  CHECK( bval );
987  bval = check_elements( &instance2, moab_type, num_elem, conn_len, coords, num_verts, moab_conn );
988  CHECK( bval );
989 
990  return true;
991 }

References CHECK, check_elements(), read_file(), and write_and_read().

Referenced by test_edge2(), test_edge3(), test_hex20(), test_hex27(), test_hex8(), test_polygon(), test_pyramid(), test_pyramid13(), test_quad4(), test_quad8(), test_quad9(), test_tet10(), test_tet4(), test_tri3(), test_tri6(), test_wedge(), and test_wedge15().

◆ test_rectilinear_grid_2d()

bool test_rectilinear_grid_2d ( )

Definition at line 519 of file VtkTest.cpp.

520 {
521  const char file[] = "# vtk DataFile Version 3.0\n"
522  "MOAB Version 1.00\n"
523  "ASCII\n"
524  "DATASET RECTILINEAR_GRID\n"
525  "DIMENSIONS 4 4 1\n"
526  "X_COORDINATES 4 float 0 1 2 3\n"
527  "Y_COORDINATES 4 float 0 1 2 3\n"
528  "Z_COORDINATES 1 float 0\n";
529 
530  return test_structured_2d( file );
531 }

References test_structured_2d().

◆ test_rectilinear_grid_3d()

bool test_rectilinear_grid_3d ( )

Definition at line 561 of file VtkTest.cpp.

562 {
563  const char file[] = "# vtk DataFile Version 3.0\n"
564  "MOAB Version 1.00\n"
565  "ASCII\n"
566  "DATASET RECTILINEAR_GRID\n"
567  "DIMENSIONS 3 3 3\n"
568  "X_COORDINATES 3 float 0 1 2\n"
569  "Y_COORDINATES 3 float 0 1 2\n"
570  "Z_COORDINATES 3 float 0 1 2\n";
571 
572  return test_structured_3d( file );
573 }

References test_structured_3d().

◆ test_scalar_attrib()

bool test_scalar_attrib ( const char *  vtk_type,
DataType  mb_type,
int  count 
)

Definition at line 1167 of file VtkTest.cpp.

1168 {
1169  char file[4096];
1170  strcpy( file, two_quad_mesh );
1171  size_t len = strlen( file );
1172  len += sprintf( file + len, "POINT_DATA 6\n" );
1173  len += sprintf( file + len, "SCALARS data %s %d\n", vtk_type, count );
1174  len += sprintf( file + len, "LOOKUP_TABLE default\n" );
1175  write_data( file, len, mb_type, 6 * count, vertex_values );
1176  len += sprintf( file + len, "CELL_DATA 2\n" );
1177  len += sprintf( file + len, "SCALARS data %s %d\n", vtk_type, count );
1178  len += sprintf( file + len, "LOOKUP_TABLE default\n" );
1179  write_data( file, len, mb_type, 2 * count, element_values );
1180 
1181  return check_tag_data( file, mb_type, count );
1182 }

References check_tag_data(), element_values, two_quad_mesh, vertex_values, and write_data().

Referenced by test_scalar_attrib_1_bit(), test_scalar_attrib_1_char(), test_scalar_attrib_1_double(), test_scalar_attrib_1_float(), test_scalar_attrib_1_int(), test_scalar_attrib_1_long(), test_scalar_attrib_1_short(), test_scalar_attrib_1_uchar(), test_scalar_attrib_1_uint(), test_scalar_attrib_1_ulong(), test_scalar_attrib_1_ushort(), test_scalar_attrib_4_bit(), test_scalar_attrib_4_char(), test_scalar_attrib_4_double(), test_scalar_attrib_4_float(), test_scalar_attrib_4_int(), test_scalar_attrib_4_long(), test_scalar_attrib_4_short(), test_scalar_attrib_4_uchar(), test_scalar_attrib_4_uint(), test_scalar_attrib_4_ulong(), and test_scalar_attrib_4_ushort().

◆ test_scalar_attrib_1_bit()

bool test_scalar_attrib_1_bit ( )

Definition at line 579 of file VtkTest.cpp.

580 {
581  return test_scalar_attrib( "bit", MB_TYPE_BIT, 1 );
582 }

References MB_TYPE_BIT, and test_scalar_attrib().

◆ test_scalar_attrib_1_char()

bool test_scalar_attrib_1_char ( )

Definition at line 589 of file VtkTest.cpp.

590 {
591  return test_scalar_attrib( "char", MB_TYPE_INTEGER, 1 );
592 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_1_double()

bool test_scalar_attrib_1_double ( )

Definition at line 629 of file VtkTest.cpp.

630 {
631  return test_scalar_attrib( "double", MB_TYPE_DOUBLE, 1 );
632 }

References MB_TYPE_DOUBLE, and test_scalar_attrib().

◆ test_scalar_attrib_1_float()

bool test_scalar_attrib_1_float ( )

Definition at line 624 of file VtkTest.cpp.

625 {
626  return test_scalar_attrib( "float", MB_TYPE_DOUBLE, 1 );
627 }

References MB_TYPE_DOUBLE, and test_scalar_attrib().

◆ test_scalar_attrib_1_int()

bool test_scalar_attrib_1_int ( )

Definition at line 609 of file VtkTest.cpp.

610 {
611  return test_scalar_attrib( "int", MB_TYPE_INTEGER, 1 );
612 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_1_long()

bool test_scalar_attrib_1_long ( )

Definition at line 619 of file VtkTest.cpp.

620 {
621  return test_scalar_attrib( "long", MB_TYPE_INTEGER, 1 );
622 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_1_short()

bool test_scalar_attrib_1_short ( )

Definition at line 599 of file VtkTest.cpp.

600 {
601  return test_scalar_attrib( "short", MB_TYPE_INTEGER, 1 );
602 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_1_uchar()

bool test_scalar_attrib_1_uchar ( )

Definition at line 584 of file VtkTest.cpp.

585 {
586  return test_scalar_attrib( "unsigned_char", MB_TYPE_INTEGER, 1 );
587 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_1_uint()

bool test_scalar_attrib_1_uint ( )

Definition at line 604 of file VtkTest.cpp.

605 {
606  return test_scalar_attrib( "unsigned_int", MB_TYPE_INTEGER, 1 );
607 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_1_ulong()

bool test_scalar_attrib_1_ulong ( )

Definition at line 614 of file VtkTest.cpp.

615 {
616  return test_scalar_attrib( "unsigned_long", MB_TYPE_INTEGER, 1 );
617 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_1_ushort()

bool test_scalar_attrib_1_ushort ( )

Definition at line 594 of file VtkTest.cpp.

595 {
596  return test_scalar_attrib( "unsigned_short", MB_TYPE_INTEGER, 1 );
597 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_4_bit()

bool test_scalar_attrib_4_bit ( )

Definition at line 634 of file VtkTest.cpp.

635 {
636  return test_scalar_attrib( "bit", MB_TYPE_BIT, 4 );
637 }

References MB_TYPE_BIT, and test_scalar_attrib().

◆ test_scalar_attrib_4_char()

bool test_scalar_attrib_4_char ( )

Definition at line 644 of file VtkTest.cpp.

645 {
646  return test_scalar_attrib( "char", MB_TYPE_INTEGER, 4 );
647 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_4_double()

bool test_scalar_attrib_4_double ( )

Definition at line 684 of file VtkTest.cpp.

685 {
686  return test_scalar_attrib( "double", MB_TYPE_DOUBLE, 4 );
687 }

References MB_TYPE_DOUBLE, and test_scalar_attrib().

◆ test_scalar_attrib_4_float()

bool test_scalar_attrib_4_float ( )

Definition at line 679 of file VtkTest.cpp.

680 {
681  return test_scalar_attrib( "float", MB_TYPE_DOUBLE, 4 );
682 }

References MB_TYPE_DOUBLE, and test_scalar_attrib().

◆ test_scalar_attrib_4_int()

bool test_scalar_attrib_4_int ( )

Definition at line 664 of file VtkTest.cpp.

665 {
666  return test_scalar_attrib( "int", MB_TYPE_INTEGER, 4 );
667 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_4_long()

bool test_scalar_attrib_4_long ( )

Definition at line 674 of file VtkTest.cpp.

675 {
676  return test_scalar_attrib( "long", MB_TYPE_INTEGER, 4 );
677 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_4_short()

bool test_scalar_attrib_4_short ( )

Definition at line 654 of file VtkTest.cpp.

655 {
656  return test_scalar_attrib( "short", MB_TYPE_INTEGER, 4 );
657 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_4_uchar()

bool test_scalar_attrib_4_uchar ( )

Definition at line 639 of file VtkTest.cpp.

640 {
641  return test_scalar_attrib( "unsigned_char", MB_TYPE_INTEGER, 4 );
642 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_4_uint()

bool test_scalar_attrib_4_uint ( )

Definition at line 659 of file VtkTest.cpp.

660 {
661  return test_scalar_attrib( "unsigned_int", MB_TYPE_INTEGER, 4 );
662 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_4_ulong()

bool test_scalar_attrib_4_ulong ( )

Definition at line 669 of file VtkTest.cpp.

670 {
671  return test_scalar_attrib( "unsigned_long", MB_TYPE_INTEGER, 4 );
672 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_scalar_attrib_4_ushort()

bool test_scalar_attrib_4_ushort ( )

Definition at line 649 of file VtkTest.cpp.

650 {
651  return test_scalar_attrib( "unsigned_short", MB_TYPE_INTEGER, 4 );
652 }

References MB_TYPE_INTEGER, and test_scalar_attrib().

◆ test_structured_2d()

bool test_structured_2d ( const char *  file)

Definition at line 993 of file VtkTest.cpp.

994 {
995  // read VTK file and check results
996  Core instance;
997  bool bval = read_file( &instance, file );
998  CHECK( bval );
999  bval = check_elements( &instance, MBQUAD, 9, 4, grid_3x3, 16, quad_structured_conn );
1000  CHECK( bval );
1001 
1002  return true;
1003 }

References CHECK, check_elements(), grid_3x3, MBQUAD, quad_structured_conn, and read_file().

Referenced by test_rectilinear_grid_2d(), test_structured_grid_2d(), and test_structured_points_2d().

◆ test_structured_3d()

bool test_structured_3d ( const char *  file)

Definition at line 1005 of file VtkTest.cpp.

1006 {
1007  // read VTK file and check results
1008  Core instance;
1009  bool bval = read_file( &instance, file );
1010  CHECK( bval );
1011  bval = check_elements( &instance, MBHEX, 8, 8, grid_2x2x2, 27, hex_structured_conn );
1012  CHECK( bval );
1013 
1014  return true;
1015 }

References CHECK, check_elements(), grid_2x2x2, hex_structured_conn, MBHEX, and read_file().

Referenced by test_rectilinear_grid_3d(), test_structured_grid_3d(), and test_structured_points_3d().

◆ test_structured_grid_2d()

bool test_structured_grid_2d ( )

Definition at line 504 of file VtkTest.cpp.

505 {
506  char file[4096] = "# vtk DataFile Version 3.0\n"
507  "MOAB Version 1.00\n"
508  "ASCII\n"
509  "DATASET STRUCTURED_GRID\n"
510  "DIMENSIONS 4 4 1\n"
511  "POINTS 16 double\n";
512  int len = strlen( file );
513  for( unsigned i = 0; i < 16; ++i )
514  len += sprintf( file + len, "%f %f %f\n", grid_3x3[3 * i], grid_3x3[3 * i + 1], grid_3x3[3 * i + 2] );
515 
516  return test_structured_2d( file );
517 }

References grid_3x3, and test_structured_2d().

◆ test_structured_grid_3d()

bool test_structured_grid_3d ( )

Definition at line 545 of file VtkTest.cpp.

546 {
547  char file[4096] = "# vtk DataFile Version 3.0\n"
548  "MOAB Version 1.00\n"
549  "ASCII\n"
550  "DATASET STRUCTURED_GRID\n"
551  "DIMENSIONS 3 3 3\n"
552  "POINTS 27 double\n";
553 
554  int len = strlen( file );
555  for( unsigned i = 0; i < 27; ++i )
556  len += sprintf( file + len, "%f %f %f\n", grid_2x2x2[3 * i], grid_2x2x2[3 * i + 1], grid_2x2x2[3 * i + 2] );
557 
558  return test_structured_3d( file );
559 }

References grid_2x2x2, and test_structured_3d().

◆ test_structured_points_2d()

bool test_structured_points_2d ( )

Definition at line 432 of file VtkTest.cpp.

433 {
434  const char file[] = "# vtk DataFile Version 3.0\n"
435  "MOAB Version 1.00\n"
436  "ASCII\n"
437  "DATASET STRUCTURED_POINTS\n"
438  "DIMENSIONS 4 4 1\n"
439  "ORIGIN 0 0 0\n"
440  "SPACING 1 1 1\n";
441  bool rval1 = test_structured_2d( file );
442 
443  // test again w/ old 1.0 ASPECT_RATIO keyword
444  const char file2[] = "# vtk DataFile Version 3.0\n"
445  "MOAB Version 1.00\n"
446  "ASCII\n"
447  "DATASET STRUCTURED_POINTS\n"
448  "DIMENSIONS 4 4 1\n"
449  "ORIGIN 0 0 0\n"
450  "ASPECT_RATIO 1 1 1\n";
451  bool rval2 = test_structured_2d( file2 );
452 
453  return rval1 && rval2;
454 }

References test_structured_2d().

◆ test_structured_points_3d()

bool test_structured_points_3d ( )

Definition at line 533 of file VtkTest.cpp.

534 {
535  const char file[] = "# vtk DataFile Version 3.0\n"
536  "MOAB Version 1.00\n"
537  "ASCII\n"
538  "DATASET STRUCTURED_POINTS\n"
539  "DIMENSIONS 3 3 3\n"
540  "ORIGIN 0 0 0\n"
541  "SPACING 1 1 1\n";
542  return test_structured_3d( file );
543 }

References test_structured_3d().

◆ test_subset()

bool test_subset ( )

Definition at line 1214 of file VtkTest.cpp.

1215 {
1216  Core moab_inst;
1217  Interface& moab = moab_inst;
1218  ErrorCode rval;
1219 
1220  // create 9 nodes in grid pattern
1221  EntityHandle verts[9];
1222  const double coords[][3] = { { 0, 0, 0 }, { 1, 0, 0 }, { 2, 0, 0 }, { 0, 1, 0 }, { 1, 1, 0 },
1223  { 2, 1, 0 }, { 0, 2, 0 }, { 1, 2, 0 }, { 2, 2, 0 } };
1224  for( unsigned i = 0; i < 9; ++i )
1225  {
1226  rval = moab.create_vertex( coords[i], verts[i] );
1227  assert( MB_SUCCESS == rval );
1228  }
1229 
1230  // create 4 quad elements in grid pattern
1231  const int conn[][4] = { { 0, 1, 4, 3 }, { 1, 2, 5, 4 }, { 3, 4, 7, 6 }, { 4, 5, 8, 7 } };
1232  EntityHandle econn[4], elems[4];
1233  for( unsigned i = 0; i < 4; ++i )
1234  {
1235  for( unsigned j = 0; j < 4; ++j )
1236  econn[j] = verts[conn[i][j]];
1237  rval = moab.create_element( MBQUAD, econn, 4, elems[i] );
1238  assert( MB_SUCCESS == rval );
1239  }
1240 
1241  // create 3 meshsets
1242  EntityHandle sets[3];
1243  for( unsigned i = 0; i < 3; ++i )
1244  {
1245  rval = moab.create_meshset( 0, sets[i] );
1246  assert( MB_SUCCESS == rval );
1247  }
1248 
1249  // add element 3 to set 0
1250  rval = moab.add_entities( sets[0], elems + 3, 1 );
1251  assert( MB_SUCCESS == rval );
1252  // add node 2 to set 1
1253  rval = moab.add_entities( sets[1], verts + 2, 1 );
1254  assert( MB_SUCCESS == rval );
1255  // add element 2 and 3 to set 2
1256  rval = moab.add_entities( sets[2], elems + 2, 2 );
1257  assert( MB_SUCCESS == rval );
1258 
1259  // make set 2 a child of set 1
1260  rval = moab.add_child_meshset( sets[1], sets[2] );
1261  assert( MB_SUCCESS == rval );
1262  // put set 1 in set 0
1263  rval = moab.add_entities( sets[0], sets + 1, 1 );
1264  assert( MB_SUCCESS == rval );
1265 
1266  // write sets[0] to vtk file
1267  rval = moab.write_mesh( "tmp_file.vtk", sets, 1 );
1268  CHECK( rval );
1269 
1270  // read data back in
1271  moab.delete_mesh();
1272  rval = moab.load_mesh( "tmp_file.vtk" );
1273  remove( "tmp_file.vtk" );
1274  CHECK( rval );
1275 
1276  // writer should have written all three sets,
1277  // so the resulting mesh should be elems[2], elems[3],
1278  // and verts[2]
1279  Range new_elems, new_verts;
1280  rval = moab.get_entities_by_type( 0, MBQUAD, new_elems );
1281  CHECK( rval );
1282  CHECK( new_elems.size() == 2 );
1283  rval = moab.get_entities_by_type( 0, MBVERTEX, new_verts );
1284  CHECK( rval );
1285  CHECK( new_verts.size() == 7 );
1286 
1287  // vertex not in element closure should have coords of 2,0,0
1288  Range elem_verts;
1289  rval = moab.get_adjacencies( new_elems, 0, false, elem_verts, Interface::UNION );
1290  CHECK( rval );
1291  CHECK( elem_verts.size() == 6 );
1292  Range free_verts( subtract( new_verts, elem_verts ) );
1293  CHECK( free_verts.size() == 1 );
1294  double vcoords[3];
1295  rval = moab.get_coords( free_verts, vcoords );
1296  CHECK( vcoords[0] == 2 );
1297  CHECK( vcoords[1] == 0 );
1298  CHECK( vcoords[2] == 0 );
1299 
1300  return true;
1301 }

References CHECK, ErrorCode, MB_SUCCESS, MBQUAD, MBVERTEX, moab::Range::size(), moab::subtract(), and moab::Interface::UNION.

◆ test_tensor_attrib()

bool test_tensor_attrib ( const char *  vtk_type,
DataType  mb_type 
)

Definition at line 1199 of file VtkTest.cpp.

1200 {
1201  char file[4096];
1202  strcpy( file, two_quad_mesh );
1203  size_t len = strlen( file );
1204  len += sprintf( file + len, "POINT_DATA 6\n" );
1205  len += sprintf( file + len, "TENSORS data %s\n", vtk_type );
1206  write_data( file, len, mb_type, 6 * 9, vertex_values );
1207  len += sprintf( file + len, "CELL_DATA 2\n" );
1208  len += sprintf( file + len, "TENSORS data %s\n", vtk_type );
1209  write_data( file, len, mb_type, 2 * 9, element_values );
1210 
1211  return check_tag_data( file, mb_type, 9 );
1212 }

References check_tag_data(), element_values, two_quad_mesh, vertex_values, and write_data().

Referenced by test_tensor_attrib_char(), test_tensor_attrib_double(), test_tensor_attrib_float(), test_tensor_attrib_int(), test_tensor_attrib_long(), test_tensor_attrib_short(), test_tensor_attrib_uchar(), test_tensor_attrib_uint(), test_tensor_attrib_ulong(), and test_tensor_attrib_ushort().

◆ test_tensor_attrib_char()

bool test_tensor_attrib_char ( )

Definition at line 749 of file VtkTest.cpp.

750 {
751  return test_tensor_attrib( "char", MB_TYPE_INTEGER );
752 }

References MB_TYPE_INTEGER, and test_tensor_attrib().

◆ test_tensor_attrib_double()

bool test_tensor_attrib_double ( )

Definition at line 789 of file VtkTest.cpp.

790 {
791  return test_tensor_attrib( "double", MB_TYPE_DOUBLE );
792 }

References MB_TYPE_DOUBLE, and test_tensor_attrib().

◆ test_tensor_attrib_float()

bool test_tensor_attrib_float ( )

Definition at line 784 of file VtkTest.cpp.

785 {
786  return test_tensor_attrib( "float", MB_TYPE_DOUBLE );
787 }

References MB_TYPE_DOUBLE, and test_tensor_attrib().

◆ test_tensor_attrib_int()

bool test_tensor_attrib_int ( )

Definition at line 769 of file VtkTest.cpp.

770 {
771  return test_tensor_attrib( "int", MB_TYPE_INTEGER );
772 }

References MB_TYPE_INTEGER, and test_tensor_attrib().

◆ test_tensor_attrib_long()

bool test_tensor_attrib_long ( )

Definition at line 779 of file VtkTest.cpp.

780 {
781  return test_tensor_attrib( "long", MB_TYPE_INTEGER );
782 }

References MB_TYPE_INTEGER, and test_tensor_attrib().

◆ test_tensor_attrib_short()

bool test_tensor_attrib_short ( )

Definition at line 759 of file VtkTest.cpp.

760 {
761  return test_tensor_attrib( "short", MB_TYPE_INTEGER );
762 }

References MB_TYPE_INTEGER, and test_tensor_attrib().

◆ test_tensor_attrib_uchar()

bool test_tensor_attrib_uchar ( )

Definition at line 744 of file VtkTest.cpp.

745 {
746  return test_tensor_attrib( "unsigned_char", MB_TYPE_INTEGER );
747 }

References MB_TYPE_INTEGER, and test_tensor_attrib().

◆ test_tensor_attrib_uint()

bool test_tensor_attrib_uint ( )

Definition at line 764 of file VtkTest.cpp.

765 {
766  return test_tensor_attrib( "unsigned_int", MB_TYPE_INTEGER );
767 }

References MB_TYPE_INTEGER, and test_tensor_attrib().

◆ test_tensor_attrib_ulong()

bool test_tensor_attrib_ulong ( )

Definition at line 774 of file VtkTest.cpp.

775 {
776  return test_tensor_attrib( "unsigned_long", MB_TYPE_INTEGER );
777 }

References MB_TYPE_INTEGER, and test_tensor_attrib().

◆ test_tensor_attrib_ushort()

bool test_tensor_attrib_ushort ( )

Definition at line 754 of file VtkTest.cpp.

755 {
756  return test_tensor_attrib( "unsigned_short", MB_TYPE_INTEGER );
757 }

References MB_TYPE_INTEGER, and test_tensor_attrib().

◆ test_tet10()

bool test_tet10 ( )

Definition at line 338 of file VtkTest.cpp.

339 {
340  const double coords[] = { 4, 0, 0, 0, 2, 0, 0, -2, 0, 0, 0, -2, 0, 0, 2, 0, 1, 1, 2, 0, 1,
341  0, -1, 1, 0, 0, 0, 2, 1, 0, 2, -1, 0, 2, 0, -1, 0, -1, -1, 0, 1, -1 };
342  const int conn[] = { 0, 1, 2, 4, 9, 8, 10, 6, 5, 7, 2, 1, 0, 3, 8, 9, 10, 12, 13, 11 };
343 
344  return test_read_write_element( coords, 14, conn, conn, 20, 2, 24, MBTET );
345 }

References MBTET, and test_read_write_element().

◆ test_tet4()

bool test_tet4 ( )

Definition at line 330 of file VtkTest.cpp.

331 {
332  const double coords[] = { 1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 0, 0, -1, 0, 0, 1 };
333  const int conn[] = { 0, 1, 3, 5, 1, 2, 3, 5, 0, 1, 4, 3, 1, 2, 4, 3 };
334 
335  return test_read_write_element( coords, 6, conn, conn, 16, 4, 10, MBTET );
336 }

References MBTET, and test_read_write_element().

◆ test_tri3()

bool test_tri3 ( )

Definition at line 242 of file VtkTest.cpp.

243 {
244  const double coords[] = { 0, 0, 0, 5, 0, 0, 0, 5, 0, -5, 0, 0, 0, -5, 0 };
245  const int conn[] = { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 1 };
246 
247  return test_read_write_element( coords, 5, conn, conn, 12, 4, 5, MBTRI );
248 }

References MBTRI, and test_read_write_element().

◆ test_tri6()

bool test_tri6 ( )

Definition at line 250 of file VtkTest.cpp.

251 {
252  const double coords[] = { 0, 2, 0, 0, 0, 2, 0, -2, 0, 0, 0, -2, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 0, 0 };
253  const int conn[] = { 0, 1, 3, 4, 5, 8, 1, 2, 3, 6, 7, 8 };
254 
255  return test_read_write_element( coords, 9, conn, conn, 12, 2, 22, MBTRI );
256 }

References MBTRI, and test_read_write_element().

◆ test_unstructured_field()

bool test_unstructured_field ( )

Definition at line 1355 of file VtkTest.cpp.

1356 {
1357  // Use existing file defined in 'two_quad_mesh', but
1358  // insert a few field data blocks
1359  std::istringstream base_data( two_quad_mesh );
1360  std::ostringstream file_data;
1361  std::string line;
1362  while( getline( base_data, line ) )
1363  {
1364  if( 0 == line.find( "POINTS" ) )
1365  {
1366  file_data << "FIELD FieldData 2" << std::endl
1367  << "avtOriginalBounds 1 6 float" << std::endl
1368  << "-10 10 -10 10 -10 10 " << std::endl
1369  << "TIME 1 1 double" << std::endl
1370  << "10.543" << std::endl;
1371  }
1372  else if( 0 == line.find( "CELLS" ) )
1373  {
1374  file_data << "FIELD more_data 2" << std::endl
1375  << "first_array 3 2 int" << std::endl
1376  << "0 1 2" << std::endl
1377  << "3 4 5" << std::endl
1378  << "second_array 4 3 bit" << std::endl
1379  << "0 0 0 0" << std::endl
1380  << "1 1 1 1" << std::endl
1381  << "1 0 1 0" << std::endl;
1382  }
1383  file_data << line << std::endl;
1384  }
1385 
1386  Core core;
1387  Interface& mb = core;
1388  bool rval = read_file( &mb, file_data.str().c_str() );
1389  CHECK( rval );
1390 
1391  EntityHandle vert_handles[6], elem_handles[2];
1393  elem_handles );
1394  CHECK( rval );
1395 
1396  return true;
1397 }

References CHECK, match_vertices_and_elements(), mb, MBQUAD, read_file(), two_quad_mesh, two_quad_mesh_conn, and two_quad_mesh_coords.

◆ test_vector_attrib()

bool test_vector_attrib ( const char *  vtk_type,
DataType  mb_type 
)

Definition at line 1184 of file VtkTest.cpp.

1185 {
1186  char file[4096];
1187  strcpy( file, two_quad_mesh );
1188  size_t len = strlen( file );
1189  len += sprintf( file + len, "POINT_DATA 6\n" );
1190  len += sprintf( file + len, "VECTORS data %s\n", vtk_type );
1191  write_data( file, len, mb_type, 6 * 3, vertex_values );
1192  len += sprintf( file + len, "CELL_DATA 2\n" );
1193  len += sprintf( file + len, "VECTORS data %s\n", vtk_type );
1194  write_data( file, len, mb_type, 2 * 3, element_values );
1195 
1196  return check_tag_data( file, mb_type, 3 );
1197 }

References check_tag_data(), element_values, two_quad_mesh, vertex_values, and write_data().

Referenced by test_vector_attrib_bit(), test_vector_attrib_char(), test_vector_attrib_double(), test_vector_attrib_float(), test_vector_attrib_int(), test_vector_attrib_long(), test_vector_attrib_short(), test_vector_attrib_uchar(), test_vector_attrib_uint(), test_vector_attrib_ulong(), and test_vector_attrib_ushort().

◆ test_vector_attrib_bit()

bool test_vector_attrib_bit ( )

Definition at line 689 of file VtkTest.cpp.

690 {
691  return test_vector_attrib( "bit", MB_TYPE_BIT );
692 }

References MB_TYPE_BIT, and test_vector_attrib().

◆ test_vector_attrib_char()

bool test_vector_attrib_char ( )

Definition at line 699 of file VtkTest.cpp.

700 {
701  return test_vector_attrib( "char", MB_TYPE_INTEGER );
702 }

References MB_TYPE_INTEGER, and test_vector_attrib().

◆ test_vector_attrib_double()

bool test_vector_attrib_double ( )

Definition at line 739 of file VtkTest.cpp.

740 {
741  return test_vector_attrib( "double", MB_TYPE_DOUBLE );
742 }

References MB_TYPE_DOUBLE, and test_vector_attrib().

◆ test_vector_attrib_float()

bool test_vector_attrib_float ( )

Definition at line 734 of file VtkTest.cpp.

735 {
736  return test_vector_attrib( "float", MB_TYPE_DOUBLE );
737 }

References MB_TYPE_DOUBLE, and test_vector_attrib().

◆ test_vector_attrib_int()

bool test_vector_attrib_int ( )

Definition at line 719 of file VtkTest.cpp.

720 {
721  return test_vector_attrib( "int", MB_TYPE_INTEGER );
722 }

References MB_TYPE_INTEGER, and test_vector_attrib().

◆ test_vector_attrib_long()

bool test_vector_attrib_long ( )

Definition at line 729 of file VtkTest.cpp.

730 {
731  return test_vector_attrib( "long", MB_TYPE_INTEGER );
732 }

References MB_TYPE_INTEGER, and test_vector_attrib().

◆ test_vector_attrib_short()

bool test_vector_attrib_short ( )

Definition at line 709 of file VtkTest.cpp.

710 {
711  return test_vector_attrib( "short", MB_TYPE_INTEGER );
712 }

References MB_TYPE_INTEGER, and test_vector_attrib().

◆ test_vector_attrib_uchar()

bool test_vector_attrib_uchar ( )

Definition at line 694 of file VtkTest.cpp.

695 {
696  return test_vector_attrib( "unsigned_char", MB_TYPE_INTEGER );
697 }

References MB_TYPE_INTEGER, and test_vector_attrib().

◆ test_vector_attrib_uint()

bool test_vector_attrib_uint ( )

Definition at line 714 of file VtkTest.cpp.

715 {
716  return test_vector_attrib( "unsigned_int", MB_TYPE_INTEGER );
717 }

References MB_TYPE_INTEGER, and test_vector_attrib().

◆ test_vector_attrib_ulong()

bool test_vector_attrib_ulong ( )

Definition at line 724 of file VtkTest.cpp.

725 {
726  return test_vector_attrib( "unsigned_long", MB_TYPE_INTEGER );
727 }

References MB_TYPE_INTEGER, and test_vector_attrib().

◆ test_vector_attrib_ushort()

bool test_vector_attrib_ushort ( )

Definition at line 704 of file VtkTest.cpp.

705 {
706  return test_vector_attrib( "unsigned_short", MB_TYPE_INTEGER );
707 }

References MB_TYPE_INTEGER, and test_vector_attrib().

◆ test_wedge()

bool test_wedge ( )

Definition at line 391 of file VtkTest.cpp.

392 {
393  const double coords[] = { 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1 };
394  const int exo_conn[] = { 0, 1, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7 };
395  const int vtk_conn[] = { 0, 3, 1, 4, 7, 5, 1, 3, 2, 5, 7, 6 };
396  return test_read_write_element( coords, 8, vtk_conn, exo_conn, 12, 2, 13, MBPRISM );
397 }

References MBPRISM, and test_read_write_element().

◆ test_wedge15()

bool test_wedge15 ( )

Definition at line 399 of file VtkTest.cpp.

400 {
401  const double coords[] = { 2, 0, 0, 2, 2, 0, 0, 2, 0, 0, 0, 0, 2, 0, 2, 2, 2, 2, 0, 2, 2, 0,
402  0, 2, 2, 1, 0, 1, 2, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 2, 1, 2, 1, 2,
403  2, 0, 1, 2, 1, 0, 2, 1, 1, 2, 2, 0, 1, 2, 2, 1, 0, 2, 1, 0, 0, 1 };
404  const int exo_conn[] = { 0, 1, 3, 4, 5, 7, 8, 12, 11, 18, 19, 21, 13, 17, 16,
405  1, 2, 3, 5, 6, 7, 9, 10, 12, 19, 20, 21, 14, 15, 17 };
406  const int vtk_conn[] = { 0, 3, 1, 4, 7, 5, 11, 12, 8, 16, 17, 13, 18, 21, 19,
407  1, 3, 2, 5, 7, 6, 12, 10, 9, 17, 15, 14, 19, 21, 20 };
408  return test_read_write_element( coords, 22, vtk_conn, exo_conn, 30, 2, 26, MBPRISM );
409 }

References MBPRISM, and test_read_write_element().

◆ test_write_free_nodes()

bool test_write_free_nodes ( )

Definition at line 1303 of file VtkTest.cpp.

1304 {
1305  Core moab_inst;
1306  Interface& moab = moab_inst;
1307  ErrorCode rval;
1308 
1309  // create 9 nodes in grid pattern
1310  EntityHandle verts[9];
1311  const double coords[][3] = { { 0, 0, 0 }, { 1, 0, 0 }, { 2, 0, 0 }, { 0, 1, 0 }, { 1, 1, 0 },
1312  { 2, 1, 0 }, { 0, 2, 0 }, { 1, 2, 0 }, { 2, 2, 0 } };
1313  for( unsigned i = 0; i < 9; ++i )
1314  {
1315  rval = moab.create_vertex( coords[i], verts[i] );
1316  assert( MB_SUCCESS == rval );
1317  }
1318 
1319  // create 3 quad elements, one node (8) not used
1320  const int conn[][4] = { { 0, 1, 4, 3 }, { 1, 2, 5, 4 }, { 3, 4, 7, 6 } };
1321 
1322  Tag gid;
1323  rval = moab.tag_get_handle( "GLOBAL_ID", 1, moab::MB_TYPE_INTEGER, gid );
1324  assert( MB_SUCCESS == rval );
1325  EntityHandle econn[4], elems[3];
1326  for( unsigned i = 0; i < 3; ++i )
1327  {
1328  for( unsigned j = 0; j < 4; ++j )
1329  econn[j] = verts[conn[i][j]];
1330  rval = moab.create_element( MBQUAD, econn, 4, elems[i] );
1331  assert( MB_SUCCESS == rval );
1332  int id = i + 1;
1333  rval = moab.tag_set_data( gid, &elems[i], 1, &id );
1334  assert( MB_SUCCESS == rval );
1335  }
1336 
1337  rval = moab.write_file( "tmp_file.vtk" );
1338  CHECK( rval );
1339 
1340  rval = moab.write_file( "tmp_file2.vtk", 0, "CREATE_ONE_NODE_CELLS;" );
1341  CHECK( rval );
1342 
1343  // read data back in
1344  moab.delete_mesh();
1345  rval = moab.load_file( "tmp_file.vtk" );
1346  remove( "tmp_file.vtk" );
1347  remove( "tmp_file2.vtk" );
1348  CHECK( rval );
1349 
1350  return true;
1351 }

References CHECK, ErrorCode, MB_SUCCESS, MB_TYPE_INTEGER, and MBQUAD.

◆ write_and_read()

bool write_and_read ( Interface iface1,
Interface iface2 
)

Definition at line 807 of file VtkTest.cpp.

808 {
809  const char fname[] = "tmp_file.vtk";
810  ErrorCode rval1 = iface1->write_mesh( fname );
811  ErrorCode rval2 = iface2->load_mesh( fname );
812  remove( fname );
813  CHECK( rval1 );
814  CHECK( rval2 );
815  return true;
816 }

References CHECK, ErrorCode, fname, moab::Interface::load_mesh(), and moab::Interface::write_mesh().

Referenced by check_tag_data(), and test_read_write_element().

◆ write_data()

void write_data ( char *  file,
size_t &  len,
DataType  type,
unsigned  count,
const int *  vals 
)

Definition at line 1042 of file VtkTest.cpp.

1043 {
1044  switch( type )
1045  {
1046  case MB_TYPE_BIT:
1047  for( unsigned i = 0; i < count; ++i )
1048  len += sprintf( file + len, "%d\n", abs( vals[i] ) % 2 );
1049  break;
1050  case MB_TYPE_INTEGER:
1051  for( unsigned i = 0; i < count; ++i )
1052  len += sprintf( file + len, "%d\n", vals[i] );
1053  break;
1054  case MB_TYPE_DOUBLE:
1055  for( unsigned i = 0; i < count; ++i )
1056  len += sprintf( file + len, "%f\n", (double)vals[i] );
1057  break;
1058  case MB_TYPE_OPAQUE:
1059  for( unsigned i = 0; i < count; ++i )
1060  len += sprintf( file + len, "%d\n", abs( vals[i] % 256 ) );
1061  break;
1062  default:
1063  assert( false /* VTK files cannot handle this type */ );
1064  }
1065 }

References MB_TYPE_BIT, MB_TYPE_DOUBLE, MB_TYPE_INTEGER, and MB_TYPE_OPAQUE.

Referenced by test_scalar_attrib(), test_tensor_attrib(), and test_vector_attrib().

Variable Documentation

◆ element_values

const int element_values[]
Initial value:
= { 1001, 1002, 1004, 1003, 50, 60, 51, 61, 1, 2, 3, 4, 5, 6,
7, 8, 9, 0, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 }

Definition at line 1039 of file VtkTest.cpp.

Referenced by check_tag_values(), test_scalar_attrib(), test_tensor_attrib(), and test_vector_attrib().

◆ grid_2x2x2

const double grid_2x2x2[]
Initial value:
= { 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 1, 1, 0, 2, 1, 0, 0, 2, 0, 1, 2, 0, 2, 2, 0,
0, 0, 1, 1, 0, 1, 2, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1,
0, 0, 2, 1, 0, 2, 2, 0, 2, 0, 1, 2, 1, 1, 2, 2, 1, 2, 0, 2, 2, 1, 2, 2, 2, 2, 2 }

Definition at line 347 of file VtkTest.cpp.

Referenced by test_hex20(), test_hex27(), test_hex8(), test_structured_3d(), and test_structured_grid_3d().

◆ grid_3x3

const double grid_3x3[]
Initial value:
= { 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0,
0, 2, 0, 1, 2, 0, 2, 2, 0, 3, 2, 0, 0, 3, 0, 1, 3, 0, 2, 3, 0, 3, 3, 0 }

Definition at line 258 of file VtkTest.cpp.

Referenced by test_quad4(), test_structured_2d(), and test_structured_grid_2d().

◆ hex_structured_conn

const int hex_structured_conn[]
Initial value:
= { 0, 1, 4, 3, 9, 10, 13, 12, 1, 2, 5, 4, 10, 11, 14, 13,
3, 4, 7, 6, 12, 13, 16, 15, 4, 5, 8, 7, 13, 14, 17, 16,
9, 10, 13, 12, 18, 19, 22, 21, 10, 11, 14, 13, 19, 20, 23, 22,
12, 13, 16, 15, 21, 22, 25, 24, 13, 14, 17, 16, 22, 23, 26, 25 }

Definition at line 351 of file VtkTest.cpp.

Referenced by test_hex8(), and test_structured_3d().

◆ num_tests

size_t num_tests = 0

Definition at line 31 of file VtkTest.cpp.

Referenced by find_volume_tests(), initialize_default_files(), main(), and register_test().

◆ poly_example

std::string poly_example = TestDir + "unittest/io/poly8-10.vtk"

Definition at line 17 of file VtkTest.cpp.

Referenced by test_polygon_mix().

◆ polyhedra_example

std::string polyhedra_example = TestDir + "unittest/io/polyhedra.vtk"

Definition at line 18 of file VtkTest.cpp.

Referenced by test_polyhedra().

◆ quad_structured_conn

const int quad_structured_conn[]
Initial value:
= { 0, 1, 5, 4, 1, 2, 6, 5, 2, 3, 7, 6, 4, 5, 9, 8, 5, 6,
10, 9, 6, 7, 11, 10, 8, 9, 13, 12, 9, 10, 14, 13, 10, 11, 15, 14 }

Definition at line 261 of file VtkTest.cpp.

Referenced by test_quad4(), and test_structured_2d().

◆ test_array

test_data* test_array = 0

Definition at line 32 of file VtkTest.cpp.

Referenced by main(), and register_test().

◆ two_quad_mesh

const char two_quad_mesh[]
Initial value:
= "# vtk DataFile Version 3.0\n"
"MOAB Version 1.00\n"
"ASCII\n"
"DATASET UNSTRUCTURED_GRID\n"
"POINTS 6 float\n"
"-1 0 0\n"
" 0 0 0\n"
" 1 0 0\n"
"-1 1 0\n"
" 0 1 0\n"
" 1 1 0\n"
"CELLS 2 10\n"
"4 0 1 4 3\n"
"4 1 2 5 4\n"
"CELL_TYPES 2\n"
"9 9\n"

Definition at line 1017 of file VtkTest.cpp.

Referenced by test_scalar_attrib(), test_tensor_attrib(), test_unstructured_field(), and test_vector_attrib().

◆ two_quad_mesh_conn

const int two_quad_mesh_conn[] = { 0, 1, 4, 3, 1, 2, 5, 4 }

Definition at line 1035 of file VtkTest.cpp.

Referenced by check_tag_values(), and test_unstructured_field().

◆ two_quad_mesh_coords

const double two_quad_mesh_coords[] = { -1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 1, 0, 0, 1, 0, 1, 1, 0 }

Definition at line 1034 of file VtkTest.cpp.

Referenced by check_tag_values(), and test_unstructured_field().

◆ vertex_values

const int vertex_values[]
Initial value:
= { 9, 3, 8, 2, 0, 6, 4, 1, 4, 1, 0, 3, 8, 6, 6, 4, 0, 2, 1, 2, 3, 4, 5, 6, 6, 5, 4,
3, 2, 1, 0, 6, 1, 5, 2, 4, 3, 6, 9, 2, 5, 8, 1, 3, 5, 7, 1, 3, 5, 8, 1, 9, 7, 4 }

Definition at line 1037 of file VtkTest.cpp.

Referenced by check_tag_values(), test_scalar_attrib(), test_tensor_attrib(), and test_vector_attrib().