MOAB: Mesh Oriented datABase  (version 5.2.1)
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 <stdlib.h>
00010 #include <cstring>
00011 #include <map>
00012 #include "assert.h"
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     { ERROR( iBase_INVALID_ENTITY_TYPE, "Entities passed into gentityNormal must be face or volume." ); }
00548 
00549     // do 2 searches, so it is not fast enough
00550     FBiGeom_getEntClosestPt( instance, entity_handle, x, y, z, pt_x, pt_y, pt_z, err );
00551 
00552     FWDERR();
00553     FBiGeom_getEntNrmlXYZ( instance, entity_handle, *pt_x, *pt_y, *pt_z, nrml_i, nrml_j, nrml_k, err );
00554     FWDERR();
00555 
00556     RETURN( iBase_SUCCESS );
00557 }
00558 
00559 void FBiGeom_getArrNrmlPlXYZ( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles,
00560                               int entity_handles_size, int storage_order, double const* near_coordinates,
00561                               int near_coordinates_size, double** on_coordinates, int* on_coordinates_allocated,
00562                               int* on_coordinates_size, double** normals, int* normals_allocated, int* normals_size,
00563                               int* err )
00564 {
00565     // set up iteration according to storage order.
00566     // allow either gentity_handles or near_coordinates to contain
00567     // only one value, where that single value is applied for every
00568     // entry in the other list.
00569     size_t index = 0;
00570     size_t near_step, on_step = 1, ent_step;
00571     int count;
00572     if( 3 * entity_handles_size == near_coordinates_size )
00573     {
00574         near_step = ent_step = 1;
00575         count                = entity_handles_size;
00576     }
00577     else if( near_coordinates_size == 3 )
00578     {
00579         near_step = 0;
00580         ent_step  = 1;
00581         count     = entity_handles_size;
00582     }
00583     else if( entity_handles_size == 1 )
00584     {
00585         near_step = 1;
00586         ent_step  = 0;
00587         count     = near_coordinates_size / 3;
00588     }
00589     else
00590     {
00591         ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
00592     }
00593 
00594     // check or pre-allocate the coordinate arrays
00595     CHECK_SIZE( *on_coordinates, *on_coordinates_allocated, 3 * count, double, NULL );
00596     CHECK_SIZE( *normals, *normals_allocated, 3 * count, double, NULL );
00597 
00598     const double *near_x, *near_y, *near_z;
00599     double *on_x, *on_y, *on_z;
00600     double *norm_x, *norm_y, *norm_z;
00601     if( storage_order == iBase_BLOCKED )
00602     {
00603         near_x  = near_coordinates;
00604         near_y  = near_x + near_coordinates_size / 3;
00605         near_z  = near_y + near_coordinates_size / 3;
00606         on_x    = *on_coordinates;
00607         on_y    = on_x + count;
00608         on_z    = on_y + count;
00609         norm_x  = *normals;
00610         norm_y  = norm_x + count;
00611         norm_z  = norm_y + count;
00612         on_step = 1;
00613     }
00614     else
00615     {
00616         storage_order = iBase_INTERLEAVED; /* set if unspecified */
00617         near_x        = near_coordinates;
00618         near_y        = near_x + 1;
00619         near_z        = near_x + 2;
00620         on_x          = *on_coordinates;
00621         on_y          = on_x + 1;
00622         on_z          = on_x + 2;
00623         norm_x        = *normals;
00624         norm_y        = norm_x + 1;
00625         norm_z        = norm_x + 2;
00626         near_step *= 3;
00627         on_step = 3;
00628     }
00629 
00630     for( int i = 0; i < count; ++i )
00631     {
00632         FBiGeom_getEntNrmlPlXYZ( instance, entity_handles[index], *near_x, *near_y, *near_z, on_x, on_y, on_z, norm_x,
00633                                  norm_y, norm_z, err );
00634         FWDERR();
00635 
00636         // entities += ent_step;
00637         index += ent_step;
00638         near_x += near_step;
00639         near_y += near_step;
00640         near_z += near_step;
00641         on_x += on_step;
00642         on_y += on_step;
00643         on_z += on_step;
00644         norm_x += on_step;
00645         norm_y += on_step;
00646         norm_z += on_step;
00647     }
00648     *on_coordinates_size = count * 3;
00649     *normals_size        = count;
00650     RETURN( iBase_SUCCESS );
00651 }
00652 
00653 void FBiGeom_getEntTgntXYZ( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
00654                             double*, int* err )
00655 {
00656     RETURN( iBase_NOT_SUPPORTED );
00657 }
00658 
00659 void FBiGeom_getArrTgntXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
00660                             double**, int*, int*, int* err )
00661 {
00662     RETURN( iBase_NOT_SUPPORTED );
00663 }
00664 
00665 void FBiGeom_getEntBoundBox( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double* min_x, double* min_y,
00666                              double* min_z, double* max_x, double* max_y, double* max_z, int* err )
00667 {
00668     ErrorCode rval;
00669     int type;
00670     FBiGeom_getEntType( instance, entity_handle, &type, err );
00671     FWDERR();
00672 
00673     if( type == 0 )
00674     {
00675         FBiGeom_getVtxCoord( instance, entity_handle, min_x, min_y, min_z, err );
00676         FWDERR();
00677         max_x = min_x;
00678         max_y = min_y;
00679         max_z = min_z;
00680     }
00681     else if( type == 1 )
00682     {
00683         // it could be relatively easy to support
00684         *err = iBase_NOT_SUPPORTED;
00685         FWDERR();
00686     }
00687     else if( type == 2 || type == 3 )
00688     {
00689 
00690         EntityHandle root;
00691         CartVect center, axis[3];
00692         GeomTopoTool* gtt = GETGTT( instance );
00693         if( !gtt ) ERROR( iBase_FAILURE, "Can't get geom topo tool." );
00694         rval = gtt->get_root( MBH_cast( entity_handle ), root );CHKERR( rval, "Failed to get tree root in FBiGeom_getEntBoundBox." );
00695         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." );
00696 
00697         CartVect absv[3];
00698         for( int i = 0; i < 3; i++ )
00699         {
00700             absv[i] = CartVect( fabs( axis[i][0] ), fabs( axis[i][1] ), fabs( axis[i][2] ) );
00701         }
00702         CartVect min, max;
00703         min    = center - absv[0] - absv[1] - absv[2];
00704         max    = center + absv[0] + absv[1] + absv[2];
00705         *min_x = min[0];
00706         *min_y = min[1];
00707         *min_z = min[2];
00708         *max_x = max[0];
00709         *max_y = max[1];
00710         *max_z = max[2];
00711     }
00712     else
00713         RETURN( iBase_INVALID_ENTITY_TYPE );
00714 
00715     RETURN( iBase_SUCCESS );
00716 }
00717 
00718 void FBiGeom_getArrBoundBox( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles,
00719                              int entity_handles_size, int storage_order, double** min_corner, int* min_corner_allocated,
00720                              int* min_corner_size, double** max_corner, int* max_corner_allocated, int* max_corner_size,
00721                              int* err )
00722 {
00723     // check or pre-allocate the coordinate arrays
00724     CHECK_SIZE( *min_corner, *min_corner_allocated, 3 * entity_handles_size, double, NULL );
00725     CHECK_SIZE( *max_corner, *max_corner_allocated, 3 * entity_handles_size, double, NULL );
00726 
00727     size_t step, init;
00728     if( storage_order == iBase_BLOCKED )
00729     {
00730         step = 1;
00731         init = entity_handles_size;
00732     }
00733     else
00734     {
00735         step = 3;
00736         init = 1;
00737     }
00738     double *min_x, *min_y, *min_z, *max_x, *max_y, *max_z;
00739     min_x = *min_corner;
00740     max_x = *max_corner;
00741     min_y = min_x + init;
00742     max_y = max_x + init;
00743     min_z = min_y + init;
00744     max_z = max_y + init;
00745 
00746     for( int i = 0; i < entity_handles_size; ++i )
00747     {
00748         FBiGeom_getEntBoundBox( instance, entity_handles[i], min_x, min_y, min_z, max_x, max_y, max_z, err );
00749         FWDERR();
00750 
00751         min_x += step;
00752         max_x += step;
00753         min_y += step;
00754         max_y += step;
00755         min_z += step;
00756         max_z += step;
00757     }
00758     *min_corner_size = 3 * entity_handles_size;
00759     *max_corner_size = 3 * entity_handles_size;
00760     RETURN( iBase_SUCCESS );
00761 }
00762 
00763 void FBiGeom_getVtxCoord( FBiGeom_Instance instance, iBase_EntityHandle vertex_handle, double* x, double* y, double* z,
00764                           int* err )
00765 {
00766     ErrorCode rval = FBE_cast( instance )->getVtxCoord( MBH_cast( vertex_handle ), x, y, z );CHKERR( rval, "Failed to vertex position" );
00767     RETURN( iBase_SUCCESS );
00768 }
00769 
00770 void FBiGeom_getVtxArrCoords( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles,
00771                               int entity_handles_size, int storage_order, double** coordinates,
00772                               int* coordinates_allocated, int* coordinates_size, int* err )
00773 {
00774     // check or pre-allocate the coordinate arrays
00775     CHECK_SIZE( *coordinates, *coordinates_allocated, 3 * entity_handles_size, double, NULL );
00776 
00777     double *x, *y, *z;
00778     size_t step;
00779     if( storage_order == iBase_BLOCKED )
00780     {
00781         x    = *coordinates;
00782         y    = x + entity_handles_size;
00783         z    = y + entity_handles_size;
00784         step = 1;
00785     }
00786     else
00787     {
00788         x    = *coordinates;
00789         y    = x + 1;
00790         z    = x + 2;
00791         step = 3;
00792     }
00793 
00794     for( int i = 0; i < entity_handles_size; i++ )
00795     {
00796         FBiGeom_getVtxCoord( instance, entity_handles[i], x, y, z, err );
00797         x += step;
00798         y += step;
00799         z += step;
00800     }
00801     *coordinates_size = 3 * entity_handles_size;
00802     RETURN( iBase_SUCCESS );
00803 }
00804 
00805 void FBiGeom_getPntRayIntsct( FBiGeom_Instance instance, double x, double y, double z, double dir_x, double dir_y,
00806                               double dir_z, iBase_EntityHandle** intersect_entity_handles,
00807                               int* intersect_entity_handles_allocated, int* intersect_entity_handles_size,
00808                               int storage_order, double** intersect_coords, int* intersect_coords_allocated,
00809                               int* intersect_coords_size, double** param_coords, int* param_coords_allocated,
00810                               int* param_coords_size, int* err )
00811 {
00812     // this is pretty cool
00813     // we will return only surfaces
00814     //
00815     // storage order is ignored
00816     std::vector< EntityHandle > intersect_handles;
00817     std::vector< double > coords;
00818     std::vector< double > params;
00819     ErrorCode rval =
00820         FBE_cast( instance )->getPntRayIntsct( x, y, z, dir_x, dir_y, dir_z, intersect_handles, coords, params );CHKERR( rval, "can't get ray intersections " );
00821     *intersect_entity_handles_size = (int)intersect_handles.size();
00822 
00823     CHECK_SIZE( *intersect_entity_handles, *intersect_entity_handles_allocated, *intersect_entity_handles_size,
00824                 iBase_EntityHandle, NULL );
00825     *intersect_coords_size = 3 * (int)intersect_handles.size();
00826     CHECK_SIZE( *intersect_coords, *intersect_coords_allocated, *intersect_coords_size, double, NULL );
00827     *param_coords_size = (int)intersect_handles.size();
00828     CHECK_SIZE( *param_coords, *param_coords_allocated, *param_coords_size, double, NULL );
00829 
00830     COPY_RANGE( intersect_handles, *intersect_entity_handles );
00831 
00832     COPY_DOUBLEVEC( params, *param_coords );
00833     if( storage_order == iBase_BLOCKED )
00834     {
00835         int sz = (int)intersect_handles.size();
00836         for( int i = 0; i < sz; i++ )
00837         {
00838             *intersect_coords[i]          = coords[3 * i];
00839             *intersect_coords[sz + i]     = coords[3 * i + 1];
00840             *intersect_coords[2 * sz + i] = coords[3 * i + 2];
00841         }
00842     }
00843     else
00844     {
00845         COPY_DOUBLEVEC( coords, *intersect_coords );
00846     }
00847 
00848     RETURN( iBase_SUCCESS );
00849 }
00850 
00851 void FBiGeom_getPntArrRayIntsct( FBiGeom_Instance instance, int, const double*, int, const double*, int,
00852                                  iBase_EntityHandle**, int*, int*, int**, int*, int*, double**, int*, int*, double**,
00853                                  int*, int*, int* err )
00854 {
00855     // not implemented
00856     RETURN( iBase_NOT_SUPPORTED );
00857 }
00858 
00859 void FBiGeom_getEntNrmlSense( FBiGeom_Instance instance, iBase_EntityHandle face, iBase_EntityHandle region,
00860                               int* sense_out, int* err )
00861 {
00862     moab::EntityHandle mbregion = (moab::EntityHandle)region;
00863     moab::EntityHandle mbface   = (moab::EntityHandle)face;
00864     moab::ErrorCode rval        = FBE_cast( instance )->getEgFcSense( mbface, mbregion, *sense_out );CHKERR( rval, "can't get normal sense " );
00865     RETURN( iBase_SUCCESS );
00866 }
00867 void FBiGeom_getArrNrmlSense( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
00868                               int**, int*, int*, int* err )
00869 {
00870     // not implemented
00871     RETURN( iBase_NOT_SUPPORTED );
00872 }
00873 
00874 /**\brief Get the sense of an edge with respect to a face
00875  * Get the sense of an edge with respect to a face.  Sense returned is -1, 0, or 1,
00876  * representing "reversed", "both", or "forward".  "both" sense indicates that edge bounds
00877  * the face once with each sense.
00878  * \param edge Edge being queried
00879  * \param face Face being queried
00880  * \param sense_out Sense of edge with respect to face
00881  */
00882 
00883 void FBiGeom_getEgFcSense( FBiGeom_Instance instance, iBase_EntityHandle edge, iBase_EntityHandle face, int* sense_out,
00884                            int* err )
00885 {
00886     // this one is important, for establishing the orientation of the edges in faces
00887     // bummer, I "thought" it is already implemented
00888     // use senses
00889     ErrorCode rval = FBE_cast( instance )->getEgFcSense( MBH_cast( edge ), MBH_cast( face ), *sense_out );
00890 
00891     CHKERR( rval, "Failed to get edge senses in FBiGeom_getEgFcSense." );
00892     RETURN( iBase_SUCCESS );
00893 }
00894 void FBiGeom_getEgFcArrSense( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
00895                               int**, int*, int*, int* err )
00896 {
00897     RETURN( iBase_NOT_SUPPORTED );
00898 }
00899 
00900 void FBiGeom_getEgVtxSense( FBiGeom_Instance instance, iBase_EntityHandle edge, iBase_EntityHandle vertex1,
00901                             iBase_EntityHandle vertex2, int* sense_out, int* err )
00902 {
00903 
00904     ErrorCode rval =
00905         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" );
00906     RETURN( iBase_SUCCESS );
00907 }
00908 void FBiGeom_getEgVtxArrSense( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*,
00909                                int, iBase_EntityHandle const*, int, int**, int*, int*, int* err )
00910 {
00911     RETURN( iBase_NOT_SUPPORTED );
00912 }
00913 
00914 void FBiGeom_measure( FBiGeom_Instance instance, iBase_EntityHandle const* entity_handles, int entity_handles_size,
00915                       double** measures, int* measures_allocated, int* measures_size, int* err )
00916 {
00917 
00918     CHECK_SIZE( *measures, *measures_allocated, entity_handles_size, double, NULL );
00919     ErrorCode rval = FBE_cast( instance )->measure( (EntityHandle*)( entity_handles ), entity_handles_size, *measures );CHKERR( rval, "Failed to get measures" );
00920     *measures_size = entity_handles_size;
00921     RETURN( iBase_SUCCESS );
00922 }
00923 
00924 void FBiGeom_getFaceType( FBiGeom_Instance instance, iBase_EntityHandle, char* face_type, int* err,
00925                           int* face_type_length )
00926 {
00927     std::string type = "nonplanar";  // for swept faces created with rays between surfaces,
00928                                      // we could actually create planar surfaces; maybe we should
00929                                      // recognize them as such
00930     face_type = new char[type.length() + 1];
00931     strcpy( face_type, type.c_str() );
00932     *face_type_length = type.length() + 1;
00933     RETURN( iBase_SUCCESS );
00934 }
00935 void FBiGeom_getParametric( FBiGeom_Instance instance, int* is_parametric, int* err )
00936 {
00937     *is_parametric = 0;  //(false)
00938     RETURN( iBase_SUCCESS );
00939 }
00940 void FBiGeom_isEntParametric( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, int* parametric, int* err )
00941 {
00942     int type = -1;
00943     FBiGeom_getEntType( instance, entity_handle, &type, err );
00944     if( type == 1 )
00945         *parametric = 1;  // true
00946     else
00947         *parametric = 0;  // false
00948     RETURN( iBase_SUCCESS );
00949 }
00950 void FBiGeom_isArrParametric( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int**, int*, int*, int* err )
00951 {
00952     // not implemented
00953     RETURN( iBase_NOT_SUPPORTED );
00954 }
00955 void FBiGeom_getEntUVtoXYZ( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double*, double*, double*,
00956                             int* err )
00957 {
00958     RETURN( iBase_NOT_SUPPORTED );
00959 }
00960 void FBiGeom_getArrUVtoXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
00961                             double**, int*, int*, int* err )
00962 {
00963     RETURN( iBase_NOT_SUPPORTED );
00964 }
00965 
00966 void FBiGeom_getEntUtoXYZ( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double* x, double* y,
00967                            double* z, int* err )
00968 {
00969     int type;
00970     FBiGeom_getEntType( instance, entity_handle, &type, err );
00971     FWDERR();
00972 
00973     if( type != 1 )  // not edge
00974         RETURN( iBase_NOT_SUPPORTED );
00975 
00976     ErrorCode rval = FBE_cast( instance )->getEntUtoXYZ( (EntityHandle)entity_handle, u, *x, *y, *z );CHKERR( rval, "Failed to get position from parameter" );
00977     RETURN( iBase_SUCCESS );
00978 }
00979 
00980 void FBiGeom_getArrUtoXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, double const*, int, int, double**,
00981                            int*, int*, int* err )
00982 {
00983     // not implemented
00984     RETURN( iBase_NOT_SUPPORTED );
00985 }
00986 void FBiGeom_getEntXYZtoUV( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
00987                             int* err )
00988 {
00989     RETURN( iBase_NOT_SUPPORTED );
00990 }
00991 void FBiGeom_getEntXYZtoU( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, int* err )
00992 {
00993     RETURN( iBase_NOT_SUPPORTED );
00994 }
00995 void FBiGeom_getArrXYZtoUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
00996                             double**, int*, int*, int* err )
00997 {
00998     RETURN( iBase_NOT_SUPPORTED );
00999 }
01000 void FBiGeom_getArrXYZtoU( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int, double**,
01001                            int*, int*, int* err )
01002 {
01003     RETURN( iBase_NOT_SUPPORTED );
01004 }
01005 void FBiGeom_getEntXYZtoUVHint( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
01006                                 int* err )
01007 {
01008     RETURN( iBase_NOT_SUPPORTED );
01009 }
01010 void FBiGeom_getArrXYZtoUVHint( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01011                                 double**, int*, int*, int* err )
01012 {
01013     RETURN( iBase_NOT_SUPPORTED );
01014 }
01015 void FBiGeom_getEntUVRange( FBiGeom_Instance instance, iBase_EntityHandle, double*, double*, double*, double*,
01016                             int* err )
01017 {
01018     RETURN( iBase_NOT_SUPPORTED );
01019 }
01020 
01021 void FBiGeom_getEntURange( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double* u_min, double* u_max,
01022                            int* err )
01023 {
01024     ErrorCode rval = FBE_cast( instance )->getEntURange( (EntityHandle)entity_handle, *u_min, *u_max );CHKERR( rval, "Failed to get range" );
01025     RETURN( iBase_SUCCESS );
01026 }
01027 void FBiGeom_getArrUVRange( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double**, int*, int*,
01028                             double**, int*, int*, int* err )
01029 {
01030     RETURN( iBase_NOT_SUPPORTED );
01031 }
01032 void FBiGeom_getArrURange( FBiGeom_Instance instance, iBase_EntityHandle const*, int, double**, int*, int*, double**,
01033                            int*, int*, int* err )
01034 {
01035     RETURN( iBase_NOT_SUPPORTED );
01036 }
01037 void FBiGeom_getEntUtoUV( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, double, double*, double*,
01038                           int* err )
01039 {
01040     RETURN( iBase_NOT_SUPPORTED );
01041 }
01042 void FBiGeom_getVtxToUV( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, double*, double*, int* err )
01043 {
01044     RETURN( iBase_NOT_SUPPORTED );
01045 }
01046 void FBiGeom_getVtxToU( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, double*, int* err )
01047 {
01048     RETURN( iBase_NOT_SUPPORTED );
01049 }
01050 void FBiGeom_getArrUtoUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
01051                           double const*, int, int, double**, int*, int*, int* err )
01052 {
01053     RETURN( iBase_NOT_SUPPORTED );
01054 }
01055 void FBiGeom_getVtxArrToUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
01056                             int, double**, int*, int*, int* err )
01057 {
01058     RETURN( iBase_NOT_SUPPORTED );
01059 }
01060 void FBiGeom_getVtxArrToU( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle const*, int,
01061                            double**, int*, int*, int* err )
01062 {
01063     RETURN( iBase_NOT_SUPPORTED );
01064 }
01065 void FBiGeom_getEntNrmlUV( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double*, double*, double*,
01066                            int* err )
01067 {
01068     RETURN( iBase_NOT_SUPPORTED );
01069 }
01070 void FBiGeom_getArrNrmlUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int, double**,
01071                            int*, int*, int* err )
01072 {
01073     RETURN( iBase_NOT_SUPPORTED );
01074 }
01075 void FBiGeom_getEntTgntU( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double* tgnt_i,
01076                           double* tgnt_j, double* tgnt_k, int* err )
01077 {
01078     ErrorCode rval =
01079         FBE_cast( instance )->getEntTgntU( (moab::EntityHandle)entity_handle, u, *tgnt_i, *tgnt_j, *tgnt_k );CHKERR( rval, "Failed to get tangent from u" );
01080     RETURN( iBase_SUCCESS );
01081 }
01082 void FBiGeom_getArrTgntU( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int, double**,
01083                           int*, int*, int* err )
01084 {
01085     RETURN( iBase_NOT_SUPPORTED );
01086 }
01087 void FBiGeom_getEnt1stDrvt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double**, int*, int*,
01088                             double**, int*, int*, int* err )
01089 {
01090     RETURN( iBase_NOT_SUPPORTED );
01091 }
01092 void FBiGeom_getArr1stDrvt( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01093                             double**, int*, int*, int**, int*, int*, double**, int*, int*, int**, int*, int*, int* err )
01094 {
01095     RETURN( iBase_NOT_SUPPORTED );
01096 }
01097 void FBiGeom_getEnt2ndDrvt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double**, int*, int*,
01098                             double**, int*, int*, double**, int*, int*, int* err )
01099 {
01100     RETURN( iBase_NOT_SUPPORTED );
01101 }
01102 void FBiGeom_getArr2ndDrvt( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01103                             double**, int*, int*, int**, int*, int*, double**, int*, int*, int**, int*, int*, double**,
01104                             int*, int*, int**, int*, int*, int* err )
01105 {
01106     RETURN( iBase_NOT_SUPPORTED );
01107 }
01108 void FBiGeom_getFcCvtrUV( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double*, double*, double*,
01109                           double*, double*, double*, int* err )
01110 {
01111     RETURN( iBase_NOT_SUPPORTED );
01112 }
01113 void FBiGeom_getFcArrCvtrUV( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01114                              double**, int*, int*, double**, int*, int*, int* err )
01115 {
01116     RETURN( iBase_NOT_SUPPORTED );
01117 }
01118 void FBiGeom_isEntPeriodic( FBiGeom_Instance /*instance*/, iBase_EntityHandle /*entity_handle*/, int* in_u, int* in_v,
01119                             int* err )
01120 {
01121     *in_u = 0;
01122     *in_v = 0;
01123     *err  = 0;
01124     return;
01125 }
01126 void FBiGeom_isArrPeriodic( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int**, int*, int*, int* err )
01127 {
01128     RETURN( iBase_NOT_SUPPORTED );
01129 }
01130 void FBiGeom_isFcDegenerate( FBiGeom_Instance instance, iBase_EntityHandle, int*, int* err )
01131 {
01132     RETURN( iBase_NOT_SUPPORTED );
01133 }
01134 void FBiGeom_isFcArrDegenerate( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int**, int*, int*, int* err )
01135 {
01136     RETURN( iBase_NOT_SUPPORTED );
01137 }
01138 
01139 void FBiGeom_initEntIter( FBiGeom_Instance instance, iBase_EntitySetHandle, int, iBase_EntityIterator*, int* err )
01140 {
01141     RETURN( iBase_NOT_SUPPORTED );
01142 }
01143 
01144 void FBiGeom_initEntArrIter( FBiGeom_Instance instance, iBase_EntitySetHandle, int, int, iBase_EntityArrIterator*,
01145                              int* err )
01146 {
01147     RETURN( iBase_NOT_SUPPORTED );
01148 }
01149 
01150 void FBiGeom_getNextEntIter( FBiGeom_Instance instance, iBase_EntityIterator, iBase_EntityHandle*, int*, int* err )
01151 {
01152     RETURN( iBase_NOT_SUPPORTED );
01153 }
01154 
01155 void FBiGeom_getNextEntArrIter( FBiGeom_Instance instance, iBase_EntityArrIterator, iBase_EntityHandle**, int*, int*,
01156                                 int*, int* err )
01157 {
01158     RETURN( iBase_NOT_SUPPORTED );
01159 }
01160 
01161 void FBiGeom_resetEntIter( FBiGeom_Instance instance, iBase_EntityIterator, int* err )
01162 {
01163     RETURN( iBase_NOT_SUPPORTED );
01164 }
01165 
01166 void FBiGeom_resetEntArrIter( FBiGeom_Instance instance, iBase_EntityArrIterator, int* err )
01167 {
01168     RETURN( iBase_NOT_SUPPORTED );
01169 }
01170 
01171 void FBiGeom_endEntIter( FBiGeom_Instance instance, iBase_EntityIterator, int* err )
01172 {
01173     RETURN( iBase_NOT_SUPPORTED );
01174 }
01175 
01176 void FBiGeom_endEntArrIter( FBiGeom_Instance instance, iBase_EntityArrIterator, int* err )
01177 {
01178     RETURN( iBase_NOT_SUPPORTED );
01179 }
01180 
01181 void FBiGeom_copyEnt( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle*, int* err )
01182 {
01183     RETURN( iBase_NOT_SUPPORTED );
01184 }
01185 
01186 void FBiGeom_sweepEntAboutAxis( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double,
01187                                 iBase_EntityHandle*, int* err )
01188 {
01189     RETURN( iBase_NOT_SUPPORTED );
01190 }
01191 
01192 void FBiGeom_deleteAll( FBiGeom_Instance instance, int* err )
01193 {
01194     // it means deleting some sets from moab db ; is this what we want?
01195     RETURN( iBase_NOT_SUPPORTED );
01196 }
01197 
01198 void FBiGeom_deleteEnt( FBiGeom_Instance instance, iBase_EntityHandle /*entity_handle*/, int* err )
01199 {
01200     RETURN( iBase_NOT_SUPPORTED );
01201 }
01202 
01203 void FBiGeom_createSphere( FBiGeom_Instance instance, double, iBase_EntityHandle*, int* err )
01204 {
01205     RETURN( iBase_NOT_SUPPORTED );
01206 }
01207 
01208 void FBiGeom_createPrism( FBiGeom_Instance instance, double, int, double, double, iBase_EntityHandle*, int* err )
01209 {
01210     RETURN( iBase_NOT_SUPPORTED );
01211 }
01212 
01213 void FBiGeom_createBrick( FBiGeom_Instance instance, double, double, double, iBase_EntityHandle*, int* err )
01214 {
01215     RETURN( iBase_NOT_SUPPORTED );
01216 }
01217 
01218 void FBiGeom_createCylinder( FBiGeom_Instance instance, double, double, double, iBase_EntityHandle*, int* err )
01219 {
01220     RETURN( iBase_NOT_SUPPORTED );
01221 }
01222 
01223 void FBiGeom_createCone( FBiGeom_Instance instance, double, double, double, double, iBase_EntityHandle*, int* err )
01224 {
01225     RETURN( iBase_NOT_SUPPORTED );
01226 }
01227 
01228 void FBiGeom_createTorus( FBiGeom_Instance instance, double, double, iBase_EntityHandle*, int* err )
01229 {
01230     RETURN( iBase_NOT_SUPPORTED );
01231 }
01232 
01233 void FBiGeom_moveEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, int* err )
01234 {
01235     RETURN( iBase_NOT_SUPPORTED );
01236 }
01237 
01238 void FBiGeom_rotateEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double, int* err )
01239 {
01240     RETURN( iBase_NOT_SUPPORTED );
01241 }
01242 
01243 void FBiGeom_reflectEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double, double, double,
01244                          int* err )
01245 {
01246     RETURN( iBase_NOT_SUPPORTED );
01247 }
01248 
01249 void FBiGeom_scaleEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double, double, double,
01250                        int* err )
01251 {
01252     RETURN( iBase_NOT_SUPPORTED );
01253 }
01254 
01255 void FBiGeom_uniteEnts( FBiGeom_Instance instance, iBase_EntityHandle const*, int, iBase_EntityHandle*, int* err )
01256 {
01257     RETURN( iBase_NOT_SUPPORTED );
01258 }
01259 
01260 void FBiGeom_subtractEnts( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, iBase_EntityHandle*,
01261                            int* err )
01262 {
01263     RETURN( iBase_NOT_SUPPORTED );
01264 }
01265 
01266 void FBiGeom_intersectEnts( FBiGeom_Instance instance, iBase_EntityHandle, iBase_EntityHandle, iBase_EntityHandle*,
01267                             int* err )
01268 {
01269     RETURN( iBase_NOT_SUPPORTED );
01270 }
01271 
01272 void FBiGeom_sectionEnt( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double, int,
01273                          iBase_EntityHandle*, int* err )
01274 {
01275     RETURN( iBase_NOT_SUPPORTED );
01276 }
01277 
01278 void FBiGeom_imprintEnts( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int* err )
01279 {
01280     RETURN( iBase_NOT_SUPPORTED );
01281 }
01282 
01283 void FBiGeom_mergeEnts( FBiGeom_Instance instance, iBase_EntityHandle const*, int, double, int* err )
01284 {
01285     RETURN( iBase_NOT_SUPPORTED );
01286 }
01287 // start copy old
01288 
01289 void FBiGeom_createEntSet( FBiGeom_Instance instance, int isList, iBase_EntitySetHandle* entity_set_created, int* err )
01290 {
01291     iMesh_createEntSet( IMESH_INSTANCE( instance ), isList, entity_set_created, err );
01292     FWDERR();
01293 }
01294 
01295 void FBiGeom_destroyEntSet( FBiGeom_Instance instance, iBase_EntitySetHandle, int* err )
01296 {
01297     RETURN( iBase_NOT_SUPPORTED );
01298 }
01299 
01300 void FBiGeom_isList( FBiGeom_Instance instance, iBase_EntitySetHandle, int*, int* err )
01301 {
01302     RETURN( iBase_NOT_SUPPORTED );
01303 }
01304 
01305 void FBiGeom_getNumEntSets( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle, int /*num_hops*/,
01306                             int* num_sets, int* err )
01307 {
01308     //  here, we get only the entity sets that have gents as members
01309     // we have the convention that entity sets of geom dimension 4 are
01310     // sets of geo entities; they should contain only gentities as elements (or other sets of gents)
01311     // we should also consider the number of hops
01312     // first, get all sets of geo dim 4 from the entity_set_handle; then intersect with
01313     // the range from geom topo tool
01314     Tag geomTag;
01315     ErrorCode rval = MBI->tag_get_handle( GEOM_DIMENSION_TAG_NAME, 1, MB_TYPE_INTEGER, geomTag );
01316     if( MB_SUCCESS != rval ) RETURN( iBase_FAILURE );
01317     GeomTopoTool* gtt   = GETGTT( instance );
01318     const Range* gRange = gtt->geoRanges();
01319     // get all sets of geom dimension 4 from the entity set
01320     EntityHandle moabSet         = (EntityHandle)entity_set_handle;
01321     const int four               = 4;
01322     const void* const four_val[] = { &four };
01323     Range tmp;
01324     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 " );
01325     tmp       = intersect( tmp, gRange[4] );
01326     *num_sets = tmp.size();  // ignore, for the time being, number of hops
01327 
01328     RETURN( iBase_SUCCESS );
01329 }
01330 
01331 void FBiGeom_getEntSets( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle, int,
01332                          iBase_EntitySetHandle** contained_set_handles, int* contained_set_handles_allocated,
01333                          int* contained_set_handles_size, int* err )
01334 {
01335     //  we get only the entity sets that have gents as members
01336     // we keep the convention that entity sets of geom dimension 4 are
01337     // sets of geo entities; they should contain only gentities as elements (or other sets of gents)
01338     Tag geomTag;
01339     ErrorCode rval = MBI->tag_get_handle( GEOM_DIMENSION_TAG_NAME, 1, MB_TYPE_INTEGER, geomTag );
01340     if( MB_SUCCESS != rval ) RETURN( iBase_FAILURE );
01341     GeomTopoTool* gtt   = GETGTT( instance );
01342     const Range* gRange = gtt->geoRanges();
01343     // get all sets of geom dimension 4 from the entity set
01344     EntityHandle moabSet         = (EntityHandle)entity_set_handle;
01345     const int four               = 4;
01346     const void* const four_val[] = { &four };
01347     Range tmp;
01348     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 " );
01349     tmp                         = intersect( tmp, gRange[4] );
01350     *contained_set_handles_size = tmp.size();
01351     CHECK_SIZE( *contained_set_handles, *contained_set_handles_allocated, *contained_set_handles_size,
01352                 iBase_EntitySetHandle, NULL );
01353     COPY_RANGE( tmp, *contained_set_handles );
01354 
01355     RETURN( iBase_SUCCESS );
01356 }
01357 
01358 void FBiGeom_addEntToSet( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_EntitySetHandle entity_set,
01359                           int* err )
01360 {
01361     iMesh_addEntToSet( IMESH_INSTANCE( instance ), entity_handle, entity_set, err );
01362 }
01363 
01364 void FBiGeom_rmvEntFromSet( FBiGeom_Instance instance, iBase_EntityHandle entity_handle,
01365                             iBase_EntitySetHandle entity_set, int* err )
01366 {
01367     iMesh_rmvEntFromSet( IMESH_INSTANCE( instance ), entity_handle, entity_set, err );
01368 }
01369 
01370 void FBiGeom_addEntArrToSet( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01371                              int entity_handles_size, iBase_EntitySetHandle entity_set, int* err )
01372 {
01373     iMesh_addEntArrToSet( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, entity_set, err );
01374 }
01375 
01376 void FBiGeom_rmvEntArrFromSet( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01377                                int entity_handles_size, iBase_EntitySetHandle entity_set, int* err )
01378 {
01379     iMesh_rmvEntArrFromSet( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, entity_set, err );
01380 }
01381 
01382 void FBiGeom_addEntSet( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_to_add,
01383                         iBase_EntitySetHandle entity_set_handle, int* err )
01384 {
01385     iMesh_addEntSet( IMESH_INSTANCE( instance ), entity_set_to_add, entity_set_handle, err );
01386 }
01387 
01388 void FBiGeom_rmvEntSet( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_to_remove,
01389                         iBase_EntitySetHandle entity_set_handle, int* err )
01390 {
01391     iMesh_rmvEntSet( IMESH_INSTANCE( instance ), entity_set_to_remove, entity_set_handle, err );
01392 }
01393 
01394 void FBiGeom_isEntContained( FBiGeom_Instance instance, iBase_EntitySetHandle containing_entity_set,
01395                              iBase_EntityHandle contained_entity, int* is_contained, int* err )
01396 {
01397     iMesh_isEntContained( IMESH_INSTANCE( instance ), containing_entity_set, contained_entity, is_contained, err );
01398 }
01399 
01400 void FBiGeom_isEntArrContained( FBiGeom_Instance instance, iBase_EntitySetHandle containing_set,
01401                                 const iBase_EntityHandle* entity_handles, int num_entity_handles, int** is_contained,
01402                                 int* is_contained_allocated, int* is_contained_size, int* err )
01403 {
01404     iMesh_isEntArrContained( IMESH_INSTANCE( instance ), containing_set, entity_handles, num_entity_handles,
01405                              is_contained, is_contained_allocated, is_contained_size, err );
01406 }
01407 
01408 void FBiGeom_isEntSetContained( FBiGeom_Instance instance, iBase_EntitySetHandle containing_entity_set,
01409                                 iBase_EntitySetHandle contained_entity_set, int* is_contained, int* err )
01410 {
01411     iMesh_isEntSetContained( IMESH_INSTANCE( instance ), containing_entity_set, contained_entity_set, is_contained,
01412                              err );
01413 }
01414 
01415 void FBiGeom_addPrntChld( FBiGeom_Instance instance, iBase_EntitySetHandle parent_entity_set,
01416                           iBase_EntitySetHandle child_entity_set, int* err )
01417 {
01418     iMesh_addPrntChld( IMESH_INSTANCE( instance ), parent_entity_set, child_entity_set, err );
01419 }
01420 
01421 void FBiGeom_rmvPrntChld( FBiGeom_Instance instance, iBase_EntitySetHandle parent_entity_set,
01422                           iBase_EntitySetHandle child_entity_set, int* err )
01423 {
01424     iMesh_rmvPrntChld( IMESH_INSTANCE( instance ), parent_entity_set, child_entity_set, err );
01425 }
01426 
01427 void FBiGeom_isChildOf( FBiGeom_Instance instance, iBase_EntitySetHandle parent_entity_set,
01428                         iBase_EntitySetHandle child_entity_set, int* is_child, int* err )
01429 {
01430     iMesh_isChildOf( IMESH_INSTANCE( instance ), parent_entity_set, child_entity_set, is_child, err );
01431 }
01432 
01433 void FBiGeom_getNumChld( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, int num_hops, int* num_child,
01434                          int* err )
01435 {
01436     iMesh_getNumChld( IMESH_INSTANCE( instance ), entity_set, num_hops, num_child, err );
01437 }
01438 
01439 void FBiGeom_getNumPrnt( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, int num_hops, int* num_parent,
01440                          int* err )
01441 {
01442     iMesh_getNumPrnt( IMESH_INSTANCE( instance ), entity_set, num_hops, num_parent, err );
01443 }
01444 
01445 void FBiGeom_getChldn( FBiGeom_Instance instance, iBase_EntitySetHandle from_entity_set, int num_hops,
01446                        iBase_EntitySetHandle** entity_set_handles, int* entity_set_handles_allocated,
01447                        int* entity_set_handles_size, int* err )
01448 {
01449     iMesh_getChldn( IMESH_INSTANCE( instance ), from_entity_set, num_hops, entity_set_handles,
01450                     entity_set_handles_allocated, entity_set_handles_size, err );
01451 }
01452 
01453 void FBiGeom_getPrnts( FBiGeom_Instance instance, iBase_EntitySetHandle from_entity_set, int num_hops,
01454                        iBase_EntitySetHandle** entity_set_handles, int* entity_set_handles_allocated,
01455                        int* entity_set_handles_size, int* err )
01456 {
01457     iMesh_getPrnts( IMESH_INSTANCE( instance ), from_entity_set, num_hops, entity_set_handles,
01458                     entity_set_handles_allocated, entity_set_handles_size, err );
01459 }
01460 
01461 void FBiGeom_createTag( FBiGeom_Instance instance, const char* tag_name, int tag_size, int tag_type,
01462                         iBase_TagHandle* tag_handle, int* err, int tag_name_len )
01463 {
01464 
01465     iMesh_createTag( IMESH_INSTANCE( instance ), tag_name, tag_size, tag_type, tag_handle, err, tag_name_len );
01466 }
01467 
01468 void FBiGeom_destroyTag( FBiGeom_Instance instance, iBase_TagHandle tag_handle, int, int* err )
01469 {
01470     ErrorCode rval = MBI->tag_delete( TAG_HANDLE( tag_handle ) );CHKERR( rval, "Failed to delete tag" );
01471     RETURN( iBase_SUCCESS );
01472 }
01473 
01474 void FBiGeom_getTagName( FBiGeom_Instance instance, iBase_TagHandle tag_handle, char* name, int* err, int name_len )
01475 {
01476     iMesh_getTagName( IMESH_INSTANCE( instance ), tag_handle, name, err, name_len );
01477 }
01478 
01479 void FBiGeom_getTagSizeValues( FBiGeom_Instance instance, iBase_TagHandle tag_handle, int* tag_size, int* err )
01480 {
01481     iMesh_getTagSizeValues( IMESH_INSTANCE( instance ), tag_handle, tag_size, err );
01482 }
01483 
01484 void FBiGeom_getTagSizeBytes( FBiGeom_Instance instance, iBase_TagHandle tag_handle, int* tag_size, int* err )
01485 {
01486     iMesh_getTagSizeBytes( IMESH_INSTANCE( instance ), tag_handle, tag_size, err );
01487 }
01488 
01489 void FBiGeom_getTagHandle( FBiGeom_Instance instance, const char* tag_name, iBase_TagHandle* tag_handle, int* err,
01490                            int tag_name_len )
01491 {
01492     iMesh_getTagHandle( IMESH_INSTANCE( instance ), tag_name, tag_handle, err, tag_name_len );
01493 }
01494 
01495 void FBiGeom_getTagType( FBiGeom_Instance instance, iBase_TagHandle tag_handle, int* tag_type, int* err )
01496 {
01497     iMesh_getTagType( IMESH_INSTANCE( instance ), tag_handle, tag_type, err );
01498 }
01499 
01500 void FBiGeom_setEntSetData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle,
01501                             iBase_TagHandle tag_handle, const void* tag_value, int tag_value_size, int* err )
01502 {
01503     iMesh_setEntSetData( IMESH_INSTANCE( instance ), entity_set_handle, tag_handle, tag_value, tag_value_size, err );
01504 }
01505 
01506 void FBiGeom_setEntSetIntData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01507                                int tag_value, int* err )
01508 {
01509     iMesh_setEntSetIntData( IMESH_INSTANCE( instance ), entity_set, tag_handle, tag_value, err );
01510 }
01511 
01512 void FBiGeom_setEntSetDblData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01513                                double tag_value, int* err )
01514 {
01515     iMesh_setEntSetDblData( IMESH_INSTANCE( instance ), entity_set, tag_handle, tag_value, err );
01516 }
01517 
01518 void FBiGeom_setEntSetEHData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01519                               iBase_EntityHandle tag_value, int* err )
01520 {
01521     iMesh_setEntSetEHData( IMESH_INSTANCE( instance ), entity_set, tag_handle, tag_value, err );
01522 }
01523 
01524 void FBiGeom_setEntSetESHData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01525                                iBase_EntitySetHandle tag_value, int* err )
01526 {
01527     iMesh_setEntSetESHData( IMESH_INSTANCE( instance ), entity_set, tag_handle, tag_value, err );
01528 }
01529 
01530 void FBiGeom_getEntSetData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle,
01531                             iBase_TagHandle tag_handle, void** tag_value, int* tag_value_allocated, int* tag_value_size,
01532                             int* err )
01533 {
01534     iMesh_getEntSetData( IMESH_INSTANCE( instance ), entity_set_handle, tag_handle, tag_value, tag_value_allocated,
01535                          tag_value_size, err );
01536 }
01537 
01538 void FBiGeom_getEntSetIntData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01539                                int* out_data, int* err )
01540 {
01541     iMesh_getEntSetIntData( IMESH_INSTANCE( instance ), entity_set, tag_handle, out_data, err );
01542 }
01543 
01544 void FBiGeom_getEntSetDblData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01545                                double* out_data, int* err )
01546 {
01547     iMesh_getEntSetDblData( IMESH_INSTANCE( instance ), entity_set, tag_handle, out_data, err );
01548 }
01549 
01550 void FBiGeom_getEntSetEHData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01551                               iBase_EntityHandle* out_data, int* err )
01552 {
01553     iMesh_getEntSetEHData( IMESH_INSTANCE( instance ), entity_set, tag_handle, out_data, err );
01554 }
01555 
01556 void FBiGeom_getEntSetESHData( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle,
01557                                iBase_EntitySetHandle* out_data, int* err )
01558 {
01559     iMesh_getEntSetESHData( IMESH_INSTANCE( instance ), entity_set, tag_handle, out_data, err );
01560 }
01561 
01562 void FBiGeom_getAllEntSetTags( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle,
01563                                iBase_TagHandle** tag_handles, int* tag_handles_allocated, int* tag_handles_size,
01564                                int* err )
01565 {
01566     iMesh_getAllEntSetTags( IMESH_INSTANCE( instance ), entity_set_handle, tag_handles, tag_handles_allocated,
01567                             tag_handles_size, err );
01568 }
01569 
01570 void FBiGeom_rmvEntSetTag( FBiGeom_Instance instance, iBase_EntitySetHandle entity_set_handle,
01571                            iBase_TagHandle tag_handle, int* err )
01572 {
01573     iMesh_rmvEntSetTag( IMESH_INSTANCE( instance ), entity_set_handle, tag_handle, err );
01574 }
01575 
01576 void FBiGeom_getArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01577                          iBase_TagHandle tag_handle, void** tag_values, int* tag_values_allocated, int* tag_values_size,
01578                          int* err )
01579 {
01580     iMesh_getArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01581                       tag_values_allocated, tag_values_size, err );
01582 }
01583 
01584 void FBiGeom_getIntArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01585                             int entity_handles_size, iBase_TagHandle tag_handle, int** tag_values,
01586                             int* tag_values_allocated, int* tag_values_size, int* err )
01587 {
01588     iMesh_getIntArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01589                          tag_values_allocated, tag_values_size, err );
01590 }
01591 
01592 void FBiGeom_getDblArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01593                             int entity_handles_size, iBase_TagHandle tag_handle, double** tag_values,
01594                             int* tag_values_allocated, int* tag_values_size, int* err )
01595 {
01596     iMesh_getDblArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01597                          tag_values_allocated, tag_values_size, err );
01598 }
01599 
01600 void FBiGeom_getEHArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01601                            iBase_TagHandle tag_handle, iBase_EntityHandle** tag_value, int* tag_value_allocated,
01602                            int* tag_value_size, int* err )
01603 {
01604     iMesh_getEHArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_value,
01605                         tag_value_allocated, tag_value_size, err );
01606 }
01607 
01608 void FBiGeom_getESHArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01609                             int entity_handles_size, iBase_TagHandle tag_handle, iBase_EntitySetHandle** tag_value,
01610                             int* tag_value_allocated, int* tag_value_size, int* err )
01611 {
01612     iMesh_getESHArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_value,
01613                          tag_value_allocated, tag_value_size, err );
01614 }
01615 
01616 void FBiGeom_setArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01617                          iBase_TagHandle tag_handle, const void* tag_values, int tag_values_size, int* err )
01618 {
01619     iMesh_setArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01620                       tag_values_size, err );
01621 }
01622 
01623 void FBiGeom_setIntArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01624                             int entity_handles_size, iBase_TagHandle tag_handle, const int* tag_values,
01625                             int tag_values_size, int* err )
01626 {
01627     iMesh_setIntArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01628                          tag_values_size, err );
01629 }
01630 
01631 void FBiGeom_setDblArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01632                             int entity_handles_size, iBase_TagHandle tag_handle, const double* tag_values,
01633                             const int tag_values_size, int* err )
01634 {
01635     iMesh_setDblArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01636                          tag_values_size, err );
01637 }
01638 
01639 void FBiGeom_setEHArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01640                            iBase_TagHandle tag_handle, const iBase_EntityHandle* tag_values, int tag_values_size,
01641                            int* err )
01642 {
01643     iMesh_setEHArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01644                         tag_values_size, err );
01645 }
01646 
01647 void FBiGeom_setESHArrData( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles,
01648                             int entity_handles_size, iBase_TagHandle tag_handle,
01649                             const iBase_EntitySetHandle* tag_values, int tag_values_size, int* err )
01650 {
01651     iMesh_setESHArrData( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, tag_values,
01652                          tag_values_size, err );
01653 }
01654 
01655 void FBiGeom_rmvArrTag( FBiGeom_Instance instance, const iBase_EntityHandle* entity_handles, int entity_handles_size,
01656                         iBase_TagHandle tag_handle, int* err )
01657 {
01658     iMesh_rmvArrTag( IMESH_INSTANCE( instance ), entity_handles, entity_handles_size, tag_handle, err );
01659 }
01660 
01661 void FBiGeom_getData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01662                       void** tag_value, int* tag_value_allocated, int* tag_value_size, int* err )
01663 {
01664     iMesh_getData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, tag_value_allocated,
01665                    tag_value_size, err );
01666 }
01667 
01668 void FBiGeom_getIntData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01669                          int* out_data, int* err )
01670 {
01671     iMesh_getIntData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, out_data, err );
01672 }
01673 
01674 void FBiGeom_getDblData( FBiGeom_Instance instance, const iBase_EntityHandle entity_handle,
01675                          const iBase_TagHandle tag_handle, double* out_data, int* err )
01676 {
01677     iMesh_getDblData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, out_data, err );
01678 }
01679 
01680 void FBiGeom_getEHData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01681                         iBase_EntityHandle* out_data, int* err )
01682 {
01683     iMesh_getEHData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, out_data, err );
01684 }
01685 
01686 void FBiGeom_getESHData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01687                          iBase_EntitySetHandle* out_data, int* err )
01688 {
01689     iMesh_getESHData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, out_data, err );
01690 }
01691 
01692 void FBiGeom_setData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01693                       const void* tag_value, int tag_value_size, int* err )
01694 {
01695     iMesh_setData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, tag_value_size, err );
01696 }
01697 
01698 void FBiGeom_setIntData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01699                          int tag_value, int* err )
01700 {
01701     iMesh_setIntData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, err );
01702 }
01703 
01704 void FBiGeom_setDblData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01705                          double tag_value, int* err )
01706 {
01707     iMesh_setDblData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, err );
01708 }
01709 
01710 void FBiGeom_setEHData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01711                         iBase_EntityHandle tag_value, int* err )
01712 {
01713     iMesh_setEHData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, err );
01714 }
01715 
01716 void FBiGeom_setESHData( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle,
01717                          iBase_EntitySetHandle tag_value, int* err )
01718 {
01719     iMesh_setESHData( IMESH_INSTANCE( instance ), entity_handle, tag_handle, tag_value, err );
01720 }
01721 
01722 void FBiGeom_getAllTags( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle** tag_handles,
01723                          int* tag_handles_allocated, int* tag_handles_size, int* err )
01724 {
01725     iMesh_getAllTags( IMESH_INSTANCE( instance ), entity_handle, tag_handles, tag_handles_allocated, tag_handles_size,
01726                       err );
01727 }
01728 
01729 void FBiGeom_rmvTag( FBiGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, int* err )
01730 {
01731     iMesh_rmvTag( IMESH_INSTANCE( instance ), entity_handle, tag_handle, err );
01732 }
01733 
01734 void FBiGeom_subtract( FBiGeom_Instance instance, iBase_EntitySetHandle, iBase_EntitySetHandle, iBase_EntitySetHandle*,
01735                        int* err )
01736 {
01737     RETURN( iBase_NOT_SUPPORTED );
01738 }
01739 
01740 void FBiGeom_intersect( FBiGeom_Instance instance, iBase_EntitySetHandle, iBase_EntitySetHandle, iBase_EntitySetHandle*,
01741                         int* err )
01742 {
01743     RETURN( iBase_NOT_SUPPORTED );
01744 }
01745 
01746 void FBiGeom_unite( FBiGeom_Instance instance, iBase_EntitySetHandle, iBase_EntitySetHandle, iBase_EntitySetHandle*,
01747                     int* err )
01748 {
01749     RETURN( iBase_NOT_SUPPORTED );
01750 }
01751 
01752 // TODO methods not yet implemented
01753 void FBiGeom_getEntClosestPtTrimmed( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*,
01754                                      double*, double*, int* err )
01755 {
01756     RETURN( iBase_NOT_SUPPORTED );
01757 }
01758 
01759 void FBiGeom_getFcCvtrXYZ( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
01760                            double*, double*, double*, double*, int* err )
01761 {
01762     RETURN( iBase_NOT_SUPPORTED );
01763 }
01764 
01765 void FBiGeom_getEgCvtrXYZ( FBiGeom_Instance instance, iBase_EntityHandle, double, double, double, double*, double*,
01766                            double*, int* err )
01767 {
01768     RETURN( iBase_NOT_SUPPORTED );
01769 }
01770 
01771 void FBiGeom_getEntArrCvtrXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01772                                double**, int*, int*, double**, int*, int*, int* err )
01773 {
01774     RETURN( iBase_NOT_SUPPORTED );
01775 }
01776 
01777 void FBiGeom_getEgEvalXYZ( FBiGeom_Instance instance, iBase_EntityHandle edge, double x, double y, double z,
01778                            double* on_x, double* on_y, double* on_z, double* tngt_i, double* tngt_j, double* tngt_k,
01779                            double* cvtr_i, double* cvtr_j, double* cvtr_k, int* err )
01780 {
01781     ErrorCode rval = FBE_cast( instance )
01782                          ->getEgEvalXYZ( (moab::EntityHandle)edge, x, y, z, *on_x, *on_y, *on_z, *tngt_i, *tngt_j,
01783                                          *tngt_k, *cvtr_i, *cvtr_j, *cvtr_k );CHKERR( rval, "can't get point on edge " );
01784     RETURN( iBase_SUCCESS );
01785 }
01786 
01787 void FBiGeom_getFcEvalXYZ( FBiGeom_Instance instance, iBase_EntityHandle face_handle, double x, double y, double z,
01788                            double* on_x, double* on_y, double* on_z, double* nrml_i, double* nrml_j, double* nrml_k,
01789                            double* cvtr1_i, double* cvtr1_j, double* cvtr1_k, double* cvtr2_i, double* cvtr2_j,
01790                            double* cvtr2_k, int* err )
01791 {
01792     /*
01793       moab::ErrorCode rval = _fbEngine->getFcEvalXYZ( (moab::EntityHandle) face,
01794       x,  y, z,
01795       on_x, on_y, on_z,
01796       nrml_i, nrml_j, nrml_k,
01797       cvtr1_i, cvtr1_j, cvtr1_k,
01798       cvtr2_i, cvtr2_j,  cvtr2_k );*/
01799     // camal really does not use curvatures
01800     // the most it is calling for normals and for closest point
01801     // return all curvatures = 0 for the time being, because we
01802     // know camal is not requesting them
01803 
01804     *cvtr1_i = *cvtr1_j = *cvtr1_k = *cvtr2_i = *cvtr2_j = *cvtr2_k = 0.;
01805     // first get closest point, then normal, separately
01806     ErrorCode rval =
01807         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 " );
01808     rval = FBE_cast( instance )
01809                ->getEntNrmlXYZ( (moab::EntityHandle)face_handle, x, y, z, nrml_i, nrml_j,
01810                                 nrml_k );  // some inconsistency here, we use pointers, not refs
01811     CHKERR( rval, "can't get normal on closest point on surface " );
01812     RETURN( iBase_SUCCESS );
01813 }
01814 
01815 void FBiGeom_getArrEgEvalXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01816                               double**, int*, int*, double**, int*, int*, double**, int*, int*, int* err )
01817 {
01818     RETURN( iBase_NOT_SUPPORTED );
01819 }
01820 
01821 void FBiGeom_getArrFcEvalXYZ( FBiGeom_Instance instance, iBase_EntityHandle const*, int, int, double const*, int,
01822                               double**, int*, int*, double**, int*, int*, double**, int*, int*, double**, int*, int*,
01823                               int* err )
01824 {
01825     RETURN( iBase_NOT_SUPPORTED );
01826 }
01827 
01828 void FBiGeom_getPntClsf( FBiGeom_Instance instance, double, double, double, iBase_EntityHandle*, int* err )
01829 {
01830     RETURN( iBase_NOT_SUPPORTED );
01831 }
01832 
01833 void FBiGeom_getPntArrClsf( FBiGeom_Instance instance, int, double const*, int, iBase_EntityHandle**, int*, int*,
01834                             int* err )
01835 {
01836     RETURN( iBase_NOT_SUPPORTED );
01837 }
01838 
01839 void FBiGeom_getFacets( FBiGeom_Instance instance, iBase_EntityHandle, double, double, int, int, int, int, int,
01840                         int* err )
01841 {
01842     RETURN( iBase_NOT_SUPPORTED );
01843 }
01844 
01845 void FBiGeom_getEntTolerance( FBiGeom_Instance instance, iBase_EntityHandle, double*, int* err )
01846 {
01847     RETURN( iBase_NOT_SUPPORTED );
01848 }
01849 void FBiGeom_getArrTolerance( FBiGeom_Instance instance, iBase_EntityHandle const*, int, double**, int*, int*,
01850                               int* err )
01851 {
01852     RETURN( iBase_NOT_SUPPORTED );
01853 }
01854 void FBiGeom_getTolerance( FBiGeom_Instance instance, int*, double*, int* err )
01855 {
01856     RETURN( iBase_NOT_SUPPORTED );
01857 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines