MeshKit  1.0
iGeom.hpp
Go to the documentation of this file.
00001 #ifndef MESHKIT_ITAPS_GEOM_HPP
00002 #define MESHKIT_ITAPS_GEOM_HPP
00003 
00007 #include "iGeom.h"
00008 #include "iRel.hpp"
00009 
00010 #include <string.h>
00011 #include <stdlib.h>
00012 #include <vector>
00013 #include <limits>
00014 #include <string>
00015 
00029 class iGeom {
00030         protected:
00031                 iGeom_Instance mInstance;
00032         public:
00033         virtual inline iRel::IfaceType iface_type() const {
00034             return iRel::IGEOM_IFACE;
00035         }
00036 
00037                 typedef iBase_EntitySetHandle EntitySetHandle;
00038                 typedef iBase_EntityHandle EntityHandle;
00039                 typedef iBase_TagHandle TagHandle;
00040                 typedef iBase_ErrorType Error;
00041                 typedef iBase_EntityType EntityType;
00042                 typedef iBase_StorageOrder StorageOrder;
00043                 typedef iBase_TagValueType TagValueType;
00044 
00045                 inline iGeom(const char* options = 0);
00046                 inline iGeom(iGeom_Instance instance);
00047 
00048                 inline iGeom(bool meshBased);
00049 
00050                 virtual inline ~iGeom();
00051 
00052                 virtual inline Error load(const char* file_name, const char* options = 0);
00053 
00054                 virtual inline Error save(const char* file_name, const char* options = 0);
00055 
00056                 virtual inline Error getBoundBox(double& min_x, double& min_y, double& min_z,
00057                                 double& max_x, double& max_y, double& max_z) const;
00058 
00059                 virtual inline int getParametric();
00060 
00061                 virtual inline Error getNumOfType(EntitySetHandle set, EntityType type,
00062                                 int& count_out) const;
00063 
00064                 virtual inline Error getEntities(EntitySetHandle set, EntityType type,
00065                                 std::vector<EntityHandle>& entities_out) const;
00066 
00067                 virtual inline Error getEntType(EntityHandle handle, EntityType& type_out) const;
00068 
00069                 virtual inline Error getArrType(const EntityHandle* entity_handles,
00070                                 int entity_handles_Size, EntityType* types_out) const;
00071 
00072                 virtual inline Error getEntAdj(EntityHandle handle,
00073                                 EntityType type_requested, std::vector<EntityHandle>& adj_entities_out) const;
00074 
00075                 virtual inline Error getArrAdj(const EntityHandle* entity_handles,
00076                                 int entity_handles_size, EntityType type_requested, std::vector<
00077                                 EntityHandle>& adjacent_entity_handles_out, int* offsets_out) const;
00078 
00079                 virtual inline Error getEnt2ndAdj(EntityHandle handle,
00080                                 EntityType bridge_dimension, EntityType type_requested, std::vector<
00081                                 EntityHandle>& adj_entities_out) const;
00082 
00083                 virtual inline Error getArr2ndAdj(const EntityHandle* entity_handles,
00084                                 int entity_handles_size, EntityType order_adjacent_key,
00085                                 EntityType type_requested,
00086                                 std::vector<EntityHandle>& adjacent_entity_handles_out, int* offsets_out) const;
00087 
00088                 virtual inline Error isEntAdj(EntityHandle entity1, EntityHandle entity2,
00089                                 bool& adjacent_out) const;
00090 
00091                 virtual inline Error isArrAdj(const EntityHandle* entities1,
00092                                 const EntityHandle* entities2, int num_entity_pairs, int* is_adj_out) const;
00093 
00094                 virtual inline Error getEntClosestPt(EntityHandle entity, double near_x,
00095                                 double near_y, double near_z, double& on_x, double& on_y, double& on_z) const;
00096 
00097                 virtual inline Error getEntClosestPtTrimmed(EntityHandle entity, double near_x,
00098                                 double near_y, double near_z, double& on_x, double& on_y, double& on_z) const;
00099 
00100                 virtual inline Error getArrClosestPt(const EntityHandle* handles,
00101                                 int handles_size, StorageOrder order, const double* near_coordinates,
00102                                 int near_coordinates_size, double* on_coordinates) const;
00103 
00104                 virtual inline Error getEntNrmlXYZ(EntityHandle entity, double x, double y,
00105                                 double z, double& i, double& j, double& k) const;
00106 
00107                 virtual inline Error getArrNrmlXYZ(const EntityHandle* entities,
00108                                 int entities_size, StorageOrder order, const double* xyz, int xyz_size,
00109                                 double* ijk) const;
00110 
00111                 virtual inline Error getEntNrmlPlXYZ(EntityHandle entity, double x, double y,
00112                                 double z, double& on_x, double& on_y, double& on_z, double& i, double& j,
00113                                 double& k) const;
00114 
00115                 virtual inline Error getArrNrmlPlXYZ(const EntityHandle* entities,
00116                                 int entities_size, StorageOrder order, const double* near_xyz,
00117                                 int near_xyz_size, double* on_xyz, double* nrml_ijk) const;
00118 
00119                 virtual inline Error getEntTgntXYZ(EntityHandle entity, double x, double y,
00120                                 double z, double& i, double& j, double& k) const;
00121 
00122                 virtual inline Error getArrTgntXYZ(const EntityHandle* entities,
00123                                 int entities_size, StorageOrder order, const double* xyz, int xyz_size,
00124                                 double* ijk) const;
00125 
00126                 virtual inline Error getFcCvtrXYZ(EntityHandle face, double x, double y,
00127                                 double z, double& i1, double& j1, double& k1, double& i2, double& j2,
00128                                 double& k2) const;
00129 
00130                 virtual inline Error getEgCvtrXYZ(EntityHandle edge, double x, double y,
00131                                 double z, double& i, double& j, double& k) const;
00132 
00133                 virtual inline Error getEntArrCvtrXYZ(const EntityHandle* entities,
00134                                 int entities_size, StorageOrder order, const double* xyz, int xyz_size,
00135                                 double* cvtr_1, double* cvtr_2) const;
00136 
00137                 virtual inline Error getEgEvalXYZ(EntityHandle edge, double x, double y,
00138                                 double z, double& on_x, double& on_y, double& on_z, double& tngt_i,
00139                                 double& tngt_j, double& tngt_k, double& cvtr_i, double& cvtr_j,
00140                                 double& cvtr_k) const;
00141 
00142                 virtual inline Error getFcEvalXYZ(EntityHandle face, double x, double y,
00143                                 double z, double& on_x, double& on_y, double& on_z, double& nrml_i,
00144                                 double& nrml_j, double& nrml_k, double& cvtr1_i, double& cvtr1_j,
00145                                 double& cvtr1_k, double& cvtr2_i, double& cvtr2_j, double& cvtr2_k) const;
00146 
00147                 virtual inline Error getArrEgEvalXYZ(const EntityHandle* edges,
00148                                 int edges_size, StorageOrder order, const double* near_coords,
00149                                 int near_coords_size, double* on_coords, double* tangent,
00150                                 double* curvature) const;
00151 
00152                 virtual inline Error getArrFcEvalXYZ(const EntityHandle* faces,
00153                                 int faces_size, StorageOrder order, const double* near_coords,
00154                                 int near_coords_size, double* on_coords, double* normal,
00155                                 double* curvature1, double* curvature2) const;
00156 
00157                 virtual inline Error
00158                         getEntBoundBox(EntityHandle entity, double& min_x, double& min_y,
00159                                         double& min_z, double& max_x, double& max_y, double& max_z) const;
00160 
00161                 virtual inline Error getArrBoundBox(const EntityHandle* entities,
00162                                 int entities_size, StorageOrder order, double* min_corners,
00163                                 double* max_corners) const;
00164 
00165                 virtual inline Error getVtxCoord(EntityHandle vertex, double& x, double& y,
00166                                 double& z) const;
00167 
00168                 virtual inline Error getVtxArrCoords(const EntityHandle* vertices,
00169                                 int vertices_size, StorageOrder order, double* coords) const;
00170 
00171                 virtual inline Error getPntRayIntsct(double x, double y, double z, double i,
00172                                 double j, double k, StorageOrder order,
00173                                 std::vector<EntityHandle>& entities_out, std::vector<double>& points_out,
00174                                 std::vector<double>& params_out) const;
00175 
00176                 virtual inline Error getPntClsf(double x, double y, double z,
00177                                 EntityHandle& handle_out)const;
00178 
00179                 virtual inline Error getPntArrClsf(StorageOrder order, const double* coords,
00180                                 int coords_size, EntityHandle* entities_out) const;
00181 
00182                 virtual inline Error getEntNrmlSense(EntityHandle face, EntityHandle region,
00183                                 int& sense) const;
00184 
00185                 virtual inline Error getEgFcSense(EntityHandle edge, EntityHandle face,
00186                                 int& sense) const;
00187 
00188                 virtual inline Error getEgVtxSense(EntityHandle edge, EntityHandle vtx1,
00189                                 EntityHandle vtx2, int& sense) const;
00190 
00191                 virtual inline Error getArrNrmlSense(const EntityHandle* faces,
00192                                 int faces_size, const EntityHandle* vols, int vols_size, int* senses_out)const;
00193 
00194                 virtual inline Error getEgFcArrSense(const EntityHandle* edges,
00195                                 int edges_size, const EntityHandle* faces, int faces_size,
00196                                 int* senses_out) const;
00197 
00198                 virtual inline Error getEgVtxArrSense(const EntityHandle* edges,
00199                                 int edges_size, const EntityHandle* vertices1, int vertices1_size,
00200                                 const EntityHandle* vertices2, int vertices2_size, int* senses_out) const;
00201 
00202                 virtual inline Error getSense(EntityHandle ent, EntityHandle wrt_ent,
00203                                 int &sense) const;
00204 
00205                 virtual inline Error getArrSense(const EntityHandle *ent, int num_ents,
00206                                 EntityHandle wrt_ent, int *sense) const;
00207 
00208                 virtual inline Error measure(const EntityHandle* entities, int entities_size,
00209                                 double* measures) const;
00210 
00211                 virtual inline Error getFaceType(EntityHandle face, std::string& type) const;
00212 
00213                 virtual inline Error isEntParametric(EntityHandle entity, bool& parametric) const;
00214 
00215                 virtual inline Error isArrParametric(const EntityHandle* entities,
00216                                 int entities_size, int* is_parametric) const;
00217 
00218                 virtual inline Error getEntUVtoXYZ(EntityHandle face, double u, double v,
00219                                 double& x, double& y, double& z) const;
00220 
00221                 virtual inline Error getEntUtoXYZ(EntityHandle edge, double u, double& x,
00222                                 double& y, double& z) const;
00223 
00224                 virtual inline Error getArrUVtoXYZ(const EntityHandle* faces, int faces_size,
00225                                 StorageOrder order, const double* uv, int uv_size, double* xyz) const;
00226 
00227                 virtual inline Error getArrUtoXYZ(const EntityHandle* edges, int edges_size,
00228                                 const double* u, int u_size, StorageOrder order, double* xyz) const;
00229 
00230                 virtual inline Error getEntXYZtoUV(EntityHandle face, double x, double y,
00231                                 double z, double& u, double& v) const;
00232 
00233                 virtual inline Error getEntXYZtoU(EntityHandle edge, double x, double y,
00234                                 double z, double& u) const;
00235 
00236                 virtual inline Error getArrXYZtoUV(const EntityHandle* faces, int faces_size,
00237                                 StorageOrder order, const double* coords, int coords_size, double* uv) const;
00238 
00239                 virtual inline Error getArrXYZtoU(const EntityHandle* edges, int edges_size,
00240                                 StorageOrder order, const double* coords, int coords_size, double* u) const;
00241 
00242                 virtual inline Error getEntXYZtoUVHint(EntityHandle face, double x, double y,
00243                                 double z, double& u, double& v) const;
00244 
00245                 virtual inline Error getArrXYZtoUVHint(const EntityHandle* faces,
00246                                 int faces_size, StorageOrder order, const double* coords,
00247                                 int coords_size, double* uv) const;
00248 
00249                 virtual inline Error getEntNrmlUV(EntityHandle face, double u, double v,
00250                                 double& i, double& j, double& k) const;
00251 
00252                 virtual inline Error getArrNrmlUV(const EntityHandle* faces, int faces_size,
00253                                 StorageOrder order, const double* uv, int uv_size, double* normals) const;
00254 
00255                 virtual inline Error getEntTgntU(EntityHandle edge, double u, double& i,
00256                                 double& j, double& k) const;
00257 
00258                 virtual inline Error getArrTgntU(const EntityHandle* edges, int edges_size,
00259                                 StorageOrder order, const double* u, int u_size, double* normals) const;
00260 
00261                 virtual inline Error getEnt1stDrvt(EntityHandle handle, double u, double v,
00262                                 double& du_i, double& du_j, double& du_k, double& dv_i, double& dv_j,
00263                                 double& dv_k) const;
00264                 virtual inline Error
00265                         getEnt2ndDrvt(EntityHandle handle, double u, double v, double& duu_i,
00266                                         double& duu_j, double& duu_k, double& dvv_i, double& dvv_j,
00267                                         double& dvv_k, double& duv_i, double& duv_j, double& duv_k) const;
00268 
00269                 virtual inline Error getArr1stDrvt(const EntityHandle* entities,
00270                                 int entities_size, StorageOrder order, const double* uv, int uv_size,
00271                                 double* dvtr_u, double* dvtr_v) const;
00272 
00273                 virtual inline Error getArr2ndDrvt(const EntityHandle* entities,
00274                                 int entities_size, StorageOrder order, const double* uv, int uv_size,
00275                                 double* dvtr_uu, double* dvtr_vv, double* dvtr_uv) const;
00276 
00277                 virtual inline Error getFcCvtrUV(EntityHandle face, double u, double v,
00278                                 double& i1, double& j1, double& k1, double& i2, double& j2, double& k2) const;
00279 
00280                 virtual inline Error getFcArrCvtrUV(const EntityHandle* faces,
00281                                 int faces_size, StorageOrder order, const double* uv, int uv_size,
00282                                 double* cvtr1, double* cvtr2) const;
00283 
00284                 virtual inline Error isEntPeriodic(EntityHandle entity, bool& in_u,
00285                                 bool& in_v) const;
00286 
00287                 virtual inline Error isArrPeriodic(const EntityHandle* entities,
00288                                 int entities_size, int* in_uv) const;
00289 
00290                 virtual inline Error isFcDegenerate(EntityHandle face, bool& is_degenerate) const;
00291 
00292                 virtual inline Error isFcArrDegenerate(const EntityHandle* faces,
00293                                 int faces_size, int* degenerate) const;
00294 
00295                 virtual inline Error getTolerance(int& type_out, double& tolerance_out) const;
00296                 virtual inline Error getEntTolerance(EntityHandle entity, double& tolerance) const;
00297                 virtual inline Error getArrTolerance(const EntityHandle* entities,
00298                                 int entities_size, double* tolerances) const;
00299 
00300                 virtual inline Error getEntUVRange(EntityHandle face, double& u_min,
00301                                 double& v_min, double& u_max, double& v_max) const;
00302                 virtual inline Error getEntURange(EntityHandle edge, double& u_min,
00303                                 double& u_max) const;
00304                 virtual inline Error getArrUVRange(const EntityHandle* faces, int faces_size,
00305                                 StorageOrder order, double* uv_min, double* uv_max) const;
00306                 virtual inline Error getArrURange(const EntityHandle* edges, int edges_size,
00307                                 double* u_min, double* u_max) const;
00308 
00309                 virtual inline Error getEntUtoUV(EntityHandle edge, EntityHandle face,
00310                                 double edge_u, double& face_u, double& face_v) const;
00311                 virtual inline Error getVtxToUV(EntityHandle vertex, EntityHandle face,
00312                                 double& u, double& v) const;
00313                 virtual inline Error getVtxToU(EntityHandle vertex, EntityHandle edge,
00314                                 double& u) const;
00315                 virtual inline Error getArrUtoUV(const EntityHandle* edges, int edges_size,
00316                                 const EntityHandle* faces, int faces_size, const double* edge_u,
00317                                 int edge_u_size, StorageOrder order, double* face_uv) const;
00318                 virtual inline Error getVtxArrToUV(const EntityHandle* vertices,
00319                                 int vertices_size, const EntityHandle* faces, int faces_size,
00320                                 StorageOrder order, double* face_uv) const;
00321                 virtual inline Error getVtxArrToU(const EntityHandle* vertices,
00322                                 int vertices_size, const EntityHandle* edges, int edges_size,
00323                                 double* edge_u) const;
00324 
00325                 virtual inline Error deleteAll();
00326 
00327                 virtual inline Error deleteEnt(EntityHandle entity);
00328 
00329                 virtual inline Error copyEnt(EntityHandle source, EntityHandle& copy);
00330 
00331                 virtual inline Error createSphere(double radius, EntityHandle& sphere);
00332                 virtual inline Error createPrism(double height, int num_sides,
00333                                 double maj_radius, double min_radius, EntityHandle& prism);
00334                 virtual inline Error createBrick(double x, double y, double z,
00335                                 EntityHandle& brick);
00336                 virtual inline Error createCylinder(double height, double maj_rad,
00337                                 double min_rad, EntityHandle& cylinder);
00338                 virtual inline Error createCone(double height, double maj_rad,
00339                                 double min_rad, double top_rad, EntityHandle& cone);
00340                 virtual inline Error createTorus(double maj_rad, double min_rad,
00341                                 EntityHandle& torus);
00342 
00343                 virtual inline Error moveEnt(EntityHandle entity, double x, double y,
00344                                 double z);
00345                 virtual inline Error rotateEnt(EntityHandle entity, double angle,
00346                                 double axis_x, double axis_y, double axis_z);
00347                 virtual inline Error reflectEnt(EntityHandle entity, double x,
00348                                 double y, double z, double norm_x,
00349                                 double norm_y, double norm_z);
00350                 virtual inline Error scaleEnt(EntityHandle entity, double x,
00351                                 double y, double z, double x_factor,
00352                                 double y_factor, double z_factor);
00353 
00354                 virtual inline Error uniteEnts(const EntityHandle* entities,
00355                                 int entities_size, EntityHandle& result_entity);
00356                 virtual inline Error subtractEnts(EntityHandle blank, EntityHandle tool,
00357                                 EntityHandle& result);
00358                 virtual inline Error intersectEnts(EntityHandle entity1,
00359                                 EntityHandle entity2, EntityHandle& result);
00360 
00361                 virtual inline Error sectionEnt(EntityHandle entity, double plane_x,
00362                                 double plane_y, double plane_z, double offset, bool reverse,
00363                                 EntityHandle& result);
00364 
00365                 virtual inline Error sweepEntAboutAxis(EntityHandle entity, double angle,
00366                                 double axis_x, double axis_y, double axis_z, EntityHandle& swept_entity);
00367 
00368                 virtual inline Error imprintEnts(const EntityHandle* entities,
00369                                 int entities_size);
00370                 virtual inline Error mergeEnts(const EntityHandle* entities,
00371                                 int entities_size, double tolerance);
00372 
00373                 // copied from iBaseVirtual.hpp
00374                 iGeom_Instance instance() {
00375                         return mInstance;
00376                 }
00377 
00378                 virtual inline std::string getDescription() const;
00379 
00380                 virtual inline Error getErrorType() const;
00381 
00382                 virtual inline EntitySetHandle getRootSet() const;
00383 
00384                 virtual inline Error createEntSet(bool is_list, EntitySetHandle& handle_out);
00385                 virtual inline Error destroyEntSet(EntitySetHandle handle);
00386                 virtual inline Error isList(EntitySetHandle handle, bool& is_list);
00387 
00388                 virtual inline Error getNumEntSets(EntitySetHandle set, int num_hops,
00389                                 int& num_sets_out) const;
00390                 virtual inline Error getEntSets(EntitySetHandle set, int num_hops, std::vector<
00391                                 EntitySetHandle>& contained_sets_out) const;
00392 
00393                 virtual inline Error addEntToSet(EntityHandle entity, EntitySetHandle set);
00394                 virtual inline Error rmvEntFromSet(EntityHandle entity, EntitySetHandle set);
00395 
00396                 virtual inline Error addEntArrToSet(const EntityHandle* entity_handles,
00397                                 int entity_handles_size, EntitySetHandle entity_set);
00398                 virtual inline Error rmvEntArrFromSet(const EntityHandle* entity_handles,
00399                                 int entity_handles_size, EntitySetHandle entity_set);
00400 
00401                 virtual inline Error addEntSet(EntitySetHandle to_add, EntitySetHandle add_to);
00402                 virtual inline Error rmvEntSet(EntitySetHandle to_rmv, EntitySetHandle rmv_from);
00403 
00404                 virtual inline Error isEntContained(EntitySetHandle set, EntityHandle ent,
00405                                 bool& contained_out) const;
00406                 virtual inline Error isEntArrContained(EntitySetHandle containing_set,
00407                                 const EntityHandle* entity_handles, int num_entity_handles,
00408                                 bool* is_contained_out) const;
00409                 virtual inline Error isEntSetContained(EntitySetHandle containing_set,
00410                                 EntitySetHandle contained_set, bool& contained_out) const;
00411 
00412                 virtual inline Error addPrntChld(EntitySetHandle parent, EntitySetHandle child);
00413                 virtual inline Error rmvPrntChld(EntitySetHandle parent, EntitySetHandle child);
00414                 virtual inline Error isChildOf(EntitySetHandle parent, EntitySetHandle child,
00415                                 bool& is_child_out) const;
00416                 virtual inline Error getNumChld(EntitySetHandle parent, int num_hops,
00417                                 int& num_child_out) const;
00418                 virtual inline Error getNumPrnt(EntitySetHandle child, int num_hops,
00419                                 int& num_parent_out) const;
00420                 virtual inline Error getChldn(EntitySetHandle parent, int num_hops, std::vector<
00421                                 EntitySetHandle>& children_out) const;
00422                 virtual inline Error getPrnts(EntitySetHandle child, int num_hops, std::vector<
00423                                 EntitySetHandle>& parents_out) const;
00424 
00425                 virtual inline Error subtract(EntitySetHandle set1, EntitySetHandle set2,
00426                                 EntitySetHandle& result_set_out);
00427                 virtual inline Error intersect(EntitySetHandle set1, EntitySetHandle set2,
00428                                 EntitySetHandle& result_set_out);
00429                 virtual inline Error unite(EntitySetHandle set1, EntitySetHandle set2,
00430                                 EntitySetHandle& result_set_out);
00431 
00432                 virtual inline Error createTag(const char* tag_name, int tag_num_type_values,
00433                                 TagValueType tag_type, TagHandle& tag_handle_out);
00434 
00435                 virtual inline Error destroyTag(TagHandle tag_handle, bool forced);
00436                 virtual inline Error getTagName(TagHandle tag_handle, std::string& name_out) const;
00437                 virtual inline Error getTagSizeValues(TagHandle tag_handle, int& size_out) const;
00438                 virtual inline Error getTagSizeBytes(TagHandle tag_handle, int& size_out) const;
00439                 virtual inline Error getTagHandle(const char* name, TagHandle& handle_out) const;
00440                 virtual inline Error getTagType(TagHandle tag_handle, TagValueType& type_out) const;
00441 
00442                 virtual inline Error setEntSetData(EntitySetHandle set_handle, TagHandle tag_handle,
00443                                 const void* tag_value);
00444                 virtual inline Error setEntSetIntData(EntitySetHandle set_handle,
00445                                 TagHandle tag_handle, int value);
00446                 virtual inline Error setEntSetDblData(EntitySetHandle set_handle,
00447                                 TagHandle tag_handle, double value);
00448                 virtual inline Error setEntSetEHData(EntitySetHandle set_handle,
00449                                 TagHandle tag_handle, EntityHandle value);
00450                 virtual inline Error setEntSetESHData(EntitySetHandle set_handle,
00451                                 TagHandle tag_handle, EntitySetHandle value);
00452 
00453                 virtual inline Error getEntSetData(EntitySetHandle set_handle, TagHandle tag_handle,
00454                                 void* tag_value_out) const;
00455                 virtual inline Error getEntSetIntData(EntitySetHandle set_handle,
00456                                 TagHandle tag_handle, int& value_out) const;
00457                 virtual inline Error getEntSetDblData(EntitySetHandle set_handle,
00458                                 TagHandle tag_handle, double& value_out) const;
00459                 virtual inline Error getEntSetEHData(EntitySetHandle set_handle,
00460                                 TagHandle tag_handle, EntityHandle& value_out) const;
00461                 virtual inline Error getEntSetESHData(EntitySetHandle set_handle,
00462                                 TagHandle tag_handle, EntitySetHandle& value_out) const;
00463 
00464                 virtual inline Error getAllEntSetTags(EntitySetHandle set,
00465                                 std::vector<TagHandle>& tags_out) const;
00466                 virtual inline Error getAllTags(EntityHandle entity,
00467                                 std::vector<TagHandle>& tags_out) const;
00468 
00469                 virtual inline Error rmvEntSetTag(EntitySetHandle set, TagHandle tag);
00470                 virtual inline Error rmvTag(EntityHandle entity, TagHandle tag);
00471                 virtual inline Error rmvArrTag(const EntityHandle* handles, int size, TagHandle tag);
00472 
00473                 virtual inline Error getArrData(const EntityHandle* entity_handles,
00474                                 int entity_handles_size, TagHandle tag_handle, void* tag_values_out) const;
00475                 virtual inline Error getIntArrData(const EntityHandle* entity_handles,
00476                                 int entity_handles_size, TagHandle tag_handle, int* tag_values_out) const;
00477                 virtual inline Error getDblArrData(const EntityHandle* entity_handles,
00478                                 int entity_handles_size, TagHandle tag_handle, double* tag_values_out) const;
00479                 virtual inline Error getEHArrData(const EntityHandle* entity_handles,
00480                                 int entity_handles_size, TagHandle tag_handle,
00481                                 EntityHandle* tag_values_out) const;
00482                 virtual inline Error getESHArrData(const EntityHandle* entity_handles,
00483                                 int entity_handles_size, TagHandle tag_handle,
00484                                 EntitySetHandle* tag_values_out) const;
00485 
00486                 virtual inline Error setArrData(const EntityHandle* entity_handles,
00487                                 int entity_handles_size, TagHandle tag_handle, const void* tag_values);
00488                 virtual inline Error setIntArrData(const EntityHandle* entity_handles,
00489                                 int entity_handles_size, TagHandle tag_handle, const int* tag_values);
00490                 virtual inline Error setDblArrData(const EntityHandle* entity_handles,
00491                                 int entity_handles_size, TagHandle tag_handle, const double* tag_values);
00492                 virtual inline Error setEHArrData(const EntityHandle* entity_handles,
00493                                 int entity_handles_size, TagHandle tag_handle,
00494                                 const EntityHandle* tag_values);
00495                 virtual inline Error setESHArrData(const EntityHandle* entity_handles,
00496                                 int entity_handles_size, TagHandle tag_handle,
00497                                 const EntitySetHandle* tag_values);
00498 
00499                 virtual inline Error setData(EntityHandle entity_handle, TagHandle tag_handle,
00500                                 const void* tag_value);
00501                 virtual inline Error setIntData(EntityHandle entity_handle, TagHandle tag_handle,
00502                                 int value);
00503                 virtual inline Error setDblData(EntityHandle entity_handle, TagHandle tag_handle,
00504                                 double value);
00505                 virtual inline Error setEHData(EntityHandle entity_handle, TagHandle tag_handle,
00506                                 EntityHandle value);
00507                 virtual inline Error setESHData(EntityHandle entity_handle, TagHandle tag_handle,
00508                                 EntitySetHandle value);
00509 
00510                 virtual inline Error getData(EntityHandle entity_handle, TagHandle tag_handle,
00511                                 void* tag_value_out) const;
00512                 virtual inline Error getFacets(EntityHandle entity_handle, double dist_tolerance,
00513                                                    std::vector<double> &point, std::vector<int> &facets) const;
00514                 virtual inline Error getIntData(EntityHandle entity_handle, TagHandle tag_handle,
00515                                 int& value_out) const;
00516                 virtual inline Error getDblData(EntityHandle entity_handle, TagHandle tag_handle,
00517                                 double& value_out) const;
00518                 virtual inline Error getEHData(EntityHandle entity_handle, TagHandle tag_handle,
00519                                 EntityHandle& value_out) const;
00520                 virtual inline Error getESHData(EntityHandle entity_handle, TagHandle tag_handle,
00521                                 EntitySetHandle& value_out) const;
00522 
00523                 virtual bool isFBiGeom() {return false;}
00524                 // end copy from iBaseVirtual.hpp
00528                 class EntArrIter {
00529                         private:
00530                                 friend class iGeom;
00531                                 iBase_EntityArrIterator mHandle;
00532                                 iGeom_Instance mInstance;
00533                                 int mSize;
00534                         public:
00535                                 EntArrIter() :
00536                                         mHandle(0), mInstance(0), mSize(0) {
00537                                         }
00538                                 inline ~EntArrIter();
00539                                 inline Error getNext(EntityHandle* entity_handles_out, int& size_out,
00540                                                 bool& has_more_data_out);
00541                                 inline Error reset();
00542                 };
00543 
00547                 class EntIter {
00548                         private:
00549                                 friend class iGeom;
00550                                 iBase_EntityIterator mHandle;
00551                                 iGeom_Instance mInstance;
00552                         public:
00553                                 EntIter() :
00554                                         mHandle(0), mInstance(0) {
00555                                         }
00556                                 inline ~EntIter();
00557                                 inline Error getNext(EntityHandle& entity_handle_out,
00558                                                 bool& has_more_data_out);
00559                                 inline Error reset();
00560                 };
00561 
00562                 virtual inline Error initEntIter(EntitySetHandle set,
00563                                 EntityType requested_type, EntIter& iter);
00564                 virtual inline Error initEntArrIter(EntitySetHandle set,
00565                                 EntityType requested_type, int requested_array_size, EntArrIter& iter);
00566         private:
00567                 bool iGeomInstanceOwner;
00568 
00569                 // prohibit copying
00570                 iGeom(const iGeom&) {
00571                 }
00572                 void operator=(const iGeom&) {
00573                 }
00574 };
00575 
00576 inline iGeom::iGeom(const char* options) :
00577         iGeomInstanceOwner(true)
00578 {
00579         int err, len = options ? strlen(options) : 0;
00580         iGeom_newGeom(options, &mInstance, &err, len);
00581         if (iBase_SUCCESS != err) {
00582                 mInstance = 0;
00583                 iGeomInstanceOwner = false;
00584         }
00585 }
00586 
00587 inline iGeom::iGeom(iGeom_Instance instance) :
00588         iGeomInstanceOwner(false)
00589 {
00590         mInstance = instance;
00591 }
00592 inline iGeom::iGeom(bool meshBased)
00593 {
00594         mInstance = 0;
00595         iGeomInstanceOwner = false;
00596 }
00597 inline iGeom::~iGeom()
00598 {
00599         if (iGeomInstanceOwner) {
00600                 int err;
00601                 iGeom_dtor(mInstance, &err);
00602         }
00603 }
00604 
00605 inline iGeom::Error iGeom::load(const char* file_name, const char* options)
00606 {
00607         int err, len = options ? strlen(options) : 0;
00608         iGeom_load(mInstance, file_name, options, &err, strlen(file_name), len);
00609         return (Error) err;
00610 }
00611 
00612 inline iGeom::Error iGeom::save(const char* file_name, const char* options)
00613 {
00614         int err, len = options ? strlen(options) : 0;
00615         iGeom_save(mInstance, file_name, options, &err, strlen(file_name), len);
00616         return (Error) err;
00617 }
00618 
00619 //inline iGeom::StorageOrder
00620 //iGeom::getDfltStorage()
00621 //{
00622 //  int err, order;
00623 //  iGeom_getDfltStorage( mInstance, &order, &err );
00624 //  return (iBase_SUCCESS == err) ? (StorageOrder)order : iBase_UNDETERMINED;
00625 //}
00626 
00627 inline iGeom::Error iGeom::getNumOfType(EntitySetHandle set, EntityType type,
00628                 int& count_out) const
00629 {
00630         int err;
00631         iGeom_getNumOfType(mInstance, set, type, &count_out, &err);
00632         return (Error) err;
00633 }
00634 
00635 inline iGeom::Error iGeom::getEntities(EntitySetHandle set, EntityType type,
00636                 std::vector<EntityHandle>& entities_out) const
00637 {
00638         // if input vect has no allocated space, allocate some so
00639         // we don't accidentally ask the impl to allocate an array
00640         if (entities_out.capacity() == 0) {
00641                 int count;
00642                 Error err2 = getNumOfType(set, iBase_ALL_TYPES, count);
00643                 if (err2 != iBase_SUCCESS)
00644                         return err2;
00645                 entities_out.resize(count);
00646         }
00647 
00648         // try getting results using whatever space input vector has allocated
00649         int err, size = 0, alloc = entities_out.capacity();
00650         entities_out.resize(entities_out.capacity());
00651         EntityHandle* ptr = &entities_out[0];
00652         iGeom_getEntities(mInstance, set, type, &ptr, &alloc, &size, &err);
00653         entities_out.resize(size);
00654 
00655         // if input vector was too small, try again with increased size
00656         if (iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err) {
00657                 alloc = entities_out.size();
00658                 ptr = &entities_out[0];
00659                 iGeom_getEntities(mInstance, set, type, &ptr, &alloc, &size, &err);
00660         }
00661 
00662         return (Error) err;
00663 }
00664 
00665 inline iGeom::Error iGeom::deleteEnt(EntityHandle handle)
00666 {
00667         int err;
00668         iGeom_deleteEnt(mInstance, handle, &err);
00669         return (Error) err;
00670 }
00671 
00672 //inline iGeom::Error
00673 //iGeom::deleteEntArr( const EntityHandle* entity_handles, int num_handles )
00674 //{
00675 //  int err;
00676 //  iGeom_deleteEntArr( mInstance, entity_handles, num_handles, &err );
00677 //  return (Error)err;
00678 //}
00679 
00680 //inline iGeom::Error
00681 //iGeom::getAdjEntities( EntitySetHandle set,
00682 //                       EntityType type_requestor,
00683 //                       EntityType type_requested,
00684 //                       std::vector<EntityHandle>& adj_entity_handles,
00685 //                       std::vector<int>& offset )
00686 //{
00687 //  std::vector<EntityHandle> entities;
00688 //  Error err = getEntities( set, type_requestor, entities );
00689 //  if (iBase_SUCCESS != err)
00690 //    return err;
00691 //
00692 //  offset.resize( entities.size() + 1 );
00693 //  return getArrAdj( &entities[0], entities.size(), type_requested,
00694 //                    adj_entity_handles, &offset[0] );
00695 //}
00696 
00697 inline iGeom::Error iGeom::initEntIter(EntitySetHandle set,
00698                 EntityType requested_type, iGeom::EntIter& iter)
00699 {
00700         int err;
00701         iter.mInstance = mInstance;
00702         iGeom_initEntIter(mInstance, set, requested_type, &iter.mHandle, &err);
00703         return (Error) err;
00704 }
00705 
00706 inline iGeom::Error iGeom::initEntArrIter(EntitySetHandle set,
00707                 EntityType requested_type, int requested_array_size,
00708                 iGeom::EntArrIter& iter)
00709 {
00710         int err;
00711         iter.mInstance = mInstance;
00712         iter.mSize = requested_array_size;
00713         iGeom_initEntArrIter(mInstance, set, requested_type, requested_array_size,
00714                         &iter.mHandle, &err);
00715         return (Error) err;
00716 }
00717 
00718 inline iGeom::EntArrIter::~EntArrIter()
00719 {
00720         int err;
00721         if (mHandle != 0) {
00722                 iGeom_endEntArrIter(mInstance, mHandle, &err);
00723                 mHandle = 0;
00724         }
00725 }
00726 
00727 inline iGeom::EntIter::~EntIter()
00728 {
00729         int err;
00730         if (mHandle != 0) {
00731                 iGeom_endEntIter(mInstance, mHandle, &err);
00732                 mHandle = 0;
00733         }
00734 }
00735 
00736 inline iGeom::Error iGeom::EntArrIter::getNext(EntityHandle* entity_handles,
00737                 int& size_out, bool& has_more_data_out)
00738 {
00739         int err, alloc = mSize, has_data;
00740         iGeom_getNextEntArrIter(mInstance, mHandle, &entity_handles, &alloc,
00741                         &size_out, &has_data, &err);
00742         has_more_data_out = (has_data != 0);
00743         return (Error) err;
00744 }
00745 
00746 inline iGeom::Error iGeom::EntIter::getNext(EntityHandle& handle_out,
00747                 bool& has_more_data_out)
00748 {
00749         int err, has_data;
00750         iGeom_getNextEntIter(mInstance, mHandle, &handle_out, &has_data, &err);
00751         has_more_data_out = (has_data != 0);
00752         return (Error) err;
00753 }
00754 
00755 inline iGeom::Error iGeom::EntArrIter::reset()
00756 {
00757         int err;
00758         iGeom_resetEntArrIter(mInstance, mHandle, &err);
00759         return (Error) err;
00760 }
00761 
00762 inline iGeom::Error iGeom::EntIter::reset()
00763 {
00764         int err;
00765         iGeom_resetEntIter(mInstance, mHandle, &err);
00766         return (Error) err;
00767 }
00768 
00769 inline iGeom::Error iGeom::getEntType(EntityHandle handle, EntityType& type_out) const
00770 {
00771         int err, result;
00772         iGeom_getEntType(mInstance, handle, &result, &err);
00773         type_out = (EntityType) result;
00774         return (Error) err;
00775 }
00776 
00777 inline iGeom::Error iGeom::getArrType(const EntityHandle* entity_handles,
00778                 int entity_handles_size, EntityType* types_out) const
00779 {
00780         int err, alloc = entity_handles_size, junk, *ptr;
00781         std::vector<int> storage;
00782         if (sizeof(EntityType) == sizeof(int))
00783                 ptr = reinterpret_cast<int*> (types_out);
00784         else {
00785                 storage.resize(entity_handles_size);
00786                 ptr = &storage[0];
00787         }
00788 
00789         iGeom_getArrType(mInstance, entity_handles, entity_handles_size, &ptr,
00790                         &alloc, &junk, &err);
00791 
00792         if (sizeof(EntityType) != sizeof(int))
00793                 for (int i = 0; i < entity_handles_size; ++i)
00794                         types_out[i] = (EntityType) storage[i];
00795 
00796         return (Error) err;
00797 }
00798 
00799 inline iGeom::Error iGeom::getEntAdj(EntityHandle handle,
00800                 EntityType type_requested, std::vector<EntityHandle>& adj_entities_out) const
00801 {
00802         if (adj_entities_out.capacity() == 0)
00803                 adj_entities_out.resize(12);
00804         else
00805                 adj_entities_out.resize(adj_entities_out.capacity());
00806 
00807         int err, alloc = adj_entities_out.size(), size = 0;
00808         EntityHandle* ptr = &adj_entities_out[0];
00809         iGeom_getEntAdj(mInstance, handle, type_requested, &ptr, &alloc, &size, &err);
00810         adj_entities_out.resize(size);
00811 
00812         if (iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err) {
00813                 alloc = adj_entities_out.size();
00814                 ptr = &adj_entities_out[0];
00815                 iGeom_getEntAdj(mInstance, handle, type_requested, &ptr, &alloc, &size,
00816                                 &err);
00817         }
00818 
00819         return (Error) err;
00820 }
00821 
00822 inline iGeom::Error iGeom::getArrAdj(const EntityHandle* entity_handles,
00823                 int entity_handles_size, EntityType type_requested, std::vector<
00824                 EntityHandle>& adj_entities_out, int* offsets_out) const
00825 {
00826         if (adj_entities_out.capacity() == 0)
00827                 adj_entities_out.resize(12 * entity_handles_size);
00828         else
00829                 adj_entities_out.resize(adj_entities_out.capacity());
00830 
00831         int err, alloc = adj_entities_out.size(), size = 0;
00832         int off_alloc = entity_handles_size + 1, junk;
00833         EntityHandle* ptr = &adj_entities_out[0];
00834         iGeom_getArrAdj(mInstance, entity_handles, entity_handles_size,
00835                         type_requested, &ptr, &alloc, &size, &offsets_out, &off_alloc, &junk,
00836                         &err);
00837         adj_entities_out.resize(size);
00838 
00839         if (iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err) {
00840                 alloc = adj_entities_out.size();
00841                 ptr = &adj_entities_out[0];
00842                 iGeom_getArrAdj(mInstance, entity_handles, entity_handles_size,
00843                                 type_requested, &ptr, &alloc, &size, &offsets_out, &off_alloc, &junk,
00844                                 &err);
00845         }
00846 
00847         return (Error) err;
00848 }
00849 
00850 inline iGeom::Error iGeom::getEnt2ndAdj(EntityHandle handle,
00851                 EntityType bridge_entity_type, EntityType type_requested, std::vector<
00852                 EntityHandle>& adj_entities_out) const
00853 {
00854         if (adj_entities_out.capacity() == 0)
00855                 adj_entities_out.resize(12);
00856         else
00857                 adj_entities_out.resize(adj_entities_out.capacity());
00858 
00859         int err, alloc = adj_entities_out.size(), size = 0;
00860         EntityHandle* ptr = &adj_entities_out[0];
00861         iGeom_getEnt2ndAdj(mInstance, handle, bridge_entity_type, type_requested,
00862                         &ptr, &alloc, &size, &err);
00863         adj_entities_out.resize(size);
00864 
00865         if (iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err) {
00866                 alloc = adj_entities_out.size();
00867                 ptr = &adj_entities_out[0];
00868                 iGeom_getEnt2ndAdj(mInstance, handle, bridge_entity_type, type_requested,
00869                                 &ptr, &alloc, &size, &err);
00870         }
00871 
00872         return (Error) err;
00873 }
00874 
00875 inline iGeom::Error iGeom::getArr2ndAdj(const EntityHandle* entity_handles,
00876                 int entity_handles_size, EntityType order_key, EntityType type_requested,
00877                 std::vector<EntityHandle>& adj_entities_out, int* offsets_out) const
00878 {
00879         if (adj_entities_out.capacity() == 0)
00880                 adj_entities_out.resize(12 * entity_handles_size);
00881         else
00882                 adj_entities_out.resize(adj_entities_out.capacity());
00883 
00884         int err, alloc = adj_entities_out.size(), size = 0;
00885         int off_alloc = entity_handles_size + 1, junk;
00886         EntityHandle* ptr = &adj_entities_out[0];
00887         iGeom_getArr2ndAdj(mInstance, entity_handles, entity_handles_size, order_key,
00888                         type_requested, &ptr, &alloc, &size, &offsets_out, &off_alloc, &junk,
00889                         &err);
00890         adj_entities_out.resize(size);
00891 
00892         if (iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err) {
00893                 alloc = adj_entities_out.size();
00894                 ptr = &adj_entities_out[0];
00895                 iGeom_getArr2ndAdj(mInstance, entity_handles, entity_handles_size,
00896                                 order_key, type_requested, &ptr, &alloc, &size, &offsets_out,
00897                                 &off_alloc, &junk, &err);
00898         }
00899 
00900         return (Error) err;
00901 }
00902 
00903 inline iGeom::Error iGeom::getBoundBox(double& min_x, double& min_y,
00904                 double& min_z, double& max_x, double& max_y, double& max_z) const
00905 {
00906         int err;
00907         iGeom_getBoundBox(mInstance, &min_x, &min_y, &min_z, &max_x, &max_y, &max_z,
00908                         &err);
00909         return (Error) err;
00910 }
00911 
00912 inline int iGeom::getParametric()
00913 {
00914         int err, result;
00915         iGeom_getParametric(mInstance, &result, &err);
00916         return result;
00917 }
00918 
00919 inline iGeom::Error iGeom::isEntAdj(EntityHandle entity1, EntityHandle entity2,
00920                 bool& adjacent_out) const
00921 {
00922         int err, result;
00923         iGeom_isEntAdj(mInstance, entity1, entity2, &result, &err);
00924         adjacent_out = (result != 0);
00925         return (Error) err;
00926 }
00927 
00928 inline iGeom::Error iGeom::isArrAdj(const EntityHandle* entities1,
00929                 const EntityHandle* entities2, int num_entity_pairs, int* is_adj_out) const
00930 {
00931         int err, alloc = num_entity_pairs, size = 0;
00932         iGeom_isArrAdj(mInstance, entities1, num_entity_pairs, entities2,
00933                         num_entity_pairs, &is_adj_out, &alloc, &size, &err);
00934         return (Error) err;
00935 }
00936 
00937 inline iGeom::Error iGeom::getEntClosestPt(EntityHandle entity, double near_x,
00938                 double near_y, double near_z, double& on_x, double& on_y, double& on_z) const
00939 {
00940         int err;
00941         iGeom_getEntClosestPt(mInstance, entity, near_x, near_y, near_z, &on_x,
00942                         &on_y, &on_z, &err);
00943         return (Error) err;
00944 }
00945 
00946 inline iGeom::Error iGeom::getEntClosestPtTrimmed(EntityHandle entity, double near_x,
00947                                           double near_y, double near_z, double& on_x, double& on_y, double& on_z) const
00948 {
00949     int err;
00950     iGeom_getEntClosestPtTrimmed(mInstance, entity, near_x, near_y, near_z, &on_x, &on_y, &on_z, &err);
00951     return (Error) err;
00952 }
00953 
00954 inline iGeom::Error iGeom::getArrClosestPt(const EntityHandle* handles,
00955           int handles_size, StorageOrder order, const double* near_coordinates,
00956           int near_coordinates_size, double* on_coordinates) const
00957 {
00958      int err, alloc = std::max(near_coordinates_size, 3 * handles_size), size = 0;
00959      iGeom_getArrClosestPt(mInstance, handles, handles_size, order,
00960                            near_coordinates, near_coordinates_size, &on_coordinates, &alloc, &size,
00961                            &err);
00962      return (Error) err;
00963 }
00964 
00965 inline iGeom::Error iGeom::getEntNrmlXYZ(EntityHandle entity, double x,
00966           double y, double z, double& i, double& j, double& k) const
00967 {
00968      int err;
00969      iGeom_getEntNrmlXYZ(mInstance, entity, x, y, z, &i, &j, &k, &err);
00970      return (Error) err;
00971 }
00972 
00973 inline iGeom::Error iGeom::getArrNrmlXYZ(const EntityHandle* entities,
00974           int entities_size, StorageOrder order, const double* xyz, int xyz_size,
00975           double* ijk) const
00976 {
00977      int err, alloc = std::max(xyz_size, 3 * entities_size), size = 0;
00978      iGeom_getArrNrmlXYZ(mInstance, entities, entities_size, order, xyz, xyz_size,
00979                          &ijk, &alloc, &size, &err);
00980      return (Error) err;
00981 }
00982 
00983 inline iGeom::Error iGeom::getEntNrmlPlXYZ(EntityHandle entity, double x,
00984           double y, double z, double& on_x, double& on_y, double& on_z, double& i,
00985           double& j, double& k) const
00986 {
00987      int err;
00988      iGeom_getEntNrmlPlXYZ(mInstance, entity, x, y, z, &on_x, &on_y, &on_z, &i,
00989                            &j, &k, &err);
00990      return (Error) err;
00991 }
00992 
00993 inline iGeom::Error iGeom::getArrNrmlPlXYZ(const EntityHandle* entities,
00994           int entities_size, StorageOrder order, const double* near_xyz,
00995           int near_xyz_size, double* on_xyz, double* nrml_ijk) const
00996 {
00997      int err, alloc = std::max(near_xyz_size, 3 * entities_size), size = 0;
00998      iGeom_getArrNrmlPlXYZ(mInstance, entities, entities_size, order, near_xyz,
00999                            near_xyz_size, &on_xyz, &alloc, &size, &nrml_ijk, &alloc, &size, &err);
01000      return (Error) err;
01001 }
01002 
01003 inline iGeom::Error iGeom::getEntTgntXYZ(EntityHandle entity, double x,
01004           double y, double z, double& i, double& j, double& k) const
01005 {
01006      int err;
01007      iGeom_getEntTgntXYZ(mInstance, entity, x, y, z, &i, &j, &k, &err);
01008      return (Error) err;
01009 }
01010 
01011 inline iGeom::Error iGeom::getArrTgntXYZ(const EntityHandle* entities,
01012           int entities_size, StorageOrder order, const double* xyz, int xyz_size,
01013           double* ijk) const
01014 {
01015      int err, alloc = std::max(xyz_size, 3 * entities_size), size = 0;
01016      iGeom_getArrTgntXYZ(mInstance, entities, entities_size, order, xyz, xyz_size,
01017                          &ijk, &alloc, &size, &err);
01018      return (Error) err;
01019 }
01020 
01021 inline iGeom::Error iGeom::getFcCvtrXYZ(EntityHandle face, double x, double y,
01022                                         double z, double& i1, double& j1, double& k1, double& i2, double& j2,
01023                                         double& k2) const
01024 {
01025      int err;
01026      iGeom_getFcCvtrXYZ(mInstance, face, x, y, z, &i1, &j1, &k1, &i2, &j2, &k2,
01027                         &err);
01028      return (Error) err;
01029 }
01030 
01031 inline iGeom::Error iGeom::getEgCvtrXYZ(EntityHandle edge, double x, double y,
01032                                         double z, double& i, double& j, double& k) const
01033 {
01034      int err;
01035      iGeom_getEgCvtrXYZ(mInstance, edge, x, y, z, &i, &j, &k, &err);
01036      return (Error) err;
01037 }
01038 
01039 inline iGeom::Error iGeom::getEntArrCvtrXYZ(const EntityHandle* entities,
01040           int entities_size, StorageOrder order, const double* xyz, int xyz_size,
01041           double* cvtr_1, double* cvtr_2) const
01042 {
01043      int err, alloc = std::max(xyz_size, 3 * entities_size), size = 0;
01044      iGeom_getEntArrCvtrXYZ(mInstance, entities, entities_size, order, xyz,
01045                             xyz_size, &cvtr_1, &alloc, &size, &cvtr_2, &alloc, &size, &err);
01046      return (Error) err;
01047 }
01048 
01049 inline iGeom::Error iGeom::getEgEvalXYZ(EntityHandle edge, double x, double y,
01050                                         double z, double& on_x, double& on_y, double& on_z, double& tngt_i,
01051                                         double& tngt_j, double& tngt_k, double& cvtr_i, double& cvtr_j,
01052                                         double& cvtr_k) const
01053 {
01054      int err;
01055      iGeom_getEgEvalXYZ(mInstance, edge, x, y, z, &on_x, &on_y, &on_z, &tngt_i,
01056                         &tngt_j, &tngt_k, &cvtr_i, &cvtr_j, &cvtr_k, &err);
01057      return (Error) err;
01058 }
01059 
01060 inline iGeom::Error iGeom::getFcEvalXYZ(EntityHandle face, double x, double y,
01061                                         double z, double& on_x, double& on_y, double& on_z, double& tngt_i,
01062                                         double& tngt_j, double& tngt_k, double& cvtr1_i, double& cvtr1_j,
01063                                         double& cvtr1_k, double& cvtr2_i, double& cvtr2_j, double& cvtr2_k) const
01064 {
01065      int err;
01066      iGeom_getFcEvalXYZ(mInstance, face, x, y, z, &on_x, &on_y, &on_z, &tngt_i,
01067                         &tngt_j, &tngt_k, &cvtr1_i, &cvtr1_j, &cvtr1_k, &cvtr2_i, &cvtr2_j,
01068                         &cvtr2_k, &err);
01069      return (Error) err;
01070 }
01071 
01072 inline iGeom::Error iGeom::getArrEgEvalXYZ(const EntityHandle* edges,
01073           int edges_size, StorageOrder order, const double* near_coords,
01074           int near_coords_size, double* on_coords, double* tangent, double* curvature) const
01075 {
01076      int err, alloc = std::max(near_coords_size, 3 * edges_size), size = 0;
01077      iGeom_getArrEgEvalXYZ(mInstance, edges, edges_size, order, near_coords,
01078                            near_coords_size, &on_coords, &alloc, &size, &tangent, &alloc, &size,
01079                            &curvature, &alloc, &size, &err);
01080      return (Error) err;
01081 }
01082 
01083 inline iGeom::Error iGeom::getArrFcEvalXYZ(const EntityHandle* faces,
01084           int faces_size, StorageOrder order, const double* near_coords,
01085           int near_coords_size, double* on_coords, double* tangent,
01086           double* curvature1, double* curvature2) const
01087 {
01088      int err, alloc = std::max(near_coords_size, 3 * faces_size), size = 0;
01089      iGeom_getArrFcEvalXYZ(mInstance, faces, faces_size, order, near_coords,
01090                            near_coords_size, &on_coords, &alloc, &size, &tangent, &alloc, &size,
01091                            &curvature1, &alloc, &size, &curvature2, &alloc, &size, &err);
01092      return (Error) err;
01093 }
01094 
01095 inline iGeom::Error iGeom::getEntBoundBox(EntityHandle entity, double& min_x,
01096           double& min_y, double& min_z, double& max_x, double& max_y, double& max_z) const
01097 {
01098      int err;
01099      iGeom_getEntBoundBox(mInstance, entity, &min_x, &min_y, &min_z, &max_x,
01100                           &max_y, &max_z, &err);
01101      return (Error) err;
01102 }
01103 
01104 inline iGeom::Error iGeom::getArrBoundBox(const EntityHandle* entities,
01105           int entities_size, StorageOrder order, double* min_corners,
01106           double* max_corners) const
01107 {
01108      int err, alloc = 3 * entities_size, size = 0, order_int = order;
01109      iGeom_getArrBoundBox(mInstance, entities, entities_size, order_int,
01110                           &min_corners, &alloc, &size, &max_corners, &alloc, &size, &err);
01111      return (Error) err;
01112 }
01113 
01114 inline iGeom::Error iGeom::getVtxCoord(EntityHandle vertex, double& x,
01115                                        double& y, double& z) const
01116 {
01117      int err;
01118      iGeom_getVtxCoord(mInstance, vertex, &x, &y, &z, &err);
01119      return (Error) err;
01120 }
01121 
01122 inline iGeom::Error iGeom::getVtxArrCoords(const EntityHandle* vertices,
01123           int vertices_size, StorageOrder order, double* coords) const
01124 {
01125      int err, alloc = vertices_size, size = 0;
01126      iGeom_getVtxArrCoords(mInstance, vertices, vertices_size, order, &coords,
01127                            &alloc, &size, &err);
01128      return (Error) err;
01129 }
01130 
01131 inline iGeom::Error iGeom::getPntRayIntsct(double x, double y, double z,
01132           double i, double j, double k, StorageOrder order,
01133           std::vector<EntityHandle>& entities_out, std::vector<double>& points_out,
01134           std::vector<double>& params_out) const
01135 {
01136      int err, count;
01137      Error err2 = getNumOfType(getRootSet(), iBase_ALL_TYPES, count);
01138      if (err2 != iBase_SUCCESS)
01139           return err2;
01140 
01141      entities_out.resize(count);
01142      points_out.resize(3 * count);
01143      params_out.resize(2 * count);
01144      int entities_alloc = entities_out.size(), entities_size = 0;
01145      int points_alloc = points_out.size(), points_size = 0;
01146      int params_alloc = params_out.size(), params_size = 0;
01147      EntityHandle* entities_ptr = &entities_out[0];
01148      double * points_ptr = &points_out[0];
01149      double * params_ptr = &params_out[0];
01150 
01151      iGeom_getPntRayIntsct(mInstance, x, y, z, i, j, k, &entities_ptr,
01152                            &entities_alloc, &entities_size, order, &points_ptr, &points_alloc,
01153                            &points_size, &params_ptr, &params_alloc, &params_size, &err);
01154      entities_out.resize(entities_size);
01155      points_out.resize(points_size);
01156      params_out.resize(params_size);
01157      if (err == iBase_BAD_ARRAY_SIZE || err == iBase_BAD_ARRAY_DIMENSION) {
01158           entities_alloc = entities_out.size();
01159           points_alloc = points_out.size();
01160           params_alloc = params_out.size();
01161           entities_ptr = &entities_out[0];
01162           points_ptr = &points_out[0];
01163           params_ptr = &params_out[0];
01164           iGeom_getPntRayIntsct(mInstance, x, y, z, i, j, k, &entities_ptr,
01165                                 &entities_alloc, &entities_size, order, &points_ptr, &points_alloc,
01166                                 &points_size, &params_ptr, &params_alloc, &params_size, &err);
01167      }
01168 
01169      return (Error) err;
01170 }
01171 
01172 inline iGeom::Error iGeom::getPntClsf(double x, double y, double z,
01173                                       EntityHandle& handle_out) const
01174 {
01175      int err;
01176      iGeom_getPntClsf(mInstance, x, y, z, &handle_out, &err);
01177      return (Error) err;
01178 }
01179 
01180 inline iGeom::Error iGeom::getPntArrClsf(StorageOrder order,
01181           const double* coords, int coords_size, EntityHandle* entities_out) const
01182 {
01183      int err, alloc = coords_size / 3, size = 0;
01184      iGeom_getPntArrClsf(mInstance, order, coords, coords_size, &entities_out,
01185                          &alloc, &size, &err);
01186      return (Error) err;
01187 }
01188 
01189 inline iGeom::Error iGeom::getSense(EntityHandle ent, EntityHandle wrt_ent,
01190                                     int &sense) const
01191 {
01192      EntityType tp_wrt, tp_ent;
01193      Error err = getEntType(wrt_ent, tp_wrt);
01194      if (iBase_SUCCESS != err)
01195           return err;
01196      err = getEntType(ent, tp_ent);
01197      if (iBase_SUCCESS != err)
01198           return err;
01199      if (tp_wrt - tp_ent != 1)
01200           return iBase_FAILURE;
01201      switch (tp_wrt) {
01202      case iBase_REGION:
01203           return getEntNrmlSense(ent, wrt_ent, sense);
01204           break;
01205      case iBase_FACE:
01206           return getEgFcSense(ent, wrt_ent, sense);
01207      case iBase_EDGE:
01208           return getEgVtxSense(wrt_ent, ent, ent, sense);
01209      case iBase_VERTEX:
01210      case iBase_ALL_TYPES:
01211           return iBase_FAILURE;
01212      }
01213      return iBase_FAILURE;
01214 }
01215 
01216 inline iGeom::Error iGeom::getArrSense(const EntityHandle *ent, int num_ents,
01217                                        EntityHandle wrt_ent, int *sense) const
01218 {
01219      EntityType tp_wrt, tp_ent;
01220      Error err = getEntType(wrt_ent, tp_wrt);
01221      if (iBase_SUCCESS != err)
01222           return err;
01223      err = getEntType(ent[0], tp_ent);
01224      if (iBase_SUCCESS != err)
01225           return err;
01226      if (tp_wrt - tp_ent != 1)
01227           return iBase_FAILURE;
01228      std::vector<EntityHandle> dum_wrts(num_ents, wrt_ent);
01229      switch (tp_wrt) {
01230      case iBase_REGION:
01231           return getArrNrmlSense(ent, num_ents, &dum_wrts[0], num_ents, sense);
01232           break;
01233      case iBase_FACE:
01234           return getEgFcArrSense(ent, num_ents, &dum_wrts[0], num_ents, sense);
01235           break;
01236      case iBase_EDGE:
01237           return getEgVtxArrSense(&dum_wrts[0], num_ents, ent, num_ents, ent,
01238                                   num_ents, sense);
01239           break;
01240      case iBase_VERTEX:
01241      case iBase_ALL_TYPES:
01242           return iBase_FAILURE;
01243           break;
01244      }
01245      return iBase_FAILURE;
01246 }
01247 
01248 inline iGeom::Error iGeom::getEntNrmlSense(EntityHandle face,
01249           EntityHandle region, int& sense) const
01250 {
01251      int err;
01252      iGeom_getEntNrmlSense(mInstance, face, region, &sense, &err);
01253      return (Error) err;
01254 }
01255 
01256 inline iGeom::Error iGeom::getEgFcSense(EntityHandle edge, EntityHandle face,
01257                                         int& sense) const
01258 {
01259      int err;
01260      iGeom_getEgFcSense(mInstance, edge, face, &sense, &err);
01261      return (Error) err;
01262 }
01263 
01264 inline iGeom::Error iGeom::getEgVtxSense(EntityHandle edge, EntityHandle vtx1,
01265           EntityHandle vtx2, int& sense) const
01266 {
01267      int err;
01268      iGeom_getEgVtxSense(mInstance, edge, vtx1, vtx2, &sense, &err);
01269      return (Error) err;
01270 }
01271 
01272 inline iGeom::Error iGeom::getArrNrmlSense(const EntityHandle* faces,
01273           int faces_size, const EntityHandle* vols, int vols_size, int* senses_out) const
01274 {
01275      int err, alloc = std::max(vols_size, faces_size), size = 0;
01276      iGeom_getArrNrmlSense(mInstance, faces, faces_size, vols, vols_size,
01277                            &senses_out, &alloc, &size, &err);
01278      return (Error) err;
01279 }
01280 
01281 inline iGeom::Error iGeom::getEgFcArrSense(const EntityHandle* edges,
01282           int edges_size, const EntityHandle* faces, int faces_size, int* senses_out) const
01283 {
01284      int err, alloc = std::max(edges_size, faces_size), size = 0;
01285      iGeom_getEgFcArrSense(mInstance, edges, edges_size, faces, faces_size,
01286                            &senses_out, &alloc, &size, &err);
01287      return (Error) err;
01288 }
01289 
01290 inline iGeom::Error iGeom::getEgVtxArrSense(const EntityHandle* edges,
01291           int edges_size, const EntityHandle* vertices1, int vertices1_size,
01292           const EntityHandle* vertices2, int vertices2_size, int* senses_out) const
01293 {
01294      int err, alloc = std::max(vertices1_size,
01295                                std::max(vertices2_size, edges_size)), size = 0;
01296      iGeom_getEgVtxArrSense(mInstance, edges, edges_size, vertices1,
01297                             vertices1_size, vertices2, vertices2_size, &senses_out, &alloc, &size,
01298                             &err);
01299      return (Error) err;
01300 }
01301 
01302 inline iGeom::Error iGeom::measure(const EntityHandle* entities,
01303                                    int entities_size, double* measures) const
01304 {
01305      int err, alloc = entities_size, size = 0;
01306      iGeom_measure(mInstance, entities, entities_size, &measures, &alloc, &size,
01307                    &err);
01308      return (Error) err;
01309 }
01310 
01311 inline iGeom::Error iGeom::getFaceType(EntityHandle face, std::string& type) const
01312 {
01313      char buffer[1024];
01314      int err, len = sizeof(buffer);
01315      iGeom_getFaceType(mInstance, face, buffer, &err, &len);
01316      type = std::string(buffer, len);
01317      return (Error) err;
01318 }
01319 
01320 inline iGeom::Error iGeom::isEntParametric(EntityHandle entity,
01321           bool& parametric) const
01322 {
01323      int err, result;
01324      iGeom_isEntParametric(mInstance, entity, &result, &err);
01325      parametric = (result != 0);
01326      return (Error) err;
01327 }
01328 
01329 inline iGeom::Error iGeom::isArrParametric(const EntityHandle* entities,
01330           int entities_size, int* is_parametric) const
01331 {
01332      int err, alloc = entities_size, size = 1;
01333      iGeom_isArrParametric(mInstance, entities, entities_size, &is_parametric,
01334                            &alloc, &size, &err);
01335      return (Error) err;
01336 }
01337 
01338 inline iGeom::Error iGeom::getEntUVtoXYZ(EntityHandle face, double u, double v,
01339           double& x, double& y, double& z) const
01340 {
01341      int err;
01342      iGeom_getEntUVtoXYZ(mInstance, face, u, v, &x, &y, &z, &err);
01343      return (Error) err;
01344 }
01345 
01346 inline iGeom::Error iGeom::getEntUtoXYZ(EntityHandle edge, double u, double& x,
01347                                         double& y, double& z) const
01348 {
01349      int err;
01350      iGeom_getEntUtoXYZ(mInstance, edge, u, &x, &y, &z, &err);
01351      return (Error) err;
01352 }
01353 
01354 inline iGeom::Error iGeom::getArrUVtoXYZ(const EntityHandle* faces,
01355           int faces_size, StorageOrder order, const double* uv, int uv_size,
01356           double* xyz) const
01357 {
01358      int err, alloc = std::max(3 * uv_size / 2, 3 * faces_size), size = 0;
01359      iGeom_getArrUVtoXYZ(mInstance, faces, faces_size, order, uv, uv_size, &xyz,
01360                          &alloc, &size, &err);
01361      return (Error) err;
01362 }
01363 
01364 inline iGeom::Error iGeom::getArrUtoXYZ(const EntityHandle* edges,
01365                                         int edges_size, const double* u, int u_size, StorageOrder order,
01366                                         double* xyz) const
01367 {
01368      int err, alloc = std::max(3 * u_size, 3 * edges_size), size = 0;
01369      iGeom_getArrUtoXYZ(mInstance, edges, edges_size, u, u_size, order, &xyz,
01370                         &alloc, &size, &err);
01371      return (Error) err;
01372 }
01373 
01374 inline iGeom::Error iGeom::getEntXYZtoUV(EntityHandle face, double x, double y,
01375           double z, double& u, double& v) const
01376 {
01377      int err;
01378      iGeom_getEntXYZtoUV(mInstance, face, x, y, z, &u, &v, &err);
01379      return (Error) err;
01380 }
01381 
01382 inline iGeom::Error iGeom::getEntXYZtoU(EntityHandle edge, double x, double y,
01383                                         double z, double& u) const
01384 {
01385      int err;
01386      iGeom_getEntXYZtoU(mInstance, edge, x, y, z, &u, &err);
01387      return (Error) err;
01388 }
01389 
01390 inline iGeom::Error iGeom::getArrXYZtoUV(const EntityHandle* faces,
01391           int faces_size, StorageOrder order, const double* coords, int coords_size,
01392           double* uv) const
01393 {
01394      int err, alloc = std::max(2 * coords_size / 3, 2 * faces_size), size = 0;
01395      iGeom_getArrXYZtoUV(mInstance, faces, faces_size, order, coords, coords_size,
01396                          &uv, &alloc, &size, &err);
01397      return (Error) err;
01398 }
01399 
01400 inline iGeom::Error iGeom::getArrXYZtoU(const EntityHandle* edges,
01401                                         int edges_size, StorageOrder order, const double* coords, int coords_size,
01402                                         double* u) const
01403 {
01404      int err, alloc = std::max(coords_size / 3, edges_size), size = 0;
01405      iGeom_getArrXYZtoU(mInstance, edges, edges_size, order, coords, coords_size,
01406                         &u, &alloc, &size, &err);
01407      return (Error) err;
01408 }
01409 
01410 inline iGeom::Error iGeom::getEntXYZtoUVHint(EntityHandle face, double x,
01411           double y, double z, double& u, double& v) const
01412 {
01413      int err;
01414      iGeom_getEntXYZtoUVHint(mInstance, face, x, y, z, &u, &v, &err);
01415      return (Error) err;
01416 }
01417 
01418 inline iGeom::Error iGeom::getArrXYZtoUVHint(const EntityHandle* faces,
01419           int faces_size, StorageOrder order, const double* coords, int coords_size,
01420           double* uv) const
01421 {
01422      int err, alloc = std::max(2 * coords_size / 3, 2 * faces_size), size = 0;
01423      iGeom_getArrXYZtoUVHint(mInstance, faces, faces_size, order, coords,
01424                              coords_size, &uv, &alloc, &size, &err);
01425      return (Error) err;
01426 }
01427 
01428 inline iGeom::Error iGeom::getEntNrmlUV(EntityHandle face, double u, double v,
01429                                         double& i, double& j, double& k) const
01430 {
01431      int err;
01432      iGeom_getEntNrmlUV(mInstance, face, u, v, &i, &j, &k, &err);
01433      return (Error) err;
01434 }
01435 
01436 inline iGeom::Error iGeom::getArrNrmlUV(const EntityHandle* faces,
01437                                         int faces_size, StorageOrder order, const double* uv, int uv_size,
01438                                         double* normals) const
01439 {
01440      int err, alloc = std::max(3 * uv_size / 2, 3 * faces_size), size = 0;
01441      iGeom_getArrNrmlUV(mInstance, faces, faces_size, order, uv, uv_size,
01442                         &normals, &alloc, &size, &err);
01443      return (Error) err;
01444 }
01445 
01446 inline iGeom::Error iGeom::getEntTgntU(EntityHandle edge, double u, double& i,
01447                                        double& j, double& k) const
01448 {
01449      int err;
01450      iGeom_getEntTgntU(mInstance, edge, u, &i, &j, &k, &err);
01451      return (Error) err;
01452 }
01453 
01454 inline iGeom::Error iGeom::getArrTgntU(const EntityHandle* edges,
01455                                        int edges_size, StorageOrder order, const double* u, int u_size,
01456                                        double* normals) const
01457 {
01458      int err, alloc = std::max(3 * u_size, 3 * edges_size), size = 0;
01459      iGeom_getArrTgntU(mInstance, edges, edges_size, order, u, u_size, &normals,
01460                        &alloc, &size, &err);
01461      return (Error) err;
01462 }
01463 
01464 inline iGeom::Error iGeom::getEnt1stDrvt(EntityHandle handle, double u,
01465           double v, double& du_i, double& du_j, double& du_k, double& dv_i,
01466           double& dv_j, double& dv_k) const
01467 {
01468      int err, du_alloc = 3, dv_alloc = 3, du_size = 0, dv_size = 0;
01469      double du[3], dv[3], *du_ptr = du, *dv_ptr = dv;
01470      iGeom_getEnt1stDrvt(mInstance, handle, u, v, &du_ptr, &du_alloc, &du_size,
01471                          &dv_ptr, &dv_alloc, &dv_size, &err);
01472      du_i = du[0];
01473      du_j = du[1];
01474      du_k = du[2];
01475      dv_i = dv[0];
01476      dv_j = dv[1];
01477      dv_k = dv[2];
01478      return (Error) err;
01479 }
01480 
01481 inline iGeom::Error iGeom::getEnt2ndDrvt(EntityHandle handle, double u,
01482           double v, double& duu_i, double& duu_j, double& duu_k, double& dvv_i,
01483           double& dvv_j, double& dvv_k, double& duv_i, double& duv_j, double& duv_k) const
01484 {
01485      int err, uu_alloc = 3, uv_alloc = 3, vv_alloc = 3, uu_size = 0, uv_size = 0,
01486                                        vv_size = 0;
01487      double uu[3], uv[3], vv[3], *uu_ptr = uu, *vv_ptr = vv, *uv_ptr = uv;
01488      iGeom_getEnt2ndDrvt(mInstance, handle, u, v, &uu_ptr, &uu_alloc, &uu_size,
01489                          &vv_ptr, &vv_alloc, &vv_size, &uv_ptr, &uv_alloc, &uv_size, &err);
01490      duu_i = uu[0];
01491      duu_j = uu[1];
01492      duu_k = uu[2];
01493      dvv_i = vv[0];
01494      dvv_j = vv[1];
01495      dvv_k = vv[2];
01496      duv_i = uv[0];
01497      duv_j = uv[1];
01498      duv_k = uv[2];
01499      return (Error) err;
01500 }
01501 
01502 inline iGeom::Error iGeom::getArr1stDrvt(const EntityHandle* entities,
01503           int entities_size, StorageOrder order, const double* uv, int uv_size,
01504           double* dvtr_u, double* dvtr_v) const
01505 {
01506      int err, allocu = std::max(3 * uv_size / 2, 3 * entities_size), sizeu = 0,
01507                        allocv = allocu, sizev = 0;
01508      std::vector<int> offset1(std::max(uv_size / 2, entities_size) + 1);
01509      std::vector<int> offset2(std::max(uv_size / 2, entities_size) + 1);
01510      int alloc1 = offset1.size(), size1 = 0, *ptr1 = &offset1[0];
01511      int alloc2 = offset2.size(), size2 = 0, *ptr2 = &offset2[0];
01512      iGeom_getArr1stDrvt(mInstance, entities, entities_size, order, uv, uv_size,
01513                          &dvtr_u, &allocu, &sizeu, &ptr1, &alloc1, &size1, &dvtr_v, &allocv,
01514                          &sizev, &ptr2, &alloc2, &size2, &err);
01515      return (Error) err;
01516 }
01517 
01518 inline iGeom::Error iGeom::getArr2ndDrvt(const EntityHandle* entities,
01519           int entities_size, StorageOrder order, const double* uv, int uv_size,
01520           double* dvtr_uu, double* dvtr_vv, double* dvtr_uv) const
01521 {
01522      int err, allocuu = std::max(3 * uv_size / 2, 3 * entities_size), sizeuu = 0,
01523                         allocvv = allocuu, sizevv = 0, allocuv = allocuu, sizeuv = 0;
01524      std::vector<int> offset1(std::max(uv_size / 2, entities_size) + 1);
01525      std::vector<int> offset2(std::max(uv_size / 2, entities_size) + 1);
01526      std::vector<int> offset3(std::max(uv_size / 2, entities_size) + 1);
01527      int alloc1 = offset1.size(), size1 = 0, *ptr1 = &offset1[0];
01528      int alloc2 = offset2.size(), size2 = 0, *ptr2 = &offset2[0];
01529      int alloc3 = offset3.size(), size3 = 0, *ptr3 = &offset3[0];
01530      iGeom_getArr2ndDrvt(mInstance, entities, entities_size, order, uv, uv_size,
01531                          &dvtr_uu, &allocuu, &sizeuu, &ptr1, &alloc1, &size1, &dvtr_vv, &allocvv,
01532                          &sizevv, &ptr2, &alloc2, &size2, &dvtr_uv, &allocuv, &sizeuv, &ptr3,
01533                          &alloc3, &size3, &err);
01534      return (Error) err;
01535 }
01536 
01537 inline iGeom::Error iGeom::getFcCvtrUV(EntityHandle face, double u, double v,
01538                                        double& i1, double& j1, double& k1, double& i2, double& j2, double& k2) const
01539 {
01540      int err;
01541      iGeom_getFcCvtrUV(mInstance, face, u, v, &i1, &j1, &k1, &i2, &j2, &k2, &err);
01542      return (Error) err;
01543 }
01544 
01545 inline iGeom::Error iGeom::getFcArrCvtrUV(const EntityHandle* faces,
01546           int faces_size, StorageOrder order, const double* uv, int uv_size,
01547           double* cvtr1, double* cvtr2) const
01548 {
01549      int err, alloc = std::max(3 * uv_size / 2, 3 * faces_size), size = 0;
01550      iGeom_getFcArrCvtrUV(mInstance, faces, faces_size, order, uv, uv_size,
01551                           &cvtr1, &alloc, &size, &cvtr2, &alloc, &size, &err);
01552      return (Error) err;
01553 }
01554 
01555 inline iGeom::Error iGeom::isEntPeriodic(EntityHandle entity, bool& in_u,
01556           bool& in_v) const
01557 {
01558      int err, u, v;
01559      iGeom_isEntPeriodic(mInstance, entity, &u, &v, &err);
01560      in_u = (u != 0);
01561      in_v = (v != 0);
01562      return (Error) err;
01563 }
01564 
01565 inline iGeom::Error iGeom::isArrPeriodic(const EntityHandle* entities,
01566           int entities_size, int* in_uv) const
01567 {
01568      int err, alloc = 2 * entities_size, size = 0;
01569      iGeom_isArrPeriodic(mInstance, entities, entities_size, &in_uv, &alloc,
01570                          &size, &err);
01571      return (Error) err;
01572 }
01573 
01574 inline iGeom::Error iGeom::isFcDegenerate(EntityHandle face,
01575           bool& is_degenerate) const
01576 {
01577      int err, result;
01578      iGeom_isFcDegenerate(mInstance, face, &result, &err);
01579      is_degenerate = (result != 0);
01580      return (Error) err;
01581 }
01582 
01583 inline iGeom::Error iGeom::isFcArrDegenerate(const EntityHandle* faces,
01584           int faces_size, int* degenerate) const
01585 {
01586      int err, alloc = faces_size, size = 0;
01587      iGeom_isFcArrDegenerate(mInstance, faces, faces_size, &degenerate, &alloc,
01588                              &size, &err);
01589      return (Error) err;
01590 }
01591 
01592 inline iGeom::Error iGeom::getTolerance(int& type_out, double& tolerance_out) const
01593 {
01594      int err;
01595      iGeom_getTolerance(mInstance, &type_out, &tolerance_out, &err);
01596      return (Error) err;
01597 }
01598 
01599 inline iGeom::Error iGeom::getEntTolerance(EntityHandle entity,
01600           double& tolerance) const
01601 {
01602      int err;
01603      iGeom_getEntTolerance(mInstance, entity, &tolerance, &err);
01604      return (Error) err;
01605 }
01606 
01607 inline iGeom::Error iGeom::getArrTolerance(const EntityHandle* entities,
01608           int entities_size, double* tolerances) const
01609 {
01610      int err, alloc = entities_size, size = 0;
01611      iGeom_getArrTolerance(mInstance, entities, entities_size, &tolerances,
01612                            &alloc, &size, &err);
01613      return (Error) err;
01614 }
01615 
01616 inline iGeom::Error iGeom::getEntUVRange(EntityHandle face, double& u_min,
01617           double& v_min, double& u_max, double& v_max) const
01618 {
01619      int err;
01620      iGeom_getEntUVRange(mInstance, face, &u_min, &v_min, &u_max, &v_max, &err);
01621      return (Error) err;
01622 }
01623 
01624 inline iGeom::Error iGeom::getEntURange(EntityHandle edge, double& u_min,
01625                                         double& u_max) const
01626 {
01627      int err;
01628      iGeom_getEntURange(mInstance, edge, &u_min, &u_max, &err);
01629      return (Error) err;
01630 }
01631 
01632 inline iGeom::Error iGeom::getArrUVRange(const EntityHandle* faces,
01633           int faces_size, StorageOrder order, double* uv_min, double* uv_max) const
01634 {
01635      int err, alloc = faces_size, size = 0;
01636      iGeom_getArrUVRange(mInstance, faces, faces_size, order, &uv_min, &alloc,
01637                          &size, &uv_max, &alloc, &size, &err);
01638      return (Error) err;
01639 }
01640 
01641 inline iGeom::Error iGeom::getArrURange(const EntityHandle* edges,
01642                                         int edges_size, double* u_min, double* u_max) const
01643 {
01644      int err, alloc = edges_size, size = 0;
01645      iGeom_getArrURange(mInstance, edges, edges_size, &u_min, &alloc, &size,
01646                         &u_max, &alloc, &size, &err);
01647      return (Error) err;
01648 }
01649 
01650 inline iGeom::Error iGeom::getEntUtoUV(EntityHandle edge, EntityHandle face,
01651                                        double edge_u, double& face_u, double& face_v) const
01652 {
01653      int err;
01654      iGeom_getEntUtoUV(mInstance, edge, face, edge_u, &face_u, &face_v, &err);
01655      return (Error) err;
01656 }
01657 
01658 inline iGeom::Error iGeom::getVtxToUV(EntityHandle vertex, EntityHandle face,
01659                                       double& u, double& v) const
01660 {
01661      int err;
01662      iGeom_getVtxToUV(mInstance, vertex, face, &u, &v, &err);
01663      return (Error) err;
01664 }
01665 
01666 inline iGeom::Error iGeom::getVtxToU(EntityHandle vertex, EntityHandle edge,
01667                                      double& u) const
01668 {
01669      int err;
01670      iGeom_getVtxToU(mInstance, vertex, edge, &u, &err);
01671      return (Error) err;
01672 }
01673 
01674 inline iGeom::Error iGeom::getArrUtoUV(const EntityHandle* edges,
01675                                        int edges_size, const EntityHandle* faces, int faces_size,
01676                                        const double* edge_u, int edge_u_size, StorageOrder order, double* face_uv) const
01677 {
01678      int err, alloc = std::max(edge_u_size, std::max(edges_size, faces_size));
01679      int size = 0;
01680      iGeom_getArrUtoUV(mInstance, edges, edges_size, faces, faces_size, edge_u,
01681                        edge_u_size, order, &face_uv, &alloc, &size, &err);
01682      return (Error) err;
01683 }
01684 
01685 inline iGeom::Error iGeom::getVtxArrToUV(const EntityHandle* vertices,
01686           int vertices_size, const EntityHandle* faces, int faces_size,
01687           StorageOrder order, double* face_uv) const
01688 {
01689      int err, alloc = std::max(vertices_size, faces_size), size = 0;
01690      iGeom_getVtxArrToUV(mInstance, vertices, vertices_size, faces, faces_size,
01691                          order, &face_uv, &alloc, &size, &err);
01692      return (Error) err;
01693 }
01694 
01695 inline iGeom::Error iGeom::getVtxArrToU(const EntityHandle* vertices,
01696                                         int vertices_size, const EntityHandle* edges, int edges_size,
01697                                         double* edge_u) const
01698 {
01699      int err, alloc = std::max(vertices_size, edges_size), size = 0;
01700      iGeom_getVtxArrToU(mInstance, vertices, vertices_size, edges, edges_size,
01701                         &edge_u, &alloc, &size, &err);
01702      return (Error) err;
01703 }
01704 
01705 inline iGeom::Error iGeom::deleteAll()
01706 {
01707      int err;
01708      iGeom_deleteAll(mInstance, &err);
01709      return (Error) err;
01710 }
01711 
01712 inline iGeom::Error iGeom::copyEnt(EntityHandle source, EntityHandle& copy)
01713 {
01714      int err;
01715      iGeom_copyEnt(mInstance, source, &copy, &err);
01716      return (Error) err;
01717 }
01718 
01719 inline iGeom::Error iGeom::createSphere(double radius, EntityHandle& sphere)
01720 {
01721      int err;
01722      iGeom_createSphere(mInstance, radius, &sphere, &err);
01723      return (Error) err;
01724 }
01725 
01726 inline iGeom::Error iGeom::createPrism(double height, int num_sides,
01727                                        double maj_radius, double min_radius, EntityHandle& prism)
01728 {
01729      int err;
01730      iGeom_createPrism(mInstance, height, num_sides, maj_radius, min_radius,
01731                        &prism, &err);
01732      return (Error) err;
01733 }
01734 
01735 inline iGeom::Error iGeom::createBrick(double x, double y, double z,
01736                                        EntityHandle& brick)
01737 {
01738      int err;
01739      iGeom_createBrick(mInstance, x, y, z, &brick, &err);
01740      return (Error) err;
01741 }
01742 
01743 inline iGeom::Error iGeom::createCylinder(double height, double maj_rad,
01744           double min_rad, EntityHandle& cylinder)
01745 {
01746      int err;
01747      iGeom_createCylinder(mInstance, height, maj_rad, min_rad, &cylinder, &err);
01748      return (Error) err;
01749 }
01750 
01751 inline iGeom::Error iGeom::createCone(double height, double maj_rad,
01752           double min_rad, double rad_top, EntityHandle& cone)
01753 {
01754      int err;
01755      iGeom_createCone(mInstance, height, maj_rad, min_rad, rad_top, &cone, &err);
01756      return (Error) err;
01757 }
01758 
01759 
01760 inline iGeom::Error iGeom::createTorus(double maj_rad, double min_rad,
01761                                        EntityHandle& torus)
01762 {
01763      int err;
01764      iGeom_createTorus(mInstance, maj_rad, min_rad, &torus, &err);
01765      return (Error) err;
01766 }
01767 
01768 inline iGeom::Error iGeom::moveEnt(EntityHandle entity, double x, double y,
01769                                    double z)
01770 {
01771      int err;
01772      iGeom_moveEnt(mInstance, entity, x, y, z, &err);
01773      return (Error) err;
01774 }
01775 
01776 inline iGeom::Error iGeom::rotateEnt(EntityHandle entity, double angle,
01777                                      double axis_x, double axis_y, double axis_z)
01778 {
01779      int err;
01780      iGeom_rotateEnt(mInstance, entity, angle, axis_x, axis_y, axis_z, &err);
01781      return (Error) err;
01782 }
01783 inline iGeom::Error iGeom::reflectEnt(EntityHandle entity, double x,
01784                                       double y, double z, double norm_x,
01785                                       double norm_y, double norm_z)
01786 {
01787      int err;
01788      iGeom_reflectEnt(mInstance, entity, x, y, z, norm_x, norm_y, norm_z, &err);
01789      return (Error) err;
01790 }
01791 
01792 inline iGeom::Error iGeom::scaleEnt(EntityHandle entity, double x,
01793                                       double y, double z, double x_factor,
01794                                       double y_factor, double z_factor)
01795 {
01796      int err;
01797      iGeom_scaleEnt(mInstance, entity, x, y, z, x_factor, y_factor, z_factor, &err);
01798      return (Error) err;
01799 }
01800 
01801 inline iGeom::Error iGeom::uniteEnts(const EntityHandle* entities,
01802                                      int entities_size, EntityHandle& result_entity)
01803 {
01804      int err;
01805      iGeom_uniteEnts(mInstance, entities, entities_size, &result_entity, &err);
01806      return (Error) err;
01807 }
01808 
01809 inline iGeom::Error iGeom::subtractEnts(EntityHandle blank, EntityHandle tool,
01810                                         EntityHandle& result)
01811 {
01812      int err;
01813      iGeom_subtractEnts(mInstance, blank, tool, &result, &err);
01814      return (Error) err;
01815 }
01816 
01817 inline iGeom::Error iGeom::intersectEnts(EntityHandle entity1,
01818           EntityHandle entity2, EntityHandle& result)
01819 {
01820      int err;
01821      iGeom_intersectEnts(mInstance, entity1, entity2, &result, &err);
01822      return (Error) err;
01823 }
01824 
01825 inline iGeom::Error iGeom::sectionEnt(EntityHandle entity, double plane_x,
01826                                       double plane_y, double plane_z, double offset, bool reverse,
01827                                       EntityHandle& result)
01828 {
01829      int err;
01830      iGeom_sectionEnt(mInstance, entity, plane_x, plane_y, plane_z, offset,
01831                       reverse, &result, &err);
01832      return (Error) err;
01833 }
01834 
01835 inline iGeom::Error iGeom::sweepEntAboutAxis(EntityHandle entity, double angle,
01836           double axis_x, double axis_y, double axis_z, EntityHandle& swept_entity)
01837 {
01838      int err;
01839      iGeom_sweepEntAboutAxis(mInstance, entity, angle, axis_x, axis_y, axis_z,
01840                              &swept_entity, &err);
01841      return (Error) err;
01842 }
01843 
01844 inline iGeom::Error iGeom::imprintEnts(const EntityHandle* entities,
01845                                        int entities_size)
01846 {
01847      int err;
01848      iGeom_imprintEnts(mInstance, entities, entities_size, &err);
01849      return (Error) err;
01850 }
01851 
01852 inline iGeom::Error iGeom::mergeEnts(const EntityHandle* entities,
01853                                      int entities_size, double tolerance)
01854 {
01855      int err;
01856      iGeom_mergeEnts(mInstance, entities, entities_size, tolerance, &err);
01857      return (Error) err;
01858 }
01859 
01860 
01861 iGeom::Error
01862 iGeom::getErrorType() const
01863 {
01864      int err;
01865      iGeom_getErrorType( mInstance, &err );
01866      return (Error)err;
01867 }
01868 
01869 std::string
01870 iGeom::getDescription() const
01871 {
01872      std::vector<char> buffer(1024);
01873      iGeom_getDescription( mInstance, &buffer[0], buffer.size() );
01874      return std::string(&buffer[0]);
01875 }
01876 
01877 
01878 
01879 
01880 iGeom::EntitySetHandle
01881 iGeom::getRootSet() const
01882 {
01883      int err;
01884      EntitySetHandle result;
01885      iGeom_getRootSet( mInstance, &result, &err );
01886      return iBase_SUCCESS == err ? result : 0;
01887 }
01888 
01889 
01890 
01891 iGeom::Error
01892 iGeom::createEntSet( bool is_list, EntitySetHandle& handle_out )
01893 {
01894      int err;
01895      iGeom_createEntSet( mInstance, is_list, &handle_out, &err );
01896      return (Error)err;
01897 }
01898 
01899 iGeom::Error
01900 iGeom::destroyEntSet( EntitySetHandle handle )
01901 {
01902      int err;
01903      iGeom_destroyEntSet( mInstance, handle, &err );
01904      return (Error)err;
01905 }
01906 
01907 iGeom::Error
01908 iGeom::isList( EntitySetHandle handle, bool& is_list )
01909 {
01910      int err, result;
01911      iGeom_isList( mInstance, handle, &result, &err );
01912      is_list = (result != 0);
01913      return (Error)err;
01914 }
01915 
01916 iGeom::Error
01917 iGeom::getNumEntSets( EntitySetHandle set, int num_hops, int& num_sets_out ) const
01918 {
01919      int err;
01920      iGeom_getNumEntSets( mInstance, set, num_hops, &num_sets_out, &err );
01921      return (Error)err;
01922 }
01923 
01924 iGeom::Error
01925 iGeom::getEntSets( EntitySetHandle set, int num_hops,
01926                    std::vector<EntitySetHandle>& contained_sets_out ) const
01927 {
01928      int err, count;
01929      iGeom_getNumEntSets( mInstance, set, num_hops, &count, &err );
01930      if (iBase_SUCCESS != err)
01931           return (Error)err;
01932      contained_sets_out.resize(count);
01933      int alloc = contained_sets_out.size(), size;
01934      EntitySetHandle* ptr = &contained_sets_out[0];
01935      iGeom_getEntSets( mInstance, set, num_hops, &ptr, &alloc, &size, &err );
01936      return (Error)err;
01937 }
01938 
01939 iGeom::Error
01940 iGeom::addEntToSet( EntityHandle entity, EntitySetHandle set )
01941 {
01942      int err;
01943      iGeom_addEntToSet( mInstance, entity,set, &err );
01944      return (Error)err;
01945 }
01946 
01947 iGeom::Error
01948 iGeom::rmvEntFromSet( EntityHandle entity, EntitySetHandle set )
01949 {
01950      int err;
01951      iGeom_rmvEntFromSet( mInstance, entity,set, &err );
01952      return (Error)err;
01953 }
01954 
01955 iGeom::Error
01956 iGeom::addEntArrToSet( const EntityHandle* entity_handles,
01957                        int entity_handles_size,
01958                        EntitySetHandle entity_set )
01959 {
01960      int err;
01961      iGeom_addEntArrToSet( mInstance, entity_handles, entity_handles_size, entity_set, &err );
01962      return (Error)err;
01963 }
01964 
01965 iGeom::Error
01966 iGeom::rmvEntArrFromSet( const EntityHandle* entity_handles,
01967                          int entity_handles_size,
01968                          EntitySetHandle entity_set )
01969 {
01970      int err;
01971      iGeom_rmvEntArrFromSet( mInstance, entity_handles, entity_handles_size, entity_set, &err );
01972      return (Error)err;
01973 }
01974 
01975 iGeom::Error
01976 iGeom::addEntSet( EntitySetHandle to_add, EntitySetHandle add_to )
01977 {
01978      int err;
01979      iGeom_addEntSet( mInstance, to_add, add_to, &err );
01980      return (Error)err;
01981 }
01982 
01983 iGeom::Error
01984 iGeom::rmvEntSet( EntitySetHandle to_rmv, EntitySetHandle rmv_from )
01985 {
01986      int err;
01987      iGeom_rmvEntSet( mInstance, to_rmv, rmv_from, &err );
01988      return (Error)err;
01989 }
01990 
01991 iGeom::Error
01992 iGeom::isEntContained( EntitySetHandle set, EntityHandle ent, bool& contained_out ) const
01993 {
01994      int err, result;
01995      iGeom_isEntContained( mInstance, set, ent, &result, &err );
01996      contained_out = (result != 0);
01997      return (Error)err;
01998 }
01999 
02000 iGeom::Error
02001 iGeom::isEntArrContained( EntitySetHandle containing_set,
02002                           const EntityHandle* entity_handles,
02003                           int num_entity_handles,
02004                           bool* is_contained_out ) const
02005 {
02006      int err, *ptr = 0, alloc = 0, size = 0;
02007      iGeom_isEntArrContained( mInstance, containing_set,
02008                               entity_handles, num_entity_handles,
02009                               &ptr, &alloc, &size, &err );
02010      if (iBase_SUCCESS != err)
02011           return (Error)err;
02012      for (int i = 0; i < num_entity_handles; ++i)
02013           is_contained_out[i] = (ptr[i] != 0);
02014      free(ptr);
02015      return iBase_SUCCESS;
02016 }
02017 
02018 iGeom::Error
02019 iGeom::isEntSetContained( EntitySetHandle containing_set,
02020                           EntitySetHandle contained_set,
02021                           bool& contained_out ) const
02022 {
02023      int err, result;
02024      iGeom_isEntSetContained( mInstance, containing_set, contained_set, &result, &err );
02025      contained_out = (result != 0);
02026      return (Error)err;
02027 }
02028 
02029 iGeom::Error
02030 iGeom::addPrntChld( EntitySetHandle parent, EntitySetHandle child )
02031 {
02032      int err;
02033      iGeom_addPrntChld( mInstance, parent, child, &err );
02034      return (Error)err;
02035 }
02036 
02037 iGeom::Error
02038 iGeom::rmvPrntChld( EntitySetHandle parent, EntitySetHandle child )
02039 {
02040      int err;
02041      iGeom_rmvPrntChld( mInstance, parent, child, &err );
02042      return (Error)err;
02043 }
02044 
02045 iGeom::Error
02046 iGeom::isChildOf( EntitySetHandle parent, EntitySetHandle child, bool& is_child_out ) const
02047 {
02048      int err, result;
02049      iGeom_isChildOf( mInstance, parent, child, &result, &err );
02050      is_child_out = (result != 0);
02051      return (Error)err;
02052 }
02053 
02054 iGeom::Error
02055 iGeom::getNumChld( EntitySetHandle parent, int num_hops, int& num_child_out ) const
02056 {
02057      int err;
02058      iGeom_getNumChld( mInstance, parent, num_hops, &num_child_out, &err );
02059      return (Error)err;
02060 }
02061 
02062 iGeom::Error
02063 iGeom::getNumPrnt( EntitySetHandle child, int num_hops, int& num_parent_out ) const
02064 {
02065      int err;
02066      iGeom_getNumPrnt( mInstance, child, num_hops, &num_parent_out, &err );
02067      return (Error)err;
02068 }
02069 
02070 iGeom::Error
02071 iGeom::getChldn( EntitySetHandle parent, int num_hops,
02072                  std::vector<EntitySetHandle>& children_out ) const
02073 {
02074      int err, count;
02075      iGeom_getNumChld( mInstance, parent, num_hops, &count, &err );
02076      if (iBase_SUCCESS != err)
02077           return (Error)err;
02078      children_out.resize(count);
02079      int alloc = children_out.size(), size;
02080      EntitySetHandle* ptr = &children_out[0];
02081      iGeom_getEntSets( mInstance, parent, num_hops, &ptr, &alloc, &size, &err );
02082      return (Error)err;
02083 }
02084 
02085 iGeom::Error
02086 iGeom::getPrnts( EntitySetHandle child, int num_hops,
02087                  std::vector<EntitySetHandle>& parents_out ) const
02088 {
02089      int err, count;
02090      iGeom_getNumPrnt( mInstance, child, num_hops, &count, &err );
02091      if (iBase_SUCCESS != err)
02092           return (Error)err;
02093      parents_out.resize(count);
02094      int alloc = parents_out.size(), size;
02095      EntitySetHandle* ptr = &parents_out[0];
02096      iGeom_getEntSets( mInstance, child, num_hops, &ptr, &alloc, &size, &err );
02097      return (Error)err;
02098 }
02099 
02100 
02101 iGeom::Error
02102 iGeom::subtract( EntitySetHandle set1, EntitySetHandle set2,
02103                  EntitySetHandle& result_set_out )
02104 {
02105      int err;
02106      iGeom_subtract( mInstance, set1, set1, &result_set_out, &err );
02107      return (Error)err;
02108 }
02109 
02110 iGeom::Error
02111 iGeom::intersect( EntitySetHandle set1, EntitySetHandle set2,
02112                   EntitySetHandle& result_set_out )
02113 {
02114      int err;
02115      iGeom_intersect( mInstance, set1, set1, &result_set_out, &err );
02116      return (Error)err;
02117 }
02118 
02119 iGeom::Error
02120 iGeom::unite( EntitySetHandle set1, EntitySetHandle set2,
02121               EntitySetHandle& result_set_out )
02122 {
02123      int err;
02124      iGeom_unite( mInstance, set1, set1, &result_set_out, &err );
02125      return (Error)err;
02126 }
02127 
02128 
02129 iGeom::Error
02130 iGeom::createTag( const char* tag_name,
02131                   int tag_num_type_values,
02132                   TagValueType tag_type,
02133                   TagHandle& tag_handle_out )
02134 {
02135      int err;
02136      iGeom_createTag( mInstance, tag_name, tag_num_type_values, tag_type,
02137                       &tag_handle_out, &err, strlen(tag_name) );
02138      return (Error)err;
02139 }
02140 
02141 
02142 iGeom::Error
02143 iGeom::destroyTag( TagHandle tag_handle, bool forced )
02144 {
02145      int err;
02146      iGeom_destroyTag( mInstance, tag_handle, forced, &err );
02147      return (Error)err;
02148 }
02149 
02150 iGeom::Error
02151 iGeom::getTagName( TagHandle tag_handle, std::string& name_out ) const
02152 {
02153      int err;
02154      char buffer[1024];
02155      memset( buffer, 0, sizeof(buffer) );
02156      iGeom_getTagName( mInstance, tag_handle, buffer, &err, sizeof(buffer) );
02157      name_out = buffer;
02158      return (Error)err;
02159 }
02160 
02161 iGeom::Error
02162 iGeom::getTagSizeValues( TagHandle tag_handle, int& size_out ) const
02163 {
02164      int err;
02165      iGeom_getTagSizeValues( mInstance, tag_handle, &size_out, &err );
02166      return (Error)err;
02167 }
02168 
02169 iGeom::Error
02170 iGeom::getTagSizeBytes( TagHandle tag_handle, int& size_out ) const
02171 {
02172      int err;
02173      iGeom_getTagSizeBytes( mInstance, tag_handle, &size_out, &err );
02174      return (Error)err;
02175 }
02176 
02177 iGeom::Error
02178 iGeom::getTagHandle( const char* name, TagHandle& handle_out ) const
02179 {
02180      int err;
02181      iGeom_getTagHandle( mInstance, name, &handle_out, &err, strlen(name) );
02182      return (Error)err;
02183 }
02184 
02185 iGeom::Error
02186 iGeom::getTagType( TagHandle tag_handle, TagValueType& type_out ) const
02187 {
02188      int err, result;
02189      iGeom_getTagType( mInstance, tag_handle, &result, &err );
02190      type_out = (TagValueType)result;
02191      return (Error)err;
02192 }
02193 
02194 
02195 iGeom::Error
02196 iGeom::setEntSetData( EntitySetHandle set_handle,
02197                       TagHandle tag_handle,
02198                       const void* tag_value )
02199 {
02200      int err, size = 1;
02201      iGeom_getTagSizeBytes( mInstance, tag_handle, &size, &err );
02202      iGeom_setEntSetData( mInstance, set_handle, tag_handle,
02203                           tag_value, size, &err);
02204      return (Error)err;
02205 }
02206 
02207 iGeom::Error
02208 iGeom::setEntSetIntData( EntitySetHandle set_handle,
02209                          TagHandle tag_handle,
02210                          int value )
02211 {
02212      int err;
02213      iGeom_setEntSetIntData( mInstance, set_handle, tag_handle, value, &err );
02214      return (Error)err;
02215 }
02216 
02217 iGeom::Error
02218 iGeom::setEntSetDblData( EntitySetHandle set_handle,
02219                          TagHandle tag_handle,
02220                          double value )
02221 {
02222      int err;
02223      iGeom_setEntSetDblData( mInstance, set_handle, tag_handle, value, &err );
02224      return (Error)err;
02225 }
02226 
02227 iGeom::Error
02228 iGeom::setEntSetEHData( EntitySetHandle set_handle,
02229                         TagHandle tag_handle,
02230                         EntityHandle value )
02231 
02232 {
02233      int err;
02234      iGeom_setEntSetEHData( mInstance, set_handle, tag_handle, value, &err );
02235      return (Error)err;
02236 }
02237 
02238 iGeom::Error
02239 iGeom::setEntSetESHData( EntitySetHandle set_handle,
02240                          TagHandle tag_handle,
02241                          EntitySetHandle value )
02242 
02243 {
02244      int err;
02245      iGeom_setEntSetESHData( mInstance, set_handle, tag_handle, value, &err );
02246      return (Error)err;
02247 }
02248 
02249 iGeom::Error
02250 iGeom::getEntSetData( EntitySetHandle set_handle,
02251                       TagHandle tag_handle,
02252                       void* tag_value_out ) const
02253 {
02254      int err, alloc = std::numeric_limits<int>::max(), size;
02255      iGeom_getEntSetData( mInstance, set_handle, tag_handle,
02256                           &tag_value_out, &alloc, &size, &err);
02257      return (Error)err;
02258 }
02259 
02260 iGeom::Error
02261 iGeom::getEntSetIntData( EntitySetHandle set_handle,
02262                          TagHandle tag_handle,
02263                          int& value_out ) const
02264 {
02265      int err;
02266      iGeom_getEntSetIntData( mInstance, set_handle, tag_handle, &value_out, &err );
02267      return (Error)err;
02268 }
02269 
02270 iGeom::Error
02271 iGeom::getEntSetDblData( EntitySetHandle set_handle,
02272                          TagHandle tag_handle,
02273                          double& value_out ) const
02274 {
02275      int err;
02276      iGeom_getEntSetDblData( mInstance, set_handle, tag_handle, &value_out, &err );
02277      return (Error)err;
02278 }
02279 
02280 iGeom::Error
02281 iGeom::getEntSetEHData( EntitySetHandle set_handle,
02282                         TagHandle tag_handle,
02283                         EntityHandle& value_out ) const
02284 
02285 {
02286      int err;
02287      iGeom_getEntSetEHData( mInstance, set_handle, tag_handle, &value_out, &err );
02288      return (Error)err;
02289 }
02290 
02291 iGeom::Error
02292 iGeom::getEntSetESHData( EntitySetHandle set_handle,
02293                          TagHandle tag_handle,
02294                          EntitySetHandle& value_out ) const
02295 
02296 {
02297      int err;
02298      iGeom_getEntSetESHData( mInstance, set_handle, tag_handle, &value_out, &err );
02299      return (Error)err;
02300 }
02301 
02302 iGeom::Error
02303 iGeom::getAllEntSetTags( EntitySetHandle set,
02304                          std::vector<TagHandle>& tags_out ) const
02305 {
02306      if (tags_out.capacity() == 0)
02307           tags_out.resize( 32 );
02308      else
02309           tags_out.resize( tags_out.capacity() );
02310 
02311      int err, alloc = tags_out.size(), size = 0;
02312      TagHandle* ptr = &tags_out[0];
02313      iGeom_getAllEntSetTags( mInstance, set, &ptr, &alloc, &size, &err );
02314      tags_out.resize(size);
02315 
02316      if (iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err) {
02317           alloc = tags_out.size();
02318           ptr = &tags_out[0];
02319           iGeom_getAllEntSetTags( mInstance, set, &ptr, &alloc, &size, &err );
02320      }
02321 
02322      return (Error)err;
02323 }
02324 
02325 iGeom::Error
02326 iGeom::getAllTags( EntityHandle entity,
02327                    std::vector<TagHandle>& tags_out ) const
02328 
02329 {
02330      if (tags_out.capacity() == 0)
02331           tags_out.resize( 32 );
02332      else
02333           tags_out.resize( tags_out.capacity() );
02334 
02335      int err, alloc = tags_out.size(), size = 0;
02336      TagHandle* ptr = &tags_out[0];
02337      iGeom_getAllTags( mInstance, entity, &ptr, &alloc, &size, &err );
02338      tags_out.resize(size);
02339 
02340      if (iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err) {
02341           alloc = tags_out.size();
02342           ptr = &tags_out[0];
02343           iGeom_getAllTags( mInstance, entity, &ptr, &alloc, &size, &err );
02344      }
02345 
02346      return (Error)err;
02347 }
02348 
02349 iGeom::Error
02350 iGeom::rmvEntSetTag( EntitySetHandle set, TagHandle tag )
02351 {
02352      int err;
02353      iGeom_rmvEntSetTag( mInstance, set, tag, &err );
02354      return (Error)err;
02355 }
02356 
02357 iGeom::Error
02358 iGeom::rmvTag( EntityHandle entity, TagHandle tag )
02359 {
02360      int err;
02361      iGeom_rmvTag( mInstance, entity, tag, &err );
02362      return (Error)err;
02363 }
02364 
02365 iGeom::Error
02366 iGeom::rmvArrTag( const EntityHandle* handles, int size, TagHandle tag )
02367 {
02368      int err;
02369      iGeom_rmvArrTag( mInstance, handles, size, tag, &err );
02370      return (Error)err;
02371 }
02372 
02373 
02374 iGeom::Error
02375 iGeom::getArrData( const EntityHandle* entity_handles,
02376                    int entity_handles_size,
02377                    TagHandle tag_handle,
02378                    void* tag_values_out ) const
02379 {
02380      int err, alloc = std::numeric_limits<int>::max(), size;
02381      iGeom_getArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02382                        &tag_values_out, &alloc, &size, &err);
02383      return (Error)err;
02384 }
02385 
02386 iGeom::Error
02387 iGeom::getIntArrData( const EntityHandle* entity_handles,
02388                       int entity_handles_size,
02389                       TagHandle tag_handle,
02390                       int* tag_values_out ) const
02391 {
02392      int err, alloc = std::numeric_limits<int>::max(), size;
02393      iGeom_getIntArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02394                           &tag_values_out, &alloc, &size, &err);
02395      return (Error)err;
02396 }
02397 
02398 iGeom::Error iGeom::getFacets(EntityHandle entity_handle, double dist_tolerance,
02399                               std::vector<double> &points, std::vector<int> &facets) const
02400 {
02401   // try getting results using whatever space input vector has allocated
02402   bool already_allocd = false;
02403   int err, points_size = 0, points_alloc = points.capacity(),
02404     facets_size = 0, facets_alloc = facets.capacity();
02405   if (points_alloc && !facets_alloc) points_alloc = 0;
02406   else if (!points_alloc && facets_alloc) facets_alloc = 0;
02407   if (points_alloc && facets_alloc) already_allocd = true;
02408   double *points_ptr = (points_alloc ? &points[0] : NULL);
02409   int *facets_ptr = (facets_alloc ? &facets[0] : NULL);
02410   iGeom_getFacets(mInstance, entity_handle, dist_tolerance,
02411                   &points_ptr, &points_alloc, &points_size,
02412                   &facets_ptr, &facets_alloc, &facets_size, &err);
02413 
02414   if (iBase_SUCCESS == err && already_allocd) {
02415     points.resize(points_size);
02416     facets.resize(facets_size);
02417     return (Error)err;
02418   }
02419   else if (iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err) {
02420   // if input vector was too small, try again requesting allocation
02421     points_alloc = 0; points_ptr = NULL;
02422     facets_alloc = 0; facets_ptr = NULL;
02423     iGeom_getFacets(mInstance, entity_handle, dist_tolerance,
02424                     &points_ptr, &points_alloc, &points_size,
02425                     &facets_ptr, &facets_alloc, &facets_size, &err);
02426   }
02427 
02428   if (iBase_SUCCESS == err) {
02429     points.resize(points_size);
02430     std::copy(points_ptr, points_ptr+points_size, points.begin());
02431     facets.resize(facets_size);
02432     std::copy(facets_ptr, facets_ptr+facets_size, facets.begin());
02433     free(points_ptr); free(facets_ptr);
02434   }
02435 
02436   return (Error)err;
02437 }
02438 
02439 iGeom::Error
02440 iGeom::getDblArrData( const EntityHandle* entity_handles,
02441                       int entity_handles_size,
02442                       TagHandle tag_handle,
02443                       double* tag_values_out ) const
02444 {
02445      int err, alloc = std::numeric_limits<int>::max(), size;
02446      iGeom_getDblArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02447                           &tag_values_out, &alloc, &size, &err);
02448      return (Error)err;
02449 }
02450 
02451 iGeom::Error
02452 iGeom::getEHArrData( const EntityHandle* entity_handles,
02453                      int entity_handles_size,
02454                      TagHandle tag_handle,
02455                      EntityHandle* tag_values_out ) const
02456 
02457 {
02458      int err, alloc = std::numeric_limits<int>::max(), size;
02459      iGeom_getEHArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02460                          &tag_values_out, &alloc, &size, &err);
02461      return (Error)err;
02462 }
02463 
02464 iGeom::Error
02465 iGeom::getESHArrData( const EntityHandle* entity_handles,
02466                       int entity_handles_size,
02467                       TagHandle tag_handle,
02468                       EntitySetHandle* tag_values_out ) const
02469 
02470 {
02471      int err, alloc = std::numeric_limits<int>::max(), size;
02472      iGeom_getESHArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02473                           &tag_values_out, &alloc, &size, &err);
02474      return (Error)err;
02475 }
02476 
02477 iGeom::Error
02478 iGeom::setArrData( const EntityHandle* entity_handles,
02479                    int entity_handles_size,
02480                    TagHandle tag_handle,
02481                    const void* tag_values )
02482 {
02483      int err, size = 1;
02484      iGeom_getTagSizeBytes( mInstance, tag_handle, &size, &err );
02485      iGeom_setArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02486                        tag_values, size*entity_handles_size,
02487                        &err );
02488      return (Error)err;
02489 }
02490 
02491 iGeom::Error
02492 iGeom::setIntArrData( const EntityHandle* entity_handles,
02493                       int entity_handles_size,
02494                       TagHandle tag_handle,
02495                       const int* tag_values )
02496 {
02497      int err, size = 1;
02498      iGeom_getTagSizeValues( mInstance, tag_handle, &size, &err );
02499      iGeom_setIntArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02500                           tag_values, size*entity_handles_size, &err );
02501      return (Error)err;
02502 }
02503 
02504 iGeom::Error
02505 iGeom::setDblArrData( const EntityHandle* entity_handles,
02506                       int entity_handles_size,
02507                       TagHandle tag_handle,
02508                       const double* tag_values )
02509 {
02510      int err, size = 1;
02511      iGeom_getTagSizeValues( mInstance, tag_handle, &size, &err );
02512      iGeom_setDblArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02513                           tag_values, size*entity_handles_size, &err );
02514      return (Error)err;
02515 }
02516 
02517 iGeom::Error
02518 iGeom::setEHArrData( const EntityHandle* entity_handles,
02519                      int entity_handles_size,
02520                      TagHandle tag_handle,
02521                      const EntityHandle* tag_values )
02522 {
02523      int err, size = 1;
02524      iGeom_getTagSizeValues( mInstance, tag_handle, &size, &err );
02525      iGeom_setEHArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02526                          tag_values, size*entity_handles_size, &err );
02527      return (Error)err;
02528 }
02529 
02530 iGeom::Error
02531 iGeom::setESHArrData( const EntityHandle* entity_handles,
02532                       int entity_handles_size,
02533                       TagHandle tag_handle,
02534                       const EntitySetHandle* tag_values )
02535 {
02536      int err, size = 1;
02537      iGeom_getTagSizeValues( mInstance, tag_handle, &size, &err );
02538      iGeom_setESHArrData( mInstance, entity_handles, entity_handles_size, tag_handle,
02539                           tag_values, size*entity_handles_size, &err );
02540      return (Error)err;
02541 }
02542 
02543 
02544 
02545 iGeom::Error
02546 iGeom::setData( EntityHandle entity_handle,
02547                 TagHandle tag_handle,
02548                 const void* tag_value )
02549 {
02550      int err, size = 1;
02551      iGeom_getTagSizeBytes( mInstance, tag_handle, &size, &err );
02552      iGeom_setData( mInstance, entity_handle, tag_handle,
02553                     tag_value, size, &err);
02554      return (Error)err;
02555 }
02556 
02557 iGeom::Error
02558 iGeom::setIntData( EntityHandle entity_handle,
02559                    TagHandle tag_handle,
02560                    int value )
02561 {
02562      int err;
02563      iGeom_setIntData( mInstance, entity_handle, tag_handle, value, &err );
02564      return (Error)err;
02565 }
02566 
02567 iGeom::Error
02568 iGeom::setDblData( EntityHandle entity_handle,
02569                    TagHandle tag_handle,
02570                    double value )
02571 {
02572      int err;
02573      iGeom_setDblData( mInstance, entity_handle, tag_handle, value, &err );
02574      return (Error)err;
02575 }
02576 
02577 iGeom::Error
02578 iGeom::setEHData( EntityHandle entity_handle,
02579                   TagHandle tag_handle,
02580                   EntityHandle value )
02581 
02582 {
02583      int err;
02584      iGeom_setEHData( mInstance, entity_handle, tag_handle, value, &err );
02585      return (Error)err;
02586 }
02587 
02588 iGeom::Error
02589 iGeom::setESHData( EntityHandle entity_handle,
02590                    TagHandle tag_handle,
02591                    EntitySetHandle value )
02592 
02593 {
02594      int err;
02595      iGeom_setESHData( mInstance, entity_handle, tag_handle, value, &err );
02596      return (Error)err;
02597 }
02598 
02599 iGeom::Error
02600 iGeom::getData( EntityHandle entity_handle,
02601                 TagHandle tag_handle,
02602                 void* tag_value_out ) const
02603 {
02604      int err, alloc = std::numeric_limits<int>::max(), size;
02605      iGeom_getData( mInstance, entity_handle, tag_handle,
02606                     &tag_value_out, &alloc, &size, &err);
02607      return (Error)err;
02608 }
02609 
02610 iGeom::Error
02611 iGeom::getIntData( EntityHandle entity_handle,
02612                    TagHandle tag_handle,
02613                    int& value_out ) const
02614 {
02615      int err;
02616      iGeom_getIntData( mInstance, entity_handle, tag_handle, &value_out, &err );
02617      return (Error)err;
02618 }
02619 
02620 iGeom::Error
02621 iGeom::getDblData( EntityHandle entity_handle,
02622                    TagHandle tag_handle,
02623                    double& value_out ) const
02624 {
02625      int err;
02626      iGeom_getDblData( mInstance, entity_handle, tag_handle, &value_out, &err );
02627      return (Error)err;
02628 }
02629 
02630 iGeom::Error
02631 iGeom::getEHData( EntityHandle entity_handle,
02632                   TagHandle tag_handle,
02633                   EntityHandle& value_out ) const
02634 {
02635      int err;
02636      iGeom_getEHData( mInstance, entity_handle, tag_handle, &value_out, &err );
02637      return (Error)err;
02638 }
02639 
02640 iGeom::Error
02641 iGeom::getESHData( EntityHandle entity_handle,
02642                    TagHandle tag_handle,
02643                    EntitySetHandle& value_out ) const
02644 {
02645      int err;
02646      iGeom_getESHData( mInstance, entity_handle, tag_handle, &value_out, &err );
02647      return (Error)err;
02648 }
02649 
02650 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines