71 #define DEFAULT_TEST_FILE brick.vtk
76 #define DEFAULT_INPUT_FILE STRINGIFY( SRCDIR/DEFAULT_TEST_FILE )
78 #define DEFAULT_INPUT_FILE STRINGIFY( DEFAULT_TEST_FILE )
82 #define ASSERT( COND ) \
86 PRINT_ASSERT_FAILURE( #COND, __FILE__, __LINE__ ); \
87 assert_pass = false; \
92 printf(
"Condition: %s\n", cond );
93 printf(
" failed at %s line %d\n", file, line );
97 if( (err) != iBase_SUCCESS ) do \
99 printf( "%s:%d ITAPS error %d\n", __FILE__, __LINE__, err ); \
114 printf(
"Success\n" );
115 ( *number_successful )++;
119 printf(
"Failure\n" );
120 ( *number_failed )++;
136 printf(
"ERROR : can not load a mesh from file %s\n",
filename );
143 #define TEST_ERROR_CODE( A, B ) \
144 if( iBase_ERROR_MAP[( A )] != ( B ) ) \
146 printf( "ERROR: Invalid mapping for MOAB error code %s\n", #A ); \
147 printf( " Expected %d, actual is %d\n", (int)iBase_ERROR_MAP[( A )], (int)( B ) ); \
173 int faces_alloc = 0, faces_size;
175 int* dimensions = NULL;
176 int dimensions_alloc = 0, dimensions_size;
182 printf(
"Failed to get faces in entity_sets_test.\n" );
190 printf(
"Failed to get dimensions of faces in topology_test.\n" );
195 if( dimensions_size != faces_size )
197 printf(
"Didn't get the right number of types in topology_test.\n" );
204 for( i = 0; i < faces_size; i++ )
231 int result, i, j, entities_alloc, entities_size, *topologies;
232 int topologies_alloc, topologies_size;
235 int top_j, num_tops, region_type, num_region;
237 int adj_faces_alloc = 0, adj_faces_size;
238 int* face_offsets = NULL;
239 int face_offsets_alloc = 0, face_offsets_size, face_loaded;
241 int adj_regions_alloc = 0, adj_regions_size;
242 int* region_offsets = NULL;
243 int region_offsets_alloc = 0, region_offsets_size;
245 int num_int = 0, num_ext = 0, found, next_offset, iter;
246 int num_faces_per_region;
260 printf(
"Failed to get entities in adjacencies_test.\n" );
264 if( entities_alloc > 0 )
267 topologies_alloc = 0;
272 printf(
"Failed to get topologies in adjacencies_test.\n" );
276 if( topologies_size != entities_size )
278 printf(
"Didn't get the right number of topologies "
279 "in topology_adjacency_test.\n" );
288 for( j = 0; j < entities_size; j++ )
291 printf(
"Didn't find entity type for this topology." );
294 entity_vectors[i][entity_vectors_sizes[i]] =
entities[j];
295 entity_vectors_sizes[i]++;
312 printf(
"Failed to get number of topologies in adjacencies_test.\n" );
314 free( entity_vectors[i] );
318 if( entity_vectors_sizes[top_j] != num_tops )
320 printf(
"Topology count mismatch.\n" );
322 free( entity_vectors[i] );
333 num_region = entity_vectors_sizes[region_type];
340 face_offsets_alloc = 0;
343 &adj_faces_size, &face_offsets, &face_offsets_alloc, &face_offsets_size, &result );
346 printf(
"Failed to get adjacent faces of regions in adjacencies_test.\n" );
348 free( entity_vectors[i] );
352 if( num_region + 1 != face_offsets_size )
354 printf(
"Number of offsets didn't agree with number of "
355 "regions in topology_adjacency_test.\n" );
356 free( face_offsets );
359 free( entity_vectors[i] );
368 if( adj_faces_size == 4 * num_region ) face_loaded =
TRUE;
372 if( adj_faces_size == 6 * num_region ) face_loaded =
TRUE;
376 if( adj_faces_size == 5 * num_region ) face_loaded =
TRUE;
380 if( adj_faces_size == 5 * num_region ) face_loaded =
TRUE;
384 if( adj_faces_size == 7 * num_region ) face_loaded =
TRUE;
391 adj_regions_alloc = 0;
392 region_offsets = NULL;
393 region_offsets_alloc = 0;
395 &adj_regions_size, ®ion_offsets, ®ion_offsets_alloc, ®ion_offsets_size,
399 printf(
"Failed to get regions from faces in adjacencies_test.\n" );
400 free( face_offsets );
403 free( entity_vectors[i] );
407 if( adj_faces_size + 1 != region_offsets_size )
409 printf(
"Number of offsets didn't agree with number of faces in "
410 "topology_adjacency_test.\n" );
411 free( face_offsets );
412 free( region_offsets );
416 free( entity_vectors[i] );
426 for( i = 0; i < adj_faces_size; i++ )
429 if( i == adj_faces_size - 1 )
430 next_offset = adj_regions_size;
432 next_offset = region_offsets[i + 1];
434 if( next_offset - region_offsets[i] == 2 )
437 for( iter = 0; iter < num_int; iter++ )
439 if( interior[iter] == adj_faces[i] )
445 if( !found ) interior[num_int++] = adj_faces[i];
451 for( i = 0; i < adj_faces_size; i++ )
454 for( iter = 0; iter < num_int; iter++ )
456 if( interior[iter] == adj_faces[i] )
462 if( !found ) exterior[num_ext++] = adj_faces[i];
465 num_faces_per_region = face_offsets[1] - face_offsets[0];
472 if( num_ext + 2 * num_int != num_faces_per_region * num_region )
474 printf(
"exterior/interior failure: %d ext, %d int, %d regions, %d faces per\n", num_ext, num_int,
475 num_region, num_faces_per_region );
476 free( face_offsets );
477 free( region_offsets );
483 free( entity_vectors[i] );
488 free( face_offsets );
489 free( region_offsets );
498 free( entity_vectors[i] );
505 return *(
char**)
h1 - *(
char**)h2;
517 int *offsets, offsets_alloc, offsets_size;
518 int *indices, indices_alloc, indices_size;
520 int entities_alloc, entities_size, adj_ents_alloc, adj_ents_size;
521 int entities2_alloc, entities2_size;
523 int adj_ents2_alloc = 27, adj_ents2_size, i,
size;
536 &entities_size, &adj_ents, &adj_ents_alloc, &adj_ents_size, &indices, &indices_alloc,
537 &indices_size, &offsets, &offsets_alloc, &offsets_size, &result );
540 printf(
"Failed to get indices of vertices in connectivity_test, type=%d.\n", type );
544 if( entities_alloc != entities_size )
546 printf(
"Number of entities didn't agree with array size in connectivity_test.\n" );
554 if( offsets_alloc != offsets_size )
556 printf(
"Number of offsets didn't agree with array size in connectivity_test.\n" );
564 if( indices_alloc != indices_size )
566 printf(
"Number of indices didn't agree with array size in connectivity_test.\n" );
574 if( adj_ents_alloc != adj_ents_size )
576 printf(
"Number of adjacent entities didn't agree with array size in "
577 "connectivity_test.\n" );
585 if( offsets_size != entities_size + 1 )
587 printf(
"Invalid/inconsistent offset size from iMesh_getAdjEntIndices.\n" );
596 for( i = 0; i < entities_size; ++i )
598 ASSERT( offsets[i] < offsets[i + 1] && offsets[i] < indices_size );
609 for( i = 0; i < indices_size; ++i )
611 ASSERT( indices[i] >= 0 && indices[i] < adj_ents_size );
643 ASSERT( entities_size == entities2_size && !memcmp( sorted, entities2,
size ) );
659 for( i = 0; i < entities_size; ++i )
673 ASSERT( adj_ents2_ptr == adj_ents2 );
683 ASSERT( adj_ents2_alloc == 27 );
694 size = offsets[i + 1] - offsets[i];
698 ASSERT( adj_ents2[
size] == adj_ents[indices[offsets[i] +
size]] );
762 int entities_alloc = 0, entities_size;
765 iBase_EntityHandle *edges = NULL, *faces = NULL, *temp_entities1 = NULL, *temp_entities2 = NULL;
766 int edges_alloc = 0, faces_alloc = 0, temp_entities1_alloc = 0, temp_entities2_alloc = 0;
767 int edges_size, faces_size, temp_entities1_size, temp_entities2_size;
769 int types_alloc = 0, types_size;
770 int num_rest, num_regions;
772 int regions_alloc = 0, regions_size;
774 int parents_alloc = 0, parents_size, temp_numb, is_child;
776 int es_array1_alloc = 0, es_array1_size, num_super;
778 int all_entities_alloc = 0, all_entities_size, k, l;
780 int adj_faces_alloc = 0, adj_faces_size;
781 int* face_offsets = NULL;
782 int face_offsets_alloc = 0, face_offsets_size;
784 int hexes_alloc = 0, hexes_size;
788 int n_whole_mesh = 0;
793 printf(
"Problem to get the number of all entity sets in whole mesh.\n" );
798 for( ; ent_type < num_type; ent_type++ )
804 printf(
"Problem creating entityset.\n" );
815 printf(
"Failed to get entities by type in entity_sets_test.\n" );
819 if( entities_alloc != entities_size )
821 printf(
"Number of entities didn't agree with array size in entity_sets_subtest.\n" );
827 if( 0 != entities_size )
832 printf(
"Failed to add entities in entity_sets_test.\n" );
843 printf(
"Failed to get number of entities by type in entity_sets_test.\n" );
849 if( number_array[ent_type] != entities_size )
851 printf(
"Number of entities by type is not correct\n" );
869 printf(
"Failed to create a super set in entity_sets_test.\n" );
873 for( i = 0; i < num_type; i++ )
878 printf(
"Failed to add a set to a super set in entity_sets_test.\n" );
890 printf(
"Failed to create a super set in entity_sets_test.\n" );
909 printf(
"Failed to get edge entities in entity_sets_test.\n" );
917 printf(
"Failed to add edge entities in entity_sets_test.\n" );
929 printf(
"Failed to get face entities in entity_sets_test.\n" );
938 printf(
"Failed to add face entities in entity_sets_test.\n" );
949 printf(
"Failed to subtract entitysets in entity_sets_test.\n" );
955 temp_entities1 = NULL;
956 temp_entities1_alloc = 0;
958 &temp_entities1_size, &result );
961 printf(
"Failed to get face entities in entity_sets_test.\n" );
967 if( faces_size != temp_entities1_size )
969 printf(
"not match number of entitysets after subtraction "
970 "in entity_sets_test.\n" );
973 free( temp_entities1 );
983 printf(
"Failed to get types of entities in entity_sets_test.\n" );
986 free( temp_entities1 );
989 for( i = 0; i < types_size; i++ )
993 printf(
"wrong entity type for face test in entity_sets_test.\n" );
996 free( temp_entities1 );
1005 printf(
"Failed to destroy temp es2.\n" );
1008 free( temp_entities1 );
1017 free( temp_entities1 );
1028 printf(
"Failed to remove face entities in entity_sets_test.\n" );
1031 free( temp_entities1 );
1040 printf(
"Failed to get number of entities by type in entity_sets_test.\n" );
1043 free( temp_entities1 );
1050 printf(
"failed to remove correctly.\n" );
1053 free( temp_entities1 );
1062 printf(
"Failed to add edge entities in entity_sets_test.\n" );
1065 free( temp_entities1 );
1074 printf(
"Failed to add edge entities in entity_sets_test.\n" );
1077 free( temp_entities1 );
1087 printf(
"Failed to intersect in entity_sets_test.\n" );
1090 free( temp_entities1 );
1095 temp_entities2 = NULL;
1096 temp_entities2_alloc = 0;
1098 &temp_entities2_size, &result );
1101 printf(
"Failed to get face entities in entity_sets_test.\n" );
1104 free( temp_entities1 );
1109 if( temp_entities2_size != 0 )
1111 printf(
"wrong number of faces.\n" );
1114 free( temp_entities1 );
1115 free( temp_entities2 );
1123 printf(
"Failed to destroy temp es2.\n" );
1126 free( temp_entities1 );
1127 free( temp_entities2 );
1136 free( temp_entities1 );
1137 free( temp_entities2 );
1147 printf(
"Failed to create a temp entityset in entity_sets_test.\n" );
1150 free( temp_entities1 );
1151 free( temp_entities2 );
1160 ®ions_size, &result );
1163 printf(
"Failed to get region entities in entity_sets_test.\n" );
1166 free( temp_entities1 );
1167 free( temp_entities2 );
1176 printf(
"Failed to add region entities in entity_sets_test.\n" );
1179 free( temp_entities1 );
1180 free( temp_entities2 );
1190 printf(
"Failed to unite in entity_sets_test.\n" );
1193 free( temp_entities1 );
1194 free( temp_entities2 );
1204 printf(
"Failed to get number of region entities by type in entity_sets_test.\n" );
1207 free( temp_entities1 );
1208 free( temp_entities2 );
1216 printf(
"different number of regions in entity_sets_test.\n" );
1219 free( temp_entities1 );
1220 free( temp_entities2 );
1230 free( temp_entities1 );
1231 free( temp_entities2 );
1243 printf(
"Problem creating entityset in entity_sets_test.\n" );
1246 free( temp_entities1 );
1247 free( temp_entities2 );
1256 printf(
"Problem add parent in entity_sets_test.\n" );
1259 free( temp_entities1 );
1260 free( temp_entities2 );
1269 iMesh_getPrnts(
mesh, parent_child, 0, &parents, &parents_alloc, &parents_size, &result );
1272 printf(
"Problem getting parents in entity_sets_test.\n" );
1275 free( temp_entities1 );
1276 free( temp_entities2 );
1282 if( parents_size != 1 )
1284 printf(
"number of parents is not correct in entity_sets_test.\n" );
1287 free( temp_entities1 );
1288 free( temp_entities2 );
1299 printf(
"Problem getting number of children in entity_sets_test.\n" );
1302 free( temp_entities1 );
1303 free( temp_entities2 );
1310 if( temp_numb != 1 )
1312 printf(
"number of children is not correct in entity_sets_test.\n" );
1315 free( temp_entities1 );
1316 free( temp_entities2 );
1328 printf(
"Problem checking relation in entity_sets_test.\n" );
1331 free( temp_entities1 );
1332 free( temp_entities2 );
1340 printf(
"parent_child and es_array[iBase_VERTEX] should be related\n" );
1343 free( temp_entities1 );
1344 free( temp_entities2 );
1356 printf(
"Problem checking relation in entity_sets_test.\n" );
1359 free( temp_entities1 );
1360 free( temp_entities2 );
1368 printf(
"es_array[iBase_REGION] and es_array[iBase_FACE] should not be related\n" );
1371 free( temp_entities1 );
1372 free( temp_entities2 );
1383 free( temp_entities1 );
1384 free( temp_entities2 );
1395 es_array1_alloc = 0;
1396 iMesh_getEntSets(
mesh, super_set, 0, &es_array1, &es_array1_alloc, &es_array1_size, &result );
1399 printf(
"Problem to get entity sets in super set.\n" );
1402 free( temp_entities1 );
1403 free( temp_entities2 );
1414 printf(
"Problem to get the number of all entity sets in super set.\n" );
1417 free( temp_entities1 );
1418 free( temp_entities2 );
1427 if( num_super != es_array1_size )
1429 printf(
"the number of entity sets in super set should be same.\n" );
1434 all_entities = NULL;
1435 all_entities_alloc = 0;
1437 &all_entities_size, &result );
1440 printf(
"Problem to get all entities in super set.\n" );
1443 free( temp_entities1 );
1444 free( temp_entities2 );
1463 for( k = 0; k < num_super; k++ )
1468 for( l = 0; l < es_array1_size; l++ )
1473 printf(
"Problem to add entity set to entityset.\n" );
1476 free( temp_entities1 );
1477 free( temp_entities2 );
1482 free( all_entities );
1491 printf(
"Problem to add super set to entitysets.\n" );
1494 free( temp_entities1 );
1495 free( temp_entities2 );
1500 free( all_entities );
1505 for( l = 0; l < 3; l++ )
1510 printf(
"Problem to add temp set to entitysets.\n" );
1513 free( temp_entities1 );
1514 free( temp_entities2 );
1519 free( all_entities );
1532 printf(
"Failed to get hexes in entity_sets_test.\n" );
1535 free( temp_entities1 );
1536 free( temp_entities2 );
1541 free( all_entities );
1547 adj_faces_alloc = 0;
1548 face_offsets = NULL;
1549 face_offsets_alloc = 0;
1552 &face_offsets, &face_offsets_alloc, &face_offsets_size, &result );
1555 printf(
"Problem to get adjacent entities in entitysets_test.\n" );
1558 free( temp_entities1 );
1559 free( temp_entities2 );
1564 free( all_entities );
1572 printf(
"Problem creating entityset in entity_sets_test.\n" );
1575 free( temp_entities1 );
1576 free( temp_entities2 );
1581 free( all_entities );
1584 free( face_offsets );
1591 printf(
"Failed to add hexes in entity_sets_test.\n" );
1594 free( temp_entities1 );
1595 free( temp_entities2 );
1600 free( all_entities );
1603 free( face_offsets );
1609 free( temp_entities1 );
1610 free( temp_entities2 );
1615 free( all_entities );
1618 free( face_offsets );
1625 int entity_sets_size;
1631 printf(
"Problem to get all entity sets in mesh.\n" );
1634 if( entity_sets_size != num_sets )
1636 printf(
"the number of entity sets in whole mesh should be %d"
1637 ", actual number is %d.\n",
1638 num_sets, entity_sets_size );
1652 int iter_num = 0, result;
1655 for( i = 0; i < 2; i++ )
1660 if( !result )
return result;
1674 int verts_alloc = 0, verts_size;
1675 double* vert_coords = NULL;
1676 int vert_coords_alloc = 0, vert_coords_size;
1684 printf(
"failed to get preferred storage order in vertex_coordinates_test.\n" );
1695 printf(
"failed to get entities in vertex_coordinates_test.\n" );
1701 vert_coords_alloc = 0;
1704 &vert_coords_size, &result );
1707 printf(
"failed to get vertex cooridinate of entities in vertex_coordinates_test.\n" );
1713 free( vert_coords );
1727 int dum_name_size = 120;
1734 const char* tag_name =
"int_tag";
1735 int tag_name_size = 8;
1739 printf(
"Failed to create tag int_tag in vertex_tag_test." );
1747 printf(
"Couldn't get name of tag just created.\n" );
1750 if( strcmp( dum_name,
"int_tag" ) != 0 )
1752 printf(
"Tag names didn't match.\n" );
1759 printf(
"Couldn't get size of tag just created.\n" );
1762 if( dum_size !=
sizeof(
int ) )
1764 printf(
"Tag sizes didn't match.\n" );
1771 printf(
"Couldn't get handle of tag just created.\n" );
1774 if( dum_handle != tag_handle )
1776 printf(
"Tag handles didn't match.\n" );
1785 printf(
"Couldn't delete tag just created.\n" );
1797 printf(
"tagGetHandle was able to find handle for deleted tag.\n" );
1809 int dum_val = 11, dum_val2;
1810 void* dum_val2_ptr = &dum_val2;
1811 int dum_val2_alloc =
sizeof( int ), dum_val2_size;
1814 const char* tag_name =
"int_tag";
1815 int tag_name_size = 8;
1819 printf(
"Failed to create tag int_tag in vertex_int_tag_test.\n" );
1824 iMesh_setArrData(
mesh, &dum_vert, 1, *int_tag, (
const char*)( &dum_val ),
sizeof(
int ), &result );
1827 printf(
"Failed to set int tag (val=11) in vertex_int_tag_test.\n" );
1831 iMesh_getArrData(
mesh, &dum_vert, 1, *int_tag, &dum_val2_ptr, &dum_val2_alloc, &dum_val2_size, &result );
1834 printf(
"Failed to get int tag (val=11) in vertex_int_tag_test.\n" );
1838 if( dum_val2 != 11 )
1841 printf(
"Value of vertex tag (val=11) wrong.\n" );
1851 printf(
"Failed to set int tag (val=12) in vertex_int_tag_test.\n" );
1855 iMesh_getArrData(
mesh, &dum_vert, 1, *int_tag, &dum_val2_ptr, &dum_val2_alloc, &dum_val2_size, &result );
1858 printf(
"Failed to get int tag (val=12) in vertex_int_tag_test.\n" );
1862 if( dum_val2 != 12 )
1865 printf(
"Value of vertex tag (val=12) wrong.\n" );
1881 double dum_val = 1.0e6, dum_val2;
1882 void* dum_val2_ptr = &dum_val2;
1883 int dum_val2_alloc =
sizeof( double ), dum_val2_size;
1886 const char* tag_name =
"double_tag";
1887 int tag_name_size = 11;
1891 printf(
"Failed to create tag double_tag in vertex_double_tag_test.\n" );
1896 iMesh_setArrData(
mesh, &dum_vert, 1, *double_tag, (
char*)( &dum_val ),
sizeof(
double ), &result );
1899 printf(
"Failed to set double tag (val=1.0e6) in vertex_double_tag_test.\n" );
1903 iMesh_getArrData(
mesh, &dum_vert, 1, *double_tag, &dum_val2_ptr, &dum_val2_alloc, &dum_val2_size, &result );
1906 printf(
"Failed to get double tag (val=1.0e6) in vertex_double_tag_test.\n" );
1910 if( dum_val2 != 1.0e6 )
1912 printf(
"Value of vertex tag (val=1.0e6) wrong.\n" );
1919 iMesh_setArrData(
mesh, &dum_vert, 1, *double_tag, (
char*)( &dum_val ),
sizeof(
double ), &result );
1922 printf(
"Failed to set double tag (val=2.0e9) in vertex_double_tag_test.\n" );
1926 iMesh_getArrData(
mesh, &dum_vert, 1, *double_tag, &dum_val2_ptr, &dum_val2_alloc, &dum_val2_size, &result );
1929 printf(
"Failed to get double tag (val=2.0e9) in vertex_double_tag_test.\n" );
1933 if( dum_val2 != 2.0e9 )
1935 printf(
"Value of vertex tag (val=2.0e9) wrong.\n" );
1957 struct TagStruct dum_struct = { 3.0e12, 2, 3 }, dum_struct2;
1958 void* dum_struct2_ptr = &dum_struct2;
1959 int dum_struct_alloc =
sizeof(
struct TagStruct ), dum_struct_size;
1962 const char* tag_name =
"struct_tag";
1963 int tag_name_size = 11;
1967 printf(
"Failed to create tag struct_tag in vertex_struct_tag_test.\n" );
1977 printf(
"Failed to set struct tag in vertex_struct_tag_test.\n" );
1981 iMesh_getArrData(
mesh, &dum_vert, 1, *struct_tag, &dum_struct2_ptr, &dum_struct_alloc, &dum_struct_size, &result );
1984 printf(
"Failed to get struct tag in vertex_struct_tag_test.\n" );
1988 if( dum_struct_size !=
sizeof(
struct TagStruct ) )
1990 printf(
"Size of vertex struct tag wrong.\n" );
1993 if( dum_struct2.test_int1 != dum_struct.
test_int1 || dum_struct2.test_int2 != dum_struct.
test_int2 ||
1994 dum_struct2.test_double != dum_struct.
test_double )
1996 printf(
"Value of vertex struct tag wrong.\n" );
2007 int delete_err =
FALSE;
2014 int all_tags_alloc = 0, all_tags_size;
2018 printf(
"Couldn't get all tag handles from vertex.\n" );
2025 printf(
"Couldn't remove tag from vertex.\n" );
2037 printf(
"Error when unforced-deleting tag in use on a vertex.\n" );
2045 printf(
"Couldn't force-delete a tag in use on a vertex.\n" );
2061 int int_err, double_err, struct_err, tag_delete_err;
2067 int verts_alloc = 0, verts_size;
2071 printf(
"entitysetGetEntities failed in vertex_tag_test.\n" );
2088 return ( info_err && int_err && double_err && struct_err && tag_delete_err );
2094 int dum_val = 11, dum_val2;
2095 void* dum_val2_ptr = &dum_val2;
2096 int dum_val2_alloc =
sizeof( int ), dum_val2_size;
2099 const char* tag_name =
"set_int_tag";
2103 printf(
"Failed to create tag int_tag in entityset_int_tag_test.\n" );
2112 printf(
"Failed to set int tag (val=11) in entityset_int_tag_test.\n" );
2120 printf(
"Failed to get int tag (val=11) in entityset_int_tag_test." );
2124 if( dum_val2 != 11 )
2126 printf(
"Value of entityset tag (val=11) wrong.\n" );
2135 printf(
"Failed to set int tag (val=12) in entityset_int_tag_test." );
2139 iMesh_getEntSetData(
mesh, sets[sets_size - 1], *int_tag, &dum_val2_ptr, &dum_val2_alloc, &dum_val2_size, &result );
2142 printf(
"Failed to get int tag (val=12) in entityset_int_tag_test." );
2146 if( dum_val2 != 12 )
2148 printf(
"Value of entityset tag (val=12) wrong.\n" );
2162 double dum_val = 1.0e6, dum_val2;
2163 void* dum_val2_ptr = &dum_val2;
2164 int dum_val2_alloc =
sizeof( double ), dum_val2_size;
2167 const char* tag_name =
"set_double_tag";
2171 printf(
"Failed to create tag double_tag in entityset_double_tag_test.\n" );
2180 printf(
"Failed to set double tag (val=11) in entityset_double_tag_test.\n" );
2188 printf(
"Failed to get double tag (val=1.0e6) in entityset_double_tag_test." );
2192 if( dum_val2 != 1.0e6 )
2194 printf(
"Value of entityset tag (val=11) wrong.\n" );
2200 iMesh_setEntSetData(
mesh, sets[sets_size - 1], *double_tag, (
char*)( &dum_val ),
sizeof(
double ), &result );
2203 printf(
"Failed to set double tag (val=2.0e9) in entityset_double_tag_test." );
2211 printf(
"Failed to get double tag (val=2.0e9) in entityset_double_tag_test." );
2215 if( dum_val2 != 2.0e9 )
2217 printf(
"Value of entityset tag (val=2.0e9) wrong.\n" );
2231 struct TagStruct dum_struct = { 3.0e12, 2, 3 }, dum_struct2;
2232 void* dum_struct2_ptr = &dum_struct2;
2233 int dum_struct_alloc =
sizeof(
struct TagStruct ), dum_struct_size;
2236 const char* tag_name =
"set_struct_tag";
2240 printf(
"Failed to create tag struct_tag in entityset_struct_tag_test.\n" );
2250 printf(
"Failed to set struct tag in entityset_struct_tag_test.\n" );
2257 printf(
"Failed to get struct tag in entityset_struct_tag_test.\n" );
2261 if( dum_struct_size !=
sizeof(
struct TagStruct ) )
2263 printf(
"Size of entityset struct tag wrong.\n" );
2266 if( dum_struct2.test_int1 != dum_struct.
test_int1 || dum_struct2.test_int2 != dum_struct.
test_int2 ||
2267 dum_struct2.test_double != dum_struct.
test_double )
2269 printf(
"Value of entityset struct tag wrong.\n" );
2281 int delete_err =
FALSE;
2287 printf(
"no sets.\n" );
2291 int all_tags_alloc = 0, all_tags_size;
2295 printf(
"Couldn't get all tag handles from entityset.\n" );
2303 printf(
"Couldn't remove tag from entityset.\n" );
2315 printf(
"Error when unforced-deleting tag in use on a entityset.\n" );
2323 printf(
"Couldn't force-delete a tag in use on a entityset.\n" );
2343 int int_success, double_success, struct_success, tag_delete_success;
2347 int esets_alloc = 0, esets_size;
2351 printf(
"entitysetGetEntities failed in entityset_tag_test.\n" );
2369 return ( int_success && double_success && struct_success && tag_delete_success );
2375 int dum_val = 11, dum_val2;
2376 void* dum_val2_ptr = &dum_val2;
2377 int dum_val2_alloc =
sizeof( int ), dum_val2_size;
2380 const char* tag_name =
"mesh_int_tag";
2384 printf(
"Failed to create tag int_tag in mesh_int_tag_test.\n" );
2393 printf(
"Failed to set int tag (val=11) in mesh_int_tag_test.\n" );
2401 printf(
"Failed to get int tag (val=11) in mesh_int_tag_test." );
2405 if( dum_val2 != 11 )
2407 printf(
"Value of entityset tag (val=11) wrong.\n" );
2416 printf(
"Failed to set int tag (val=12) in mesh_int_tag_test." );
2423 printf(
"Failed to get int tag (val=12) in mesh_int_tag_test." );
2427 if( dum_val2 != 12 )
2429 printf(
"Value of entityset tag (val=12) wrong.\n" );
2440 double dum_val = 1.0e6, dum_val2;
2441 void* dum_val2_ptr = &dum_val2;
2442 int dum_val2_alloc =
sizeof( double ), dum_val2_size;
2445 const char* tag_name =
"mesh_double_tag";
2449 printf(
"Failed to create tag double_tag in mesh_double_tag_test.\n" );
2458 printf(
"Failed to set double tag (val=11) in mesh_double_tag_test.\n" );
2466 printf(
"Failed to get double tag (val=1.0e6) in mesh_double_tag_test." );
2470 if( dum_val2 != 1.0e6 )
2472 printf(
"Value of entityset tag (val=11) wrong.\n" );
2481 printf(
"Failed to set double tag (val=2.0e9) in mesh_double_tag_test." );
2488 printf(
"Failed to get double tag (val=2.0e9) in mesh_double_tag_test." );
2492 if( dum_val2 != 2.0e9 )
2494 printf(
"Value of entityset tag (val=2.0e9) wrong.\n" );
2505 struct TagStruct dum_struct = { 3.0e12, 2, 3 }, dum_struct2;
2506 void* dum_struct2_ptr = &dum_struct2;
2507 int dum_struct_alloc =
sizeof(
struct TagStruct ), dum_struct_size;
2510 const char* tag_name =
"mesh_struct_tag";
2514 printf(
"Failed to create tag struct_tag in vertex_struct_tag_test.\n" );
2524 printf(
"Failed to set struct tag in mesh_struct_tag_test.\n" );
2531 printf(
"Failed to get struct tag in mesh_struct_tag_test.\n" );
2535 if( dum_struct_size !=
sizeof(
struct TagStruct ) )
2537 printf(
"Size of entityset struct tag wrong.\n" );
2540 if( dum_struct2.test_int1 != dum_struct.
test_int1 || dum_struct2.test_int2 != dum_struct.
test_int2 ||
2541 dum_struct2.test_double != dum_struct.
test_double )
2543 printf(
"Value of entityset struct tag wrong.\n" );
2555 int delete_err =
FALSE;
2559 int all_tags_alloc = 0, all_tags_size;
2563 printf(
"Couldn't get all tag handles from entityset.\n" );
2570 printf(
"Couldn't remove tag from entityset.\n" );
2582 printf(
"Error when unforced-deleting tag in use on a entityset.\n" );
2590 printf(
"Couldn't force-delete a tag in use on a entityset.\n" );
2621 return ( int_success && double_success && struct_success && tag_delete_success );
2641 fprintf( stderr,
"isEntSetContained returned false for contained set\n" );
2652 fprintf( stderr,
"isEntSetContained returned true for removed set\n" );
2663 double coords[] = { 0, 0, 0, 1, 1, 1 };
2666 int verts_alloc = 0, verts_size;
2672 int adj_alloc = 0, adj_size;
2685 if( adj_size != 1 || adj[0] != line )
2687 printf(
"Bad: couldn't find adjacency for vertex\n" );
2696 if( adj_size != 2 ||
2697 ( ( adj[0] != verts[0] || adj[1] != verts[1] ) && ( adj[0] != verts[1] || adj[1] != verts[0] ) ) )
2699 printf(
"Bad: couldn't find adjacencies for line\n" );
2713 double coords[] = { 0, 0, 0, 1, 1, 1 };
2716 int i, err, status, two = 2, three = 3;
2728 ents_in[0] = verts[1];
2730 ents_in[2] = verts[0];
2736 for( i = 0; i < three; i++ )
2738 if( ents_in[i] != ents_out[i] )
2740 printf(
"Ordered set does not preserve order\n" );
2753 double coords[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3 };
2756 int verts_alloc = 0, verts_size;
2759 int ents_alloc, ents_size;
2767 printf(
"Failed to return a root set.\n" );
2821 printf(
"%s:%d: Error %d initializing %s iterator for type %d/topo %d\n", __FILE__, __LINE__, result, info,
2822 (
int)type, (
int)topo );
2826 for( twice = 0; twice < 2; ++twice )
2829 for( i = 0; i < contents_size; ++i )
2834 printf(
"%s:%d: Error %d stepping %s iterator for type %d/topo %d\n", __FILE__, __LINE__, result, info,
2835 (
int)type, (
int)topo );
2836 goto end_single_iter;
2841 printf(
"%s:%d: %s iterator for type %d/topo %d ended prematurely at %d of %d\n", __FILE__, __LINE__,
2842 info, (
int)type, (
int)topo, i, contents_size );
2844 goto end_single_iter;
2847 if( value != contents[i] )
2849 printf(
"%s:%d: %s iterator for type %d/topo %d returned incorrect value at %d of %d\n", __FILE__,
2850 __LINE__, info, (
int)type, (
int)topo, i, contents_size );
2852 goto end_single_iter;
2859 printf(
"%s:%d: Error %d stepping %s iterator for type %d/topo %d\n", __FILE__, __LINE__, result, info,
2860 (
int)type, (
int)topo );
2861 goto end_single_iter;
2866 printf(
"%s:%d: %s iterator for type %d/topo %d did not end after %d values\n", __FILE__, __LINE__, info,
2867 (
int)type, (
int)topo, contents_size );
2869 goto end_single_iter;
2875 printf(
"%s:%d: Error %d resetting %s iterator for type %d/topo %d\n", __FILE__, __LINE__, result, info,
2876 (
int)type, (
int)topo );
2878 goto end_single_iter;
2886 printf(
"%s:%d: Error %d releasing %s iterator for type %d/topo %d\n", __FILE__, __LINE__, result, info,
2887 (
int)type, (
int)topo );
2905 int values_size, values_alloc = array_size;
2911 printf(
"%s:%d: Error %d initializing %s array iterator for type %d/topo %d\n", __FILE__, __LINE__, result,
2912 info, (
int)type, (
int)topo );
2917 for( twice = 0; twice < 2; ++twice )
2920 while( i < contents_size )
2926 printf(
"%s:%d: Error %d stepping %s array iterator for type %d/topo %d\n", __FILE__, __LINE__, result,
2927 info, (
int)type, (
int)topo );
2931 if( !has_data || !values_size )
2933 printf(
"%s:%d: %s array iterator for type %d/topo %d ended prematurely at %d of %d\n", __FILE__,
2934 __LINE__, info, (
int)type, (
int)topo, i, contents_size );
2939 if( i + values_size > contents_size )
2941 printf(
"%s:%d: %s array iterator for type %d/topo %d returned more than %d handles\n", __FILE__,
2942 __LINE__, info, (
int)type, (
int)topo, contents_size );
2947 if( contents_size - i >= array_size && values_size < array_size )
2949 printf(
"%s:%d: %s array iterator for type %d/topo %d returned fewer than %d handles\n", __FILE__,
2950 __LINE__, info, (
int)type, (
int)topo, array_size );
2955 for( j = 0; j < values_size; ++j, ++i )
2957 if( values[j] != contents[i] )
2959 printf(
"%s:%d: %s array iterator for type %d/topo %d returned incorrect value "
2961 __FILE__, __LINE__, info, (
int)type, (
int)topo, i, contents_size );
2971 printf(
"%s:%d: Error %d stepping %s array iterator for type %d/topo %d\n", __FILE__, __LINE__, result,
2972 info, (
int)type, (
int)topo );
2976 if( has_data || values_size )
2978 printf(
"%s:%d: %s array iterator for type %d/topo %d did not end after %d values\n", __FILE__, __LINE__,
2979 info, (
int)type, (
int)topo, contents_size );
2987 printf(
"%s:%d: Error %d resetting %s array iterator for type %d/topo %d\n", __FILE__, __LINE__, result,
2988 info, (
int)type, (
int)topo );
2999 printf(
"%s:%d: Error %d releasing %s array iterator for type %d/topo %d\n", __FILE__, __LINE__, result, info,
3000 (
int)type, (
int)topo );
3014 int content_size = 0, content_alloc = 0;
3019 if( array_size == 1 )
3032 int array_len = 0, array_size = 0;
3040 for( i = 1; i < array_size; i += 2 )
3041 array[i] = array[i - 1];
3042 for( i = 0; i < 2; ++i )
3044 setptr = i ? &list : &set;
3057 array_size = 2 * i + 2;
3075 array_size = 2 * i + 2;
3099 int number_tests_not_implemented = 0;
3110 printf(
"Usage: %s <mesh_filename>\n", argv[0] );
3111 if( argc != 1 )
return 1;
3120 printf(
"Failed to create a mesh instance.\n" );
3126 printf(
"Failed to return a root set.\n" );
3131 printf(
"\n\nTSTT TEST PROGRAM:\n\n" );
3134 printf(
" load_mesh: " );
3141 printf(
" topology_adjacency_test: " );
3148 printf(
" entity_connectivity_test: " );
3155 printf(
" vertex_coordinates_test: " );
3162 printf(
" topology_dimension_test: " );
3169 printf(
" entity_sets_test: " );
3176 printf(
" vertex_tag_test: " );
3183 printf(
" entityset_tag_test: " );
3190 printf(
" mesh_tag_test: " );
3197 printf(
" test_iterator: " );
3204 printf(
" set_remove_contained_regression: " );
3211 printf(
" all_adjacency_regression: " );
3218 printf(
" error_code_test: " );
3225 printf(
" ordered_set_regression: " );
3232 printf(
" array_allocation_regression: " );
3240 printf(
"\nTSTT TEST SUMMARY: \n" );
3244 printf(
" Number Not Implemented: %d\n", number_tests_not_implemented );
3252 printf(
"Failed to destruct the mesh instance.\n" );