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