MOAB: Mesh Oriented datABase  (version 5.3.0)
FBiGeom_MOAB.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <map>
00003 #include "FBiGeom_MOAB.hpp"
00004 #include "moab/GeomTopoTool.hpp"
00005 #include "moab/OrientedBoxTreeTool.hpp"
00006 #include "moab/CartVect.hpp"
00007 #include "moab/FileOptions.hpp"
00008 #include "MBTagConventions.hpp"
00009 #include <cstdlib>
00010 #include <cstring>
00011 #include <map>
00012 #include <cassert>
00013 
00014 using namespace moab;
00015 
00016 static int compare_no_case1( const char* str1, const char* str2, size_t n )
00017 {
00018     for( size_t i = 1; i != n && *str1 && toupper( *str1 ) == toupper( *str2 ); ++i, ++str1, ++str2 )
00019         ;
00020     return toupper( *str2 ) - toupper( *str1 );
00021 }
00022 // Filter out non-MOAB options and remove the "moab:" prefix
00023 static std::string filter_options1( const char* begin, const char* end )
00024 {
00025     const char* opt_begin = begin;
00026     const char* opt_end   = begin;
00027 
00028     std::string filtered;
00029     bool first = true;
00030 
00031     while( opt_end != end )
00032     {
00033         opt_end = std::find( opt_begin, end, ' ' );
00034 
00035         if( opt_end - opt_begin >= 5 && compare_no_case1( opt_begin, "moab:", 5 ) == 0 )
00036         {
00037             if( !first ) filtered.push_back( ';' );
00038             first = false;
00039             filtered.append( opt_begin + 5, opt_end );
00040         }
00041 
00042         opt_begin = opt_end + 1;
00043     }
00044     return filtered;
00045 }
00046 
00047 bool debug_igeom     = false;
00048 bool Debug_surf_eval = false;
00049 
00050 #define COPY_RANGE( r, vec )                                              \
00051     {                                                                     \
00052         EntityHandle* tmp_ptr = reinterpret_cast< EntityHandle* >( vec ); \
00053         std::copy( ( r ).begin(), ( r ).end(), tmp_ptr );                 \
00054     }
00055 
00056 #define TAG_HANDLE( tagh ) reinterpret_cast< Tag >( tagh )
00057 
00058 #define COPY_DOUBLEVEC( r, vec )                              \
00059     {                                                         \
00060         double* tmp_ptr = reinterpret_cast< double* >( vec ); \
00061         std::copy( ( r ).begin(), ( r ).end(), tmp_ptr );     \
00062     }
00063 
00064 void FBiGeom_getDescription( FBiGeom_Instance instance, char* descr, int descr_len )
00065 {
00066     iMesh_getDescription( IMESH_INSTANCE( instance ), descr, descr_len );
00067 }
00068 
00069 void FBiGeom_getErrorType( FBiGeom_Instance instance, /*out*/ int* error_type )
00070 {
00071     iMesh_getErrorType( IMESH_INSTANCE( instance ), /*out*/ error_type );
00072 }
00073 
00074 void FBiGeom_newGeom( char const* options, FBiGeom_Instance* instance_out, int* err, int options_len )
00075 {
00076 
00077     std::string tmp_options = filter_options1( options, options + options_len );
00078     FileOptions opts( tmp_options.c_str() );
00079     // process some options?
00080 
00081     MBiGeom** mbigeom = reinterpret_cast< MBiGeom** >( instance_out );
00082     *mbigeom          = NULL;
00083     *mbigeom          = new MBiGeom();
00084     *err              = iBase_SUCCESS;
00085 }
00086 
00087 void FBiGeom_dtor( FBiGeom_Instance instance, int* err )
00088 {
00089     MBiGeom** mbigeom = reinterpret_cast< MBiGeom** >( &instance );
00090     if( *mbigeom ) delete *mbigeom;
00091     *err = iBase_SUCCESS;
00092 }
00093 
00094 void FBiGeom_newGeomFromMesh( iMesh_Instance mesh, iBase_EntitySetHandle set, const char* options,
00095                               FBiGeom_Instance* geom, int* err, int )
00096 {
00097     MBiMesh* mbimesh           = reinterpret_cast< MBiMesh* >( mesh );
00098     moab::Interface* mbi       = mbimesh->mbImpl;
00099     moab::EntityHandle rootSet = reinterpret_cast< moab::EntityHandle >( set );
00100     moab::GeomTopoTool* gtt    = new moab::GeomTopoTool( mbi, true, rootSet );
00101     bool smooth                = false;  // decide from options
00102     char smth[]                = "SMOOTH;";
00103     const char* res            = strstr( options, smth );
00104     if( res != NULL ) smooth = true;
00105     moab::FBEngine* fbe = new moab::FBEngine( mbi, gtt, smooth );
00106     MBiGeom** mbigeom   = reinterpret_cast< MBiGeom** >( geom );
00107     *mbigeom            = NULL;
00108     *mbigeom            = new MBiGeom( mbimesh, fbe );
00109     // will do now the initialization of the engine;
00110     // heavy duty computation
00111     fbe->Init();
00112     *err = iBase_SUCCESS;
00113 }
00114 // corresponding to constructor 2, from iMesh instance
00115 void FBiGeom_dtor2( FBiGeom_Instance instance, int* err )
00116 {
00117     moab::FBEngine* fbe = FBE_cast( instance );
00118     if( fbe )
00119     {
00120         moab::GeomTopoTool* gtt = fbe->get_gtt();
00121         if( gtt ) delete gtt;
00122         delete fbe;
00123     }
00124     MBiGeom** mbigeom = reinterpret_cast< MBiGeom** >( &instance );
00125     if( *mbigeom ) delete *mbigeom;
00126     *err = iBase_SUCCESS;
00127 }
00128 
00129 void FBiGeom_load( FBiGeom_Instance instance, char const* name, char const* options, int* err, int, int options_len )
00130 {
00131     // first remove option for smooth facetting
00132 
00133     const char smth[] = "SMOOTH;";
00134     bool smooth       = false;
00135     const char* res   = NULL;
00136 
00137     char* reducedOptions = NULL;
00138     bool localReduce     = false;
00139     if( options ) res = strstr( options, smth );
00140     if( res )
00141     {
00142         // extract that option, will not be recognized by our moab/imesh
00143         reducedOptions = new char[options_len - 6];
00144         localReduce    = true;
00145         int preLen     = (int)( res - options );
00146         strncpy( reducedOptions, options, preLen );
00147         int postLen = options_len - 7 - preLen;
00148 
00149         char* tmp = reducedOptions + preLen;
00150 
00151         strncpy( tmp, res + 7, postLen );
00152         reducedOptions[options_len - 7] = 0;
00153         std::cout << reducedOptions << std::endl;
00154         smooth = true;
00155     }
00156     else
00157     {
00158         reducedOptions = const_cast< char* >( options );
00159     }
00160     // load mesh-based geometry
00161     const EntityHandle* file_set = 0;
00162     ErrorCode rval               = MBI->load_file( name, file_set, reducedOptions );CHKERR( rval, "can't load mesh file" );
00163     if( localReduce ) delete[] reducedOptions;
00164 
00165     FBEngine* fbe = FBE_cast( instance );
00166     if( fbe == NULL )
00167     {
00168         *err = iBase_FAILURE;
00169         return;
00170     }
00171     GeomTopoTool* gtt = GETGTT( instance );
00172     if( gtt == NULL )
00173     {
00174         *err = iBase_FAILURE;
00175         return;
00176     }
00177     // keep mesh-based geometries in Range
00178     rval = gtt->find_geomsets();CHKERR( rval, "Failure to find geometry lists." );
00179 
00180     if( smooth ) fbe->set_smooth();  // assumes that initialization did not happen yet
00181 
00182     fbe->Init();  // major computation
00183 
00184     RETURN( iBase_SUCCESS );
00185 }
00186 
00187 void FBiGeom_save( FBiGeom_Instance instance, char const* name, char const* options, int* err, int name_len,
00188                    int options_len )
00189 {
00190     iMesh_save( IMESH_INSTANCE( instance ), NULL, name, options, err, name_len, options_len );
00191 }
00192 
00193 void FBiGeom_getRootSet( FBiGeom_Instance instance, iBase_EntitySetHandle* root_set, int* err )
00194 {
00195     EntityHandle modelSet;
00196     ErrorCode rval = FBE_cast( instance )->getRootSet( &modelSet );CHKERR( rval, "can't get root set " );
00197     *root_set = (iBase_EntitySetHandle)modelSet;
00198     RETURN( iBase_SUCCESS );
00199 }
00200 
00201 void FBiGeom_getBoundBox( FBiGeom_Instance instance, double*, double*, double*, double*, double*, double*, int* err )
00202 {
00203     RETURN( iBase_NOT_SUPPORTED );
00204 }
00205 
00206 void FBiGeom_getEntities( FBiGeom_Instance instance, iBase_EntitySetHandle set_handle, int entity_type,
00207                           iBase_EntityHandle** entity_handles, int* entity_handles_allocated, int* entity_handles_size,
00208                           int* err )
00209 {
00210 
00211     if( 0 > entity_type || 4 < entity_type ) { ERROR( iBase_INVALID_ENTITY_TYPE, "Bad entity type." ); }
00212     else /* 0<= entity_type <= 4) */
00213     {
00214         Range gentities;
00215         ErrorCode rval = FBE_cast( instance )->getEntities( (EntityHandle)set_handle, entity_type, gentities );CHKERR( rval, "can't get entities " );
00216         *entity_handles_size = gentities.size();
00217 
00218         CHECK_SIZE( *entity_handles, *entity_handles_allocated, *entity_handles_size, iBase_EntityHandle, NULL );
00219         COPY_RANGE( gentities, *entity_handles );
00220     }
00221 
00222     RETURN( iBase_SUCCESS );
00223 }
00224 
00225 void FBiGeom_getNumOfType( FBiGeom_Instance instance, iBase_EntitySetHandle set_handle, int entity_type, int* num_out,
00226                            int* err )
00227 {
00228     if( 0 > entity_type || 4 < entity_type ) { ERROR( iBase_INVALID_ENTITY_TYPE, "Bad entity type." ); }
00229     ErrorCode rval = FBE_cast( instance )->getNumOfType( (EntityHandle)set_handle, entity_type, num_out );CHKERR( rval, "can't get number of type " );
00230 
00231     RETURN( iBase_SUCCESS );
00232 }
00233 
00234 void FBiGeom_getEntType( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, int* type, int* err )
00235 {
00236 
00237     ErrorCode rval = FBE_cast( instance )->getEntType( (EntityHandle)entity_handle, type );CHKERR( rval, "can't get entity type " );
00238 
00239     RETURN( iBase_SUCCESS );
00240 }
00241 
00242 void FBiGeom_getArrType( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles, int entity_handles_size,
00243                          int** type, int* type_allocated, int* type_size, int* err )
00244 {
00245     CHECK_SIZE( *type, *type_allocated, entity_handles_size, int, NULL );
00246     *type_size = entity_handles_size;
00247 
00248     int tmp_err;
00249 
00250     for( int i = 0; i < entity_handles_size; i++ )
00251     {
00252         FBiGeom_getEntType( instance, entity_handles[i], *type + i, &tmp_err );
00253         if( iBase_SUCCESS != tmp_err ) { ERROR( tmp_err, "Failed to get entity type in FBiGeom_getArrType." ); }
00254     }
00255 
00256     RETURN( iBase_SUCCESS );
00257 }
00258 
00259 void FBiGeom_getEntAdj( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, int to_dimension,
00260                         iBase_EntityHandle** adj_entities, int* adj_entities_allocated, int* adj_entities_size,
00261                         int* err )
00262 {
00263     Range adjs;
00264     EntityHandle this_ent = MBH_cast( entity_handle );
00265 
00266     ErrorCode rval = FBE_cast( instance )->getEntAdj( this_ent, to_dimension, adjs );
00267 
00268     CHKERR( rval, "Failed to get adjacent entities in FBiGeom_getEntAdj." );
00269 
00270     // copy adjacent entities
00271     *adj_entities_size = adjs.size();
00272     CHECK_SIZE( *adj_entities, *adj_entities_allocated, *adj_entities_size, iBase_EntityHandle, NULL );
00273     COPY_RANGE( adjs, *adj_entities );
00274 
00275     RETURN( iBase_SUCCESS );
00276 }
00277 
00278 // I suspect this is wrong
00279 void FBiGeom_getArrAdj( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles, int entity_handles_size,
00280                         int requested_entity_type, iBase_EntityHandle** adj_entity_handles,
00281                         int* adj_entity_handles_allocated, int* adj_entity_handles_size, int** offset,
00282                         int* offset_allocated, int* offset_size, int* err )
00283 {
00284     // check offset array size
00285     Range temp_range, total_range;
00286     CHECK_SIZE( *offset, *offset_allocated, entity_handles_size + 1, int, NULL );
00287     *offset_size = entity_handles_size + 1;
00288 
00289     // get adjacent entities
00290     for( int i = 0; i < entity_handles_size; ++i )
00291     {
00292         ( *offset )[i] = total_range.size();
00293         temp_range.clear();
00294         ErrorCode rval =
00295             FBE_cast( instance )->getEntAdj( MBH_cast( entity_handles[i] ), requested_entity_type, temp_range );CHKERR( rval, "Failed to get adjacent entities in FBiGeom_getArrAdj." );
00296         total_range.merge( temp_range );
00297     }
00298     int nTot                         = total_range.size();
00299     ( *offset )[entity_handles_size] = nTot;
00300 
00301     // copy adjacent entities
00302     CHECK_SIZE( *adj_entity_handles, *adj_entity_handles_allocated, nTot, iBase_EntityHandle, NULL );
00303     COPY_RANGE( total_range, *adj_entity_handles );
00304     *adj_entity_handles_size = nTot;
00305 
00306     RETURN( iBase_SUCCESS );
00307 }
00308 
00309 void FBiGeom_getEnt2ndAdj( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, int bridge_dimension,
00310                            int to_dimension, iBase_EntityHandle** adjacent_entities, int* adjacent_entities_allocated,
00311                            int* adjacent_entities_size, int* err )
00312 {
00313     Range to_ents, bridge_ents, tmp_ents;
00314     ErrorCode rval = FBE_cast( instance )->getEntAdj( MBH_cast( entity_handle ), bridge_dimension, bridge_ents );
00315 
00316     CHKERR( rval, "Failed to get adjacent entities in FBiGeom_getEnt2ndAdj." );
00317 
00318     Range::iterator iter, jter, kter, end_jter;
00319     Range::iterator end_iter = bridge_ents.end();
00320     for( iter = bridge_ents.begin(); iter != end_iter; ++iter )
00321     {
00322         rval = FBE_cast( instance )->getEntAdj( *iter, to_dimension, tmp_ents );
00323 
00324         CHKERR( rval, "Failed to get adjacent entities in FBiGeom_getEnt2ndAdj." );
00325 
00326         for( jter = tmp_ents.begin(); jter != end_jter; ++jter )
00327         {
00328             if( to_ents.find( *jter ) == to_ents.end() ) { to_ents.insert( *jter ); }
00329         }
00330         tmp_ents.clear();
00331     }
00332 
00333     *adjacent_entities_size = to_ents.size();
00334     CHECK_SIZE( *adjacent_entities, *adjacent_entities_allocated, *adjacent_entities_size, iBase_EntityHandle, NULL );
00335     COPY_RANGE( to_ents, *adjacent_entities );
00336 
00337     RETURN( iBase_SUCCESS );
00338 }
00339 
00340 void FBiGeom_getArr2ndAdj( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, int, iBase_EntityHandle**,
00341                            int*, int*, int**, int*, int*, int* err )
00342 {
00343     // not implemented
00344     // who would need this monster, anyway?
00345     RETURN( iBase_NOT_SUPPORTED );
00346 }
00347 
00348 void FBiGeom_isEntAdj( FBiGeom_Instance instance, iBase_EntityHandle entity_handle1, iBase_EntityHandle entity_handle2,
00349                        int* are_adjacent, int* err )
00350 {
00351 
00352     bool adjacent_out;
00353     ErrorCode rval =
00354         FBE_cast( instance )->isEntAdj( MBH_cast( entity_handle1 ), MBH_cast( entity_handle2 ), adjacent_out );CHKERR( rval, "Failed to get adjacent info" );
00355     *are_adjacent = (int)adjacent_out;  // 0 or 1, really
00356 
00357     RETURN( iBase_SUCCESS );
00358 }
00359 
00360 void FBiGeom_isArrAdj( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles_1, int entity_handles_1_size,
00361                        iBase_EntityHandle const* entity_handles_2, int entity_handles_2_size, int** is_adjacent_info,
00362                        int* is_adjacent_info_allocated, int* is_adjacent_info_size, int* err )
00363 {
00364     int index1 = 0;
00365     int index2 = 0;
00366     size_t index1_step, index2_step;
00367     int count;
00368 
00369     // If either list contains only 1 entry, compare that entry with
00370     // every entry in the other list.
00371     if( entity_handles_1_size == entity_handles_2_size )
00372     {
00373         index1_step = index2_step = 1;
00374         count                     = entity_handles_1_size;
00375     }
00376     else if( entity_handles_1_size == 1 )
00377     {
00378         index1_step = 0;
00379         index2_step = 1;
00380         count       = entity_handles_2_size;
00381     }
00382     else if( entity_handles_2_size == 1 )
00383     {
00384         index1_step = 1;
00385         index2_step = 0;
00386         count       = entity_handles_1_size;
00387     }
00388     else
00389     {
00390         RETURN( iBase_INVALID_ENTITY_COUNT );
00391     }
00392 
00393     CHECK_SIZE( *is_adjacent_info, *is_adjacent_info_allocated, count, int, NULL );
00394 
00395     for( int i = 0; i < count; ++i )
00396     {
00397         FBiGeom_isEntAdj( instance, entity_handles_1[index1], entity_handles_2[index2], &( ( *is_adjacent_info )[i] ),
00398                           err );
00399         FWDERR();
00400 
00401         index1 += index1_step;
00402         index2 += index2_step;
00403     }
00404     // it is now safe to set the size
00405     *is_adjacent_info_size = count;
00406 
00407     RETURN( iBase_SUCCESS );
00408 }
00409 
00410 void FBiGeom_getEntClosestPt( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double near_x, double near_y,
00411                               double near_z, double* on_x, double* on_y, double* on_z, int* err )
00412 {
00413 
00414     ErrorCode rval =
00415         FBE_cast( instance )->getEntClosestPt( MBH_cast( entity_handle ), near_x, near_y, near_z, on_x, on_y, on_z );CHKERR( rval, "Failed to get closest point" );
00416 
00417     RETURN( iBase_SUCCESS );
00418 }
00419 
00420 void FBiGeom_getArrClosestPt( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles,
00421                               int entity_handles_size, int storage_order, double const* near_coordinates,
00422                               int near_coordinates_size, double** on_coordinates, int* on_coordinates_allocated,
00423                               int* on_coordinates_size, int* err )
00424 {
00425     CHECK_SIZE( *on_coordinates, *on_coordinates_allocated, near_coordinates_size, double, NULL );
00426 
00427     for( int i = 0; i < entity_handles_size; i++ )
00428     {
00429         if( storage_order == iBase_INTERLEAVED )
00430         {
00431             FBiGeom_getEntClosestPt( instance, entity_handles[i], near_coordinates[3 * i], near_coordinates[3 * i + 1],
00432                                      near_coordinates[3 * i + 2], on_coordinates[3 * i], on_coordinates[3 * i + 1],
00433                                      on_coordinates[3 * i + 2], err );
00434         }
00435         else if( storage_order == iBase_BLOCKED )
00436         {
00437             FBiGeom_getEntClosestPt( instance, entity_handles[i], near_coordinates[i],
00438                                      near_coordinates[i + entity_handles_size],
00439                                      near_coordinates[i + 2 * entity_handles_size], on_coordinates[i],
00440                                      on_coordinates[i + entity_handles_size],
00441                                      on_coordinates[i + 2 * entity_handles_size], err );
00442         }
00443         FWDERR();
00444     }
00445     *on_coordinates_size = near_coordinates_size;
00446 
00447     RETURN( iBase_SUCCESS );
00448 }
00449 
00450 void FBiGeom_getEntNrmlXYZ( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double x, double y, double z,
00451                             double* nrml_i, double* nrml_j, double* nrml_k, int* err )
00452 {
00453 
00454     ErrorCode rval = FBE_cast( instance )->getEntNrmlXYZ( MBH_cast( entity_handle ), x, y, z, nrml_i, nrml_j, nrml_k );CHKERR( rval, "Failed to get normal" );
00455     RETURN( iBase_SUCCESS );
00456 }
00457 
00458 void FBiGeom_getArrNrmlXYZ( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles,
00459                             int entity_handles_size, int storage_order, double const* coordinates, int coordinates_size,
00460                             double** normals, int* normals_allocated, int* normals_size, int* err )
00461 {
00462     // set up iteration according to storage order.
00463     // allow either gentity_handles or near_coordinates to contain
00464     // only one value, where that single value is applied for every
00465     // entry in the other list.
00466     size_t index = 0;
00467     size_t coord_step, norm_step = 1, ent_step;
00468     int count;
00469     if( 3 * entity_handles_size == coordinates_size )
00470     {
00471         coord_step = ent_step = 1;
00472         count                 = entity_handles_size;
00473     }
00474     else if( coordinates_size == 3 )
00475     {
00476         coord_step = 0;
00477         ent_step   = 1;
00478         count      = entity_handles_size;
00479     }
00480     else if( entity_handles_size == 1 )
00481     {
00482         coord_step = 1;
00483         ent_step   = 0;
00484         count      = coordinates_size / 3;
00485     }
00486     else
00487     {
00488         ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
00489     }
00490 
00491     // check or pre-allocate the coordinate arrays
00492     CHECK_SIZE( *normals, *normals_allocated, 3 * count, double, NULL );
00493 
00494     const double *coord_x, *coord_y, *coord_z;
00495     double *norm_x, *norm_y, *norm_z;
00496     if( storage_order == iBase_BLOCKED )
00497     {
00498         coord_x   = coordinates;
00499         coord_y   = coord_x + coordinates_size / 3;
00500         coord_z   = coord_y + coordinates_size / 3;
00501         norm_x    = *normals;
00502         norm_y    = norm_x + count;
00503         norm_z    = norm_y + count;
00504         norm_step = 1;
00505     }
00506     else
00507     {
00508         storage_order = iBase_INTERLEAVED; /* set if unspecified */
00509         coord_x       = coordinates;
00510         coord_y       = coord_x + 1;
00511         coord_z       = coord_x + 2;
00512         norm_x        = *normals;
00513         norm_y        = norm_x + 1;
00514         norm_z        = norm_x + 2;
00515         coord_step *= 3;
00516         norm_step = 3;
00517     }
00518 
00519     for( int i = 0; i < count; ++i )
00520     {
00521         FBiGeom_getEntNrmlXYZ( instance, entity_handles[index], *coord_x, *coord_y, *coord_z, norm_x, norm_y, norm_z,
00522                                err );
00523         FWDERR();
00524 
00525         index += ent_step;
00526         coord_x += coord_step;
00527         coord_y += coord_step;
00528         coord_z += coord_step;
00529         norm_x += norm_step;
00530         norm_y += norm_step;
00531         norm_z += norm_step;
00532     }
00533     *normals_size = count;
00534     RETURN( iBase_SUCCESS );
00535 }
00536 
00537 void FBiGeom_getEntNrmlPlXYZ( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double x, double y, double z,
00538                               double* pt_x, double* pt_y, double* pt_z, double* nrml_i, double* nrml_j, double* nrml_k,
00539                               int* err )
00540 {
00541     // just do for surface and volume
00542     int type;
00543     FBiGeom_getEntType( instance, entity_handle, &type, err );
00544     FWDERR();
00545 
00546     if( type != 2 && type != 3 )
00547     {
00548         ERROR( iBase_INVALID_ENTITY_TYPE, "Entities passed into gentityNormal must be face or volume." );
00549     }
00550 
00551     // do 2 searches, so it is not fast enough
00552     FBiGeom_getEntClosestPt( instance, entity_handle, x, y, z, pt_x, pt_y, pt_z, err );
00553 
00554     FWDERR();
00555     FBiGeom_getEntNrmlXYZ( instance, entity_handle, *pt_x, *pt_y, *pt_z, nrml_i, nrml_j, nrml_k, err );
00556     FWDERR();
00557 
00558     RETURN( iBase_SUCCESS );
00559 }
00560 
00561 void FBiGeom_getArrNrmlPlXYZ( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles,
00562                               int entity_handles_size, int storage_order, double const* near_coordinates,
00563                               int near_coordinates_size, double** on_coordinates, int* on_coordinates_allocated,
00564                               int* on_coordinates_size, double** normals, int* normals_allocated, int* normals_size,
00565                               int* err )
00566 {
00567     // set up iteration according to storage order.
00568     // allow either gentity_handles or near_coordinates to contain
00569     // only one value, where that single value is applied for every
00570     // entry in the other list.
00571     size_t index = 0;
00572     size_t near_step, on_step = 1, ent_step;
00573     int count;
00574     if( 3 * entity_handles_size == near_coordinates_size )
00575     {
00576         near_step = ent_step = 1;
00577         count                = entity_handles_size;
00578     }
00579     else if( near_coordinates_size == 3 )
00580     {
00581         near_step = 0;
00582         ent_step  = 1;
00583         count     = entity_handles_size;
00584     }
00585     else if( entity_handles_size == 1 )
00586     {
00587         near_step = 1;
00588         ent_step  = 0;
00589         count     = near_coordinates_size / 3;
00590     }
00591     else
00592     {
00593         ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
00594     }
00595 
00596     // check or pre-allocate the coordinate arrays
00597     CHECK_SIZE( *on_coordinates, *on_coordinates_allocated, 3 * count, double, NULL );
00598     CHECK_SIZE( *normals, *normals_allocated, 3 * count, double, NULL );
00599 
00600     const double *near_x, *near_y, *near_z;
00601     double *on_x, *on_y, *on_z;
00602     double *norm_x, *norm_y, *norm_z;
00603     if( storage_order == iBase_BLOCKED )
00604     {
00605         near_x  = near_coordinates;
00606         near_y  = near_x + near_coordinates_size / 3;
00607         near_z  = near_y + near_coordinates_size / 3;
00608         on_x    = *on_coordinates;
00609         on_y    = on_x + count;
00610         on_z    = on_y + count;
00611         norm_x  = *normals;
00612         norm_y  = norm_x + count;
00613         norm_z  = norm_y + count;
00614         on_step = 1;
00615     }
00616     else
00617     {
00618         storage_order = iBase_INTERLEAVED; /* set if unspecified */
00619         near_x        = near_coordinates;
00620         near_y        = near_x + 1;
00621         near_z        = near_x + 2;
00622         on_x          = *on_coordinates;
00623         on_y          = on_x + 1;
00624         on_z          = on_x + 2;
00625         norm_x        = *normals;
00626         norm_y        = norm_x + 1;
00627         norm_z        = norm_x + 2;
00628         near_step *= 3;
00629         on_step = 3;
00630     }
00631 
00632     for( int i = 0; i < count; ++i )
00633     {
00634         FBiGeom_getEntNrmlPlXYZ( instance, entity_handles[index], *near_x, *near_y, *near_z, on_x, on_y, on_z, norm_x,
00635                                  norm_y, norm_z, err );
00636         FWDERR();
00637 
00638         // entities += ent_step;
00639         index += ent_step;
00640         near_x += near_step;
00641         near_y += near_step;
00642         near_z += near_step;
00643         on_x += on_step;
00644         on_y += on_step;
00645         on_z += on_step;
00646         norm_x += on_step;
00647         norm_y += on_step;
00648         norm_z += on_step;
00649     }
00650     *on_coordinates_size = count * 3;
00651     *normals_size        = count;
00652     RETURN( iBase_SUCCESS );
00653 }
00654 
00655 void FBiGeom_getEntTgntXYZ( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
00656                             double*, int* err )
00657 {
00658     RETURN( iBase_NOT_SUPPORTED );
00659 }
00660 
00661 void FBiGeom_getArrTgntXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
00662                             double**, int*, int*, int* err )
00663 {
00664     RETURN( iBase_NOT_SUPPORTED );
00665 }
00666 
00667 void FBiGeom_getEntBoundBox( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double* min_x, double* min_y,
00668                              double* min_z, double* max_x, double* max_y, double* max_z, int* err )
00669 {
00670     ErrorCode rval;
00671     int type;
00672     FBiGeom_getEntType( instance, entity_handle, &type, err );
00673     FWDERR();
00674 
00675     if( type == 0 )
00676     {
00677         FBiGeom_getVtxCoord( instance, entity_handle, min_x, min_y, min_z, err );
00678         FWDERR();
00679         max_x = min_x;
00680         max_y = min_y;
00681         max_z = min_z;
00682     }
00683     else if( type == 1 )
00684     {
00685         // it could be relatively easy to support
00686         *err = iBase_NOT_SUPPORTED;
00687         FWDERR();
00688     }
00689     else if( type == 2 || type == 3 )
00690     {
00691 
00692         EntityHandle root;
00693         CartVect center, axis[3];
00694         GeomTopoTool* gtt = GETGTT( instance );
00695         if( !gtt ) ERROR( iBase_FAILURE, "Can't get geom topo tool." );
00696         rval = gtt->get_root( MBH_cast( entity_handle ), root );CHKERR( rval, "Failed to get tree root in FBiGeom_getEntBoundBox." );
00697         rval = gtt->obb_tree()->box( root, center.array(), axis[0].array(), axis[1].array(), axis[2].array() );CHKERR( rval, "Failed to get box from obb tree." );
00698 
00699         CartVect absv[3];
00700         for( int i = 0; i < 3; i++ )
00701         {
00702             absv[i] = CartVect( fabs( axis[i][0] ), fabs( axis[i][1] ), fabs( axis[i][2] ) );
00703         }
00704         CartVect min, max;
00705         min    = center - absv[0] - absv[1] - absv[2];
00706         max    = center + absv[0] + absv[1] + absv[2];
00707         *min_x = min[0];
00708         *min_y = min[1];
00709         *min_z = min[2];
00710         *max_x = max[0];
00711         *max_y = max[1];
00712         *max_z = max[2];
00713     }
00714     else
00715         RETURN( iBase_INVALID_ENTITY_TYPE );
00716 
00717     RETURN( iBase_SUCCESS );
00718 }
00719 
00720 void FBiGeom_getArrBoundBox( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles,
00721                              int entity_handles_size, int storage_order, double** min_corner, int* min_corner_allocated,
00722                              int* min_corner_size, double** max_corner, int* max_corner_allocated, int* max_corner_size,
00723                              int* err )
00724 {
00725     // check or pre-allocate the coordinate arrays
00726     CHECK_SIZE( *min_corner, *min_corner_allocated, 3 * entity_handles_size, double, NULL );
00727     CHECK_SIZE( *max_corner, *max_corner_allocated, 3 * entity_handles_size, double, NULL );
00728 
00729     size_t step, init;
00730     if( storage_order == iBase_BLOCKED )
00731     {
00732         step = 1;
00733         init = entity_handles_size;
00734     }
00735     else
00736     {
00737         step = 3;
00738         init = 1;
00739     }
00740     double *min_x, *min_y, *min_z, *max_x, *max_y, *max_z;
00741     min_x = *min_corner;
00742     max_x = *max_corner;
00743     min_y = min_x + init;
00744     max_y = max_x + init;
00745     min_z = min_y + init;
00746     max_z = max_y + init;
00747 
00748     for( int i = 0; i < entity_handles_size; ++i )
00749     {
00750         FBiGeom_getEntBoundBox( instance, entity_handles[i], min_x, min_y, min_z, max_x, max_y, max_z, err );
00751         FWDERR();
00752 
00753         min_x += step;
00754         max_x += step;
00755         min_y += step;
00756         max_y += step;
00757         min_z += step;
00758         max_z += step;
00759     }
00760     *min_corner_size = 3 * entity_handles_size;
00761     *max_corner_size = 3 * entity_handles_size;
00762     RETURN( iBase_SUCCESS );
00763 }
00764 
00765 void FBiGeom_getVtxCoord( FBiGeom_Instance instance, iBase_EntityHandle vertex_handle, double* x, double* y, double* z,
00766                           int* err )
00767 {
00768     ErrorCode rval = FBE_cast( instance )->getVtxCoord( MBH_cast( vertex_handle ), x, y, z );CHKERR( rval, "Failed to vertex position" );
00769     RETURN( iBase_SUCCESS );
00770 }
00771 
00772 void FBiGeom_getVtxArrCoords( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles,
00773                               int entity_handles_size, int storage_order, double** coordinates,
00774                               int* coordinates_allocated, int* coordinates_size, int* err )
00775 {
00776     // check or pre-allocate the coordinate arrays
00777     CHECK_SIZE( *coordinates, *coordinates_allocated, 3 * entity_handles_size, double, NULL );
00778 
00779     double *x, *y, *z;
00780     size_t step;
00781     if( storage_order == iBase_BLOCKED )
00782     {
00783         x    = *coordinates;
00784         y    = x + entity_handles_size;
00785         z    = y + entity_handles_size;
00786         step = 1;
00787     }
00788     else
00789     {
00790         x    = *coordinates;
00791         y    = x + 1;
00792         z    = x + 2;
00793         step = 3;
00794     }
00795 
00796     for( int i = 0; i < entity_handles_size; i++ )
00797     {
00798         FBiGeom_getVtxCoord( instance, entity_handles[i], x, y, z, err );
00799         x += step;
00800         y += step;
00801         z += step;
00802     }
00803     *coordinates_size = 3 * entity_handles_size;
00804     RETURN( iBase_SUCCESS );
00805 }
00806 
00807 void FBiGeom_getPntRayIntsct( FBiGeom_Instance instance, double x, double y, double z, double dir_x, double dir_y,
00808                               double dir_z, iBase_EntityHandle** intersect_entity_handles,
00809                               int* intersect_entity_handles_allocated, int* intersect_entity_handles_size,
00810                               int storage_order, double** intersect_coords, int* intersect_coords_allocated,
00811                               int* intersect_coords_size, double** param_coords, int* param_coords_allocated,
00812                               int* param_coords_size, int* err )
00813 {
00814     // this is pretty cool
00815     // we will return only surfaces
00816     //
00817     // storage order is ignored
00818     std::vector< EntityHandle > intersect_handles;
00819     std::vector< double > coords;
00820     std::vector< double > params;
00821     ErrorCode rval =
00822         FBE_cast( instance )->getPntRayIntsct( x, y, z, dir_x, dir_y, dir_z, intersect_handles, coords, params );CHKERR( rval, "can't get ray intersections " );
00823     *intersect_entity_handles_size = (int)intersect_handles.size();
00824 
00825     CHECK_SIZE( *intersect_entity_handles, *intersect_entity_handles_allocated, *intersect_entity_handles_size,
00826                 iBase_EntityHandle, NULL );
00827     *intersect_coords_size = 3 * (int)intersect_handles.size();
00828     CHECK_SIZE( *intersect_coords, *intersect_coords_allocated, *intersect_coords_size, double, NULL );
00829     *param_coords_size = (int)intersect_handles.size();
00830     CHECK_SIZE( *param_coords, *param_coords_allocated, *param_coords_size, double, NULL );
00831 
00832     COPY_RANGE( intersect_handles, *intersect_entity_handles );
00833 
00834     COPY_DOUBLEVEC( params, *param_coords );
00835     if( storage_order == iBase_BLOCKED )
00836     {
00837         int sz = (int)intersect_handles.size();
00838         for( int i = 0; i < sz; i++ )
00839         {
00840             *intersect_coords[i]          = coords[3 * i];
00841             *intersect_coords[sz + i]     = coords[3 * i + 1];
00842             *intersect_coords[2 * sz + i] = coords[3 * i + 2];
00843         }
00844     }
00845     else
00846     {
00847         COPY_DOUBLEVEC( coords, *intersect_coords );
00848     }
00849 
00850     RETURN( iBase_SUCCESS );
00851 }
00852 
00853 void FBiGeom_getPntArrRayIntsct( FBiGeom_Instance instance, int, const double*, int, const double*, int,
00854                                  iBase_EntityHandle**, int*, int*, int**, int*, int*, double**, int*, int*, double**,
00855                                  int*, int*, int* err )
00856 {
00857     // not implemented
00858     RETURN( iBase_NOT_SUPPORTED );
00859 }
00860 
00861 void FBiGeom_getEntNrmlSense( FBiGeom_Instance instance, iBase_EntityHandle face, iBase_EntityHandle region,
00862                               int* sense_out, int* err )
00863 {
00864     moab::EntityHandle mbregion = (moab::EntityHandle)region;
00865     moab::EntityHandle mbface   = (moab::EntityHandle)face;
00866     moab::ErrorCode rval        = FBE_cast( instance )->getEgFcSense( mbface, mbregion, *sense_out );CHKERR( rval, "can't get normal sense " );
00867     RETURN( iBase_SUCCESS );
00868 }
00869 void FBiGeom_getArrNrmlSense( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
00870                               int**, int*, int*, int* err )
00871 {
00872     // not implemented
00873     RETURN( iBase_NOT_SUPPORTED );
00874 }
00875 
00876 /**\brief Get the sense of an edge with respect to a face
00877  * Get the sense of an edge with respect to a face.  Sense returned is -1, 0, or 1,
00878  * representing "reversed", "both", or "forward".  "both" sense indicates that edge bounds
00879  * the face once with each sense.
00880  * \param edge Edge being queried
00881  * \param face Face being queried
00882  * \param sense_out Sense of edge with respect to face
00883  */
00884 
00885 void FBiGeom_getEgFcSense( FBiGeom_Instance instance, iBase_EntityHandle edge, iBase_EntityHandle face, int* sense_out,
00886                            int* err )
00887 {
00888     // this one is important, for establishing the orientation of the edges in faces
00889     // bummer, I "thought" it is already implemented
00890     // use senses
00891     ErrorCode rval = FBE_cast( instance )->getEgFcSense( MBH_cast( edge ), MBH_cast( face ), *sense_out );
00892 
00893     CHKERR( rval, "Failed to get edge senses in FBiGeom_getEgFcSense." );
00894     RETURN( iBase_SUCCESS );
00895 }
00896 void FBiGeom_getEgFcArrSense( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
00897                               int**, int*, int*, int* err )
00898 {
00899     RETURN( iBase_NOT_SUPPORTED );
00900 }
00901 
00902 void FBiGeom_getEgVtxSense( FBiGeom_Instance instance, iBase_EntityHandle edge, iBase_EntityHandle vertex1,
00903                             iBase_EntityHandle vertex2, int* sense_out, int* err )
00904 {
00905 
00906     ErrorCode rval =
00907         FBE_cast( instance )->getEgVtxSense( MBH_cast( edge ), MBH_cast( vertex1 ), MBH_cast( vertex2 ), *sense_out );CHKERR( rval, "Failed to get vertex sense wrt edge in FBiGeom_getEgVtxSense" );
00908     RETURN( iBase_SUCCESS );
00909 }
00910 void FBiGeom_getEgVtxArrSense( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*,
00911                                int, iBase_EntityHandle const*, int, int**, int*, int*, int* err )
00912 {
00913     RETURN( iBase_NOT_SUPPORTED );
00914 }
00915 
00916 void FBiGeom_measure( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles, int entity_handles_size,
00917                       double** measures, int* measures_allocated, int* measures_size, int* err )
00918 {
00919 
00920     CHECK_SIZE( *measures, *measures_allocated, entity_handles_size, double, NULL );
00921     ErrorCode rval = FBE_cast( instance )->measure( (EntityHandle*)( entity_handles ), entity_handles_size, *measures );CHKERR( rval, "Failed to get measures" );
00922     *measures_size = entity_handles_size;
00923     RETURN( iBase_SUCCESS );
00924 }
00925 
00926 void FBiGeom_getFaceType( FBiGeom_Instance instance, iBase_EntityHandle, char* face_type, int* err,
00927                           int* face_type_length )
00928 {
00929     std::string type = "nonplanar";  // for swept faces created with rays between surfaces,
00930                                      // we could actually create planar surfaces; maybe we should
00931                                      // recognize them as such
00932     face_type = new char[type.length() + 1];
00933     strcpy( face_type, type.c_str() );
00934     *face_type_length = type.length() + 1;
00935     RETURN( iBase_SUCCESS );
00936 }
00937 void FBiGeom_getParametric( FBiGeom_Instance instance, int* is_parametric, int* err )
00938 {
00939     *is_parametric = 0;  //(false)
00940     RETURN( iBase_SUCCESS );
00941 }
00942 void FBiGeom_isEntParametric( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, int* parametric, int* err )
00943 {
00944     int type = -1;
00945     FBiGeom_getEntType( instance, entity_handle, &type, err );
00946     if( type == 1 )
00947         *parametric = 1;  // true
00948     else
00949         *parametric = 0;  // false
00950     RETURN( iBase_SUCCESS );
00951 }
00952 void FBiGeom_isArrParametric( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int**, int*, int*, int* err )
00953 {
00954     // not implemented
00955     RETURN( iBase_NOT_SUPPORTED );
00956 }
00957 void FBiGeom_getEntUVtoXYZ( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double*, double*, double*,
00958                             int* err )
00959 {
00960     RETURN( iBase_NOT_SUPPORTED );
00961 }
00962 void FBiGeom_getArrUVtoXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
00963                             double**, int*, int*, int* err )
00964 {
00965     RETURN( iBase_NOT_SUPPORTED );
00966 }
00967 
00968 void FBiGeom_getEntUtoXYZ( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double* x, double* y,
00969                            double* z, int* err )
00970 {
00971     int type;
00972     FBiGeom_getEntType( instance, entity_handle, &type, err );
00973     FWDERR();
00974 
00975     if( type != 1 )  // not edge
00976         RETURN( iBase_NOT_SUPPORTED );
00977 
00978     ErrorCode rval = FBE_cast( instance )->getEntUtoXYZ( (EntityHandle)entity_handle, u, *x, *y, *z );CHKERR( rval, "Failed to get position from parameter" );
00979     RETURN( iBase_SUCCESS );
00980 }
00981 
00982 void FBiGeom_getArrUtoXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, double const*, int, int, double**,
00983                            int*, int*, int* err )
00984 {
00985     // not implemented
00986     RETURN( iBase_NOT_SUPPORTED );
00987 }
00988 void FBiGeom_getEntXYZtoUV( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
00989                             int* err )
00990 {
00991     RETURN( iBase_NOT_SUPPORTED );
00992 }
00993 void FBiGeom_getEntXYZtoU( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, int* err )
00994 {
00995     RETURN( iBase_NOT_SUPPORTED );
00996 }
00997 void FBiGeom_getArrXYZtoUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
00998                             double**, int*, int*, int* err )
00999 {
01000     RETURN( iBase_NOT_SUPPORTED );
01001 }
01002 void FBiGeom_getArrXYZtoU( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int, double**,
01003                            int*, int*, int* err )
01004 {
01005     RETURN( iBase_NOT_SUPPORTED );
01006 }
01007 void FBiGeom_getEntXYZtoUVHint( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
01008                                 int* err )
01009 {
01010     RETURN( iBase_NOT_SUPPORTED );
01011 }
01012 void FBiGeom_getArrXYZtoUVHint( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01013                                 double**, int*, int*, int* err )
01014 {
01015     RETURN( iBase_NOT_SUPPORTED );
01016 }
01017 void FBiGeom_getEntUVRange( FBiGeom_Instance instance, iBase_EntityHandle, double*, double*, double*, double*,
01018                             int* err )
01019 {
01020     RETURN( iBase_NOT_SUPPORTED );
01021 }
01022 
01023 void FBiGeom_getEntURange( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double* u_min, double* u_max,
01024                            int* err )
01025 {
01026     ErrorCode rval = FBE_cast( instance )->getEntURange( (EntityHandle)entity_handle, *u_min, *u_max );CHKERR( rval, "Failed to get range" );
01027     RETURN( iBase_SUCCESS );
01028 }
01029 void FBiGeom_getArrUVRange( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double**, int*, int*,
01030                             double**, int*, int*, int* err )
01031 {
01032     RETURN( iBase_NOT_SUPPORTED );
01033 }
01034 void FBiGeom_getArrURange( FBiGeom_Instance instance, iBase_EntityHandle const*, int, double**, int*, int*, double**,
01035                            int*, int*, int* err )
01036 {
01037     RETURN( iBase_NOT_SUPPORTED );
01038 }
01039 void FBiGeom_getEntUtoUV( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, double, double*, double*,
01040                           int* err )
01041 {
01042     RETURN( iBase_NOT_SUPPORTED );
01043 }
01044 void FBiGeom_getVtxToUV( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, double*, double*, int* err )
01045 {
01046     RETURN( iBase_NOT_SUPPORTED );
01047 }
01048 void FBiGeom_getVtxToU( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, double*, int* err )
01049 {
01050     RETURN( iBase_NOT_SUPPORTED );
01051 }
01052 void FBiGeom_getArrUtoUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
01053                           double const*, int, int, double**, int*, int*, int* err )
01054 {
01055     RETURN( iBase_NOT_SUPPORTED );
01056 }
01057 void FBiGeom_getVtxArrToUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
01058                             int, double**, int*, int*, int* err )
01059 {
01060     RETURN( iBase_NOT_SUPPORTED );
01061 }
01062 void FBiGeom_getVtxArrToU( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
01063                            double**, int*, int*, int* err )
01064 {
01065     RETURN( iBase_NOT_SUPPORTED );
01066 }
01067 void FBiGeom_getEntNrmlUV( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double*, double*, double*,
01068                            int* err )
01069 {
01070     RETURN( iBase_NOT_SUPPORTED );
01071 }
01072 void FBiGeom_getArrNrmlUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int, double**,
01073                            int*, int*, int* err )
01074 {
01075     RETURN( iBase_NOT_SUPPORTED );
01076 }
01077 void FBiGeom_getEntTgntU( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double* tgnt_i,
01078                           double* tgnt_j, double* tgnt_k, int* err )
01079 {
01080     ErrorCode rval =
01081         FBE_cast( instance )->getEntTgntU( (moab::EntityHandle)entity_handle, u, *tgnt_i, *tgnt_j, *tgnt_k );CHKERR( rval, "Failed to get tangent from u" );
01082     RETURN( iBase_SUCCESS );
01083 }
01084 void FBiGeom_getArrTgntU( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int, double**,
01085                           int*, int*, int* err )
01086 {
01087     RETURN( iBase_NOT_SUPPORTED );
01088 }
01089 void FBiGeom_getEnt1stDrvt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double**, int*, int*,
01090                             double**, int*, int*, int* err )
01091 {
01092     RETURN( iBase_NOT_SUPPORTED );
01093 }
01094 void FBiGeom_getArr1stDrvt( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01095                             double**, int*, int*, int**, int*, int*, double**, int*, int*, int**, int*, int*, int* err )
01096 {
01097     RETURN( iBase_NOT_SUPPORTED );
01098 }
01099 void FBiGeom_getEnt2ndDrvt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double**, int*, int*,
01100                             double**, int*, int*, double**, int*, int*, int* err )
01101 {
01102     RETURN( iBase_NOT_SUPPORTED );
01103 }
01104 void FBiGeom_getArr2ndDrvt( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01105                             double**, int*, int*, int**, int*, int*, double**, int*, int*, int**, int*, int*, double**,
01106                             int*, int*, int**, int*, int*, int* err )
01107 {
01108     RETURN( iBase_NOT_SUPPORTED );
01109 }
01110 void FBiGeom_getFcCvtrUV( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double*, double*, double*,
01111                           double*, double*, double*, int* err )
01112 {
01113     RETURN( iBase_NOT_SUPPORTED );
01114 }
01115 void FBiGeom_getFcArrCvtrUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01116                              double**, int*, int*, double**, int*, int*, int* err )
01117 {
01118     RETURN( iBase_NOT_SUPPORTED );
01119 }
01120 void FBiGeom_isEntPeriodic( FBiGeom_Instance /*instance*/, iBase_EntityHandle /*entity_handle*/, int* in_u, int* in_v,
01121                             int* err )
01122 {
01123     *in_u = 0;
01124     *in_v = 0;
01125     *err  = 0;
01126     return;
01127 }
01128 void FBiGeom_isArrPeriodic( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int**, int*, int*, int* err )
01129 {
01130     RETURN( iBase_NOT_SUPPORTED );
01131 }
01132 void FBiGeom_isFcDegenerate( FBiGeom_Instance instance, iBase_EntityHandle, int*, int* err )
01133 {
01134     RETURN( iBase_NOT_SUPPORTED );
01135 }
01136 void FBiGeom_isFcArrDegenerate( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int**, int*, int*, int* err )
01137 {
01138     RETURN( iBase_NOT_SUPPORTED );
01139 }
01140 
01141 void FBiGeom_initEntIter( FBiGeom_Instance instance, iBase_EntitySetHandle, int, iBase_EntityIterator*, int* err )
01142 {
01143     RETURN( iBase_NOT_SUPPORTED );
01144 }
01145 
01146 void FBiGeom_initEntArrIter( FBiGeom_Instance instance, iBase_EntitySetHandle, int, int, iBase_EntityArrIterator*,
01147                              int* err )
01148 {
01149     RETURN( iBase_NOT_SUPPORTED );
01150 }
01151 
01152 void FBiGeom_getNextEntIter( FBiGeom_Instance instance, iBase_EntityIterator, iBase_EntityHandle*, int*, int* err )
01153 {
01154     RETURN( iBase_NOT_SUPPORTED );
01155 }
01156 
01157 void FBiGeom_getNextEntArrIter( FBiGeom_Instance instance, iBase_EntityArrIterator, iBase_EntityHandle**, int*, int*,
01158                                 int*, int* err )
01159 {
01160     RETURN( iBase_NOT_SUPPORTED );
01161 }
01162 
01163 void FBiGeom_resetEntIter( FBiGeom_Instance instance, iBase_EntityIterator, int* err )
01164 {
01165     RETURN( iBase_NOT_SUPPORTED );
01166 }
01167 
01168 void FBiGeom_resetEntArrIter( FBiGeom_Instance instance, iBase_EntityArrIterator, int* err )
01169 {
01170     RETURN( iBase_NOT_SUPPORTED );
01171 }
01172 
01173 void FBiGeom_endEntIter( FBiGeom_Instance instance, iBase_EntityIterator, int* err )
01174 {
01175     RETURN( iBase_NOT_SUPPORTED );
01176 }
01177 
01178 void FBiGeom_endEntArrIter( FBiGeom_Instance instance, iBase_EntityArrIterator, int* err )
01179 {
01180     RETURN( iBase_NOT_SUPPORTED );
01181 }
01182 
01183 void FBiGeom_copyEnt( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle*, int* err )
01184 {
01185     RETURN( iBase_NOT_SUPPORTED );
01186 }
01187 
01188 void FBiGeom_sweepEntAboutAxis( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double,
01189                                 iBase_EntityHandle*, int* err )
01190 {
01191     RETURN( iBase_NOT_SUPPORTED );
01192 }
01193 
01194 void FBiGeom_deleteAll( FBiGeom_Instance instance, int* err )
01195 {
01196     // it means deleting some sets from moab db ; is this what we want?
01197     RETURN( iBase_NOT_SUPPORTED );
01198 }
01199 
01200 void FBiGeom_deleteEnt( FBiGeom_Instance instance, iBase_EntityHandle /*entity_handle*/, int* err )
01201 {
01202     RETURN( iBase_NOT_SUPPORTED );
01203 }
01204 
01205 void FBiGeom_createSphere( FBiGeom_Instance instance, double, iBase_EntityHandle*, int* err )
01206 {
01207     RETURN( iBase_NOT_SUPPORTED );
01208 }
01209 
01210 void FBiGeom_createPrism( FBiGeom_Instance instance, double, int, double, double, iBase_EntityHandle*, int* err )
01211 {
01212     RETURN( iBase_NOT_SUPPORTED );
01213 }
01214 
01215 void FBiGeom_createBrick( FBiGeom_Instance instance, double, double, double, iBase_EntityHandle*, int* err )
01216 {
01217     RETURN( iBase_NOT_SUPPORTED );
01218 }
01219 
01220 void FBiGeom_createCylinder( FBiGeom_Instance instance, double, double, double, iBase_EntityHandle*, int* err )
01221 {
01222     RETURN( iBase_NOT_SUPPORTED );
01223 }
01224 
01225 void FBiGeom_createCone( FBiGeom_Instance instance, double, double, double, double, iBase_EntityHandle*, int* err )
01226 {
01227     RETURN( iBase_NOT_SUPPORTED );
01228 }
01229 
01230 void FBiGeom_createTorus( FBiGeom_Instance instance, double, double, iBase_EntityHandle*, int* err )
01231 {
01232     RETURN( iBase_NOT_SUPPORTED );
01233 }
01234 
01235 void FBiGeom_moveEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, int* err )
01236 {
01237     RETURN( iBase_NOT_SUPPORTED );
01238 }
01239 
01240 void FBiGeom_rotateEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double, int* err )
01241 {
01242     RETURN( iBase_NOT_SUPPORTED );
01243 }
01244 
01245 void FBiGeom_reflectEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double, double, double,
01246                          int* err )
01247 {
01248     RETURN( iBase_NOT_SUPPORTED );
01249 }
01250 
01251 void FBiGeom_scaleEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double, double, double,
01252                        int* err )
01253 {
01254     RETURN( iBase_NOT_SUPPORTED );
01255 }
01256 
01257 void FBiGeom_uniteEnts( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle*, int* err )
01258 {
01259     RETURN( iBase_NOT_SUPPORTED );
01260 }
01261 
01262 void FBiGeom_subtractEnts( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, iBase_EntityHandle*,
01263                            int* err )
01264 {
01265     RETURN( iBase_NOT_SUPPORTED );
01266 }
01267 
01268 void FBiGeom_intersectEnts( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, iBase_EntityHandle*,
01269                             int* err )
01270 {
01271     RETURN( iBase_NOT_SUPPORTED );
01272 }
01273 
01274 void FBiGeom_sectionEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double, int,
01275                          iBase_EntityHandle*, int* err )
01276 {
01277     RETURN( iBase_NOT_SUPPORTED );
01278 }
01279 
01280 void FBiGeom_imprintEnts( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int* err )
01281 {
01282     RETURN( iBase_NOT_SUPPORTED );
01283 }
01284 
01285 void FBiGeom_mergeEnts( FBiGeom_Instance instance, iBase_EntityHandle const*, int, double, int* err )
01286 {
01287     RETURN( iBase_NOT_SUPPORTED );
01288 }
01289 // start copy old
01290 
01291 void FBiGeom_createEntSet( FBiGeom_Instance instance, int isList, iBase_EntitySetHandle* entity_set_created, int* err )
01292 {
01293     iMesh_createEntSet( IMESH_INSTANCE( instance ), isList, entity_set_created, err );
01294     FWDERR();
01295 }
01296 
01297 void FBiGeom_destroyEntSet( FBiGeom_Instance instance, iBase_EntitySetHandle, int* err )
01298 {
01299     RETURN( iBase_NOT_SUPPORTED );
01300 }
01301 
01302 void FBiGeom_isList( FBiGeom_Instance instance, iBase_EntitySetHandle, int*, int* err )
01303 {
01304     RETURN( iBase_NOT_SUPPORTED );
01305 }
01306 
01307 void FBiGeom_getNumEntSets( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle, int /*num_hops*/,
01308                             int* num_sets, int* err )
01309 {
01310     //  here, we get only the entity sets that have gents as members
01311     // we have the convention that entity sets of geom dimension 4 are
01312     // sets of geo entities; they should contain only gentities as elements (or other sets of gents)
01313     // we should also consider the number of hops
01314     // first, get all sets of geo dim 4 from the entity_set_handle; then intersect with
01315     // the range from geom topo tool
01316     Tag geomTag;
01317     ErrorCode rval = MBI->tag_get_handle( GEOM_DIMENSION_TAG_NAME, 1, MB_TYPE_INTEGER, geomTag );
01318     if( MB_SUCCESS != rval ) RETURN( iBase_FAILURE );
01319     GeomTopoTool* gtt   = GETGTT( instance );
01320     const Range* gRange = gtt->geoRanges();
01321     // get all sets of geom dimension 4 from the entity set
01322     EntityHandle moabSet         = (EntityHandle)entity_set_handle;
01323     const int four               = 4;
01324     const void* const four_val[] = { &four };
01325     Range tmp;
01326     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 " );
01327     tmp       = intersect( tmp, gRange[4] );
01328     *num_sets = tmp.size();  // ignore, for the time being, number of hops
01329 
01330     RETURN( iBase_SUCCESS );
01331 }
01332 
01333 void FBiGeom_getEntSets( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle, int,
01334                          iBase_EntitySetHandle** contained_set_handles, int* contained_set_handles_allocated,
01335                          int* contained_set_handles_size, int* err )
01336 {
01337     //  we get only the entity sets that have gents as members
01338     // we keep the convention that entity sets of geom dimension 4 are
01339     // sets of geo entities; they should contain only gentities as elements (or other sets of gents)
01340     Tag geomTag;
01341     ErrorCode rval = MBI->tag_get_handle( GEOM_DIMENSION_TAG_NAME, 1, MB_TYPE_INTEGER, geomTag );
01342     if( MB_SUCCESS != rval ) RETURN( iBase_FAILURE );
01343     GeomTopoTool* gtt   = GETGTT( instance );
01344     const Range* gRange = gtt->geoRanges();
01345     // get all sets of geom dimension 4 from the entity set
01346     EntityHandle moabSet         = (EntityHandle)entity_set_handle;
01347     const int four               = 4;
01348     const void* const four_val[] = { &four };
01349     Range tmp;
01350     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 " );
01351     tmp                         = intersect( tmp, gRange[4] );
01352     *contained_set_handles_size = tmp.size();
01353     CHECK_SIZE( *contained_set_handles, *contained_set_handles_allocated, *contained_set_handles_size,
01354                 iBase_EntitySetHandle, NULL );
01355     COPY_RANGE( tmp, *contained_set_handles );
01356 
01357     RETURN( iBase_SUCCESS );
01358 }
01359 
01360 void FBiGeom_addEntToSet( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_EntitySetHandle entity_set,
01361                           int* err )
01362 {
01363     iMesh_addEntToSet( IMESH_INSTANCE( instance ), entity_handle, entity_set, err );
01364 }
01365 
01366 void FBiGeom_rmvEntFromSet( FBiGeom_Instance instance, iBase_EntityHandle entity_handle,
01367                             iBase_EntitySetHandle entity_set, int* err )
01368 {
01369     iMesh_rmvEntFromSet( IMESH_INSTANCE( instance ), entity_handle, entity_set, err );
01370 }
01371 
01372 void FBiGeom_addEntArrToSet( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01373                              int entity_handles_size, iBase_EntitySetHandle entity_set, int* err )
01374 {
01375     iMesh_addEntArrToSet( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, entity_set, err );
01376 }
01377 
01378 void FBiGeom_rmvEntArrFromSet( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01379                                int entity_handles_size, iBase_EntitySetHandle entity_set, int* err )
01380 {
01381     iMesh_rmvEntArrFromSet( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, entity_set, err );
01382 }
01383 
01384 void FBiGeom_addEntSet( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_to_add,
01385                         iBase_EntitySetHandle entity_set_handle, int* err )
01386 {
01387     iMesh_addEntSet( IMESH_INSTANCE( instance ), entity_set_to_add, entity_set_handle, err );
01388 }
01389 
01390 void FBiGeom_rmvEntSet( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_to_remove,
01391                         iBase_EntitySetHandle entity_set_handle, int* err )
01392 {
01393     iMesh_rmvEntSet( IMESH_INSTANCE( instance ), entity_set_to_remove, entity_set_handle, err );
01394 }
01395 
01396 void FBiGeom_isEntContained( FBiGeom_Instance instance, iBase_EntitySetHandle containing_entity_set,
01397                              iBase_EntityHandle contained_entity, int* is_contained, int* err )
01398 {
01399     iMesh_isEntContained( IMESH_INSTANCE( instance ), containing_entity_set, contained_entity, is_contained, err );
01400 }
01401 
01402 void FBiGeom_isEntArrContained( FBiGeom_Instance instance, iBase_EntitySetHandle containing_set,
01403                                 const iBase_EntityHandle* entity_handles, int num_entity_handles, int** is_contained,
01404                                 int* is_contained_allocated, int* is_contained_size, int* err )
01405 {
01406     iMesh_isEntArrContained( IMESH_INSTANCE( instance ), containing_set, entity_handles, num_entity_handles,
01407                              is_contained, is_contained_allocated, is_contained_size, err );
01408 }
01409 
01410 void FBiGeom_isEntSetContained( FBiGeom_Instance instance, iBase_EntitySetHandle containing_entity_set,
01411                                 iBase_EntitySetHandle contained_entity_set, int* is_contained, int* err )
01412 {
01413     iMesh_isEntSetContained( IMESH_INSTANCE( instance ), containing_entity_set, contained_entity_set, is_contained,
01414                              err );
01415 }
01416 
01417 void FBiGeom_addPrntChld( FBiGeom_Instance instance, iBase_EntitySetHandle parent_entity_set,
01418                           iBase_EntitySetHandle child_entity_set, int* err )
01419 {
01420     iMesh_addPrntChld( IMESH_INSTANCE( instance ), parent_entity_set, child_entity_set, err );
01421 }
01422 
01423 void FBiGeom_rmvPrntChld( FBiGeom_Instance instance, iBase_EntitySetHandle parent_entity_set,
01424                           iBase_EntitySetHandle child_entity_set, int* err )
01425 {
01426     iMesh_rmvPrntChld( IMESH_INSTANCE( instance ), parent_entity_set, child_entity_set, err );
01427 }
01428 
01429 void FBiGeom_isChildOf( FBiGeom_Instance instance, iBase_EntitySetHandle parent_entity_set,
01430                         iBase_EntitySetHandle child_entity_set, int* is_child, int* err )
01431 {
01432     iMesh_isChildOf( IMESH_INSTANCE( instance ), parent_entity_set, child_entity_set, is_child, err );
01433 }
01434 
01435 void FBiGeom_getNumChld( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, int num_hops, int* num_child,
01436                          int* err )
01437 {
01438     iMesh_getNumChld( IMESH_INSTANCE( instance ), entity_set, num_hops, num_child, err );
01439 }
01440 
01441 void FBiGeom_getNumPrnt( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, int num_hops, int* num_parent,
01442                          int* err )
01443 {
01444     iMesh_getNumPrnt( IMESH_INSTANCE( instance ), entity_set, num_hops, num_parent, err );
01445 }
01446 
01447 void FBiGeom_getChldn( FBiGeom_Instance instance, iBase_EntitySetHandle from_entity_set, int num_hops,
01448                        iBase_EntitySetHandle** entity_set_handles, int* entity_set_handles_allocated,
01449                        int* entity_set_handles_size, int* err )
01450 {
01451     iMesh_getChldn( IMESH_INSTANCE( instance ), from_entity_set, num_hops, entity_set_handles,
01452                     entity_set_handles_allocated, entity_set_handles_size, err );
01453 }
01454 
01455 void FBiGeom_getPrnts( FBiGeom_Instance instance, iBase_EntitySetHandle from_entity_set, int num_hops,
01456                        iBase_EntitySetHandle** entity_set_handles, int* entity_set_handles_allocated,
01457                        int* entity_set_handles_size, int* err )
01458 {
01459     iMesh_getPrnts( IMESH_INSTANCE( instance ), from_entity_set, num_hops, entity_set_handles,
01460                     entity_set_handles_allocated, entity_set_handles_size, err );
01461 }
01462 
01463 void FBiGeom_createTag( FBiGeom_Instance instance, const char* tag_name, int tag_size, int tag_type,
01464                         iBase_TagHandle* tag_handle, int* err, int tag_name_len )
01465 {
01466 
01467     iMesh_createTag( IMESH_INSTANCE( instance ), tag_name, tag_size, tag_type, tag_handle, err, tag_name_len );
01468 }
01469 
01470 void FBiGeom_destroyTag( FBiGeom_Instance instance, iBase_TagHandle tag_handle, int, int* err )
01471 {
01472     ErrorCode rval = MBI->tag_delete( TAG_HANDLE( tag_handle ) );CHKERR( rval, "Failed to delete tag" );
01473     RETURN( iBase_SUCCESS );
01474 }
01475 
01476 void FBiGeom_getTagName( FBiGeom_Instance instance, iBase_TagHandle tag_handle, char* name, int* err, int name_len )
01477 {
01478     iMesh_getTagName( IMESH_INSTANCE( instance ), tag_handle, name, err, name_len );
01479 }
01480 
01481 void FBiGeom_getTagSizeValues( FBiGeom_Instance instance, iBase_TagHandle tag_handle, int* tag_size, int* err )
01482 {
01483     iMesh_getTagSizeValues( IMESH_INSTANCE( instance ), tag_handle, tag_size, err );
01484 }
01485 
01486 void FBiGeom_getTagSizeBytes( FBiGeom_Instance instance, iBase_TagHandle tag_handle, int* tag_size, int* err )
01487 {
01488     iMesh_getTagSizeBytes( IMESH_INSTANCE( instance ), tag_handle, tag_size, err );
01489 }
01490 
01491 void FBiGeom_getTagHandle( FBiGeom_Instance instance, const char* tag_name, iBase_TagHandle* tag_handle, int* err,
01492                            int tag_name_len )
01493 {
01494     iMesh_getTagHandle( IMESH_INSTANCE( instance ), tag_name, tag_handle, err, tag_name_len );
01495 }
01496 
01497 void FBiGeom_getTagType( FBiGeom_Instance instance, iBase_TagHandle tag_handle, int* tag_type, int* err )
01498 {
01499     iMesh_getTagType( IMESH_INSTANCE( instance ), tag_handle, tag_type, err );
01500 }
01501 
01502 void FBiGeom_setEntSetData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle,
01503                             iBase_TagHandle tag_handle, const void* tag_value, int tag_value_size, int* err )
01504 {
01505     iMesh_setEntSetData( IMESH_INSTANCE( instance ), entity_set_handle, tag_handle, tag_value, tag_value_size, err );
01506 }
01507 
01508 void FBiGeom_setEntSetIntData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01509                                int tag_value, int* err )
01510 {
01511     iMesh_setEntSetIntData( IMESH_INSTANCE( instance ), entity_set, tag_handle, tag_value, err );
01512 }
01513 
01514 void FBiGeom_setEntSetDblData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01515                                double tag_value, int* err )
01516 {
01517     iMesh_setEntSetDblData( IMESH_INSTANCE( instance ), entity_set, tag_handle, tag_value, err );
01518 }
01519 
01520 void FBiGeom_setEntSetEHData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01521                               iBase_EntityHandle tag_value, int* err )
01522 {
01523     iMesh_setEntSetEHData( IMESH_INSTANCE( instance ), entity_set, tag_handle, tag_value, err );
01524 }
01525 
01526 void FBiGeom_setEntSetESHData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01527                                iBase_EntitySetHandle tag_value, int* err )
01528 {
01529     iMesh_setEntSetESHData( IMESH_INSTANCE( instance ), entity_set, tag_handle, tag_value, err );
01530 }
01531 
01532 void FBiGeom_getEntSetData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle,
01533                             iBase_TagHandle tag_handle, void** tag_value, int* tag_value_allocated, int* tag_value_size,
01534                             int* err )
01535 {
01536     iMesh_getEntSetData( IMESH_INSTANCE( instance ), entity_set_handle, tag_handle, tag_value, tag_value_allocated,
01537                          tag_value_size, err );
01538 }
01539 
01540 void FBiGeom_getEntSetIntData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01541                                int* out_data, int* err )
01542 {
01543     iMesh_getEntSetIntData( IMESH_INSTANCE( instance ), entity_set, tag_handle, out_data, err );
01544 }
01545 
01546 void FBiGeom_getEntSetDblData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01547                                double* out_data, int* err )
01548 {
01549     iMesh_getEntSetDblData( IMESH_INSTANCE( instance ), entity_set, tag_handle, out_data, err );
01550 }
01551 
01552 void FBiGeom_getEntSetEHData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01553                               iBase_EntityHandle* out_data, int* err )
01554 {
01555     iMesh_getEntSetEHData( IMESH_INSTANCE( instance ), entity_set, tag_handle, out_data, err );
01556 }
01557 
01558 void FBiGeom_getEntSetESHData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01559                                iBase_EntitySetHandle* out_data, int* err )
01560 {
01561     iMesh_getEntSetESHData( IMESH_INSTANCE( instance ), entity_set, tag_handle, out_data, err );
01562 }
01563 
01564 void FBiGeom_getAllEntSetTags( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle,
01565                                iBase_TagHandle** tag_handles, int* tag_handles_allocated, int* tag_handles_size,
01566                                int* err )
01567 {
01568     iMesh_getAllEntSetTags( IMESH_INSTANCE( instance ), entity_set_handle, tag_handles, tag_handles_allocated,
01569                             tag_handles_size, err );
01570 }
01571 
01572 void FBiGeom_rmvEntSetTag( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle,
01573                            iBase_TagHandle tag_handle, int* err )
01574 {
01575     iMesh_rmvEntSetTag( IMESH_INSTANCE( instance ), entity_set_handle, tag_handle, err );
01576 }
01577 
01578 void FBiGeom_getArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01579                          iBase_TagHandle tag_handle, void** tag_values, int* tag_values_allocated, int* tag_values_size,
01580                          int* err )
01581 {
01582     iMesh_getArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01583                       tag_values_allocated, tag_values_size, err );
01584 }
01585 
01586 void FBiGeom_getIntArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01587                             int entity_handles_size, iBase_TagHandle tag_handle, int** tag_values,
01588                             int* tag_values_allocated, int* tag_values_size, int* err )
01589 {
01590     iMesh_getIntArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01591                          tag_values_allocated, tag_values_size, err );
01592 }
01593 
01594 void FBiGeom_getDblArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01595                             int entity_handles_size, iBase_TagHandle tag_handle, double** tag_values,
01596                             int* tag_values_allocated, int* tag_values_size, int* err )
01597 {
01598     iMesh_getDblArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01599                          tag_values_allocated, tag_values_size, err );
01600 }
01601 
01602 void FBiGeom_getEHArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01603                            iBase_TagHandle tag_handle, iBase_EntityHandle** tag_value, int* tag_value_allocated,
01604                            int* tag_value_size, int* err )
01605 {
01606     iMesh_getEHArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_value,
01607                         tag_value_allocated, tag_value_size, err );
01608 }
01609 
01610 void FBiGeom_getESHArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01611                             int entity_handles_size, iBase_TagHandle tag_handle, iBase_EntitySetHandle** tag_value,
01612                             int* tag_value_allocated, int* tag_value_size, int* err )
01613 {
01614     iMesh_getESHArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_value,
01615                          tag_value_allocated, tag_value_size, err );
01616 }
01617 
01618 void FBiGeom_setArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01619                          iBase_TagHandle tag_handle, const void* tag_values, int tag_values_size, int* err )
01620 {
01621     iMesh_setArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01622                       tag_values_size, err );
01623 }
01624 
01625 void FBiGeom_setIntArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01626                             int entity_handles_size, iBase_TagHandle tag_handle, const int* tag_values,
01627                             int tag_values_size, int* err )
01628 {
01629     iMesh_setIntArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01630                          tag_values_size, err );
01631 }
01632 
01633 void FBiGeom_setDblArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01634                             int entity_handles_size, iBase_TagHandle tag_handle, const double* tag_values,
01635                             const int tag_values_size, int* err )
01636 {
01637     iMesh_setDblArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01638                          tag_values_size, err );
01639 }
01640 
01641 void FBiGeom_setEHArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01642                            iBase_TagHandle tag_handle, const iBase_EntityHandle* tag_values, int tag_values_size,
01643                            int* err )
01644 {
01645     iMesh_setEHArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01646                         tag_values_size, err );
01647 }
01648 
01649 void FBiGeom_setESHArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01650                             int entity_handles_size, iBase_TagHandle tag_handle,
01651                             const iBase_EntitySetHandle* tag_values, int tag_values_size, int* err )
01652 {
01653     iMesh_setESHArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01654                          tag_values_size, err );
01655 }
01656 
01657 void FBiGeom_rmvArrTag( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01658                         iBase_TagHandle tag_handle, int* err )
01659 {
01660     iMesh_rmvArrTag( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, err );
01661 }
01662 
01663 void FBiGeom_getData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01664                       void** tag_value, int* tag_value_allocated, int* tag_value_size, int* err )
01665 {
01666     iMesh_getData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, tag_value_allocated,
01667                    tag_value_size, err );
01668 }
01669 
01670 void FBiGeom_getIntData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01671                          int* out_data, int* err )
01672 {
01673     iMesh_getIntData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, out_data, err );
01674 }
01675 
01676 void FBiGeom_getDblData( FBiGeom_Instance instance, const iBase_EntityHandle entity_handle,
01677                          const iBase_TagHandle tag_handle, double* out_data, int* err )
01678 {
01679     iMesh_getDblData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, out_data, err );
01680 }
01681 
01682 void FBiGeom_getEHData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01683                         iBase_EntityHandle* out_data, int* err )
01684 {
01685     iMesh_getEHData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, out_data, err );
01686 }
01687 
01688 void FBiGeom_getESHData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01689                          iBase_EntitySetHandle* out_data, int* err )
01690 {
01691     iMesh_getESHData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, out_data, err );
01692 }
01693 
01694 void FBiGeom_setData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01695                       const void* tag_value, int tag_value_size, int* err )
01696 {
01697     iMesh_setData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, tag_value_size, err );
01698 }
01699 
01700 void FBiGeom_setIntData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01701                          int tag_value, int* err )
01702 {
01703     iMesh_setIntData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, err );
01704 }
01705 
01706 void FBiGeom_setDblData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01707                          double tag_value, int* err )
01708 {
01709     iMesh_setDblData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, err );
01710 }
01711 
01712 void FBiGeom_setEHData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01713                         iBase_EntityHandle tag_value, int* err )
01714 {
01715     iMesh_setEHData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, err );
01716 }
01717 
01718 void FBiGeom_setESHData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01719                          iBase_EntitySetHandle tag_value, int* err )
01720 {
01721     iMesh_setESHData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, err );
01722 }
01723 
01724 void FBiGeom_getAllTags( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle** tag_handles,
01725                          int* tag_handles_allocated, int* tag_handles_size, int* err )
01726 {
01727     iMesh_getAllTags( IMESH_INSTANCE( instance ), entity_handle, tag_handles, tag_handles_allocated, tag_handles_size,
01728                       err );
01729 }
01730 
01731 void FBiGeom_rmvTag( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, int* err )
01732 {
01733     iMesh_rmvTag( IMESH_INSTANCE( instance ), entity_handle, tag_handle, err );
01734 }
01735 
01736 void FBiGeom_subtract( FBiGeom_Instance instance, iBase_EntitySetHandle, iBase_EntitySetHandle, iBase_EntitySetHandle*,
01737                        int* err )
01738 {
01739     RETURN( iBase_NOT_SUPPORTED );
01740 }
01741 
01742 void FBiGeom_intersect( FBiGeom_Instance instance, iBase_EntitySetHandle, iBase_EntitySetHandle, iBase_EntitySetHandle*,
01743                         int* err )
01744 {
01745     RETURN( iBase_NOT_SUPPORTED );
01746 }
01747 
01748 void FBiGeom_unite( FBiGeom_Instance instance, iBase_EntitySetHandle, iBase_EntitySetHandle, iBase_EntitySetHandle*,
01749                     int* err )
01750 {
01751     RETURN( iBase_NOT_SUPPORTED );
01752 }
01753 
01754 // TODO methods not yet implemented
01755 void FBiGeom_getEntClosestPtTrimmed( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*,
01756                                      double*, double*, int* err )
01757 {
01758     RETURN( iBase_NOT_SUPPORTED );
01759 }
01760 
01761 void FBiGeom_getFcCvtrXYZ( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
01762                            double*, double*, double*, double*, int* err )
01763 {
01764     RETURN( iBase_NOT_SUPPORTED );
01765 }
01766 
01767 void FBiGeom_getEgCvtrXYZ( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
01768                            double*, int* err )
01769 {
01770     RETURN( iBase_NOT_SUPPORTED );
01771 }
01772 
01773 void FBiGeom_getEntArrCvtrXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01774                                double**, int*, int*, double**, int*, int*, int* err )
01775 {
01776     RETURN( iBase_NOT_SUPPORTED );
01777 }
01778 
01779 void FBiGeom_getEgEvalXYZ( FBiGeom_Instance instance, iBase_EntityHandle edge, double x, double y, double z,
01780                            double* on_x, double* on_y, double* on_z, double* tngt_i, double* tngt_j, double* tngt_k,
01781                            double* cvtr_i, double* cvtr_j, double* cvtr_k, int* err )
01782 {
01783     ErrorCode rval = FBE_cast( instance )
01784                          ->getEgEvalXYZ( (moab::EntityHandle)edge, x, y, z, *on_x, *on_y, *on_z, *tngt_i, *tngt_j,
01785                                          *tngt_k, *cvtr_i, *cvtr_j, *cvtr_k );CHKERR( rval, "can't get point on edge " );
01786     RETURN( iBase_SUCCESS );
01787 }
01788 
01789 void FBiGeom_getFcEvalXYZ( FBiGeom_Instance instance, iBase_EntityHandle face_handle, double x, double y, double z,
01790                            double* on_x, double* on_y, double* on_z, double* nrml_i, double* nrml_j, double* nrml_k,
01791                            double* cvtr1_i, double* cvtr1_j, double* cvtr1_k, double* cvtr2_i, double* cvtr2_j,
01792                            double* cvtr2_k, int* err )
01793 {
01794     /*
01795       moab::ErrorCode rval = _fbEngine->getFcEvalXYZ( (moab::EntityHandle) face,
01796       x,  y, z,
01797       on_x, on_y, on_z,
01798       nrml_i, nrml_j, nrml_k,
01799       cvtr1_i, cvtr1_j, cvtr1_k,
01800       cvtr2_i, cvtr2_j,  cvtr2_k );*/
01801     // camal really does not use curvatures
01802     // the most it is calling for normals and for closest point
01803     // return all curvatures = 0 for the time being, because we
01804     // know camal is not requesting them
01805 
01806     *cvtr1_i = *cvtr1_j = *cvtr1_k = *cvtr2_i = *cvtr2_j = *cvtr2_k = 0.;
01807     // first get closest point, then normal, separately
01808     ErrorCode rval =
01809         FBE_cast( instance )->getEntClosestPt( (moab::EntityHandle)face_handle, x, y, z, on_x, on_y, on_z );CHKERR( rval, "can't get closest point on surface " );
01810     rval = FBE_cast( instance )
01811                ->getEntNrmlXYZ( (moab::EntityHandle)face_handle, x, y, z, nrml_i, nrml_j,
01812                                 nrml_k );  // some inconsistency here, we use pointers, not refs
01813     CHKERR( rval, "can't get normal on closest point on surface " );
01814     RETURN( iBase_SUCCESS );
01815 }
01816 
01817 void FBiGeom_getArrEgEvalXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01818                               double**, int*, int*, double**, int*, int*, double**, int*, int*, int* err )
01819 {
01820     RETURN( iBase_NOT_SUPPORTED );
01821 }
01822 
01823 void FBiGeom_getArrFcEvalXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01824                               double**, int*, int*, double**, int*, int*, double**, int*, int*, double**, int*, int*,
01825                               int* err )
01826 {
01827     RETURN( iBase_NOT_SUPPORTED );
01828 }
01829 
01830 void FBiGeom_getPntClsf( FBiGeom_Instance instance, double, double, double, iBase_EntityHandle*, int* err )
01831 {
01832     RETURN( iBase_NOT_SUPPORTED );
01833 }
01834 
01835 void FBiGeom_getPntArrClsf( FBiGeom_Instance instance, int, double const*, int, iBase_EntityHandle**, int*, int*,
01836                             int* err )
01837 {
01838     RETURN( iBase_NOT_SUPPORTED );
01839 }
01840 
01841 void FBiGeom_getFacets( FBiGeom_Instance instance, iBase_EntityHandle, double, double, int, int, int, int, int,
01842                         int* err )
01843 {
01844     RETURN( iBase_NOT_SUPPORTED );
01845 }
01846 
01847 void FBiGeom_getEntTolerance( FBiGeom_Instance instance, iBase_EntityHandle, double*, int* err )
01848 {
01849     RETURN( iBase_NOT_SUPPORTED );
01850 }
01851 void FBiGeom_getArrTolerance( FBiGeom_Instance instance, iBase_EntityHandle const*, int, double**, int*, int*,
01852                               int* err )
01853 {
01854     RETURN( iBase_NOT_SUPPORTED );
01855 }
01856 void FBiGeom_getTolerance( FBiGeom_Instance instance, int*, double*, int* err )
01857 {
01858     RETURN( iBase_NOT_SUPPORTED );
01859 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines