18 for(
size_t i = 1; i != n && *str1 && toupper( *str1 ) == toupper( *str2 ); ++i, ++str1, ++str2 )
20 return toupper( *str2 ) - toupper( *str1 );
25 const char* opt_begin = begin;
26 const char* opt_end = begin;
31 while( opt_end != end )
33 opt_end = std::find( opt_begin, end,
' ' );
35 if( opt_end - opt_begin >= 5 &&
compare_no_case1( opt_begin,
"moab:", 5 ) == 0 )
37 if( !
first ) filtered.push_back(
';' );
39 filtered.append( opt_begin + 5, opt_end );
42 opt_begin = opt_end + 1;
50 #define COPY_RANGE( r, vec ) \
52 EntityHandle* tmp_ptr = reinterpret_cast< EntityHandle* >( vec ); \
53 std::copy( ( r ).begin(), ( r ).end(), tmp_ptr ); \
56 #define TAG_HANDLE( tagh ) reinterpret_cast< Tag >( tagh )
58 #define COPY_DOUBLEVEC( r, vec ) \
60 double* tmp_ptr = reinterpret_cast< double* >( vec ); \
61 std::copy( ( r ).begin(), ( r ).end(), tmp_ptr ); \
77 std::string tmp_options =
filter_options1( options, options + options_len );
90 if( *mbigeom )
delete *mbigeom;
106 char smth[] =
"SMOOTH;";
107 const char* res = strstr( options, smth );
108 if( res != NULL ) smooth =
true;
112 *mbigeom =
new MBiGeom( mbimesh, fbe );
125 if( gtt )
delete gtt;
129 if( *mbigeom )
delete *mbigeom;
137 const char smth[] =
"SMOOTH;";
139 const char* res = NULL;
141 char* reducedOptions = NULL;
142 bool localReduce =
false;
143 if( options ) res = strstr( options, smth );
147 reducedOptions =
new char[options_len - 6];
149 int preLen = (int)( res - options );
150 strncpy( reducedOptions, options, preLen );
151 int postLen = options_len - 7 - preLen;
153 char* tmp = reducedOptions + preLen;
155 strncpy( tmp, res + 7, postLen );
156 reducedOptions[options_len - 7] = 0;
157 std::cout << reducedOptions << std::endl;
162 reducedOptions =
const_cast< char*
>( options );
166 ErrorCode rval =
MBI->load_file( name, file_set, reducedOptions );
CHKERR( rval,
"can't load mesh file" );
167 if( localReduce )
delete[] reducedOptions;
218 int* entity_handles_allocated,
219 int* entity_handles_size,
223 if( 0 > entity_type || 4 < entity_type )
231 *entity_handles_size = gentities.
size();
246 if( 0 > entity_type || 4 < entity_type )
265 int entity_handles_size,
271 CHECK_SIZE( *type, *type_allocated, entity_handles_size,
int, NULL );
272 *type_size = entity_handles_size;
276 for(
int i = 0; i < entity_handles_size; i++ )
281 ERROR( tmp_err,
"Failed to get entity type in FBiGeom_getArrType." );
292 int* adj_entities_allocated,
293 int* adj_entities_size,
301 CHKERR( rval,
"Failed to get adjacent entities in FBiGeom_getEntAdj." );
304 *adj_entities_size = adjs.
size();
314 int entity_handles_size,
315 int requested_entity_type,
317 int* adj_entity_handles_allocated,
318 int* adj_entity_handles_size,
320 int* offset_allocated,
325 Range temp_range, total_range;
326 CHECK_SIZE( *offset, *offset_allocated, entity_handles_size + 1,
int, NULL );
327 *offset_size = entity_handles_size + 1;
330 for(
int i = 0; i < entity_handles_size; ++i )
332 ( *offset )[i] = total_range.
size();
335 FBE_cast( instance )->
getEntAdj(
MBH_cast( entity_handles[i] ), requested_entity_type, temp_range );
CHKERR( rval,
"Failed to get adjacent entities in FBiGeom_getArrAdj." );
336 total_range.
merge( temp_range );
338 int nTot = total_range.
size();
339 ( *offset )[entity_handles_size] = nTot;
343 COPY_RANGE( total_range, *adj_entity_handles );
344 *adj_entity_handles_size = nTot;
351 int bridge_dimension,
354 int* adjacent_entities_allocated,
355 int* adjacent_entities_size,
358 Range to_ents, bridge_ents, tmp_ents;
361 CHKERR( rval,
"Failed to get adjacent entities in FBiGeom_getEnt2ndAdj." );
365 for( iter = bridge_ents.
begin(); iter != end_iter; ++iter )
369 CHKERR( rval,
"Failed to get adjacent entities in FBiGeom_getEnt2ndAdj." );
371 for( jter = tmp_ents.
begin(); jter != end_jter; ++jter )
373 if( to_ents.
find( *jter ) == to_ents.
end() )
381 *adjacent_entities_size = to_ents.
size();
416 *are_adjacent = (int)adjacent_out;
423 int entity_handles_1_size,
425 int entity_handles_2_size,
426 int** is_adjacent_info,
427 int* is_adjacent_info_allocated,
428 int* is_adjacent_info_size,
433 size_t index1_step, index2_step;
438 if( entity_handles_1_size == entity_handles_2_size )
440 index1_step = index2_step = 1;
441 count = entity_handles_1_size;
443 else if( entity_handles_1_size == 1 )
447 count = entity_handles_2_size;
449 else if( entity_handles_2_size == 1 )
453 count = entity_handles_1_size;
460 CHECK_SIZE( *is_adjacent_info, *is_adjacent_info_allocated, count,
int, NULL );
462 for(
int i = 0; i < count; ++i )
464 FBiGeom_isEntAdj( instance, entity_handles_1[index1], entity_handles_2[index2], &( ( *is_adjacent_info )[i] ),
468 index1 += index1_step;
469 index2 += index2_step;
472 *is_adjacent_info_size = count;
496 int entity_handles_size,
498 double const* near_coordinates,
499 int near_coordinates_size,
500 double** on_coordinates,
501 int* on_coordinates_allocated,
502 int* on_coordinates_size,
505 CHECK_SIZE( *on_coordinates, *on_coordinates_allocated, near_coordinates_size,
double, NULL );
507 for(
int i = 0; i < entity_handles_size; i++ )
512 near_coordinates[3 * i + 2], on_coordinates[3 * i], on_coordinates[3 * i + 1],
513 on_coordinates[3 * i + 2], err );
518 near_coordinates[i + entity_handles_size],
519 near_coordinates[i + 2 * entity_handles_size], on_coordinates[i],
520 on_coordinates[i + entity_handles_size],
521 on_coordinates[i + 2 * entity_handles_size], err );
525 *on_coordinates_size = near_coordinates_size;
547 int entity_handles_size,
549 double const* coordinates,
550 int coordinates_size,
552 int* normals_allocated,
561 size_t coord_step, norm_step = 1, ent_step;
563 if( 3 * entity_handles_size == coordinates_size )
565 coord_step = ent_step = 1;
566 count = entity_handles_size;
568 else if( coordinates_size == 3 )
572 count = entity_handles_size;
574 else if( entity_handles_size == 1 )
578 count = coordinates_size / 3;
586 CHECK_SIZE( *normals, *normals_allocated, 3 * count,
double, NULL );
588 const double *coord_x, *coord_y, *coord_z;
589 double *norm_x, *norm_y, *norm_z;
592 coord_x = coordinates;
593 coord_y = coord_x + coordinates_size / 3;
594 coord_z = coord_y + coordinates_size / 3;
596 norm_y = norm_x + count;
597 norm_z = norm_y + count;
603 coord_x = coordinates;
604 coord_y = coord_x + 1;
605 coord_z = coord_x + 2;
613 for(
int i = 0; i < count; ++i )
615 FBiGeom_getEntNrmlXYZ( instance, entity_handles[index], *coord_x, *coord_y, *coord_z, norm_x, norm_y, norm_z,
620 coord_x += coord_step;
621 coord_y += coord_step;
622 coord_z += coord_step;
627 *normals_size = count;
649 if( type != 2 && type != 3 )
666 int entity_handles_size,
668 double const* near_coordinates,
669 int near_coordinates_size,
670 double** on_coordinates,
671 int* on_coordinates_allocated,
672 int* on_coordinates_size,
674 int* normals_allocated,
683 size_t near_step, on_step = 1, ent_step;
685 if( 3 * entity_handles_size == near_coordinates_size )
687 near_step = ent_step = 1;
688 count = entity_handles_size;
690 else if( near_coordinates_size == 3 )
694 count = entity_handles_size;
696 else if( entity_handles_size == 1 )
700 count = near_coordinates_size / 3;
708 CHECK_SIZE( *on_coordinates, *on_coordinates_allocated, 3 * count,
double, NULL );
709 CHECK_SIZE( *normals, *normals_allocated, 3 * count,
double, NULL );
711 const double *near_x, *near_y, *near_z;
712 double *on_x, *on_y, *on_z;
713 double *norm_x, *norm_y, *norm_z;
716 near_x = near_coordinates;
717 near_y = near_x + near_coordinates_size / 3;
718 near_z = near_y + near_coordinates_size / 3;
719 on_x = *on_coordinates;
723 norm_y = norm_x + count;
724 norm_z = norm_y + count;
730 near_x = near_coordinates;
733 on_x = *on_coordinates;
743 for(
int i = 0; i < count; ++i )
746 norm_y, norm_z, err );
761 *on_coordinates_size = count * 3;
762 *normals_size = count;
822 else if( type == 2 || type == 3 )
829 rval = gtt->
get_root(
MBH_cast( entity_handle ), root );
CHKERR( rval,
"Failed to get tree root in FBiGeom_getEntBoundBox." );
833 for(
int i = 0; i < 3; i++ )
835 absv[i] =
CartVect( fabs( axis[i][0] ), fabs( axis[i][1] ), fabs( axis[i][2] ) );
838 min =
center - absv[0] - absv[1] - absv[2];
839 max =
center + absv[0] + absv[1] + absv[2];
855 int entity_handles_size,
858 int* min_corner_allocated,
859 int* min_corner_size,
861 int* max_corner_allocated,
862 int* max_corner_size,
866 CHECK_SIZE( *min_corner, *min_corner_allocated, 3 * entity_handles_size,
double, NULL );
867 CHECK_SIZE( *max_corner, *max_corner_allocated, 3 * entity_handles_size,
double, NULL );
873 init = entity_handles_size;
880 double *min_x, *min_y, *min_z, *max_x, *max_y, *max_z;
883 min_y = min_x +
init;
884 max_y = max_x +
init;
885 min_z = min_y +
init;
886 max_z = max_y +
init;
888 for(
int i = 0; i < entity_handles_size; ++i )
900 *min_corner_size = 3 * entity_handles_size;
901 *max_corner_size = 3 * entity_handles_size;
918 int entity_handles_size,
920 double** coordinates,
921 int* coordinates_allocated,
922 int* coordinates_size,
926 CHECK_SIZE( *coordinates, *coordinates_allocated, 3 * entity_handles_size,
double, NULL );
933 y = x + entity_handles_size;
934 z = y + entity_handles_size;
945 for(
int i = 0; i < entity_handles_size; i++ )
952 *coordinates_size = 3 * entity_handles_size;
964 int* intersect_entity_handles_allocated,
965 int* intersect_entity_handles_size,
967 double** intersect_coords,
968 int* intersect_coords_allocated,
969 int* intersect_coords_size,
970 double** param_coords,
971 int* param_coords_allocated,
972 int* param_coords_size,
979 std::vector< EntityHandle > intersect_handles;
980 std::vector< double > coords;
981 std::vector< double > params;
983 FBE_cast( instance )->
getPntRayIntsct( x, y, z, dir_x, dir_y, dir_z, intersect_handles, coords, params );
CHKERR( rval,
"can't get ray intersections " );
984 *intersect_entity_handles_size = (int)intersect_handles.size();
986 CHECK_SIZE( *intersect_entity_handles, *intersect_entity_handles_allocated, *intersect_entity_handles_size,
988 *intersect_coords_size = 3 * (int)intersect_handles.size();
989 CHECK_SIZE( *intersect_coords, *intersect_coords_allocated, *intersect_coords_size,
double, NULL );
990 *param_coords_size = (int)intersect_handles.size();
991 CHECK_SIZE( *param_coords, *param_coords_allocated, *param_coords_size,
double, NULL );
993 COPY_RANGE( intersect_handles, *intersect_entity_handles );
998 int sz = (int)intersect_handles.size();
999 for(
int i = 0; i < sz; i++ )
1001 *intersect_coords[i] = coords[3 * i];
1002 *intersect_coords[sz + i] = coords[3 * i + 1];
1003 *intersect_coords[2 * sz + i] = coords[3 * i + 2];
1083 CHKERR( rval,
"Failed to get edge senses in FBiGeom_getEgFcSense." );
1128 int entity_handles_size,
1130 int* measures_allocated,
1135 CHECK_SIZE( *measures, *measures_allocated, entity_handles_size,
double, NULL );
1137 *measures_size = entity_handles_size;
1145 int* face_type_length )
1147 std::string type =
"nonplanar";
1150 face_type =
new char[type.length() + 1];
1151 strcpy( face_type, type.c_str() );
1152 *face_type_length = type.length() + 1;
1815 const void*
const four_val[] = { &four };
1817 rval =
MBI->get_entities_by_type_and_tag( moabSet,
MBENTITYSET, &
geomTag, four_val, 1, tmp );
CHKERR( rval,
"can't get sets of geo dim 4 " );
1819 *num_sets = tmp.
size();
1828 int* contained_set_handles_allocated,
1829 int* contained_set_handles_size,
1843 const void*
const four_val[] = { &four };
1845 rval =
MBI->get_entities_by_type_and_tag( moabSet,
MBENTITYSET, &
geomTag, four_val, 1, tmp );
CHKERR( rval,
"can't get sets of geo dim 4 " );
1847 *contained_set_handles_size = tmp.
size();
1848 CHECK_SIZE( *contained_set_handles, *contained_set_handles_allocated, *contained_set_handles_size,
1873 int entity_handles_size,
1882 int entity_handles_size,
1917 int num_entity_handles,
1919 int* is_contained_allocated,
1920 int* is_contained_size,
1924 is_contained, is_contained_allocated, is_contained_size, err );
1984 int* entity_set_handles_allocated,
1985 int* entity_set_handles_size,
1989 entity_set_handles_allocated, entity_set_handles_size, err );
1996 int* entity_set_handles_allocated,
1997 int* entity_set_handles_size,
2001 entity_set_handles_allocated, entity_set_handles_size, err );
2005 const char* tag_name,
2038 const char* tag_name,
2054 const void* tag_value,
2101 int* tag_value_allocated,
2102 int* tag_value_size,
2106 tag_value_size, err );
2148 int* tag_handles_allocated,
2149 int* tag_handles_size,
2153 tag_handles_size, err );
2166 int entity_handles_size,
2169 int* tag_values_allocated,
2170 int* tag_values_size,
2174 tag_values_allocated, tag_values_size, err );
2179 int entity_handles_size,
2182 int* tag_values_allocated,
2183 int* tag_values_size,
2187 tag_values_allocated, tag_values_size, err );
2192 int entity_handles_size,
2194 double** tag_values,
2195 int* tag_values_allocated,
2196 int* tag_values_size,
2200 tag_values_allocated, tag_values_size, err );
2205 int entity_handles_size,
2208 int* tag_value_allocated,
2209 int* tag_value_size,
2213 tag_value_allocated, tag_value_size, err );
2218 int entity_handles_size,
2221 int* tag_value_allocated,
2222 int* tag_value_size,
2226 tag_value_allocated, tag_value_size, err );
2231 int entity_handles_size,
2233 const void* tag_values,
2234 int tag_values_size,
2238 tag_values_size, err );
2243 int entity_handles_size,
2245 const int* tag_values,
2246 int tag_values_size,
2250 tag_values_size, err );
2255 int entity_handles_size,
2257 const double* tag_values,
2258 const int tag_values_size,
2262 tag_values_size, err );
2267 int entity_handles_size,
2270 int tag_values_size,
2274 tag_values_size, err );
2279 int entity_handles_size,
2282 int tag_values_size,
2286 tag_values_size, err );
2291 int entity_handles_size,
2302 int* tag_value_allocated,
2303 int* tag_value_size,
2307 tag_value_size, err );
2349 const void* tag_value,
2395 int* tag_handles_allocated,
2396 int* tag_handles_size,
2513 *tngt_k, *cvtr_i, *cvtr_j, *cvtr_k );
CHKERR( rval,
"can't get point on edge " );
2548 *cvtr1_i = *cvtr1_j = *cvtr1_k = *cvtr2_i = *cvtr2_j = *cvtr2_k = 0.;
2555 CHKERR( rval,
"can't get normal on closest point on surface " );