cgma
iGeom_CGMA.cc File Reference
#include "InitCGMA.hpp"
#include "GMem.hpp"
#include <iostream>
#include <limits>
#include <math.h>
#include "GeometryQueryTool.hpp"
#include "CubitCompat.hpp"
#include "CCubitFile.hpp"
#include "cgm/CGMConfig.h"
#include "iGeom.h"
#include "CATag.hpp"
#include "CGMAIterator.hpp"
#include "iGeomError.h"
#include "RefEntityFactory.hpp"
#include "BasicTopologyEntity.hpp"
#include "RefGroup.hpp"
#include "Body.hpp"
#include "RefVertex.hpp"
#include "RefEdge.hpp"
#include "RefFace.hpp"
#include "RefVolume.hpp"
#include "CubitVector.hpp"
#include "CGMApp.hpp"
#include "GeometryModifyTool.hpp"
#include "Surface.hpp"
#include "CubitFile.hpp"
#include "CubitDefines.h"
#include "MergeTool.hpp"
#include "GeometryDefines.h"

Go to the source code of this file.

Classes

class  iGeomArrayManager

Defines

#define ITAPS_API
#define RETURN(a)   do {CGM_iGeom_setLastError((*err = a)); return; } while(false)
#define ERROR(a, b)   do {CGM_iGeom_setLastError((*err = a), b); return; } while(false)
#define ARRAY_IN(b)   b, b ## _size
#define ARRAY_INOUT(b)   b, b ## _allocated, b ## _size
#define ALLOC_CHECK_ARRAY(array, this_size)
#define KEEP_ARRAY(array)   array ## _manager .keep_array()
#define ALLOC_CHECK_ARRAY_NOFAIL(array, this_size)   ALLOC_CHECK_ARRAY(array, this_size); KEEP_ARRAY(array)
#define TAG_HANDLE(handle)   reinterpret_cast<long>(handle)
#define ENTITY_HANDLE(handle)   reinterpret_cast<RefEntity*>(handle)
#define SET_HANDLE(handle)   reinterpret_cast<RefGroup*>(handle)
#define ENTITY_HANDLE_ARRAY(array)   reinterpret_cast<RefEntity**>(array)
#define SET_HANDLE_ARRAY(array)   reinterpret_cast<RefGroup**>(array)
#define ENTITY_HANDLE_CONST_ARRAY(array)   reinterpret_cast<RefEntity* const*>(array)
#define SET_HANDLE_CONST_ARRAY(array)   reinterpret_cast<RefGroup* const*>(array)
#define ENTITY_HANDLE_ARRAY_PTR(array)   reinterpret_cast<RefEntity***>(array)
#define SET_HANDLE_ARRAY_PTR(array)   reinterpret_cast<RefGroup***>(array)
#define CAST_TO_VOID(ptr)   reinterpret_cast<void*>(ptr)
#define TAG_HANDLE_ARRAY_INOUT(a)   reinterpret_cast<long**>(a), a ## _allocated, a ## _size
#define TM   reinterpret_cast<CGMTagManager*>(instance)
#define gqt   GeometryQueryTool::instance()
#define gmt   GeometryModifyTool::instance()

Functions

static void iGeom_get_adjacent_entities (const RefEntity *from, const int to_dim, DLIList< RefEntity * > &adj_ents, int *err)
static void tokenize (const std::string &str, std::vector< std::string > &tokens)
static bool match_option (const std::string &opt, const char *name, std::string &value)
static void iGeom_load_cub_geometry (const char *name, int *err)
static iBase_ErrorType process_attribs (iGeom_Instance instance, DLIList< RefEntity * > &ref_list)
static CubitStatus iGeom_closest_point (RefEntity *this_entity, const CubitVector &near, CubitVector &on)
static CubitStatus iGeom_closest_point_trimmed (RefEntity *this_entity, const CubitVector &near, CubitVector &on)
static CubitStatus iGeom_closest_point_and_normal (RefEntity *this_entity, const CubitVector &near, CubitVector &on, CubitVector &normal)
static CubitStatus iGeom_bounding_box (RefEntity *entity, CubitVector &minc, CubitVector &maxc)
static CubitStatus iGeom_fire_ray (const CubitVector &point, const CubitVector &direction, DLIList< RefEntity * > &entities, DLIList< double > &ray_params)
static RefEntityiGeom_get_point_containment (const CubitVector &pt)
static int iGeom_get_nonmanifold_sense (const BasicTopologyEntity *child, const BasicTopologyEntity *parent, int *err)
static int iGeom_edge_vertex_sense (const RefEdge *cedge, const RefVertex *vtx1, const RefVertex *vtx2, int *err)
static int iGeom_is_parametric (RefEntity *entity)
static iBase_ErrorType iGeom_get_vtx_to_u (RefVertex *vertex, RefEdge *edge, double &u)
static iBase_ErrorType iGeom_get_vtx_to_uv (RefVertex *vertex, RefFace *face, double &u, double &uv)
static CubitStatus iGeom_normal_from_uv (RefFace *face, double u, double v, CubitVector &normal)
static CubitStatus iGeom_is_periodic (RefEntity *entity, int &u, int &v)
static bool iGeom_is_face_degenerate (RefFace *face)
static int count_ibase_type (int ibase_type, const DLIList< CubitEntity * > &list, int *err)
static void copy_ibase_type (int ibase_type, const DLIList< CubitEntity * > &list, iBase_EntityHandle **entity_handles, int *entity_handles_alloc, int *entity_handles_size, int *err)
static void append_ibase_type (int ibase_type, const DLIList< CubitEntity * > &source_list, DLIList< RefEntity * > &target_list, int *err)
static void append_all_ibase_type (int ibase_type, DLIList< RefEntity * > &target_list, int *err)
static CubitStatus init_cgm (const std::string &engine)
ITAPS_API void iGeom_getErrorType (iGeom_Instance geom, int *error_type)
 Get the error type returned from the last iGeom function.
ITAPS_API void iGeom_getDescription (iGeom_Instance geom, char *description_buffer, int description_buffer_length)
 Get a description of the error returned from the last iGeom call.
ITAPS_API void iGeom_newGeom (const char *options, iGeom_Instance *instance_out, int *err, const int options_size)
 Construct a new iGeom instance.
ITAPS_API void iGeom_dtor (iGeom_Instance instance, int *err)
 Destroy an iGeom instance.
ITAPS_API void iGeom_load (iGeom_Instance instance, const char *name, const char *options, int *err, int name_len, int options_size)
 Load a geom from a file.
ITAPS_API void iGeom_save (iGeom_Instance instance, const char *name, const char *options, int *err, int name_len, int options_len)
 Save a geom to a file.
ITAPS_API void iGeom_getRootSet (iGeom_Instance, iBase_EntitySetHandle *root, int *err)
 Get handle of the root set for this instance.
ITAPS_API void iGeom_getBoundBox (iGeom_Instance, double *min_x, double *min_y, double *min_z, double *max_x, double *max_y, double *max_z, int *err)
 Get the bounding box of the entire model.
ITAPS_API void iGeom_initEntIter (iGeom_Instance instance, iBase_EntitySetHandle entity_set_handle, const int dimension, iBase_EntityIterator *iterator, int *err)
 Initialize an iterator over specified entity type.
ITAPS_API void iGeom_initEntArrIter (iGeom_Instance instance, iBase_EntitySetHandle entity_set_handle, int type, int requested_array_size, iBase_EntityArrIterator *entArr_iterator, int *err)
 Initialize an array iterator over specified entity type and size.
ITAPS_API void iGeom_getNextEntIter (iGeom_Instance instance, iBase_EntityIterator gentity_iterator, iBase_EntityHandle *gentity_handle, int *has_data, int *err)
 Get entity corresponding to an iterator and increment iterator.
ITAPS_API void iGeom_getNextEntArrIter (iGeom_Instance instance, iBase_EntityArrIterator entArr_iterator, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *has_data, int *err)
 Get entities contained in array iterator and increment iterator.
ITAPS_API void iGeom_resetEntIter (iGeom_Instance instance, iBase_EntityIterator gentity_iterator, int *err)
 Reset the iterator.
ITAPS_API void iGeom_resetEntArrIter (iGeom_Instance instance, iBase_EntityArrIterator gentity_iterator, int *err)
 Reset the array iterator.
ITAPS_API void iGeom_endEntIter (iGeom_Instance instance, iBase_EntityIterator gentity_iterator, int *err)
 Destroy the specified iterator.
ITAPS_API void iGeom_endEntArrIter (iGeom_Instance instance, iBase_EntityArrIterator gentity_iterator, int *err)
 Destroy the specified array iterator.
ITAPS_API void iGeom_isChildOf (iGeom_Instance instance, iBase_EntitySetHandle parent_entity_set, iBase_EntitySetHandle child_entity_set, int *is_child, int *err)
 Return whether two sets are related by parent/child links.
ITAPS_API void iGeom_getChldn (iGeom_Instance instance, iBase_EntitySetHandle from_entity_set, const int num_hops, iBase_EntitySetHandle **entity_set_handles, int *entity_set_handles_allocated, int *entity_set_handles_size, int *err)
 Get the child sets linked from a specified set.
ITAPS_API void iGeom_getPrnts (iGeom_Instance instance, iBase_EntitySetHandle from_entity_set, const int num_hops, iBase_EntitySetHandle **entity_set_handles, int *entity_set_handles_allocated, int *entity_set_handles_size, int *err)
 Get the parent sets linked from a specified set.
ITAPS_API void iGeom_getNumChld (iGeom_Instance instance, iBase_EntitySetHandle entity_set, const int num_hops, int *num_child, int *err)
 Get the number of child sets linked from a specified set.
ITAPS_API void iGeom_getNumPrnt (iGeom_Instance instance, iBase_EntitySetHandle entity_set, const int num_hops, int *num_parent, int *err)
 Get the number of parent sets linked from a specified set.
ITAPS_API void iGeom_addPrntChld (iGeom_Instance instance, iBase_EntitySetHandle parent_entity_set, iBase_EntitySetHandle child_entity_set, int *err)
 Add parent/child links between two sets.
ITAPS_API void iGeom_rmvPrntChld (iGeom_Instance instance, iBase_EntitySetHandle parent_entity_set, iBase_EntitySetHandle child_entity_set, int *err)
 Remove parent/child links between two sets.
ITAPS_API void iGeom_getEntities (iGeom_Instance instance, iBase_EntitySetHandle set_handle, int gentity_type, iBase_EntityHandle **gentity_handles, int *gentity_handles_allocated, int *gentity_handles_size, int *err)
 Get entities of specific type in set or instance.
ITAPS_API void iGeom_getNumOfType (iGeom_Instance instance, iBase_EntitySetHandle set_handle, int gentity_type, int *count, int *err)
 Get the number of entities with the specified type in the instance or set.
ITAPS_API void iGeom_getEntType (iGeom_Instance instance, iBase_EntityHandle handle, int *gtype, int *err)
 Get the entity type for the specified entity.
ITAPS_API void iGeom_getArrType (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int **gtype, int *gtype_allocated, int *gtype_size, int *err)
 Get the entity type for the specified entities.
ITAPS_API void iGeom_getEntAdj (iGeom_Instance instance, iBase_EntityHandle gentity_handle, int to_dimension, iBase_EntityHandle **adj_gentities, int *adj_gentities_allocated, int *adj_gentities_size, int *err)
 Get entities of specified type adjacent to an entity.
ITAPS_API void iGeom_getArrAdj (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, const int entity_handles_size, int requested_entity_type, iBase_EntityHandle **adj_entity_handles, int *adj_entity_handles_allocated, int *adj_entity_handles_size, int **offset, int *offset_allocated, int *offset_size, int *err)
 Get entities of specified type adjacent to entities.
ITAPS_API void iGeom_getEnt2ndAdj (iGeom_Instance instance, iBase_EntityHandle gentity_handle, int bridge_dimension, int to_dimension, iBase_EntityHandle **adjacent_gentities, int *adjacent_gentities_allocated, int *adjacent_gentities_size, int *err)
 Get "2nd order" adjacencies to an entity.
ITAPS_API void iGeom_getArr2ndAdj (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, int order_adjacent_key, int requested_entity_type, iBase_EntityHandle **adj_entity_handles, int *adj_entity_handles_allocated, int *adj_entity_handles_size, int **offset, int *offset_allocated, int *offset_size, int *err)
 Get "2nd order" adjacencies to an array of entities.
ITAPS_API void iGeom_isEntAdj (iGeom_Instance instance, iBase_EntityHandle gentity_handle1, iBase_EntityHandle gentity_handle2, int *are_adjacent, int *err)
 Return whether two entities are adjacent.
ITAPS_API void iGeom_isArrAdj (iGeom_Instance instance, iBase_EntityHandle const *entity_handles_1, int entity_handles_1_size, iBase_EntityHandle const *entity_handles_2, int entity_handles_2_size, int **is_adjacent_info, int *is_adjacent_info_allocated, int *is_adjacent_info_size, int *err)
 Return whether entity pairs are adjacent.
ITAPS_API void iGeom_getTopoLevel (iGeom_Instance instance, int *level, int *err)
 Return the topology level of the geometry.
ITAPS_API void iGeom_createTag (iGeom_Instance instance, const char *tag_name, int tag_size, int tag_type, iBase_TagHandle *tag_handle, int *err, int tag_name_len)
 Create a tag with specified name, size, and type.
ITAPS_API void iGeom_destroyTag (iGeom_Instance instance, iBase_TagHandle tag_handle, int forced, int *err)
 Destroy a tag.
ITAPS_API void iGeom_getTagName (iGeom_Instance instance, iBase_TagHandle tag_handle, char *name, int *err, int name_len)
 Get the name for a given tag handle.
ITAPS_API void iGeom_getTagSizeValues (iGeom_Instance instance, iBase_TagHandle tag_handle, int *tag_size, int *err)
 Get size of a tag in units of numbers of tag data type.
ITAPS_API void iGeom_getTagSizeBytes (iGeom_Instance instance, iBase_TagHandle tag_handle, int *tag_size, int *err)
 Get size of a tag in units of bytes.
ITAPS_API void iGeom_getTagType (iGeom_Instance instance, iBase_TagHandle tag_handle, int *type, int *err)
 Get the data type of the specified tag handle.
ITAPS_API void iGeom_getTagHandle (iGeom_Instance instance, const char *tag_name, iBase_TagHandle *tag_handle, int *err, int tag_name_len)
 Get a the handle of an existing tag with the specified name.
ITAPS_API void iGeom_rmvArrTag (iGeom_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, int *err)
 Remove a tag value from an array of entities.
ITAPS_API void iGeom_rmvTag (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, int *err)
 Remove a tag value from an entity.
ITAPS_API void iGeom_getAllTags (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle **tag_handles, int *tag_handles_allocated, int *tag_handles_size, int *err)
 Get all the tags associated with a specified entity handle.
ITAPS_API void iGeom_getArrData (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, void **tag_value_tmp, int *tag_value_allocated, int *tag_value_size, int *err)
 Get tag values of arbitrary type for an array of entities.
ITAPS_API void iGeom_getIntArrData (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, int **tag_value, int *tag_value_allocated, int *tag_value_size, int *err)
 Get tag values of integer type for an array of entities.
ITAPS_API void iGeom_getDblArrData (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, double **tag_value, int *tag_value_allocated, int *tag_value_size, int *err)
 Get tag values of double type for an array of entities.
ITAPS_API void iGeom_getEHArrData (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, iBase_EntityHandle **tag_value, int *tag_value_allocated, int *tag_value_size, int *err)
 Get tag values of entity handle type for an array of entities.
ITAPS_API void iGeom_getESHArrData (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, iBase_EntitySetHandle **tag_value, int *tag_value_allocated, int *tag_value_size, int *err)
 Get tag values of entity set handle type for an array of entities.
ITAPS_API void iGeom_setArrData (iGeom_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, const void *tag_value_tmp, const int tag_value_size, int *err)
 Set tag values of arbitrary type on an array of entities.
ITAPS_API void iGeom_setIntArrData (iGeom_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, const int *tag_value, int tag_value_size, int *err)
 Set tag values of integer type on an array of entities.
ITAPS_API void iGeom_setDblArrData (iGeom_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, const double *tag_value, int tag_value_size, int *err)
 Set tag values of double type on an array of entities.
ITAPS_API void iGeom_setEHArrData (iGeom_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, iBase_EntityHandle const *tag_values, int tag_values_size, int *err)
 Set tag values of entity handle type on an array of entities.
ITAPS_API void iGeom_setESHArrData (iGeom_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, iBase_TagHandle tag_handle, iBase_EntitySetHandle const *tag_values, int tag_values_size, int *err)
 Set tag values of entity set handle type on an array of entities.
ITAPS_API void iGeom_getData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, void **tag_value_tmp, int *tag_value_allocated, int *tag_value_size, int *err)
 Get the value of a tag of arbitrary type on an entity.
ITAPS_API void iGeom_getIntData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, int *data_out, int *err)
 Get the value of a tag of integer type on an entity.
ITAPS_API void iGeom_getDblData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, double *data_out, int *err)
 Get the value of a tag of double type on an entity.
ITAPS_API void iGeom_getEHData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, iBase_EntityHandle *data_out, int *err)
 Get the value of a tag of entity handle type on an entity.
ITAPS_API void iGeom_getESHData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, iBase_EntitySetHandle *data_out, int *err)
 Get the value of a tag of entity set handle type on an entity.
ITAPS_API void iGeom_setData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, const void *tag_value_tmp, int tag_value_size, int *err)
 Set a tag value of arbitrary type on an entity.
ITAPS_API void iGeom_setIntData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, int tag_value, int *err)
 Set a tag value of integer type on an entity.
ITAPS_API void iGeom_setDblData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, double tag_value, int *err)
 Set a tag value of double type on an entity.
ITAPS_API void iGeom_setEHData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, iBase_EntityHandle tag_value, int *err)
 Set a tag value of entity handle type on an entity.
ITAPS_API void iGeom_setESHData (iGeom_Instance instance, iBase_EntityHandle entity_handle, iBase_TagHandle tag_handle, iBase_EntitySetHandle tag_value, int *err)
 Set a tag value of entity set handle type on an entity.
ITAPS_API void iGeom_rmvEntSetTag (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, int *err)
 Remove a tag value from an entity set.
ITAPS_API void iGeom_getAllEntSetTags (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle **tag_handles, int *tag_handles_allocated, int *tag_handles_size, int *err)
 Get all the tags associated with a specified entity set.
ITAPS_API void iGeom_getEntSetData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, void **tag_value_tmp, int *tag_value_allocated, int *tag_value_size, int *err)
 Get the value of a tag of arbitrary type on an entity set.
ITAPS_API void iGeom_getEntSetIntData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, int *tag_ptr, int *err)
 Get the value of a tag of integer type on an entity set.
ITAPS_API void iGeom_getEntSetDblData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, double *tag_ptr, int *err)
 Get the value of a tag of double type on an entity set.
ITAPS_API void iGeom_getEntSetEHData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, iBase_EntityHandle *tag_ptr, int *err)
 Get the value of a tag of entity handle type on an entity set.
ITAPS_API void iGeom_getEntSetESHData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, iBase_EntitySetHandle *tag_ptr, int *err)
 Get the value of a tag of entity set handle type on an entity set.
ITAPS_API void iGeom_setEntSetData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, const void *tag_value_tmp, int tag_value_size, int *err)
 Set a tag value of arbitrary type on an entity set.
ITAPS_API void iGeom_setEntSetIntData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, int tag_value, int *err)
 Set a tag value of integer type on an entity set.
ITAPS_API void iGeom_setEntSetDblData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, double tag_value, int *err)
 Set a tag value of double type on an entity set.
ITAPS_API void iGeom_setEntSetEHData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, iBase_EntityHandle tag_value, int *err)
 Set a tag value of entity handle type on an entity set.
ITAPS_API void iGeom_setEntSetESHData (iGeom_Instance instance, iBase_EntitySetHandle entity_set, iBase_TagHandle tag_handle, iBase_EntitySetHandle tag_value, int *err)
 Set a tag value of entity set handle type on an entity set.
ITAPS_API void iGeom_getEntClosestPt (iGeom_Instance instance, iBase_EntityHandle entity_handle, double near_x, double near_y, double near_z, double *on_x, double *on_y, double *on_z, int *err)
 Get closest point to an entity.
ITAPS_API void iGeom_getEntClosestPtTrimmed (iGeom_Instance instance, iBase_EntityHandle entity_handle, double near_x, double near_y, double near_z, double *on_x, double *on_y, double *on_z, int *err)
 Get closest point for an array of entities and points For surfaces, closest point could be on the void space inside it. Get closest point for an array of entities and points. If either the number of entities or number of coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.
ITAPS_API void iGeom_getArrClosestPt (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int storage_order, const double *near_coordinates, int near_coordinates_size, double **on_coordinates, int *on_coordinates_allocated, int *on_coordinates_size, int *err)
 Get closest point for an array of entities and points For surfaces, it made sure the closest point in on surface. Get closest point for an array of entities and points. If either the number of entities or number of coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.
ITAPS_API void iGeom_getEntNrmlPlXYZ (iGeom_Instance instance, iBase_EntityHandle entity_handle, double x, double y, double z, double *pt_x, double *pt_y, double *pt_z, double *nmrl_i, double *nmrl_j, double *nmrl_k, int *err)
 Get the normal vector AND closest point on an entity at given position.
ITAPS_API void iGeom_getArrNrmlPlXYZ (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, const int gentity_handles_size, int storage_order, const double *near_coordinates, const int near_coordinates_size, double **on_coordinates, int *on_coordinates_allocated, int *on_coordinates_size, double **normals, int *normals_allocated, int *normals_size, int *err)
 Get the normal vector AND closest point on an entity(ies) at given position(s)
ITAPS_API void iGeom_getEntNrmlXYZ (iGeom_Instance instance, iBase_EntityHandle entity_handle, double near_x, double near_y, double near_z, double *nmrl_i, double *nmrl_j, double *nmrl_k, int *err)
 Get the normal vector on an entity at the given position Get the normal vector on an entity at the given position.
ITAPS_API void iGeom_getArrNrmlXYZ (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int storage_order, const double *coordinates, int coordinates_size, double **normals, int *normals_allocated, int *normals_size, int *err)
 Get the normal vector on an entity(ies) at given position(s)
ITAPS_API void iGeom_getEntTgntXYZ (iGeom_Instance instance, iBase_EntityHandle entity_handle, double x, double y, double z, double *tgnt_i, double *tgnt_j, double *tgnt_k, int *err)
 Get the tangent vector on an entity at given position.
ITAPS_API void iGeom_getArrTgntXYZ (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int storage_order, const double *coordinates, int coordinates_size, double **tangents, int *tangents_allocated, int *tangents_size, int *err)
 Get the tangent vector on an entity(ies) at given position(s)
ITAPS_API void iGeom_getFcCvtrXYZ (iGeom_Instance instance, iBase_EntityHandle face_handle, double x, double y, double z, double *cvtr1_i, double *cvtr1_j, double *cvtr1_k, double *cvtr2_i, double *cvtr2_j, double *cvtr2_k, int *err)
 Get the two principle curvature vectors for a face at a point.
ITAPS_API void iGeom_getEgCvtrXYZ (iGeom_Instance instance, iBase_EntityHandle edge_handle, double x, double y, double z, double *cvtr_i, double *cvtr_j, double *cvtr_k, int *err)
 Get the principle curvature vector for an edge at a point.
ITAPS_API void iGeom_getEntArrCvtrXYZ (iGeom_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, int storage_order, const double *coordinates, int coordinates_size, double **cvtr_1, int *cvtr_1_allocated, int *cvtr_1_size, double **cvtr_2, int *cvtr_2_allocated, int *cvtr_2_size, int *err)
 Get the curvature(s) on an entity(ies) at given position(s)
ITAPS_API void iGeom_getEgEvalXYZ (iGeom_Instance instance, iBase_EntityHandle edge_handle, double x, double y, double z, double *on_x, double *on_y, double *on_z, double *tan_i, double *tan_j, double *tan_k, double *cvtr_i, double *cvtr_j, double *cvtr_k, int *err)
 Get closest point, tangent, and curvature of edge.
ITAPS_API void iGeom_getFcEvalXYZ (iGeom_Instance instance, iBase_EntityHandle face_handle, double x, double y, double z, double *on_x, double *on_y, double *on_z, double *norm_i, double *norm_j, double *norm_k, double *cvtr1_i, double *cvtr1_j, double *cvtr1_k, double *cvtr2_i, double *cvtr2_j, double *cvtr2_k, int *err)
 Get closest point, tangent, and curvature of face.
ITAPS_API void iGeom_getArrEgEvalXYZ (iGeom_Instance instance, const iBase_EntityHandle *edge_handles, int edge_handles_size, int storage_order, const double *coordinates, int coordinates_size, double **on_coords, int *on_coords_allocated, int *on_coords_size, double **tangents, int *tangents_allocated, int *tangents_size, double **curvatures, int *curvatures_allocated, int *curvatures_size, int *err)
 Get the closest point(s), tangent(s), and curvature(s) on an entity(ies) at given position(s)
ITAPS_API void iGeom_getArrFcEvalXYZ (iGeom_Instance instance, const iBase_EntityHandle *face_handles, int face_handles_size, int storage_order, const double *coordinates, int coordinates_size, double **on_coords, int *on_coords_allocated, int *on_coords_size, double **normals, int *normals_allocated, int *normals_size, double **curvatures_1, int *curvatures_1_allocated, int *curvatures_1_size, double **curvatures_2, int *curvatures_2_allocated, int *curvatures_2_size, int *err)
 Get the closest point(s), tangent(s), and curvature(s) on an entity(ies) at given position(s)
ITAPS_API void iGeom_measure (iGeom_Instance instance, const iBase_EntityHandle *gentity_handles, int gentity_handles_size, double **measures, int *measures_allocated, int *measures_size, int *err)
 Return the measure (length, area, or volume) of entities.
ITAPS_API void iGeom_getEntBoundBox (iGeom_Instance instance, iBase_EntityHandle entity_handle, double *min_x, double *min_y, double *min_z, double *max_x, double *max_y, double *max_z, int *err)
 Get the bounding box of the specified entity.
ITAPS_API void iGeom_getFaceType (iGeom_Instance instance, iBase_EntityHandle gentity_handle, char *face_type, int *err, int *face_type_length)
 Get the geometric type of a face.
ITAPS_API void iGeom_getArrBoundBox (iGeom_Instance instance, const iBase_EntityHandle *gentity_handles, int gentity_handles_size, int storage_order, double **min_corner, int *min_corner_allocated, int *min_corner_size, double **max_corner, int *max_corner_allocated, int *max_corner_size, int *err)
 Get the bounding box of the specified entities.
ITAPS_API void iGeom_getVtxCoord (iGeom_Instance instance, iBase_EntityHandle vertex_handle, double *x, double *y, double *z, int *err)
 Get coordinates of specified vertex.
ITAPS_API void iGeom_getVtxArrCoords (iGeom_Instance instance, const iBase_EntityHandle *gentity_handles, int gentity_handles_size, int storage_order, double **coordinates, int *coordinates_allocated, int *coordinates_size, int *err)
 Get coordinates of specified vertices.
ITAPS_API void iGeom_getPntRayIntsct (iGeom_Instance instance, double x, double y, double z, double dx, double dy, double dz, iBase_EntityHandle **intersect_entity_handles, int *intersect_entity_handles_allocated, int *intersect_entity_handles_size, int storage_order, double **intersect_coords, int *intersect_coords_allocated, int *intersect_coords_size, double **param_coords, int *param_coords_allocated, int *param_coords_size, int *err)
 Intersect a ray with the model.
ITAPS_API void iGeom_getPntArrRayIntsct (iGeom_Instance instance, int storage_order, const double *points, int points_size, const double *directions, int directions_size, iBase_EntityHandle **intersect_entity_handles, int *intersect_entity_handles_allocated, int *intersect_entity_handles_size, int **offset, int *offset_allocated, int *offset_size, double **intersect_coords, int *intersect_coords_allocated, int *intersect_coords_size, double **param_coords, int *param_coords_allocated, int *param_coords_size, int *err)
 Intersect an array of rays with the model.
ITAPS_API void iGeom_getPntClsf (iGeom_Instance instance, double x, double y, double z, iBase_EntityHandle *entity_handle, int *err)
 Get the entity on which a point is located.
ITAPS_API void iGeom_getPntArrClsf (iGeom_Instance instance, int storage_order, const double *coords, int coords_size, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *err)
 Get the entities on which points are located.
ITAPS_API void iGeom_getEntNrmlSense (iGeom_Instance instance, iBase_EntityHandle gface, iBase_EntityHandle gregion, int *rel_sense, int *err)
 Get the sense of a face with respect to a region.
ITAPS_API void iGeom_getArrNrmlSense (iGeom_Instance instance, iBase_EntityHandle const *faces, int faces_size, iBase_EntityHandle const *regions, int regions_size, int **senses, int *senses_allocated, int *senses_size, int *err)
 Get the senses of an array of faces with respect to an array of regions.
ITAPS_API void iGeom_getEgFcSense (iGeom_Instance instance, iBase_EntityHandle gedge, iBase_EntityHandle gface, int *rel_sense, int *err)
 Get the sense of an edge with respect to a face.
ITAPS_API void iGeom_getEgFcArrSense (iGeom_Instance instance, iBase_EntityHandle const *edges, int edges_size, iBase_EntityHandle const *faces, int faces_size, int **senses, int *senses_allocated, int *senses_size, int *err)
 Get the senses of an array of edges with respect to an array of faces.
ITAPS_API void iGeom_getEgVtxSense (iGeom_Instance instance, iBase_EntityHandle gedge, iBase_EntityHandle gvertex1, iBase_EntityHandle gvertex2, int *rel_sense, int *err)
 Get the sense of a vertex pair with respect to an edge.
ITAPS_API void iGeom_getEgVtxArrSense (iGeom_Instance instance, iBase_EntityHandle const *edges, int edges_size, iBase_EntityHandle const *start_vertices, int start_vertices_size, iBase_EntityHandle const *end_vertices, int end_vertices_size, int **senses, int *senses_allocated, int *senses_size, int *err)
 Get the senses of vertex pair with respect to a edges.
ITAPS_API void iGeom_getNumEntSets (iGeom_Instance instance, iBase_EntitySetHandle entity_set, int num_hops, int *num_ent_sets, int *err)
 Get the number of entity sets contained in a set or interface.
ITAPS_API void iGeom_getEntSets (iGeom_Instance instance, iBase_EntitySetHandle entity_set, int num_hops, iBase_EntitySetHandle **contained_entity_set_handles, int *contained_entity_set_handles_allocated, int *contained_entity_set_handles_size, int *err)
 Get the entity sets contained in a set or interface.
ITAPS_API void iGeom_createEntSet (iGeom_Instance instance, int isList, iBase_EntitySetHandle *entity_set, int *err)
 Create an entity set.
ITAPS_API void iGeom_destroyEntSet (iGeom_Instance instance, iBase_EntitySetHandle entity_set, int *err)
 Destroy an entity set.
ITAPS_API void iGeom_isList (iGeom_Instance instance, iBase_EntitySetHandle entity_set, int *result, int *err)
 Return whether a specified set is ordered or unordered.
ITAPS_API void iGeom_addEntSet (iGeom_Instance instance, iBase_EntitySetHandle entity_set_to_add, iBase_EntitySetHandle entity_set_handle, int *err)
 Add an entity set to a set.
ITAPS_API void iGeom_rmvEntSet (iGeom_Instance instance, iBase_EntitySetHandle entity_set_to_remove, iBase_EntitySetHandle entity_set_handle, int *err)
 Remove an entity set from a set.
ITAPS_API void iGeom_addEntToSet (iGeom_Instance instance, iBase_EntityHandle entity_to_add, iBase_EntitySetHandle entity_set_handle, int *err)
 Add an entity to a set.
ITAPS_API void iGeom_rmvEntFromSet (iGeom_Instance instance, iBase_EntityHandle entity_to_remove, iBase_EntitySetHandle entity_set_handle, int *err)
 Remove an entity from a set.
ITAPS_API void iGeom_isEntContained (iGeom_Instance instance, iBase_EntitySetHandle containing_entity_set, iBase_EntityHandle contained_entity, int *is_contained, int *err)
 Return whether an entity is contained in another set.
ITAPS_API void iGeom_isEntArrContained (iGeom_Instance instance, iBase_EntitySetHandle containing_set, const iBase_EntityHandle *entity_handles, int num_entity_handles, int **is_contained, int *is_contained_allocated, int *is_contained_size, int *err)
 Return whether entities are contained in a set.
ITAPS_API void iGeom_isEntSetContained (iGeom_Instance instance, iBase_EntitySetHandle containing_entity_set, iBase_EntitySetHandle contained_entity_set, int *is_contained, int *err)
 Return whether an entity set is contained in another set.
ITAPS_API void iGeom_addEntArrToSet (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, iBase_EntitySetHandle entity_set, int *err)
 Add an array of entities to a set.
ITAPS_API void iGeom_rmvEntArrFromSet (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, iBase_EntitySetHandle entity_set, int *err)
 Remove an array of entities from a set.
ITAPS_API void iGeom_getTolerance (iGeom_Instance instance, int *type, double *tolerance, int *err)
 Get the tolerance of the instance.
ITAPS_API void iGeom_getEntTolerance (iGeom_Instance instance, iBase_EntityHandle entity_handle, double *tolerance, int *err)
 Get the tolerance of the specified entity.
ITAPS_API void iGeom_getArrTolerance (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, const int gentity_handles_size, double **tolerances, int *tolerances_allocated, int *tolerances_size, int *err)
 Get the tolerances of the specified entities.
ITAPS_API void iGeom_getParametric (iGeom_Instance instance, int *is_parametric, int *err)
 Return whether interface has information about parameterization.
ITAPS_API void iGeom_isEntParametric (iGeom_Instance instance, iBase_EntityHandle gentity_handle, int *is_parametric, int *err)
 Return whether an entity has a parameterization.
ITAPS_API void iGeom_isArrParametric (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, int **is_parametric, int *is_parametric_allocated, int *is_parametric_size, int *err)
 Return whether entities have parameterizations.
ITAPS_API void iGeom_getEntUVtoXYZ (iGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double v, double *x, double *y, double *z, int *err)
 Return coordinate position at specified parametric position on entity.
ITAPS_API void iGeom_getArrUVtoXYZ (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int storage_order, const double *uv, int uv_size, double **coordinates, int *coordinates_allocated, int *coordinates_size, int *err)
 Return coordinate positions at specified parametric position(s) on entity(ies)
ITAPS_API void iGeom_getEntUtoXYZ (iGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double *x, double *y, double *z, int *err)
 Return coordinate position at specified parametric position on entity.
ITAPS_API void iGeom_getArrUtoXYZ (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, const double *u, int u_size, int storage_order, double **coordinates, int *coordinates_allocated, int *coordinates_size, int *err)
 Return coordinate positions at specified parametric position(s) on entity(ies)
ITAPS_API void iGeom_getEntXYZtoUV (iGeom_Instance instance, iBase_EntityHandle entity_handle, double x, double y, double z, double *u, double *v, int *err)
 Return parametric position at specified spatial position on entity.
ITAPS_API void iGeom_getArrXYZtoUV (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int storage_order, const double *coordinates, int coordinates_size, double **uv, int *uv_allocated, int *uv_size, int *err)
 Return parametric positions at specified spatial position(s) on entity(ies) Return parametric positions at specified spatial position(s) on entity(ies). If either the number of entities or number of spatial coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.
ITAPS_API void iGeom_getEntXYZtoU (iGeom_Instance instance, iBase_EntityHandle entity_handle, double x, double y, double z, double *u, int *err)
 Return parametric position at specified spatial position on entity.
ITAPS_API void iGeom_getArrXYZtoU (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int storage_order, const double *coordinates, int coordinates_size, double **u, int *u_allocated, int *u_size, int *err)
 Return spatial positions at specified parametric position(s) on entity(ies)
ITAPS_API void iGeom_getEntXYZtoUVHint (iGeom_Instance instance, iBase_EntityHandle entity_handle, double x, double y, double z, double *u, double *v, int *err)
 Return parametric position at specified spatial position on entity, based on parametric position hint.
ITAPS_API void iGeom_getArrXYZtoUVHint (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int storage_order, const double *coordinates, int coordinates_size, double **uv, int *uv_allocated, int *uv_size, int *err)
 Return parametric positions at specified spatial position(s) on entity(ies), based on parametric position hints Return parametric positions at specified spatial position(s) on entity(ies), based on parametric position hints. If either the number of entities or number of spatial coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.
ITAPS_API void iGeom_getEntUVRange (iGeom_Instance instance, iBase_EntityHandle entity_handle, double *u_min, double *v_min, double *u_max, double *v_max, int *err)
 Get parametric range of entity.
ITAPS_API void iGeom_getEntURange (iGeom_Instance instance, iBase_EntityHandle entity_handle, double *u_min, double *u_max, int *err)
 Get parametric range of entity.
ITAPS_API void iGeom_getArrUVRange (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int storage_order, double **uv_min, int *uv_min_allocated, int *uv_min_size, double **uv_max, int *uv_max_allocated, int *uv_max_size, int *err)
 Get parametric range of entities.
ITAPS_API void iGeom_getArrURange (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, const int gentity_handles_size, double **u_min, int *u_min_allocated, int *u_min_size, double **u_max, int *u_max_allocated, int *u_max_size, int *err)
 Get parametric range of entities.
ITAPS_API void iGeom_getEntUtoUV (iGeom_Instance instance, iBase_EntityHandle edge_handle, iBase_EntityHandle face_handle, double in_u, double *u, double *v, int *err)
 Return the face parametric coordinates for a parametric position on a bounding edge.
static bool iGeom_check_array_size (int size1, int size2)
ITAPS_API void iGeom_getArrUtoUV (iGeom_Instance instance, iBase_EntityHandle const *edge_handles, int edge_handles_size, iBase_EntityHandle const *face_handles, int face_handles_size, const double *in_u, int in_u_size, int storage_order, double **uv, int *uv_allocated, int *uv_size, int *err)
 Return the face parametric coordinates for a parametric position on bounding edges.
ITAPS_API void iGeom_getVtxToUV (iGeom_Instance instance, iBase_EntityHandle vertex_handle, iBase_EntityHandle face_handle, double *u, double *v, int *err)
 Return parametric coordinates on face of vertex position.
ITAPS_API void iGeom_getVtxArrToUV (iGeom_Instance instance, iBase_EntityHandle const *vertex_handles, int vertex_handles_size, iBase_EntityHandle const *face_handles, int face_handles_size, int storage_order, double **uv, int *uv_allocated, int *uv_size, int *err)
 Return parametric coordinates on faces of vertex positions.
ITAPS_API void iGeom_getVtxToU (iGeom_Instance instance, iBase_EntityHandle vertex_handle, iBase_EntityHandle edge_handle, double *u, int *err)
 Return parametric coordinates on edge of vertex position.
ITAPS_API void iGeom_getVtxArrToU (iGeom_Instance instance, iBase_EntityHandle const *vertex_handles, int vertex_handles_size, iBase_EntityHandle const *edge_handles, int edge_handles_size, double **u, int *u_allocated, int *u_size, int *err)
 Return parametric coordinates on edges of vertex positions.
ITAPS_API void iGeom_getEntNrmlUV (iGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double v, double *nrml_i, double *nrml_j, double *nrml_k, int *err)
 Return the normal at a specified parametric position.
ITAPS_API void iGeom_getArrNrmlUV (iGeom_Instance instance, iBase_EntityHandle const *gface_handles, int gface_handles_size, int storage_order, const double *parameters, int parameters_size, double **normals, int *normals_allocated, int *normals_size, int *err)
 Return the normals at specified parametric positions.
ITAPS_API void iGeom_getEntTgntU (iGeom_Instance instance, iBase_EntityHandle entity_handle, double param_coord, double *tngt_i, double *tngt_j, double *tngt_k, int *err)
 Return the tangent at a specified parametric position.
ITAPS_API void iGeom_getArrTgntU (iGeom_Instance instance, iBase_EntityHandle const *gedge_handles, int gedge_handles_size, int storage_order, const double *parameters, int parameters_size, double **tangents, int *tangents_allocated, int *tangents_size, int *err)
 Return the tangents at specified parametric positions.
ITAPS_API void iGeom_getEnt1stDrvt (iGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double v, double **dvrt_u, int *dvrt_u_allocated, int *dvrt_u_size, double **dvrt_v, int *dvrt_v_allocated, int *dvrt_v_size, int *err)
 Get the first derivative of a face at specified parametric position.
ITAPS_API void iGeom_getArr1stDrvt (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, int storage_order, const double *uv, int uv_size, double **drvt_u, int *drvt_u_allocated, int *drvt_u_size, int **u_offset, int *u_offset_allocated, int *u_offset_size, double **drvt_v, int *drvt_v_allocated, int *drvt_v_size, int **v_offset, int *v_offset_allocated, int *v_offset_size, int *err)
 Get the first derivatives of faces at specified parametric positions.
ITAPS_API void iGeom_getEnt2ndDrvt (iGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double v, double **dvrt_uu, int *dvrt_uu_allocated, int *dvrt_uu_size, double **dvrt_uv, int *dvrt_uv_allocated, int *dvrt_uv_size, double **dvrt_vv, int *dvrt_vv_allocated, int *dvrt_vv_size, int *err)
 Get the second derivative of a face at specified parametric position.
ITAPS_API void iGeom_getArr2ndDrvt (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, int storage_order, const double *uv, int uv_size, double **drvt_uu, int *drvt_uu_allocated, int *drvt_uu_size, int **uu_offset, int *uu_offset_allocated, int *uu_offset_size, double **drvt_uv, int *drvt_uv_allocated, int *drvt_uv_size, int **uv_offset, int *uv_offset_allocated, int *uv_offset_size, double **drvt_vv, int *drvt_vv_allocated, int *drvt_vv_size, int **vv_offset, int *vv_offset_allocated, int *vv_offset_size, int *err)
 Get the second derivatives of faces at specified parametric positions.
ITAPS_API void iGeom_getFcCvtrUV (iGeom_Instance instance, iBase_EntityHandle entity_handle, double u, double v, double *cvtr1_i, double *cvtr1_j, double *cvtr1_k, double *cvtr2_i, double *cvtr2_j, double *cvtr2_k, int *err)
 Get the two principle curvature vectors for a face at a parametric position.
ITAPS_API void iGeom_getFcArrCvtrUV (iGeom_Instance instance, const iBase_EntityHandle *face_handles, int face_handles_size, int storage_order, const double *uv, int uv_size, double **cvtr_1, int *cvtr_1_allocated, int *cvtr_1_size, double **cvtr_2, int *cvtr_2_allocated, int *cvtr_2_size, int *err)
 Get the curvature(s) on face(s) at given parametric position(s)
ITAPS_API void iGeom_isEntPeriodic (iGeom_Instance instance, iBase_EntityHandle entity_handle, int *in_u, int *in_v, int *err)
 Return whether an entity is periodic.
ITAPS_API void iGeom_isArrPeriodic (iGeom_Instance instance, iBase_EntityHandle const *entity_handles, const int entity_handles_size, int **in_uv, int *in_uv_allocated, int *in_uv_size, int *err)
 Return whether entities are periodic.
ITAPS_API void iGeom_isFcDegenerate (iGeom_Instance instance, iBase_EntityHandle entity_handle, int *is_degenerate, int *err)
 Return whether a face is degenerate.
ITAPS_API void iGeom_isFcArrDegenerate (iGeom_Instance instance, iBase_EntityHandle const *face_handles, const int face_handles_size, int **degenerate, int *degenerate_allocated, int *degenerate_size, int *err)
 Return whether faces are degenerate.
ITAPS_API void iGeom_subtract (iGeom_Instance instance, iBase_EntitySetHandle entity_set_1, iBase_EntitySetHandle entity_set_2, iBase_EntitySetHandle *result_entity_set, int *err)
 Subtract contents of one entity set from another.
ITAPS_API void iGeom_intersect (iGeom_Instance instance, iBase_EntitySetHandle entity_set_1, iBase_EntitySetHandle entity_set_2, iBase_EntitySetHandle *result_entity_set, int *err)
 Intersect contents of one entity set with another.
ITAPS_API void iGeom_unite (iGeom_Instance instance, iBase_EntitySetHandle entity_set_1, iBase_EntitySetHandle entity_set_2, iBase_EntitySetHandle *result_entity_set, int *err)
 Unite contents of one entity set with another.
ITAPS_API void iGeom_copyEnt (iGeom_Instance instance, iBase_EntityHandle geom_entity, iBase_EntityHandle *geom_entity2, int *err)
 Make a copy of the specified entity.
ITAPS_API void iGeom_sweepEntAboutAxis (iGeom_Instance instance, iBase_EntityHandle geom_entity, const double angle, const double axis_normal_x, const double axis_normal_y, const double axis_normal_z, iBase_EntityHandle *geom_entity2, int *err)
 Sweep (extrude) an entity about an axis.
ITAPS_API void iGeom_deleteAll (iGeom_Instance, int *err)
 Delete all entities and sets.
ITAPS_API void iGeom_deleteEnt (iGeom_Instance instance, iBase_EntityHandle geom_entity, int *err)
 Delete specified entity.
ITAPS_API void iGeom_createSphere (iGeom_Instance instance, double radius, iBase_EntityHandle *geom_entity, int *err)
 Create a sphere.
ITAPS_API void iGeom_createPrism (iGeom_Instance instance, double height, int n_sides, double major_rad, double minor_rad, iBase_EntityHandle *geom_entity, int *err)
 Create a prism.
ITAPS_API void iGeom_createBrick (iGeom_Instance instance, double x, double y, double z, iBase_EntityHandle *geom_entity, int *err)
 Create an axis-oriented box.
ITAPS_API void iGeom_createCylinder (iGeom_Instance instance, double height, double major_rad, double minor_rad, iBase_EntityHandle *geom_entity, int *err)
 Create a cylinder.
ITAPS_API void iGeom_createCone (iGeom_Instance instance, double height, double major_rad_base, double minor_rad_base, double rad_top, iBase_EntityHandle *geom_entity, int *err)
 Create a cone or tapered cylinder.
ITAPS_API void iGeom_createTorus (iGeom_Instance instance, double major_rad, double minor_rad, iBase_EntityHandle *geom_entity, int *err)
 Create a torus.
ITAPS_API void iGeom_moveEnt (iGeom_Instance instance, iBase_EntityHandle geom_entity, double x, double y, double z, int *err)
 Move an entity by the given vector.
ITAPS_API void iGeom_rotateEnt (iGeom_Instance instance, iBase_EntityHandle geom_entity, double angle, double axis_normal_x, double axis_normal_y, double axis_normal_z, int *err)
 Rotate an entity about an axis.
ITAPS_API void iGeom_reflectEnt (iGeom_Instance instance, iBase_EntityHandle geom_entity, double point_x, double point_y, double point_z, double plane_normal_x, double plane_normal_y, double plane_normal_z, int *err)
ITAPS_API void iGeom_scaleEnt (iGeom_Instance instance, iBase_EntityHandle geom_entity, double point_x, double point_y, double point_z, double scale_x, double scale_y, double scale_z, int *err)
ITAPS_API void iGeom_uniteEnts (iGeom_Instance instance, iBase_EntityHandle const *geom_entities, int geom_entities_size, iBase_EntityHandle *geom_entity, int *err)
 Geometrically unite entities.
ITAPS_API void iGeom_subtractEnts (iGeom_Instance instance, iBase_EntityHandle blank, iBase_EntityHandle tool, iBase_EntityHandle *geom_entity, int *err)
 Geometrically subtract one entity from another.
ITAPS_API void iGeom_intersectEnts (iGeom_Instance instance, iBase_EntityHandle ent1, iBase_EntityHandle ent2, iBase_EntityHandle *geom_entity, int *err)
 Geometrically intersect a pair of entities.
ITAPS_API void iGeom_sectionEnt (iGeom_Instance instance, iBase_EntityHandle geom_entity, double plane_normal_x, double plane_normal_y, double plane_normal_z, double offset, int reverse, iBase_EntityHandle *geom_entity2, int *err)
 Section (cut) a region with a plane.
ITAPS_API void iGeom_imprintEnts (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, int *err)
 Imprint entities.
ITAPS_API void iGeom_mergeEnts (iGeom_Instance instance, iBase_EntityHandle const *gentity_handles, int gentity_handles_size, double tolerance, int *err)
 Merge ents.
ITAPS_API void iGeom_isPositionOn (iGeom_Instance instance, iBase_EntityHandle entity, double x, double y, double z, int *IsOn)
static RefEntitypoint_classification (const CubitVector &pt, RefVertex *vtx)
static RefEntitypoint_classification (const CubitVector &pt, RefEdge *edge)
static RefEntitypoint_classification (const CubitVector &pt, RefFace *face)
static RefEntitypoint_classification (const CubitVector &pt, Body *body)
template<typename T >
static int count_type (const DLIList< CubitEntity * > &list)
template<typename TARGET_TYPE , typename LIST_TYPE >
static void append_type (const DLIList< CubitEntity * > &source_list, DLIList< LIST_TYPE * > &target_list)
template<typename SKIP_TYPE , typename LIST_TYPE >
static void append_not_type (const DLIList< CubitEntity * > &source_list, DLIList< LIST_TYPE * > &target_list)
template<typename TARGET_TYPE >
static int append_type (const DLIList< CubitEntity * > &source_list, iBase_EntityHandle *array, int array_size)
template<typename SKIP_TYPE >
static int append_not_type (const DLIList< CubitEntity * > &source_list, iBase_EntityHandle *array, int array_size)
void iGeom_getFacets (iGeom_Instance instance, iBase_EntityHandle entity, double dist_tolerance, double **points, int *points_allocated, int *points_size, int **facets, int *facets_allocated, int *facets_size, int *err)
 Return facet information from solid modeling engine.

Variables

const bool debug = false
const double RAD_TO_DEG = 180.0 / acos(-1.0)
const double DEG_TO_RAD = 1.0 / RAD_TO_DEG
const char * iGeom_entity_type_names [] = {"vertex", "curve", "surface", "body"}
const char * cgm_type_names [] = {"vertex", "curve", "surface", "volume", "body"}

Detailed Description

Copyright 2006 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government retains certain rights in this software.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Author:
Tim Tautges
Jason Kraftcheck

Original file from SNL TSTT repository was named TSTTG_CGM.cpp.

Renamed iGeom_CGMA.cc and added to ANL ITAPS repository by J.Kraftcheck, 2007-6-15

Definition in file iGeom_CGMA.cc.


Define Documentation

#define ALLOC_CHECK_ARRAY (   array,
  this_size 
)
Value:
iGeomArrayManager array ## _manager ( reinterpret_cast<void**>(array), *(array ## _allocated), *(array ## _size), this_size, sizeof(**array), err ); \
  if (iBase_SUCCESS != *err) return

Definition at line 59 of file iGeom_CGMA.cc.

#define ALLOC_CHECK_ARRAY_NOFAIL (   array,
  this_size 
)    ALLOC_CHECK_ARRAY(array, this_size); KEEP_ARRAY(array)

Definition at line 68 of file iGeom_CGMA.cc.

#define ARRAY_IN (   b)    b, b ## _size

Definition at line 50 of file iGeom_CGMA.cc.

#define ARRAY_INOUT (   b)    b, b ## _allocated, b ## _size

Definition at line 53 of file iGeom_CGMA.cc.

#define CAST_TO_VOID (   ptr)    reinterpret_cast<void*>(ptr)

Definition at line 85 of file iGeom_CGMA.cc.

#define ENTITY_HANDLE (   handle)    reinterpret_cast<RefEntity*>(handle)

Definition at line 73 of file iGeom_CGMA.cc.

#define ENTITY_HANDLE_ARRAY (   array)    reinterpret_cast<RefEntity**>(array)

Definition at line 76 of file iGeom_CGMA.cc.

#define ENTITY_HANDLE_ARRAY_PTR (   array)    reinterpret_cast<RefEntity***>(array)

Definition at line 82 of file iGeom_CGMA.cc.

#define ENTITY_HANDLE_CONST_ARRAY (   array)    reinterpret_cast<RefEntity* const*>(array)

Definition at line 79 of file iGeom_CGMA.cc.

#define ERROR (   a,
 
)    do {CGM_iGeom_setLastError((*err = a), b); return; } while(false)

Definition at line 48 of file iGeom_CGMA.cc.

Definition at line 121 of file iGeom_CGMA.cc.

Definition at line 120 of file iGeom_CGMA.cc.

#define ITAPS_API

Definition at line 42 of file iGeom_CGMA.cc.

#define KEEP_ARRAY (   array)    array ## _manager .keep_array()

Definition at line 63 of file iGeom_CGMA.cc.

#define RETURN (   a)    do {CGM_iGeom_setLastError((*err = a)); return; } while(false)

Definition at line 47 of file iGeom_CGMA.cc.

#define SET_HANDLE (   handle)    reinterpret_cast<RefGroup*>(handle)

Definition at line 74 of file iGeom_CGMA.cc.

#define SET_HANDLE_ARRAY (   array)    reinterpret_cast<RefGroup**>(array)

Definition at line 77 of file iGeom_CGMA.cc.

#define SET_HANDLE_ARRAY_PTR (   array)    reinterpret_cast<RefGroup***>(array)

Definition at line 83 of file iGeom_CGMA.cc.

#define SET_HANDLE_CONST_ARRAY (   array)    reinterpret_cast<RefGroup* const*>(array)

Definition at line 80 of file iGeom_CGMA.cc.

#define TAG_HANDLE (   handle)    reinterpret_cast<long>(handle)

Definition at line 71 of file iGeom_CGMA.cc.

#define TAG_HANDLE_ARRAY_INOUT (   a)    reinterpret_cast<long**>(a), a ## _allocated, a ## _size

Definition at line 86 of file iGeom_CGMA.cc.

#define TM   reinterpret_cast<CGMTagManager*>(instance)

Definition at line 88 of file iGeom_CGMA.cc.


Function Documentation

static void append_all_ibase_type ( int  ibase_type,
DLIList< RefEntity * > &  target_list,
int *  err 
) [static]

Definition at line 7359 of file iGeom_CGMA.cc.

{
  RefEntityFactory *const ref = RefEntityFactory::instance();
  if (ibase_type == iBase_ALL_TYPES) {
    for (int i = 0; i < 4; ++i) {
      DLIList<RefEntity*> tmp;
      ref->ref_entity_list( iGeom_entity_type_names[i], tmp );
      target_list += tmp;
    }
  }
  else if (abs(ibase_type) < iBase_ALL_TYPES) {
    ref->ref_entity_list( iGeom_entity_type_names[ibase_type], target_list );
  }
  else {
    RETURN(iBase_INVALID_ENTITY_TYPE);
  }
  
  RETURN(iBase_SUCCESS);
}
static void append_ibase_type ( int  ibase_type,
const DLIList< CubitEntity * > &  source_list,
DLIList< RefEntity * > &  target_list,
int *  err 
) [static]

Definition at line 7329 of file iGeom_CGMA.cc.

{
  switch (ibase_type) {
    case iBase_ALL_TYPES:
      append_not_type<RefGroup>(source_list, target_list);
      break;
    case iBase_REGION:
      append_type<Body>(source_list, target_list);
      break;
    case iBase_FACE:
      append_type<RefFace>(source_list, target_list);
      break;
    case iBase_EDGE:
      append_type<RefEdge>(source_list, target_list);
      break;
    case iBase_VERTEX:
      append_type<RefVertex>(source_list, target_list);
      break;
    default:
      RETURN(iBase_INVALID_ENTITY_TYPE);
      break;
  }
  
  RETURN(iBase_SUCCESS);
}
template<typename SKIP_TYPE , typename LIST_TYPE >
static void append_not_type ( const DLIList< CubitEntity * > &  source_list,
DLIList< LIST_TYPE * > &  target_list 
) [inline, static]

Definition at line 7236 of file iGeom_CGMA.cc.

{
  int size = source_list.size();
  for (int i = 0; i < size; ++i) 
    if (!dynamic_cast<SKIP_TYPE*>(source_list[i]))
      if (RefEntity* ent = dynamic_cast<LIST_TYPE*>(source_list[i]))
        target_list.append(ent);
}
template<typename SKIP_TYPE >
static int append_not_type ( const DLIList< CubitEntity * > &  source_list,
iBase_EntityHandle array,
int  array_size 
) [inline, static]

Definition at line 7265 of file iGeom_CGMA.cc.

{
  int len = source_list.size();
  int count = 0;
  for (int i = 0; i < len; ++i) {
    if (!dynamic_cast<SKIP_TYPE*>(source_list[i])) {
      if (count == array_size) 
        return -1;
      else if (RefEntity* ent = dynamic_cast<RefEntity*>(source_list[i]))
        array[count++] = reinterpret_cast<iBase_EntityHandle>(ent);
    }
  }
  return count;
}
template<typename TARGET_TYPE , typename LIST_TYPE >
static void append_type ( const DLIList< CubitEntity * > &  source_list,
DLIList< LIST_TYPE * > &  target_list 
) [inline, static]

Definition at line 7226 of file iGeom_CGMA.cc.

{
  int size = source_list.size();
  for (int i = 0; i < size; ++i) 
    if (TARGET_TYPE* ent = dynamic_cast<TARGET_TYPE*>(source_list[i]))
      target_list.append(ent);
}
template<typename TARGET_TYPE >
static int append_type ( const DLIList< CubitEntity * > &  source_list,
iBase_EntityHandle array,
int  array_size 
) [inline, static]

Definition at line 7248 of file iGeom_CGMA.cc.

{
  RefEntity* re_ptr;
  int len = source_list.size();
  int count = 0;
  for (int i = 0; i < len; ++i) {
    if (TARGET_TYPE* ent = dynamic_cast<TARGET_TYPE*>(source_list[i])) {
      if (count < array_size)
        array[count] = reinterpret_cast<iBase_EntityHandle>(re_ptr = ent);
      ++count;
    }
  }
  return count;
}
static void copy_ibase_type ( int  ibase_type,
const DLIList< CubitEntity * > &  list,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_alloc,
int *  entity_handles_size,
int *  err 
) [static]

Definition at line 7282 of file iGeom_CGMA.cc.

{
  int count;
  if (*entity_handles_alloc == 0) {
    count = count_ibase_type( ibase_type, list, err );
    if (count < 0)
      return;
    *entity_handles = (iBase_EntityHandle*)malloc( count * sizeof(iBase_EntityHandle) );
    if (!*entity_handles) 
      RETURN(iBase_MEMORY_ALLOCATION_FAILED);
    *entity_handles_alloc = count;
  }
  
  switch (ibase_type) {
    case iBase_ALL_TYPES:
      count = append_not_type<RefGroup>(list,*entity_handles, *entity_handles_alloc);
      break;
    case iBase_REGION:
      count = append_type<Body>(list,*entity_handles, *entity_handles_alloc);
      break;
    case iBase_FACE:
      count = append_type<RefFace>(list,*entity_handles, *entity_handles_alloc);
      break;
    case iBase_EDGE:
      count = append_type<RefEdge>(list,*entity_handles, *entity_handles_alloc);
      break;
    case iBase_VERTEX:
      count = append_type<RefVertex>(list,*entity_handles, *entity_handles_alloc);
      break;
    default:
      RETURN(iBase_INVALID_ENTITY_TYPE);
      break;
  }
  
  *entity_handles_size = count;
  if (count > *entity_handles_alloc)
    RETURN(iBase_BAD_ARRAY_DIMENSION);
  
  RETURN(iBase_SUCCESS);
}
static int count_ibase_type ( int  ibase_type,
const DLIList< CubitEntity * > &  list,
int *  err 
) [inline, static]

Definition at line 7209 of file iGeom_CGMA.cc.

{
  *err = iBase_SUCCESS;
  switch (ibase_type) {
    case iBase_ALL_TYPES: return list.size() - count_type<RefGroup>(list);
    case iBase_REGION:    return count_type<Body>(list);
    case iBase_FACE:      return count_type<RefFace>(list);
    case iBase_EDGE:      return count_type<RefEdge>(list);
    case iBase_VERTEX:    return count_type<RefVertex>(list);
    default:
      *err = iBase_INVALID_ENTITY_TYPE;
      CGM_iGeom_setLastError( *err );
      return -1;
  }
}
template<typename T >
static int count_type ( const DLIList< CubitEntity * > &  list) [inline, static]

Definition at line 7199 of file iGeom_CGMA.cc.

{
  int count = 0, size = list.size();
  for (int i = 0; i < size; ++i)
    if (dynamic_cast<T*>(list[i]))
      ++count;
  return count;
}
ITAPS_API void iGeom_addEntArrToSet ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
iBase_EntitySetHandle  entity_set,
int *  err 
)

Add an array of entities to a set.

Add existing gentities to the gentity_set (do not create them). Note that if a gentity of dimension d>0 is added to the gentityset, the lower-dimensional gentities that bound it are not automatically associated with the gentityset.

Parameters:
gentity_setSet being added to
gentity_handlesGentities being added to gentity_set

Definition at line 4254 of file iGeom_CGMA.cc.

{
  if (NULL == entity_set) RETURN(iBase_INVALID_ARGUMENT);

  RefGroup *this_set = SET_HANDLE(entity_set);
  RefEntity **ent_array = (RefEntity**)(entity_handles);
  CubitStatus status = CUBIT_SUCCESS, tmp_status;
  for (int i = 0; i < entity_handles_size; i++) {
    tmp_status = this_set->add_ref_entity(ent_array[i]);
    if (CUBIT_SUCCESS != tmp_status) status = tmp_status;
  }

  if (CUBIT_SUCCESS != status) {
    ERROR(iBase_FAILURE, "Problem adding entities to a set.");
  }
  
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_addEntSet ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set_to_add,
iBase_EntitySetHandle  entity_set_handle,
int *  err 
)

Add an entity set to a set.

Allows the user to explicitly add one or more gentity_sets to another. This automatically sets the contained in relationship, but not the parent/child relationships. All gentity_set handles are automatically contained in the parent mesh interface, so passing in NULL as the first argument results in no action.

Parameters:
gentity_setSet to which other sets are being added
gentity_set_handlesSets added to gentity_set

Definition at line 4111 of file iGeom_CGMA.cc.

{
  iGeom_addEntToSet(instance, reinterpret_cast<iBase_EntityHandle>(entity_set_to_add), entity_set_handle, err);
}
ITAPS_API void iGeom_addEntToSet ( iGeom_Instance  instance,
iBase_EntityHandle  entity_to_add,
iBase_EntitySetHandle  entity_set_handle,
int *  err 
)

Add an entity to a set.

Allows the user to explicitly add one or more gentity_sets to another. This automatically sets the contained in relationship, but not the parent/child relationships. All gentity_set handles are automatically contained in the parent mesh interface, so passing in NULL as the first argument results in no action.

Parameters:
gentity_setSet to which other sets are being added
gentity_set_handlesSets added to gentity_set

Definition at line 4146 of file iGeom_CGMA.cc.

{
  if (NULL == entity_to_add) RETURN(iBase_INVALID_ARGUMENT);
  
  CubitStatus status = SET_HANDLE(entity_set_handle)->
    add_ref_entity(const_cast<RefEntity*>(ENTITY_HANDLE(entity_to_add)));
  
  if (CUBIT_SUCCESS != status) {
    ERROR(iBase_FAILURE, "Problem adding entity to another set.");
  }

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_addPrntChld ( iGeom_Instance  instance,
iBase_EntitySetHandle  parent_entity_set,
iBase_EntitySetHandle  child_entity_set,
int *  err 
)

Add parent/child links between two sets.

Add a parent to the gentity_set

Definition at line 1114 of file iGeom_CGMA.cc.

{
  std::vector<RefGroup*> *my_parents = 
    TM->pc_list(SET_HANDLE(child_entity_set), 0, true);
  std::vector<RefGroup*> *my_children = 
    TM->pc_list(SET_HANDLE(parent_entity_set), 1, true);
  RefGroup *par_group = SET_HANDLE(parent_entity_set);
  RefGroup *child_group = SET_HANDLE(child_entity_set);
  my_parents->push_back(par_group);
  my_children->push_back(child_group);
  RETURN(iBase_SUCCESS);
}
static CubitStatus iGeom_bounding_box ( RefEntity entity,
CubitVector minc,
CubitVector maxc 
) [static]

Definition at line 6857 of file iGeom_CGMA.cc.

{
  CubitBox box;
  if (BasicTopologyEntity* bte = dynamic_cast<BasicTopologyEntity*>(entity))
    box = bte->bounding_box();
  else if(Body* body = dynamic_cast<Body*>(entity))
    box = body->bounding_box();
  else {
    CGM_iGeom_setLastError(iBase_INVALID_ENTITY_HANDLE, "Entities passed into gentityBoundingBox must be vertex, edge, face, or region."); 
    return CUBIT_FAILURE;
  }
  
  minc = box.minimum();
  maxc = box.maximum();
  return CUBIT_SUCCESS;
}
static bool iGeom_check_array_size ( int  size1,
int  size2 
) [static]

Definition at line 5058 of file iGeom_CGMA.cc.

{
    return size1 == 1 || size2 == 1 || size1 == size2;        
}
static CubitStatus iGeom_closest_point ( RefEntity this_entity,
const CubitVector near,
CubitVector on 
) [static]

Definition at line 6716 of file iGeom_CGMA.cc.

{
  RefEdge *this_edge;
  RefFace *this_face;
  Surface *this_surf;
  CubitStatus status;
 
  switch (this_entity->dimension()) {
    case 0:
      on = dynamic_cast<RefVertex*>(this_entity)->coordinates();
      status = CUBIT_SUCCESS;
      break;
    case 1:
      this_edge = dynamic_cast<RefEdge*>(this_entity);
      if (NULL == this_edge) return CUBIT_FAILURE;

      status = this_edge->closest_point(near, on);

      if (debug) {
        std::cout << "Edge " << this_edge->id() << " closest point to (" 
                  << near.x() << ", " << near.y() << ", " << near.z() 
                  << ") is "
                  << on.x() << ", " << on.y() << ", " << on.z() 
                  << ")" << std::endl;
      }
      break;
    case 2:
      this_face = dynamic_cast<RefFace*>(this_entity);
      if (NULL == this_face) return CUBIT_FAILURE;
      this_surf = this_face->get_surface_ptr();
      if (NULL == this_surf) return CUBIT_FAILURE;
      status = this_surf->closest_point( near, &on );
      break;
    default:
        // just copy over the coordinates
      on = near;
      status = CUBIT_SUCCESS;
      break;
  }
  
  return status;
}
static CubitStatus iGeom_closest_point_and_normal ( RefEntity this_entity,
const CubitVector near,
CubitVector on,
CubitVector normal 
) [static]

Definition at line 6808 of file iGeom_CGMA.cc.

{
  RefEdge* this_edge;
  RefFace* this_face;
  Surface* this_surf;
  CubitStatus status;
  switch (this_entity->dimension()) {
    case 0:
      on = dynamic_cast<RefVertex*>(this_entity)->coordinates();
      normal.set( 0, 0, 0 );
      status = CUBIT_SUCCESS;
      break;
    case 1:
      this_edge = dynamic_cast<RefEdge*>(this_entity);
      if (NULL == this_edge) return CUBIT_FAILURE;
      
      status = this_edge->closest_point( near, on );
      if (debug) {
        std::cout << "Edge " << this_edge->id() << " closest point to (" 
                  << near.x() << ", " << near.y() << ", " << near.z() 
                  << ") is "
                  << on.x() << ", " << on.y() << ", " << on.x()
                  << ")" << std::endl;
      }
      break;
    case 2:
      this_face = dynamic_cast<RefFace*>(this_entity);
      if (NULL == this_face) return CUBIT_FAILURE;
      this_surf = this_face->get_surface_ptr();
      if (NULL == this_surf) return CUBIT_FAILURE;
      status = this_surf->closest_point( near, &on, &normal );
      if (this_surf->bridge_sense() == CUBIT_REVERSED)
        normal = -normal;
      break;
    default:
        // just copy over the coordinates
      on = near;
      normal.set( 0, 0, 0 );
      status = CUBIT_SUCCESS;
      break;
  }
  
  return status;
}
static CubitStatus iGeom_closest_point_trimmed ( RefEntity this_entity,
const CubitVector near,
CubitVector on 
) [static]

Definition at line 6761 of file iGeom_CGMA.cc.

{
  RefEdge *this_edge;
  RefFace *this_face;
  Surface *this_surf;
  CubitStatus status;

  switch (this_entity->dimension()) {
    case 0:
      on = dynamic_cast<RefVertex*>(this_entity)->coordinates();
      status = CUBIT_SUCCESS;
      break;
    case 1:
      this_edge = dynamic_cast<RefEdge*>(this_entity);
      if (NULL == this_edge) return CUBIT_FAILURE;

      status = this_edge->closest_point(near, on);

      if (debug) {
        std::cout << "Edge " << this_edge->id() << " closest point to ("
                  << near.x() << ", " << near.y() << ", " << near.z()
                  << ") is "
                  << on.x() << ", " << on.y() << ", " << on.z()
                  << ")" << std::endl;
      }
      break;
    case 2:
      this_face = dynamic_cast<RefFace*>(this_entity);
      if (NULL == this_face) return CUBIT_FAILURE;
      this_surf = this_face->get_surface_ptr();
      if (NULL == this_surf) return CUBIT_FAILURE;
      this_surf->closest_point_trimmed( near, on );
      status = CUBIT_SUCCESS;
      break;
    default:
        // just copy over the coordinates
      on = near;
      status = CUBIT_SUCCESS;
      break;
  }

  return status;
}
ITAPS_API void iGeom_copyEnt ( iGeom_Instance  instance,
iBase_EntityHandle  source,
iBase_EntityHandle copy,
int *  err 
)

Make a copy of the specified entity.

Make a copy of the specified entity

Parameters:
instanceiGeom instance handle
sourceentity to be copied
copythe newly-created entity
*errPointer to error type returned from function

Definition at line 5802 of file iGeom_CGMA.cc.

{
  Body *this_body = dynamic_cast<Body*>(ENTITY_HANDLE(geom_entity));
  RefVolume *this_vol = dynamic_cast<RefVolume*>(ENTITY_HANDLE(geom_entity));
  if (NULL != this_vol || NULL != this_body) {
      // need to get the associated body, since cgm only supports copying bodies,
      // not volumes
    if (NULL == this_body) {
      this_body = this_vol->get_body_ptr();
      if (NULL == this_body) {
        ERROR(iBase_FAILURE, "Can't get body from volume.");
      }
    }

    RefEntity *temp_entity = gmt->copy_body(this_body);
    *geom_entity2 = reinterpret_cast<iBase_EntityHandle>(temp_entity);
  }
  else {
    RefEntity *this_ent = ENTITY_HANDLE(geom_entity);
    RefEntity *temp_entity = gmt->copy_refentity(this_ent);
    *geom_entity2 = reinterpret_cast<iBase_EntityHandle>(temp_entity);
  }

  if (NULL == *geom_entity2) {
    ERROR(iBase_FAILURE, "NULL returned from CGM copy.");
  }
  
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_createBrick ( iGeom_Instance  instance,
double  x,
double  y,
double  z,
iBase_EntityHandle geom_entity,
int *  err 
)

Create an axis-oriented box.

Create an axis-oriented box of the given dimensions, centered at the origin.

Parameters:
instanceiGeom instance handle
xx dimension of new box
yy dimension of new box
zz dimension of new box
geom_entityPointer to new entity handle returned from function
*errPointer to error type returned from function

Definition at line 5972 of file iGeom_CGMA.cc.

{
  double tmp_x = x;
  double tmp_y = y;
  double tmp_z = z;
  
  if (0.0 == y && 0.0 == z) {
    tmp_y = x;
    tmp_z = x;
  }
  
  if (0.0 >= tmp_x || 0.0 >= tmp_y || 0.0 >= tmp_z) {
    ERROR(iBase_INVALID_ARGUMENT, "Dimensions must be >= 0, or y & z must both be zero.");
  }
    
  RefEntity *temp_body = gmt->brick(tmp_x, tmp_y, tmp_z);
  *geom_entity = reinterpret_cast<iBase_EntityHandle>(temp_body);

  if (NULL == *geom_entity) {
    RETURN(iBase_FAILURE);
  }

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_createCone ( iGeom_Instance  instance,
double  height,
double  major_rad_base,
double  minor_rad_base,
double  rad_top,
iBase_EntityHandle geom_entity,
int *  err 
)

Create a cone or tapered cylinder.

Create a cone parallel to the z-axis and centered at the origin (so that its z-coordinate extents are +height/2 and -height/2). The 'base' of the cylinder is at z = -height/2, and the top is at +height/2.

Parameters:
instanceiGeom instance handle
heightThe height of the cone.
major_rad_baseThe x-axis radius at the base of the cylinder
minor_rad_baseThe y-axis radius at the base. If minor_rad_base is 0, the cylinder will be circular (as if minor_rad_base == major_rad_base)
rad_topThe x-axis radius at the top of the cone. The y-axis radius at the top of the cone will be inferred to keep the aspect ratio of the top of the cone the same as the bottom. If rad_top is 0, the cone terminates at a point.
geom_entityPointer to new entity handle returned from function
*errPointer to error type returned from function

Definition at line 6024 of file iGeom_CGMA.cc.

{
  double tmp_minor = (0.0 == minor_rad_base ? major_rad_base : minor_rad_base);
  RefEntity *temp_body = 
    gmt->cylinder(height, major_rad_base, tmp_minor, rad_top);
  *geom_entity = reinterpret_cast<iBase_EntityHandle>(temp_body);


  if (NULL == *geom_entity) {
    RETURN(iBase_FAILURE);
  }

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_createCylinder ( iGeom_Instance  instance,
double  height,
double  major_rad,
double  minor_rad,
iBase_EntityHandle geom_entity,
int *  err 
)

Create a cylinder.

Create a cylinder parallel to the z-axis and centered at the origin (so that its z-coordinate extents are +height/2 and -height/2).

Parameters:
instanceiGeom instance handle
heightThe height of the cylinder.
major_radThe x-axis radius
minor_radThe y-axis radius. If minor_rad is 0, the cylinder will be circular (as if minor_rad == major_rad).
geom_entityPointer to new entity handle returned from function
*errPointer to error type returned from function

Definition at line 6003 of file iGeom_CGMA.cc.

{
  double tmp_minor = (0.0 == minor_rad ? major_rad : minor_rad);
  RefEntity *temp_body = 
    gmt->cylinder(height, major_rad, tmp_minor, major_rad);
  *geom_entity = reinterpret_cast<iBase_EntityHandle>(temp_body);


  if (NULL == *geom_entity) {
    RETURN(iBase_FAILURE);
  }

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_createEntSet ( iGeom_Instance  instance,
int  isList,
iBase_EntitySetHandle entity_set,
int *  err 
)

Create an entity set.

This function allows a new gentity_set to be created. The user may set the multiset, ordered, isMesh, flags as needed; otherwise default values (all false) will be used. On creation, Entitysets are empty of entities and contained in the parent geometry interface. They must be explicitly filled with entities using the addGentities call and relationships with other Entitysets must be done through the addEntityset and parent/child relationship calls.

Parameters:
multisetIf true, gentities can appear more than once in this gentity_set
orderedIf true, order of addition and removal is maintained for this gentity_set
gentity_set_createdEntity_set created by this function

Definition at line 4049 of file iGeom_CGMA.cc.

{
  RefGroup* grp = RefEntityFactory::instance()->construct_RefGroup();
  *entity_set = reinterpret_cast<iBase_EntitySetHandle>(grp);
    // need to set a tag denoting multiset or not...
  if (*entity_set == NULL) {
    RETURN(iBase_FAILURE);
  }
  
  else {
    RETURN(iBase_SUCCESS);
  }
}
ITAPS_API void iGeom_createPrism ( iGeom_Instance  instance,
double  height,
int  n_sides,
double  major_rad,
double  minor_rad,
iBase_EntityHandle geom_entity,
int *  err 
)

Create a prism.

Create a prism parallel to the z-axis and centered at the origin (so that its z-coordinate extents are +height/2 and -height/2).

Parameters:
instanceiGeom instance handle
heightheight of new prism
n_sidesnumber of sides of new prism
major_radmajor radius of new prism
minor_radminor radius of new prism
geom_entityPointer to new entity handle returned from function
*errPointer to error type returned from function

Definition at line 5951 of file iGeom_CGMA.cc.

{
  if ( 0.0>=height ) {
    ERROR(iBase_INVALID_ARGUMENT, "Prism height must be positive.");
  } else if ( 3>n_sides ) {
    ERROR(iBase_INVALID_ARGUMENT, "Prism must have at least three sides.");
  }
  
  RefEntity* tmp_body = gmt->prism( height, n_sides, major_rad, minor_rad );
  *geom_entity = reinterpret_cast<iBase_EntityHandle>(tmp_body);
  RETURN ((tmp_body ? iBase_SUCCESS :iBase_FAILURE));
}
ITAPS_API void iGeom_createSphere ( iGeom_Instance  instance,
double  radius,
iBase_EntityHandle geom_entity,
int *  err 
)

Create a sphere.

Create a sphere of the specified radius centered on the origin.

Parameters:
instanceiGeom instance handle
radiusradius of the sphere
geom_entityPointer to new entity handle returned from function
*errPointer to error type returned from function

Definition at line 5935 of file iGeom_CGMA.cc.

{
  if (radius <= 0.0) {
    ERROR(iBase_INVALID_ARGUMENT, "Sphere radius must be must be positive.");
  }
  
  RefEntity* tmp_body = gmt->sphere( radius );
  *geom_entity = reinterpret_cast<iBase_EntityHandle>(tmp_body);
  RETURN ((tmp_body ? iBase_SUCCESS : iBase_FAILURE));
}
ITAPS_API void iGeom_createTag ( iGeom_Instance  instance,
const char *  tag_name,
int  tag_size,
int  tag_type,
iBase_TagHandle tag_handle,
int *  err,
int  tag_name_len 
)

Create a tag with specified name, size, and type.

Create a tag handle with a given name, size (in bytes), and default value. The tag name is a unique string; if it duplicates an existing tag name, an error is returned. The tag_handle is returned as an opaque value which is not associated with any mesh gentities until explicitly done so through one of the 'AddTag' functions defined later. The implementation is assumed to allocate memory as needed to store the tag data.

Definition at line 1516 of file iGeom_CGMA.cc.

{
  long new_tag;
  int this_size = tag_size;
  switch (tag_type) {
    case iBase_INTEGER:
      this_size *= sizeof(int);
      break;
    case iBase_DOUBLE:
      this_size *= sizeof(double);
      break;
    case iBase_ENTITY_HANDLE:
      this_size *= sizeof(iBase_EntityHandle);
      break;
    case iBase_ENTITY_SET_HANDLE:
      this_size *= sizeof(iBase_EntitySetHandle);
      break;
    case iBase_BYTES:
      break;
  }
  
    // make sure string is null terminated
  std::string name_buf( tag_name, tag_name_len );
  tag_name = name_buf.c_str();
  
  iBase_ErrorType retval = TM->createTag(tag_name, this_size, tag_type, NULL, &new_tag);
  *tag_handle = (iBase_TagHandle) new_tag;
  RETURN(retval);
}
ITAPS_API void iGeom_createTorus ( iGeom_Instance  instance,
double  major_rad,
double  minor_rad,
iBase_EntityHandle geom_entity,
int *  err 
)

Create a torus.

Create a torus centered on the origin and encircling the z-axis.

Parameters:
instanceiGeom instance handle
major_radThe distance from the origin to the center of the torus's circular cross-section.
minor_radThe radius of the cross-section.
geom_entityPointer to new entity handle returned from function
*errPointer to error type returned from function

Definition at line 6046 of file iGeom_CGMA.cc.

{
  if (minor_rad >= major_rad) {
    ERROR(iBase_INVALID_ARGUMENT, "Major radius must be greater than minor radius for tori.");
  }
  
  RefEntity *temp_body = gmt->torus(major_rad, minor_rad);
  *geom_entity = reinterpret_cast<iBase_EntityHandle>(temp_body);
   
  if (NULL == *geom_entity) {
    RETURN(iBase_FAILURE);
  }

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_deleteAll ( iGeom_Instance  instance,
int *  err 
)

Delete all entities and sets.

Delete all entities and sets

Parameters:
instanceiGeom instance handle
*errPointer to error type returned from function

Definition at line 5895 of file iGeom_CGMA.cc.

ITAPS_API void iGeom_deleteEnt ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
int *  err 
)

Delete specified entity.

Delete specified entity

Parameters:
instanceiGeom instance handle
entity_handleEntity to be deleted
*errPointer to error type returned from function

Definition at line 5904 of file iGeom_CGMA.cc.

{
  RefEntity *this_ent = ENTITY_HANDLE(geom_entity);

    // special case: if this is a volume, delete the body instead
  CubitStatus result;
  RefVolume *this_vol = CAST_TO(this_ent, RefVolume);
  if (NULL != this_vol)
    result = gqt->delete_Body(this_vol->body());
  else    
    result = gqt->delete_RefEntity(this_ent);

  if (CUBIT_FAILURE == result) {
    ERROR(iBase_FAILURE, "Problems deleting entity.");
  }

    // check to see if this was last thing deleted; if so, reset ids
  RefEntityFactory *rfi = RefEntityFactory::instance();
  if (rfi->num_bodies() == 0 && 
      rfi->num_ref_volumes() == 0 &&
      rfi->num_ref_faces() == 0 &&
      rfi->num_ref_edges() == 0 &&
      rfi->num_ref_vertices() == 0)
    rfi->reset_ids();
  
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_destroyEntSet ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
int *  err 
)

Destroy an entity set.

Destroy the gentity set. This method only destroys the grouping of gentities, not the gentities themselves.

Parameters:
gentity_setEntity_set to be destroyed

Definition at line 4072 of file iGeom_CGMA.cc.

{
  if (NULL == entity_set) {
    ERROR(iBase_INVALID_ARGUMENT, "Can't destroy interface set.");
  }
      
  CubitStatus result = RefGroup::delete_group(SET_HANDLE(entity_set));
  if (CUBIT_SUCCESS == result) {
    RETURN(iBase_SUCCESS);
  }
  
  else {
    RETURN(iBase_FAILURE);
  }
  
}
ITAPS_API void iGeom_destroyTag ( iGeom_Instance  instance,
iBase_TagHandle  tag_handle,
int  forced,
int *  err 
)

Destroy a tag.

Delete a tag handle and the data associated with that tag. The deletion can be forced or not forced. If the deletion is forced, the tag and all of its associated data are deleted from the implementation even if the tag is still associated with mesh gentities. If the deletion is not forced, the tag will not be deleted if it is still associated with one or more mesh gentities. In this case an error is returned asking the user to remove the tag from that gentity before deleting it. If the underlying implementation does not support the requested deletion mechanism, an error will be returned.

Definition at line 1565 of file iGeom_CGMA.cc.

{
  iBase_ErrorType retval = TM->destroyTag(TAG_HANDLE(tag_handle), forced);
  RETURN(retval);
}
ITAPS_API void iGeom_dtor ( iGeom_Instance  instance,
int *  err 
)

Destroy an iGeom instance.

Destroy an iGeom instance

Parameters:
instanceiGeom instance to be destroyed
*errPointer to error type returned from function

Definition at line 630 of file iGeom_CGMA.cc.

{
  if (NULL == TM) 
    ERROR(iBase_INVALID_ARGUMENT, "NUll Instance");
  
    // delete TM;
  
    // shut down CGM
  CGMApp::instance()->shutdown();

  RETURN(iBase_SUCCESS);
}
static int iGeom_edge_vertex_sense ( const RefEdge cedge,
const RefVertex vtx1,
const RefVertex vtx2,
int *  err 
) [static]

Definition at line 7066 of file iGeom_CGMA.cc.

{
  RefEdge* edge = const_cast<RefEdge*>(cedge);
  if (edge->start_vertex() == vtx1 && edge->end_vertex() == vtx2) 
    return vtx1 == vtx2 ? 0 : 1;
  else if (edge->start_vertex() == vtx2 && edge->end_vertex() == vtx1)
    return -1;
  CGM_iGeom_setLastError((*err = iBase_INVALID_ENTITY_HANDLE), "Relative senes of unrelated entities"); 
  return 2;
}
ITAPS_API void iGeom_endEntArrIter ( iGeom_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
int *  err 
)

Destroy the specified array iterator.

Destroy the specified array iterator

Parameters:
instanceiGeom instance handle
entArr_iteratorIterator which gets destroyed
*errPointer to error type returned from function

Definition at line 979 of file iGeom_CGMA.cc.

{
  CGMAIterator* iterator = reinterpret_cast<CGMAIterator*>(gentity_iterator);
  delete iterator;
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_endEntIter ( iGeom_Instance  instance,
iBase_EntityIterator  gentity_iterator,
int *  err 
)

Destroy the specified iterator.

Delete an iterator

Parameters:
gentity_iteratorIterator deleted by this function

Definition at line 969 of file iGeom_CGMA.cc.

{
  CGMAIterator* iterator = reinterpret_cast<CGMAIterator*>(gentity_iterator);
  delete iterator;
  RETURN(iBase_SUCCESS);
}
static CubitStatus iGeom_fire_ray ( const CubitVector point,
const CubitVector direction,
DLIList< RefEntity * > &  entities,
DLIList< double > &  ray_params 
) [static]

Smits' algorithm

We could use Smits' algorithm here, but only if we turned of floating-point exceptions

Definition at line 6925 of file iGeom_CGMA.cc.

{
  const double EPSILON = 0.0;
  CubitStatus s;
  CubitVector nc_point(point), nc_direction(direction);
  
    // get all free entities in model
  DLIList<RefEntity*> target_entities;
  s = GeometryQueryTool::instance()->get_free_ref_entities( target_entities );
  if (CUBIT_SUCCESS != s) return s;
  DLIList<Body*> bodies;
  GeometryQueryTool::instance()->bodies( bodies );
  CAST_LIST_TO_PARENT( bodies, target_entities );
    
    // do ray fire at list of free entities
  return GeometryQueryTool::instance()->
    fire_ray( nc_point, nc_direction, target_entities, ray_params, 0, EPSILON, &entities );
}
static void iGeom_get_adjacent_entities ( const RefEntity from,
const int  to_dim,
DLIList< RefEntity * > &  adj_ents,
int *  err 
) [static]

Definition at line 6671 of file iGeom_CGMA.cc.

{
  TopologyEntity *topo_ent = const_cast<TopologyEntity*>(dynamic_cast<const TopologyEntity*>(from));
  if (NULL == topo_ent) {
    ERROR(iBase_INVALID_ARGUMENT, "Bad entity input.");
  }
  
  adj_ents.clean_out();
  static DLIList<RefVertex*> tmp_verts;
  static DLIList<RefEdge*> tmp_edges;
  static DLIList<RefFace*> tmp_faces;
  static DLIList<Body*> tmp_bodies;
  
  switch (to_dim) {
    case 0:
      tmp_verts.clean_out();
      topo_ent->ref_vertices(tmp_verts);
      CAST_LIST_TO_PARENT(tmp_verts, adj_ents);
      break;
    case 1:
      tmp_edges.clean_out();
      topo_ent->ref_edges(tmp_edges);
      CAST_LIST_TO_PARENT(tmp_edges, adj_ents);
      break;
    case 2:
      tmp_faces.clean_out();
      topo_ent->ref_faces(tmp_faces);
      CAST_LIST_TO_PARENT(tmp_faces, adj_ents);
      break;
    case 3:
      tmp_bodies.clean_out();
      topo_ent->bodies(tmp_bodies);
      CAST_LIST_TO_PARENT(tmp_bodies, adj_ents);
      break;
    default:
      ERROR(iBase_INVALID_ARGUMENT, "Bad input dimension getting adjacent entities.");
  }
  
  RETURN(iBase_SUCCESS);
}
static int iGeom_get_nonmanifold_sense ( const BasicTopologyEntity child,
const BasicTopologyEntity parent,
int *  err 
) [static]

Definition at line 7043 of file iGeom_CGMA.cc.

{
  DLIList<SenseEntity*> se_list(1);
  const_cast<BasicTopologyEntity*>(child)
    ->get_sense_entities( se_list, const_cast<BasicTopologyEntity*>(parent) );
  if (se_list.size() == 0) {
    CGM_iGeom_setLastError((*err = iBase_INVALID_ENTITY_HANDLE), "Relative senes of unrelated entities"); 
    return 2;
  }
  se_list.reset();
  CubitSense sense = se_list.get_and_step()->get_sense();
  for (int i = se_list.size() - 1; i > 0; --i)
    if (se_list.get_and_step()->get_sense() != sense) {
      *err = iBase_SUCCESS;
      return 0;
    }
  *err = iBase_SUCCESS;
  return sense == CUBIT_FORWARD ? 1 : -1;
}
static RefEntity * iGeom_get_point_containment ( const CubitVector pt) [static]

Definition at line 7014 of file iGeom_CGMA.cc.

{
  DLIList<RefEntity*> ents;
  gqt->get_free_ref_entities( ents );
  
  ents.reset();
  for (int i = 0; i < ents.size(); ++i)
    if (RefVertex* vtx = dynamic_cast<RefVertex*>(ents.get_and_step()))
      if (RefEntity* ent = point_classification( pt, vtx ))
        return ent;
  for (int i = 0; i < ents.size(); ++i)
    if (RefEdge* edge = dynamic_cast<RefEdge*>(ents.get_and_step()))
      if (RefEntity* ent = point_classification( pt, edge ))
        return ent;
  for (int i = 0; i < ents.size(); ++i)
    if (RefFace* face = dynamic_cast<RefFace*>(ents.get_and_step()))
      if (RefEntity* ent = point_classification( pt, face ))
        return ent;
        
  DLIList<Body*> bodies;
  gqt->bodies( bodies );
  bodies.reset();
  for (int i = 0; i < bodies.size(); ++i)
   if (RefEntity* ent = point_classification( pt, bodies.get_and_step() ))
     return ent;
  
  return 0;
}
static iBase_ErrorType iGeom_get_vtx_to_u ( RefVertex vertex,
RefEdge edge,
double &  u 
) [static]

Definition at line 7091 of file iGeom_CGMA.cc.

{
  if (edge->start_vertex() == vertex)
    u = edge->start_param();
  else if (edge->end_vertex() == vertex)
    u = edge->end_param();
  else
    return iBase_INVALID_ARGUMENT;
  return iBase_SUCCESS;
}
static iBase_ErrorType iGeom_get_vtx_to_uv ( RefVertex vertex,
RefFace face,
double &  u,
double &  uv 
) [static]

Definition at line 7105 of file iGeom_CGMA.cc.

{
  DLIList<RefVertex*> pts;
  TopologyEntity *topo_ent = dynamic_cast<TopologyEntity*>(face);
  topo_ent->ref_vertices(pts);

  pts.reset();
  for(int i=0; i<pts.size(); i++) {
    if (pts.get_and_step() == vertex) {
      face->u_v_from_position( vertex->coordinates(), u, v );         
      return iBase_SUCCESS;
    }
  }
  return iBase_INVALID_ARGUMENT;
}
ITAPS_API void iGeom_getAllEntSetTags ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
iBase_TagHandle **  tag_handles,
int *  tag_handles_allocated,
int *  tag_handles_size,
int *  err 
)

Get all the tags associated with a specified entity set.

Get all tag handles associated with a given mesh or gentity_set.

Definition at line 2050 of file iGeom_CGMA.cc.

{
    // have to go through RefEntity* so that RefEntity** gets set right
  const RefEntity *tmp_entity = SET_HANDLE(entity_set);
  iBase_ErrorType retval = TM->getAllTags(tmp_entity,TAG_HANDLE_ARRAY_INOUT(tag_handles));
  RETURN(retval);
}
ITAPS_API void iGeom_getAllTags ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
iBase_TagHandle **  tag_handles,
int *  tag_handles_allocated,
int *  tag_handles_size,
int *  err 
)

Get all the tags associated with a specified entity handle.

Get all tag handles associated with a given gentity.

Definition at line 1698 of file iGeom_CGMA.cc.

{
  iBase_ErrorType retval = TM->getAllTags(SET_HANDLE(entity_handle), 
                                          TAG_HANDLE_ARRAY_INOUT(tag_handles));
  RETURN(retval);
}
ITAPS_API void iGeom_getArr1stDrvt ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int  storage_order,
double const *  uv,
int  uv_size,
double **  dvrt_u,
int *  dvrt_u_allocated,
int *  dvrt_u_size,
int **  u_offset,
int *  u_offset_allocated,
int *  u_offset_size,
double **  dvrt_v,
int *  dvrt_v_allocated,
int *  dvrt_v_size,
int **  v_offset,
int *  v_offset_allocated,
int *  v_offset_size,
int *  err 
)

Get the first derivatives of faces at specified parametric positions.

Get the first derivatives of faces at specified parametric positions. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
entity_handlesArray of entity handles being queried
entity_handles_sizeNumber of entities in entity_handles array
storage_orderStorage order of coordinates input and output
uvParametric coordinates being queried
uv_sizeNumber of coordinates in array
dvrt_uPointer to array of coordinates of derivative with respect to u at specified position returned from function
dvrt_u_allocatedAllocated size of dvrt_u array
dvrt_u_sizeOccupied size of dvrt_u array
u_offsetPointer to array of offsets for dvrt_u returned from function
u_offset_allocatedPointer to allocated size of u_offset array
u_offset_sizePointer to occupied size of u_offset array
dvrt_vPointer to array of coordinates of derivative with respect to v at specified position returned from function
dvrt_v_allocatedAllocated size of dvrt_v array
dvrt_v_sizeOccupied size of dvrt_v array
v_offsetPointer to array of offsets for dvrt_v returned from function
v_offset_allocatedPointer to allocated size of v_offset array
v_offset_sizePointer to occupied size of v_offset array
*errPointer to error type returned from function

Definition at line 5477 of file iGeom_CGMA.cc.

{
  if (2*entity_handles_size != uv_size) {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
    RETURN(iBase_INVALID_ENTITY_COUNT);
  }
  
  ALLOC_CHECK_ARRAY( drvt_u, 3*entity_handles_size );
  ALLOC_CHECK_ARRAY( drvt_v, 3*entity_handles_size );
  ALLOC_CHECK_ARRAY( u_offset, entity_handles_size+1 );
  ALLOC_CHECK_ARRAY( v_offset, entity_handles_size+1 );
  
  size_t u_step, du_step, init;
  if (storage_order == iBase_BLOCKED) {
    u_step = du_step = 1;
    init = entity_handles_size;
  }
  else {
    storage_order = iBase_INTERLEAVED;
    u_step = 2;
    du_step = 3;
    init = 1;
  }
  
  const double *u = uv;
  const double *v = u + init;
  double *du_x = *drvt_u;
  double *du_y = du_x + init;
  double *du_z = du_y + init;
  double *dv_x = *drvt_v;
  double *dv_y = dv_x + init;
  double *dv_z = dv_y + init;
  
  int off = 0;
  RefEntity** entities = (RefEntity**)entity_handles;
  for (int i = 0; i < entity_handles_size; ++i) {
    RefFace* face = dynamic_cast<RefFace*>(entities[i]);
    if (!face) { 
      ERROR( iBase_INVALID_ENTITY_TYPE, "Derivatives only for faces." );
    }
    
    CubitVector du, dv;
    CubitStatus s = face->get_surface_ptr()->uv_derivitives( *u, *v, du, dv );
    if (s != CUBIT_SUCCESS) { RETURN(iBase_FAILURE); }
    du.get_xyz( *du_x, *du_y, *du_z );
    dv.get_xyz( *dv_x, *dv_y, *dv_z );
  
    u += u_step;
    v += u_step;
    du_x += du_step;
    du_y += du_step;
    du_z += du_step;
    dv_x += du_step;
    dv_y += du_step;
    dv_z += du_step;

    (*u_offset)[i] = off;
    (*v_offset)[i] = off;
    off += du_step;
  }
  (*u_offset)[entity_handles_size] = off;
  (*v_offset)[entity_handles_size] = off; 

  KEEP_ARRAY( drvt_u );
  KEEP_ARRAY( drvt_v );
  KEEP_ARRAY( u_offset );
  KEEP_ARRAY( v_offset );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArr2ndAdj ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int  order_adjacent_key,
int  requested_entity_type,
iBase_EntityHandle **  adj_entity_handles,
int *  adj_entity_handles_allocated,
int *  adj_entity_handles_size,
int **  offset,
int *  offset_allocated,
int *  offset_size,
int *  err 
)

Get "2nd order" adjacencies to an array of entities.

Get "2nd order" adjacencies to an array of entities, that is, from each entity, through other entities of a specified "bridge" dimension, to other entities of another specified "to" dimension.

Parameters:
instanceiGeom instance handle
entity_handlesEntities from which adjacencies are requested
entity_handles_sizeNumber of entities whose adjacencies are requested
bridge_dimensionBridge dimension for 2nd order adjacencies
to_dimensionDimension of adjacent entities returned
adj_entity_handlesAdjacent entities
adj_entity_handles_allocatedAllocated size of returned array
adj_entity_handles_sizeOccupied size of returned array
offsetOffset[i] is offset into adj_entity_handles of 2nd order adjacencies of ith entity in entity_handles
offset_allocatedAllocated size of offset array
offset_sizeOccupied size of offset array
*errPointer to error type returned from function

Definition at line 1388 of file iGeom_CGMA.cc.

{
  ALLOC_CHECK_ARRAY(offset, entity_handles_size+1);
  DLIList<RefEntity*> bridge_list, temp_list, entity_list, total_list;
   
  for (int i = 0; i < entity_handles_size; ++i) {
    bridge_list.clean_out();
    entity_list.clean_out();
    iGeom_get_adjacent_entities( (RefEntity*)(entity_handles[i]), order_adjacent_key, bridge_list, err );
    if (iBase_SUCCESS != *err) return;
    bridge_list.reset();
    for (int j = bridge_list.size(); j > 0; --j) {
      temp_list.clean_out();
      iGeom_get_adjacent_entities( bridge_list.get_and_step(), requested_entity_type, temp_list, err );
      if (iBase_SUCCESS != *err) return;
      entity_list += temp_list;
    }
    entity_list.uniquify_unordered();
    (*offset)[i] = total_list.size();
    total_list += entity_list;
  }
  (*offset)[entity_handles_size] = total_list.size();

  ALLOC_CHECK_ARRAY_NOFAIL(adj_entity_handles, total_list.size());
  total_list.copy_to((RefEntity**)*adj_entity_handles);
  KEEP_ARRAY(offset);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArr2ndDrvt ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int  storage_order,
double const *  uv,
int  uv_size,
double **  dvtr_uu,
int *  dvrt_uu_allocated,
int *  dvrt_uu_size,
int **  uu_offset,
int *  uu_offset_allocated,
int *  uu_offset_size,
double **  dvtr_vv,
int *  dvrt_vv_allocated,
int *  dvrt_vv_size,
int **  vv_offset,
int *  vv_offset_allocated,
int *  vv_offset_size,
double **  dvrt_uv,
int *  dvrt_uv_allocated,
int *  dvrt_uv_size,
int **  uv_offset,
int *  uv_offset_allocated,
int *  uv_offset_size,
int *  err 
)

Get the second derivatives of faces at specified parametric positions.

Get the second derivatives of faces at specified parametric positions. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
entity_handlesArray of entity handles being queried
entity_handles_sizeNumber of entities in entity_handles array
storage_orderStorage order of coordinates input and output
uvParametric coordinates being queried
uv_sizeNumber of coordinates in array
dvrt_uuPointer to array of coordinates of derivative with respect to u at specified position returned from function
dvrt_uu_allocatedAllocated size of dvrt_uu array
dvrt_uu_sizeOccupied size of dvrt_uu array
uu_offsetPointer to array of offsets for dvrt_uu returned from function
uu_offset_allocatedPointer to allocated size of uu_offset array
uu_offset_sizePointer to occupied size of uu_offset array
dvrt_vvPointer to array of coordinates of derivative with respect to v at specified position returned from function
dvrt_vv_allocatedAllocated size of dvrt_vv array
dvrt_vv_sizeOccupied size of dvrt_vv array
vv_offsetPointer to array of offsets for dvrt_vv returned from function
vv_offset_allocatedPointer to allocated size of vv_offset array
vv_offset_sizePointer to occupied size of vv_offset array
dvrt_uvPointer to array of coordinates of derivative with respect to u and v at specified position returned from function
dvrt_uv_allocatedAllocated size of dvrt_uv array
dvrt_uv_sizeOccupied size of dvrt_uv array
uv_offsetPointer to array of offsets for dvrt_uv returned from function
uv_offset_allocatedPointer to allocated size of uv_offset array
uv_offset_sizePointer to occupied size of uv_offset array
*errPointer to error type returned from function

Definition at line 5585 of file iGeom_CGMA.cc.

ITAPS_API void iGeom_getArrAdj ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int  requested_entity_type,
iBase_EntityHandle **  adj_entity_handles,
int *  adj_entity_handles_allocated,
int *  adj_entity_handles_size,
int **  offset,
int *  offset_allocated,
int *  offset_size,
int *  err 
)

Get entities of specified type adjacent to entities.

Get entities of specified type adjacent to entities. Specified type must be value in the iBase_EntityType enumeration. offset(i) is index of first entity in adjacentEntityHandles array adjacent to entity_handles[i].

Parameters:
instanceiGeom instance handle
entity_handlesArray of entity handles being queried
entity_handles_sizeNumber of entities in entity_handles array
entity_type_requestedType of adjacent entities requested
*adjacentEntityHandlesPointer to array of adjacentEntityHandles returned from function
*adjacentEntityHandles_allocatedPointer to allocated size of adjacentEntityHandles array
*adj_entity_handles_sizePointer to occupied size of adjacentEntityHandles array
*offsetPointer to array of offsets returned from function
*offset_allocatedPointer to allocated size of offset array
*offset_sizePointer to occupied size of offset array
*errPointer to error type returned from function

Definition at line 1312 of file iGeom_CGMA.cc.

{
  ALLOC_CHECK_ARRAY(offset, entity_handles_size+1);
  DLIList<RefEntity*> temp_list, total_list;
  for (int i = 0; i < entity_handles_size; ++i) {
    (*offset)[i] = total_list.size();
    temp_list.clean_out();
    iGeom_get_adjacent_entities( (RefEntity*)(entity_handles[i]), requested_entity_type, temp_list, err );
    if (iBase_SUCCESS != *err) return;
    total_list += temp_list;
  }
  (*offset)[entity_handles_size] = total_list.size();

  ALLOC_CHECK_ARRAY_NOFAIL(adj_entity_handles, total_list.size());
  total_list.copy_to((RefEntity**)*adj_entity_handles);
  KEEP_ARRAY(offset);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrBoundBox ( iGeom_Instance  instance,
const iBase_EntityHandle gentity_handles,
int  gentity_handles_size,
int  storage_order,
double **  min_corner,
int *  min_corner_allocated,
int *  min_corner_size,
double **  max_corner,
int *  max_corner_allocated,
int *  max_corner_size,
int *  err 
)

Get the bounding box of the specified entities.

Return the bounding boxex of given entities; coordinates returned interleaved.

Parameters:
gentity_handlesThe gentities being queried
min_cornersMinimum corner coordinates of the boxes, interleaved
max_cornersMaximum corner coordinates of the boxes, interleaved

Definition at line 3337 of file iGeom_CGMA.cc.

{
    // check or pre-allocate the coordinate arrays
  ALLOC_CHECK_ARRAY(min_corner, 3*gentity_handles_size);
  ALLOC_CHECK_ARRAY(max_corner, 3*gentity_handles_size);
  
  size_t step, init;
  if (storage_order == iBase_BLOCKED) {
    step = 1;
    init = gentity_handles_size;
  }
  else {
    step = 3;
    init = 1;
  }
  double *min_x, *min_y, *min_z, *max_x, *max_y, *max_z;
  min_x = *min_corner;
  max_x = *max_corner;
  min_y = min_x + init;
  max_y = max_x + init;
  min_z = min_y + init;
  max_z = max_y + init;
  
  iBase_ErrorType result = iBase_SUCCESS;
  RefEntity** entities = (RefEntity**)gentity_handles;
  for (int i = 0; i < gentity_handles_size; ++i)
  {
    CubitVector min_c, max_c;
    CubitStatus s = iGeom_bounding_box( entities[i], min_c, max_c );
    if (s != CUBIT_SUCCESS)
      result = iBase_FAILURE;
    min_c.get_xyz( *min_x, *min_y, *min_z );
    max_c.get_xyz( *max_x, *max_y, *max_z );
    
    min_x += step;
    max_x += step;
    min_y += step;
    max_y += step;
    min_z += step;
    max_z += step;
  }

  KEEP_ARRAY(min_corner);
  KEEP_ARRAY(max_corner);
  RETURN(result);
}
ITAPS_API void iGeom_getArrClosestPt ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
int  gentity_handles_size,
int  storage_order,
const double *  near_coordinates,
int  near_coordinates_size,
double **  on_coordinates,
int *  on_coordinates_allocated,
int *  on_coordinates_size,
int *  err 
)

Get closest point for an array of entities and points For surfaces, it made sure the closest point in on surface. Get closest point for an array of entities and points. If either the number of entities or number of coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Return a points on specified entities closest to specified points in space. Input coordinates and output points are interleaved in the arrays.

Parameters:
gentity_handlesThe gentities being queried
near_coordinatesInput coordinates
on_coordinatesClosest point on gentity

Definition at line 2254 of file iGeom_CGMA.cc.

{
    /* set up iteration according to storage order.
       allow either gentity_handles or near_coordinates to contain
       only one value, where that single value is applied for every
       entry in the other list.
    */
  size_t near_step, on_step = 1, ent_step;
  int count;
  if (3*gentity_handles_size == near_coordinates_size) {
    near_step = ent_step = 1;
    count = gentity_handles_size;
  }
  else if (near_coordinates_size == 3) {
    near_step = 0;
    ent_step = 1;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    near_step = 1;
    ent_step = 0;
    count = near_coordinates_size / 3;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
  }
  ALLOC_CHECK_ARRAY( on_coordinates, 3*count );
  
  const double *near_x, *near_y, *near_z;
  double *on_x, *on_y, *on_z;
  if (storage_order == iBase_BLOCKED) {
    near_x = near_coordinates;
    near_y = near_x + near_coordinates_size/3;
    near_z = near_y + near_coordinates_size/3;
    on_x = *on_coordinates;
    on_y = on_x + count;
    on_z = on_y + count;
    on_step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED; /* set if unspecified */
    near_x = near_coordinates;
    near_y = near_x+1;
    near_z = near_x+2;
    on_x = *on_coordinates;
    on_y = on_x+1;
    on_z = on_x+2;
    near_step *= 3;
    on_step = 3;
  }
  
  RefEntity** ent_iter = (RefEntity**)(gentity_handles);
  CubitStatus final_result = CUBIT_SUCCESS;
  for (int i = 0; i < count; ++i) {
    CubitVector on, near( *near_x, *near_y, *near_z );
    CubitStatus status = iGeom_closest_point( *ent_iter, near, on );
    if (status != CUBIT_SUCCESS)
      final_result = status;
    on.get_xyz( *on_x, *on_y, *on_z );
    
    ent_iter += ent_step;
    near_x += near_step;
    near_y += near_step;
    near_z += near_step;
    on_x += on_step;
    on_y += on_step;
    on_z += on_step;
  }
  
  if (final_result == CUBIT_FAILURE) {
    ERROR(iBase_FAILURE, "Problems getting closest point for some entity.");
  }

  KEEP_ARRAY(on_coordinates);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrData ( iGeom_Instance  instance,
const iBase_EntityHandle entity_handles,
int  entity_handles_size,
iBase_TagHandle  tag_handle,
void **  tag_values,
int *  tag_values_allocated,
int *  tag_values_size,
int *  err 
)

Get tag values of arbitrary type for an array of entities.

Get tag values of arbitrary type for an array of entities. Tag data is returned as void*. tag_values_size specifies the size of the memory pointed to by tag_values in terms of bytes. Applications may use this function to get data of any type, not just iBase_BYTES. However, because this function supports data of arbitrary type, in all cases the size specified by tag_values_size always in terms of bytes.

Parameters:
instanceiGeom instance handle
entity_handlesEntity array on which tag is being set
entity_handles_sizeNumber of entities in array
tag_handleTag being set on an entity
*tag_valuesPointer to tag data array being returned from function. Note that the implicit INTERLEAVED storage order rule applies (see section ITAPS Storage Orders)
tag_values_allocatedPointer to allocated size of tag data array
tag_values_sizePointer to occupied size in bytes of tag data array
*errPointer to error type returned from function

Definition at line 1711 of file iGeom_CGMA.cc.

{
  char **tag_value = reinterpret_cast<char**>(tag_value_tmp);
  iBase_ErrorType retval = TM->getArrData(reinterpret_cast<RefEntity*const*>(entity_handles),
                                          entity_handles_size,
                                          TAG_HANDLE(tag_handle), 
                                          ARRAY_INOUT(tag_value));
  RETURN(retval);
}
ITAPS_API void iGeom_getArrEgEvalXYZ ( iGeom_Instance  instance,
iBase_EntityHandle const *  edge_handles,
int  edge_handles_size,
int  storage_order,
double const *  coords,
int  coords_size,
double **  on_coords,
int *  on_coords_allocated,
int *  on_coords_size,
double **  tangent,
int *  tangent_allocated,
int *  tangent_size,
double **  cvtr,
int *  cvtr_allocated,
int *  cvtr_size,
int *  err 
)

Get the closest point(s), tangent(s), and curvature(s) on an entity(ies) at given position(s)

Get the closest point(s), tangent(s), and curvature(s) on an entity(ies) at given position(s). If either the number of entities or number of coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
edge_handlesEdge(s) being queried
edge_handles_sizeNumber of edges being queried
storage_orderStorage order of coordinates
coordsStarting coordinates
coords_sizeNumber of values in coordinates array
on_coordsClosest point array
on_coords_allocatedAllocated size of closest point array
on_coords_sizeOccupied size of closest point array
tangentTangent array
tangent_allocatedAllocated size of tangent array
tangent_sizeOccupied size of tangent array
cvtrFirst principal curvatures
cvtr_allocatedAllocated size of first curvature array
cvtr_sizeOccupied size of first curvature array
*errPointer to error type returned from function

Definition at line 2977 of file iGeom_CGMA.cc.

{
    /* set up iteration according to storage order.
       allow either gentity_handles or near_coordinates to contain
       only one value, where that single value is applied for every
       entry in the other list.
    */
  size_t coord_step, on_step = 1, ent_step;
  int count;
  if (3*edge_handles_size == coordinates_size) {
    coord_step = ent_step = 1;
    count = edge_handles_size;
  }
  else if (coordinates_size == 3) {
    coord_step = 0;
    ent_step = 1;
    count = edge_handles_size;
  }
  else if (edge_handles_size == 1) {
    coord_step = 1;
    ent_step = 0;
    count = coordinates_size / 3;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
  }

    // check or pre-allocate the coordinate arrays
  ALLOC_CHECK_ARRAY( on_coords, 3*count );
  ALLOC_CHECK_ARRAY( tangents, 3*count );
  ALLOC_CHECK_ARRAY( curvatures, 3*count );
  
  const double *coord_x, *coord_y, *coord_z;
  double *on_x, *on_y, *on_z;
  double *tan_x, *tan_y, *tan_z;
  double *curv_x, *curv_y, *curv_z;
  if (storage_order == iBase_BLOCKED) {
    coord_x = coordinates;
    coord_y = coord_x + coordinates_size/3;
    coord_z = coord_y + coordinates_size/3;
    on_x = *on_coords;
    on_y = on_x + count;
    on_z = on_y + count;
    tan_x = *tangents;
    tan_y = tan_x + count;
    tan_z = tan_y + count;
    curv_x = *curvatures;
    curv_y = curv_x + count;
    curv_z = curv_y + count;
    on_step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED; /* set if unspecified */
    coord_x = coordinates;
    coord_y = coord_x+1;
    coord_z = coord_x+2;
    on_x = *on_coords;
    on_y = on_x + 1;
    on_z = on_x + 2;
    tan_x = *tangents;
    tan_y = tan_x+1;
    tan_z = tan_x+2;
    curv_x = *curvatures;
    curv_y = curv_x + 1;
    curv_z = curv_x + 2;
    coord_step *= 3;
    on_step = 3;
  }
  
  RefEntity** ent_iter = (RefEntity**)edge_handles;
  iBase_ErrorType result = iBase_SUCCESS;
  for (int i = 0; i < count; ++i) {
    RefEdge* edge = dynamic_cast<RefEdge*>(*ent_iter);
    if (!edge) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Non-edge input handle.");
    }
    else {
      const CubitVector coords( *coord_x, *coord_y, *coord_z );
      CubitVector on, tan, curv;
      CubitStatus s = edge->closest_point( coords, on, &tan, &curv );
      if (s == CUBIT_FAILURE)
        result = iBase_FAILURE;
      on.get_xyz( *on_x, *on_y, *on_z );
      tan.get_xyz( *tan_x, *tan_y, *tan_z );
      curv.get_xyz( *curv_x, *curv_y, *curv_z );
    }
    
    ent_iter += ent_step;
    coord_x += coord_step;
    coord_y += coord_step;
    coord_z += coord_step;
    on_x += on_step;
    on_y += on_step;
    on_z += on_step;
    tan_x += on_step;
    tan_y += on_step;
    tan_z += on_step;
    curv_x += on_step;
    curv_y += on_step;
    curv_z += on_step;
  }
  
  KEEP_ARRAY( on_coords );
  KEEP_ARRAY( tangents );
  KEEP_ARRAY( curvatures );
  RETURN(result);
}
ITAPS_API void iGeom_getArrFcEvalXYZ ( iGeom_Instance  instance,
iBase_EntityHandle const *  face_handles,
int  face_handles_size,
int  storage_order,
double const *  coords,
int  coords_size,
double **  on_coords,
int *  on_coords_allocated,
int *  on_coords_size,
double **  normal,
int *  normal_allocated,
int *  normal_size,
double **  cvtr1,
int *  cvtr1_allocated,
int *  cvtr1_size,
double **  cvtr2,
int *  cvtr2_allocated,
int *  cvtr2_size,
int *  err 
)

Get the closest point(s), tangent(s), and curvature(s) on an entity(ies) at given position(s)

Get the closest point(s), tangent(s), and curvature(s) on an entity(ies) at given position(s). If either the number of entities or number of coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
edge_handlesEdge(s) being queried
edge_handles_sizeNumber of edges being queried
storage_orderStorage order of coordinates
coordsStarting coordinates
coords_sizeNumber of values in coordinates array
on_coordsClosest point array
on_coords_allocatedAllocated size of closest point array
on_coords_sizeOccupied size of closest point array
normalNormal array
normal_allocatedAllocated size of normal array
normal_sizeOccupied size of normal array
cvtr_1First principal curvatures
cvtr_1_allocatedAllocated size of first curvature array
cvtr_1_sizeOccupied size of first curvature array
cvtr_2Second principal curvatures
cvtr_2_allocatedAllocated size of second curvature array
cvtr_2_sizeOccupied size of second curvature array
*errPointer to error type returned from function

Definition at line 3101 of file iGeom_CGMA.cc.

{
    /* set up iteration according to storage order.
       allow either gentity_handles or near_coordinates to contain
       only one value, where that single value is applied for every
       entry in the other list.
    */
  size_t coord_step, on_step = 1, ent_step;
  int count;
  if (3*face_handles_size == coordinates_size) {
    coord_step = ent_step = 1;
    count = face_handles_size;
  }
  else if (coordinates_size == 3) {
    coord_step = 0;
    ent_step = 1;
    count = face_handles_size;
  }
  else if (face_handles_size == 1) {
    coord_step = 1;
    ent_step = 0;
    count = coordinates_size / 3;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
  }

    // check or pre-allocate the coordinate arrays
  ALLOC_CHECK_ARRAY( on_coords, 3*count );
  ALLOC_CHECK_ARRAY( normals, 3*count );
  ALLOC_CHECK_ARRAY( curvatures_1, 3*count );
  ALLOC_CHECK_ARRAY( curvatures_2, 3*count );
  
  const double *coord_x, *coord_y, *coord_z;
  double *on_x, *on_y, *on_z;
  double *norm_x, *norm_y, *norm_z;
  double *curv1_x, *curv1_y, *curv1_z;
  double *curv2_x, *curv2_y, *curv2_z;
  if (storage_order == iBase_BLOCKED) {
    coord_x = coordinates;
    coord_y = coord_x + coordinates_size/3;
    coord_z = coord_y + coordinates_size/3;
    on_x = *on_coords;
    on_y = on_x + count;
    on_z = on_y + count;
    norm_x = *normals;
    norm_y = norm_x + count;
    norm_z = norm_y + count;
    curv1_x = *curvatures_1;
    curv1_y = curv1_x + count;
    curv1_z = curv1_y + count;
    curv2_x = *curvatures_2;
    curv2_y = curv2_x + count;
    curv2_z = curv2_y + count;
    on_step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED; /* set if unspecified */
    coord_x = coordinates;
    coord_y = coord_x+1;
    coord_z = coord_x+2;
    on_x = *on_coords;
    on_y = on_x + 1;
    on_z = on_x + 2;
    norm_x = *normals;
    norm_y = norm_x+1;
    norm_z = norm_x+2;
    curv1_x = *curvatures_1;
    curv1_y = curv1_x + 1;
    curv1_z = curv1_x + 2;
    curv2_x = *curvatures_2;
    curv2_y = curv2_x + 1;
    curv2_z = curv2_x + 2;
    coord_step *= 3;
    on_step = 3;
  }
  
  RefEntity** ent_iter = (RefEntity**)face_handles;
  iBase_ErrorType result = iBase_SUCCESS;
  for (int i = 0; i < count; ++i) {
    RefFace* face = dynamic_cast<RefFace*>(*ent_iter);
    if (!face) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Non-face input handle.");
      result = iBase_INVALID_ENTITY_TYPE;
    }
    else {
      const CubitVector coords( *coord_x, *coord_y, *coord_z );
      CubitVector on, norm, curv1, curv2;
      Surface* surf = face->get_surface_ptr();
#ifdef CGM_HAVE_FACET_ENGINE_ONLY
      CubitStatus s = surf->closest_point( coords, &on, &norm);
#else
      CubitStatus s = surf->closest_point( coords, &on, &norm, &curv1, &curv2 );
#endif
      if (s == CUBIT_FAILURE)
        result = iBase_FAILURE;
      on.get_xyz( *on_x, *on_y, *on_z );
      norm.get_xyz( *norm_x, *norm_y, *norm_z );
      curv1.get_xyz( *curv1_x, *curv1_y, *curv1_z );
      curv2.get_xyz( *curv2_x, *curv2_y, *curv2_z );
    }
    
    ent_iter += ent_step;
    coord_x += coord_step;
    coord_y += coord_step;
    coord_z += coord_step;
    on_x += on_step;
    on_y += on_step;
    on_z += on_step;
    norm_x += on_step;
    norm_y += on_step;
    norm_z += on_step;
    curv1_x += on_step;
    curv1_y += on_step;
    curv1_z += on_step;
    curv2_x += on_step;
    curv2_y += on_step;
    curv2_z += on_step;
  }
  
  KEEP_ARRAY( on_coords );
  KEEP_ARRAY( normals );
  KEEP_ARRAY( curvatures_1 );
  KEEP_ARRAY( curvatures_2 );
  RETURN(result);
}
ITAPS_API void iGeom_getArrNrmlPlXYZ ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
const int  gentity_handles_size,
int  storage_order,
const double *  near_coordinates,
const int  near_coordinates_size,
double **  on_coordinates,
int *  on_coordinates_allocated,
int *  on_coordinates_size,
double **  normals,
int *  normals_allocated,
int *  normals_size,
int *  err 
)

Get the normal vector AND closest point on an entity(ies) at given position(s)

Return a points on specified entities closest to specified points in space, and normals at that point. Input coordinates and output points are interleaved in the arrays.

Parameters:
gentity_handlesThe gentities being queried
near_coordinatesInput coordinates
on_coordinatesClosest point on gentity

Definition at line 2376 of file iGeom_CGMA.cc.

{
    /* set up iteration according to storage order.
       allow either gentity_handles or near_coordinates to contain
       only one value, where that single value is applied for every
       entry in the other list.
    */
  size_t near_step, on_step = 1, ent_step;
  int count;
  if (3*gentity_handles_size == near_coordinates_size) {
    near_step = ent_step = 1;
    count = gentity_handles_size;
  }
  else if (near_coordinates_size == 3) {
    near_step = 0;
    ent_step = 1;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    near_step = 1;
    ent_step = 0;
    count = near_coordinates_size / 3;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
  }
  ALLOC_CHECK_ARRAY( on_coordinates, 3*count );
  ALLOC_CHECK_ARRAY( normals, 3*count );
  
  const double *near_x, *near_y, *near_z;
  double *on_x, *on_y, *on_z;
  double *norm_x, *norm_y, *norm_z;
  if (storage_order == iBase_BLOCKED) {
    near_x = near_coordinates;
    near_y = near_x + near_coordinates_size/3;
    near_z = near_y + near_coordinates_size/3;
    on_x = *on_coordinates;
    on_y = on_x + count;
    on_z = on_y + count;
    norm_x = *normals;
    norm_y = norm_x + count;
    norm_z = norm_y + count;
    on_step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED; /* set if unspecified */
    near_x = near_coordinates;
    near_y = near_x+1;
    near_z = near_x+2;
    on_x = *on_coordinates;
    on_y = on_x+1;
    on_z = on_x+2;
    norm_x = *normals;
    norm_y = norm_x+1;
    norm_z = norm_x+2;
    near_step *= 3;
    on_step = 3;
  }
  
  RefEntity** ent_iter = (RefEntity**)(gentity_handles);
  CubitStatus final_result = CUBIT_SUCCESS;
  for (int i = 0; i < count; ++i) {
    CubitVector on, norm, near( *near_x, *near_y, *near_z );
    CubitStatus status = iGeom_closest_point_and_normal( *ent_iter, near, on, norm );
    if (status != CUBIT_SUCCESS)
      final_result = status;
    on.get_xyz( *on_x, *on_y, *on_z );
    norm.get_xyz( *norm_x, *norm_y, *norm_z );
    
    ent_iter += ent_step;
    near_x += near_step;
    near_y += near_step;
    near_z += near_step;
    on_x += on_step;
    on_y += on_step;
    on_z += on_step;
    norm_x += on_step;
    norm_y += on_step;
    norm_z += on_step;
  }
  
  if (final_result == CUBIT_FAILURE) {
    ERROR(iBase_FAILURE, "Problems getting closest point for some entity.");
  }

  KEEP_ARRAY(on_coordinates);
  KEEP_ARRAY(normals);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrNrmlSense ( iGeom_Instance  instance,
iBase_EntityHandle const *  face_handles,
int  face_handles_size,
iBase_EntityHandle const *  region_handles,
int  region_handles_size,
int **  sense,
int *  sense_allocated,
int *  sense_size,
int *  err 
)

Get the senses of an array of faces with respect to an array of regions.

Get the senses of an array of faces with respect to an array of regions. Sense returned is -1, 0, or 1, representing "reversed", "both", or "forward". "both" sense indicates that face bounds the region once with each sense.

Parameters:
instanceiGeom instance handle
face_handlesFaces being queried
face_handles_sizeSize of face handles array
region_handlesRegions being queried
region_handles_sizeSize of region handles array
senseSenses of faces with respect to regions
sense_allocatedAllocated size of senses array
sense_sizeOccupied size of senses array
*errPointer to error type returned from function

Definition at line 3721 of file iGeom_CGMA.cc.

{
  size_t faces_step, regions_step;
  int count;
  if (faces_size == regions_size) {
    faces_step = regions_step = 1;
    count = faces_size;
  }
  else if (faces_size == 1) {
    faces_step = 0;
    regions_step = 1;
    count = regions_size;
  }
  else if (regions_size == 1) {
    faces_step = 1;
    regions_step = 0;
    count = faces_size;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes" );
    RETURN (iBase_INVALID_ENTITY_COUNT);
  }
  
  RefEntity** face_iter = (RefEntity**)faces;
  RefEntity** region_iter = (RefEntity**)regions;
  ALLOC_CHECK_ARRAY( senses, count );
  for (int i = 0; i < count; ++i) {
    RefFace *face_ent = dynamic_cast<RefFace*>(*face_iter);
    if (NULL == face_ent) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "1st argument to getArrNrmlSense must be a face.");
    }

    // XXX: workaround; remove this when we switch iBase_REGIONs to RefVolume
    const RefVolume *volume_ent;
    Body *body_ent = dynamic_cast<Body*>(*region_iter);
    if (NULL != body_ent) {
      DLIList<RefEntity*> children;
      body_ent->get_child_ref_entities(children);
      if (children.size() != 1) {
        ERROR(iBase_FAILURE, "Can only support bodies with one volume");
      }
      volume_ent = dynamic_cast<const RefVolume*>(children[0]);
    }
    else {
      volume_ent = dynamic_cast<const RefVolume*>(*region_iter);
    }

    if (NULL == volume_ent) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "2nd argument to getArrNrmlSense must be a region.");
    }

    (*senses)[i] = iGeom_get_nonmanifold_sense( face_ent, volume_ent, err );
    if (iBase_SUCCESS != *err)
      return;

    face_iter += faces_step;
    region_iter += regions_step;
  }
  
  KEEP_ARRAY(senses);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrNrmlUV ( iGeom_Instance  instance,
iBase_EntityHandle const *  gface_handles,
int  gface_handles_size,
int  storage_order,
const double *  parameters,
int  parameters_size,
double **  normals,
int *  normals_allocated,
int *  normals_size,
int *  err 
)

Return the normals at specified parametric positions.

Return the normals at specified uv positions on gfaces. If any gentity input is not a face, returns error. Input parameters and output normals are interleaved.

Parameters:
gface_handlesThe entities being queried
parametersThe uv parameters of points being queried, interleaved
normalsNormals at specified points, interleaved

Definition at line 5324 of file iGeom_CGMA.cc.

{
  int count;
  size_t face_step, param_step, norm_step;
  if (2*gface_handles_size == parameters_size) {
    count = gface_handles_size;
    face_step = param_step = 1;
  }
  else if (parameters_size == 2) {
    count = gface_handles_size;
    face_step = 1;
    param_step = 0;
  }
  else if (gface_handles_size == 1) {
    count = parameters_size/2;
    face_step = 0;
    param_step = 1;
  }
  else {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }
  
    // check or pre-allocate the coordinate arrays
  ALLOC_CHECK_ARRAY( normals, 3*count );

  const double *u, *v;
  double *x, *y, *z;
  u = parameters;
  x = *normals;
  if (storage_order == iBase_BLOCKED) {
    v = u + (param_step ? count : 1);
    y = x + count;
    z = y + count;
    norm_step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED;
    v = u + 1;
    y = x + 1;
    z = x + 2;
    norm_step = 3;
    param_step *= 2;
  }
  
  RefEntity** face_iter = (RefEntity**)gface_handles;
  for (int i = 0; i < count; ++i) {
    RefFace* face = dynamic_cast<RefFace*>(*face_iter);
    if (!face) { RETURN (iBase_INVALID_ENTITY_TYPE); }
    
    CubitVector normal;
    CubitStatus s = iGeom_normal_from_uv( face, *u, *v, normal );
    normal.get_xyz( *x, *y, *z );
    if (CUBIT_SUCCESS != s) {
      RETURN(iBase_FAILURE);
    }
    
    face_iter += face_step;
    x += norm_step;
    y += norm_step;
    z += norm_step;
    u += param_step;
    v += param_step;
  }
  
  KEEP_ARRAY(normals);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrNrmlXYZ ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
int  gentity_handles_size,
int  storage_order,
const double *  coordinates,
int  coordinates_size,
double **  normals,
int *  normals_allocated,
int *  normals_size,
int *  err 
)

Get the normal vector on an entity(ies) at given position(s)

Return the normals at point on specified entities. Returns error if any input entity is not a gface. Input coordinates and normals are interleaved in the arrays.

Parameters:
gentity_handlesThe gentities being queried
coordinatesInput coordinates, interleaved
normalsThe normals at the specified points, interleaved

Definition at line 2510 of file iGeom_CGMA.cc.

{
    /* set up iteration according to storage order.
       allow either gentity_handles or near_coordinates to contain
       only one value, where that single value is applied for every
       entry in the other list.
    */
  size_t coord_step, norm_step = 1, ent_step;
  int count;
  if (3*gentity_handles_size == coordinates_size) {
    coord_step = ent_step = 1;
    count = gentity_handles_size;
  }
  else if (coordinates_size == 3) {
    coord_step = 0;
    ent_step = 1;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    coord_step = 1;
    ent_step = 0;
    count = coordinates_size / 3;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
  }

    // check or pre-allocate the coordinate arrays
  ALLOC_CHECK_ARRAY( normals, 3*count );
  
  const double *coord_x, *coord_y, *coord_z;
  double *norm_x, *norm_y, *norm_z;
  if (storage_order == iBase_BLOCKED) {
    coord_x = coordinates;
    coord_y = coord_x + coordinates_size/3;
    coord_z = coord_y + coordinates_size/3;
    norm_x = *normals;
    norm_y = norm_x + count;
    norm_z = norm_y + count;
    norm_step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED; /* set if unspecified */
    coord_x = coordinates;
    coord_y = coord_x+1;
    coord_z = coord_x+2;
    norm_x = *normals;
    norm_y = norm_x+1;
    norm_z = norm_x+2;
    coord_step *= 3;
    norm_step = 3;
  }
  
  RefEntity** entities = (RefEntity**)(gentity_handles);
  for (int i = 0; i < count; ++i)
  {
    RefFace* face = dynamic_cast<RefFace*>(*entities);
    if (NULL == face) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Entities passed into gentityNormal must be faces.");
    }
    else {
      CubitVector normal, coords( *coord_x, *coord_y, *coord_z );
      normal = face->normal_at( coords );
      normal.get_xyz( *norm_x, *norm_y, *norm_z );
    }
    entities += ent_step;
    coord_x += coord_step;
    coord_y += coord_step;
    coord_z += coord_step;
    norm_x += norm_step;
    norm_y += norm_step;
    norm_z += norm_step;
  }

  KEEP_ARRAY(normals);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrTgntU ( iGeom_Instance  instance,
iBase_EntityHandle const *  gedge_handles,
int  gedge_handles_size,
int  storage_order,
const double *  parameters,
int  parameters_size,
double **  tangents,
int *  tangents_allocated,
int *  tangents_size,
int *  err 
)

Return the tangents at specified parametric positions.

Return the tangents at specified u positions on gedges. If any gentity input is not a face, returns error. Output normals are interleaved.

Parameters:
gentity_handlesThe gedges being queried
parametersThe u parameters of points being queried
tangentsTangents at specified points, interleaved

Definition at line 5426 of file iGeom_CGMA.cc.

{
  iGeom_getArrUtoXYZ(instance, ARRAY_IN(gedge_handles),
                     ARRAY_IN(parameters), storage_order, 
                     ARRAY_INOUT(tangents), err); 
  if (iBase_SUCCESS == *err)
    iGeom_getArrTgntXYZ(instance, ARRAY_IN(gedge_handles), storage_order,
                        *tangents, *tangents_size, ARRAY_INOUT(tangents), err);
}
ITAPS_API void iGeom_getArrTgntXYZ ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
int  gentity_handles_size,
int  storage_order,
const double *  coordinates,
int  coordinates_size,
double **  tangents,
int *  tangents_allocated,
int *  tangents_size,
int *  err 
)

Get the tangent vector on an entity(ies) at given position(s)

Return the tangent at point on specified entities. Returns error if any input entity is not a gedge. Input coordinates and tangents are interleaved in the arrays.

Parameters:
gentity_handlesThe gentities being queried
coordinatesInput coordinates, interleaved
tangentsThe tangents at the specified points, interleaved

Definition at line 2630 of file iGeom_CGMA.cc.

{
    /* set up iteration according to storage order.
       allow either gentity_handles or near_coordinates to contain
       only one value, where that single value is applied for every
       entry in the other list.
    */
  size_t coord_step, tan_step = 1, ent_step;
  int count;
  if (3*gentity_handles_size == coordinates_size) {
    coord_step = ent_step = 1;
    count = gentity_handles_size;
  }
  else if (coordinates_size == 3) {
    coord_step = 0;
    ent_step = 1;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    coord_step = 1;
    ent_step = 0;
    count = coordinates_size / 3;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
  }

    // check or pre-allocate the coordinate arrays
  ALLOC_CHECK_ARRAY( tangents, 3*count );
  
  const double *coord_x, *coord_y, *coord_z;
  double *tan_x, *tan_y, *tan_z;
  if (storage_order == iBase_BLOCKED) {
    coord_x = coordinates;
    coord_y = coord_x + coordinates_size/3;
    coord_z = coord_y + coordinates_size/3;
    tan_x = *tangents;
    tan_y = tan_x + count;
    tan_z = tan_y + count;
    tan_step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED; /* set if unspecified */
    coord_x = coordinates;
    coord_y = coord_x+1;
    coord_z = coord_x+2;
    tan_x = *tangents;
    tan_y = tan_x+1;
    tan_z = tan_x+2;
    coord_step *= 3;
    tan_step = 3;
  }
  
  RefEntity** entities = (RefEntity**)(gentity_handles);
  for (int i = 0; i < count; ++i)
  {
    RefEdge* edge = dynamic_cast<RefEdge*>(*entities);
    if (NULL == edge) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Entities passed into gentityTangent must be edges.");
    }
    else {
      CubitVector tangent, coords( *coord_x, *coord_y, *coord_z );
      edge->tangent( coords, tangent );
      tangent.get_xyz( *tan_x, *tan_y, *tan_z );
    }
    
    entities += ent_step;
    coord_x += coord_step;
    coord_y += coord_step;
    coord_z += coord_step;
    tan_x += tan_step;
    tan_y += tan_step;
    tan_z += tan_step;
  }

  KEEP_ARRAY(tangents);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrTolerance ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
const int  gentity_handles_size,
double **  tolerances,
int *  tolerances_allocated,
int *  tolerances_size,
int *  err 
)

Get the tolerances of the specified entities.

Return the relative and absolute tolerances for specified gentities. If a gentity does not have a specific tolerance, zero is returned for both values.

Parameters:
gentity_handlesGentities being queried
relative_tolerancesRelative tolerances
absolute_tolerancesAbsolute tolerances

Definition at line 4343 of file iGeom_CGMA.cc.

{
  ALLOC_CHECK_ARRAY_NOFAIL(tolerances, gentity_handles_size);
  double dum_abs_tol = gqt->get_sme_resabs_tolerance();
  for (int i = 0; i < gentity_handles_size; i++) {
    (*tolerances)[i] = dum_abs_tol;
  }
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrType ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
int  gentity_handles_size,
int **  gtype,
int *  gtype_allocated,
int *  gtype_size,
int *  err 
)

Get the entity type for the specified entities.

Returns an integer array of topological dimensions for an input array of entity handles.

Definition at line 1258 of file iGeom_CGMA.cc.

{
    // go through each entity and look up its dimension
  ALLOC_CHECK_ARRAY_NOFAIL(gtype, gentity_handles_size);

  const RefEntity **tmp_handles = (const RefEntity**)(gentity_handles);
  
  for (int i = 0; i < gentity_handles_size; i++) {
    if (dynamic_cast<const Body*>(tmp_handles[i]))
      (*gtype)[i] = iBase_REGION;
    else
      (*gtype)[i] = tmp_handles[i]->dimension();
  }

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrURange ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
double **  u_min,
int *  u_min_allocated,
int *  u_min_size,
double **  u_max,
int *  u_max_allocated,
int *  u_max_size,
int *  err 
)

Get parametric range of entities.

Get parametric range of entities

Parameters:
instanceiGeom instance handle
entity_handlesEntities being queried
entity_handles_sizeNumber of entities being queried
storage_orderStorage order of parametric coordinates being returned
u_minMinimum parametric coordinate for entities
u_min_allocatedAllocated size of minimum parametric coordinate array
u_min_sizeOccupied size of minimum parametric coordinate array
u_maxMaximum parametric coordinate for entities
u_max_allocatedAllocated size of maximum parametric coordinate array
u_max_sizeOccupied size of maximum parametric coordinate array
*errPointer to error type returned from function

Definition at line 5000 of file iGeom_CGMA.cc.

{
  ALLOC_CHECK_ARRAY(u_min, gentity_handles_size);
  ALLOC_CHECK_ARRAY(u_max, gentity_handles_size);
  
  RefEntity** entities = (RefEntity**)gentity_handles;
  for (int i = 0; i < gentity_handles_size; ++i) {
    RefEdge* edge = dynamic_cast<RefEdge*>(entities[i]);
    if (!edge) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Expected edge for 1-param method.");
    }
    
    CubitBoolean r1 = edge->get_param_range((*u_min)[i], (*u_max)[i]);
    if (!r1) {
      RETURN(iBase_FAILURE);
    }
  }
  
  KEEP_ARRAY(u_min);
  KEEP_ARRAY(u_max);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrUtoUV ( iGeom_Instance  instance,
iBase_EntityHandle const *  edge_handles,
int  edge_handles_size,
iBase_EntityHandle const *  face_handles,
int  face_handles_size,
double const *  u_in,
int  u_in_size,
int  storage_order,
double **  uv,
int *  uv_allocated,
int *  uv_size,
int *  err 
)

Return the face parametric coordinates for a parametric position on bounding edges.

Return the face parametric coordinates for a parametric position on bounding edges

Parameters:
instanceiGeom instance handle
edge_handlesEdges being queried
edge_handles_sizeNumber of edges being queried
face_handlesFaces being queried
face_handles_sizeNumber of faces being queried
u_inParametric positions on edges
u_in_sizeNumber of parametric positions on edges
storage_orderStorage order of coordinates returned
uvCorresponding parametric positions on faces
uv_allocatedAllocated size of parameter array
uv_sizeOccupied size of parameter array
*errPointer to error type returned from function

Definition at line 5064 of file iGeom_CGMA.cc.

{
  int count;
  size_t edge_step, face_step, coord_step, in_u_step;

  if (!(iGeom_check_array_size(edge_handles_size, face_handles_size) &&
        iGeom_check_array_size(edge_handles_size, in_u_size) &&
        iGeom_check_array_size(face_handles_size, in_u_size))) {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }

  edge_step = (edge_handles_size == 1) ? 0:1;
  face_step = (face_handles_size == 1) ? 0:1;
  in_u_step = (in_u_size == 1) ? 0:1;

  count = std::max(edge_handles_size, std::max(face_handles_size, in_u_size));

  ALLOC_CHECK_ARRAY( uv, 2*count );
  
  const double *in_u_iter;
  double *u, *v;
  in_u_iter = in_u;
  u = *uv;
  if (storage_order == iBase_BLOCKED) {
    v = u + count;
    coord_step = 1;
  } 
  else {
    v = u + 1;
    coord_step = 2;
  }
  
  RefEntity** edge_ent = (RefEntity**)edge_handles;
  RefEntity** face_ent = (RefEntity**)face_handles;
  for (int i = 0; i < count; ++i) {
    RefEdge* edge = dynamic_cast<RefEdge*>(*edge_ent);
    RefFace* face = dynamic_cast<RefFace*>(*face_ent);
    if (!edge || !face) {
      RETURN(iBase_INVALID_ENTITY_TYPE);
    }
    
    CubitVector xyz;
    CubitStatus s;
    s = edge->position_from_u( *in_u_iter, xyz );
    if (CUBIT_SUCCESS != s)
      RETURN(iBase_FAILURE);
    s = face->u_v_from_position( xyz, *u, *v );
    if (CUBIT_SUCCESS != s)
      RETURN(iBase_FAILURE);

    edge_ent += edge_step;
    face_ent += face_step;
    in_u_iter += in_u_step;
    u += coord_step;
    v += coord_step;
  }
  
  KEEP_ARRAY(uv);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrUtoXYZ ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
double const *  u,
int  u_size,
int  storage_order,
double **  on_coords,
int *  on_coords_allocated,
int *  on_coords_size,
int *  err 
)

Return coordinate positions at specified parametric position(s) on entity(ies)

Return coordinate positions at specified parametric position(s) on entity(ies). If either the number of entities or number of parametric coordinate pairs is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
entity_handlesEntities being queried
entity_handles_sizeNumber of entities being queried
storage_orderStorage order of resulting coordinates
uvCoordinates being queried
uv_sizeNumber of coordinates in array
coordinatesCoordinates of parametric positions
coordinates_allocatedAllocated size of coordinates array
coordinates_sizeOccupied size of coordinates array
*errPointer to error type returned from function

Definition at line 4526 of file iGeom_CGMA.cc.

{
  int count;
  size_t ent_step, coord_step, u_step;
  if (gentity_handles_size == u_size) {
    ent_step = u_step = 1;
    count = gentity_handles_size;
  }
  else if (u_size == 1) {
    ent_step = 1;
    u_step = 0;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    ent_step = 0;
    u_step = 1;
    count = u_size;
  }
  else {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }
    
  ALLOC_CHECK_ARRAY( coordinates, 3*count );
  
  const double *u_iter;
  double *x, *y, *z;
  u_iter = u;
  x = *coordinates;
  if (storage_order == iBase_BLOCKED) {
    y = x + count;
    z = y + count;
    coord_step = 1;
  } 
  else {
    y = x + 1;
    z = x + 2;
    coord_step = 3;
  }
  
  iBase_ErrorType result = iBase_SUCCESS;
  RefEntity** ent = (RefEntity**)gentity_handles;
  for (int i = 0; i < count; ++i) {
    RefEdge* edge = dynamic_cast<RefEdge*>(*ent);
    if (!edge) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Expected edge for 1-param method.");
    }
    
    CubitVector xyz;
    CubitStatus s = edge->position_from_u( *u_iter, xyz );
    if (CUBIT_SUCCESS != s)
      result = iBase_FAILURE;
    xyz.get_xyz( *x, *y, *z );
    
    ent += ent_step;
    u_iter += u_step;
    x += coord_step;
    y += coord_step;
    z += coord_step;
  }
  
  KEEP_ARRAY(coordinates);
  RETURN(result);
}
ITAPS_API void iGeom_getArrUVRange ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
int  gentity_handles_size,
int  storage_order,
double **  uv_min,
int *  uv_min_allocated,
int *  uv_min_size,
double **  uv_max,
int *  uv_max_allocated,
int *  uv_max_size,
int *  err 
)

Get parametric range of entities.

Return the uv range of the specified gentities. Parameters are interleaved.

Parameters:
gentity_handlesGentities being queried.
uv_minMinimum parameters of gentities, interleaved
uv_maxMaximum parameters of gentities, interleaved

Definition at line 4945 of file iGeom_CGMA.cc.

{
  ALLOC_CHECK_ARRAY(uv_min, 2*gentity_handles_size);
  ALLOC_CHECK_ARRAY(uv_max, 2*gentity_handles_size);
  
  size_t init, step;
  if (storage_order == iBase_BLOCKED) {
    init = gentity_handles_size;
    step = 1;
  }
  else {
    init = 1;
    step = 2;
  }
  
  double *u_min = *uv_min;
  double *v_min = u_min + init;
  double *u_max = *uv_max;
  double *v_max = u_max + init;
  
  RefEntity** entities = (RefEntity**)gentity_handles;
  for (int i = 0; i < gentity_handles_size; ++i) {
    RefFace* face = dynamic_cast<RefFace*>(entities[i]);
    if (!face) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Expected face for UV method.");
    }
    
    CubitBoolean r1 = face->get_param_range_U(*u_min, *u_max);
    CubitBoolean r2 = face->get_param_range_V(*v_min, *v_max);
    if (!(r1 && r2)) {
      RETURN(iBase_FAILURE);
    }
    
    u_min += step;
    v_min += step;
    u_max += step;
    v_max += step;
  }
  
  KEEP_ARRAY(uv_min);
  KEEP_ARRAY(uv_max);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrUVtoXYZ ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
int  gentity_handles_size,
int  storage_order,
const double *  uv,
int  uv_size,
double **  coordinates,
int *  coordinates_allocated,
int *  coordinates_size,
int *  err 
)

Return coordinate positions at specified parametric position(s) on entity(ies)

Given sets of parametric coordinates, return the corresponding real space coordinates on the gentities. Input and output coordinates are interleaved.

Parameters:
gentity_handlesGentities being queried.
uvInput parametric coordinates
xyzOutput real space coordinates

Definition at line 4430 of file iGeom_CGMA.cc.

{
  size_t ent_step, coord_step, uv_step;
  int count;
  if (2*gentity_handles_size == uv_size) {
    ent_step = uv_step = 1;
    count = gentity_handles_size;
  }
  else if (uv_size == 2) {
    ent_step = 1;
    uv_step = 0;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    ent_step = 0;
    uv_step = 1;
    count = uv_size/2;
  }
  else {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }

  ALLOC_CHECK_ARRAY( coordinates, 3*count );
    
  const double *u, *v;
  double *x, *y, *z;
  u = uv;
  x = *coordinates;
  if (storage_order == iBase_BLOCKED) {
    v = u + (uv_step ? count : 1);
    y = x + count;
    z = y + count;
    coord_step = 1;
  } 
  else {
    storage_order = iBase_INTERLEAVED;
    v = u + 1;
    y = x + 1;
    z = x + 2;
    coord_step = 3;
    uv_step *= 2;
  }
  
  RefEntity** ent = (RefEntity**)gentity_handles;
  for (int i = 0; i < count; ++i) {
    RefFace* face = dynamic_cast<RefFace*>(*ent);
    if (!face) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Expected face for UV method.");
    }
    
    CubitVector xyz = face->position_from_u_v( *u, *v );
    xyz.get_xyz( *x, *y, *z );
    
    ent += ent_step;
    u += uv_step;
    v += uv_step;
    x += coord_step;
    y += coord_step;
    z += coord_step;
  }
  
  KEEP_ARRAY(coordinates);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrXYZtoU ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int  storage_order,
double const *  coordinates,
int  coordinates_size,
double **  u,
int *  u_allocated,
int *  u_size,
int *  err 
)

Return spatial positions at specified parametric position(s) on entity(ies)

Return spatial positions at specified parametric position(s) on entity(ies). If either the number of entities or number of spatial coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
entity_handlesEntities being queried
entity_handles_sizeNumber of entities being queried
storage_orderStorage order of spatial coordinates input
coordinatesCoordinates being queried
coordinates_sizeNumber of coordinates in array
uCoordinates of parametric positions
u_allocatedAllocated size of coordinates array
u_sizeOccupied size of coordinates array
*errPointer to error type returned from function

Definition at line 4729 of file iGeom_CGMA.cc.

{
  int count;
  size_t ent_step, coord_step;
  if (3*gentity_handles_size == coordinates_size) {
    ent_step = coord_step = 1;
    count = gentity_handles_size;
  }
  else if (coordinates_size == 3) {
    ent_step = 1;
    coord_step = 0;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    ent_step = 0;
    coord_step = 1;
    count = coordinates_size/3;
  }
  else {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }
    
  const double *x, *y, *z;
  x = coordinates;
  if (storage_order == iBase_BLOCKED) {
    y = x + (coord_step ? count : 1);
    z = y + (coord_step ? count : 1);
  } 
  else {
    storage_order = iBase_INTERLEAVED;
    y = x + 1;
    z = x + 2;
    coord_step *= 3;
  }
  
  ALLOC_CHECK_ARRAY( u, count );
  
  RefEntity** ent = (RefEntity**)gentity_handles;
  for (int i = 0; i < count; ++i) {
    RefEdge* edge = dynamic_cast<RefEdge*>(*ent);
    if (!edge) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Expected edge for 1-param method.");
    }
    
    CubitVector xyz( *x, *y, *z );
    (*u)[i] = edge->u_from_position( xyz );
    
    ent += ent_step;
    x += coord_step;
    y += coord_step;
    z += coord_step;
  }
  
  KEEP_ARRAY(u);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrXYZtoUV ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
int  gentity_handles_size,
int  storage_order,
const double *  coordinates,
int  coordinates_size,
double **  uv,
int *  uv_allocated,
int *  uv_size,
int *  err 
)

Return parametric positions at specified spatial position(s) on entity(ies) Return parametric positions at specified spatial position(s) on entity(ies). If either the number of entities or number of spatial coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Given sets of real space coordinates, return the corresponding parametric coordinates on the gentities. Input and output coordinates are interleaved.

Parameters:
gentity_handlesGentities being queried.
xyzInput real space coordinates
uvOutput parametric coordinates

Definition at line 4630 of file iGeom_CGMA.cc.

{
  int count;
  size_t ent_step, coord_step, uv_step;
  if (3*gentity_handles_size == coordinates_size) {
    ent_step = coord_step = 1;
    count = gentity_handles_size;
  }
  else if (coordinates_size == 3) {
    ent_step = 1;
    coord_step = 0;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    ent_step = 0;
    coord_step = 1;
    count = coordinates_size/3;
  }
  else {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }

  ALLOC_CHECK_ARRAY( uv, 2*count );

  double *u, *v;
  const double *x, *y, *z;
  u = *uv;
  x = coordinates;
  if (storage_order == iBase_BLOCKED) {
    v = u + count;
    y = x + (coord_step ? count : 1);
    z = y + (coord_step ? count : 1);
    uv_step = 1;
  } 
  else {
    storage_order = iBase_INTERLEAVED;
    v = u + 1;
    y = x + 1;
    z = x + 2;
    coord_step *= 3;
    uv_step = 2;
  }
  
  RefEntity** ent = (RefEntity**)gentity_handles;
  for (int i = 0; i < count; ++i) {
    RefFace* face = dynamic_cast<RefFace*>(*ent);
    if (!face) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Expected face for UV method.");
    }
    
    CubitVector xyz( *x, *y, *z );
    CubitStatus s = face->u_v_from_position( xyz, *u, *v );
    if (CUBIT_SUCCESS != s)
      RETURN(iBase_FAILURE);
    
    ent += ent_step;
    u += uv_step;
    v += uv_step;
    x += coord_step;
    y += coord_step;
    z += coord_step;
  }
  
  KEEP_ARRAY(uv);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getArrXYZtoUVHint ( iGeom_Instance  instance,
iBase_EntityHandle const *  gentity_handles,
int  gentity_handles_size,
int  storage_order,
const double *  coordinates,
int  coordinates_size,
double **  uv,
int *  uv_allocated,
int *  uv_size,
int *  err 
)

Return parametric positions at specified spatial position(s) on entity(ies), based on parametric position hints Return parametric positions at specified spatial position(s) on entity(ies), based on parametric position hints. If either the number of entities or number of spatial coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Given sets of real space coordinates, return the corresponding parametric coordinates on the gentities. Input and output coordinates are interleaved.

Parameters:
gentity_handlesGentities being queried.
xyzInput real space coordinates
uvOutput parametric coordinates

Definition at line 4826 of file iGeom_CGMA.cc.

{
  int count;
  size_t ent_step, coord_step, uv_step;
  if (3*gentity_handles_size == coordinates_size) {
    ent_step = coord_step = 1;
    count = gentity_handles_size;
  }
  else if (coordinates_size == 3) {
    ent_step = 1;
    coord_step = 0;
    count = gentity_handles_size;
  }
  else if (gentity_handles_size == 1) {
    ent_step = 0;
    coord_step = 1;
    count = coordinates_size/3;
  }
  else {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }
    
  double *u, *v;
  const double *x, *y, *z;
  u = *uv;
  x = coordinates;
  if (storage_order == iBase_BLOCKED) {
    v = u + count;
    y = x + (coord_step ? count : 1);
    z = y + (coord_step ? count : 1);
    uv_step = 1;
  } 
  else {
    storage_order = iBase_INTERLEAVED;
    v = u + 1;
    y = x + 1;
    z = x + 2;
    coord_step *= 3;
    uv_step = 2;
  }
  
  ALLOC_CHECK_ARRAY( uv, 2*count );
  
  RefEntity** ent = (RefEntity**)gentity_handles;
  for (int i = 0; i < count; ++i) {
    RefFace* face = dynamic_cast<RefFace*>(*ent);
    if (!face) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Expected face for UV method.");
    }
    
    CubitVector xyz( *x, *y, *z );
    face->move_to_surface( xyz, u, v );
    
    ent += ent_step;
    u += uv_step;
    v += uv_step;
    x += coord_step;
    y += coord_step;
    z += coord_step;
  }
  
  KEEP_ARRAY(uv);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getBoundBox ( iGeom_Instance  instance,
double *  min_x,
double *  min_y,
double *  min_z,
double *  max_x,
double *  max_y,
double *  max_z,
int *  err 
)

Get the bounding box of the entire model.

Get the bounding box of the entire model

Parameters:
instanceiGeom instance handle
min_xMinimum coordinate of bounding box
min_yMinimum coordinate of bounding box
min_zMinimum coordinate of bounding box
max_xMaximum coordinate of bounding box
max_yMaximum coordinate of bounding box
max_zMaximum coordinate of bounding box
*errPointer to error type returned from function

Definition at line 832 of file iGeom_CGMA.cc.

{
  CubitBox box = GeometryQueryTool::instance()->model_bounding_box();
  *min_x = box.min_x();
  *min_y = box.min_y();
  *min_z = box.min_z();
  *max_x = box.max_x();
  *max_y = box.max_y();
  *max_z = box.max_z();
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getChldn ( iGeom_Instance  instance,
iBase_EntitySetHandle  from_entity_set,
const int  num_hops,
iBase_EntitySetHandle **  entity_set_handles,
int *  entity_set_handles_allocated,
int *  entity_set_handles_size,
int *  err 
)

Get the child sets linked from a specified set.

Recursively gets the children of this gentity_set up to num_hops levels; if num_hops is set to -1 all children are returned

Definition at line 1026 of file iGeom_CGMA.cc.

{
  std::vector<RefGroup*> group_ptrs;
  const RefGroup *this_grp = SET_HANDLE(from_entity_set);
  TM->get_pc_groups(const_cast<RefGroup*>(this_grp), 1, num_hops, group_ptrs);
  ALLOC_CHECK_ARRAY_NOFAIL(entity_set_handles, group_ptrs.size());

  iBase_EntitySetHandle* ent_arr = reinterpret_cast<iBase_EntitySetHandle*>(&group_ptrs[0]);
  std::copy( ent_arr, ent_arr + group_ptrs.size(), *entity_set_handles);
  
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getData ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
iBase_TagHandle  tag_handle,
void **  tag_value_tmp,
int *  tag_value_allocated,
int *  tag_value_size,
int *  err 
)

Get the value of a tag of arbitrary type on an entity.

Allows the user to retrieve an array of tag values associated with a tag handle from an input array of gentity handles

Definition at line 1898 of file iGeom_CGMA.cc.

{
  char **tag_value = reinterpret_cast<char **>(tag_value_tmp);
  RefEntity *tmp_entity = ENTITY_HANDLE(entity_handle);
  iBase_ErrorType retval = TM->getArrData(&tmp_entity, 1, TAG_HANDLE(tag_handle), 
                                          ARRAY_INOUT(tag_value));
  RETURN(retval);
}
ITAPS_API void iGeom_getDblArrData ( iGeom_Instance  instance,
const iBase_EntityHandle entity_handles,
int  entity_handles_size,
iBase_TagHandle  tag_handle,
double **  tag_values,
int *  tag_values_allocated,
int *  tag_values_size,
int *  err 
)

Get tag values of double type for an array of entities.

Get tag values of double type for an array of entities.

Parameters:
instanceiGeom instance handle
entity_handlesEntity array on which tag is being set
entity_handles_sizeNumber of entities in array
tag_handleTag being set on an entity
*tag_valuesPointer to tag data array being returned from function
tag_values_allocatedPointer to allocated size of tag data array
tag_values_sizePointer to occupied size of tag data array
*errPointer to error type returned from function

Definition at line 1753 of file iGeom_CGMA.cc.

{
  int tag_value_allocated_tmp = *tag_value_allocated * sizeof(double);
  int tag_value_size_tmp = *tag_value_size * sizeof(double);
  iGeom_getArrData(instance, entity_handles, 
                   entity_handles_size, tag_handle,
                   reinterpret_cast<void**>(tag_value),
                   &tag_value_allocated_tmp, 
                   &tag_value_size_tmp,
                   err);
  *tag_value_allocated = tag_value_allocated_tmp / sizeof(double);
  *tag_value_size = tag_value_size_tmp / sizeof(double);
}
ITAPS_API void iGeom_getDblData ( iGeom_Instance  instance,
const iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
double *  out_data,
int *  err 
)

Get the value of a tag of double type on an entity.

Get the value of a tag of double type on an entity.

Parameters:
instanceiGeom instance handle
entity_handleEntity on which tag is being set
tag_handleTag being set on an entity
*out_dataPointer to tag value returned from function
*errPointer to error type returned from function

Definition at line 1927 of file iGeom_CGMA.cc.

{
  void *val_ptr = data_out;
  int val_size = sizeof(double);
  iGeom_getArrData(instance, &entity_handle, 1, 
                   tag_handle, &val_ptr, &val_size, &val_size, err);
}
ITAPS_API void iGeom_getDescription ( iGeom_Instance  instance,
char *  descr,
int  descr_len 
)

Get a description of the error returned from the last iGeom call.

Get a description of the error returned from the last iGeom function

Parameters:
instanceiGeom instance handle
descrPointer to a character string to be filled with a description of the error from the last iGeom function
descr_lenLength of the character string pointed to by descr

Definition at line 585 of file iGeom_CGMA.cc.

{
  CGM_iGeom_getLastErrorDesc(description_buffer, description_buffer_length);
}
ITAPS_API void iGeom_getEgCvtrXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  edge_handle,
double  x,
double  y,
double  z,
double *  cvtr_i,
double *  cvtr_j,
double *  cvtr_k,
int *  err 
)

Get the principle curvature vector for an edge at a point.

Get the principle curvature vector for an edge at a point. Magnitude of vector is the curvature, direction is direction of principal curvature.

Parameters:
instanceiGeom instance handle
edge_handleEdge being queried
xPosition being queried
yPosition being queried
zPosition being queried
cvtr_iMaximum curvature vector
cvtr_jMaximum curvature vector
cvtr_kMaximum curvature vector
*errPointer to error type returned from function

Definition at line 2751 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)edge_handle;
  RefEdge* edge = dynamic_cast<RefEdge*>(entity);
  if (!edge)
    RETURN(iBase_INVALID_ENTITY_TYPE);
  
  CubitVector loc(x,y,z), junk, curv;
  CubitStatus status = edge->closest_point( loc, junk, 0, &curv );
  curv.get_xyz( *cvtr_i, *cvtr_j, *cvtr_k );
  RETURN( (status == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getEgEvalXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  edge_handle,
double  x,
double  y,
double  z,
double *  on_x,
double *  on_y,
double *  on_z,
double *  tgnt_i,
double *  tgnt_j,
double *  tgnt_k,
double *  cvtr_i,
double *  cvtr_j,
double *  cvtr_k,
int *  err 
)

Get closest point, tangent, and curvature of edge.

Get closest point, tangent, and curvature of edge.

Parameters:
instanceiGeom instance handle
edge_handleEdge being queried
xPoint at which entity is being queried
yPoint at which entity is being queried
zPoint at which entity is being queried
on_xClosest point at point being queried
on_yClosest point at point being queried
on_zClosest point at point being queried
tgnt_iTangent at point being queried
tgnt_jTangent at point being queried
tgnt_kTangent at point being queried
cvtr_iCurvature at point being queried
cvtr_jCurvature at point being queried
cvtr_kCurvature at point being queried
*errPointer to error type returned from function

Definition at line 2902 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)edge_handle;
  RefEdge* edge = dynamic_cast<RefEdge*>(entity);
  if (!edge)
    RETURN(iBase_INVALID_ENTITY_TYPE);
  
  CubitVector loc(x,y,z), on, tan, curv;
  CubitStatus status = edge->closest_point( loc, on, &tan, &curv );
  on.get_xyz( *on_x, *on_y, *on_z );
  tan.get_xyz( *tan_i, *tan_j, *tan_k );
  curv.get_xyz( *cvtr_i, *cvtr_j, *cvtr_k );
  RETURN( (status == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getEgFcArrSense ( iGeom_Instance  instance,
iBase_EntityHandle const *  edge_handles,
int  edge_handles_size,
iBase_EntityHandle const *  face_handles,
int  face_handles_size,
int **  sense,
int *  sense_allocated,
int *  sense_size,
int *  err 
)

Get the senses of an array of edges with respect to an array of faces.

Get the senses of an array of edges with respect to an array of faces. Sense returned is -1, 0, or 1, representing "reversed", "both", or "forward". "both" sense indicates that edge bounds the face once with each sense.

Parameters:
instanceiGeom instance handle
edge_handlesEdges being queried
edge_handles_sizeSize of edge handles array
face_handlesFaces being queried
face_handles_sizeSize of face handles array
senseSenses of faces with respect to regions
sense_allocatedAllocated size of senses array
sense_sizeOccupied size of senses array
*errPointer to error type returned from function

Definition at line 3821 of file iGeom_CGMA.cc.

{
  size_t faces_step, edges_step;
  int count;
  if (faces_size == edges_size) {
    faces_step = edges_step = 1;
    count = faces_size;
  }
  else if (faces_size == 1) {
    faces_step = 0;
    edges_step = 1;
    count = edges_size;
  }
  else if (edges_size == 1) {
    faces_step = 1;
    edges_step = 0;
    count = faces_size;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes" );
  }
  
  RefEntity** face_iter = (RefEntity**)faces;
  RefEntity** edge_iter = (RefEntity**)edges;
  ALLOC_CHECK_ARRAY( senses, count );
  for (int i = 0; i < count; ++i) {
    RefEdge *edge_ent = dynamic_cast<RefEdge*>(*edge_iter);
    if (NULL == edge_ent) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "1st argument to getGnormalSense must be a face.");
    }
    RefFace *face_ent = dynamic_cast<RefFace*>(*face_iter);
    if (NULL == face_ent) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "2nd argument to getGnormalSense must be a region.");
    }
    (*senses)[i] = iGeom_get_nonmanifold_sense( edge_ent, face_ent, err );
    if (iBase_SUCCESS != *err)
      return;

    face_iter += faces_step;
    edge_iter += edges_step;
  }
  
  KEEP_ARRAY(senses);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEgFcSense ( iGeom_Instance  instance,
iBase_EntityHandle  gedge,
iBase_EntityHandle  gface,
int *  rel_sense,
int *  err 
)

Get the sense of an edge with respect to a face.

Return the sense of a gedge with respect to a gface. Sense is either forward (=1), reverse (=-1), both (=0), or unknown (=2). Error is returned if first entity is not a gedge or second entity is not a gface.

Parameters:
gedgeGedge whose sense is being queried.
gfaceGface gedge is being queried with respect to

Definition at line 3802 of file iGeom_CGMA.cc.

{
  const RefEdge *edge_ent = dynamic_cast<const RefEdge*>(ENTITY_HANDLE(gedge));
  if (NULL == edge_ent) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "1st argument to getGtangentSense must be an edge.");
  }
  const RefFace *face_ent = dynamic_cast<const RefFace*>(ENTITY_HANDLE(gface));
  if (NULL == face_ent) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "2nd argument to getGtangentSense must be a face.");
  }
  *rel_sense = iGeom_get_nonmanifold_sense( edge_ent, face_ent, err );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEgVtxArrSense ( iGeom_Instance  instance,
iBase_EntityHandle const *  edge_handles,
int  edge_handles_size,
iBase_EntityHandle const *  vertex_handles_1,
int  veretx_handles_1_size,
iBase_EntityHandle const *  vertex_handles_2,
int  vertex_handles_2_size,
int **  sense,
int *  sense_allocated,
int *  sense_size,
int *  err 
)

Get the senses of vertex pair with respect to a edges.

Get the senses of vertex pairs with respect to edges. Sense returned is -1, 0, or 1, representing "reversed", "both", or "forward". "both" sense indicates that both vertices in pair are identical and that vertex bounds both sides of the edge.

Parameters:
instanceiGeom instance handle
edge_handlesEdges being queried
edge_handles_sizeNumber of edges being queried
vertex_handles_1First vertex being queried
vertex_handles_1_sizeNumber of vertices in vertices array
vertex_handles_2Second vertex being queried
vertex_handles_2_sizeNumber of vertices in vertices array
senseSense of vertex pair with respect to edge
sense_allocatedAllocated size of sense array
sense_sizeOccupied size of sense array
*errPointer to error type returned from function

Definition at line 3904 of file iGeom_CGMA.cc.

{
  int count;
  size_t edge_step, start_step, end_step;
  edge_step = edges_size > 1;
  start_step = start_vertices_size > 1;
  end_step = end_vertices_size > 1;
  count = edges_size;
  if (count != 1) {
    if (start_vertices_size != 1 && start_vertices_size != count) {
      ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes" );
    }
  }
  else
    count = start_vertices_size;
  if (count != 1) {
    if (end_vertices_size != 1 && end_vertices_size != count) {
      ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes" );
    }
  }
  else
    count = end_vertices_size;
    
  ALLOC_CHECK_ARRAY( senses, count );
  
  RefEntity** edge_iter = (RefEntity**)edges;
  RefEntity** start_iter = (RefEntity**)start_vertices;
  RefEntity** end_iter = (RefEntity**)end_vertices;
  for (int i = 0; i < count; ++i) {
    RefEdge* edge = dynamic_cast<RefEdge*>(*edge_iter);
    RefVertex* vtx1 = dynamic_cast<RefVertex*>(*start_iter);
    RefVertex* vtx2 = dynamic_cast<RefVertex*>(*end_iter);
    if (!edge || !vtx1 || !vtx2) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Bad entity argument to getGvertexTangentSense.");
    }
    
    (*senses)[i] = iGeom_edge_vertex_sense( edge, vtx1, vtx2, err );
    if (iBase_SUCCESS != *err)
      return;
    edge_iter += edge_step;
    start_iter += start_step;
    end_iter += end_step;
  }
  
  KEEP_ARRAY(senses);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEgVtxSense ( iGeom_Instance  instance,
iBase_EntityHandle  gedge,
iBase_EntityHandle  gvertex1,
iBase_EntityHandle  gvertex2,
int *  rel_sense,
int *  err 
)

Get the sense of a vertex pair with respect to an edge.

Return the sense of a gedge with respect to a specified order of vertices bounding the gedge. Sense is either forward (=1), reverse (=-1), or closed (=0). Error is returned if any gentities are not the expected type or if the gedge is bounded by only one gvertex (in this case, use getGtangentSense).

Parameters:
gedgeGedge whose sense is being queried.
gvertex1First gvertex
gvertex2Second gvertex

Definition at line 3886 of file iGeom_CGMA.cc.

{
  const RefEdge *this_edge = dynamic_cast<const RefEdge*>(ENTITY_HANDLE(gedge));
  const RefVertex *vertex1 = dynamic_cast<const RefVertex*>(ENTITY_HANDLE(gvertex1));
  const RefVertex *vertex2 = dynamic_cast<const RefVertex*>(ENTITY_HANDLE(gvertex2));
  if (NULL == this_edge || NULL == vertex1 || NULL == vertex2) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Bad entity argument to getGvertexTangentSense.");
  }
  *rel_sense = iGeom_edge_vertex_sense( this_edge, vertex1, vertex2, err );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEHArrData ( iGeom_Instance  instance,
const iBase_EntityHandle entity_handles,
int  entity_handles_size,
iBase_TagHandle  tag_handle,
iBase_EntityHandle **  tag_value,
int *  tag_value_allocated,
int *  tag_value_size,
int *  err 
)

Get tag values of entity handle type for an array of entities.

Get tag values of entity handle type for an array of entities.

Parameters:
instanceiGeom instance handle
entity_handlesEntity array on which tag is being set
entity_handles_sizeNumber of entities in array
tag_handleTag being set on an entity
*tag_valuePointer to tag data array being returned from function
tag_value_allocatedPointer to allocated size of tag data array
tag_value_sizePointer to occupied size of tag data array
*errPointer to error type returned from function

Definition at line 1775 of file iGeom_CGMA.cc.

{
  int tag_value_allocated_tmp = *tag_value_allocated * sizeof(iBase_EntityHandle);
  int tag_value_size_tmp = *tag_value_size * sizeof(iBase_EntityHandle);
  iGeom_getArrData(instance, entity_handles, 
                   entity_handles_size, tag_handle,
                   reinterpret_cast<void**>(tag_value),
                   &tag_value_allocated_tmp, 
                   &tag_value_size_tmp,
                   err);
  *tag_value_allocated = tag_value_allocated_tmp / sizeof(iBase_EntityHandle);
  *tag_value_size = tag_value_size_tmp / sizeof(iBase_EntityHandle);
}
ITAPS_API void iGeom_getEHData ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
iBase_TagHandle  tag_handle,
iBase_EntityHandle out_data,
int *  err 
)

Get the value of a tag of entity handle type on an entity.

Get the value of a tag of entity handle type on an entity.

Parameters:
instanceiGeom instance handle
entity_handleEntity on which tag is being set
tag_handleTag being set on an entity
*out_dataPointer to tag value returned from function
*errPointer to error type returned from function

Definition at line 1940 of file iGeom_CGMA.cc.

{
  void *val_ptr = data_out;
  int val_size = sizeof(iBase_EntityHandle);
  iGeom_getArrData(instance, &entity_handle, 1, 
                   tag_handle, &val_ptr, &val_size, &val_size, err);
}
ITAPS_API void iGeom_getEnt1stDrvt ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  u,
double  v,
double **  drvt_u,
int *  drvt_u_allocated,
int *  drvt_u_size,
double **  drvt_v,
int *  dvrt_v_allocated,
int *  dvrt_v_size,
int *  err 
)

Get the first derivative of a face at specified parametric position.

Get the first derivative of a face at specified parametric position.

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
uParametric position being queried
vParametric position being queried
dvrt_uPointer to coordinates of derivative with respect to u at specified position returned from function
dvrt_u_allocatedAllocated size of dvrt_u array
dvrt_u_sizeOccupied size of dvrt_u array
dvrt_vPointer to coordinates of derivative with respect to v at specified position returned from function
dvrt_v_allocatedAllocated size of dvrt_v array
dvrt_v_sizeOccupied size of dvrt_v array
*errPointer to error type returned from function

Definition at line 5446 of file iGeom_CGMA.cc.

{
  RefFace* face = dynamic_cast<RefFace*>((RefEntity*)entity_handle);
  if (!face) { 
    ERROR( iBase_INVALID_ENTITY_TYPE, "Derivatives only for faces." );
  }
  
  CubitVector du, dv;
  CubitStatus s = face->get_surface_ptr()->uv_derivitives( u, v, du, dv );
  if (CUBIT_SUCCESS != s) {
    RETURN(iBase_FAILURE);
  }
  
  ALLOC_CHECK_ARRAY_NOFAIL( dvrt_u, 3 );
  ALLOC_CHECK_ARRAY_NOFAIL( dvrt_v, 3 );
  du.get_xyz( *dvrt_u );
  dv.get_xyz( *dvrt_v );
  RETURN (iBase_SUCCESS);
}
ITAPS_API void iGeom_getEnt2ndAdj ( iGeom_Instance  instance,
iBase_EntityHandle  gentity_handle,
int  bridge_dimension,
int  to_dimension,
iBase_EntityHandle **  adjacent_gentities,
int *  adjacent_gentities_allocated,
int *  adjacent_gentities_size,
int *  err 
)

Get "2nd order" adjacencies to an entity.

Get the "2nd order" adjacent entities, through a specified "bridge" dimension, of a target dimension. For example, given a region, return the regions (to_dimension=3) sharing an edge (bridge_dimension=1) with that region. bridge_dimension must be less than dimension of gentity_handle, and to_dimension must be greater than bridge dimension.

Parameters:
gentity_handleEntity for which 2nd order adjacencies are requested
to_dimensionTarget dimension of 2nd order adjacent entities
bridge_dimensionDimension of "bridge" entities
adj_gentitiesList returned with 2nd order adjacent entities

Definition at line 1354 of file iGeom_CGMA.cc.

{
    // for better or worse, go to cgm as quickly as possible, to avoid working with
    // sidl arrays
  const RefEntity *gentity = ENTITY_HANDLE(gentity_handle);
  DLIList<RefEntity*> to_ents, bridge_ents, tmp_ents;

  iGeom_get_adjacent_entities(gentity, bridge_dimension, bridge_ents, err);
  if (iBase_SUCCESS != *err) return;
  
  for (int i = bridge_ents.size(); i > 0; i--) {
    iGeom_get_adjacent_entities(bridge_ents.get_and_step(), to_dimension, tmp_ents, err);
    if (iBase_SUCCESS != *err) return;

    to_ents += tmp_ents;
    tmp_ents.clean_out();
  }

  to_ents.uniquify_unordered();

  ALLOC_CHECK_ARRAY_NOFAIL(adjacent_gentities, to_ents.size());
  to_ents.copy_to((RefEntity**)*adjacent_gentities);

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEnt2ndDrvt ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  u,
double  v,
double **  drvt_uu,
int *  drvt_uu_allocated,
int *  drvt_uu_size,
double **  drvt_vv,
int *  dvrt_vv_allocated,
int *  dvrt_vv_size,
double **  drvt_uv,
int *  dvrt_uv_allocated,
int *  dvrt_uv_size,
int *  err 
)

Get the second derivative of a face at specified parametric position.

Get the second derivative of a face at specified parametric position.

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
uParametric position being queried
vParametric position being queried
dvrt_uuPointer to coordinates of derivative with respect to u at specified position returned from function
dvrt_uu_allocatedAllocated size of dvrt_uu array
dvrt_uu_sizeOccupied size of dvrt_uu array
dvrt_vvPointer to coordinates of derivative with respect to v at specified position returned from function
dvrt_vv_allocatedAllocated size of dvrt_vv array
dvrt_vv_sizeOccupied size of dvrt_vv array
dvrt_uvPointer to coordinates of derivative with respect to u and v at specified position returned from function
dvrt_uv_allocatedAllocated size of dvrt_uv array
dvrt_uv_sizeOccupied size of dvrt_uv array
*errPointer to error type returned from function

Definition at line 5566 of file iGeom_CGMA.cc.

ITAPS_API void iGeom_getEntAdj ( iGeom_Instance  instance,
iBase_EntityHandle  gentity_handle,
int  to_dimension,
iBase_EntityHandle **  adj_gentities,
int *  adj_gentities_allocated,
int *  adj_gentities_size,
int *  err 
)

Get entities of specified type adjacent to an entity.

Get the adjacent entities of a given dimension.

Parameters:
gentity_handleEntity for which adjacencies are requested
to_dimensionTarget dimension of adjacent entities
adj_gentitiesList returned with adjacent entities

Definition at line 1288 of file iGeom_CGMA.cc.

{
  const RefEntity *tmp_hndl = ENTITY_HANDLE(gentity_handle);

  if (tmp_hndl->dimension() == to_dimension) {
    ERROR(iBase_INVALID_ARGUMENT, "Can't get adjacencies to entities of same dimension.");
  }

  static DLIList<RefEntity*> tmp_ents;
  iGeom_get_adjacent_entities(tmp_hndl, to_dimension, tmp_ents, err);
  if (iBase_SUCCESS != *err) return;

  ALLOC_CHECK_ARRAY_NOFAIL(adj_gentities, tmp_ents.size());
  tmp_ents.copy_to((RefEntity**)*adj_gentities);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntArrCvtrXYZ ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int  storage_order,
double const *  coords,
int  coords_size,
double **  cvtr_1,
int *  cvtr_1_allocated,
int *  cvtr_1_size,
double **  cvtr_2,
int *  cvtr_2_allocated,
int *  cvtr_2_size,
int *  err 
)

Get the curvature(s) on an entity(ies) at given position(s)

Get the curvature(s) on an entity(ies) at given position(s). If either the number of entities or number of coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
entity_handlesEntity(ies) being queried
entity_handles_sizeNumber of entities being queried
storage_orderStorage order of coordinates
coordsStarting coordinates
coords_sizeNumber of values in coordinates array
cvtr_1First principal curvatures
cvtr_1_allocatedAllocated size of first curvature array
cvtr_1_sizeOccupied size of first curvature array
cvtr_2Second principal curvatures
cvtr_2_allocatedAllocated size of second curvature array
cvtr_2_sizeOccupied size of second curvature array
*errPointer to error type returned from function

Definition at line 2773 of file iGeom_CGMA.cc.

{
  RefEntity** entities = (RefEntity**)(entity_handles);
  
    /* set up iteration according to storage order.
       allow either gentity_handles or near_coordinates to contain
       only one value, where that single value is applied for every
       entry in the other list.
    */
  size_t coord_step, cvtr_step = 1, ent_step;
  int count;
  if (3*entity_handles_size == coordinates_size) {
    coord_step = ent_step = 1;
    count = entity_handles_size;
  }
  else if (coordinates_size == 3) {
    coord_step = 0;
    ent_step = 1;
    count = entity_handles_size;
  }
  else if (entity_handles_size == 1) {
    coord_step = 1;
    ent_step = 0;
    count = coordinates_size / 3;
  }
  else {
    ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched array sizes" );
  }
  
    /* check if input list contains any surfaces. */
  bool have_surfs = false;
  for (int s = 0; s < entity_handles_size; ++s)
    if (dynamic_cast<RefFace*>(entities[s])) {
      have_surfs = true;
      break;
    }

    // check or pre-allocate the coordinate arrays
  ALLOC_CHECK_ARRAY( cvtr_1, 3*count );
  ALLOC_CHECK_ARRAY( cvtr_2, have_surfs ? 3*count : 0 );
  
  const double *coord_x, *coord_y, *coord_z;
  double *c1x, *c1y, *c1z, *c2x, *c2y, *c2z;
  if (storage_order == iBase_BLOCKED) {
    coord_x = coordinates;
    coord_y = coord_x + coordinates_size/3;
    coord_z = coord_y + coordinates_size/3;
    c1x = *cvtr_1;
    c1y = c1x + count;
    c1z = c1y + count;
    c2x = *cvtr_2;
    c2y = c2x + count;
    c2z = c2y + count;
    cvtr_step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED; /* set if unspecified */
    coord_x = coordinates;
    coord_y = coord_x+1;
    coord_z = coord_x+2;
    c1x = *cvtr_1;
    c1y = c1x+1;
    c1z = c1x+2;
    c2x = *cvtr_2;
    c2y = c2x+1;
    c2z = c2x+2;
    coord_step *= 3;
    cvtr_step = 3;
  }
  
  RefFace *face;
  RefEdge *edge;
  CubitStatus result = CUBIT_SUCCESS;
  for (int i = 0; i < count; ++i) {
    CubitStatus status;
    const CubitVector coords( *coord_x, *coord_y, *coord_z );
    if ((face = dynamic_cast<RefFace*>(*entities))) {
      Surface* surf = face->get_surface_ptr();
      CubitVector curv1, curv2;
      status = surf->closest_point( coords, 0, 0, &curv1, &curv2 );
      curv1.get_xyz( *c1x, *c1y, *c1z );
      curv2.get_xyz( *c2x, *c2y, *c2z );
    }
    else if ((edge = dynamic_cast<RefEdge*>(*entities))) {
      CubitVector junk, curv;
      status = edge->closest_point( coords, junk, 0, &curv );
      curv.get_xyz( *c1x, *c1y, *c1z );
    }
    else {
      status = CUBIT_FAILURE;
    }

    if (CUBIT_SUCCESS != status)
      result = status;
    
    entities += ent_step;
    coord_x += coord_step;
    coord_y += coord_step;
    coord_z += coord_step;
    c1x += cvtr_step;
    c1y += cvtr_step;
    c1z += cvtr_step;
    c2x += cvtr_step;
    c2y += cvtr_step;
    c2z += cvtr_step;
  }
  
  if (result == CUBIT_FAILURE)
    RETURN(iBase_FAILURE);
  
  KEEP_ARRAY( cvtr_1 );
  KEEP_ARRAY( cvtr_2 );
  RETURN( iBase_SUCCESS );
}
ITAPS_API void iGeom_getEntBoundBox ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double *  min_x,
double *  min_y,
double *  min_z,
double *  max_x,
double *  max_y,
double *  max_z,
int *  err 
)

Get the bounding box of the specified entity.

Get the bounding box of the specified entity

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
min_xMinimum coordinate of bounding box
min_yMinimum coordinate of bounding box
min_zMinimum coordinate of bounding box
max_xMaximum coordinate of bounding box
max_yMaximum coordinate of bounding box
max_zMaximum coordinate of bounding box
*errPointer to error type returned from function

Definition at line 3273 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  CubitVector minc, maxc;
  CubitStatus status = iGeom_bounding_box( entity, minc, maxc );
  minc.get_xyz( *min_x, *min_y, *min_z );
  maxc.get_xyz( *max_x, *max_y, *max_z );
  RETURN( (status == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getEntClosestPt ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  near_x,
double  near_y,
double  near_z,
double *  on_x,
double *  on_y,
double *  on_z,
int *  err 
)

Get closest point to an entity.

Get closest point to a specified position on an entity

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
near_xCoordinates of starting point
near_yCoordinates of starting point
near_zCoordinates of starting point
on_xClosest point on entity
on_yClosest point on entity
on_zClosest point on entity
*errPointer to error type returned from function

Definition at line 2204 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  CubitVector on, near(near_x, near_y, near_z);
  CubitStatus status = iGeom_closest_point( entity, near, on );
  if (status == CUBIT_FAILURE) {
    ERROR(iBase_FAILURE, "Problems getting closest point for some entity.");
  }
  on.get_xyz( *on_x, *on_y, *on_z );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntClosestPtTrimmed ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  near_x,
double  near_y,
double  near_z,
double *  on_x,
double *  on_y,
double *  on_z,
int *  err 
)

Get closest point for an array of entities and points For surfaces, closest point could be on the void space inside it. Get closest point for an array of entities and points. If either the number of entities or number of coordinate triples is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
entity_handlesEntity(ies) being queried
entity_handles_sizeNumber of entities being queried
storage_orderStorage order of input points
near_coordinatesCoordinates of starting point(s)
near_coordinates_sizeNumber of values in near_coordinates array
on_coordinatesCoordinates of closest points
on_coordinates_allocatedAllocated size of closest point array
on_coordinates_sizeOccupied size of closest point array
*errPointer to error type returned from function

Definition at line 2225 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  CubitVector on, near(near_x, near_y, near_z);
  CubitStatus status = iGeom_closest_point_trimmed( entity, near, on );
  if (status == CUBIT_FAILURE) {
    ERROR(iBase_FAILURE, "Problems getting closest point for some entity.");
  }
  on.get_xyz( *on_x, *on_y, *on_z );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntities ( iGeom_Instance  instance,
iBase_EntitySetHandle  set_handle,
int  gentity_type,
iBase_EntityHandle **  gentity_handles,
int *  gentity_handles_allocated,
int *  gentity_handles_size,
int *  err 
)

Get entities of specific type in set or instance.

Return gentities of specified dimension in this set, or in whole model.

Parameters:
set_handleEntity set being queried (if 0, whole model)
gentity_dimensionDimension of entities being queried
gentity_handlesEntity handles

Definition at line 1159 of file iGeom_CGMA.cc.

{
  if (RefGroup *this_set = SET_HANDLE(set_handle)) {
    static DLIList<CubitEntity*> centities;
    centities.clean_out();
    this_set->get_child_entities(centities);
    copy_ibase_type( gentity_type, centities, 
                     gentity_handles,
                     gentity_handles_allocated,
                     gentity_handles_size,
                     err );
  }
  else {
    static DLIList<RefEntity*> dim_entities;
    dim_entities.clean_out();
    append_all_ibase_type( gentity_type, dim_entities, err );
    if (iBase_SUCCESS != *err)
      return;
    
    ALLOC_CHECK_ARRAY_NOFAIL(gentity_handles, dim_entities.size());
    dim_entities.copy_to((RefEntity**)*gentity_handles);
    RETURN(iBase_SUCCESS);
  }  
}
ITAPS_API void iGeom_getEntNrmlPlXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  x,
double  y,
double  z,
double *  pt_x,
double *  pt_y,
double *  pt_z,
double *  nrml_i,
double *  nrml_j,
double *  nrml_k,
int *  err 
)

Get the normal vector AND closest point on an entity at given position.

Get the normal vector AND closest point on an entity at a given position.

Parameters:
entity_handleEntity being queried
instanceiGeom instance handle
xStarting coordinates
yStarting coordinates
zStarting coordinates
pt_xClosest point
pt_yClosest point
pt_zClosest point
nrml_iNormal at closest point
nrml_jNormal at closest point
nrml_kNormal at closest point
*errPointer to error type returned from function

Definition at line 2342 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  CubitVector pt, nmrl, near(x, y, z);
  CubitStatus status = iGeom_closest_point_and_normal( entity, near, pt, nmrl );
  if (status == CUBIT_FAILURE) {
    ERROR(iBase_FAILURE, "Problems getting closest point for some entity.");
  }
  pt.get_xyz( *pt_x, *pt_y, *pt_z );
  nmrl.get_xyz( *nmrl_i, *nmrl_j, *nmrl_k );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntNrmlSense ( iGeom_Instance  instance,
iBase_EntityHandle  gface,
iBase_EntityHandle  gregion,
int *  rel_sense,
int *  err 
)

Get the sense of a face with respect to a region.

Return the sense of a face with respect to a region. Sense is either forward (=1), reverse (=-1), both (=0). Error is returned if first entity is not a gface or second entity is not a gregion.

Parameters:
gfaceface whose sense is being queried.
gregionregion gface is being queried with respect to

Definition at line 3687 of file iGeom_CGMA.cc.

{
  const RefFace *face_ent = dynamic_cast<const RefFace*>(ENTITY_HANDLE(gface));
  if (NULL == face_ent) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "1st argument to getEntNrmlSense must be a face.");
  }

  // XXX: workaround; remove this when we switch iBase_REGIONs to RefVolume
  const RefVolume *volume_ent;
  Body *body_ent = dynamic_cast<Body*>(ENTITY_HANDLE(gregion));
  if (NULL != body_ent) {
    DLIList<RefEntity*> children;
    body_ent->get_child_ref_entities(children);
    if (children.size() != 1) {
      ERROR(iBase_FAILURE, "Can only support bodies with one volume");
    }
    volume_ent = dynamic_cast<const RefVolume*>(children[0]);
  }
  else {
    volume_ent = dynamic_cast<const RefVolume*>(ENTITY_HANDLE(gregion));
  }

  if (NULL == volume_ent) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "2nd argument to getEntNrmlSense must be a region.");
  }

  *rel_sense = iGeom_get_nonmanifold_sense( face_ent, volume_ent, err );
}
ITAPS_API void iGeom_getEntNrmlUV ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  u,
double  v,
double *  nrml_i,
double *  nrml_j,
double *  nrml_k,
int *  err 
)

Return the normal at a specified parametric position.

Return the normal at a specified parametric position

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
uParametric position being queried
vParametric position being queried
nrml_iNormal at specified position
nrml_jNormal at specified position
nrml_kNormal at specified position
*errPointer to error type returned from functino

Definition at line 5295 of file iGeom_CGMA.cc.

{
  RefFace* face = dynamic_cast<RefFace*>((RefEntity*)entity_handle);
  if (!face) {
    RETURN (iBase_INVALID_ENTITY_TYPE);
  }
  
  CubitVector normal;
  CubitStatus s = iGeom_normal_from_uv( face, u, v, normal );
  normal.get_xyz( *nrml_i, *nrml_j, *nrml_k );
  RETURN ((s == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE));
}
ITAPS_API void iGeom_getEntNrmlXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  x,
double  y,
double  z,
double *  nrml_i,
double *  nrml_j,
double *  nrml_k,
int *  err 
)

Get the normal vector on an entity at the given position Get the normal vector on an entity at the given position.

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
xCoordinates of starting point
yCoordinates of starting point
zCoordinates of starting point
nrml_iNormal vector at starting point
nrml_jNormal vector at starting point
nrml_kNormal vector at starting point
*errPointer to error type returned from function

Definition at line 2479 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefFace* face = dynamic_cast<RefFace*>(entity);
  if (NULL == face) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Entities passed into gentityNormal must be faces.");
  }
  
  CubitVector normal, near( near_x, near_y, near_z );
  normal = face->normal_at( near );
  normal.get_xyz( *nmrl_i, *nmrl_j, *nmrl_k );
  RETURN(iBase_SUCCESS);
} 
ITAPS_API void iGeom_getEntSetData ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
iBase_TagHandle  tag_handle,
void **  tag_value_tmp,
int *  tag_value_allocated,
int *  tag_value_size,
int *  err 
)

Get the value of a tag of arbitrary type on an entity set.

Get the tag data associated with a tag handle from the mesh or gentity_set. It is assumed that the tag_value argument is allocated by the application before being passed into the getTag function.

Definition at line 2070 of file iGeom_CGMA.cc.

{
  char **tag_value = reinterpret_cast<char **>(tag_value_tmp);
    // have to go through RefEntity* so that RefEntity** gets set right
  RefEntity *tmp_entity = SET_HANDLE(entity_set);
  iBase_ErrorType retval = TM->getArrData(&tmp_entity, 1, TAG_HANDLE(tag_handle), 
                                          ARRAY_INOUT(tag_value));
  RETURN(retval);
}
ITAPS_API void iGeom_getEntSetDblData ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
iBase_TagHandle  tag_handle,
double *  out_data,
int *  err 
)

Get the value of a tag of double type on an entity set.

Get the value of a tag of double type on an entity set.

Parameters:
instanceiGeom instance handle
entity_setEntity set on which tag is being set
tag_handleTag being set on an entity set
*out_dataPointer to tag value returned from function
*errPointer to error type returned from function

Definition at line 2100 of file iGeom_CGMA.cc.

{
  int tag_size = sizeof(double);
  void* data_ptr = tag_ptr;
  iGeom_getEntSetData(instance, entity_set, tag_handle, &data_ptr, 
                      &tag_size, &tag_size, err);
}
ITAPS_API void iGeom_getEntSetEHData ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
iBase_TagHandle  tag_handle,
iBase_EntityHandle out_data,
int *  err 
)

Get the value of a tag of entity handle type on an entity set.

Get the value of a tag of entity handle type on an entity set.

Parameters:
instanceiGeom instance handle
entity_setEntity set on which tag is being set
tag_handleTag being set on an entity set
*out_dataPointer to tag value returned from function
*errPointer to error type returned from function

Definition at line 2113 of file iGeom_CGMA.cc.

{
  int tag_size = sizeof(iBase_EntityHandle);
  void* data_ptr = tag_ptr;
  iGeom_getEntSetData(instance, entity_set, tag_handle, &data_ptr, 
                      &tag_size, &tag_size, err);
}
ITAPS_API void iGeom_getEntSetESHData ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
iBase_TagHandle  tag_handle,
iBase_EntitySetHandle out_data,
int *  err 
)

Get the value of a tag of entity set handle type on an entity set.

Get the value of a tag of entity set handle type on an entity set.

Parameters:
instanceiGeom instance handle
entity_setEntity set on which tag is being set
tag_handleTag being set on an entity set
*out_dataPointer to tag value returned from function
*errPointer to error type returned from function

Definition at line 2126 of file iGeom_CGMA.cc.

{
  int tag_size = sizeof(iBase_EntitySetHandle);
  void* data_ptr = tag_ptr;
  iGeom_getEntSetData(instance, entity_set, tag_handle, &data_ptr,
                      &tag_size, &tag_size, err);
}
ITAPS_API void iGeom_getEntSetIntData ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
iBase_TagHandle  tag_handle,
int *  out_data,
int *  err 
)

Get the value of a tag of integer type on an entity set.

Get the value of a tag of integer type on an entity set.

Parameters:
instanceiGeom instance handle
entity_setEntity set on which tag is being set
tag_handleTag being set on an entity set
*out_dataPointer to tag value returned from function
*errPointer to error type returned from function

Definition at line 2087 of file iGeom_CGMA.cc.

{
  int tag_size = sizeof(int);
  void* data_ptr = tag_ptr;
  iGeom_getEntSetData(instance, entity_set, tag_handle, &data_ptr, 
                      &tag_size, &tag_size, err);
}
ITAPS_API void iGeom_getEntSets ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
int  num_hops,
iBase_EntitySetHandle **  contained_entity_set_handles,
int *  contained_entity_set_handles_allocated,
int *  contained_entity_set_handles_size,
int *  err 
)

Get the entity sets contained in a set or interface.

Returns the gentity_set handles contained in a given model or gentity_set one level deep

Parameters:
gentity_set_handleEntity set being queried
contained_gentity_set_handlesNumber of entity sets in gentity_set_handle

Definition at line 4006 of file iGeom_CGMA.cc.

{
  if (0 < num_hops) {
    ERROR(iBase_NOT_SUPPORTED, "Num_hops argument not yet supported.");
  }

  const RefGroup *this_set = SET_HANDLE(entity_set);
  DLIList<RefEntity*> tmp_ents;
  DLIList<RefGroup*> groups;
  if (NULL == this_set)
    RefEntityFactory::instance()->ref_groups(groups);
  else {
    const_cast<RefGroup*>(this_set)->get_child_ref_entities(tmp_ents);
    CAST_LIST(tmp_ents, groups, RefGroup);
  }
  
  ALLOC_CHECK_ARRAY_NOFAIL(contained_entity_set_handles, groups.size());

  groups.copy_to(*SET_HANDLE_ARRAY_PTR(contained_entity_set_handles));
  
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntTgntU ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  u,
double *  tgnt_i,
double *  tgnt_j,
double *  tgnt_k,
int *  err 
)

Return the tangent at a specified parametric position.

Return the tangent at a specified parametric position

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
uParametric position being queried
tgnt_iTangent at specified position
tgnt_jTangent at specified position
tgnt_kTangent at specified position
*errPointer to error type returned from function

Definition at line 5403 of file iGeom_CGMA.cc.

{
  double x, y, z;
  iGeom_getEntUtoXYZ( instance, entity_handle, param_coord, &x, &y, &z, err );
  if (iBase_SUCCESS == *err)
    iGeom_getEntTgntXYZ( instance, entity_handle, x, y, z, tngt_i, tngt_j, tngt_k, err );
}
ITAPS_API void iGeom_getEntTgntXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  x,
double  y,
double  z,
double *  tgnt_i,
double *  tgnt_j,
double *  tgnt_k,
int *  err 
)

Get the tangent vector on an entity at given position.

Get the tangent vector on an entity at a given position.

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
xStarting coordinates
yStarting coordinates
zStarting coordinates
tgnt_iTangent at closest point
tgnt_jTangent at closest point
tgnt_kTangent at closest point
*errPointer to error type returned from function

Definition at line 2599 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefEdge* edge = dynamic_cast<RefEdge*>(entity);
  if (NULL == edge) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Entities passed into gentityTangent must be edges.");
  }
  
  CubitVector tangent, near( x, y, x );
  edge->tangent( near, tangent );
  tangent.get_xyz( *tgnt_i, *tgnt_j, *tgnt_k );
  RETURN(iBase_SUCCESS);
} 
ITAPS_API void iGeom_getEntTolerance ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double *  tolerance,
int *  err 
)

Get the tolerance of the specified entity.

Get the tolerance of the specified entity.

Parameters:
instanceiGeom instance handle
entity_handleEntity handle being queried
tolerancePointer to tolerance returned from function
*errPointer to error type returned from function

Definition at line 4325 of file iGeom_CGMA.cc.

{
  *tolerance = gqt->get_sme_resabs_tolerance();
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntType ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
int *  type,
int *  err 
)

Get the entity type for the specified entity.

Get the entity type for the specified entity. Type returned is a value in the iBase_EntityType enumeration.

Parameters:
instanceiGeom instance handle
entity_handleentity handle being queried
*typePointer to location at which to store the returned type
*errPointer to error type returned from function

Definition at line 1240 of file iGeom_CGMA.cc.

{
  RefEntity* entity = reinterpret_cast<RefEntity*>(handle);
  if (dynamic_cast<Body*>(entity))
    *gtype = iBase_REGION;
  else
    *gtype = static_cast<int>(entity->dimension());
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntURange ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double *  u_min,
double *  u_max,
int *  err 
)

Get parametric range of entity.

Get parametric range of entity

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
u_minMinimum parametric coordinate for entity
u_maxMaximum parametric coordinate for entity
*errPointer to error type returned from function

Definition at line 4921 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefEdge* edge = dynamic_cast<RefEdge*>(entity);
  if (!edge) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Expected edge for 1-param method.");
  }
  
  CubitBoolean r1 = edge->get_param_range(*u_min, *u_max);
  RETURN( (r1 ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getEntUtoUV ( iGeom_Instance  instance,
iBase_EntityHandle  edge_handle,
iBase_EntityHandle  face_handle,
double  in_u,
double *  u,
double *  v,
int *  err 
)

Return the face parametric coordinates for a parametric position on a bounding edge.

Return the face parametric coordinates for a parametric position on a bounding edge

Parameters:
instanceiGeom instance handle
edge_handleEdge being queried
face_handleFace being queried
in_uParametric position on edge
uCorresponding parametric position on face
vCorresponding parametric position on face
*errPointer to error type returned from function

Definition at line 5033 of file iGeom_CGMA.cc.

{
  RefEdge* edge = dynamic_cast<RefEdge*>((RefEntity*)edge_handle);
  RefFace* face = dynamic_cast<RefFace*>((RefEntity*)face_handle);
  if (!edge || !face) {
    RETURN(iBase_INVALID_ENTITY_TYPE);
  }
  
  CubitVector xyz;
  CubitStatus s;
  s = edge->position_from_u( in_u, xyz );
  if (s != CUBIT_SUCCESS)
    RETURN(iBase_FAILURE);

  s = face->u_v_from_position( xyz, *u, *v );
  RETURN( (s == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getEntUtoXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  u,
double *  x,
double *  y,
double *  z,
int *  err 
)

Return coordinate position at specified parametric position on entity.

Return coordinate position at specified parametric position on entity.

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
uParametric coordinate being queried
xSpatial coordinate at parametric position being queried
ySpatial coordinate at parametric position being queried
zSpatial coordinate at parametric position being queried
*errPointer to error type returned from function

Definition at line 4505 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefEdge* edge = dynamic_cast<RefEdge*>(entity);
  if (!edge) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Expected edge for 1-param method.");
  }
  
  CubitVector xyz;
  CubitStatus s = edge->position_from_u( u, xyz );
  xyz.get_xyz( *x, *y, *z );
  RETURN( (s == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getEntUVRange ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double *  u_min,
double *  v_min,
double *  u_max,
double *  v_max,
int *  err 
)

Get parametric range of entity.

Get parametric range of entity

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
u_minMinimum parametric coordinate for entity
v_minMinimum parametric coordinate for entity
u_maxMaximum parametric coordinate for entity
v_maxMaximum parametric coordinate for entity
*errPointer to error type returned from function

Definition at line 4901 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefFace* face = dynamic_cast<RefFace*>(entity);
  if (!face) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Expected face for UV method.");
  }
  
  CubitBoolean r1 = face->get_param_range_U(*u_min, *u_max);
  CubitBoolean r2 = face->get_param_range_V(*v_min, *v_max);
  RETURN( ((r1 && r2) ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getEntUVtoXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  u,
double  v,
double *  x,
double *  y,
double *  z,
int *  err 
)

Return coordinate position at specified parametric position on entity.

Return coordinate position at specified parametric position on entity.

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
uParametric coordinate being queried
vParametric coordinate being queried
xSpatial coordinate at parametric position being queried
ySpatial coordinate at parametric position being queried
zSpatial coordinate at parametric position being queried
*errPointer to error type returned from function

Definition at line 4401 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefFace* face = dynamic_cast<RefFace*>(entity);
  if (!face) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Expected face for UV method.");
  }
  
  CubitVector xyz = face->position_from_u_v( u, v );
  xyz.get_xyz( *x, *y, *z );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntXYZtoU ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  x,
double  y,
double  z,
double *  u,
int *  err 
)

Return parametric position at specified spatial position on entity.

Return parametric position at specified spatial position on entity

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
xSpatial coordinate being queried
ySpatial coordinate being queried
zSpatial coordinate being queried
uParametric coordinate at spatial position being queried
*errPointer to error type returned from function

Definition at line 4708 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefEdge* edge = dynamic_cast<RefEdge*>(entity);
  if (!edge) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Expected edge for 1-param method.");
  }
  
  const CubitVector xyz( x, y, z );
  *u = edge->u_from_position( xyz );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getEntXYZtoUV ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  x,
double  y,
double  z,
double *  u,
double *  v,
int *  err 
)

Return parametric position at specified spatial position on entity.

Return parametric position at specified spatial position on entity

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
xSpatial coordinate being queried
ySpatial coordinate being queried
zSpatial coordinate being queried
uParametric coordinate at spatial position being queried
vParametric coordinate at spatial position being queried
*errPointer to error type returned from function

Definition at line 4600 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefFace* face = dynamic_cast<RefFace*>(entity);
  if (!face) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Expected face for UV method.");
  }
  
  const CubitVector xyz( x, y, z );
  CubitStatus s = face->u_v_from_position( xyz, *u, *v );
  RETURN( (s == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getEntXYZtoUVHint ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
double  x,
double  y,
double  z,
double *  u,
double *  v,
int *  err 
)

Return parametric position at specified spatial position on entity, based on parametric position hint.

Return parametric position at specified spatial position on entity, based on parametric position hint. For this function, u and v are input with parameters from which to start search. Typically this will reduce the search time for new parametric coordinates.

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
xSpatial coordinate being queried
ySpatial coordinate being queried
zSpatial coordinate being queried
uParametric coordinate at spatial position being queried
vParametric coordinate at spatial position being queried
*errPointer to error type returned from function

Definition at line 4796 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)entity_handle;
  RefFace* face = dynamic_cast<RefFace*>(entity);
  if (!face) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Expected face for UV method.");
  }
  
  CubitVector xyz( x, y, z );
  face->move_to_surface( xyz, u, v );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getErrorType ( iGeom_Instance  instance,
int *  error_type 
)

Get the error type returned from the last iGeom function.

Get the error type returned from the last iGeom function. Value returned is a member of the iBase_ErrorType enumeration.

Parameters:
instanceiGeom instance handle
*error_typeError type returned from last iGeom function

Definition at line 578 of file iGeom_CGMA.cc.

{
  *error_type = CGM_iGeom_getLastErrorType();
}
ITAPS_API void iGeom_getESHArrData ( iGeom_Instance  instance,
const iBase_EntityHandle entity_handles,
int  entity_handles_size,
iBase_TagHandle  tag_handle,
iBase_EntitySetHandle **  tag_value,
int *  tag_value_allocated,
int *  tag_value_size,
int *  err 
)

Get tag values of entity set handle type for an array of entities.

Get tag values of entity set handle type for an array of entities.

Parameters:
instanceiGeom instance handle
entity_handlesEntity array on which tag is being set
entity_handles_sizeNumber of entities in array
tag_handleTag being set on an entity
*tag_valuePointer to tag data array being returned from function
tag_value_allocatedPointer to allocated size of tag data array
tag_value_sizePointer to occupied size of tag data array
*errPointer to error type returned from function

Definition at line 1797 of file iGeom_CGMA.cc.

{
  int tag_value_allocated_tmp = *tag_value_allocated * sizeof(iBase_EntitySetHandle);
  int tag_value_size_tmp = *tag_value_size * sizeof(iBase_EntitySetHandle);
  iGeom_getArrData(instance, entity_handles,
                   entity_handles_size, tag_handle,
                   reinterpret_cast<void**>(tag_value),
                   &tag_value_allocated_tmp,
                   &tag_value_size_tmp,
                   err);
  *tag_value_allocated = tag_value_allocated_tmp / sizeof(iBase_EntitySetHandle);
  *tag_value_size = tag_value_size_tmp / sizeof(iBase_EntitySetHandle);
}
ITAPS_API void iGeom_getESHData ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
iBase_TagHandle  tag_handle,
iBase_EntitySetHandle out_data,
int *  err 
)

Get the value of a tag of entity set handle type on an entity.

Get the value of a tag of entity set handle type on an entity.

Parameters:
instanceiGeom instance handle
entity_handleEntity on which tag is being set
tag_handleTag being set on an entity
*out_dataPointer to tag value returned from function
*errPointer to error type returned from function

Definition at line 1953 of file iGeom_CGMA.cc.

{
  void *val_ptr = data_out;
  int val_size = sizeof(iBase_EntitySetHandle);
  iGeom_getArrData(instance, &entity_handle, 1,
                   tag_handle, &val_ptr, &val_size, &val_size, err);
}
void iGeom_getFacets ( iGeom_Instance  instance,
iBase_EntityHandle  entity,
double  dist_tolerance,
double **  points,
int *  points_allocated,
int *  points_size,
int **  facets,
int *  facets_allocated,
int *  facets_size,
int *  err 
)

Return facet information from solid modeling engine.

Return facet information from solid modeling engine

Parameters:
instanceiGeom instance handle
entity_handleEntity being queried
dist_toleranceTolerance guidance for faceting engine
pointsList of vertices in faceting of curve or surface
points_allocatedAllocated size of vertex list array
points_sizeOccupied size of vertex list array
facetsList of facets in faceting of surface
facets_allocatedAllocated size of facet list array
facets_sizeOccupied size of facet list array
*errPointer to error type returned from function

Definition at line 7381 of file iGeom_CGMA.cc.

{
  GMem gMem;
  CubitStatus resl = CUBIT_SUCCESS;
  RefFace *ref_face = dynamic_cast<RefFace*>(ENTITY_HANDLE(entity));
  if(ref_face)
    resl = ref_face->get_graphics(gMem, 15, dist_tolerance);

  RefEdge *ref_edge = dynamic_cast<RefEdge*>(ENTITY_HANDLE(entity));
  if(ref_edge)
    resl = ref_edge->get_graphics(gMem, 15, dist_tolerance);

  if(resl == CUBIT_FAILURE)
      ERROR(iBase_FAILURE, "Can't get facets for this entity.");

  if(ref_face || ref_edge)
  {
    int p_count = gMem.point_list_size(); 
    int f_count = gMem.facet_list_size();
    if(p_count)
    {
      ALLOC_CHECK_ARRAY_NOFAIL(points, p_count * 3);
      GPoint* gpoints = gMem.point_list();
      double *x, *y, *z;
      x = *points;
      y = x + 1;
      z = x + 2;
      size_t step = 3;
      for(int i = 0; i < p_count; i++)
      {
        GPoint pt = gpoints[i];       
        *x = pt.x;
        *y = pt.y;
        *z = pt.z;
        x += step;
        y += step;
        z += step; 
      } 
    }
    if(f_count)
    {
      //return all the triangles. Current gMem gives 4*triangle facets which
      //includes a '3' for each facet set to indicate there are 3 nodes on 
      //the tessilation. Here trying to ignore the '3'.
      ALLOC_CHECK_ARRAY_NOFAIL(facets, f_count*3/4);
      int *connectivity;
      connectivity = *facets;
      int* list = gMem.facet_list();
      for (int i = 0; i < f_count/4; i++)
      {
         *connectivity = list[i*4 + 1];
         *(connectivity + 1) = list[i*4 + 2];
         *(connectivity + 2) = list[i*4 + 3];
         connectivity += 3;
      }
    } 
    RETURN(iBase_SUCCESS); 
  }
  else
    RETURN(iBase_INVALID_ENTITY_TYPE);
}
ITAPS_API void iGeom_getFaceType ( iGeom_Instance  instance,
iBase_EntityHandle  gentity_handle,
char *  face_type,
int *  err,
int *  face_type_length 
)

Get the geometric type of a face.

Return the type of surface as a string; if not a surface, an error is returned

Parameters:
face_handleFace for which the type is requested
face_typeType of face, returned as a string

Definition at line 3297 of file iGeom_CGMA.cc.

{
  static const char *surf_types[] = {"cone", "plane", "sphere", "spline", 
                                     "torus", "best_fit", "facet", "undefined"};
  
  RefEntity *this_ent = ENTITY_HANDLE(gentity_handle);
  RefFace *this_face = dynamic_cast<RefFace*>(this_ent);
  if (!this_face)
    RETURN(iBase_INVALID_ENTITY_TYPE);
  GeometryType this_type = this_face->get_surface_ptr()->geometry_type();
  if (this_type < CONE_SURFACE_TYPE || this_type > UNDEFINED_SURFACE_TYPE) {
    RETURN(iBase_FAILURE);
  }
  
  const char* result = surf_types[this_type - CONE_SURFACE_TYPE];
  const int len = strlen(result);
  if (len < *face_type_length) {
    strcpy(face_type, result);
    *face_type_length = len;
  }
  else {
    strncpy(face_type, result, *face_type_length-1);
    face_type[*face_type_length] = '\0';
  }

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getFcArrCvtrUV ( iGeom_Instance  instance,
iBase_EntityHandle const *  face_handles,
int  face_handles_size,
int  storage_order,
double const *  uv,
int  uv_size,
double **  cvtr_1,
int *  cvtr_1_allocated,
int *  cvtr_1_size,
double **  cvtr_2,
int *  cvtr_2_allocated,
int *  cvtr_2_size,
int *  err 
)

Get the curvature(s) on face(s) at given parametric position(s)

Get the curvature(s) on face(s) at given parametric position(s). If either the number of faces or number of coordinate pairs is unity, then all points or entities are queried for that entity or point, respectively, otherwise each point corresponds to each entity. storage_order should be a value in the iBase_StorageOrder enum.

Parameters:
instanceiGeom instance handle
face_handlesFace(s) being queried
face_handles_sizeNumber of entities being queried
storage_orderStorage order of uv coordinates
uvStarting parametric coordinates
uv_sizeNumber of values in uv array
cvtr_1First principal curvatures
cvtr_1_allocatedAllocated size of first curvature array
cvtr_1_sizeOccupied size of first curvature array
cvtr_2Second principal curvatures
cvtr_2_allocatedAllocated size of second curvature array
cvtr_2_sizeOccupied size of second curvature array
*errPointer to error type returned from function

Definition at line 5638 of file iGeom_CGMA.cc.

{
  iGeom_getArrUVtoXYZ(instance, ARRAY_IN(face_handles), storage_order, 
                      ARRAY_IN(uv), ARRAY_INOUT(cvtr_1), err);
  if (*err == iBase_SUCCESS)
    iGeom_getEntArrCvtrXYZ(instance, ARRAY_IN(face_handles), storage_order,
                           *cvtr_1, *cvtr_1_size, 
                           ARRAY_INOUT(cvtr_1), ARRAY_INOUT(cvtr_2), err);
}
ITAPS_API void iGeom_getFcCvtrUV ( iGeom_Instance  instance,
iBase_EntityHandle  face_handle,
double  u,
double  v,
double *  cvtr1_i,
double *  cvtr1_j,
double *  cvtr1_k,
double *  cvtr2_i,
double *  cvtr2_j,
double *  cvtr2_k,
int *  err 
)

Get the two principle curvature vectors for a face at a parametric position.

Get the two principle curvature vectors for a face at a parametric position. Magnitudes of vectors are curvature, directions are directions of principal curvatures.

Parameters:
instanceiGeom instance handle
face_handleFace being queried
uParametric position being queried
vParametric position being queried
cvtr1_iMaximum curvature vector
cvtr1_jMaximum curvature vector
cvtr1_kMaximum curvature vector
cvtr2_iMinimum curvature vector
cvtr2_jMinimum curvature vector
cvtr2_kMinimum curvature vector
*errPointer to error type returned from function

Definition at line 5615 of file iGeom_CGMA.cc.

{
  double x, y, z;
  iGeom_getEntUVtoXYZ(instance, entity_handle, u, v, &x, &y, &z, err );
  if (*err == iBase_SUCCESS)
    iGeom_getFcCvtrXYZ(instance, entity_handle, x, y, z, 
                       cvtr1_i, cvtr1_j, cvtr1_k,
                       cvtr2_i, cvtr2_j, cvtr2_k,
                       err );
}
ITAPS_API void iGeom_getFcCvtrXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  face_handle,
double  x,
double  y,
double  z,
double *  cvtr1_i,
double *  cvtr1_j,
double *  cvtr1_k,
double *  cvtr2_i,
double *  cvtr2_j,
double *  cvtr2_k,
int *  err 
)

Get the two principle curvature vectors for a face at a point.

Get the two principle curvature vectors for a face at a point. Magnitudes of vectors are curvature, directions are directions of principal curvatures.

Parameters:
instanceiGeom instance handle
face_handleFace being queried
xPosition being queried
yPosition being queried
zPosition being queried
cvtr1_iMaximum curvature vector
cvtr1_jMaximum curvature vector
cvtr1_kMaximum curvature vector
cvtr2_iMinimum curvature vector
cvtr2_jMinimum curvature vector
cvtr2_kMinimum curvature vector
*errPointer to error type returned from function

Definition at line 2720 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)face_handle;
  RefFace* face = dynamic_cast<RefFace*>(entity);
  if (!face)
    RETURN(iBase_INVALID_ENTITY_TYPE);
  
  Surface* surf = face->get_surface_ptr();
  CubitVector loc(x,y,z), curv1, curv2;
  CubitStatus status = surf->closest_point( loc, 0, 0, &curv1, &curv2 );
  if (surf->bridge_sense() == CUBIT_REVERSED) {
    curv1 = -curv1;
    curv2 = -curv2;
  }
  curv1.get_xyz( *cvtr1_i, *cvtr1_j, *cvtr1_k );
  curv2.get_xyz( *cvtr2_i, *cvtr2_j, *cvtr2_k );
  RETURN( (status == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getFcEvalXYZ ( iGeom_Instance  instance,
iBase_EntityHandle  face_handle,
double  x,
double  y,
double  z,
double *  on_x,
double *  on_y,
double *  on_z,
double *  nrml_i,
double *  nrml_j,
double *  nrml_k,
double *  cvtr1_i,
double *  cvtr1_j,
double *  cvtr1_k,
double *  cvtr2_i,
double *  cvtr2_j,
double *  cvtr2_k,
int *  err 
)

Get closest point, tangent, and curvature of face.

Get closest point, tangent, and curvature of face. If any of input coordinate pointers are NULL, that value is not returned.

Parameters:
instanceiGeom instance handle
face_handleFace being queried
xPoint at which entity is being queried
yPoint at which entity is being queried
zPoint at which entity is being queried
on_xClosest point at point being queried
on_yClosest point at point being queried
on_zClosest point at point being queried
nrml_iNormal at point being queried
nrml_jNormal at point being queried
nrml_kNormal at point being queried
cvtr1_iFirst principal curvature at point being queried
cvtr1_jFirst principal curvature at point being queried
cvtr1_kFirst principal curvature at point being queried
cvtr2_iSecond principal curvature at point being queried
cvtr2_jSecond principal curvature at point being queried
cvtr2_kSecond principal curvature at point being queried
*errPointer to error type returned from function

Definition at line 2932 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)face_handle;
  RefFace* face = dynamic_cast<RefFace*>(entity);
  if (!face)
    RETURN(iBase_INVALID_ENTITY_TYPE);
  
  Surface* surf = face->get_surface_ptr();
  CubitVector loc(x,y,z), on, norm, curv1, curv2;
#ifdef CGM_HAVE_FACET_ENGINE_ONLY
  CubitStatus status = surf->closest_point( loc, &on, &norm);
#else
  CubitStatus status = surf->closest_point( loc, &on, &norm, &curv1, &curv2 );
#endif

  if (surf->bridge_sense() == CUBIT_REVERSED) {
    norm = -norm;
    curv1 = -curv1;
    curv2 = -curv2;
  }
  on.get_xyz( *on_x, *on_y, *on_z );
  norm.get_xyz( *norm_i, *norm_j, *norm_k );
  curv1.get_xyz( *cvtr1_i, *cvtr1_j, *cvtr1_k );
  curv2.get_xyz( *cvtr2_i, *cvtr2_j, *cvtr2_k );
  RETURN( (status == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) );
}
ITAPS_API void iGeom_getIntArrData ( iGeom_Instance  instance,
const iBase_EntityHandle entity_handles,
int  entity_handles_size,
iBase_TagHandle  tag_handle,
int **  tag_values,
int *  tag_values_allocated,
int *  tag_values_size,
int *  err 
)

Get tag values of integer type for an array of entities.

Get tag values of integer type for an array of entities.

Parameters:
instanceiGeom instance handle
entity_handlesEntity array on which tag is being set
entity_handles_sizeNumber of entities in array
tag_handleTag being set on an entity
*tag_valuesPointer to tag data array being returned from function
tag_values_allocatedPointer to allocated size of tag data array
tag_values_sizePointer to occupied size of tag data array
*errPointer to error type returned from function

Definition at line 1730 of file iGeom_CGMA.cc.

{
  int tag_value_allocated_tmp = *tag_value_allocated * sizeof(int);
  int tag_value_size_tmp = *tag_value_size * sizeof(int);
  iGeom_getArrData(instance, entity_handles, 
                   entity_handles_size, tag_handle,
                   reinterpret_cast<void**>(tag_value),
                   &tag_value_allocated_tmp, 
                   &tag_value_size_tmp,
                   err);
  *tag_value_allocated = tag_value_allocated_tmp / sizeof(int);
  *tag_value_size = tag_value_size_tmp / sizeof(int);
}
ITAPS_API void iGeom_getIntData ( iGeom_Instance  instance,
iBase_EntityHandle  entity_handle,
iBase_TagHandle  tag_handle,
int *  out_data,
int *  err 
)

Get the value of a tag of integer type on an entity.

Get the value of a tag of integer type on an entity.

Parameters:
instanceiGeom instance handle
entity_handleEntity on which tag is being set
tag_handleTag being set on an entity
*out_dataPointer to tag value returned from function
*errPointer to error type returned from function

Definition at line 1914 of file iGeom_CGMA.cc.

{
  void *val_ptr = data_out;
  int val_size = sizeof(int);
  iGeom_getArrData(instance, &entity_handle, 1, 
                   tag_handle, &val_ptr, &val_size, &val_size, err);
}
ITAPS_API void iGeom_getNextEntArrIter ( iGeom_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
int *  has_data,
int *  err 
)

Get entities contained in array iterator and increment iterator.

Get the entities contained in an array iterator, and increment the iterator. Also return whether the next value of the iterator has any entities (if non-zero, next iterator value is the end of the iteration).

Parameters:
instanceiGeom instance handle
entArr_iteratorIterator being queried
*entity_handlesPointer to array of entity handles contained in current value of iterator
*entity_handles_allocatedPointer to allocated size of entity_handles array
*entity_handles_sizePointer to occupied size of entity_handles array
has_dataPointer to a flag indicating if the value(s) returned in entity_handles are valid. A non-zero value indicates the value(s) are valid. A zero value indicates the value(s) are NOT valid.
*errPointer to error type returned from function

Definition at line 922 of file iGeom_CGMA.cc.

{
  CGMAIterator* iterator = reinterpret_cast<CGMAIterator*>(entArr_iterator);
  *has_data = !iterator->at_end();
  if (has_data) {
    ALLOC_CHECK_ARRAY_NOFAIL(entity_handles, iterator->size());
    iterator->next( (RefEntity**)*entity_handles, *entity_handles_size );
  }
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getNextEntIter ( iGeom_Instance  instance,
iBase_EntityIterator  gentity_iterator,
iBase_EntityHandle gentity_handle,
int *  has_data,
int *  err 
)

Get entity corresponding to an iterator and increment iterator.

Get the next entity for this iterator.

Parameters:
gentity_iteratorIterator being iterated over
gentity_handleNext gentity
Returns:
If true, there were more gentities, if false, the iterator was already at the end.

Definition at line 904 of file iGeom_CGMA.cc.

{
  CGMAIterator* iterator = reinterpret_cast<CGMAIterator*>(gentity_iterator);
  RefEntity** out_handle = reinterpret_cast<RefEntity**>(gentity_handle);
  *has_data = !iterator->at_end();
  if (*has_data) {
    int count = 1;
    iterator->next( out_handle, count );
  }
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getNumChld ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
const int  num_hops,
int *  num_child,
int *  err 
)

Get the number of child sets linked from a specified set.

Returns the number of immediate children in the gentity_set (one level down only)

Definition at line 1073 of file iGeom_CGMA.cc.

{
    // HJK: num_hops has to be handled
  if (0 < num_hops) {
    ERROR(iBase_NOT_SUPPORTED, "Num_hops argument not yet supported.");
  }

  std::vector<RefGroup*> *my_children = TM->pc_list(const_cast<RefGroup*>(SET_HANDLE(entity_set)), 1, false);
  *num_child = my_children == NULL ? 0 : my_children->size();
  RETURN (iBase_SUCCESS);
}
ITAPS_API void iGeom_getNumEntSets ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
int  num_hops,
int *  num_ent_sets,
int *  err 
)

Get the number of entity sets contained in a set or interface.

Returns the number of gentity_sets contained in a given model or gentity_set one level deep

Parameters:
gentity_set_handleEntity set being queried
Returns:
Number of entity sets in gentity_set_handle

Definition at line 3973 of file iGeom_CGMA.cc.

{
    // HJK: num_hops has to be handled
  if (0 < num_hops) {
    ERROR(iBase_NOT_SUPPORTED, "Num_hops argument not yet supported.");
  }
  
  const RefGroup *this_set = SET_HANDLE(entity_set);
  if (NULL == this_set)
    *num_ent_sets = RefEntityFactory::instance()->num_ref_groups();
  else {
    DLIList<RefEntity*> tmp_ents;
    DLIList<RefGroup*> groups;
    const_cast<RefGroup*>(this_set)->get_child_ref_entities(tmp_ents);
    CAST_LIST(tmp_ents, groups, RefGroup);
    *num_ent_sets = groups.size();
  }

  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getNumOfType ( iGeom_Instance  instance,
iBase_EntitySetHandle  set_handle,
int  gentity_type,
int *  count,
int *  err 
)

Get the number of entities with the specified type in the instance or set.

Return number of gentities of specified dimension in this set, or in whole model.

Parameters:
set_handleEntity set being queried (if 0, whole model)
gentity_dimensionDimension of entities being queried
Returns:
Number of entities

Definition at line 1198 of file iGeom_CGMA.cc.

{
  const RefGroup *this_set = SET_HANDLE(set_handle);
  if (0 == this_set) {
    switch (gentity_type) {
      case iBase_ALL_TYPES:
        *count  = GeometryQueryTool::instance()->num_bodies();
        *count += GeometryQueryTool::instance()->num_ref_faces();
        *count += GeometryQueryTool::instance()->num_ref_edges();
        *count += GeometryQueryTool::instance()->num_ref_vertices();
        break;
      case iBase_REGION:
        *count = GeometryQueryTool::instance()->num_bodies();
        break;
      case iBase_FACE:
        *count = GeometryQueryTool::instance()->num_ref_faces();
        break;
      case iBase_EDGE:
        *count = GeometryQueryTool::instance()->num_ref_edges();
        break;
      case iBase_VERTEX:
        *count = GeometryQueryTool::instance()->num_ref_vertices();
        break;
      default:
        RETURN(iBase_BAD_TYPE_AND_TOPO);
        break;
    }
    RETURN (iBase_SUCCESS);
  }
  else {
    static DLIList<CubitEntity*> centities;
    centities.clean_out();
    const_cast<RefGroup*>(this_set)->get_child_entities(centities);
    *count = count_ibase_type( gentity_type, centities, err );
  }
}
ITAPS_API void iGeom_getNumPrnt ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set,
const int  num_hops,
int *  num_parent,
int *  err 
)

Get the number of parent sets linked from a specified set.

Returns the number of immediate parents to the gentity_set (one level up only)

Definition at line 1094 of file iGeom_CGMA.cc.

{
    // HJK: num_hops has to be handled
  if (0 < num_hops) {
    ERROR(iBase_NOT_SUPPORTED, "Num_hops argument not yet supported.");
  }

  std::vector<RefGroup*> *my_parents = TM->pc_list(const_cast<RefGroup*>(SET_HANDLE(entity_set)), 0, false);
  *num_parent = my_parents == NULL ? 0 : my_parents->size();
  RETURN (iBase_SUCCESS);
}
ITAPS_API void iGeom_getParametric ( iGeom_Instance  instance,
int *  is_parametric,
int *  err 
)

Return whether interface has information about parameterization.

Return whether an interface has information about parameterization (!=0) or not (0)

Parameters:
instanceiGeom instance handle
is_parametricIf non-zero, interface has information about parameterization
*errPointer to error type returned from function

Definition at line 4360 of file iGeom_CGMA.cc.

{
  *is_parametric = true;
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getPntArrClsf ( iGeom_Instance  instance,
int  storage_order,
double const *  coords,
int  coords_size,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
int *  err 
)

Get the entities on which points are located.

Get the entities on which points are located. Storage orders should be members of the iBase_StorageOrder enumeration.

Parameters:
instanceiGeom instance handle
storage_orderStorage order of coordinates in coords
coordsPoints being queried
coords_sizeNumber of entries in coords array
entity_handlesEntities on which points are located
entity_handles_allocatedAllocated size of entity_handles array
entity_handles_sizeOccupied size of entity_handles array
*errPointer to error type returned from function

Definition at line 3636 of file iGeom_CGMA.cc.

{
  size_t init, step;
  int count = coords_size / 3;
  if (storage_order == iBase_BLOCKED) {
    init = count;
    step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED;
    init = 1;
    step = 3;
  }
  const double *x = coords;
  const double *y = x + init;
  const double *z = y + init;
  
  ALLOC_CHECK_ARRAY( entity_handles, count );
  
  RefEntity** array = (RefEntity**)*entity_handles;
  for (int i = 0; i < count; ++i)
  {
    const CubitVector pt( *x, *y, *z );
    array[i] = iGeom_get_point_containment( pt );
    if (!array[i]) {
      RETURN(iBase_FAILURE);
    }
    x += step;
    y += step;
    z += step;
  }
  
  KEEP_ARRAY(entity_handles);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getPntArrRayIntsct ( iGeom_Instance  instance,
int  storage_order,
const double *  coords,
int  coords_size,
const double *  directions,
int  directions_size,
iBase_EntityHandle **  intersect_entity_handles,
int *  intersect_entity_handles_allocated,
int *  intersect_entity_hangles_size,
int **  offset,
int *  offset_allocated,
int *  offset_size,
double **  intersect_coords,
int *  intersect_coords_allocated,
int *  intersect_coords_size,
double **  param_coords,
int *  param_coords_allocated,
int *  param_coords_size,
int *  err 
)

Intersect an array of rays with the model.

Intersect an array of rays with the model. Storage order passed in is a member of the iBase_StorageOrder enumeration.

Parameters:
instanceiGeom instance handle
storage_orderStorage order of input coordinates
coordsPoints from which rays are fired
coords_sizeNumber of points from which rays are fired
directionsDirections in which rays are fired
directions_sizeNumber of coordinates in directions array
intersect_entity_handlesEntities intersected by ray
intersect_entity_handles_allocatedAllocated size of intersections array
intersect_entity_hangles_sizeOccupied size of intersections array
offsetOffset[i] is offset into intersect_entity_handles of ith ray
offset_allocatedAllocated size of offset array
offset_sizeOccupied size of offset array
storage_orderStorage order of coordinates passed back
intersect_coordsCoordinates of intersections
intersect_coords_allocatedAllocated size of coordinates array
intersect_coords_sizeOccupied size of coordinates array
param_coordsDistances along ray of intersections
param_coords_allocatedAllocated size of param_coords array
param_coords_sizeOccupied size of param_coords array
*errPointer to error type returned from function

Definition at line 3527 of file iGeom_CGMA.cc.

{
  if (points_size != directions_size || points_size % 3) {
    ERROR(iBase_INVALID_ARGUMENT, "Mismatched or invalid input array size");
  }
  
  const int count = points_size / 3;
  ALLOC_CHECK_ARRAY( offset, count );
  
  const double *px, *py, *pz, *dx, *dy, *dz;
  size_t init, step;
  if (storage_order == iBase_BLOCKED) {
    init = count;
    step = 1;
  }
  else {
    storage_order = iBase_INTERLEAVED;
    init = 1;
    step = 3;
  }
  px = points;
  py = px + init;
  pz = py + init;
  dx = directions;
  dy = dx + init;
  dz = dy + init;
  
  DLIList<RefEntity*> entities, tmp_entities;
  DLIList<double> params, tmp_params;
  std::vector<CubitVector> coords;
  for (int i = 0; i < count; ++i)
  {
    tmp_entities.clean_out();
    tmp_params.clean_out();
    (*offset)[i] = params.size();
    const CubitVector point(*px, *py, *pz), dir(*dx, *dy, *dz);
    CubitStatus s = iGeom_fire_ray( point, dir, tmp_entities, tmp_params );
    if (CUBIT_SUCCESS != s) {
      RETURN(iBase_FAILURE);
    }

    entities += tmp_entities;
    params += tmp_params;
    tmp_params.reset();
    for (int j = tmp_params.size(); j > 0; --j) 
      coords.push_back( tmp_params.get_and_step() * dir + point );
    
    px += step;
    py += step;
    pz += step;
    dx += step;
    dy += step;
    dz += step;
  }
  
  ALLOC_CHECK_ARRAY_NOFAIL( intersect_entity_handles, entities.size() );
  ALLOC_CHECK_ARRAY_NOFAIL( intersect_coords, coords.size() );
  ALLOC_CHECK_ARRAY_NOFAIL( param_coords, params.size() );
  entities.copy_to( (RefEntity**)*intersect_entity_handles );
  params.copy_to( *param_coords );
  
  double *x = *intersect_coords;
  double *y = x + init;
  double *z = y + init;
  for (std::vector<CubitVector>::const_iterator k = coords.begin(); k != coords.end(); ++k)
  {
    k->get_xyz( *x, *y, *z );
    x += step;
    y += step;
    z += step;
  }
  
  KEEP_ARRAY(offset);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getPntClsf ( iGeom_Instance  instance,
double  x,
double  y,
double  z,
iBase_EntityHandle entity_handle,
int *  err 
)

Get the entity on which a point is located.

Get the entity on which a point is located

Parameters:
instanceiGeom instance handle
xPoint being queried
yPoint being queried
zPoint being queried
entity_handleEntity on which point is located
*errPointer to error type returned from function

Definition at line 3622 of file iGeom_CGMA.cc.

{
  RefEntity** ptr = (RefEntity**)entity_handle;
  const CubitVector pt(x,y,z);
  *ptr = iGeom_get_point_containment( pt );
  RETURN( *ptr ? iBase_SUCCESS : iBase_FAILURE );
}
ITAPS_API void iGeom_getPntRayIntsct ( iGeom_Instance  instance,
double  x,
double  y,
double  z,
double  dir_x,
double  dir_y,
double  dir_z,
iBase_EntityHandle **  intersect_entity_handles,
int *  intersect_entity_handles_allocated,
int *  intersect_entity_hangles_size,
int  storage_order,
double **  intersect_coords,
int *  intersect_coords_allocated,
int *  intersect_coords_size,
double **  param_coords,
int *  param_coords_allocated,
int *  param_coords_size,
int *  err 
)

Intersect a ray with the model.

Intersect a ray with the model. Storage orders passed in should be a member of the iBase_StorageOrder enumeration.

Parameters:
instanceiGeom instance handle
xPoint from which ray is fired
yPoint from which ray is fired
zPoint from which ray is fired
dir_xDirection in which ray is fired
dir_yDirection in which ray is fired
dir_zDirection in which ray is fired
intersect_entity_handlesEntities intersected by ray
intersect_entity_handles_allocatedAllocated size of intersections array
intersect_entity_hangles_sizeOccupied size of intersections array
storage_orderStorage order of coordinates passed back
intersect_coordsCoordinates of intersections
intersect_coords_allocatedAllocated size of coordinates array
intersect_coords_sizeOccupied size of coordinates array
param_coordsDistances along ray of intersections
param_coords_allocatedAllocated size of param_coords array
param_coords_sizeOccupied size of param_coords array
*errPointer to error type returned from function

Definition at line 3469 of file iGeom_CGMA.cc.

{
  DLIList<double> ray_params;
  DLIList<RefEntity*> entities;
  CubitVector point(x,y,z), dir(dx,dy,dz);
  CubitStatus status = iGeom_fire_ray( point, dir, entities, ray_params );
  if (status != CUBIT_SUCCESS)
    RETURN(iBase_FAILURE);
  
  ALLOC_CHECK_ARRAY_NOFAIL( intersect_entity_handles, entities.size() );
  ALLOC_CHECK_ARRAY_NOFAIL( intersect_coords, 3*ray_params.size() );
  ALLOC_CHECK_ARRAY_NOFAIL( param_coords, ray_params.size() );
  
  size_t init, step;
  if (storage_order == iBase_BLOCKED) {
    init = ray_params.size();
    step = 1;
  }
  else {
    init = 1;
    step = 3;
  }
  
  double *x_iter = *intersect_coords;
  double *y_iter = x_iter + init;
  double *z_iter = y_iter + init;
  for (size_t i = ray_params.size(); i > 0; --i) {
    double t = ray_params.get_and_step();
    CubitVector pos = t * dir + point;
    pos.get_xyz( *x_iter, *y_iter, *z_iter );
    x_iter += step;
    y_iter += step;
    z_iter += step;
  }
  ray_params.copy_to( *param_coords );
  entities.copy_to( (RefEntity**)*intersect_entity_handles );
         
  RETURN(iBase_SUCCESS);  
}
ITAPS_API void iGeom_getPrnts ( iGeom_Instance  instance,
iBase_EntitySetHandle  from_entity_set,
const int  num_hops,
iBase_EntitySetHandle **  entity_set_handles,
int *  entity_set_handles_allocated,
int *  entity_set_handles_size,
int *  err 
)

Get the parent sets linked from a specified set.

Recursively gets the parents of this gentity_set up to num_hops levels; if num_hops is set to -1 all parents are returned

Definition at line 1050 of file iGeom_CGMA.cc.

{
  std::vector<RefGroup*> group_ptrs;
  const RefGroup *this_grp = SET_HANDLE(from_entity_set);
  TM->get_pc_groups(const_cast<RefGroup*>(this_grp), 0, num_hops, group_ptrs);
  ALLOC_CHECK_ARRAY_NOFAIL(entity_set_handles, group_ptrs.size());

  iBase_EntitySetHandle* ent_arr = reinterpret_cast<iBase_EntitySetHandle*>(&group_ptrs[0]);
  std::copy( ent_arr, ent_arr + group_ptrs.size(), *entity_set_handles);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getRootSet ( iGeom_Instance  instance,
iBase_EntitySetHandle root_set,
int *  err 
)

Get handle of the root set for this instance.

Get handle of the root set for this instance. All geom in this instance can be accessed from this set.

Parameters:
instanceiGeom instance handle
root_setPointer to set handle returned from function
*errPointer to error type returned from function

Definition at line 822 of file iGeom_CGMA.cc.

{
  *root = NULL;
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getTagHandle ( iGeom_Instance  instance,
const char *  tag_name,
iBase_TagHandle tag_handle,
int *  err,
int  tag_name_len 
)

Get a the handle of an existing tag with the specified name.

Get the tag handle associated with a given string name.

Definition at line 1650 of file iGeom_CGMA.cc.

{
    // make sure string is null-terminated
  std::string tag_name_buf( tag_name, tag_name_len );
  tag_name = tag_name_buf.c_str();
  *tag_handle = reinterpret_cast<iBase_TagHandle>(static_cast<size_t>(TM->getTagHandle( tag_name )));

    // XXX: this seems really wrong...
  iGeom_getErrorType(instance, err);
}
ITAPS_API void iGeom_getTagName ( iGeom_Instance  instance,
iBase_TagHandle  tag_handle,
char *  name,
int *  err,
int  name_len 
)

Get the name for a given tag handle.

Get the tag name associated with a given tag handle.

Definition at line 1578 of file iGeom_CGMA.cc.

{
  const char* name_ptr = TM->getTagName(TAG_HANDLE(tag_handle));
  int len = strlen(name_ptr) + 1;
  if (len > name_len)
    len = name_len;
  memcpy( name, name_ptr, len );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getTagSizeBytes ( iGeom_Instance  instance,
iBase_TagHandle  tag_handle,
int *  tag_size,
int *  err 
)

Get size of a tag in units of bytes.

Get the size of the data associated with a given tag handle.

Definition at line 1627 of file iGeom_CGMA.cc.

{
  *tag_size = TM->getTagSize(TAG_HANDLE(tag_handle));
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getTagSizeValues ( iGeom_Instance  instance,
iBase_TagHandle  tag_handle,
int *  tag_size,
int *  err 
)

Get size of a tag in units of numbers of tag data type.

Get the size of the data associated with a given tag handle.

Definition at line 1596 of file iGeom_CGMA.cc.

{
  *tag_size = TM->getTagSize(TAG_HANDLE(tag_handle));
  int type;
  iGeom_getTagType( instance, tag_handle, &type, err );
  if (iBase_SUCCESS != *err) return;
  
  switch (type) {
    case iBase_INTEGER:
      *tag_size /= sizeof(int);
      break;
    case iBase_DOUBLE:
      *tag_size /= sizeof(double);
      break;
    case iBase_ENTITY_HANDLE:
    case iBase_ENTITY_SET_HANDLE:
      *tag_size /= sizeof(iBase_EntityHandle);
      break;
    case iBase_BYTES:
      break;
  }
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getTagType ( iGeom_Instance  instance,
iBase_TagHandle  tag_handle,
int *  tag_type,
int *  err 
)

Get the data type of the specified tag handle.

Get the data type of the specified tag handle. Tag type is a value in the iBase_TagType enumeration.

Parameters:
instanceiGeom instance handle
tag_handleHandle for the tag being queried
tag_typePointer to tag type returned from function
*errPointer to error type returned from function

Definition at line 1637 of file iGeom_CGMA.cc.

{
  *type = TM->getTagType(TAG_HANDLE(tag_handle));
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getTolerance ( iGeom_Instance  instance,
int *  type,
double *  tolerance,
int *  err 
)

Get the tolerance of the instance.

Return the relative and absolute tolerances at the modeler level. If model does not have a modeler-wide tolerance, zero is returned for both values.

Parameters:
relative_toleranceRelative tolerance for model as a whole
absolute_toleranceAbsolute tolerance for model as a whole

Definition at line 4314 of file iGeom_CGMA.cc.

{
  *type = 1;
  *tolerance = gqt->get_sme_resabs_tolerance();
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getTopoLevel ( iGeom_Instance  instance,
int *  topo_level_out,
int *  err 
)

Return the topology level of the geometry.

Return the topology level of the geometry as an integer, where 0 = basic entities only, 1 = manifold entities, 2 = non-manifold entities.

Parameters:
instanceiGeom instance handle
topo_level_outThe topology level
*errPointer to error type returned from function

Definition at line 1497 of file iGeom_CGMA.cc.

{
  *level = 2; // 0->basic entities only, 1->manifold, 2->non-manifold
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getVtxArrCoords ( iGeom_Instance  instance,
const iBase_EntityHandle gentity_handles,
int  gentity_handles_size,
int  storage_order,
double **  coordinates,
int *  coordinates_allocated,
int *  coordinates_size,
int *  err 
)

Get coordinates of specified vertices.

Return the coordinates of the specified vertices; returns error if any of the entities are not gvertices. Coordinates returned interleaved.

Parameters:
gentity_handlesThe gentities being queried
coordinatesThe coordinates of the gvertices, interleaved.

Definition at line 3418 of file iGeom_CGMA.cc.

{
  const RefEntity **handle_array = (const RefEntity**)(gentity_handles);

    // check or pre-allocate the coordinate arrays
  ALLOC_CHECK_ARRAY(coordinates, 3*gentity_handles_size);
  
  CubitVector dumvec;
  const RefVertex *this_vertex;

  double *x, *y, *z;
  size_t step;
  if (storage_order == iBase_BLOCKED) {
    x = *coordinates;
    y = x + gentity_handles_size;
    z = y + gentity_handles_size;
    step = 1;
  }
  else {
    x = *coordinates;
    y = x + 1;
    z = x + 2;
    step = 3;
  }

  for (int i = 0; i < gentity_handles_size; i++) {
    this_vertex = dynamic_cast<const RefVertex*>(handle_array[i]);
    if (NULL == this_vertex) {
      ERROR(iBase_INVALID_ENTITY_TYPE, "Entities passed into getGvertexCoordinates must be vertices.");
    }
    else {
      dumvec = this_vertex->coordinates();
      dumvec.get_xyz(*x,*y,*z);
      x += step;
      y += step;
      z += step;
    }
  }

  KEEP_ARRAY(coordinates);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getVtxArrToU ( iGeom_Instance  instance,
iBase_EntityHandle const *  vertex_handles,
int  vertex_handles_size,
iBase_EntityHandle const *  edge_handles,
int  edge_handles_size,
double **  u,
int *  u_allocated,
int *  u_size,
int *  err 
)

Return parametric coordinates on edges of vertex positions.

Return parametric coordinates on edges of vertex positions

Parameters:
instanceiGeom instance handle
vertex_handlesVertices being queried
vertex_handles_sizeNumber of vertices being queried
edge_handlesEdges being queried
edge_handles_sizeNumber of edges being queried
uCorresponding parametric positions on faces
u_allocatedAllocated size of positions array
u_sizeOccupied size of positions array
*errPointer to error type returned from function

Definition at line 5241 of file iGeom_CGMA.cc.

{
  int count;
  size_t vtx_step, edge_step;
  if (vertex_handles_size == edge_handles_size) {
    count = vertex_handles_size;
    vtx_step = edge_step = 1;
  }
  else if (edge_handles_size == 1) {
    count = vertex_handles_size;
    vtx_step = 1;
    edge_step = 0;
  }
  else if (vertex_handles_size == 1) {
    count = edge_handles_size;
    vtx_step = 0;
    edge_step = 1;
  }
  else {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }
  
  ALLOC_CHECK_ARRAY( u, count );
  
  RefEntity** vtx_iter = (RefEntity**)vertex_handles;
  RefEntity** edge_iter = (RefEntity**)edge_handles;
  for (int i = 0; i < count; ++i) {
    RefVertex* vtx = dynamic_cast<RefVertex*>(*vtx_iter);
    RefEdge* edge = dynamic_cast<RefEdge*>(*edge_iter);
    if (!vtx || !edge) {
      RETURN(iBase_INVALID_ENTITY_TYPE);
    }
    
    iBase_ErrorType rval = iGeom_get_vtx_to_u( vtx, edge, (*u)[i] );
    if (iBase_SUCCESS != rval) {
      RETURN(rval);
    }
    
    vtx_iter += vtx_step;
    edge_iter += edge_step;
  }
  KEEP_ARRAY(u);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getVtxArrToUV ( iGeom_Instance  instance,
iBase_EntityHandle const *  vertex_handles,
int  vertex_handles_size,
iBase_EntityHandle const *  face_handles,
int  face_handles_size,
int  storage_order,
double **  uv,
int *  uv_allocated,
int *  uv_size,
int *  err 
)

Return parametric coordinates on faces of vertex positions.

Return parametric coordinates on faces of vertex positions

Parameters:
instanceiGeom instance handle
vertex_handlesVertices being queried
vertex_handles_sizeNumber of vertices being queried
face_handlesFaces being queried
face_handles_sizeNumber of faces being queried
storage_orderStorage order of coordinates returned
uvCorresponding parametric positions on faces
uv_allocatedAllocated size of positions array
uv_sizeOccupied size of positions array
*errPointer to error type returned from function

Definition at line 5155 of file iGeom_CGMA.cc.

{
  int count;
  size_t vtx_step, face_step, uv_step;
  if (vertex_handles_size == face_handles_size) {
    count = vertex_handles_size;
    vtx_step = face_step = 1;
  }
  else if (face_handles_size == 1) {
    count = vertex_handles_size;
    vtx_step = 1;
    face_step = 0;
  }
  else if (vertex_handles_size == 1) {
    count = face_handles_size;
    vtx_step = 0;
    face_step = 1;
  }
  else {
    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes.");
  }
  
  ALLOC_CHECK_ARRAY( uv, 2*count );

  double *u, *v;
  u = *uv;
  if (storage_order == iBase_BLOCKED) {
    v = u + count;
    uv_step = 1;
  } 
  else {
    storage_order = iBase_INTERLEAVED;
    v = u + 1;
    uv_step = 2;
  }
  
  RefEntity** vtx_iter = (RefEntity**)vertex_handles;
  RefEntity** face_iter = (RefEntity**)face_handles;
  for (int i = 0; i < count; ++i) {
    RefVertex* vtx = dynamic_cast<RefVertex*>(*vtx_iter);
    RefFace* face = dynamic_cast<RefFace*>(*face_iter);
    if (!vtx || !face) {
      RETURN(iBase_INVALID_ENTITY_TYPE);
    }
    
    iBase_ErrorType rval = iGeom_get_vtx_to_uv( vtx, face, *u, *v );
    if (iBase_SUCCESS != rval) {
      RETURN(rval);
    }

    vtx_iter += vtx_step;
    face_iter += face_step;
    u += uv_step;
    v += uv_step;
  }
  KEEP_ARRAY(uv);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getVtxCoord ( iGeom_Instance  instance,
iBase_EntityHandle  vertex_handle,
double *  x,
double *  y,
double *  z,
int *  err 
)

Get coordinates of specified vertex.

Get coordinates of specified vertex.

Parameters:
instanceiGeom instance handle
vertex_handleGeom vertex being queried
*xPointer to x coordinate returned from function
*yPointer to y coordinate returned from function
*zPointer to z coordinate returned from function
*errPointer to error type returned from function

Definition at line 3395 of file iGeom_CGMA.cc.

{
  RefEntity* entity = (RefEntity*)vertex_handle;
  RefVertex* vertex = dynamic_cast<RefVertex*>(entity);
  if (!vertex) {
    ERROR(iBase_INVALID_ENTITY_TYPE, "Entity not a vertex");
  }
  vertex->coordinates().get_xyz(*x, *y, *z);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_getVtxToU ( iGeom_Instance  instance,
iBase_EntityHandle  vertex_handle,
iBase_EntityHandle  edge_handle,
double *  u,
int *  err 
)

Return parametric coordinates on edge of vertex position.

Return parametric coordinates on edge of vertex position

Parameters:
instanceiGeom instance handle
vertex_handleVertex being queried
edge_handleEdge being queried
uCorresponding parametric position on face
*errPointer to error type returned from function

Definition at line 5224 of file iGeom_CGMA.cc.

{
  RefVertex* vtx = dynamic_cast<RefVertex*>((RefEntity*)vertex_handle);
  RefEdge* edge = dynamic_cast<RefEdge*>((RefEntity*)edge_handle);
  if (!vtx || !edge) {
    RETURN(iBase_INVALID_ENTITY_TYPE);
  }
  
  iBase_ErrorType result = iGeom_get_vtx_to_u( vtx, edge, *u );
  RETURN(result);
}
ITAPS_API void iGeom_getVtxToUV ( iGeom_Instance  instance,
iBase_EntityHandle  vertex_handle,
iBase_EntityHandle  face_handle,
double *  u,
double *  v,
int *  err 
)

Return parametric coordinates on face of vertex position.

Return parametric coordinates on face of vertex position

Parameters:
instanceiGeom instance handle
vertex_handleVertex being queried
face_handleFace being queried
uCorresponding parametric position on face
vCorresponding parametric position on face
*errPointer to error type returned from function

Definition at line 5137 of file iGeom_CGMA.cc.

{
  RefVertex* vtx = dynamic_cast<RefVertex*>((RefEntity*)vertex_handle);
  RefFace* face = dynamic_cast<RefFace*>((RefEntity*)face_handle);
  if (!vtx || !face) {
    RETURN(iBase_INVALID_ENTITY_TYPE);
  }

  iBase_ErrorType result = iGeom_get_vtx_to_uv( vtx, face, *u, *v );
  RETURN(result);
}  
ITAPS_API void iGeom_imprintEnts ( iGeom_Instance  instance,
iBase_EntityHandle const *  geom_entities,
int  geom_entities_size,
int *  err 
)

Imprint entities.

Imprint entities by merging coincident surfaces.

Parameters:
instanceiGeom instance handle
geom_entitiesArray of entity handles being imprinted
geom_entities_sizeNumber of entities in geom_entities array
*errPointer to error type returned from function

Definition at line 6450 of file iGeom_CGMA.cc.

{
  if (gentity_handles_size < 1) // GMT::imprint segfaults if passed an empty list
    RETURN(iBase_SUCCESS);

  DLIList<Body*> bods;
  DLIList<RefVolume*> vols, temp_vols;
  RefEntity* const* handle_array = ENTITY_HANDLE_CONST_ARRAY(gentity_handles);
  CubitStatus status = CUBIT_SUCCESS;
  for (int i = 0; i < gentity_handles_size; i++) {
    Body *temp_bod = dynamic_cast<Body*>(handle_array[i]);
    if (NULL != temp_bod) {
      bods.append_unique(temp_bod);
      continue;
    }
    
    RefVolume *temp_vol = dynamic_cast<RefVolume*>(handle_array[i]);
    if (NULL != temp_vol) {
      TopologyEntity *topo_ent = dynamic_cast<TopologyEntity*>(handle_array[i]);
      if (NULL == topo_ent) {
        status = CUBIT_FAILURE;
        continue;
      }
      temp_bod = topo_ent->body();
      if (NULL == temp_bod) {
        status = CUBIT_FAILURE;
        continue;
      }
      bods.append_unique(temp_bod);
      continue;
    }

      // if we've gotten here, it's an error
    status = CUBIT_FAILURE;
  }
  
  if (CUBIT_SUCCESS != status) RETURN(iBase_FAILURE);

  DLIList<Body*> temp_bods;
  status = GeometryModifyTool::instance()->imprint(bods, temp_bods, false);
  
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_initEntArrIter ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set_handle,
int  requested_entity_type,
int  requested_array_size,
iBase_EntityArrIterator entArr_iterator,
int *  err 
)

Initialize an array iterator over specified entity type and size.

Initialize an array iterator over specified entity type and size for a specified set or instance. Iterator returned can be used as input to functions returning entities for the iterator. If all entities of a specified type are to be iterated, specify iBase_ALL_TYPES. Specified type must be a value in the iBase_EntityType enumerations.

Parameters:
instanceiGeom instance handle
entity_set_handleEntity set being iterated
requested_entity_typeType of entity to iterate
requested_array_sizeSize of chunks of handles returned for each value of the iterator
entArr_iteratorPointer to iterator returned from function
*errPointer to error type returned from function

Definition at line 871 of file iGeom_CGMA.cc.

{
  DLIList<RefEntity*> entities;
  if (RefGroup* group = reinterpret_cast<RefGroup*>(entity_set_handle)) {
    DLIList<CubitEntity*> centities;
    group->get_child_entities( centities );
    append_ibase_type( type, centities, entities, err );
  }
  else {
    append_all_ibase_type( type, entities, err );
  }
  
  if (*err == iBase_SUCCESS) {
    CGMAIterator* iter = new CGMAIterator(entities, requested_array_size);
    *entArr_iterator = reinterpret_cast<iBase_EntityArrIterator>(iter);
  }
}
ITAPS_API void iGeom_initEntIter ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set_handle,
const int  dimension,
iBase_EntityIterator iterator,
int *  err 
)

Initialize an iterator over specified entity type.

Initialize an iterator over gentities of a specified dimension.

Parameters:
gentity_dimensionDimension of gentities to be iterated over
gentity_iteratorIterator initialized by this function

Definition at line 859 of file iGeom_CGMA.cc.

{
  iGeom_initEntArrIter( instance, entity_set_handle, dimension, 1, 
                        reinterpret_cast<iBase_EntityArrIterator*>(iterator), 
                        err );
}
ITAPS_API void iGeom_intersect ( iGeom_Instance  instance,
iBase_EntitySetHandle  entity_set_1,
iBase_EntitySetHandle  entity_set_2,
iBase_EntitySetHandle result_entity_set,
int *  err 
)

Intersect contents of one entity set with another.

Intersect gentity_set_1 and gentity_set_2; the result is returned in gentity_set_1. If both are multisets and both contain 2 entries of gentity k, the intersection contains 2 entries as well.

Definition at line 5759 of file iGeom_CGMA.cc.

{
  const RefGroup *set1 = SET_HANDLE(entity_set_1);
  const RefGroup *set2 = SET_HANDLE(entity_set_2);
  RefGroup *set3 = SET_HANDLE(*result_entity_set);
  if (NULL == set3) {
    set3 = RefEntityFactory::instance()->construct_RefGroup();
    *result_entity_set = reinterpret_cast<iBase_EntitySetHandle>(set3);
  }

  const_cast<RefGroup*>(set1)->intersect(const_cast<RefGroup*>(set2), set3);
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_intersectEnts ( iGeom_Instance  instance,
iBase_EntityHandle  entity2,
iBase_EntityHandle  entity1,
iBase_EntityHandle geom_entity,
int *  err 
)

Geometrically intersect a pair of entities.

Geometrically intersect a pair of entities.

Parameters:
instanceiGeom instance handle
entity1The entity to intersect
entity2The entity to intersect
geom_entityPointer to new entity handle returned from function
*errPointer to error type returned from function

Definition at line 6349 of file iGeom_CGMA.cc.

{
  Body *this_ent1 = dynamic_cast<Body*>(ENTITY_HANDLE(ent1));
  Body *ent1_copy = gmt->copy_body(this_ent1);
  if (NULL == ent1_copy) {
    ERROR(iBase_FAILURE, "Trouble copying blank.");
  }
  Body *this_ent2 = dynamic_cast<Body*>(ENTITY_HANDLE(ent2));
  Body *ent2_copy = gmt->copy_body(this_ent2);
  if (NULL == ent2_copy) {
    ERROR(iBase_FAILURE, "Trouble copying tool.");
    gqt->delete_RefEntity(ent1_copy);
    RETURN(iBase_FAILURE);
  }

  DLIList<Body*> ent1_list, new_body_list;
  ent1_list.append(ent1_copy);
  
  RefEntity *new_body = NULL;
  CubitStatus result = gmt->intersect(ent2_copy, ent1_list, new_body_list);
  if (CUBIT_SUCCESS != result || 0 == new_body_list.size()) {
    ERROR(iBase_FAILURE, "Intersect failed.");
  }
  else {
    new_body = new_body_list.get();
    *geom_entity = reinterpret_cast<iBase_EntityHandle>(new_body);
    gqt->delete_RefEntity(this_ent2);
    gqt->delete_RefEntity(this_ent1);
  }

  RETURN(iBase_SUCCESS);
}
static bool iGeom_is_face_degenerate ( RefFace face) [static]

Definition at line 7153 of file iGeom_CGMA.cc.

{
  double param = 0;
  CubitBoolean b1 = face->is_singular_in_U(param);
  CubitBoolean b2 = face->is_singular_in_V(param);
  return b1 || b2;
}
static int iGeom_is_parametric ( RefEntity entity) [static]

Definition at line 7080 of file iGeom_CGMA.cc.

{
  if (RefFace* face = dynamic_cast<RefFace*>(entity))
    return face->is_parametric();
  else if (dynamic_cast<RefEdge*>(entity))
    return true;
  else
    return false;
}
static CubitStatus iGeom_is_periodic ( RefEntity entity,
int &  u,
int &  v 
) [static]

Definition at line 7134 of file iGeom_CGMA.cc.

{
  if (RefEdge* edge = dynamic_cast<RefEdge*>(entity)) {
    u = edge->is_periodic();
    v = CUBIT_FALSE;
  }
  else if (RefFace* face = dynamic_cast<RefFace*>(entity)) {
    double period;
    u = face->is_periodic_in_U(period);
    v = face->is_periodic_in_V(period);
  }
  else {
    u = v = CUBIT_FALSE;
  }
  
  return CUBIT_SUCCESS;
}
ITAPS_API void iGeom_isArrAdj ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles_1,
int  entity_handles_1_size,
iBase_EntityHandle const *  entity_handles_2,
int  entity_handles_2_size,
int **  is_adjacent_info,
int *  is_adjacent_info_allocated,
int *  is_adjacent_info_size,
int *  err 
)

Return whether entity pairs are adjacent.

Return whether entity pairs are adjacent, i.e. if entity_handles_1[i] is adjacent to entity_handles_2[i]. This function requires entity_handles_1_size and entity_handles_2_size to be equal.

Parameters:
instanceiGeom instance handle
entity_handles_1First array of entities
entity_handles_1_sizeNumber of entities in first array
entity_handles_2Second array of entities
entity_handles_2_sizeNumber of entities in second array
is_adjacent_infoArray of flags returned from function
is_adjacent_info_allocatedAllocated size of flags array
is_adjacent_info_sizeOccupied size of flags array
*errPointer to error type returned from function

Definition at line 1450 of file iGeom_CGMA.cc.

{
  RefEntity **list_1_iter = (RefEntity**)entity_handles_1, 
    **list_2_iter = (RefEntity**)entity_handles_2;
  size_t list_1_step, list_2_step;
  int count;
    // If either list contains only 1 entry, compare that entry with
    // every entry in the other list.
  if (entity_handles_1_size == entity_handles_2_size) {
    list_1_step = list_2_step = 1;
    count = entity_handles_1_size;
  }
  else if (entity_handles_1_size == 1) {
    list_1_step = 0;
    list_2_step = 1;
    count = entity_handles_2_size;
  }
  else if (entity_handles_2_size == 1) {
    list_1_step = 1;
    list_2_step = 0;
    count = entity_handles_1_size;
  }
  else {
    RETURN(iBase_INVALID_ENTITY_COUNT);
  }
  
  ALLOC_CHECK_ARRAY_NOFAIL(is_adjacent_info, count);
  for (int i = 0; i < count; ++i)
  {
    TopologyEntity* ent1 = dynamic_cast<TopologyEntity*>(*list_1_iter);
    TopologyEntity* ent2 = dynamic_cast<TopologyEntity*>(*list_2_iter);
    (*is_adjacent_info)[i] = ent1->is_directly_related(ent2);
    list_1_iter += list_1_step;
    list_2_iter += list_2_step;
  }
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_isArrParametric ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int **  is_parametric,
int *  is_parametric_allocated,
int *  is_parametric_size,
int *  err 
)

Return whether entities have parameterizations.

Return whether entities have parameterizations (=1) or not (=0)

Parameters:
instanceiGeom instance handle
entity_handlesEntities being queried
entity_handles_sizeNumber of entities being queried
is_parametricentity_handles[i] has a parameterization (=1) or not (=0)
is_parametric_allocatedAllocated size of is_parametric array
is_parametric_sizeOccupied size of is_parametric array
*errPointer to error type returned from function

Definition at line 4385 of file iGeom_CGMA.cc.

{
  ALLOC_CHECK_ARRAY_NOFAIL( is_parametric, entity_handles_size );
  RefEntity** const ent_array = (RefEntity**)entity_handles;
  for (int i = 0; i < entity_handles_size; ++i)
    (*is_parametric)[i] = iGeom_is_parametric( ent_array[i] );
  RETURN(iBase_SUCCESS);
}
ITAPS_API void iGeom_isArrPeriodic ( iGeom_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int **  in_uv,
int *  in_uv_allocated,
int *  in_uv_size,
int *  err 
)

Return whether entities are periodic.

Return whether entities are periodic (=1) or not (=0) in the u and v directions.

Parameters:
instanceiGeom instance handle
entity_handlesEntities being queried
entity_handles_sizeNumber of entities being queried
in_uvArray of pairs of integers representing whether entity_handles[i] is periodic (=1) or not (=0) in u and v directions
in_uv_allocatedAllocated size of in_uv array
in_uv_sizeOccupied size of in_uv array
*errPointer to error type returned from function

Definition at line 5672 of file iGeom_CGMA.cc.

{
  ALLOC_CHECK_ARRAY( in_uv, 2*entity_handles_size );
  RefEntity** ents = (RefEntity**)entity_handles;
  for (int i = 0; i < entity_handles_size; ++i) {
    CubitStatus s = iGeom_is_periodic( ents[i], (*in_uv)[2*i], (*in_uv)[2*i+1] );
    if (s != CUBIT_SUCCESS) {
      RETURN(iBase_FAILURE);
    }
  }
  KEEP_ARRAY(in_uv);
  RETURN(iBase_SUCCESS);
}