[MOAB-dev] r3539 - in MOAB/trunk: . tools tools/iGeom

hongjun at mcs.anl.gov hongjun at mcs.anl.gov
Fri Feb 12 00:53:14 CST 2010


Author: hongjun
Date: 2010-02-12 00:53:14 -0600 (Fri, 12 Feb 2010)
New Revision: 3539

Added:
   MOAB/trunk/tools/iGeom/
   MOAB/trunk/tools/iGeom/GeomTopoUtil.cpp
   MOAB/trunk/tools/iGeom/GeomTopoUtil.hpp
   MOAB/trunk/tools/iGeom/Makefile.am
   MOAB/trunk/tools/iGeom/brick.stp
   MOAB/trunk/tools/iGeom/iBase.h
   MOAB/trunk/tools/iGeom/iBase_f.h
   MOAB/trunk/tools/iGeom/iGeom-Defs.inc.in
   MOAB/trunk/tools/iGeom/iGeom.h
   MOAB/trunk/tools/iGeom/iGeom_MOAB.cpp
   MOAB/trunk/tools/iGeom/iGeom_MOAB.hpp
   MOAB/trunk/tools/iGeom/iGeom_f.h
   MOAB/trunk/tools/iGeom/iGeom_protos.h
   MOAB/trunk/tools/iGeom/testgeom.cc
Modified:
   MOAB/trunk/GeomTopoTool.cpp
   MOAB/trunk/GeomTopoTool.hpp
   MOAB/trunk/configure.ac
Log:
o iGeom interface MOAB implementations are added (2/3 functions are implemented currently)
o Utility functions are added to GeomTopoTool.*pp to use obb tree functions outside iGeom_MOAB.cpp
o testgeom.cc is added for testing
o iGeom bild is disable in default


Modified: MOAB/trunk/GeomTopoTool.cpp
===================================================================
--- MOAB/trunk/GeomTopoTool.cpp	2010-02-11 20:36:21 UTC (rev 3538)
+++ MOAB/trunk/GeomTopoTool.cpp	2010-02-12 06:53:14 UTC (rev 3539)
@@ -86,9 +86,97 @@
   return MB_SUCCESS;
 }
 
+MBErrorCode GeomTopoTool::find_geomsets(MBRange *ranges) 
+{
+  //MBTag geom_tag;
+  MBErrorCode result = mdbImpl->tag_create(GEOM_DIMENSION_TAG_NAME, 4, 
+                                           MB_TAG_SPARSE, geomTag, NULL);
+  if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result)
+    return result;
+  
+    // get all sets with this tag
+  MBRange geom_sets;
+  result = mdbImpl->get_entities_by_type_and_tag(0, MBENTITYSET, &geomTag, NULL, 1,
+                                                 geom_sets);
+  if (MB_SUCCESS != result || geom_sets.empty()) 
+    return result;
 
+  result = separate_by_dimension(geom_sets, geomRanges, geomTag);
+  if (MB_SUCCESS != result)
+    return result;
+
+  if (ranges) {
+    for (int i = 0; i < 4; i++) ranges[i] = geomRanges[i];
+  }
   
+  return MB_SUCCESS;
+}
+
+MBErrorCode GeomTopoTool::construct_obb_trees()
+{
+  // get all surfaces and volumes
+  MBRange surfs, vols;
+  const int three = 3;
+  const void* const three_val[] = {&three};
+  MBErrorCode rval = mdbImpl->get_entities_by_type_and_tag(0, MBENTITYSET, &geomTag, 
+							   three_val, 1, vols);
+  if (MB_SUCCESS != rval) return rval;
+
+  const int two = 2;
+  const void* const two_val[] = {&two};
+  rval = mdbImpl->get_entities_by_type_and_tag(0, MBENTITYSET, &geomTag, 
+					       two_val, 1, surfs);
+  if (MB_SUCCESS != rval) return rval;
+
+  // surf/vol offsets are just first handles
+  setOffset = (*surfs.begin() < *vols.begin() ? *surfs.begin() : *vols.begin());
+
+  // for surface
+  MBEntityHandle root;
+  rootSets.resize(surfs.size() + vols.size());
+  for (MBRange::iterator i = surfs.begin(); i != surfs.end(); ++i) {
+    MBRange tris;
+    rval = mdbImpl->get_entities_by_dimension( *i, 2, tris );
+    if (MB_SUCCESS != rval) return rval;
+    
+    if (tris.empty()) {
+      std::cerr << "WARNING: Surface has no facets." << std::endl;
+    }
+
+    rval = obbTree.build( tris, root );
+    if (MB_SUCCESS != rval) return rval;
+
+    rval = mdbImpl->add_entities( root, &*i, 1 );
+    if (MB_SUCCESS != rval) return rval;
+
+    rootSets[*i - setOffset] = root;
+  }
   
+  // for volumes
+  for (MBRange::iterator i = vols.begin(); i != vols.end(); ++i) {
+    // get all surfaces in volume
+    MBRange tmp_surfs;
+    rval = mdbImpl->get_child_meshsets( *i, tmp_surfs );
+    if (MB_SUCCESS != rval) return rval;
+    
+    // get OBB trees for each surface
+    MBRange trees;
+    for (MBRange::iterator j = tmp_surfs.begin();  j != tmp_surfs.end(); ++j) {
+      rval = get_root(*j, root);
+      if (MB_SUCCESS != rval || !root) return MB_FAILURE;
+      trees.insert( root );
+    }
+    
+    // build OBB tree for volume
+    rval = obbTree.join_trees( trees, root );
+    if (MB_SUCCESS != rval) return rval;
+
+    rootSets[*i - setOffset] = root;
+  }
+
+  return MB_SUCCESS;
+} 
+  
     //! Restore parent/child links between GEOM_TOPO mesh sets
 MBErrorCode GeomTopoTool::restore_topology() 
 {
@@ -274,6 +362,5 @@
   
   return result;
 }
-
+ 
   
-  

Modified: MOAB/trunk/GeomTopoTool.hpp
===================================================================
--- MOAB/trunk/GeomTopoTool.hpp	2010-02-11 20:36:21 UTC (rev 3538)
+++ MOAB/trunk/GeomTopoTool.hpp	2010-02-12 06:53:14 UTC (rev 3539)
@@ -19,12 +19,13 @@
 #define GEOM_TOPO_TOOL_HPP
 
 #include "MBForward.hpp"
+#include "MBRange.hpp"
+#include "MBOrientedBoxTreeTool.hpp"
 
 class GeomTopoTool
 {
 public:
-  GeomTopoTool(MBInterface *impl) : mdbImpl(impl), sense2Tag(0) {}
-  
+  GeomTopoTool(MBInterface *impl, bool find_geoments = false);
   ~GeomTopoTool() {}
   
     //! Restore parent/child links between GEOM_TOPO mesh sets
@@ -42,20 +43,54 @@
                          MBEntityHandle volume,
                          bool& forward );
 
+  MBErrorCode find_geomsets(MBRange *ranges = NULL);
+
+  MBErrorCode construct_obb_trees();
+
+  MBErrorCode get_root(MBEntityHandle vol_or_surf, MBEntityHandle &root);
+
+  MBOrientedBoxTreeTool *obb_tree() {return &obbTree;}
+
 private:
   MBInterface *mdbImpl;
   MBTag sense2Tag;
+  MBTag geomTag;
+  MBRange geomRanges[4];
+
+  MBOrientedBoxTreeTool obbTree;
+  MBEntityHandle setOffset;
+  std::vector<MBEntityHandle> rootSets;
   
     //! compute vertices inclusive and put on tag on sets in geom_sets
   MBErrorCode construct_vertex_ranges(const MBRange &geom_sets,
-                                       const MBTag verts_tag);
+				      const MBTag verts_tag);
   
     //! given a range of geom topology sets, separate by dimension
   MBErrorCode separate_by_dimension(const MBRange &geom_sets,
-                                     MBRange *entities, MBTag geom_tag = 0);
+				    MBRange *entities, MBTag geom_tag = 0);
+
+  //MBErrorCode construct_obb_trees(MBEntityHandle& offset,
+  //			  MBRange& rootSets,
+  //			  MBOrientedBoxTreeTool& obbTree);
   
+  
+  
 };
 
+inline GeomTopoTool::GeomTopoTool(MBInterface *impl, 
+                                  bool find_geoments) 
+  : mdbImpl(impl), obbTree(impl), sense2Tag(0) 
+{
+  if (find_geoments) find_geomsets();
+}
 
+// get the root of the obbtree for a given entity
+inline MBErrorCode GeomTopoTool::get_root(MBEntityHandle vol_or_surf, MBEntityHandle &root) 
+{
+  unsigned int index = vol_or_surf - setOffset;
+  root = (index < rootSets.size() ? rootSets[index] : 0);
+  return (root ? MB_SUCCESS : MB_INDEX_OUT_OF_RANGE);
+}
+
 #endif
 

Modified: MOAB/trunk/configure.ac
===================================================================
--- MOAB/trunk/configure.ac	2010-02-11 20:36:21 UTC (rev 3538)
+++ MOAB/trunk/configure.ac	2010-02-12 06:53:14 UTC (rev 3539)
@@ -41,6 +41,34 @@
 esac
 
 ################################################################################
+#                           iGeom Part 1 of 3
+################################################################################
+
+CONFIGURE_FORTRAN=no
+FORCE_ENABLE_IGEOM=no
+AC_ARG_ENABLE( [igeom],
+[AC_HELP_STRING([--enable-igeom(=nofortran)],[Build iGeom interface.  If optional
+'nofortran' argument is given, support for FORTRAN name mangling will be disabled.])
+AC_HELP_STRING([--disable-igeom],[Don't build support for iGeom interface (default).])],
+[enableval="$enableval"],[enableval=no] )
+
+case $enableval in
+  yes)
+    ENABLE_igeom=yes
+    CONFIGURE_FORTRAN=yes
+    ;;
+  nofortran|NoFortran|noFORTRAN|NoFORTRAN|Nofortran)
+    ENABLE_igeom=yes
+    ;;
+  no)
+    ENABLE_igeom=no
+    ;;
+  *)
+    AC_MSG_ERROR([Invalid argument to --enable-igeom : $enableval])
+    ;;
+esac
+
+################################################################################
 #                           Compilers
 ################################################################################
 
@@ -152,6 +180,35 @@
 fi
 
 ################################################################################
+#                           iGeom Part 2 of 3
+################################################################################
+
+# The iGeom option must be checked before configuring the compilers
+# so that we know if we need Fortran.  This stuff has to be done
+# after configuring the compilers so that we know what size of 
+# various types are.
+
+AC_MSG_CHECKING([size of MBEntityHandle])
+AC_MSG_RESULT([$SIZEOF_MBENTITYHANDLE])
+IGEOM_VALID_HANDLE_SIZE=yes
+if test $SIZEOF_VOID_P -ne $SIZEOF_MBENTITYHANDLE; then
+  IMESH_VALID_HANDLE_SIZE=no
+  AC_MSG_WARN([Cannot build iMesh API because sizeof(MBEntityHandle) != sizeof(void*)])
+  if test "x$FORCE_ENABLE_IGEOM" = "xno"; then
+    ENABLE_igeom=no
+  fi
+fi
+
+AC_MSG_CHECKING([if iGeom support is to be built])
+AC_MSG_RESULT([$ENABLE_igeom])
+AM_CONDITIONAL([ENABLE_igeom],[test "xyes" = "x$ENABLE_igeom"])
+if test "x$ENABLE_igeom" = "xyes"; then
+  if test "x$IGEOM_VALID_HANDLE_SIZE" != "xyes"; then
+    AC_MSG_ERROR([Cannot build iGeom API with sizeof(MBEntityHandle) != sizeof(void*)])
+  fi
+fi
+
+################################################################################
 #                              Version Stuff
 ################################################################################
 
@@ -973,6 +1030,8 @@
                  tools/iMesh/SIDL/iMesh-SIDL-Defs.inc
                  tools/iMesh/SIDL/Makefile
                  tools/iMesh/SIDL/common.make
+		 tools/iGeom/Makefile
+                 tools/iGeom/iGeom-Defs.inc
                  tools/mbperf/Makefile
                  tools/mbchaco/Makefile
                  tools/mbcoupler/Makefile

Added: MOAB/trunk/tools/iGeom/GeomTopoUtil.cpp
===================================================================
--- MOAB/trunk/tools/iGeom/GeomTopoUtil.cpp	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/GeomTopoUtil.cpp	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,288 @@
+/**
+ * MOAB, a Mesh-Oriented datABase, is a software component for creating,
+ * storing and accessing finite element mesh data.
+ * 
+ * Copyright 2004 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.
+ * 
+ */
+
+#include "GeomTopoUtil.hpp"
+#include "MBRange.hpp"
+#include "MBTagConventions.hpp"
+#include "MBInterface.hpp"
+#include "MBCN.hpp"
+#include "MBInternals.hpp"
+#include <assert.h>
+#include <iostream>
+
+// Tag name used for saving sense of faces in volumes.
+// We assume that the surface occurs in at most two volumes.
+// Code will error out if more than two volumes per surface.
+// The tag data is a pair of tag handles, representing the
+// forward and reverse volumes, respectively.  If a surface
+// is non-manifold in a single volume, the same volume will
+// be listed for both the forward and reverse slots.
+const char GEOM_SENSE_TAG_NAME[] = "GEOM_SENSE_2";
+
+MBErrorCode GeomTopoUtil::set_sense( MBEntityHandle surface,
+                                     MBEntityHandle volume,
+                                     bool forward )
+{
+  MBErrorCode rval;
+  if (!sense2Tag) {
+    rval = mdbImpl->tag_create( GEOM_SENSE_TAG_NAME, 2*sizeof(MBEntityHandle), 
+                           MB_TAG_SPARSE, MB_TYPE_HANDLE, 
+                           sense2Tag, 0, true );
+    if (MB_SUCCESS != rval)
+      return rval;
+  }
+  
+  MBEntityHandle sense_data[2] = {0,0};
+  rval = mdbImpl->tag_get_data( sense2Tag, &surface, 1, sense_data );
+  if (MB_TAG_NOT_FOUND != rval && MB_SUCCESS != rval)
+    return MB_FAILURE;
+  
+  if (sense_data[!forward] == volume)
+    return MB_SUCCESS;
+  else if (sense_data[!forward])
+    return MB_MULTIPLE_ENTITIES_FOUND;
+  
+  sense_data[!forward] = volume;
+  return mdbImpl->tag_set_data( sense2Tag, &surface, 1, sense_data );
+}
+
+MBErrorCode GeomTopoUtil::get_sense( MBEntityHandle surface,
+                                     MBEntityHandle volume,
+                                     bool& forward )
+{
+  MBErrorCode rval;
+  if (!sense2Tag) {
+    rval = mdbImpl->tag_get_handle( GEOM_SENSE_TAG_NAME, sense2Tag );
+    if (MB_SUCCESS != rval) {
+      sense2Tag = 0;
+      return MB_FAILURE;
+    }
+  }
+  
+  MBEntityHandle sense_data[2] = {0,0};
+  rval = mdbImpl->tag_get_data( sense2Tag, &surface, 1, sense_data );
+  if (MB_SUCCESS != rval)
+    return rval;
+  
+  if (sense_data[0] == volume)
+    forward = true;
+  else if (sense_data[1] == volume)
+    forward = false;
+  else
+    return MB_ENTITY_NOT_FOUND;
+  
+  return MB_SUCCESS;
+}
+
+MBErrorCode GeomTopoUtil::find_geomsets(MBRange *ranges) 
+{
+  MBTag geom_tag;
+  MBErrorCode result = mdbImpl->tag_create(GEOM_DIMENSION_TAG_NAME, 4, 
+                                           MB_TAG_SPARSE, geom_tag, NULL);
+  if (MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result)
+    return result;
+  
+    // get all sets with this tag
+  MBRange geom_sets;
+  result = mdbImpl->get_entities_by_type_and_tag(0, MBENTITYSET, &geom_tag, NULL, 1,
+                                                 geom_sets);
+  if (MB_SUCCESS != result || geom_sets.empty()) 
+    return result;
+
+  result = separate_by_dimension(geom_sets, geomRanges, geom_tag);
+  if (MB_SUCCESS != result)
+    return result;
+
+  if (ranges) {
+    for (int i = 0; i < 4; i++) ranges[i] = geomRanges[i];
+  }
+  
+  return MB_SUCCESS;
+}
+  
+    //! Restore parent/child links between GEOM_TOPO mesh sets
+MBErrorCode GeomTopoUtil::restore_topology() 
+{
+  
+    // look for geometric topology sets and restore parent/child links between them
+    // algorithm:
+    // - for each entity of dimension d=D-1..0:
+    //   . get d-dimensional entity in entity
+    //   . get all (d+1)-dim adjs to that entity
+    //   . for each geom entity if dim d+1, if it contains any of the ents,
+    //     add it to list of parents
+    //   . make parent/child links with parents
+
+  MBRange entities[4];
+  result = find_geomsets(entities);
+  if (MB_SUCCESS != result)
+    return result;
+
+  std::vector<MBEntityHandle> parents;
+  MBRange tmp_parents;
+  
+    // loop over dimensions
+  for (int dim = 2; dim >= 0; dim--) {
+      // mark entities of next higher dimension with their owners; regenerate tag
+      // each dimension so prev dim's tag data goes away
+    MBTag owner_tag;
+    MBEntityHandle dum_val = 0;
+    result = mdbImpl->tag_create("__owner_tag", sizeof(MBEntityHandle), MB_TAG_DENSE,
+                                 MB_TYPE_HANDLE, owner_tag, &dum_val);
+    if (MB_SUCCESS != result) continue;
+    MBRange dp1ents;
+    std::vector<MBEntityHandle> owners;
+    for (MBRange::iterator rit = entities[dim+1].begin(); rit != entities[dim+1].end(); rit++) {
+      dp1ents.clear();
+      result = mdbImpl->get_entities_by_dimension(*rit, dim+1, dp1ents);
+      if (MB_SUCCESS != result) continue;
+      owners.resize(dp1ents.size());
+      std::fill(owners.begin(), owners.end(), *rit);
+      result = mdbImpl->tag_set_data(owner_tag, dp1ents, &owners[0]);
+      if (MB_SUCCESS != result) continue;
+    }
+    
+    for (MBRange::iterator d_it = entities[dim].begin(); 
+         d_it != entities[dim].end(); d_it++) {
+      MBRange dents;
+      result = mdbImpl->get_entities_by_dimension(*d_it, dim, dents);
+      if (MB_SUCCESS != result) continue;
+      if (dents.empty()) continue;
+      
+        // get (d+1)-dimensional adjs
+      dp1ents.clear();
+      result = mdbImpl->get_adjacencies(&(*dents.begin()), 1, dim+1, 
+                                        false, dp1ents);
+      if (MB_SUCCESS != result || dp1ents.empty()) continue;
+
+        // get owner tags
+      parents.resize(dp1ents.size());
+      result = mdbImpl->tag_get_data(owner_tag, dp1ents, &parents[0]);
+      assert(MB_TAG_NOT_FOUND != result);
+      if (MB_SUCCESS != result) continue;
+      
+        // compress to a range to remove duplicates
+      tmp_parents.clear();
+      std::copy(parents.begin(), parents.end(), mb_range_inserter(tmp_parents));
+      for (MBRange::iterator pit = tmp_parents.begin(); pit != tmp_parents.end(); pit++) {
+        result = mdbImpl->add_parent_child(*pit, *d_it);
+        if (MB_SUCCESS != result) return result;
+      }
+      
+        // store surface senses
+      if (dim != 2) 
+        continue;
+      const MBEntityHandle *conn3, *conn2;
+      int len3, len2, err, num, sense, offset;
+      for (size_t i = 0; i < parents.size(); ++i) {
+        result = mdbImpl->get_connectivity( dp1ents[i], conn3, len3, true );
+        if (MB_SUCCESS != result) return result;
+        result = mdbImpl->get_connectivity( dents.front(), conn2, len2, true );
+        if (MB_SUCCESS != result) return result;
+        assert(len2 <= 4);
+        err = MBCN::SideNumber( TYPE_FROM_HANDLE(dp1ents[i]), conn3,
+                                conn2, len2, dim, num, sense, offset );
+        if (err)
+          return MB_FAILURE;
+        
+        result = set_sense( *d_it, parents[i], sense == 1 );
+        if (MB_MULTIPLE_ENTITIES_FOUND == result) {
+          std::cerr << "Warning: Multiple volumes use surface with same sense." << std::endl
+                    << "         Some geometric sense data lost." << std::endl;
+        }
+        else if (MB_SUCCESS != result) {
+          return result;
+        }
+      }
+    }
+    
+      // now delete owner tag on this dimension, automatically removes tag data
+    result = mdbImpl->tag_delete(owner_tag);
+    if (MB_SUCCESS != result) return result;
+    
+  } // dim
+
+  return result;
+}
+
+MBErrorCode GeomTopoUtil::separate_by_dimension(const MBRange &geom_sets,
+                                                 MBRange *entities, MBTag geom_tag) 
+{
+  MBErrorCode result;
+  
+  if (0 == geom_tag) {
+    
+    result = mdbImpl->tag_get_handle(GEOM_DIMENSION_TAG_NAME, geom_tag);
+    if (MB_SUCCESS != result)
+      return result;
+  }
+
+    // get the data for those tags
+  std::vector<int> tag_vals(geom_sets.size());
+  result = mdbImpl->tag_get_data(geom_tag, geom_sets, &tag_vals[0]);
+  if (MB_SUCCESS != result)
+    return result;
+
+  MBRange::const_iterator git;
+  std::vector<int>::iterator iit;
+  
+  for (git = geom_sets.begin(), iit = tag_vals.begin(); git != geom_sets.end(); 
+       git++, iit++) {
+    if (0 <= *iit && 3 >= *iit) 
+      entities[*iit].insert(*git);
+    else {
+        // assert(false);
+        // do nothing for now
+    }
+  }
+  
+  return MB_SUCCESS;
+}
+
+MBErrorCode GeomTopoUtil::construct_vertex_ranges(const MBRange &geom_sets,
+                                                   const MBTag verts_tag) 
+{
+    // construct the vertex range for each entity and put on that tag
+  MBRange *temp_verts, temp_elems;
+  MBErrorCode result = MB_SUCCESS;
+  for (MBRange::const_iterator it = geom_sets.begin(); it != geom_sets.end(); it++) {
+      // make the new range
+    temp_verts = new MBRange();
+    assert(NULL != temp_verts);
+    temp_elems.clear();
+    
+      // get all the elements in the set, recursively
+    result = mdbImpl->get_entities_by_handle(*it, temp_elems, true);
+    if (MB_SUCCESS != result) 
+      return result;
+    
+      // get all the verts of those elements; use get_adjacencies 'cuz it handles ranges better
+    result = mdbImpl->get_adjacencies(temp_elems, 0, false, *temp_verts,
+                                      MBInterface::UNION);
+    if (MB_SUCCESS != result) 
+      return result;
+
+      // store this range as a tag on the entity
+    result = mdbImpl->tag_set_data(verts_tag, &(*it), 1, &temp_verts);
+    if (MB_SUCCESS != result) 
+      return result;
+    
+  }
+  
+  return result;
+}
+
+  
+  

Added: MOAB/trunk/tools/iGeom/GeomTopoUtil.hpp
===================================================================
--- MOAB/trunk/tools/iGeom/GeomTopoUtil.hpp	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/GeomTopoUtil.hpp	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,69 @@
+/**
+ * MOAB, a Mesh-Oriented datABase, is a software component for creating,
+ * storing and accessing finite element mesh data.
+ * 
+ * Copyright 2004 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.
+ * 
+ */
+
+
+
+#ifndef GEOM_TOPO_UTIL_HPP
+#define GEOM_TOPO_UTIL_HPP
+
+#include "MBForward.hpp"
+#include "MBRange.hpp"
+
+class GeomTopoUtil
+{
+public:
+  GeomTopoUtil(MBInterface *impl, bool find_geoments = false);
+  ~GeomTopoUtil() {}
+  
+    //! Restore parent/child links between GEOM_TOPO mesh sets
+  MBErrorCode restore_topology();
+  
+    //! Store sense of surface relative to volume.
+    //!\return MB_MULTIPLE_ENTITIES_FOUND if surface already has a forward volume.
+    //!        MB_SUCCESS if successful
+    //!        otherwise whatever internal error code occured.
+  MBErrorCode set_sense( MBEntityHandle surface,
+                         MBEntityHandle volume,
+                         bool forward );
+
+  MBErrorCode get_sense( MBEntityHandle surface,
+                         MBEntityHandle volume,
+                         bool& forward );
+
+  MBErrorCode find_geomsets(MBRange *ranges = NULL);
+
+private:
+  MBInterface *mdbImpl;
+  MBTag sense2Tag;
+  MBRange geomRanges[4];
+  
+    //! compute vertices inclusive and put on tag on sets in geom_sets
+  MBErrorCode construct_vertex_ranges(const MBRange &geom_sets,
+                                       const MBTag verts_tag);
+  
+    //! given a range of geom topology sets, separate by dimension
+  MBErrorCode separate_by_dimension(const MBRange &geom_sets,
+                                     MBRange *entities, MBTag geom_tag = 0);
+};
+
+inline GeomTopoUtil::GeomTopoUtil(MBInterface *impl, 
+                                  bool find_geoments) 
+        : mdbImpl(impl), sense2Tag(0) 
+{
+  if (find_geoments) find_geomsets();
+}
+
+#endif
+

Added: MOAB/trunk/tools/iGeom/Makefile.am
===================================================================
--- MOAB/trunk/tools/iGeom/Makefile.am	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/Makefile.am	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,54 @@
+AUTOMAKE_OPTIONS = foreign
+BUILT_SOURCES = iGeom_protos.h
+
+IMESH_DIR = $(top_srcdir)/tools/iMesh
+INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I. -I$(IMESH_DIR)
+
+DEFS += $(DEFINES) -DSRCDIR=$(srcdir)
+
+lib_LTLIBRARIES = libiGeomMOAB.la
+
+libiGeomMOAB_la_includedir = $(includedir)
+
+#libiGeomMOAB_la_LIBADD = $(top_builddir)/libMOAB.la
+
+libiGeomMOAB_la_SOURCES = \
+	iGeom_MOAB.cpp 
+
+libiGeomMOAB_la_include_HEADERS = \
+	iBase.h \
+	iGeom.h \
+	iGeom_protos.h \
+	iBase_f.h \
+	iGeom_f.h
+
+# stuff for c test program
+check_PROGRAMS = testgeom
+testgeom_SOURCES = testgeom.cc
+testgeom_DEPENDENCIES = libiGeomMOAB.la $(IMESH_DIR)/libiMesh.la $(top_builddir)/libMOAB.la
+testgeom_LDADD = libiGeomMOAB.la $(IMESH_DIR)/libiMesh.la $(top_builddir)/libMOAB.la ${MOAB_CXX_LINKFLAGS} ${MOAB_CXX_LIBS}
+
+# Automake doesn't seem to have a directory defined for
+# platform-dependent data (or include) files. So put 
+# in $(libdir).  Define a $(cfgdir) to get around automake's
+# check that only libraries are going in $(libdir)
+cfgdir = $(libdir)
+cfg_DATA = iGeom-Defs.inc
+
+# By default, moab.make will define these to $(srcdir).  We
+# want to override that during the INSTALL of the file so
+# that the correct values are set (e.g. if someone does 
+# 'make prefix=/foo install', we don't know the correct install
+# directory until we're doing the install.
+install-data-hook:
+	echo "IGEOM_DIR=${cfgdir}/.." >> $(DESTDIR)$(cfgdir)/iGeom-SIDL-Defs.inc
+	echo "IGEOM_INCLUDEDIR=${includedir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
+	echo "IGEOM_INCLUDEDIR2=" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
+	echo "IGEOM_LIBDIR=${libdir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
+	echo "MOAB_LIBDIR=${libdir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
+
+iGeom_protos.h: iGeom.h mkprotos.sh
+	$(srcdir)/mkprotos.sh iGeom MBCN $< $@ MBCN_FCDefs.h
+
+iGeom_FCDefs.h: iBase_FCDefs.h
+	cd ../.. && ./config.status tools/iGeom/iGeom_FCDefs.h
\ No newline at end of file

Added: MOAB/trunk/tools/iGeom/brick.stp
===================================================================
--- MOAB/trunk/tools/iGeom/brick.stp	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/brick.stp	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,214 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION( ( 'STEP AP203' ), '1' );
+FILE_NAME( 'brick.stp', '  ', ( '  ' ), ( '  ' ), 'XStep 1.0', '  ', '  ' );
+FILE_SCHEMA( ( 'CONFIG_CONTROL_DESIGN' ) );
+ENDSEC;
+DATA;
+#1 = DESIGN_CONTEXT( '', #27, 'design' );
+#2 = APPLICATION_PROTOCOL_DEFINITION( 'INTERNATIONAL STANDARD', 'config_control_design', 1994, #27 );
+#3 = PRODUCT_CATEGORY_RELATIONSHIP( 'NONE', 'NONE', #28, #29 );
+#4 = DATE_AND_TIME( #30, #31 );
+#5 = DATE_TIME_ROLE( 'creation_date' );
+#6 = DATE_TIME_ROLE( 'classification_date' );
+#7 = PERSON_AND_ORGANIZATION_ROLE( 'creator' );
+#8 = PERSON_AND_ORGANIZATION_ROLE( 'design_supplier' );
+#9 = PERSON_AND_ORGANIZATION_ROLE( 'classification_officer' );
+#10 = PERSON_AND_ORGANIZATION_ROLE( 'design_owner' );
+#11 = APPROVAL_PERSON_ORGANIZATION( #32, #33, #34 );
+#12 = APPROVAL_DATE_TIME( #4, #33 );
+#13 = CC_DESIGN_APPROVAL( #33, ( #35, #36, #37 ) );
+#14 = CC_DESIGN_DATE_AND_TIME_ASSIGNMENT( #4, #5, ( #37 ) );
+#15 = CC_DESIGN_DATE_AND_TIME_ASSIGNMENT( #4, #6, ( #35 ) );
+#16 = CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT( #32, #10, ( #38 ) );
+#17 = CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT( #32, #7, ( #37 ) );
+#18 = CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT( #32, #7, ( #36 ) );
+#19 = CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT( #32, #8, ( #36 ) );
+#20 = CC_DESIGN_SECURITY_CLASSIFICATION( #35, ( #36 ) );
+#21 = CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT( #32, #9, ( #35 ) );
+#22 = SHAPE_DEFINITION_REPRESENTATION( #39, #40 );
+#23 =  ( GEOMETRIC_REPRESENTATION_CONTEXT( 3 )GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT( ( #43 ) )GLOBAL_UNIT_ASSIGNED_CONTEXT( ( #45, #46, #47 ) )REPRESENTATION_CONTEXT( 'NONE', 'WORKSPACE' ) );
+#27 = APPLICATION_CONTEXT( 'CONFIGURATION CONTROLLED 3D DESIGNS OF MECHANICAL PARTS AND ASSEMBLIES' );
+#28 = PRODUCT_CATEGORY( 'part', 'NONE' );
+#29 = PRODUCT_RELATED_PRODUCT_CATEGORY( 'detail', ' ', ( #38 ) );
+#30 = CALENDAR_DATE( 2009, 29, 9 );
+#31 = LOCAL_TIME( 15, 30, 51.0000000000000, #49 );
+#32 = PERSON_AND_ORGANIZATION( #50, #51 );
+#33 = APPROVAL( #52, 'SOLID MODEL' );
+#34 = APPROVAL_ROLE( 'APPROVED' );
+#35 = SECURITY_CLASSIFICATION( '', '', #53 );
+#36 = PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE( ' ', 'NONE', #38, .NOT_KNOWN. );
+#37 = PRODUCT_DEFINITION( 'NONE', 'NONE', #36, #1 );
+#38 = PRODUCT( '1', '1', 'PART-1-DESC', ( #54 ) );
+#39 = PRODUCT_DEFINITION_SHAPE( 'NONE', 'NONE', #37 );
+#40 = ADVANCED_BREP_SHAPE_REPRESENTATION( '1', ( #55, #56 ), #23 );
+#43 = UNCERTAINTY_MEASURE_WITH_UNIT( LENGTH_MEASURE( 1.00000000000000E-06 ), #45, '', '' );
+#45 =  ( CONVERSION_BASED_UNIT( 'MILLIMETRE', #59 )LENGTH_UNIT(  )NAMED_UNIT( #62 ) );
+#46 =  ( NAMED_UNIT( #64 )PLANE_ANGLE_UNIT(  )SI_UNIT( $, .RADIAN. ) );
+#47 =  ( NAMED_UNIT( #64 )SOLID_ANGLE_UNIT(  )SI_UNIT( $, .STERADIAN. ) );
+#49 = COORDINATED_UNIVERSAL_TIME_OFFSET( 6, 0, .BEHIND. );
+#50 = PERSON( '', 'UNSPECIFIED', $, $, $, $ );
+#51 = ORGANIZATION( 'UNSPECIFIED', 'UNSPECIFIED', 'UNSPECIFIED' );
+#52 = APPROVAL_STATUS( 'approved' );
+#53 = SECURITY_CLASSIFICATION_LEVEL( 'unclassified' );
+#54 = MECHANICAL_CONTEXT( '', #27, 'mechanical' );
+#55 = MANIFOLD_SOLID_BREP( '1', #70 );
+#56 = AXIS2_PLACEMENT_3D( '', #71, #72, #73 );
+#59 = LENGTH_MEASURE_WITH_UNIT( LENGTH_MEASURE( 1.00000000000000 ), #74 );
+#62 = DIMENSIONAL_EXPONENTS( 1.00000000000000, 0.00000000000000, 0.00000000000000, 0.00000000000000, 0.00000000000000, 0.00000000000000, 0.00000000000000 );
+#64 = DIMENSIONAL_EXPONENTS( 0.00000000000000, 0.00000000000000, 0.00000000000000, 0.00000000000000, 0.00000000000000, 0.00000000000000, 0.00000000000000 );
+#70 = CLOSED_SHELL( '', ( #75, #76, #77, #78, #79, #80 ) );
+#71 = CARTESIAN_POINT( '', ( 0.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#72 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, 1.00000000000000 ) );
+#73 = DIRECTION( '', ( 1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#74 =  ( NAMED_UNIT( #62 )LENGTH_UNIT(  )SI_UNIT( .MILLI., .METRE. ) );
+#75 = ADVANCED_FACE( '', ( #82 ), #83, .T. );
+#76 = ADVANCED_FACE( '', ( #84 ), #85, .F. );
+#77 = ADVANCED_FACE( '', ( #86 ), #87, .F. );
+#78 = ADVANCED_FACE( '', ( #88 ), #89, .F. );
+#79 = ADVANCED_FACE( '', ( #90 ), #91, .F. );
+#80 = ADVANCED_FACE( '', ( #92 ), #93, .F. );
+#82 = FACE_OUTER_BOUND( '', #94, .T. );
+#83 = PLANE( '', #95 );
+#84 = FACE_OUTER_BOUND( '', #96, .T. );
+#85 = PLANE( '', #97 );
+#86 = FACE_OUTER_BOUND( '', #98, .T. );
+#87 = PLANE( '', #99 );
+#88 = FACE_OUTER_BOUND( '', #100, .T. );
+#89 = PLANE( '', #101 );
+#90 = FACE_OUTER_BOUND( '', #102, .T. );
+#91 = PLANE( '', #103 );
+#92 = FACE_OUTER_BOUND( '', #104, .T. );
+#93 = PLANE( '', #105 );
+#94 = EDGE_LOOP( '', ( #106, #107, #108, #109 ) );
+#95 = AXIS2_PLACEMENT_3D( '', #110, #111, #112 );
+#96 = EDGE_LOOP( '', ( #113, #114, #115, #116 ) );
+#97 = AXIS2_PLACEMENT_3D( '', #117, #118, #119 );
+#98 = EDGE_LOOP( '', ( #120, #121, #122, #123 ) );
+#99 = AXIS2_PLACEMENT_3D( '', #124, #125, #126 );
+#100 = EDGE_LOOP( '', ( #127, #128, #129, #130 ) );
+#101 = AXIS2_PLACEMENT_3D( '', #131, #132, #133 );
+#102 = EDGE_LOOP( '', ( #134, #135, #136, #137 ) );
+#103 = AXIS2_PLACEMENT_3D( '', #138, #139, #140 );
+#104 = EDGE_LOOP( '', ( #141, #142, #143, #144 ) );
+#105 = AXIS2_PLACEMENT_3D( '', #145, #146, #147 );
+#106 = ORIENTED_EDGE( '', *, *, #148, .T. );
+#107 = ORIENTED_EDGE( '', *, *, #149, .T. );
+#108 = ORIENTED_EDGE( '', *, *, #150, .T. );
+#109 = ORIENTED_EDGE( '', *, *, #151, .T. );
+#110 = CARTESIAN_POINT( '', ( 0.00000000000000, 0.00000000000000, 5.00000000000000 ) );
+#111 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, 1.00000000000000 ) );
+#112 = DIRECTION( '', ( 1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#113 = ORIENTED_EDGE( '', *, *, #152, .T. );
+#114 = ORIENTED_EDGE( '', *, *, #153, .T. );
+#115 = ORIENTED_EDGE( '', *, *, #154, .T. );
+#116 = ORIENTED_EDGE( '', *, *, #155, .T. );
+#117 = CARTESIAN_POINT( '', ( 0.00000000000000, 0.00000000000000, -5.00000000000000 ) );
+#118 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, 1.00000000000000 ) );
+#119 = DIRECTION( '', ( 1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#120 = ORIENTED_EDGE( '', *, *, #156, .T. );
+#121 = ORIENTED_EDGE( '', *, *, #153, .F. );
+#122 = ORIENTED_EDGE( '', *, *, #157, .F. );
+#123 = ORIENTED_EDGE( '', *, *, #151, .F. );
+#124 = CARTESIAN_POINT( '', ( 0.00000000000000, -5.00000000000000, 0.00000000000000 ) );
+#125 = DIRECTION( '', ( 0.00000000000000, 1.00000000000000, -0.00000000000000 ) );
+#126 = DIRECTION( '', ( -0.00000000000000, 0.00000000000000, 1.00000000000000 ) );
+#127 = ORIENTED_EDGE( '', *, *, #158, .T. );
+#128 = ORIENTED_EDGE( '', *, *, #154, .F. );
+#129 = ORIENTED_EDGE( '', *, *, #156, .F. );
+#130 = ORIENTED_EDGE( '', *, *, #150, .F. );
+#131 = CARTESIAN_POINT( '', ( -5.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#132 = DIRECTION( '', ( 1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#133 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, -1.00000000000000 ) );
+#134 = ORIENTED_EDGE( '', *, *, #159, .T. );
+#135 = ORIENTED_EDGE( '', *, *, #155, .F. );
+#136 = ORIENTED_EDGE( '', *, *, #158, .F. );
+#137 = ORIENTED_EDGE( '', *, *, #149, .F. );
+#138 = CARTESIAN_POINT( '', ( 0.00000000000000, 5.00000000000000, 0.00000000000000 ) );
+#139 = DIRECTION( '', ( 0.00000000000000, -1.00000000000000, 0.00000000000000 ) );
+#140 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, -1.00000000000000 ) );
+#141 = ORIENTED_EDGE( '', *, *, #157, .T. );
+#142 = ORIENTED_EDGE( '', *, *, #152, .F. );
+#143 = ORIENTED_EDGE( '', *, *, #159, .F. );
+#144 = ORIENTED_EDGE( '', *, *, #148, .F. );
+#145 = CARTESIAN_POINT( '', ( 5.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#146 = DIRECTION( '', ( -1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#147 = DIRECTION( '', ( 0.00000000000000, -0.00000000000000, 1.00000000000000 ) );
+#148 = EDGE_CURVE( '', #160, #161, #162, .T. );
+#149 = EDGE_CURVE( '', #161, #163, #164, .T. );
+#150 = EDGE_CURVE( '', #163, #165, #166, .T. );
+#151 = EDGE_CURVE( '', #165, #160, #167, .T. );
+#152 = EDGE_CURVE( '', #168, #169, #170, .T. );
+#153 = EDGE_CURVE( '', #169, #171, #172, .T. );
+#154 = EDGE_CURVE( '', #171, #173, #174, .T. );
+#155 = EDGE_CURVE( '', #173, #168, #175, .T. );
+#156 = EDGE_CURVE( '', #165, #171, #176, .T. );
+#157 = EDGE_CURVE( '', #160, #169, #177, .T. );
+#158 = EDGE_CURVE( '', #163, #173, #178, .T. );
+#159 = EDGE_CURVE( '', #161, #168, #179, .T. );
+#160 = VERTEX_POINT( '', #180 );
+#161 = VERTEX_POINT( '', #181 );
+#162 = LINE( '', #182, #183 );
+#163 = VERTEX_POINT( '', #184 );
+#164 = LINE( '', #185, #186 );
+#165 = VERTEX_POINT( '', #187 );
+#166 = LINE( '', #188, #189 );
+#167 = LINE( '', #190, #191 );
+#168 = VERTEX_POINT( '', #192 );
+#169 = VERTEX_POINT( '', #193 );
+#170 = LINE( '', #194, #195 );
+#171 = VERTEX_POINT( '', #196 );
+#172 = LINE( '', #197, #198 );
+#173 = VERTEX_POINT( '', #199 );
+#174 = LINE( '', #200, #201 );
+#175 = LINE( '', #202, #203 );
+#176 = LINE( '', #204, #205 );
+#177 = LINE( '', #206, #207 );
+#178 = LINE( '', #208, #209 );
+#179 = LINE( '', #210, #211 );
+#180 = CARTESIAN_POINT( '', ( 5.00000000000000, -5.00000000000000, 5.00000000000000 ) );
+#181 = CARTESIAN_POINT( '', ( 5.00000000000000, 5.00000000000000, 5.00000000000000 ) );
+#182 = CARTESIAN_POINT( '', ( 5.00000000000000, 0.00000000000000, 5.00000000000000 ) );
+#183 = VECTOR( '', #212, 1.00000000000000 );
+#184 = CARTESIAN_POINT( '', ( -5.00000000000000, 5.00000000000000, 5.00000000000000 ) );
+#185 = CARTESIAN_POINT( '', ( 0.00000000000000, 5.00000000000000, 5.00000000000000 ) );
+#186 = VECTOR( '', #213, 1.00000000000000 );
+#187 = CARTESIAN_POINT( '', ( -5.00000000000000, -5.00000000000000, 5.00000000000000 ) );
+#188 = CARTESIAN_POINT( '', ( -5.00000000000000, 0.00000000000000, 5.00000000000000 ) );
+#189 = VECTOR( '', #214, 1.00000000000000 );
+#190 = CARTESIAN_POINT( '', ( 0.00000000000000, -5.00000000000000, 5.00000000000000 ) );
+#191 = VECTOR( '', #215, 1.00000000000000 );
+#192 = CARTESIAN_POINT( '', ( 5.00000000000000, 5.00000000000000, -5.00000000000000 ) );
+#193 = CARTESIAN_POINT( '', ( 5.00000000000000, -5.00000000000000, -5.00000000000000 ) );
+#194 = CARTESIAN_POINT( '', ( 5.00000000000000, 0.00000000000000, -5.00000000000000 ) );
+#195 = VECTOR( '', #216, 1.00000000000000 );
+#196 = CARTESIAN_POINT( '', ( -5.00000000000000, -5.00000000000000, -5.00000000000000 ) );
+#197 = CARTESIAN_POINT( '', ( 0.00000000000000, -5.00000000000000, -5.00000000000000 ) );
+#198 = VECTOR( '', #217, 1.00000000000000 );
+#199 = CARTESIAN_POINT( '', ( -5.00000000000000, 5.00000000000000, -5.00000000000000 ) );
+#200 = CARTESIAN_POINT( '', ( -5.00000000000000, 0.00000000000000, -5.00000000000000 ) );
+#201 = VECTOR( '', #218, 1.00000000000000 );
+#202 = CARTESIAN_POINT( '', ( 0.00000000000000, 5.00000000000000, -5.00000000000000 ) );
+#203 = VECTOR( '', #219, 1.00000000000000 );
+#204 = CARTESIAN_POINT( '', ( -5.00000000000000, -5.00000000000000, 0.00000000000000 ) );
+#205 = VECTOR( '', #220, 1.00000000000000 );
+#206 = CARTESIAN_POINT( '', ( 5.00000000000000, -5.00000000000000, 0.00000000000000 ) );
+#207 = VECTOR( '', #221, 1.00000000000000 );
+#208 = CARTESIAN_POINT( '', ( -5.00000000000000, 5.00000000000000, 0.00000000000000 ) );
+#209 = VECTOR( '', #222, 1.00000000000000 );
+#210 = CARTESIAN_POINT( '', ( 5.00000000000000, 5.00000000000000, 0.00000000000000 ) );
+#211 = VECTOR( '', #223, 1.00000000000000 );
+#212 = DIRECTION( '', ( 0.00000000000000, 1.00000000000000, 0.00000000000000 ) );
+#213 = DIRECTION( '', ( -1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#214 = DIRECTION( '', ( 0.00000000000000, -1.00000000000000, 0.00000000000000 ) );
+#215 = DIRECTION( '', ( 1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#216 = DIRECTION( '', ( 0.00000000000000, -1.00000000000000, 0.00000000000000 ) );
+#217 = DIRECTION( '', ( -1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#218 = DIRECTION( '', ( 0.00000000000000, 1.00000000000000, 0.00000000000000 ) );
+#219 = DIRECTION( '', ( 1.00000000000000, 0.00000000000000, 0.00000000000000 ) );
+#220 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, -1.00000000000000 ) );
+#221 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, -1.00000000000000 ) );
+#222 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, -1.00000000000000 ) );
+#223 = DIRECTION( '', ( 0.00000000000000, 0.00000000000000, -1.00000000000000 ) );
+ENDSEC;
+END-ISO-10303-21;

Added: MOAB/trunk/tools/iGeom/iBase.h
===================================================================
--- MOAB/trunk/tools/iGeom/iBase.h	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/iBase.h	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,135 @@
+#ifndef __IBASE_H__
+#define __IBASE_H__
+
+#ifndef ITAPS
+#define ITAPS
+#endif
+
+#ifdef __cplusplus
+
+extern "C"
+{
+#endif
+
+    /*==========================================================
+     * TYPEDEF'S
+     *==========================================================
+     */
+  typedef void* iBase_Instance;
+  typedef struct iBase_EntityHandle_Private* iBase_EntityHandle;
+  typedef struct iBase_EntitySetHandle_Private* iBase_EntitySetHandle;
+  typedef struct iBase_TagHandle_Private* iBase_TagHandle;
+
+    /*==========================================================
+     * ENTITYTYPE ENUMERATION
+     *==========================================================
+     */
+  enum iBase_EntityType {
+    iBase_VERTEX = 0,
+    iBase_EDGE,
+    iBase_FACE,
+    iBase_REGION,
+    iBase_ALL_TYPES
+  };
+
+    /*==========================================================
+     * ADJACENCYCOST ENUMERATION
+     *==========================================================
+     */
+  enum iBase_AdjacencyCost {
+    iBase_UNAVAILABLE = 0,          /**< Adjacency information not supported */
+    iBase_ALL_ORDER_1,              /**< No more than local mesh traversal required */
+    iBase_ALL_ORDER_LOGN,           /**< Global tree search */
+    iBase_ALL_ORDER_N,              /**< Global exhaustive search */
+    iBase_SOME_ORDER_1,             /**< Only some adjacency info, local */
+    iBase_SOME_ORDER_LOGN,          /**< Only some adjacency info, tree */
+    iBase_SOME_ORDER_N              /**< Only some adjacency info, exhaustive */
+  };
+
+    /*==========================================================
+     * CREATIONSTATUS ENUMERATION
+     *==========================================================
+     */
+  enum iBase_CreationStatus {
+    iBase_NEW = 0,
+    iBase_ALREADY_EXISTED,
+    iBase_CREATED_DUPLICATE,
+    iBase_CREATION_FAILED
+  };
+
+    /*==========================================================
+     * ERRORACTIONS ENUMERATION
+     *==========================================================
+     */
+  enum iBase_ErrorActions {
+    iBase_SILENT,
+    iBase_WARN_ONLY,
+    iBase_THROW_ERROR
+  };
+
+    /*==========================================================
+     * ERRORTYPE ENUMERATION
+     *==========================================================
+     */
+  enum iBase_ErrorType {
+    iBase_SUCCESS,
+    iBase_MESH_ALREADY_LOADED,
+    iBase_NO_MESH_DATA,
+    iBase_FILE_NOT_FOUND,
+    iBase_FILE_WRITE_ERROR,
+    iBase_NIL_ARRAY,
+    iBase_BAD_ARRAY_SIZE,
+    iBase_BAD_ARRAY_DIMENSION,
+    iBase_INVALID_ENTITY_HANDLE,
+    iBase_INVALID_ENTITY_COUNT,
+    iBase_INVALID_ENTITY_TYPE,
+    iBase_INVALID_ENTITY_TOPOLOGY,
+    iBase_BAD_TYPE_AND_TOPO,
+    iBase_ENTITY_CREATION_ERROR,
+    iBase_INVALID_TAG_HANDLE,
+    iBase_TAG_NOT_FOUND,
+    iBase_TAG_ALREADY_EXISTS,
+    iBase_TAG_IN_USE,
+    iBase_INVALID_ENTITYSET_HANDLE,
+    iBase_INVALID_ITERATOR_HANDLE,
+    iBase_INVALID_ARGUMENT,
+    iBase_MEMORY_ALLOCATION_FAILED,
+    iBase_NOT_SUPPORTED,
+    iBase_FAILURE
+  };
+
+    /*==========================================================
+     * ERROR STRUCT
+     *==========================================================
+     */
+  struct iBase_Error
+  {
+    int error_type;
+    char description[120];
+  };
+
+    /*==========================================================
+     * STORAGEORDER ENUMERATION
+     *==========================================================
+     */
+  enum iBase_StorageOrder {
+    iBase_BLOCKED,
+    iBase_INTERLEAVED
+  };
+
+    /*==========================================================
+     * TAGVALUETYPE ENUMERATION
+     *==========================================================
+     */
+  enum iBase_TagValueType {
+    iBase_INTEGER,
+    iBase_DOUBLE,
+    iBase_ENTITY_HANDLE,
+    iBase_BYTES
+  };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* #ifndef __IBASE_H__ */

Added: MOAB/trunk/tools/iGeom/iBase_f.h
===================================================================
--- MOAB/trunk/tools/iGeom/iBase_f.h	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/iBase_f.h	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,113 @@
+#ifndef IBASE_F_H
+#define IBASE_F_H
+
+#define iBase_EntityHandle integer
+#define iBase_EntitySetHandle integer
+#define iBase_TagHandle integer
+
+#endif
+
+      integer iBase_VERTEX
+      integer iBase_EDGE
+      integer iBase_FACE
+      integer iBase_REGION
+      integer iBase_ALL_TYPES
+
+      parameter (iBase_VERTEX = 0) 
+      parameter (iBase_EDGE = 1) 
+      parameter (iBase_FACE = 2) 
+      parameter (iBase_REGION = 3)
+      parameter (iBase_ALL_TYPES = 4)
+
+
+
+      integer iBase_NEW
+      integer iBase_ALREADY_EXISTED
+      integer iBase_CREATED_DUPLICATE
+      integer iBase_CREATION_FAILED
+
+      parameter (iBase_NEW = 0)               
+      parameter (iBase_ALREADY_EXISTED = 1)   
+      parameter (iBase_CREATED_DUPLICATE = 2)
+      parameter (iBase_CREATION_FAILED = 3)
+
+
+      integer iBase_SILENT
+      integer iBase_WARN_ONLY
+      integer iBase_THROW_ERROR
+
+      parameter (iBase_SILENT = 0) 
+      parameter (iBase_WARN_ONLY = 1) 
+      parameter (iBase_THROW_ERROR = 4)
+
+
+      integer iBase_SUCCESS
+      integer iBase_MESH_ALREADY_LOADED
+      integer iBase_NO_MESH_DATA
+      integer iBase_FILE_NOT_FOUND
+      integer iBase_FILE_WRITE_ERROR
+      integer iBase_NIL_ARRAY
+      integer iBase_BAD_ARRAY_SIZE
+      integer iBase_BAD_ARRAY_DIMENSION
+      integer iBase_INVALID_ENTITY_HANDLE
+      integer iBase_INVALID_ENTITY_COUNT
+      integer iBase_INVALID_ENTITY_TYPE
+      integer iBase_INVALID_ENTITY_TOPOLOGY
+      integer iBase_BAD_TYPE_AND_TOPO
+      integer iBase_ENTITY_CREATION_ERROR
+      integer iBase_INVALID_TAG_HANDLE
+      integer iBase_TAG_NOT_FOUND
+      integer iBase_TAG_ALREADY_EXISTS
+      integer iBase_TAG_IN_USE
+      integer iBase_INVALID_ENTITYSET_HANDLE
+      integer iBase_INVALID_ITERATOR_HANDLE
+      integer iBase_INVALID_ARGUMENT
+      integer iBase_MEMORY_ALLOCATION_FAILED
+      integer iBase_NOT_SUPPORTED
+      integer iBase_FAILURE
+
+      parameter (iBase_SUCCESS = 0)
+      parameter (iBase_MESH_ALREADY_LOADED = 1)
+      parameter (iBase_NO_MESH_DATA = 2)
+      parameter (iBase_FILE_NOT_FOUND = 3)
+      parameter (iBase_FILE_WRITE_ERROR = 4)
+      parameter (iBase_NIL_ARRAY = 5)
+      parameter (iBase_BAD_ARRAY_SIZE = 6)
+      parameter (iBase_BAD_ARRAY_DIMENSION = 7)
+      parameter (iBase_INVALID_ENTITY_HANDLE = 8)
+      parameter (iBase_INVALID_ENTITY_COUNT = 9)
+      parameter (iBase_INVALID_ENTITY_TYPE = 10)
+      parameter (iBase_INVALID_ENTITY_TOPOLOGY = 11)
+      parameter (iBase_BAD_TYPE_AND_TOPO = 12)
+      parameter (iBase_ENTITY_CREATION_ERROR = 13)
+      parameter (iBase_INVALID_TAG_HANDLE = 14)
+      parameter (iBase_TAG_NOT_FOUND = 15)
+      parameter (iBase_TAG_ALREADY_EXISTS = 16)
+      parameter (iBase_TAG_IN_USE = 17)
+      parameter (iBase_INVALID_ENTITYSET_HANDLE = 18)
+      parameter (iBase_INVALID_ITERATOR_HANDLE = 19)
+      parameter (iBase_INVALID_ARGUMENT = 20)
+      parameter (iBase_MEMORY_ALLOCATION_FAILED = 21)
+      parameter (iBase_NOT_SUPPORTED = 22)
+      parameter (iBase_FAILURE = 23)
+
+
+      integer iBase_BLOCKED
+      integer iBase_INTERLEAVED
+      integer iBase_UNDETERMINED
+
+      parameter (iBase_BLOCKED = 0)
+      parameter (iBase_INTERLEAVED = 1)
+      parameter (iBase_UNDETERMINED = 2)
+
+
+      integer iBase_INTEGER
+      integer iBase_DOUBLE
+      integer iBase_ENTITY_HANDLE
+      integer iBase_BYTES
+
+      parameter (iBase_INTEGER = 0)
+      parameter (iBase_DOUBLE = 1)
+      parameter (iBase_ENTITY_HANDLE = 2)
+      parameter (iBase_BYTES = 3)
+

Added: MOAB/trunk/tools/iGeom/iGeom-Defs.inc.in
===================================================================
--- MOAB/trunk/tools/iGeom/iGeom-Defs.inc.in	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/iGeom-Defs.inc.in	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,23 @@
+IGEOM_CXXFLAGS = @CXXFLAGS@ 
+IGEOM_CFLAGS = @CFLAGS@
+IGEOM_LDFLAGS = @EXPORT_LDFLAGS@
+IGEOM_CXX_LDFLAGS = @MOAB_CXX_LINKFLAGS@
+IGEOM_CXX_LIBS = @MOAB_CXX_LIBS@
+
+IGEOM_FC = @FC@
+IGEOM_FCFLAGS = @FCFLAGS@
+
+IGEOM_FCDEFS = @DEFS@
+
+IGEOM_INCLUDES = -I$(IGEOM_INCLUDEDIR) $(IGEOM_INCLUDEDIR2)
+
+IGEOM_LIBS = $(IGEOM_LDFLAGS) -L$(MOAB_LIBDIR) \
+             -L$(IGEOM_LIBDIR) -liMesh -lMOAB \
+             @NETCDF_LIBS@ @HDF5_LIBS@ @LIBS@ \
+             $(IGEOM_CXX_LDFLAGS) $(IGEOM_CXX_LIBS) \
+             @CGM_LDFLAGS@ @CGM_LIBS@
+
+IGEOM_INCLUDEDIR1 = @abs_srcdir@
+IGEOM_INCLUDEDIR2 = -I at abs_top_builddir@
+IGEOM_LIBDIR = @abs_builddir@/.libs
+MOAB_LIBDIR = @abs_builddir@/../../.libs

Added: MOAB/trunk/tools/iGeom/iGeom.h
===================================================================
--- MOAB/trunk/tools/iGeom/iGeom.h	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/iGeom.h	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,3287 @@
+#ifndef IGEOM_CBIND_H__
+#define IGEOM_CBIND_H__
+
+  /** \mainpage The ITAPS Geometry Interface iGeom
+   *
+   * The ITAPS Geometry Interface iGeom provides a common interface for
+   * accessing geometry and data associated with a mesh.  Applications written
+   * to use this interface can use a variety of implementations, choosing
+   * the one that best meets its needs.  They can also use tools written
+   * to this interface.
+   *
+   * \section ITAPS Data Model
+   *
+   * The ITAPS interfaces use a data model composed of four basic data types:\n
+   * \em Entity: basic topological entities in a model, e.g. vertices, 
+   * edges, faces, regions. \n
+   * \em Entity \em Set: arbitrary grouping of other entities and sets. 
+   * Entity sets also support parent/child relations with other sets which
+   * are distinct from entities contained in those sets.  Parent/child links
+   * can be used to embed graph relationships between sets, e.g. to 
+   * represent topological relationships between the sets. \n
+   * \em Interface: the object with which model is associated and on which
+   * functions in iGeom are called. \n
+   * \em Tag: application data associated with objects of any of the other 
+   * data types.  Each tag has a designated name, size, and data type.
+   *
+   * \section JTAPS Entity Type
+   * Each entity has a specific Entity Type.  The Entity 
+   * Type is one of VERTEX, EDGE, FACE, and REGION, and is synonymous with
+   * the topological dimension of the entity.  Entity Type is an enumerated
+   * type in the iBase_EntityType enumeration.
+   *
+   * \section KTAPS Entity-, Array-, and Iterator-Based Access
+   *
+   * The iGeom interface provides functions for accessing entities
+   * individually, as arrays of entities, or using iterators.  These access
+   * methods have different memory versus execution time tradeoffs, 
+   * depending on the implementation.
+   *
+   * \section LTAPS Lists Passed Through Interface
+   *
+   * Many of the functions in iGeom have arguments corresponding to lists of 
+   * objects.  In-type arguments for lists consist of a pointer to an array and
+   * a list size.  Lists returned from functions are passed in three arguments,
+   * a pointer to the array representing the list, and pointers to the
+   * allocated and occupied lengths of the array.  These three arguments are 
+   * inout-type arguments, because they can be allocated by the application and
+   * passed into the interface to hold the results of the function.  Lists
+   * which are pre-allocated must be large enough to hold the results of the
+   * function; if this is not the case, an error is generated.  Otherwise, the
+   * occupied size is changed to the size output from the function.  If a list
+   * argument is unallocated (the list pointer points to a NULL value) or if
+   * the incoming value of the allocated size is zero, the list storage will be
+   * allocated by the implementation.  IN ALL CASES, MEMORY ALLOCATED BY ITAPS
+   * INTERFACE IMPLEMENTATIONS IS DONE USING THE C MALLOC FUNCTION, AND CAN BE
+   * DE-ALLOCATED USING THE C FREE FUNCTION.
+   *
+   */
+
+#ifndef ITAPS
+#define ITAPS
+#endif
+
+#include "iBase.h"
+#include "iGeom_protos.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    /**\brief  Type used to store iGeom interface handle
+     *
+     * Type used to store iGeom interface handle
+     */
+  typedef struct iGeom_Instance_Private* iGeom_Instance;
+
+    /**\brief  Type used to store an iterator returned by iGeom
+     *
+     * Type used to store an iterator returned by iGeom
+     */
+  typedef struct iGeom_EntityIterator_Private* iGeom_EntityIterator;
+
+    /**\brief  Type used to store an array iterator returned by iGeom
+     *
+     * Type used to store an array iterator returned by iGeom
+     */
+  typedef struct iGeom_EntityArrIterator_Private* iGeom_EntityArrIterator;
+
+    /**\brief  Get a description of the error returned from the last iGeom function
+     *
+     * Get a description of the error returned from the last iGeom function
+     * \param instance iGeom instance handle
+     * \param descr Pointer to a character string to be filled with a
+     *        description of the error from the last iGeom function
+     * \param *err Pointer to error type returned from function
+     * \param descr_len Length of the character string pointed to by descr
+     */
+  void iGeom_getDescription( iGeom_Instance instance,
+                             char* descr,
+                             int* err,
+                             int descr_len );
+
+    /**\brief  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.
+     * \param instance iGeom instance handle
+     * \param *error_type Error type returned from last iGeom function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getErrorType(iGeom_Instance instance,
+                          /*out*/ int *error_type, 
+                          int *err);
+
+    /**\brief  Construct a new iGeom instance
+     *
+     * Construct a new iGeom instance, using implementation-specific
+     * options
+     * \param options Pointer to implementation-specific options string
+     * \param instance Pointer to iGeom instance handle returned from function
+     * \param *err Pointer to error type returned from function
+     * \param options_len Length of the character string pointed to by options
+     */
+  void iGeom_newGeom( char const* options,
+                      iGeom_Instance* instance_out,
+                      int* err,
+                      int options_len );
+
+    /**\brief  Destroy an iGeom instance
+     *
+     * Destroy an iGeom instance
+     * \param instance iGeom instance to be destroyed
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_dtor( iGeom_Instance instance, int* err );
+
+
+    /**\brief  Load a geom from a file
+     *
+     * Load a geom from a file.  If entity set is specified, loaded geom
+     * is added to that set; specify zero if that is not desired.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Set to which loaded geom will be added, zero
+     *        if not desired
+     * \param name File name from which geom is to be loaded
+     * \param options Pointer to implementation-specific options string
+     * \param *err Pointer to error type returned from function
+     * \param name_len Length of the file name character string
+     * \param options_len Length of the options character string
+     */
+  void iGeom_load( iGeom_Instance,
+                   char const* name,
+                   char const* options,
+                   int* err,
+                   int name_len,
+                   int options_len );
+
+    /**\brief  Save a geom to a file
+     *
+     * Save a geom to a file.  If entity set is specified, save only the
+     * geom contained in that set.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set being saved
+     * \param name File name to which geom is to be saved
+     * \param options Pointer to implementation-specific options string
+     * \param *err Pointer to error type returned from function
+     * \param name_len Length of the file name character string
+     * \param options_len Length of the options character string
+     */
+  void iGeom_save( iGeom_Instance,
+                   char const* name,
+                   char const* options,
+                   int* err,
+                   int name_len,
+                   int options_len );
+
+    /**\brief  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.
+     * \param instance iGeom instance handle
+     * \param root_set Pointer to set handle returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getRootSet( iGeom_Instance,
+                         iBase_EntitySetHandle* root_set,
+                         int* err );
+
+/**\brief Get the bounding box of the entire model
+ * Get the bounding box of the entire model
+ * \param min_x Minimum coordinate of bounding box 
+ * \param min_y Minimum coordinate of bounding box 
+ * \param min_z Minimum coordinate of bounding box 
+ * \param max_x Maximum coordinate of bounding box 
+ * \param max_y Maximum coordinate of bounding box 
+ * \param max_z Maximum coordinate of bounding box 
+ */
+  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 );
+
+    /**\brief  Get entities of specific type and/or topology in set or instance
+     *
+     * Get entities of specific type and/or topology in set or instance.  All 
+     * entities of a given type or topology are requested by specifying
+     * iBase_ALL_TOPOLOGIES or iBase_ALL_TYPES, respectively.  Specified type
+     * or topology must be a value in the iBase_EntityType or iBase_EntityTopology
+     * enumeration, respectively.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set being queried
+     * \param entity_type Type of entities being requested
+     * \param entity_topology Topology of entities being requested
+     * \param *entity_handles Pointer to array of entity handles returned 
+     *        from function
+     * \param *entity_handles_allocated Pointer to allocated size of 
+     *        entity_handles array
+     * \param *entity_handles_size Pointer to occupied size of entity_handles array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEntities( iGeom_Instance instance,
+                          iBase_EntitySetHandle set_handle,
+                          int entity_type,
+                          iBase_EntityHandle** entity_handles,
+                          int* entity_handles_allococated,
+                          int* entity_handles_size,
+                          int* err );
+
+    /**\brief  Get the number of entities with the specified type in the instance or set
+     *
+     * Get the number of entities with the specified type in the instance 
+     * or set.  If entity set handle is zero, return information for instance,
+     * otherwise for set.  Value of entity type must be from the
+     * iBase_EntityType enumeration.  If iBase_ALL_TYPES is specified,
+     * total number of entities (excluding entity sets) is returned.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set being queried
+     * \param entity_type Type of entity requested
+     * \param num_type Pointer to number of entities, returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getNumOfType( iGeom_Instance instance,
+                           iBase_EntitySetHandle set_handle,
+                           int entity_type,
+                           int* num_out,
+                           int* err );
+
+    /**\brief  Get the entity type for the specified entity
+     *
+     * Get the entity type for the specified entity.  Types
+     * returned are values in the iBase_EntityType enumeration.
+     * \param instance iGeom instance handle
+     * \param entity_handle entity handle being queried
+     * \param *type Pointer to location at which to store the returned type
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEntType( iGeom_Instance instance,
+                         iBase_EntityHandle entity_handle,
+                         int* type,
+                         int* err );
+
+    /**\brief  Get the entity type for the specified entities
+     *
+     * Get the entity type for the specified entities.  Types
+     * returned are values in the iBase_EntityType enumeration.
+     * \param instance iGeom instance handle
+     * \param entity_handles Array of entity handles being queried
+     * \param entity_handles_size Number of entities in entity_handles array
+     * \param *type Pointer to array of types returned from function
+     * \param *type_allocated Pointer to allocated size of type array
+     * \param *type_size Pointer to occupied size of type array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getArrType( iGeom_Instance instance,
+                         iBase_EntityHandle const* entity_handles,
+                         int entity_handles_size,
+                         int** type,
+                         int* type_allocated,
+                         int* type_size,
+                         int* err );
+
+    /**\brief  Get entities of specified type adjacent to an entity
+     *
+     * Get entities of specified type adjacent to an entity.  Specified type
+     * must be value in the iBase_EntityType enumeration.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity handle being queried
+     * \param entity_type_requested Type of adjacent entities requested
+     * \param *adj_entity_handles Pointer to array of adjacent entities
+     *        returned from function
+     * \param *adj_entity_handles_allocated Pointer to allocated size of 
+     *        adj_entity_handles array
+     * \param *adj_entity_handles_size Pointer to occupied size of 
+     *        adj_entity_handles array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEntAdj( iGeom_Instance instance,
+                        iBase_EntityHandle entity_handle,
+                        int to_dimension,
+                        iBase_EntityHandle** adj_entities,
+                        int* adj_entities_allocated,
+                        int* adj_entities_size,
+                        int* err );
+
+    /**\brief  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.  \em offset(i) is
+     * index of first entity in adjacentEntityHandles array adjacent to 
+     * entity_handles[i].
+     * \param instance iGeom instance handle
+     * \param entity_handles Array of entity handles being queried
+     * \param entity_handles_size Number of entities in entity_handles array
+     * \param entity_type_requested Type of adjacent entities requested
+     * \param *adjacentEntityHandles Pointer to array of adjacentEntityHandles 
+     *        returned from function
+     * \param *adjacentEntityHandles_allocated Pointer to allocated size of 
+     *        adjacentEntityHandles array
+     * \param *adj_entity_handles_size Pointer to occupied size of 
+     *        adjacentEntityHandles array
+     * \param *offset Pointer to array of offsets returned from function
+     * \param *offset_allocated Pointer to allocated size of offset array
+     * \param *offset_size Pointer to occupied size of offset array
+     * \param *err Pointer to error type returned from function
+     */
+  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 );
+
+/**\brief Get "2nd order" adjacencies to an entity
+ * Get "2nd order" adjacencies to an entity, that is, from an entity, through
+ * other entities of a specified "bridge" dimension, to other entities of another 
+ * specified "to" dimension.
+ * \param entity_handle Entity from which adjacencies are requested
+ * \param bridge_dimension Bridge dimension for 2nd order adjacencies
+ * \param to_dimension Dimension of adjacent entities returned
+ * \param adjacent_entities Adjacent entities
+ * \param adjacent_entities_allocated Allocated size of returned array
+ * \param adjacent_entities_size Occupied size of returned array
+ * \param err 
+ */
+  void iGeom_getEnt2ndAdj( iGeom_Instance instance,
+                           iBase_EntityHandle entity_handle,
+                           int bridge_dimension,
+                           int to_dimension,
+                           iBase_EntityHandle** adjacent_entities,
+                           int* adjacent_entities_allocated,
+                           int* adjacent_entities_size,
+                           int* err );
+
+/**\brief 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.
+ *
+ * \param entity_handles Entities from which adjacencies are requested
+ * \param entity_handles_size Number of entities whose adjacencies are requested
+ * \param bridge_dimension Bridge dimension for 2nd order adjacencies
+ * \param to_dimension Dimension of adjacent entities returned
+ * \param adj_entity_handles Adjacent entities
+ * \param adj_entity_handles_allocated Allocated size of returned array
+ * \param adj_entity_handles_size Occupied size of returned array
+ * \param offset Offset[i] is offset into adj_entity_handles of 2nd order 
+ *        adjacencies of ith entity in entity_handles
+ * \param offset_allocated Allocated size of offset array
+ * \param offset_size Occupied size of offset array
+ * \param err 
+ */
+  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 );
+
+/**\brief Return whether two entities are adjacent
+ * Return whether two entities are adjacent.
+ * \param entity_handle1 First entity queried
+ * \param entity_handle2 Second entity queried
+ * \param are_adjacent If returned non-zero, entities are adjacent, otherwise
+ *        they are not
+ * \param err 
+ */
+  void iGeom_isEntAdj( iGeom_Instance instance,
+                       iBase_EntityHandle entity_handle1,
+                       iBase_EntityHandle entity_handle2,
+                       int* are_adjacent,
+                       int* err );
+
+/**\brief 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.
+ * \param entity_handles_1 First array of entities
+ * \param entity_handles_1_size Number of entities in first array
+ * \param entity_handles_2 Second array of entities
+ * \param entity_handles_2_size Number of entities in second array
+ * \param is_adjacent_info Array of flags returned from function
+ * \param is_adjacent_info_allocated Allocated size of flags array
+ * \param is_adjacent_info_size Occupied size of flags array
+ */
+  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 );
+
+/**\brief DON'T KNOW WHAT THIS FUNCTION IS
+ *
+ * \param topo_level_out 
+ */
+  void iGeom_getTopoLevel( iGeom_Instance instance,
+                           int* topo_level_out,
+                           int* err );
+
+/**\brief Get closest point to an entity
+ * Get closest point to a specified position on an entity
+ * \param entity_handle Entity being queried
+ * \param near_x Coordinates of starting point
+ * \param near_y Coordinates of starting point
+ * \param near_z Coordinates of starting point
+ * \param on_x Closest point on entity
+ * \param on_y Closest point on entity
+ * \param on_z Closest point on entity
+ */
+  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 );
+
+/**\brief Get closest point for an array of entities and points
+ * 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entity(ies) being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of input points
+ * \param near_coordinates Coordinates of starting point(s)
+ * \param near_coordinates_size Number of values in near_coordinates array
+ * \param on_coordinates Coordinates of closest points
+ * \param on_coordinates_allocated Allocated size of closest point array
+ * \param on_coordinates_size Occupied size of closest point array
+ */
+  void iGeom_getArrClosestPt( iGeom_Instance instance,
+                              iBase_EntityHandle const* entity_handles,
+                              int entity_handles_size,
+                              int storage_order,
+                              double const* near_coordinates,
+                              int near_coordinates_size,
+                              double** on_coordinates,
+                              int* on_coordinates_allocated,
+                              int* on_coordinates_size,
+                              int* err );
+
+/**\brief Get the normal vector on an entity at the given position
+ * Get the normal vector on an entity at the given position.
+ * \param entity_handle Entity being queried
+ * \param x Coordinates of starting point
+ * \param y Coordinates of starting point
+ * \param z Coordinates of starting point
+ * \param nrml_i Normal vector at starting point
+ * \param nrml_j Normal vector at starting point
+ * \param nrml_k Normal vector at starting point
+ */
+  void iGeom_getEntNrmlXYZ( iGeom_Instance,
+                            iBase_EntityHandle entity_handle,
+                            double x,
+                            double y,
+                            double z,
+                            double* nrml_i,
+                            double* nrml_j,
+                            double* nrml_k,
+                            int* err );
+
+/**\brief Get the normal vector on an entity(ies) at given position(s)
+ * Get the normal vector 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entity(ies) being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of coordinates
+ * \param coordinates Starting coordinates
+ * \param coordinates_size Number of values in coordinates array
+ * \param normals Normal coordinates
+ * \param normals_allocated Allocated size of normals array
+ * \param normals_size Occupied size of normals array
+ */
+  void iGeom_getArrNrmlXYZ( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int storage_order,
+                            double const* coordinates,
+                            int coordinates_size,
+                            double** normals,
+                            int* normals_allocated,
+                            int* normals_size,
+                            int* err );
+
+/**\brief 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.
+ * \param entity_handle Entity being queried
+ * \param x Starting coordinates
+ * \param y Starting coordinates
+ * \param z Starting coordinates
+ * \param pt_x Closest point
+ * \param pt_y Closest point
+ * \param pt_z Closest point
+ * \param nrml_i Normal at closest point
+ * \param nrml_j Normal at closest point
+ * \param nrml_k Normal at closest point
+ */
+  void iGeom_getEntNrmlPlXYZ( iGeom_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 );
+
+/**\brief Get the normal vector AND closest point on an entity(ies) at given position(s)
+ * Get the normal vector AND closest point 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entity(ies) being queried
+ * \param entity_handles_size Number of entity(ies) being queried
+ * \param storage_order Storage order in near_coordinates array
+ * \param near_coordinates Starting coordinates
+ * \param near_coordinates_size Number of values in near_coordinates array
+ * \param on_coordinates Closest point array
+ * \param on_coordinates_allocated Allocated size of closest point array
+ * \param on_coordinates_size Occupied size of closest point array
+ * \param normals Normal array
+ * \param normals_allocated Allocated size of normal array
+ * \param normals_size Occupied size of normal array
+ */
+  void iGeom_getArrNrmlPlXYZ( iGeom_Instance,
+                              iBase_EntityHandle const* entity_handles,
+                              int entity_handles_size,
+                              int storage_order,
+                              double const* near_coordinates,
+                              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 );
+
+/**\brief Get the tangent vector on an entity at given position
+ * Get the tangent vector on an entity at a given position.
+ * \param entity_handle Entity being queried
+ * \param x Starting coordinates
+ * \param y Starting coordinates
+ * \param z Starting coordinates
+ * \param tgnt_i Tangent at closest point
+ * \param tgnt_j Tangent at closest point
+ * \param tgnt_k Tangent at closest point
+ */
+  void iGeom_getEntTgntXYZ( iGeom_Instance,
+                            iBase_EntityHandle entity_handle,
+                            double x,
+                            double y,
+                            double z,
+                            double* tgnt_i,
+                            double* tgnt_j,
+                            double* tgnt_k,
+                            int* err );
+
+/**\brief Get the tangent vector on an entity(ies) at given position(s)
+ * Get the tangent vector 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entity(ies) being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of coordinates
+ * \param coordinates Starting coordinates
+ * \param coordinates_size Number of values in coordinates array
+ * \param tangents Tangent coordinates
+ * \param tangents_allocated Allocated size of tangents array
+ * \param tangents_size Occupied size of tangents array
+ */
+  void iGeom_getArrTgntXYZ( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int storage_order,
+                            double const* coordinates,
+                            int coordinates_size,
+                            double** tangents,
+                            int* tangents_allocated,
+                            int* tangents_size,
+                            int* err );
+
+/**\brief 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.
+ * \param face_handle Face being queried
+ * \param x Position being queried
+ * \param y Position being queried
+ * \param z Position being queried
+ * \param cvtr1_i Maximum curvature vector
+ * \param cvtr1_j Maximum curvature vector
+ * \param cvtr1_k Maximum curvature vector
+ * \param cvtr2_i Minimum curvature vector
+ * \param cvtr2_j Minimum curvature vector
+ * \param cvtr2_k Minimum curvature vector
+ */
+  void iGeom_getFcCvtrXYZ( iGeom_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 );
+
+/**\brief 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.
+ * \param edge_handle Edge being queried
+ * \param x Position being queried
+ * \param y Position being queried
+ * \param z Position being queried
+ * \param cvtr_i Maximum curvature vector
+ * \param cvtr_j Maximum curvature vector
+ * \param cvtr_k Maximum curvature vector
+ */
+  void iGeom_getEgCvtrXYZ( iGeom_Instance,
+                           iBase_EntityHandle edge_handle,
+                           double x,
+                           double y,
+                           double z,
+                           double* cvtr_i,
+                           double* cvtr_j,
+                           double* cvtr_k,
+                           int* err );
+
+/**\brief 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entity(ies) being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of coordinates
+ * \param coords Starting coordinates
+ * \param coords_size Number of values in coordinates array
+ * \param cvtr_1 First principal curvatures
+ * \param cvtr_1_allocated Allocated size of first curvature array
+ * \param cvtr_1_size Occupied size of first curvature array
+ * \param cvtr_2 Second principal curvatures
+ * \param cvtr_2_allocated Allocated size of second curvature array
+ * \param cvtr_2_size Occupied size of second curvature array
+ */
+  void iGeom_getEntArrCvtrXYZ( iGeom_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 );
+
+/**\brief Get closest point, tangent, and curvature of edge
+ * Get closest point, tangent, and curvature of edge.
+ * \param edge_handle Edge being queried
+ * \param x Point at which entity is being queried
+ * \param y Point at which entity is being queried
+ * \param z Point at which entity is being queried
+ * \param on_x Closest point at point being queried
+ * \param on_y Closest point at point being queried
+ * \param on_z Closest point at point being queried
+ * \param tgnt_i Tangent at point being queried
+ * \param tgnt_j Tangent at point being queried
+ * \param tgnt_k Tangent at point being queried
+ * \param cvtr_i Curvature at point being queried
+ * \param cvtr_j Curvature at point being queried
+ * \param cvtr_k Curvature at point being queried
+ */
+  void iGeom_getEgEvalXYZ( iGeom_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 );
+
+/**\brief 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.
+ * \param face_handle Face being queried
+ * \param x Point at which entity is being queried
+ * \param y Point at which entity is being queried
+ * \param z Point at which entity is being queried
+ * \param on_x Closest point at point being queried
+ * \param on_y Closest point at point being queried
+ * \param on_z Closest point at point being queried
+ * \param nrml_i Normal at point being queried
+ * \param nrml_j Normal at point being queried
+ * \param nrml_k Normal at point being queried
+ * \param cvtr1_i First principal curvature at point being queried
+ * \param cvtr1_j First principal curvature at point being queried
+ * \param cvtr1_k First principal curvature at point being queried
+ * \param cvtr2_i Second principal curvature at point being queried
+ * \param cvtr2_j Second principal curvature at point being queried
+ * \param cvtr2_k Second principal curvature at point being queried
+ */
+  void iGeom_getFcEvalXYZ( iGeom_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 );
+
+/**\brief 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param edge_handles Edge(s) being queried
+ * \param edge_handles_size Number of edges being queried
+ * \param storage_order Storage order of coordinates
+ * \param coords Starting coordinates
+ * \param coords_size Number of values in coordinates array
+ * \param on_coords Closest point array
+ * \param on_coords_allocated Allocated size of closest point array
+ * \param on_coords_size Occupied size of closest point array
+ * \param tangent Tangent array
+ * \param tangent_allocated Allocated size of tangent array
+ * \param tangent_size Occupied size of tangent array
+ * \param cvtr First principal curvatures
+ * \param cvtr_allocated Allocated size of first curvature array
+ * \param cvtr_size Occupied size of first curvature array
+ */
+  void iGeom_getArrEgEvalXYZ( iGeom_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 );
+
+/**\brief 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param edge_handles Edge(s) being queried
+ * \param edge_handles_size Number of edges being queried
+ * \param storage_order Storage order of coordinates
+ * \param coords Starting coordinates
+ * \param coords_size Number of values in coordinates array
+ * \param on_coords Closest point array
+ * \param on_coords_allocated Allocated size of closest point array
+ * \param on_coords_size Occupied size of closest point array
+ * \param normal Normal array
+ * \param normal_allocated Allocated size of normal array
+ * \param normal_size Occupied size of normal array
+ * \param cvtr_1 First principal curvatures
+ * \param cvtr_1_allocated Allocated size of first curvature array
+ * \param cvtr_1_size Occupied size of first curvature array
+ * \param cvtr_2 Second principal curvatures
+ * \param cvtr_2_allocated Allocated size of second curvature array
+ * \param cvtr_2_size Occupied size of second curvature array
+ */
+  void iGeom_getArrFcEvalXYZ( iGeom_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 );
+
+/**\brief Get the bounding box of the specified entity
+ * Get the bounding box of the specified entity
+ * \param entity_handle Entity being queried
+ * \param min_x Minimum coordinate of bounding box 
+ * \param min_y Minimum coordinate of bounding box 
+ * \param min_z Minimum coordinate of bounding box 
+ * \param max_x Maximum coordinate of bounding box 
+ * \param max_y Maximum coordinate of bounding box 
+ * \param max_z Maximum coordinate of bounding box 
+ */
+  void iGeom_getEntBoundBox( iGeom_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 );
+
+/**\brief Get the bounding box of the specified entities
+ * Get the bounding box of the specified entities.  Storage order passed back
+ * will be member of iBase_StorageOrder enum.
+ * \param entity_handles Entity handles being queried
+ * \param enttiy_handles_size Number of entities being queried
+ * \param storage_order Storage order of coordinates passed back
+ * \param min_corner Minimum coordinates of bounding boxes
+ * \param min_corner_allocated Allocated size of minimum coordinates array
+ * \param min_corner_size Occupied size of minimum coordinates array
+ * \param max_corner Maximum coordinates of bounding boxes
+ * \param max_corner_allocated Allocated size of maximum coordinates array
+ * \param max_corner_size Occupied size of maximum coordinates array
+ */
+  void iGeom_getArrBoundBox( iGeom_Instance,
+                             iBase_EntityHandle const* entity_handles,
+                             int entity_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 );
+
+    /**\brief  Get coordinates of specified vertex
+     *
+     * Get coordinates of specified vertex.
+     * \param instance iGeom instance handle
+     * \param vertex_handle Geom vertex being queried
+     * \param *x Pointer to x coordinate returned from function
+     * \param *y Pointer to y coordinate returned from function
+     * \param *z Pointer to z coordinate returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getVtxCoord( iGeom_Instance,
+                          iBase_EntityHandle vertex_handle,
+                          double* x,
+                          double* y,
+                          double* z,
+                          int* err );
+
+    /**\brief  Get coordinates of specified vertices
+     *
+     * Get coordinates of specified vertices.  If storage order is passed in
+     * with a value other than iBase_UNDETERMINED, coordinates are returned
+     * in the specified storage order, otherwise storage order is that native
+     * to the implementation.  Storage order of returned coordinates is also
+     * returned.
+     * \param instance iGeom instance handle
+     * \param vertex_handles Array of geom vertex handles whose coordinates are
+     *        being requested
+     * \param vertex_handles_size Number of vertices in vertex_handles array
+     * \param storage_order Storage order requested for coordinate data
+     * \param *coords Pointer to array of coordinates returned from function
+     * \param *coords_allocated Pointer to allocated size of coords array
+     * \param *coords_size Pointer to occupied size of coords array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getVtxArrCoords( iGeom_Instance,
+                              iBase_EntityHandle const* entity_handles,
+                              int entity_handles_size,
+                              int storage_order,
+                              double** coordinates,
+                              int* coordinates_allocated,
+                              int* coordinates_size,
+                              int* err );
+
+/**\brief Intersect a ray with the model
+ * Intersect a ray with the model.  Storage orders passed back are members of the
+ * iBase_StorageOrder enumeration; if output is iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param x Point from which ray is fired
+ * \param y Point from which ray is fired
+ * \param z Point from which ray is fired
+ * \param dir_x Direction in which ray is fired
+ * \param dir_y Direction in which ray is fired
+ * \param dir_z Direction in which ray is fired
+ * \param intersect_entity_handles Entities intersected by ray
+ * \param intersect_entity_handles_allocated Allocated size of intersections array
+ * \param intersect_entity_hangles_size Occupied size of intersections array
+ * \param storage_order Storage order of coordinates passed back
+ * \param intersect_coords Coordinates of intersections
+ * \param intersect_coords_allocated Allocated size of coordinates array
+ * \param intersect_coords_size Occupied size of coordinates array
+ * \param param_coords Distances along ray of intersections
+ * \param param_coords_allocated Allocated size of param_coords array
+ * \param param_coords_size Occupied size of param_coords array
+ */
+  void iGeom_getPntRayIntsct( iGeom_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 );
+
+/**\brief Intersect an array of rays with the model
+ * Intersect an array of rays with the model.  Storage orders passed back are members of the
+ * iBase_StorageOrder enumeration; if input/output is iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param storage_order Storage order of input coordinates
+ * \param coords Points from which rays are fired
+ * \param coords_size Number of points from which rays are fired
+ * \param directions Directions in which rays are fired
+ * \param directions_size Number of coordinates in directions array
+ * \param intersect_entity_handles Entities intersected by ray
+ * \param intersect_entity_handles_allocated Allocated size of intersections array
+ * \param intersect_entity_hangles_size Occupied size of intersections array
+ * \param offset Offset[i] is offset into intersect_entity_handles of ith ray
+ * \param offset_allocated Allocated size of offset array
+ * \param offset_size Occupied size of offset array
+ * \param storage_order Storage order of coordinates passed back
+ * \param intersect_coords Coordinates of intersections
+ * \param intersect_coords_allocated Allocated size of coordinates array
+ * \param intersect_coords_size Occupied size of coordinates array
+ * \param param_coords Distances along ray of intersections
+ * \param param_coords_allocated Allocated size of param_coords array
+ * \param param_coords_size Occupied size of param_coords array
+ */
+  void iGeom_getPntArrRayIntsct( iGeom_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 );
+
+/**\brief Get the entity on which a point is located
+ * Get the entity on which a point is located
+ * \param x Point being queried
+ * \param y Point being queried
+ * \param z Point being queried
+ * \param entity_handle Entity on which point is located
+ */
+  void iGeom_getPntClsf( iGeom_Instance,
+                         double x,
+                         double y,
+                         double z,
+                         iBase_EntityHandle* entity_handle,
+                         int* err );
+
+/**\brief 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; if input is iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param storage_order Storage order of coordinates in coords
+ * \param coords Points being queried
+ * \param coords_size Number of entries in coords array
+ * \param entity_handles Entities on which points are located
+ * \param entity_handles_allocated Allocated size of entity_handles array
+ * \param entity_handles_size Occupied size of entity_handles array
+ */
+  void iGeom_getPntArrClsf( iGeom_Instance,
+                            int storage_order,
+                            double const* coords,
+                            int coords_size,
+                            iBase_EntityHandle** entity_handles,
+                            int* entity_handles_allocated,
+                            int* entity_handles_size,
+                            int* err );
+
+/**\brief Get the sense of a face with respect to a region
+ * Get the sense of a face with respect to a region.  Sense returned is -1, 0, or 1,
+ * representing "reversed", "both", or "forward".  "both" sense indicates that face bounds
+ * the region once with each sense.
+ * \param face Face being queried
+ * \param region Region being queried
+ * \param sense_out Sense of face with respect to region
+ */
+  void iGeom_getEntNrmlSense( iGeom_Instance,
+                              iBase_EntityHandle face,
+                              iBase_EntityHandle region,
+                              int* sense_out,
+                              int* err );
+
+/**\brief 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.
+ * \param face_handles Faces being queried
+ * \param face_handles_size Size of face handles array
+ * \param region_handles Regions being queried
+ * \param region_handles_size Size of region handles array
+ * \param sense Senses of faces with respect to regions
+ * \param sense_allocated Allocated size of senses array
+ * \param sense_size Occupied size of senses array
+ */
+  void iGeom_getArrNrmlSense( iGeom_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 );
+
+/**\brief Get the sense of an edge with respect to a face
+ * Get the sense of an edge with respect to a face.  Sense returned is -1, 0, or 1,
+ * representing "reversed", "both", or "forward".  "both" sense indicates that edge bounds
+ * the face once with each sense.
+ * \param edge Edge being queried
+ * \param face Face being queried
+ * \param sense_out Sense of edge with respect to face
+ */
+  void iGeom_getEgFcSense( iGeom_Instance,
+                           iBase_EntityHandle edge,
+                           iBase_EntityHandle face,
+                           int* sense_out,
+                           int* err );
+
+/**\brief 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.
+ * \param edge_handles Edges being queried
+ * \param edge_handles_size Size of edge handles array
+ * \param face_handles Faces being queried
+ * \param face_handles_size Size of face handles array
+ * \param sense Senses of faces with respect to regions
+ * \param sense_allocated Allocated size of senses array
+ * \param sense_size Occupied size of senses array
+ */
+  void iGeom_getEgFcArrSense( iGeom_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 );
+
+/**\brief Get the sense of a vertex pair with respect to an edge
+ * Get the sense of a vertex pair with respect to an edge.  Sense returned is -1, 0, or 1,
+ * representing "reversed", "both", or "forward".  "both" sense indicates that vertices
+ * are identical and that vertex bounds both sides of the edge
+ * \param edge Edge being queried
+ * \param vertex1 First vertex being queried
+ * \param vertex2 Second vertex being queried
+ * \param sense_out Sense of vertex pair with respect to edge
+ */
+  void iGeom_getEgVtxSense( iGeom_Instance,
+                            iBase_EntityHandle edge,
+                            iBase_EntityHandle vertex1,
+                            iBase_EntityHandle vertex2,
+                            int* sense_out,
+                            int* err );
+
+/**\brief 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
+ * \param edge_handles Edges being queried
+ * \param edge_handles_size Number of edges being queried
+ * \param vertex_handles_1 First vertex being queried
+ * \param vertex_handles_1_size Number of vertices in vertices array
+ * \param vertex_handles_2 Second vertex being queried
+ * \param vertex_handles_2_size Number of vertices in vertices array
+ * \param sense Sense of vertex pair with respect to edge
+ * \param sense_allocated Allocated size of sense array
+ * \param sense_size Occupied size of sense array
+ */
+  void iGeom_getEgVtxArrSense( iGeom_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 );
+
+/**\brief Return the measure (length, area, volume) of entities
+ * Return the measure (length, area, volume) of entities
+ * \param entity_handles Array of entities being queried
+ * \param entity_handles_size Number of entities in entity array
+ * \param measures Measures of entities being queried
+ * \param measures_allocated Allocated size of measures array
+ * \param measures_size Occupied size of measures array
+ */
+  void iGeom_measure( iGeom_Instance,
+                      iBase_EntityHandle const* entity_handles,
+                      int entity_handles_size,
+                      double** measures,
+                      int* measures_allocated,
+                      int* measures_size,
+                      int* err );
+
+/**\brief Get the geometric type of an entity
+ * Get the geometric type of an entity.  Specific types depend on implementation.
+ * \param face_handle Face being queried
+ * \param face_type Face type
+ * \param face_type_length Length of face type string
+ */
+  void iGeom_getFaceType( iGeom_Instance,
+                          iBase_EntityHandle face_handle,
+                          char* face_type,
+                          int* err,
+                          int* face_type_length);
+
+/**\brief Return whether interface has information about parameterization
+ * Return whether an interface has information about parameterization (!=0) or not (0)
+ * \param is_parametric If non-zero, interface has information about parameterization
+ */
+  void iGeom_getParametric( iGeom_Instance,
+                            int* is_parametric,
+                            int* err );
+
+/**\brief Return whether an entity has a parameterization
+ * Return whether an entity has a parameterization (!= 0) or not (=0)
+ * \param entity_handle Entity being queried
+ * \param is_parametric Entity has a parameterization (!= 0) or not (=0)
+ */
+  void iGeom_isEntParametric( iGeom_Instance,
+                              iBase_EntityHandle entity_handle,
+                              int* parametric,
+                              int* err );
+
+/**\brief Return whether entities have parameterizations
+ * Return whether entities have parameterizations (!= 0) or not (=0)
+ * \param entity_handles Entities being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param is_parametric entity_handles[i] has a parameterization (!= 0) or not (=0)
+ * \param is_parametric_allocated Allocated size of is_parametric array
+ * \param is_parametric_size Occupied size of is_parametric array
+ */
+  void iGeom_isArrParametric( iGeom_Instance,
+                              iBase_EntityHandle const* entity_handles,
+                              int entity_handles_size,
+                              int** is_parametric,
+                              int* is_parametric_allocated,
+                              int* is_parametric_size,
+                              int* err );
+
+/**\brief Return coordinate position at specified parametric position on entity
+ * Return coordinate position at specified parametric position on entity.
+ * \param entity_handle Entity being queried
+ * \param u Parametric coordinate being queried
+ * \param v Parametric coordinate being queried
+ * \param x Spatial coordinate at parametric position being queried
+ * \param y Spatial coordinate at parametric position being queried
+ * \param z Spatial coordinate at parametric position being queried
+ */
+  void iGeom_getEntUVtoXYZ( iGeom_Instance,
+                            iBase_EntityHandle entity_handle,
+                            double u,
+                            double v,
+                            double* x,
+                            double* y,
+                            double* z,
+                            int* err );
+
+/**\brief 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entities being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of uv coordinates input and xyz coordinate output
+ * \param uv Coordinates being queried
+ * \param uv_size Number of coordinates in array
+ * \param coordinates Coordinates of parametric positions
+ * \param coordinates_allocated Allocated size of coordinates array
+ * \param coordinates_size Occupied size of coordinates array
+ */
+  void iGeom_getArrUVtoXYZ( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int storage_order,
+                            double const* uv,
+                            int uv_size,
+                            double** coordinates,
+                            int* coordinates_allocated,
+                            int* coordinates_size,
+                            int* err );
+
+/**\brief Return coordinate position at specified parametric position on entity
+ * Return coordinate position at specified parametric position on entity.
+ * \param entity_handle Entity being queried
+ * \param u Parametric coordinate being queried
+ * \param x Spatial coordinate at parametric position being queried
+ * \param y Spatial coordinate at parametric position being queried
+ * \param z Spatial coordinate at parametric position being queried
+ */
+  void iGeom_getEntUtoXYZ( iGeom_Instance,
+                           iBase_EntityHandle entity_handle,
+                           double u,
+                           double* x, 
+                           double* y,
+                           double* z,
+                           int* err );
+
+/**\brief 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entities being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of resulting coordinates
+ * \param uv Coordinates being queried
+ * \param uv_size Number of coordinates in array
+ * \param coordinates Coordinates of parametric positions
+ * \param coordinates_allocated Allocated size of coordinates array
+ * \param coordinates_size Occupied size of coordinates array
+ */
+  void iGeom_getArrUtoXYZ( iGeom_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 );
+
+/**\brief Return parametric position at specified spatial position on entity
+ * Return parametric position at specified spatial position on entity
+ * \param entity_handle Entity being queried
+ * \param x Spatial coordinate being queried
+ * \param y Spatial coordinate being queried
+ * \param z Spatial coordinate being queried
+ * \param u Parametric coordinate at spatial position being queried
+ * \param v Parametric coordinate at spatial position being queried
+ */
+  void iGeom_getEntXYZtoUV( iGeom_Instance,
+                            iBase_EntityHandle entity_handle,
+                            double x,
+                            double y,
+                            double z,
+                            double* u,
+                            double* v, 
+                            int* err );
+
+/**\brief Return parametric position at specified spatial position on entity
+ * Return parametric position at specified spatial position on entity
+ * \param entity_handle Entity being queried
+ * \param x Spatial coordinate being queried
+ * \param y Spatial coordinate being queried
+ * \param z Spatial coordinate being queried
+ * \param u Parametric coordinate at spatial position being queried
+ */
+  void iGeom_getEntXYZtoU( iGeom_Instance,
+                           iBase_EntityHandle entity_handle,
+                           double x,
+                           double y,
+                           double z,
+                           double* u,
+                           int* err );
+
+/**\brief 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entities being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of spatial coordinates input
+ * \param coordinates Coordinates being queried
+ * \param coordinates_size Number of coordinates in array
+ * \param uv Coordinates of parametric positions
+ * \param uv_allocated Allocated size of coordinates array
+ * \param uv_size Occupied size of coordinates array
+ */
+  void iGeom_getArrXYZtoUV( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int storage_order,
+                            double const* coordinates,
+                            int coordinates_size,
+                            double** uv,
+                            int* uv_allocated,
+                            int* uv_size,
+                            int* err );
+
+/**\brief 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; if input as iBase_UNKNOWN, order is in native order
+ * with respect to implementation.
+ * \param entity_handles Entities being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of spatial coordinates input
+ * \param coordinates Coordinates being queried
+ * \param coordinates_size Number of coordinates in array
+ * \param u Coordinates of parametric positions
+ * \param u_allocated Allocated size of coordinates array
+ * \param u_size Occupied size of coordinates array
+ */
+  void iGeom_getArrXYZtoU( iGeom_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 );
+
+/**\brief 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.
+ * \param entity_handle Entity being queried
+ * \param x Spatial coordinate being queried
+ * \param y Spatial coordinate being queried
+ * \param z Spatial coordinate being queried
+ * \param u Parametric coordinate at spatial position being queried
+ * \param v Parametric coordinate at spatial position being queried
+ */
+  void iGeom_getEntXYZtoUVHint( iGeom_Instance,
+                                iBase_EntityHandle entity_handle,
+                                double x,
+                                double y,
+                                double z,
+                                double* u,
+                                double* v,
+                                int* err );
+
+/**\brief 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; if input as iBase_UNKNOWN, order is in 
+ * native order with respect to implementation.
+ * \param entity_handles Entities being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of spatial coordinates input
+ * \param coordinates Coordinates being queried
+ * \param coordinates_size Number of coordinates in array
+ * \param uv Coordinates of parametric positions
+ * \param uv_allocated Allocated size of coordinates array
+ * \param uv_size Occupied size of coordinates array
+ */
+  void iGeom_getArrXYZtoUVHint( iGeom_Instance,
+                                iBase_EntityHandle const* entity_handles,
+                                int entity_handles_size,
+                                int storage_order,
+                                double const* coords,
+                                int coords_size,
+                                double** uv,
+                                int* uv_allocated,
+                                int* uv_size,
+                                int* err );
+
+/**\brief Get parametric range of entity
+ * Get parametric range of entity
+ * \param entity_handle Entity being queried
+ * \param u_min Minimum parametric coordinate for entity
+ * \param v_min Minimum parametric coordinate for entity
+ * \param u_max Maximum parametric coordinate for entity
+ * \param v_max Maximum parametric coordinate for entity
+ */
+  void iGeom_getEntUVRange( iGeom_Instance,
+                            iBase_EntityHandle entity_handle,
+                            double* u_min,
+                            double* v_min,
+                            double* u_max,
+                            double* v_max,
+                            int* err );
+
+/**\brief Get parametric range of entity
+ * Get parametric range of entity
+ * \param entity_handle Entity being queried
+ * \param u_min Minimum parametric coordinate for entity
+ * \param u_max Maximum parametric coordinate for entity
+ */
+  void iGeom_getEntURange( iGeom_Instance,
+                           iBase_EntityHandle entity_handle,
+                           double* u_min,
+                           double* u_max,
+                           int* err );
+
+/**\brief Get parametric range of entities
+ * Get parametric range of entities
+ * \param entity_handles Entities being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of parametric coordinates being returned
+ * \param uv_min Minimum parametric coordinate for entities
+ * \param uv_min_allocated Allocated size of minimum parametric coordinate array
+ * \param uv_min_size Occupied size of minimum parametric coordinate array
+ * \param uv_max Maximum parametric coordinate for entities
+ * \param uv_max_allocated Allocated size of maximum parametric coordinate array
+ * \param uv_max_size Occupied size of maximum parametric coordinate array
+ */
+  void iGeom_getArrUVRange( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_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 );
+
+/**\brief Get parametric range of entities
+ * Get parametric range of entities
+ * \param entity_handles Entities being queried
+ * \param entity_handles_size Number of entities being queried
+ * \param storage_order Storage order of parametric coordinates being returned
+ * \param u_min Minimum parametric coordinate for entities
+ * \param u_min_allocated Allocated size of minimum parametric coordinate array
+ * \param u_min_size Occupied size of minimum parametric coordinate array
+ * \param u_max Maximum parametric coordinate for entities
+ * \param u_max_allocated Allocated size of maximum parametric coordinate array
+ * \param u_max_size Occupied size of maximum parametric coordinate array
+ */
+  void iGeom_getArrURange( iGeom_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 );
+
+/**\brief 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
+ * \param edge_handle Edge being queried
+ * \param face_handle Face being queried
+ * \param in_u Parametric position on edge
+ * \param u Corresponding parametric position on face
+ * \param v Corresponding parametric position on face
+ */
+  void iGeom_getEntUtoUV( iGeom_Instance,
+                          iBase_EntityHandle edge_handle,
+                          iBase_EntityHandle face_handle,
+                          double in_u,
+                          double* u,
+                          double* v,
+                          int* err );
+
+/**\brief Return parametric coordinates on face of vertex position
+ * Return parametric coordinates on face of vertex position
+ * \param vertex_handle Vertex being queried
+ * \param face_handle Face being queried
+ * \param u Corresponding parametric position on face
+ * \param v Corresponding parametric position on face
+ */
+  void iGeom_getVtxToUV( iGeom_Instance,
+                         iBase_EntityHandle vertex_handle,
+                         iBase_EntityHandle face_handle,
+                         double* u,
+                         double* v,
+                         int* err );
+
+/**\brief Return parametric coordinates on edge of vertex position
+ * Return parametric coordinates on edge of vertex position
+ * \param vertex_handle Vertex being queried
+ * \param edge_handle Edge being queried
+ * \param u Corresponding parametric position on face
+ */
+  void iGeom_getVtxToU( iGeom_Instance,
+                        iBase_EntityHandle vertex_handle,
+                        iBase_EntityHandle edge_handle,
+                        double* u,
+                        int* err );
+
+/**\brief Return the face parametric coordinates for a parametric position on bounding edges
+ * Return the face parametric coordinates for a parametric position on bounding edges
+ * \param edge_handles Edges being queried
+ * \param edge_handles_size Number of edges being queried
+ * \param face_handles Faces being queried
+ * \param face_handles_size Number of faces being queried
+ * \param u_in Parametric positions on edges
+ * \param u_in_size Number of parametric positions on edges
+ * \param storage_order Storage order of coordinates returned
+ * \param uv Corresponding parametric positions on faces
+ * \param uv_allocated Allocated size of parameter array
+ * \param uv_size Occupied size of parameter array
+ */
+  void iGeom_getArrUtoUV( iGeom_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 );
+
+/**\brief Return parametric coordinates on faces of vertex positions
+ * Return parametric coordinates on faces of vertex positions
+ * \param vertex_handles Vertices being queried
+ * \param vertex_handles_size Number of vertices being queried
+ * \param face_handles Faces being queried
+ * \param face_handles_size Number of faces being queried
+ * \param storage_order Storage order of coordinates returned
+ * \param uv Corresponding parametric positions on faces
+ * \param uv_allocated Allocated size of positions array
+ * \param uv_size Occupied size of positions array
+ */
+  void iGeom_getVtxArrToUV( iGeom_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 );
+
+/**\brief Return parametric coordinates on edges of vertex positions
+ * Return parametric coordinates on edges of vertex positions
+ * \param vertex_handles Vertices being queried
+ * \param vertex_handles_size Number of vertices being queried
+ * \param edge_handles Edges being queried
+ * \param edge_handles_size Number of edges being queried
+ * \param u Corresponding parametric positions on faces
+ * \param u_allocated Allocated size of positions array
+ * \param u_size Occupied size of positions array
+ */
+  void iGeom_getVtxArrToU( iGeom_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 );
+
+/**\brief Return the normal at a specified parametric position
+ * Return the normal at a specified parametric position
+ * \param entity_handle Entity being queried
+ * \param u Parametric position being queried
+ * \param v Parametric position being queried
+ * \param nrml_i Normal at specified position
+ * \param nrml_j Normal at specified position
+ * \param nrml_k Normal at specified position
+ */
+  void iGeom_getEntNrmlUV( iGeom_Instance,
+                           iBase_EntityHandle entity_handle,
+                           double u,
+                           double v,
+                           double* nrml_i,
+                           double* nrml_j,
+                           double* nrml_k,
+                           int* err );
+
+/**\brief Return the normals at a specified parametric positions
+ * Return the normals at a specified parametric positions.  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; if input as iBase_UNKNOWN, order is in 
+ * native order with respect to implementation.
+ * \param entity_handle Entity being queried
+ * \param u Parametric position being queried
+ * \param v Parametric position being queried
+ */
+  void iGeom_getArrNrmlUV( iGeom_Instance,
+                           iBase_EntityHandle const* face_handles,
+                           int face_handles_size,
+                           int storage_order,
+                           double const* parameters,
+                           int parameters_size,
+                           double** normals,
+                           int* normals_allocated,
+                           int* normals_size,
+                           int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_getEntTgntU( iGeom_Instance,
+                          iBase_EntityHandle entity_handle,
+                          double u,
+                          double* tgnt_i,
+                          double* tgnt_j,
+                          double* tgnt_k,
+                          int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_getArrTgntU( iGeom_Instance,
+                          iBase_EntityHandle const* edge_handles,
+                          int edge_handles_size,
+                          int storage_order,
+                          double const* parameters,
+                          int parameters_size,
+                          double** tangents,
+                          int* tangents_allocated,
+                          int* tangents_size,
+                          int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_getEnt1stDrvt( iGeom_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 );
+
+/**\brief 
+ *
+ */
+  void iGeom_getArr1stDrvt( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int storage_order,
+                            double const* uv,
+                            int uv_size,
+                            double** dvtr_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 );
+
+/**\brief 
+ *
+ */
+  void iGeom_getEnt2ndDrvt( iGeom_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 );
+
+/**\brief 
+ *
+ */
+  void iGeom_getArr2ndDrvt( iGeom_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 );
+
+/**\brief 
+ *
+ */
+  void iGeom_getFcCvtrUV( iGeom_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 );
+
+/**\brief 
+ *
+ */
+  void iGeom_getFcArrCvtrUV( iGeom_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 );
+
+/**\brief 
+ *
+ */
+  void iGeom_isEntPeriodic( iGeom_Instance,
+                            iBase_EntityHandle entity_handle,
+                            int* in_u,
+                            int* in_v,
+                            int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_isArrPeriodic( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int** in_uv,
+                            int* in_uv_allocated,
+                            int* in_uv_size,
+                            int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_isFcDegenerate( iGeom_Instance,
+                             iBase_EntityHandle face_handle,
+                             int* is_degenerate,
+                             int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_isFcArrDegenerate( iGeom_Instance,
+                                iBase_EntityHandle const* face_handles,
+                                int face_handles_size,
+                                int** degenerate,
+                                int* degenerate_allocated,
+                                int* degenerate_size,
+                                int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_getTolerance( iGeom_Instance,
+                           int* type,
+                           double* tolerance,
+                           int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_getEntTolerance( iGeom_Instance,
+                              iBase_EntityHandle entity_handle,
+                              double* tolerance,
+                              int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_getArrTolerance( iGeom_Instance,
+                              iBase_EntityHandle const* entity_handles,
+                              int entity_handles_size,
+                              double** tolerances,
+                              int* tolerances_allocated,
+                              int* tolerances_size,
+                              int* err );
+
+    /**\brief  Initialize an iterator over specified entity type, topology, and size
+     *
+     * Initialize an iterator over specified entity type, topology, and size,
+     * for a specified set or instance.  Iterator returned can be used as input
+     * to functions returning the entity for the iterator.  If all entities of 
+     * a specified type and/or topology are to be iterated, specify 
+     * iBase_ALL_TYPES or iGeom_ALL_TOPOLOGIES, respectively.  Specified type 
+     * or topology must be a value in the iBase_EntityType or 
+     * iGeom_EntityTopology enumerations, respectively.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set being iterated
+     * \param requested_entity_type Type of entity to iterate
+     * \param requested_entity_topology Topology of entity to iterate
+     * \param entity_iterator Pointer to iterator returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_initEntIter( iGeom_Instance,
+                          iBase_EntitySetHandle entity_set_handle,
+                          int entity_dimension,
+                          iGeom_EntityIterator* entity_iterator,
+                          int* err );
+
+    /**\brief Initialize an array iterator over specified entity type, topology, and 
+     *        size
+     *
+     * Initialize an array iterator over specified entity type, topology, 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 and/or topology are to be iterated, 
+     * specify iBase_ALL_TYPES or iGeom_ALL_TOPOLOGIES, respectively.  
+     * Specified type or topology must be a value in the iBase_EntityType or 
+     * iGeom_EntityTopology enumerations, respectively.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set being iterated
+     * \param requested_entity_type Type of entity to iterate
+     * \param requested_entity_topology Topology of entity to iterate
+     * \param requested_array_size Size of chunks of handles returned for each
+     *        value of the iterator
+     * \param entArr_iterator Pointer to iterator returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_initEntArrIter( iGeom_Instance,
+                             iBase_EntitySetHandle entity_set_handle,
+                             int entity_dimension,
+                             int requested_array_size,
+                             iGeom_EntityArrIterator* entArr_iterator,
+                             int* err );
+
+    /**\brief  Get entity corresponding to an iterator and increment iterator
+     *
+     * Get the entity corresponding to an array iterator, and increment the 
+     * iterator.  Also return whether the next value of the iterator has
+     * an entity (if non-zero, next iterator value is the end of the
+     * iteration).
+     * \param instance iGeom instance handle
+     * \param entity_iterator Iterator being queried
+     * \param entity_handle Pointer to an entity handle corresponding to the
+     *        current value of iterator
+     * \param has_data Pointer to a flag indicating if the value returned
+     *        in entity_handle is valid. A non-zero value indicates the value
+     *        is valid. A zero value indicates the value is NOT valid.
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getNextEntIter( iGeom_Instance,
+                             iGeom_EntityIterator,
+                             iBase_EntityHandle* entity_handle,
+                             int* has_data,
+                             int* err );
+
+    /**\brief  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).
+     * \param instance iGeom instance handle
+     * \param entArr_iterator Iterator being queried
+     * \param *entity_handles Pointer to array of entity handles contained in
+     *        current value of iterator
+     * \param *entity_handles_allocated Pointer to allocated size of 
+     *        entity_handles array
+     * \param *entity_handles_size Pointer to occupied size of entity_handles 
+     *        array
+     * \param has_data Pointer 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.
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getNextEntArrIter( iGeom_Instance,
+                                iGeom_EntityArrIterator,
+                                iBase_EntityHandle** entity_handles,
+                                int* entity_handles_allocated,
+                                int* entity_handles_size,
+                                int* has_data,
+                                int* err );
+
+    /**\brief  Reset the iterator
+     *
+     * Reset the iterator
+     * \param instance iGeom instance handle
+     * \param entity_iterator Iterator to reset
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_resetEntIter( iGeom_Instance,
+                           iGeom_EntityIterator,
+                           int* err );
+
+    /**\brief  Reset the array iterator
+     *
+     * Reset the array iterator
+     * \param instance iGeom instance handle
+     * \param entArr_iterator Iterator to reset
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_resetEntArrIter( iGeom_Instance,
+                              iGeom_EntityArrIterator,
+                              int* err );
+
+    /**\brief  Destroy the specified iterator
+     *
+     * Destroy the specified iterator
+     * \param instance iGeom instance handle
+     * \param entity_iterator Iterator which gets destroyed
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_endEntIter( iGeom_Instance, iGeom_EntityIterator, int* err );
+
+    /**\brief  Destroy the specified array iterator
+     *
+     * Destroy the specified array iterator
+     * \param instance iGeom instance handle
+     * \param entArr_iterator Iterator which gets destroyed
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_endEntArrIter( iGeom_Instance, iGeom_EntityArrIterator, int* err );
+
+/**\brief Make a copy of the specified entity
+ *
+ */
+  void iGeom_copyEnt( iGeom_Instance,
+                      iBase_EntityHandle source,
+                      iBase_EntityHandle* copy,
+                      int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_sweepEntAboutAxis( iGeom_Instance,
+                                iBase_EntityHandle geom_entity,
+                                double angle,
+                                double axis_normal_x,
+                                double axis_normal_y,
+                                double axis_normal_z,
+                                iBase_EntityHandle* geom_entity2,
+                                int* err );
+
+  /**\brief Delete all entities and sets
+   */
+  void iGeom_deleteAll( iGeom_Instance, int* err );
+
+    /**\brief  Delete specified entity
+     *
+     * Delete specified entity
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity to be deleted
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_deleteEnt( iGeom_Instance,
+                        iBase_EntityHandle,
+                        int* err );
+
+    /**\brief Create a sphere centered on the origin
+     */
+  void iGeom_createSphere( iGeom_Instance,
+                           double radius,
+                           iBase_EntityHandle* sphere_handle_out,
+                           int* err );
+
+/**\brief Create a prism centered on the origin
+ */
+void iGeom_createPrism( iGeom_Instance,
+                   double height,
+		   int n_sides,
+		   double major_rad,
+	           double minor_rad,
+	           iBase_EntityHandle* prism_handle_out,
+                   int* err );
+
+/**\brief Create an axis-oriented box 
+ *
+ * Create an axis-oriented box of the given dimensions, centered at the origin
+ */
+  void iGeom_createBrick( iGeom_Instance,
+                          double x,
+                          double y,
+                          double z,
+                          iBase_EntityHandle* geom_entity,
+                          int* err );
+
+/**\brief 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).
+ * \param height The height of the cylinder.
+ * \param major_rad The x-axis radius
+ * \param minor_rad The y-axis radius. If minor_rad is 0, the cylinder will 
+ *                  be circular (as if minor_rad == major_rad).
+ */
+  void iGeom_createCylinder( iGeom_Instance,
+                             double height,
+                             double major_rad,
+                             double minor_rad,
+                             iBase_EntityHandle* geom_entity,
+                             int* err );
+
+/**\brief 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.
+ * 
+ * \param height The height of the cone.
+ * \param major_rad_base The x-axis radius at the base of the cylinder 
+ * \param minor_rad_base The 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)
+ * \param rad_top The 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.
+ */
+  void iGeom_createCone( iGeom_Instance,
+			 double height,
+			 double major_rad_base,
+			 double minor_rad_base,
+			 double rad_top,
+			 iBase_EntityHandle* geom_entity,
+			 int* err );
+
+/**\brief Create a torus
+ *
+ * Create a torus centered on the origin and encircling the z-axis.
+ *
+ * \param major_rad The distance from the origin to the center of the
+ *                  torus's circular cross-section.
+ * \param minor_rad The radius of the cross-section.
+ */
+  void iGeom_createTorus( iGeom_Instance,
+                          double major_rad,
+                          double minor_rad,
+                          iBase_EntityHandle* geom_entity,
+                          int* err );
+
+/**\brief Move an entity by the given vector
+ *
+ */
+  void iGeom_moveEnt( iGeom_Instance,
+                      iBase_EntityHandle geom_entity,
+                      double x,
+                      double y,
+                      double z,
+                      int* err );
+
+/**\brief Rotate an entity about a given axis
+ *
+ * \param angle The rotational angle, in degrees.
+ */
+  void iGeom_rotateEnt( iGeom_Instance,
+                        iBase_EntityHandle geom_entity,
+                        double angle,
+                        double axis_normal_x,
+                        double axis_normal_y,
+                        double axis_normal_z,
+                        int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_reflectEnt( iGeom_Instance,
+                         iBase_EntityHandle geom_entity,
+                         double plane_normal_x,
+                         double plane_normal_y,
+                         double plane_normal_z,
+                         int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_scaleEnt( iGeom_Instance,
+                       iBase_EntityHandle geom_entity,
+                       double scale_x,
+                       double scale_y,
+                       double scale_z,
+                       int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_uniteEnts( iGeom_Instance,
+                        iBase_EntityHandle const* geom_entities,
+                        int geom_entities_size,
+                        iBase_EntityHandle* geom_entity,
+                        int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_subtractEnts( iGeom_Instance,
+                           iBase_EntityHandle blank,
+                           iBase_EntityHandle tool,
+                           iBase_EntityHandle* geom_entity,
+                           int* err );
+
+/**\brief
+ */
+  void iGeom_intersectEnts( iGeom_Instance,
+                            iBase_EntityHandle entity2,
+			    iBase_EntityHandle entity1,
+			    iBase_EntityHandle* geom_entity,
+			    int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_sectionEnt( iGeom_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 );
+
+/**\brief 
+ *
+ */
+  void iGeom_imprintEnts( iGeom_Instance,
+                          iBase_EntityHandle const* geom_entities,
+                          int geom_entities_size,
+                          int* err );
+
+/**\brief 
+ *
+ */
+  void iGeom_mergeEnts( iGeom_Instance,
+                        iBase_EntityHandle const* geom_entities,
+                        int geom_entities_size,
+                        double tolerance,
+                        int* err );
+
+
+    /**\brief  Create an entity set
+     *
+     * Create an entity set, either ordered (isList=1) or unordered 
+     * (isList=0).  Unordered entity sets can contain a given entity or 
+     * set only once.
+     * \param instance iGeom instance handle
+     * \param isList If non-zero, an ordered list is created, otherwise an
+     *        unordered set is created.
+     * \param entity_set_created Entity set created by function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_createEntSet(iGeom_Instance instance,
+                          int isList,
+                          iBase_EntitySetHandle* entity_set_created, 
+                          int *err);
+
+
+    /**\brief  Destroy an entity set
+     *
+     * Destroy an entity set
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set to be destroyed
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_destroyEntSet(iGeom_Instance instance,
+                           iBase_EntitySetHandle entity_set, 
+                           int *err);
+
+    /**\brief  Return whether a specified set is ordered or unordered
+     *
+     * Return whether a specified set is ordered (*is_list=1) or 
+     * unordered (*is_list=0)
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set being queried
+     * \param is_list Pointer to flag returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_isList(iGeom_Instance instance,
+                    iBase_EntitySetHandle entity_set,
+                    int *is_list, 
+                    int *err);
+
+    /**\brief  Get the number of entity sets contained in a set or interface
+     *
+     * Get the number of entity sets contained in a set or interface.  If
+     * a set is input which is not the root set, num_hops indicates the 
+     * maximum number of contained sets from entity_set_handle to one of the
+     * contained sets, inclusive of the contained set.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set being queried
+     * \param num_hops Maximum hops from entity_set_handle to contained set,
+     *        inclusive of the contained set
+     * \param num_sets Pointer to the number of sets returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getNumEntSets(iGeom_Instance instance,
+                           iBase_EntitySetHandle entity_set_handle,
+                           int num_hops,
+                           int *num_sets, 
+                           int *err);
+
+
+    /**\brief  Get the entity sets contained in a set or interface
+     *
+     * Get the entity sets contained in a set or interface.  If
+     * a set is input which is not the root set, num_hops indicates the 
+     * maximum number of contained sets from entity_set_handle to one of the
+     * contained sets, inclusive of the contained set.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set being queried
+     * \param num_hops Maximum hops from entity_set_handle to contained set,
+     *        inclusive of the contained set
+     * \param *contained_set_handles Pointer to array of set handles returned
+     *        from function
+     * \param contained_set_handles_allocated Pointer to allocated length of
+     *        contained_set_handles array
+     * \param contained_set_handles_size Pointer to occupied length of
+     *        contained_set_handles array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEntSets(iGeom_Instance instance,
+                        iBase_EntitySetHandle entity_set_handle,
+                        int num_hops,
+                        iBase_EntitySetHandle** contained_set_handles,
+                        int* contained_set_handles_allocated,
+                        int* contained_set_handles_size, 
+                        int *err);
+
+    /**\brief  Add an entity to a set
+     *
+     * Add an entity to a set
+     * \param instance iGeom instance handle
+     * \param entity_handle The entity being added
+     * \param entity_set Pointer to the set being added to
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_addEntToSet(iGeom_Instance instance,
+                         iBase_EntityHandle entity_handle,
+                         iBase_EntitySetHandle entity_set, 
+                         int *err);
+
+    /**\brief  Remove an entity from a set
+     *
+     * Remove an entity from a set
+     *
+     * \param instance iGeom instance handle
+     * \param entity_handle The entity being removed
+     * \param entity_set Pointer to the set being removed from
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_rmvEntFromSet(iGeom_Instance instance,
+                           iBase_EntityHandle entity_handle,
+                           iBase_EntitySetHandle entity_set, 
+                           int *err);
+
+
+    /**\brief  Add an array of entities to a set
+     *
+     * Add an array of entities to a set
+     * \param instance iGeom instance handle
+     * \param entity_handles Array of entities being added
+     * \param entity_handles_size Number of entities in entity_handles array
+     * \param entity_set Pointer to the set being added to
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_addEntArrToSet(iGeom_Instance instance,
+                            const iBase_EntityHandle* entity_handles,
+                            int entity_handles_size,
+                            iBase_EntitySetHandle entity_set, 
+                            int *err);
+
+
+    /**\brief  Remove an array of entities from a set
+     *
+     * Remove an array of entities from a set
+     * \param instance iGeom instance handle
+     * \param entity_handles Array of entities being remove
+     * \param entity_handles_size Number of entities in entity_handles array
+     * \param entity_set Pointer to the set being removed from
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_rmvEntArrFromSet(iGeom_Instance instance,
+                              const iBase_EntityHandle* entity_handles,
+                              int entity_handles_size,
+                              iBase_EntitySetHandle entity_set,
+                              int *err);
+
+
+    /**\brief  Add an entity set to a set
+     *
+     * Add an entity set to a set
+     * \param instance iGeom instance handle
+     * \param entity_set_to_add The entity set being added
+     * \param entity_set_handle Pointer to the set being added to
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_addEntSet(iGeom_Instance instance,
+                       iBase_EntitySetHandle entity_set_to_add,
+                       iBase_EntitySetHandle entity_set_handle, 
+                       int *err);
+
+
+    /**\brief  Remove an entity set from a set
+     *
+     * Remove an entity set from a set
+     * \param instance iGeom instance handle
+     * \param entity_set_to_remove The entity set being removed
+     * \param entity_set_handle Pointer to the set being removed from
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_rmvEntSet(iGeom_Instance instance,
+                       iBase_EntitySetHandle entity_set_to_remove,
+                       iBase_EntitySetHandle entity_set_handle, 
+                       int *err);
+
+    /**\brief  Return whether an entity is contained in another set
+     *
+     * Return whether an entity is contained (*is_contained=1) or not 
+     * contained (*is_contained=0) in another set
+     * \param instance iGeom instance handle
+     * \param containing_entity_set Entity set being queried
+     * \param contained_entity Entity potentially contained in 
+     *        containing_entity_set
+     * \param is_contained Pointer to flag returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_isEntContained(iGeom_Instance instance,
+                            iBase_EntitySetHandle containing_entity_set,
+                            iBase_EntityHandle contained_entity,
+                            int *is_contained, 
+                            int *err);
+
+    /**\brief  Return whether entities are contained in a set
+     *
+     * Return whether each entity is contained in the set.
+     * \param instance iMesh instance handle
+     * \param containing_entity_set Entity set being queried
+     * \param entity_handles List of entities for which to check containment.
+     * \param is_contained One value for each input entity, 1 if contained
+     *          in set, zero otherwise.
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_isEntArrContained( iGeom_Instance instance,
+                         /*in*/ iBase_EntitySetHandle containing_set,
+                         /*in*/ const iBase_EntityHandle* entity_handles,
+                         /*in*/ int num_entity_handles,
+                      /*inout*/ int** is_contained,
+                      /*inout*/ int* is_contained_allocated,
+                        /*out*/ int* is_contained_size,
+                        /*out*/ int* err );
+
+    /**\brief  Return whether an entity set is contained in another set
+     *
+     * Return whether a set is contained (*is_contained=1) or not contained
+     * (*is_contained=0) in another set
+     * \param instance iGeom instance handle
+     * \param containing_entity_set Entity set being queried
+     * \param contained_entity_set Entity set potentially contained in 
+     *        containing_entity_set
+     * \param is_contained Pointer to flag returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_isEntSetContained(iGeom_Instance instance,
+                               iBase_EntitySetHandle containing_entity_set,
+                               iBase_EntitySetHandle contained_entity_set,
+                               int *is_contained, 
+                               int *err);
+
+    /**\brief  Add parent/child links between two sets
+     *
+     * Add parent/child links between two sets.  Makes parent point to child
+     * and child point to parent.
+     * \param instance iGeom instance handle
+     * \param parent_entity_set Pointer to parent set
+     * \param child_entity_set Pointer to child set
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_addPrntChld(iGeom_Instance instance,
+                         iBase_EntitySetHandle parent_entity_set,
+                         iBase_EntitySetHandle child_entity_set, 
+                         int *err);
+
+    /**\brief  Remove parent/child links between two sets
+     *
+     * Remove parent/child links between two sets.
+     * \param instance iGeom instance handle
+     * \param parent_entity_set Pointer to parent set
+     * \param child_entity_set Pointer to child set
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_rmvPrntChld(iGeom_Instance instance,
+                         iBase_EntitySetHandle parent_entity_set,
+                         iBase_EntitySetHandle child_entity_set, 
+                         int *err);
+
+    /**\brief  Return whether two sets are related by parent/child links
+     *
+     * Return whether two sets are related (*is_child=1) or not (*is_child=0)
+     * by parent/child links
+     * \param instance iGeom instance handle
+     * \param parent_entity_set Pointer to parent set
+     * \param child_entity_set Pointer to child set
+     * \param is_child Pointer to flag returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_isChildOf(iGeom_Instance instance,
+                       iBase_EntitySetHandle parent_entity_set,
+                       iBase_EntitySetHandle child_entity_set,
+                       int *is_child, 
+                       int *err);
+
+    /**\brief  Get the number of child sets linked from a specified set
+     *
+     * Get the number of child sets linked from a specified set.  If num_hops
+     * is non-zero, this represents the maximum hops from entity_set to any
+     * child in the count.
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set being queried
+     * \param num_hops Maximum hops from entity_set_handle to child set,
+     *        inclusive of the child set
+     * \param num_child Pointer to number of children returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getNumChld(iGeom_Instance instance,
+                        iBase_EntitySetHandle entity_set,
+                        int num_hops,
+                        int *num_child, 
+                        int *err);
+
+    /**\brief  Get the number of parent sets linked from a specified set
+     *
+     * Get the number of parent sets linked from a specified set.  If num_hops
+     * is non-zero, this represents the maximum hops from entity_set to any
+     * parent in the count.
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set being queried
+     * \param num_hops Maximum hops from entity_set_handle to parent set,
+     *        inclusive of the parent set
+     * \param num_parent Pointer to number of parents returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getNumPrnt(iGeom_Instance instance,
+                        iBase_EntitySetHandle entity_set,
+                        int num_hops,
+                        int *num_parent, 
+                        int *err);
+
+    /**\brief  Get the child sets linked from a specified set
+     *
+     * Get the child sets linked from a specified set.  If num_hops
+     * is non-zero, this represents the maximum hops from entity_set to any
+     * child.
+     * \param instance iGeom instance handle
+     * \param from_entity_set Entity set being queried
+     * \param num_hops Maximum hops from entity_set_handle to child set,
+     *        inclusive of the child set
+     * \param *entity_set_handles Pointer to array of child sets
+     *        returned from function
+     * \param *entity_set_handles_allocated Pointer to allocated size of 
+     *        entity_set_handles array
+     * \param *entity_set_handles_size Pointer to occupied size of 
+     *        entity_set_handles array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getChldn(iGeom_Instance instance,
+                      iBase_EntitySetHandle from_entity_set,
+                      int num_hops,
+                      iBase_EntitySetHandle** entity_set_handles,
+                      int* entity_set_handles_allocated,
+                      int* entity_set_handles_size, 
+                      int *err);
+
+    /**\brief  Get the parent sets linked from a specified set
+     *
+     * Get the parent sets linked from a specified set.  If num_hops
+     * is non-zero, this represents the maximum hops from entity_set to any
+     * parent.
+     * \param instance iGeom instance handle
+     * \param from_entity_set Entity set being queried
+     * \param num_hops Maximum hops from entity_set_handle to parent set,
+     *        inclusive of the parent set
+     * \param *entity_set_handles Pointer to array of parent sets
+     *        returned from function
+     * \param *entity_set_handles_allocated Pointer to allocated size of 
+     *        entity_set_handles array
+     * \param *entity_set_handles_size Pointer to occupied size of 
+     *        entity_set_handles array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getPrnts(iGeom_Instance instance,
+                      iBase_EntitySetHandle from_entity_set,
+                      int num_hops,
+                      iBase_EntitySetHandle** entity_set_handles,
+                      int* entity_set_handles_allocated,
+                      int* entity_set_handles_size, 
+                      int *err);
+
+    /**\brief  Create a tag with specified name, size, and type
+     *
+     * Create a tag with specified name, size, and type.  Tag size is in
+     * units of size of tag_type data types.  Value input for tag type must be 
+     * value in iBase_TagType enumeration.
+     * \param instance iGeom instance handle
+     * \param tag_name Character string indicating tag name
+     * \param tag_size Size of each tag value, in units of number of tag_type 
+     *        entities
+     * \param tag_type Data type for data stored in this tag
+     * \param tag_handle Pointer to tag handle returned from function
+     * \param *err Pointer to error type returned from function
+     * \param tag_name_len Length of tag name string
+     */
+  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 );
+
+
+    /**\brief  Destroy a tag
+     *
+     * Destroy a tag.  If forced is non-zero and entities still have values
+     * set for this tag, tag is deleted anyway and those values disappear,
+     * otherwise tag is not deleted.
+     * \param instance iGeom instance handle
+     * \param tag_handle Handle of tag to be deleted
+     * \param forced If non-zero, delete the tag even if entities have values
+     *        set for that tag
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_destroyTag(iGeom_Instance instance,
+                        iBase_TagHandle tag_handle,
+                        int forced, 
+                        int *err);
+
+    /**\brief  Get the name for a given tag handle
+     *
+     * Get the name for a given tag handle
+     * \param instance iGeom instance handle
+     * \param tag_handle Tag handle being queried
+     * \param name Pointer to character string to store name returned from 
+     *        function
+     * \param *err Pointer to error type returned from function
+     * \param name_len Length of character string input to function
+     */
+  void iGeom_getTagName(iGeom_Instance instance,
+                        iBase_TagHandle tag_handle,
+                        char *name, 
+                        int* err,
+                        int name_len);
+
+    /**\brief  Get size of a tag in units of numbers of tag data type
+     *
+     * Get size of a tag in units of numbers of tag data type
+     * \param instance iGeom instance handle
+     * \param tag_handle Handle of tag being queried
+     * \param tag_size Pointer to tag size returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getTagSizeValues(iGeom_Instance instance,
+                              iBase_TagHandle tag_handle,
+                              int *tag_size, 
+                              int *err);
+
+    /**\brief  Get size of a tag in units of bytes
+     *
+     * Get size of a tag in units of bytes
+     * \param instance iGeom instance handle
+     * \param tag_handle Handle of tag being queried
+     * \param tag_size Pointer to tag size returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getTagSizeBytes(iGeom_Instance instance,
+                             iBase_TagHandle tag_handle,
+                             int *tag_size, 
+                             int *err);
+
+    /**\brief  Get a the handle of an existing tag with the specified name
+     *
+     * Get a the handle of an existing tag with the specified name
+     * \param instance iGeom instance handle
+     * \param tag_name Name of tag being queried
+     * \param tag_handle Pointer to tag handle returned from function
+     * \param *err Pointer to error type returned from function
+     * \param tag_name_len Length of tag name string
+     */
+  void iGeom_getTagHandle(iGeom_Instance instance,
+                          const char* tag_name,
+                          iBase_TagHandle *tag_handle, 
+                          int *err,
+                          int tag_name_len);
+
+    /**\brief  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.
+     * \param instance iGeom instance handle
+     * \param tag_handle Handle for the tag being queried
+     * \param tag_type Pointer to tag type returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getTagType(iGeom_Instance instance,
+                        iBase_TagHandle tag_handle,
+                        int *tag_type, 
+                        int *err);
+
+
+    /**\brief  Set a tag value of arbitrary type on an entity set
+     *
+     * Set a tag value of arbitrary type on an entity set.  Tag data is 
+     * passed as char* type,
+     * but really represents pointer to arbitrary data.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set on which tag is being set
+     * \param tag_handle Tag being set on an entity set
+     * \param tag_value Pointer to tag data being set on entity set
+     * \param tag_value_size Size in bytes of tag data
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setEntSetData(iGeom_Instance instance,
+                           iBase_EntitySetHandle entity_set_handle,
+                           iBase_TagHandle tag_handle,
+                           const char* tag_value,
+                           int tag_value_size, 
+                           int *err);
+
+
+    /**\brief  Set a tag value of integer type on an entity set
+     *
+     * Set a tag value of integer type on an entity set.
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set on which tag is being set
+     * \param tag_handle Tag being set on an entity set
+     * \param tag_value Tag value being set on entity set
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setEntSetIntData(iGeom_Instance instance,
+                              iBase_EntitySetHandle entity_set,
+                              iBase_TagHandle tag_handle,
+                              int tag_value, 
+                              int *err);
+
+
+    /**\brief  Set a tag value of double type on an entity set
+     *
+     * Set a tag value of double type on an entity set.
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set on which tag is being set
+     * \param tag_handle Tag being set on an entity set
+     * \param tag_value Tag value being set on entity set
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setEntSetDblData(iGeom_Instance instance,
+                              iBase_EntitySetHandle entity_set,
+                              iBase_TagHandle tag_handle,
+                              double tag_value, 
+                              int *err);
+
+
+    /**\brief  Set a tag value of entity handle type on an entity set
+     *
+     * Set a tag value of entity handle type on an entity set.
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set on which tag is being set
+     * \param tag_handle Tag being set on an entity set
+     * \param tag_value Tag value being set on entity set
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setEntSetEHData(iGeom_Instance instance,
+                             iBase_EntitySetHandle entity_set,
+                             iBase_TagHandle tag_handle,
+                             iBase_EntityHandle tag_value, 
+                             int *err);
+
+
+    /**\brief  Get the value of a tag of arbitrary type on an entity set
+     *
+     * Get the value of a tag of arbitrary type on an entity set.  Tag data 
+     * is passed back as char* type, but really represents arbitrary data.
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set on which tag is being set
+     * \param tag_handle Tag being set on an entity set
+     * \param *tag_value Pointer to tag data array being queried
+     * \param *tag_value_allocated Pointer to tag data array allocated size
+     * \param *tag_value_size Pointer to tag data array occupied size
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEntSetData(iGeom_Instance instance,
+                           iBase_EntitySetHandle entity_set_handle,
+                           iBase_TagHandle tag_handle,
+                           char** tag_value,
+                           int* tag_value_allocated,
+                           int* tag_value_size, 
+                           int *err);
+
+    /**\brief  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.
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set on which tag is being set
+     * \param tag_handle Tag being set on an entity set
+     * \param *out_data Pointer to tag value returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEntSetIntData(iGeom_Instance instance,
+                              iBase_EntitySetHandle entity_set,
+                              iBase_TagHandle tag_handle,
+                              int *out_data, 
+                              int *err);
+
+    /**\brief  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.
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set on which tag is being set
+     * \param tag_handle Tag being set on an entity set
+     * \param *out_data Pointer to tag value returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEntSetDblData(iGeom_Instance instance,
+                              iBase_EntitySetHandle entity_set,
+                              iBase_TagHandle tag_handle,
+                              double *out_data, 
+                              int *err);
+
+    /**\brief  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.
+     * \param instance iGeom instance handle
+     * \param entity_set Entity set on which tag is being set
+     * \param tag_handle Tag being set on an entity set
+     * \param *out_data Pointer to tag value returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEntSetEHData(iGeom_Instance instance,
+                             iBase_EntitySetHandle entity_set,
+                             iBase_TagHandle tag_handle,
+                             iBase_EntityHandle *out_data, 
+                             int *err);
+
+    /**\brief  Get all the tags associated with a specified entity set
+     *
+     * Get all the tags associated with a specified entity set
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity being queried
+     * \param *tag_handles Pointer to array of tag_handles returned from 
+     *        function
+     * \param *tag_handles_allocated Pointer to allocated size of tag_handles 
+     *        array
+     * \param *tag_handles_size Pointer to occupied size of tag_handles array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getAllEntSetTags(iGeom_Instance instance,
+                              iBase_EntitySetHandle entity_set_handle,
+                              iBase_TagHandle** tag_handles,
+                              int* tag_handles_allocated,
+                              int* tag_handles_size, 
+                              int *err);
+
+    /**\brief  Remove a tag value from an entity set
+     *
+     * Remove a tag value from an entity set
+     * \param instance iGeom instance handle
+     * \param entity_set_handle Entity set from which tag is being removed
+     * \param tag_handle Tag handle of tag being removed
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_rmvEntSetTag(iGeom_Instance instance,
+                          iBase_EntitySetHandle entity_set_handle,
+                          iBase_TagHandle tag_handle, 
+                          int *err);
+
+
+    /**\brief  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 char* type, but really represents arbitrary data.
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity array on which tag is being set
+     * \param entity_handles_size Number of entities in array
+     * \param tag_handle Tag being set on an entity
+     * \param *tag_values Pointer to tag data array being returned from 
+     *        function
+     * \param tag_values_allocated Pointer to allocated size of tag data array
+     * \param tag_values_size Pointer to occupied size of tag data array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getArrData(iGeom_Instance instance,
+                        const iBase_EntityHandle* entity_handles,
+                        int entity_handles_size,
+                        iBase_TagHandle tag_handle,
+                        char** tag_values,
+                        int* tag_values_allocated,
+                        int* tag_values_size, 
+                        int *err);
+
+    /**\brief  Get tag values of integer type for an array of entities
+     *
+     * Get tag values of integer type for an array of entities.
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity array on which tag is being set
+     * \param entity_handles_size Number of entities in array
+     * \param tag_handle Tag being set on an entity
+     * \param *tag_values Pointer to tag data array being returned from 
+     *        function
+     * \param tag_values_allocated Pointer to allocated size of tag data array
+     * \param tag_values_size Pointer to occupied size of tag data array
+     * \param *err Pointer to error type returned from function
+     */
+  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);
+
+    /**\brief  Get tag values of double type for an array of entities
+     *
+     * Get tag values of double type for an array of entities.
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity array on which tag is being set
+     * \param entity_handles_size Number of entities in array
+     * \param tag_handle Tag being set on an entity
+     * \param *tag_values Pointer to tag data array being returned from 
+     *        function
+     * \param tag_values_allocated Pointer to allocated size of tag data array
+     * \param tag_values_size Pointer to occupied size of tag data array
+     * \param *err Pointer to error type returned from function
+     */
+  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);
+
+    /**\brief  Get tag values of entity handle type for an array of entities
+     *
+     * Get tag values of entity handle type for an array of entities.
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity array on which tag is being set
+     * \param entity_handles_size Number of entities in array
+     * \param tag_handle Tag being set on an entity
+     * \param *tag_value Pointer to tag data array being returned from 
+     *        function
+     * \param tag_value_allocated Pointer to allocated size of tag data array
+     * \param tag_value_size Pointer to occupied size of tag data array
+     * \param *err Pointer to error type returned from function
+     */
+  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);
+
+    /**\brief  Set tag values of arbitrary type on an array of entities
+     *
+     * Set tag values of arbitrary type on an array of entities.  Tag data is 
+     * passed as char* type, but really represents pointer to arbitrary data.
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity array on which tag is being set
+     * \param entity_handles_size Number of entities in array
+     * \param tag_handle Tag being set on an entity
+     * \param tag_values Pointer to tag data being set on entity
+     * \param tag_values_size Size in total bytes of tag data
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setArrData(iGeom_Instance instance,
+                        const iBase_EntityHandle* entity_handles,
+                        int entity_handles_size,
+                        iBase_TagHandle tag_handle,
+                        const char* tag_values,
+                        int tag_values_size, 
+                        int *err);
+
+    /**\brief  Set tag values of integer type on an array of entities
+     *
+     * Set tag values of integer type on an array of entities.
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity array on which tag is being set
+     * \param entity_handles_size Number of entities in array
+     * \param tag_handle Tag being set on an entity
+     * \param tag_values Pointer to tag data being set on entities
+     * \param tag_values_size Size in total number of integers of tag data
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setIntArrData(iGeom_Instance instance,
+                           const iBase_EntityHandle* entity_handles,
+                           int entity_handles_size,
+                           iBase_TagHandle tag_handle,
+                           const int* tag_values,
+                           int tag_values_size, 
+                           int *err);
+
+    /**\brief  Set tag values of double type on an array of entities
+     *
+     * Set tag values of double type on an array of entities.
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity array on which tag is being set
+     * \param entity_handles_size Number of entities in array
+     * \param tag_handle Tag being set on an entity
+     * \param tag_values Pointer to tag data being set on entities
+     * \param tag_values_size Size in total number of doubles of tag data
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setDblArrData(iGeom_Instance instance,
+                           const iBase_EntityHandle* entity_handles,
+                           int entity_handles_size,
+                           iBase_TagHandle tag_handle,
+                           const double* tag_values,
+                           const int tag_values_size, 
+                           int *err);
+
+    /**\brief  Set tag values of entity handle type on an array of entities
+     *
+     * Set tag values of entity handle type on an array of entities.
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity array on which tag is being set
+     * \param entity_handles_size Number of entities in array
+     * \param tag_handle Tag being set on an entity
+     * \param tag_values Pointer to tag data being set on entities
+     * \param tag_values_size Size in total number of entity handles of tag 
+     *        data
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setEHArrData(iGeom_Instance instance,
+                          const iBase_EntityHandle* entity_handles,
+                          int entity_handles_size,
+                          iBase_TagHandle tag_handle,
+                          const iBase_EntityHandle* tag_values,
+                          int tag_values_size, 
+                          int *err);
+
+    /**\brief  Remove a tag value from an array of entities
+     *
+     * Remove a tag value from an array of entities
+     * \param instance iGeom instance handle
+     * \param entity_handles Entity from which tag is being removed
+     * \param entity_handles_size Number of entities in entity array
+     * \param tag_handle Tag handle of tag being removed
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_rmvArrTag(iGeom_Instance instance,
+                       const iBase_EntityHandle* entity_handles,
+                       int entity_handles_size,
+                       iBase_TagHandle tag_handle, 
+                       int *err);
+
+    /**\brief  Get the value of a tag of arbitrary type on an entity
+     *
+     * Get the value of a tag of arbitrary type on an entity.  Tag data 
+     * is passed back as char* type, but really represents arbitrary data.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity on which tag is being set
+     * \param tag_handle Tag being set on an entity
+     * \param *tag_value Pointer to tag data array being queried
+     * \param *tag_value_allocated Pointer to tag data array allocated size
+     * \param *tag_value_size Pointer to tag data array occupied size
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getData(iGeom_Instance instance,
+                     iBase_EntityHandle entity_handle,
+                     iBase_TagHandle tag_handle,
+                     char** tag_value,
+                     int *tag_value_allocated,
+                     int *tag_value_size, 
+                     int *err);
+
+    /**\brief  Get the value of a tag of integer type on an entity
+     *
+     * Get the value of a tag of integer type on an entity.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity on which tag is being set
+     * \param tag_handle Tag being set on an entity
+     * \param *out_data Pointer to tag value returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getIntData(iGeom_Instance instance,
+                        iBase_EntityHandle entity_handle,
+                        iBase_TagHandle tag_handle,
+                        int *out_data, 
+                        int *err);
+
+    /**\brief  Get the value of a tag of double type on an entity
+     *
+     * Get the value of a tag of double type on an entity.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity on which tag is being set
+     * \param tag_handle Tag being set on an entity
+     * \param *out_data Pointer to tag value returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getDblData(iGeom_Instance instance,
+                        /*in*/ const iBase_EntityHandle entity_handle,
+                        /*in*/ const iBase_TagHandle tag_handle,
+                        double *out_data, int *err);
+
+    /**\brief  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.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity on which tag is being set
+     * \param tag_handle Tag being set on an entity
+     * \param *out_data Pointer to tag value returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getEHData(iGeom_Instance instance,
+                       iBase_EntityHandle entity_handle,
+                       iBase_TagHandle tag_handle,
+                       iBase_EntityHandle *out_data, 
+                       int *err);
+
+    /**\brief  Set a tag value of arbitrary type on an entity
+     *
+     * Set a tag value of arbitrary type on an entity.  Tag data is 
+     * passed as char* type, but really represents pointer to arbitrary data.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity on which tag is being set
+     * \param tag_handle Tag being set on an entity
+     * \param tag_value Pointer to tag data being set on entity
+     * \param tag_value_size Size in bytes of tag data
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setData(iGeom_Instance instance,
+                     iBase_EntityHandle entity_handle,
+                     iBase_TagHandle tag_handle,
+                     const char* tag_value,
+                     int tag_value_size, 
+                     int *err);
+
+    /**\brief  Set a tag value of integer type on an entity
+     *
+     * Set a tag value of integer type on an entity.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity on which tag is being set
+     * \param tag_handle Tag being set on an entity
+     * \param tag_value Tag value being set on entity
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setIntData(iGeom_Instance instance,
+                        iBase_EntityHandle entity_handle,
+                        iBase_TagHandle tag_handle,
+                        int tag_value, 
+                        int *err);
+
+    /**\brief  Set a tag value of double type on an entity
+     *
+     * Set a tag value of double type on an entity.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity on which tag is being set
+     * \param tag_handle Tag being set on an entity
+     * \param tag_value Tag value being set on entity
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setDblData(iGeom_Instance instance,
+                        iBase_EntityHandle entity_handle,
+                        iBase_TagHandle tag_handle,
+                        double tag_value, 
+                        int *err);
+
+    /**\brief  Set a tag value of entity handle type on an entity
+     *
+     * Set a tag value of entity handle type on an entity.
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity on which tag is being set
+     * \param tag_handle Tag being set on an entity
+     * \param tag_value Tag value being set on entity
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_setEHData(iGeom_Instance instance,
+                       iBase_EntityHandle entity_handle,
+                       iBase_TagHandle tag_handle,
+                       iBase_EntityHandle tag_value, 
+                       int *err);
+
+    /**\brief  Get all the tags associated with a specified entity handle
+     *
+     * Get all the tags associated with a specified entity handle
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity being queried
+     * \param *tag_handles Pointer to array of tag_handles returned from 
+     *        function
+     * \param *tag_handles_allocated Pointer to allocated size of tag_handles 
+     *        array
+     * \param *tag_handles_size Pointer to occupied size of tag_handles array
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_getAllTags(iGeom_Instance instance,
+                        iBase_EntityHandle entity_handle,
+                        iBase_TagHandle** tag_handles,
+                        int* tag_handles_allocated,
+                        int* tag_handles_size, 
+                        int *err);
+
+    /**\brief  Remove a tag value from an entity
+     *
+     * Remove a tag value from an entity
+     * \param instance iGeom instance handle
+     * \param entity_handle Entity from which tag is being removed
+     * \param tag_handle Tag handle of tag being removed
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_rmvTag(iGeom_Instance instance,
+                    iBase_EntityHandle entity_handle,
+                    iBase_TagHandle tag_handle, 
+                    int *err);
+
+    /**\brief  Subtract contents of one entity set from another
+     *
+     * Subtract contents of one entity set from another
+     * \param instance iGeom instance handle
+     * \param entity_set_1 Entity set from which other set is being subtracted
+     * \param entity_set_2 Entity set being subtracted from other set
+     * \param result_entity_set Pointer to entity set returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_subtract(iGeom_Instance instance,
+                      iBase_EntitySetHandle entity_set_1,
+                      iBase_EntitySetHandle entity_set_2,
+                      iBase_EntitySetHandle* result_entity_set, 
+                      int *err);
+
+    /**\brief  Intersect contents of one entity set with another
+     *
+     * Intersect contents of one entity set with another
+     * \param instance iGeom instance handle
+     * \param entity_set_1 Entity set being intersected with another
+     * \param entity_set_2 Entity set being intersected with another
+     * \param result_entity_set Pointer to entity set returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_intersect(iGeom_Instance instance,
+                       iBase_EntitySetHandle entity_set_1,
+                       iBase_EntitySetHandle entity_set_2,
+                       iBase_EntitySetHandle* result_entity_set, 
+                       int *err);
+
+    /**\brief  Unite contents of one entity set with another
+     *
+     * Unite contents of one entity set with another
+     * \param instance iGeom instance handle
+     * \param entity_set_1 Entity set being united with another
+     * \param entity_set_2 Entity set being united with another
+     * \param result_entity_set Pointer to entity set returned from function
+     * \param *err Pointer to error type returned from function
+     */
+  void iGeom_unite(iGeom_Instance instance,
+                   iBase_EntitySetHandle entity_set_1,
+                   iBase_EntitySetHandle entity_set_2,
+                   iBase_EntitySetHandle* result_entity_set, 
+                   int *err);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif

Added: MOAB/trunk/tools/iGeom/iGeom_MOAB.cpp
===================================================================
--- MOAB/trunk/tools/iGeom/iGeom_MOAB.cpp	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/iGeom_MOAB.cpp	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,2099 @@
+#include "iGeom_MOAB.hpp"
+#include "iMesh.h"
+#include "MBInterface.hpp"
+#include "GeomTopoTool.hpp"
+#include "MBOrientedBox.hpp"
+#include "MBOrientedBoxTreeTool.hpp"
+#include "MBCartVect.hpp"
+
+iBase_Error iGeom_LAST_ERROR;
+bool i_created = false; // if interface is created
+bool t_created = false;
+MBRange _my_gsets[4];
+GeomTopoTool* _my_geomTopoTool = NULL;
+
+//int treeOffset = 0; // if obb tree is created, set to the first root set
+//MBRange _my_treeRootSets;
+//MBOrientedBoxTreeTool _my_obbTree;
+
+#define COPY_RANGE(r, vec) {                      \
+    MBEntityHandle *tmp_ptr = reinterpret_cast<MBEntityHandle*>(vec);	\
+    std::copy(r.begin(), r.end(), tmp_ptr);}
+ 
+static inline void
+iGeom_processError(iBase_ErrorType code, const char* desc);
+
+static void
+iGeom_get_adjacent_entities(iGeom_Instance instance,
+			    const MBEntityHandle from, 
+			    const int to_dim,
+			    MBRange &adj_ents, int* err);
+
+void iGeom_getDescription( iGeom_Instance instance,
+                           char* descr,
+                           int* err,
+                           int descr_len )
+{
+  unsigned int len = MIN(strlen(iGeom_LAST_ERROR.description), ((unsigned int) descr_len));
+  strncpy(descr, iGeom_LAST_ERROR.description, len);
+  descr[len] = '\0';
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getErrorType(iGeom_Instance instance,
+                        /*out*/ int *error_type, 
+                        int *err)
+{
+  *error_type = iGeom_LAST_ERROR.error_type;
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_newGeom( char const* options,
+                    iGeom_Instance* instance_out,
+                    int* err,
+                    int options_len ) 
+{
+  if (*instance_out && !(reinterpret_cast<MBInterface*>(instance_out))) {
+    *err = iBase_INVALID_ENTITY_TYPE;
+    ERRORR("Passed in instance must be an MBInterface*.");
+  }
+
+  // make a new imesh instance
+  iMesh_newMesh(options, reinterpret_cast<iMesh_Instance*>(instance_out),
+		err, options_len);
+  ERRORR("Failure to create instance.");
+
+  i_created = true;
+
+  RETURN(iBase_SUCCESS);
+}
+  
+void iGeom_dtor( iGeom_Instance instance, int* err ) 
+{
+  if (i_created) {
+    iMesh_dtor(IMESH_INSTANCE(instance), err);
+    ERRORR("Failed to destruct instance.");
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_load( iGeom_Instance instance,
+                 char const* name,
+                 char const* options,
+                 int* err,
+                 int name_len,
+                 int options_len ) 
+{
+  // load mesh-based geometry
+  iMesh_load(IMESH_INSTANCE(instance), NULL, name, options, err, 
+             name_len, options_len);
+  ERRORR("Failure to load geometry.");
+  
+  // keep mesh-based geometries in MBRange
+  GETGTT(instance);
+  MBErrorCode rval = _my_geomTopoTool->find_geomsets(_my_gsets);
+  MBERRORR("Failure to keep geometry list.");
+
+  RETURN(iBase_SUCCESS);
+}
+
+  
+void iGeom_save( iGeom_Instance instance,
+                 char const* name,
+                 char const* options,
+                 int* err,
+                 int name_len,
+                 int options_len ) 
+{
+  iMesh_save(IMESH_INSTANCE(instance), NULL, name, options, err, 
+             name_len, options_len);
+  ERRORR("Failed get save geomtry instance.");
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getRootSet( iGeom_Instance instance,
+                       iBase_EntitySetHandle* root_set,
+                       int* err )
+{
+  iMesh_getRootSet(IMESH_INSTANCE(instance), root_set, err);
+  ERRORR("Failed get root set.");
+
+  RETURN(iBase_SUCCESS);
+}
+
+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 )
+{
+  RETURN(iBase_NOT_SUPPORTED);
+}
+
+void iGeom_getEntities( iGeom_Instance instance,
+                        iBase_EntitySetHandle set_handle,
+                        int entity_type,
+                        iBase_EntityHandle** entity_handles,
+                        int* entity_handles_allocated,
+                        int* entity_handles_size,
+                        int* err ) 
+{
+  int i;
+  if (0 > entity_type || 4 < entity_type) {
+    *err = iBase_INVALID_ENTITY_TYPE;
+    ERRORR("Bad entity type.");
+  }
+  else if (entity_type < 4) {
+    *entity_handles_size = _my_gsets[entity_type].size();
+    CHECK_SIZE(*entity_handles, *entity_handles_allocated,
+	       *entity_handles_size, iBase_EntityHandle, NULL);
+    COPY_RANGE(_my_gsets[entity_type], *entity_handles);
+  }
+  else {
+    *entity_handles_size = 0;
+    MBRange total_range;
+    for (i = 0; i < 4; i++) {
+      total_range.merge(_my_gsets[i]);
+    }
+    *entity_handles_size = total_range.size();
+    CHECK_SIZE(*entity_handles, *entity_handles_allocated,
+	       *entity_handles_size, iBase_EntityHandle, NULL);
+    COPY_RANGE(total_range, *entity_handles);
+  }
+  
+  RETURN(iBase_SUCCESS);
+}
+  
+void iGeom_getNumOfType( iGeom_Instance instance,
+                         iBase_EntitySetHandle set_handle,
+                         int entity_type,
+                         int* num_out,
+                         int* err ) 
+{
+  if (0 > entity_type || 3 < entity_type) {
+    *err = iBase_INVALID_ENTITY_TYPE;
+    ERRORR("Bad entity type.");
+  }
+  *num_out = _my_gsets[entity_type].size();
+  
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getEntType( iGeom_Instance instance,
+                       iBase_EntityHandle entity_handle,
+                       int* type,
+                       int* err ) 
+{
+  for (int i = 0; i < 4; i++) {
+    if (_my_gsets[i].find(MBH_cast(entity_handle)) != _my_gsets[i].end()) {
+      *type = i;
+      RETURN(iBase_SUCCESS);
+    }
+  }
+  
+  *err = iBase_INVALID_ENTITY_TYPE;
+  ERRORR("Entity not a geometry entity.");
+}
+
+void iGeom_getArrType( iGeom_Instance instance,
+                       iBase_EntityHandle const* entity_handles,
+                       int entity_handles_size,
+                       int** type,
+                       int* type_allocated,
+                       int* type_size,
+                       int* err ) 
+{
+  CHECK_SIZE(*type, *type_allocated, *type_size, int, NULL);
+
+  int tmp_err;
+  *err = iBase_SUCCESS;
+  
+  for (int i = 0; i < entity_handles_size; i++) {
+    iGeom_getEntType(instance, entity_handles[i], *type + i, &tmp_err);
+    if (iBase_SUCCESS != tmp_err) {
+      *err = tmp_err;
+      ERRORR("Failed to get entity type in iGeom_getArrType.");
+    }
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getEntAdj( iGeom_Instance instance,
+                      iBase_EntityHandle entity_handle,
+                      int to_dimension,
+                      iBase_EntityHandle** adj_entities,
+                      int* adj_entities_allocated,
+                      int* adj_entities_size,
+                      int* err ) 
+{
+  MBRange adjs;
+  MBEntityHandle this_ent = MBH_cast(entity_handle);
+
+  // get adjacent
+  iGeom_get_adjacent_entities(instance, this_ent, to_dimension,
+			      adjs, err);
+  ERRORR("Failed to get adjacent entities in iGeom_getEntAdj.");
+  
+  // copy adjacent entities
+  CHECK_SIZE(*adj_entities, *adj_entities_allocated,
+	     (int) adjs.size(), iBase_EntityHandle, NULL);
+  COPY_RANGE(adjs, *adj_entities);
+
+  RETURN(iBase_SUCCESS);
+}
+
+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 ) 
+{
+  // check offset array size
+  MBRange temp_range, total_range;
+  CHECK_SIZE(*offset, *offset_allocated, entity_handles_size + 1, int, NULL);
+  *offset_size = entity_handles_size + 1;
+  
+  // get adjacent entities
+  for (int i = 0; i < entity_handles_size; ++i) {
+    (*offset)[i] = total_range.size();
+    temp_range.clear();
+    iGeom_get_adjacent_entities(instance, MBH_cast(entity_handles[i]),
+				requested_entity_type, temp_range, err);
+    ERRORR("Failed to get adjacent entities in iGeom_getEntAdj.");
+
+    total_range.merge(temp_range);
+  }
+  int nTot = total_range.size();
+  (*offset)[entity_handles_size] = nTot;
+
+  // copy adjacent entities
+  CHECK_SIZE(*adj_entity_handles, *adj_entity_handles_allocated,
+	     nTot, iBase_EntityHandle, NULL);
+  COPY_RANGE(total_range, *adj_entity_handles);
+  *adj_entity_handles_size = nTot;
+
+  RETURN(iBase_SUCCESS);
+}
+  
+void iGeom_getEnt2ndAdj( iGeom_Instance instance,
+                         iBase_EntityHandle entity_handle,
+                         int bridge_dimension,
+                         int to_dimension,
+                         iBase_EntityHandle** adjacent_entities,
+                         int* adjacent_entities_allocated,
+                         int* adjacent_entities_size,
+                         int* err )
+{
+  MBRange to_ents, bridge_ents, tmp_ents;
+  iGeom_get_adjacent_entities(instance, MBH_cast(entity_handle), bridge_dimension, bridge_ents, err);
+  ERRORR("Failed to get adjacent entities in iGeom_getEnt2ndAdj.");
+  
+  MBRange::iterator iter, jter, kter, end_jter;
+  MBRange::iterator end_iter = bridge_ents.end();
+  for (iter = bridge_ents.begin(); iter != end_iter; iter++) {
+    iGeom_get_adjacent_entities(instance, *iter, to_dimension, tmp_ents, err);
+    ERRORR("Failed to get adjacent entities in iGeom_getEnt2ndAdj.");
+    
+    for (jter = tmp_ents.begin(); jter != end_jter; jter++) {
+      if (to_ents.find(*jter) == to_ents.end()) {
+	to_ents.insert(*jter);
+      }
+    }
+    tmp_ents.clear();
+  }
+
+  *adjacent_entities_size = to_ents.size();
+  CHECK_SIZE(*adjacent_entities, *adjacent_entities_allocated,
+	     *adjacent_entities_size, iBase_EntityHandle, NULL);
+  COPY_RANGE(to_ents, *adjacent_entities);
+
+  RETURN(iBase_SUCCESS);
+}
+
+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 )
+{
+  CHECK_SIZE(*offset, *offset_allocated, entity_handles_size + 1, int, NULL);
+  MBRange bridge_range, temp_range, entity_range, total_range;
+   
+  for (int i = 0; i < entity_handles_size; ++i) {
+    bridge_range.clear();
+    entity_range.clear();
+    iGeom_get_adjacent_entities(instance, MBH_cast(entity_handles[i]),
+				order_adjacent_key, bridge_range, err);
+    ERRORR("Failed to get adjacent entities in iGeom_getArr2ndAdj.");
+
+    MBRange::iterator iter, jter, end_jter;
+    MBRange::iterator end_iter = bridge_range.end();
+    for (iter = bridge_range.begin(); iter != end_iter; iter++) {
+      temp_range.clear();
+      iGeom_get_adjacent_entities(instance, *iter,
+				  requested_entity_type, temp_range, err);
+      ERRORR("Failed to get adjacent entities in iGeom_getArr2ndAdj.");
+
+      for (jter = temp_range.begin(); jter != end_jter; jter++) {
+	if (entity_range.find(*jter) == entity_range.end()) {
+	  entity_range.insert(*jter);
+	}
+      }
+    }
+
+    (*offset)[i] = total_range.size();
+    total_range.merge(entity_range);
+  }
+  *adj_entity_handles_size = total_range.size();
+  (*offset)[entity_handles_size] = *adj_entity_handles_size;
+
+  CHECK_SIZE(*adj_entity_handles, *adj_entity_handles_allocated,
+	     *adj_entity_handles_size, iBase_EntityHandle, NULL);
+  COPY_RANGE(total_range, *adj_entity_handles);
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_isEntAdj( iGeom_Instance instance,
+                     iBase_EntityHandle entity_handle1,
+                     iBase_EntityHandle entity_handle2,
+                     int* are_adjacent,
+                     int* err )
+{
+  int type1, type2;
+  iGeom_getEntType(instance, entity_handle1, &type1, err);
+  ERRORR("Failed to get entity type in iGeom_isEntAdj.");
+  iGeom_getEntType(instance, entity_handle2, &type2, err);
+  ERRORR("Failed to get entity type in iGeom_isEntAdj.");
+
+  MBErrorCode rval;
+  MBRange adjs;
+  if (type1 < type2) {
+    rval = MBI->get_parent_meshsets(MBH_cast(entity_handle1), adjs, type2 - type1);
+    MBERRORR("Failed to get parent meshsets in iGeom_isEntAdj.");
+  }
+  else {
+    rval = MBI->get_child_meshsets(MBH_cast(entity_handle1), adjs, type2 - type1);
+    MBERRORR("Failed to get child meshsets in iGeom_isEntAdj.");
+  }
+  
+  *are_adjacent = adjs.find(MBH_cast(entity_handle2)) != _my_gsets[type2].end();
+
+  RETURN(iBase_SUCCESS);
+}
+
+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 )
+{
+  int index1 = 0;
+  int index2 = 0;
+  size_t index1_step, index2_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) {
+    index1_step = index2_step = 1;
+    count = entity_handles_1_size;
+  }
+  else if (entity_handles_1_size == 1) {
+    index1_step = 0;
+    index2_step = 1;
+    count = entity_handles_2_size;
+  }
+  else if (entity_handles_2_size == 1) {
+    index1_step = 1;
+    index2_step = 0;
+    count = entity_handles_1_size;
+  }
+  else {
+    RETURN(iBase_INVALID_ENTITY_COUNT);
+  }
+  
+  CHECK_SIZE(*is_adjacent_info, *is_adjacent_info_allocated,
+	     count, int, NULL);
+
+  for (int i = 0; i < count; ++i)
+  {
+    iGeom_isEntAdj(instance, entity_handles_1[index1],
+		   entity_handles_2[index2],
+		   &((*is_adjacent_info)[i]), err);
+    ERRORR("Failed to check if entities are adjacent in iGeom_isArrAdj.");
+
+    index1 += index1_step;
+    index2 += index2_step;
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+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 )
+{
+  MBErrorCode rval;
+  int type;
+  iGeom_getEntType(instance, entity_handle, &type, err);
+  ERRORR("Failed to get entity type.");
+
+  if (type == 0) {
+    iGeom_getVtxCoord(instance, entity_handle,
+		      on_x, on_y, on_z, err);
+    ERRORR("Failed to get vertex coordinates.");
+  }
+  else if (type == 1) {
+    // just copy over the coordinates
+    // should be modified
+    *on_x = near_x;
+    *on_y = near_y;
+    *on_z = near_z;
+  }
+  else if (type == 2 || type == 3) {
+    if (!t_created) {
+      GETGTT(instance);
+      rval = _my_geomTopoTool->construct_obb_trees();
+      MBERRORR("Failed to construct obb tree.");
+      t_created = true;
+    }
+    
+    double point[3] = {near_x, near_y, near_z};
+    double point_out[3];
+    MBEntityHandle root, facet_out;
+    _my_geomTopoTool->get_root(MBH_cast(entity_handle), root);
+    MBERRORR("Failed to get tree root in iGeom_getEntClosestPt.");
+    rval = _my_geomTopoTool->obb_tree()->closest_to_location(point, root,
+							     point_out,
+							     facet_out);
+    MBERRORR("Failed to get closest point in iGeom_getEntClosestPt.");
+    
+    *on_x = point_out[0];
+    *on_y = point_out[1];
+    *on_z = point_out[2];
+  }
+  else RETURN(iBase_INVALID_ENTITY_TYPE);
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getArrClosestPt( iGeom_Instance instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int storage_order,
+                            double const* near_coordinates,
+                            int near_coordinates_size,
+                            double** on_coordinates,
+                            int* on_coordinates_allocated,
+                            int* on_coordinates_size,
+                            int* err )
+{
+  CHECK_SIZE(*on_coordinates, *on_coordinates_allocated,
+	     near_coordinates_size, double, NULL);
+  for (int i = 0; i < entity_handles_size; i++) {
+    if (storage_order == iBase_INTERLEAVED) {
+      iGeom_getEntClosestPt(instance, entity_handles[i], near_coordinates[3*i],
+			    near_coordinates[3*i + 1], near_coordinates[3*i + 2],
+			    on_coordinates[3*i], on_coordinates[3*i + 1],
+			    on_coordinates[3*i + 2], err);
+    }
+    else if (storage_order == iBase_BLOCKED) {
+      iGeom_getEntClosestPt(instance, entity_handles[i], near_coordinates[i],
+			    near_coordinates[i + entity_handles_size],
+			    near_coordinates[i + 2*entity_handles_size],
+			    on_coordinates[i], on_coordinates[i + entity_handles_size],
+			    on_coordinates[i + 2*entity_handles_size], err);
+    }
+    ERRORR("Failed to get closest point.");
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+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 )
+{
+  // just do for surface and volume
+  int type;
+  iGeom_getEntType(instance, entity_handle, &type, err);
+  ERRORR("Failed to get entity type in iGeom_getEntNrmlXYZ.");
+
+  if (type != 2 && type != 3) {
+    *err = iBase_INVALID_ENTITY_TYPE;
+    ERRORR("Entities passed into gentityNormal must be face or volume.");
+  }
+
+  // get closest location and facet
+  double point[3] = {x, y, z};
+  double point_out[3];
+  MBEntityHandle root, facet_out;
+  _my_geomTopoTool->get_root(MBH_cast(entity_handle), root);
+  MBErrorCode rval = _my_geomTopoTool->obb_tree()->closest_to_location(point, root,
+							   point_out,
+							   facet_out);
+  MBERRORR("Failed to get closest location in iGeom_getEntNrmlXYZ.");
+
+  // get facet normal
+  const MBEntityHandle* conn;
+  int len, sense;
+  MBCartVect coords[3], normal;
+  rval = MBI->get_connectivity(facet_out, conn, len);
+  MBERRORR("Failed to get triangle connectivity in iGeom_getEntNrmlXYZ.");
+  if (len != 3) RETURN(iBase_FAILURE);
+  
+  rval = MBI->get_coords(conn, len, coords[0].array());
+  MBERRORR("Failed to get triangle coordinates in iGeom_getEntNrmlXYZ.");
+  
+  coords[1] -= coords[0];
+  coords[2] -= coords[0];
+  normal = coords[1] * coords[2];
+  normal.normalize();
+  *nrml_i = normal[0];
+  *nrml_j = normal[1];
+  *nrml_k = normal[2];
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getArrNrmlXYZ( iGeom_Instance instance,
+                          iBase_EntityHandle const* entity_handles,
+                          int entity_handles_size,
+                          int storage_order,
+                          double const* coordinates,
+                          int coordinates_size,
+                          double** normals,
+                          int* normals_allocated,
+                          int* normals_size,
+                          int* err )
+{
+  // 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 index = 0;
+  size_t coord_step, norm_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 {
+    *err = iBase_INVALID_ENTITY_COUNT;
+    ERRORR("Mismatched array sizes");
+  }
+
+  // check or pre-allocate the coordinate arrays
+  CHECK_SIZE(*normals, *normals_allocated, 3*count, double, NULL);
+  
+  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;
+  }
+  
+  for (int i = 0; i < count; ++i)
+  {
+    iGeom_getEntNrmlXYZ(instance, entity_handles[index],
+			*coord_x, *coord_y, *coord_z,
+			norm_x, norm_y, norm_z, err);
+    ERRORR("Failed to get entity normal of point.");
+
+    //entities += ent_step;
+    index += 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;
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+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 )
+{
+  // just do for surface and volume
+  int type;
+  iGeom_getEntType(instance, entity_handle, &type, err);
+  ERRORR("Failed to get entity type in iGeom_getEntNrmlPlXYZ.");
+
+  if (type != 2 && type != 3) {
+    *err = iBase_INVALID_ENTITY_TYPE;
+    ERRORR("Entities passed into gentityNormal must be face or volume.");
+  }
+
+  // get closest location and facet
+  double point[3] = {x, y, z};
+  double point_out[3];
+  MBEntityHandle root, facet_out;
+  _my_geomTopoTool->get_root(MBH_cast(entity_handle), root);
+  MBErrorCode rval = _my_geomTopoTool->obb_tree()->closest_to_location(point, root,
+								       point_out,
+								       facet_out);
+  MBERRORR("Failed to get closest location in iGeom_getEntNrmlPlXYZ.");
+
+  // get closest point
+  *pt_x = point_out[0];
+  *pt_y = point_out[1];
+  *pt_z = point_out[2];
+
+  // get facet normal
+  const MBEntityHandle* conn;
+  int len, sense;
+  MBCartVect coords[3], normal;
+  rval = MBI->get_connectivity(facet_out, conn, len);
+  MBERRORR("Failed to get triangle connectivity in iGeom_getEntNrmlPlXYZ.");
+  if (len != 3) RETURN(iBase_FAILURE);
+  
+  rval = MBI->get_coords(conn, len, coords[0].array());
+  MBERRORR("Failed to get triangle coordinates in iGeom_getEntNrmlPlXYZ.");
+  
+  coords[1] -= coords[0];
+  coords[2] -= coords[0];
+  normal = coords[1] * coords[2];
+  normal.normalize();
+  *nrml_i = normal[0];
+  *nrml_j = normal[1];
+  *nrml_k = normal[2];
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getArrNrmlPlXYZ( iGeom_Instance instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int storage_order,
+                            double const* near_coordinates,
+                            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 )
+{
+  // 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 index = 0;
+  size_t near_step, on_step = 1, ent_step;
+  int count;
+  if (3*entity_handles_size == near_coordinates_size) {
+    near_step = ent_step = 1;
+    count = entity_handles_size;
+  }
+  else if (near_coordinates_size == 3) {
+    near_step = 0;
+    ent_step = 1;
+    count = entity_handles_size;
+  }
+  else if (entity_handles_size == 1) {
+    near_step = 1;
+    ent_step = 0;
+    count = near_coordinates_size / 3;
+  }
+  else {
+    *err = iBase_INVALID_ENTITY_COUNT;
+    ERRORR("Mismatched array sizes");
+  }
+
+  // check or pre-allocate the coordinate arrays
+  CHECK_SIZE(*on_coordinates, *on_coordinates_allocated, 3*count, double, NULL);
+  CHECK_SIZE(*normals, *normals_allocated, 3*count, double, NULL);
+  
+  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;
+  }
+  
+  for (int i = 0; i < count; ++i)
+  {
+    iGeom_getEntNrmlPlXYZ(instance, entity_handles[index],
+			  *near_x, *near_y, *near_z,
+			  on_x, on_y, on_z,
+			  norm_x, norm_y, norm_z, err);
+    ERRORR("Failed to get entity normal of point.");
+
+    //entities += ent_step;
+    index += 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;
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getEntTgntXYZ( iGeom_Instance,
+                          iBase_EntityHandle entity_handle,
+                          double x,
+                          double y,
+                          double z,
+                          double* tgnt_i,
+                          double* tgnt_j,
+                          double* tgnt_k,
+                          int* err )
+{
+  RETURN(iBase_NOT_SUPPORTED);
+}
+
+void iGeom_getArrTgntXYZ( iGeom_Instance,
+                          iBase_EntityHandle const* entity_handles,
+                          int entity_handles_size,
+                          int storage_order,
+                          double const* coordinates,
+                          int coordinates_size,
+                          double** tangents,
+                          int* tangents_allocated,
+                          int* tangents_size,
+                          int* err )
+{
+  RETURN(iBase_NOT_SUPPORTED);
+}
+
+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 )
+{
+  MBErrorCode rval;
+  int type;
+  iGeom_getEntType(instance, entity_handle, &type, err);
+  ERRORR("Failed to get entity type.");
+
+  if (type == 0) {
+    iGeom_getVtxCoord(instance, entity_handle,
+		      min_x, min_y, min_z, err);
+    ERRORR("Failed to get vertex coordinates.");
+    max_x = min_x;
+    max_y = min_y;
+    max_z = min_z;
+  }
+  else if (type == 1) {
+    *err = iBase_NOT_SUPPORTED;
+    ERRORR("iGeom_getEntBoundBox is not supported for Edge entity type.");
+  }
+  else if (type == 2 || type == 3) {
+    if (!t_created) {
+      GETGTT(instance);
+      rval = _my_geomTopoTool->construct_obb_trees();
+      MBERRORR("Failed to construct obb tree.");
+      t_created = true;
+    }
+    
+    MBEntityHandle root;
+    MBOrientedBox box;
+    rval = _my_geomTopoTool->get_root(MBH_cast(entity_handle), root);
+    MBERRORR("Failed to get tree root in iGeom_getEntBoundBox.");
+    rval = _my_geomTopoTool->obb_tree()->box(root, box);
+    MBERRORR("Failed to get closest point in iGeom_getEntBoundBox.");
+    
+    MBCartVect min, max;
+    min = box.center - box.length[0]*box.axis[0] - box.length[1]*box.axis[1]
+      - box.length[2]*box.axis[2];
+    max = box.center + box.length[0]*box.axis[0] + box.length[1]*box.axis[1]
+      + box.length[2]*box.axis[2];
+    *min_x = min[0];
+    *min_y = min[1];
+    *min_z = min[2];
+    *max_x = max[0];
+    *max_y = max[1];
+    *max_z = max[2];
+  }
+  else RETURN(iBase_INVALID_ENTITY_TYPE);
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getArrBoundBox( iGeom_Instance instance,
+                           iBase_EntityHandle const* entity_handles,
+                           int entity_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 )
+{
+  // check or pre-allocate the coordinate arrays
+  CHECK_SIZE(*min_corner, *min_corner_allocated, 3*entity_handles_size, double, NULL);
+  CHECK_SIZE(*max_corner, *max_corner_allocated, 3*entity_handles_size, double, NULL);
+  
+  size_t step, init;
+  if (storage_order == iBase_BLOCKED) {
+    step = 1;
+    init = entity_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;
+  
+  for (int i = 0; i < entity_handles_size; ++i)
+  {
+    iGeom_getEntBoundBox(instance, entity_handles[i],
+			 min_x, min_y, min_z,
+			 max_x, max_y, max_z, err);
+    ERRORR("Failed to get entity bounding box in iGeom_getArrBoundBox.");
+    
+    min_x += step;
+    max_x += step;
+    min_y += step;
+    max_y += step;
+    min_z += step;
+    max_z += step;
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getVtxCoord( iGeom_Instance instance,
+                        iBase_EntityHandle vertex_handle,
+                        double* x,
+                        double* y,
+                        double* z,
+                        int* err )
+{
+  int type;
+  iGeom_getEntType(instance, vertex_handle, &type, err);
+  ERRORR("Failed to get entity type in iGeom_getVtxCoord.");
+
+  if (type != 0) {
+    *err = iBase_INVALID_ENTITY_TYPE;
+    ERRORR("Entity is not a vertex type.");
+  }
+
+  iBase_EntityHandle *verts = NULL;
+  int verts_alloc = 0, verts_size;
+  double *vert_coords = NULL;
+  int vert_coords_alloc = 0, vert_coords_size;
+  iMesh_getEntities(IMESH_INSTANCE(instance), reinterpret_cast<iBase_EntitySetHandle> (vertex_handle),
+		    iBase_VERTEX, iMesh_POINT, &verts, &verts_alloc, &verts_size, err);
+  ERRORR("Failed to get vertices.");
+
+  if (verts_size != 1) {
+    *err = iBase_FAILURE;
+    ERRORR("Vertex has multiple points.");
+  }
+
+  iMesh_getVtxCoord(IMESH_INSTANCE(instance), verts[0],
+		    x, y, z, err);
+  ERRORR("Failed to get vertex coordinate.");
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getVtxArrCoords( iGeom_Instance instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int storage_order,
+                            double** coordinates,
+                            int* coordinates_allocated,
+                            int* coordinates_size,
+                            int* err )
+{
+  // check or pre-allocate the coordinate arrays
+  CHECK_SIZE(*coordinates, *coordinates_allocated, 3*entity_handles_size, double, NULL);
+
+  double *x, *y, *z;
+  size_t step;
+  if (storage_order == iBase_BLOCKED) {
+    x = *coordinates;
+    y = x + entity_handles_size;
+    z = y + entity_handles_size;
+    step = 1;
+  }
+  else {
+    x = *coordinates;
+    y = x + 1;
+    z = x + 2;
+    step = 3;
+  }
+  
+  for (int i = 0; i < entity_handles_size; i++) {
+    iGeom_getVtxCoord(instance, entity_handles[i], x, y, z, err);
+    x += step;
+    y += step;
+    z += step;
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_getPntRayIntsct( iGeom_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 )
+{
+ }
+
+void iGeom_getPntArrRayIntsct( iGeom_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 ){ }
+void iGeom_getEntNrmlSense( iGeom_Instance,
+                            iBase_EntityHandle face,
+                            iBase_EntityHandle region,
+                            int* sense_out,
+                            int* err ){ }
+void iGeom_getArrNrmlSense( iGeom_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 ){ }
+void iGeom_getEgFcSense( iGeom_Instance,
+                         iBase_EntityHandle edge,
+                         iBase_EntityHandle face,
+                         int* sense_out,
+                         int* err ){ }
+void iGeom_getEgFcArrSense( iGeom_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 ){ }
+void iGeom_getEgVtxSense( iGeom_Instance,
+                          iBase_EntityHandle edge,
+                          iBase_EntityHandle vertex1,
+                          iBase_EntityHandle vertex2,
+                          int* sense_out,
+                          int* err ){ }
+void iGeom_getEgVtxArrSense( iGeom_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 ){ }
+void iGeom_measure( iGeom_Instance,
+                    iBase_EntityHandle const* entity_handles,
+                    int entity_handles_size,
+                    double** measures,
+                    int* measures_allocated,
+                    int* measures_size,
+                    int* err ){ }
+void iGeom_getFaceType( iGeom_Instance,
+                        iBase_EntityHandle face_handle,
+                        char* face_type,
+                        int* err,
+                        int* face_type_length){ }
+void iGeom_getParametric( iGeom_Instance,
+                          int* is_parametric,
+                          int* err ){ }
+void iGeom_isEntParametric( iGeom_Instance,
+                            iBase_EntityHandle entity_handle,
+                            int* parametric,
+                            int* err ){ }
+void iGeom_isArrParametric( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            int** is_parametric,
+                            int* is_parametric_allocated,
+                            int* is_parametric_size,
+                            int* err ){ }
+void iGeom_getArrTolerance( iGeom_Instance,
+                            iBase_EntityHandle const* entity_handles,
+                            int entity_handles_size,
+                            double** tolerances,
+                            int* tolerances_allocated,
+                            int* tolerances_size,
+                            int* err ){ }
+
+void iGeom_initEntIter( iGeom_Instance,
+                        iBase_EntitySetHandle entity_set_handle,
+                        int entity_dimension,
+                        iGeom_EntityIterator* entity_iterator,
+                        int* err ){ }
+
+void iGeom_initEntArrIter( iGeom_Instance,
+                           iBase_EntitySetHandle entity_set_handle,
+                           int entity_dimension,
+                           int requested_array_size,
+                           iGeom_EntityArrIterator* entArr_iterator,
+                           int* err ){ }
+
+void iGeom_getNextEntIter( iGeom_Instance,
+                           iGeom_EntityIterator,
+                           iBase_EntityHandle* entity_handle,
+                           int* has_data,
+                           int* err ){ }
+
+void iGeom_getNextEntArrIter( iGeom_Instance,
+                              iGeom_EntityArrIterator,
+                              iBase_EntityHandle** entity_handles,
+                              int* entity_handles_allocated,
+                              int* entity_handles_size,
+                              int* has_data,
+                              int* err ){ }
+
+void iGeom_resetEntIter( iGeom_Instance,
+                         iGeom_EntityIterator,
+                         int* err ){ }
+
+void iGeom_resetEntArrIter( iGeom_Instance,
+                            iGeom_EntityArrIterator,
+                            int* err ){ }
+
+void iGeom_endEntIter( iGeom_Instance, iGeom_EntityIterator, int* err ){ }
+
+void iGeom_endEntArrIter( iGeom_Instance, iGeom_EntityArrIterator, int* err ){ }
+
+void iGeom_copyEnt( iGeom_Instance,
+                    iBase_EntityHandle source,
+                    iBase_EntityHandle* copy,
+                    int* err ){ }
+
+void iGeom_sweepEntAboutAxis( iGeom_Instance,
+			      iBase_EntityHandle geom_entity,
+			      double angle,
+			      double axis_normal_x,
+			      double axis_normal_y,
+			      double axis_normal_z,
+			      iBase_EntityHandle* geom_entity2,
+			      int* err )
+{
+}
+
+void iGeom_deleteAll(iGeom_Instance instance, int* err )
+{
+  MBErrorCode rval;
+  for (int i = 0; i < 4; i++) {
+    rval = MBI->delete_entities(_my_gsets[i]);
+    MBERRORR("Failed to delete entities in iGeom_deleteAll.");
+    _my_gsets[i].clear();
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+void iGeom_deleteEnt( iGeom_Instance instance,
+                      iBase_EntityHandle entity_handle,
+                      int* err )
+{
+  int type;
+  iGeom_getEntType(instance, entity_handle, &type, err);
+  ERRORR("Failed to get entity type in iGeom_deleteEnt.");
+
+  MBRange::iterator iter = _my_gsets[type].find(MBH_cast(entity_handle));
+  if (iter == _my_gsets[type].end()) {
+    RETURN(iBase_INVALID_ENTITY_HANDLE);
+  }
+  _my_gsets[type].erase(iter);
+
+  MBEntityHandle this_entity = MBH_cast(entity_handle);
+  MBErrorCode rval = MBI->delete_entities(&this_entity, 1);
+  MBERRORR("Failed to delete entity.");
+}
+
+void iGeom_createSphere( iGeom_Instance,
+			 double radius,
+			 iBase_EntityHandle* sphere_handle_out,
+			 int* err ){ }
+
+void iGeom_createPrism( iGeom_Instance,
+                   double height,
+		   int n_sides,
+		   double major_rad,
+	           double minor_rad,
+	           iBase_EntityHandle* prism_handle_out,
+                   int* err ){ }
+
+
+void iGeom_createBrick( iGeom_Instance,
+			double x,
+			double y,
+			double z,
+			iBase_EntityHandle* geom_entity,
+			int* err ){ }
+
+void iGeom_createCylinder( iGeom_Instance,
+			   double height,
+			   double major_rad,
+			   double minor_rad,
+			   iBase_EntityHandle* geom_entity,
+			   int* err ){ }
+
+void iGeom_createCone( iGeom_Instance,
+		       double height,
+		       double major_rad_base,
+		       double minor_rad_base,
+		       double rad_top,
+		       iBase_EntityHandle* geom_entity,
+		       int* err ){ }
+
+  void iGeom_createTorus( iGeom_Instance,
+                          double major_rad,
+                          double minor_rad,
+                          iBase_EntityHandle* geom_entity,
+                          int* err ){ }
+
+  void iGeom_moveEnt( iGeom_Instance,
+                      iBase_EntityHandle geom_entity,
+                      double x,
+                      double y,
+                      double z,
+                      int* err ){ }
+
+  void iGeom_rotateEnt( iGeom_Instance,
+                        iBase_EntityHandle geom_entity,
+                        double angle,
+                        double axis_normal_x,
+                        double axis_normal_y,
+                        double axis_normal_z,
+                        int* err ){ }
+
+
+  void iGeom_reflectEnt( iGeom_Instance,
+                         iBase_EntityHandle geom_entity,
+                         double plane_normal_x,
+                         double plane_normal_y,
+                         double plane_normal_z,
+                         int* err ){ }
+
+  void iGeom_scaleEnt( iGeom_Instance,
+                       iBase_EntityHandle geom_entity,
+                       double scale_x,
+                       double scale_y,
+                       double scale_z,
+                       int* err ){ }
+
+  void iGeom_uniteEnts( iGeom_Instance,
+                        iBase_EntityHandle const* geom_entities,
+                        int geom_entities_size,
+                        iBase_EntityHandle* geom_entity,
+                        int* err ){ }
+
+  void iGeom_subtractEnts( iGeom_Instance,
+                           iBase_EntityHandle blank,
+                           iBase_EntityHandle tool,
+                           iBase_EntityHandle* geom_entity,
+                           int* err ){ }
+
+  void iGeom_intersectEnts( iGeom_Instance,
+                            iBase_EntityHandle entity2,
+			    iBase_EntityHandle entity1,
+			    iBase_EntityHandle* geom_entity,
+			    int* err ){ }
+
+  void iGeom_sectionEnt( iGeom_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 ){ }
+
+  void iGeom_imprintEnts( iGeom_Instance,
+                          iBase_EntityHandle const* geom_entities,
+                          int geom_entities_size,
+                          int* err ){ }
+
+  void iGeom_mergeEnts( iGeom_Instance,
+                        iBase_EntityHandle const* geom_entities,
+                        int geom_entities_size,
+                        double tolerance,
+                        int* err ){ }
+
+void iGeom_createEntSet(iGeom_Instance instance,
+                        int isList,
+                        iBase_EntitySetHandle* entity_set_created, 
+                        int *err)
+{
+  iMesh_createEntSet(IMESH_INSTANCE(instance), isList,
+		     entity_set_created, err);
+  ERRORR("Failed to get create entity set.");
+}
+
+void iGeom_destroyEntSet(iGeom_Instance instance,
+                         iBase_EntitySetHandle entity_set, 
+                         int *err){ }
+
+void iGeom_isList(iGeom_Instance instance,
+                  iBase_EntitySetHandle entity_set,
+                  int *is_list, 
+                  int *err){ }
+
+void iGeom_getNumEntSets(iGeom_Instance instance,
+                         iBase_EntitySetHandle entity_set_handle,
+                         int num_hops,
+                         int *num_sets, 
+                         int *err)
+{
+  iMesh_getNumEntSets(IMESH_INSTANCE(instance), entity_set_handle,
+		      num_hops, num_sets, err);
+  ERRORR("Failed to get number of entity sets.");
+}
+
+void iGeom_getEntSets(iGeom_Instance instance,
+                      iBase_EntitySetHandle entity_set_handle,
+                      int num_hops,
+                      iBase_EntitySetHandle** contained_set_handles,
+                      int* contained_set_handles_allocated,
+                      int* contained_set_handles_size, 
+                      int *err)
+{
+  iMesh_getEntSets(IMESH_INSTANCE(instance), entity_set_handle,
+		   num_hops, contained_set_handles,
+		   contained_set_handles_allocated,
+		   contained_set_handles_size, err);
+  ERRORR("Failed to get entity sets.");
+}
+
+void iGeom_addEntToSet(iGeom_Instance instance,
+                       iBase_EntityHandle entity_handle,
+                       iBase_EntitySetHandle entity_set, 
+                       int *err)
+{
+  iMesh_addEntToSet(IMESH_INSTANCE(instance), entity_handle,
+		    entity_set, err);
+  ERRORR("Failed to add entity to set.");
+}
+
+void iGeom_rmvEntFromSet(iGeom_Instance instance,
+                         iBase_EntityHandle entity_handle,
+                         iBase_EntitySetHandle entity_set, 
+                         int *err)
+{
+  iMesh_rmvEntFromSet(IMESH_INSTANCE(instance), entity_handle,
+		      entity_set, err);
+  ERRORR("Failed to remove entity from set.");
+}
+
+void iGeom_addEntArrToSet(iGeom_Instance instance,
+                          const iBase_EntityHandle* entity_handles,
+                          int entity_handles_size,
+                          iBase_EntitySetHandle entity_set, 
+                          int *err)
+{
+  iMesh_addEntArrToSet(IMESH_INSTANCE(instance), entity_handles,
+		       entity_handles_size, entity_set, err);
+  ERRORR("Failed to add entities to set.");
+}
+
+
+void iGeom_rmvEntArrFromSet(iGeom_Instance instance,
+                            const iBase_EntityHandle* entity_handles,
+                            int entity_handles_size,
+                            iBase_EntitySetHandle entity_set,
+                            int *err)
+{
+  iMesh_rmvEntArrFromSet(IMESH_INSTANCE(instance), entity_handles,
+			 entity_handles_size, entity_set, err);
+  ERRORR("Failed to remove entities from set.");
+}
+
+void iGeom_addEntSet(iGeom_Instance instance,
+                     iBase_EntitySetHandle entity_set_to_add,
+                     iBase_EntitySetHandle entity_set_handle, 
+                     int *err)
+{
+  iMesh_addEntSet(IMESH_INSTANCE(instance), entity_set_to_add,
+		  entity_set_handle, err);
+  ERRORR("Failed to add entity set to entity set.");
+}
+
+
+void iGeom_rmvEntSet(iGeom_Instance instance,
+                     iBase_EntitySetHandle entity_set_to_remove,
+                     iBase_EntitySetHandle entity_set_handle, 
+                     int *err)
+{
+  iMesh_rmvEntSet(IMESH_INSTANCE(instance), entity_set_to_remove,
+		  entity_set_handle, err);
+  ERRORR("Failed to remove entity set from entity set.");
+}
+
+void iGeom_isEntContained(iGeom_Instance instance,
+                          iBase_EntitySetHandle containing_entity_set,
+                          iBase_EntityHandle contained_entity,
+                          int *is_contained, 
+                          int *err)
+{
+  iMesh_isEntContained(IMESH_INSTANCE(instance), containing_entity_set,
+		       contained_entity, is_contained, err);
+  ERRORR("Failed to check if entity is contained to entity set.");
+}
+
+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 )
+{
+  iMesh_isEntArrContained(IMESH_INSTANCE(instance),
+			  containing_set, entity_handles,
+			  num_entity_handles, is_contained,
+			  is_contained_allocated, is_contained_size,
+			  err );
+  ERRORR("Failed to check if entities are contained to entity sets.");
+ }
+
+void iGeom_isEntSetContained(iGeom_Instance instance,
+                             iBase_EntitySetHandle containing_entity_set,
+                             iBase_EntitySetHandle contained_entity_set,
+                             int *is_contained, 
+                             int *err)
+{
+  iMesh_isEntSetContained (IMESH_INSTANCE(instance),
+			   containing_entity_set, contained_entity_set,
+			   is_contained, err);
+  ERRORR("Failed to check if entity set is contained to entity set.");
+}
+
+void iGeom_addPrntChld(iGeom_Instance instance,
+                       iBase_EntitySetHandle parent_entity_set,
+                       iBase_EntitySetHandle child_entity_set, 
+                       int *err)
+{
+  iMesh_addPrntChld(IMESH_INSTANCE(instance),
+		    parent_entity_set, child_entity_set, err);
+  ERRORR("Failed to add parent and child relation of geometry sets.");
+}
+
+void iGeom_rmvPrntChld(iGeom_Instance instance,
+                       iBase_EntitySetHandle parent_entity_set,
+                       iBase_EntitySetHandle child_entity_set, 
+                       int *err)
+{
+  iMesh_rmvPrntChld(IMESH_INSTANCE(instance),
+		    parent_entity_set, child_entity_set, err);
+  ERRORR("Failed to remove parent and child relation of geometry sets.");
+}
+
+void iGeom_isChildOf(iGeom_Instance instance,
+                     iBase_EntitySetHandle parent_entity_set,
+                     iBase_EntitySetHandle child_entity_set,
+                     int *is_child, 
+                     int *err)
+{
+  iMesh_isChildOf(IMESH_INSTANCE(instance),
+		  parent_entity_set, child_entity_set, is_child, err);
+  ERRORR("Failed to check if there is a parent/child relation.");
+ }
+
+void iGeom_getNumChld(iGeom_Instance instance,
+                      iBase_EntitySetHandle entity_set,
+                      int num_hops,
+                      int *num_child, 
+                      int *err)
+{
+  iMesh_getNumChld(IMESH_INSTANCE(instance), entity_set,
+		   num_hops, num_child, err);
+  ERRORR("Failed to get number of children.");
+}
+
+void iGeom_getNumPrnt(iGeom_Instance instance,
+                      iBase_EntitySetHandle entity_set,
+                      int num_hops,
+                      int *num_parent, 
+                      int *err)
+{
+  iMesh_getNumPrnt(IMESH_INSTANCE(instance), entity_set,
+		   num_hops, num_parent, err);
+  ERRORR("Failed to get number of parents.");
+}
+
+void iGeom_getChldn(iGeom_Instance instance,
+                    iBase_EntitySetHandle from_entity_set,
+                    int num_hops,
+                    iBase_EntitySetHandle** entity_set_handles,
+                    int* entity_set_handles_allocated,
+                    int* entity_set_handles_size, 
+                    int *err)
+{
+  iMesh_getChldn(IMESH_INSTANCE(instance), from_entity_set,
+		 num_hops, entity_set_handles, entity_set_handles_allocated,
+		 entity_set_handles_size, err);
+  ERRORR("Failed to get children.");
+}
+
+void iGeom_getPrnts(iGeom_Instance instance,
+                    iBase_EntitySetHandle from_entity_set,
+                    int num_hops,
+                    iBase_EntitySetHandle** entity_set_handles,
+                    int* entity_set_handles_allocated,
+                    int* entity_set_handles_size, 
+                    int *err)
+{
+  iMesh_getPrnts(IMESH_INSTANCE(instance), from_entity_set,
+		 num_hops, entity_set_handles, entity_set_handles_allocated,
+		 entity_set_handles_size, err);
+  ERRORR("Failed to get parents.");
+}
+
+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 )
+{
+  
+  iMesh_createTag(IMESH_INSTANCE(instance), tag_name, tag_size,
+		  tag_type, tag_handle, err, tag_name_len);
+  ERRORR("Failure to create tag.");
+}
+
+void iGeom_destroyTag(iGeom_Instance instance,
+                      iBase_TagHandle tag_handle,
+                      int forced, 
+                      int *err)
+{
+  iMesh_destroyTag(IMESH_INSTANCE(instance), tag_handle,
+		   forced, err);
+  ERRORR("Failure to destroy tag.");
+ }
+
+void iGeom_getTagName(iGeom_Instance instance,
+                      iBase_TagHandle tag_handle,
+                      char *name, 
+                      int* err,
+                      int name_len)
+{
+  iMesh_getTagName(IMESH_INSTANCE(instance), tag_handle, name,
+		   err, name_len);
+  ERRORR("Failure to get tag name.");
+}
+
+void iGeom_getTagSizeValues(iGeom_Instance instance,
+                            iBase_TagHandle tag_handle,
+                            int *tag_size, 
+                            int *err)
+{
+  iMesh_getTagSizeValues(IMESH_INSTANCE(instance), tag_handle,
+			 tag_size, err);
+  ERRORR("Failure to get numbers tag size.");
+}
+
+void iGeom_getTagSizeBytes(iGeom_Instance instance,
+                           iBase_TagHandle tag_handle,
+                           int *tag_size, 
+                           int *err)
+{
+  iMesh_getTagSizeBytes(IMESH_INSTANCE(instance), tag_handle,
+			tag_size, err);
+  ERRORR("Failure to get byte tag size.");
+}
+
+void iGeom_getTagHandle(iGeom_Instance instance,
+                        const char* tag_name,
+                        iBase_TagHandle *tag_handle, 
+                        int *err,
+                        int tag_name_len)
+{
+  iMesh_getTagHandle(IMESH_INSTANCE(instance), tag_name,
+		     tag_handle, err, tag_name_len);
+  ERRORR("Failure to get tag name.");
+}
+
+void iGeom_getTagType(iGeom_Instance instance,
+                      iBase_TagHandle tag_handle,
+                      int *tag_type, 
+                      int *err)
+{
+  iMesh_getTagType(IMESH_INSTANCE(instance), tag_handle,
+		   tag_type, err);
+  ERRORR("Failure to get tag type.");
+}
+
+void iGeom_setEntSetData(iGeom_Instance instance,
+                         iBase_EntitySetHandle entity_set_handle,
+                         iBase_TagHandle tag_handle,
+                         const char* tag_value,
+                         int tag_value_size, 
+                         int *err)
+{
+  iMesh_setEntSetData(IMESH_INSTANCE(instance), entity_set_handle,
+		      tag_handle, tag_value, tag_value_size, err);
+  ERRORR("Failure to set arbitrary data to entity set.");
+}
+
+void iGeom_setEntSetIntData(iGeom_Instance instance,
+                            iBase_EntitySetHandle entity_set,
+                            iBase_TagHandle tag_handle,
+                            int tag_value, 
+                            int *err)
+{
+  iMesh_setEntSetIntData(IMESH_INSTANCE(instance), entity_set,
+			 tag_handle, tag_value, err);
+  ERRORR("Failure to set integer data to entity set.");
+}
+
+
+void iGeom_setEntSetDblData(iGeom_Instance instance,
+                            iBase_EntitySetHandle entity_set,
+                            iBase_TagHandle tag_handle,
+                            double tag_value, 
+                            int *err)
+{
+  iMesh_setEntSetDblData(IMESH_INSTANCE(instance), entity_set,
+			 tag_handle, tag_value, err);
+  ERRORR("Failure to set double data to entity set.");
+}
+
+
+void iGeom_setEntSetEHData(iGeom_Instance instance,
+                           iBase_EntitySetHandle entity_set,
+                           iBase_TagHandle tag_handle,
+                           iBase_EntityHandle tag_value, 
+                           int *err)
+{
+  iMesh_setEntSetEHData(IMESH_INSTANCE(instance), entity_set,
+			tag_handle, tag_value, err);
+  ERRORR("Failure to set entity handle data to entity set.");
+}
+
+
+void iGeom_getEntSetData(iGeom_Instance instance,
+                         iBase_EntitySetHandle entity_set_handle,
+                         iBase_TagHandle tag_handle,
+                         char** tag_value,
+                         int* tag_value_allocated,
+                         int* tag_value_size, 
+                         int *err)
+{
+  iMesh_getEntSetData (IMESH_INSTANCE(instance), entity_set_handle,
+		       tag_handle, tag_value, tag_value_allocated,
+		       tag_value_size, err);
+  ERRORR("Failure to get arbitrary data from entity set.");
+}
+
+void iGeom_getEntSetIntData(iGeom_Instance instance,
+                            iBase_EntitySetHandle entity_set,
+                            iBase_TagHandle tag_handle,
+                            int *out_data, 
+                            int *err)
+{
+  iMesh_getEntSetIntData(IMESH_INSTANCE(instance), entity_set,
+			 tag_handle, out_data, err);
+  ERRORR("Failure to get integer data from entity set.");
+}
+
+void iGeom_getEntSetDblData(iGeom_Instance instance,
+                            iBase_EntitySetHandle entity_set,
+                            iBase_TagHandle tag_handle,
+                            double *out_data, 
+                            int *err)
+{
+  iMesh_getEntSetDblData (IMESH_INSTANCE(instance), entity_set,
+			  tag_handle, out_data, err);
+  ERRORR("Failure to get double data from entity set.");
+}
+
+void iGeom_getEntSetEHData(iGeom_Instance instance,
+                           iBase_EntitySetHandle entity_set,
+                           iBase_TagHandle tag_handle,
+                           iBase_EntityHandle *out_data, 
+                           int *err)
+{
+  iMesh_getEntSetEHData(IMESH_INSTANCE(instance), entity_set,
+			tag_handle, out_data, err);
+  ERRORR("Failure to get double data from entity set.");
+}
+
+void iGeom_getAllEntSetTags(iGeom_Instance instance,
+                            iBase_EntitySetHandle entity_set_handle,
+                            iBase_TagHandle** tag_handles,
+                            int* tag_handles_allocated,
+                            int* tag_handles_size, 
+                            int *err)
+{
+  iMesh_getAllEntSetTags(IMESH_INSTANCE(instance), entity_set_handle,
+			 tag_handles, tag_handles_allocated,
+			 tag_handles_size, err);
+  ERRORR("Failure to get double data from entity set.");
+}
+
+void iGeom_rmvEntSetTag(iGeom_Instance instance,
+                        iBase_EntitySetHandle entity_set_handle,
+                        iBase_TagHandle tag_handle, 
+                        int *err)
+{
+  iMesh_rmvEntSetTag (IMESH_INSTANCE(instance), entity_set_handle,
+		      tag_handle, err);
+  ERRORR("Failure to remove entity set tag.");
+}
+
+
+void iGeom_getArrData(iGeom_Instance instance,
+                      const iBase_EntityHandle* entity_handles,
+                      int entity_handles_size,
+                      iBase_TagHandle tag_handle,
+                      char** tag_values,
+                      int* tag_values_allocated,
+                      int* tag_values_size, 
+                      int *err)
+{
+  iMesh_getArrData (IMESH_INSTANCE(instance), entity_handles,
+		    entity_handles_size, tag_handle,
+		    tag_values, tag_values_allocated,
+		    tag_values_size, err);
+  ERRORR("Failure to get tag values of arbitrary type on an array of entities.");
+}
+
+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)
+{
+  iMesh_getIntArrData(IMESH_INSTANCE(instance), entity_handles,
+		      entity_handles_size, tag_handle,
+		      tag_values, tag_values_allocated,
+		      tag_values_size, err);
+  ERRORR("Failure to get integer tag values on an array of entities.");
+}
+
+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)
+{
+  iMesh_getDblArrData(IMESH_INSTANCE(instance), entity_handles,
+		      entity_handles_size, tag_handle,
+		      tag_values, tag_values_allocated,
+		      tag_values_size, err);
+  ERRORR("Failure to get double tag values on an array of entities.");
+}
+
+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)
+{
+  iMesh_getEHArrData(IMESH_INSTANCE(instance), entity_handles,
+		      entity_handles_size, tag_handle,
+		      tag_value, tag_value_allocated,
+		      tag_value_size, err);
+  ERRORR("Failure to get entity handle tag values on an array of entities.");
+}
+
+void iGeom_setArrData(iGeom_Instance instance,
+                      const iBase_EntityHandle* entity_handles,
+                      int entity_handles_size,
+                      iBase_TagHandle tag_handle,
+                      const char* tag_values,
+                      int tag_values_size, 
+                      int *err)
+{
+  iMesh_setArrData(IMESH_INSTANCE(instance), entity_handles,
+		   entity_handles_size, tag_handle,
+		   tag_values, tag_values_size, err);
+  ERRORR("Failure to set tag values of arbitrary type on an array of entities.");
+}
+
+void iGeom_setIntArrData(iGeom_Instance instance,
+                         const iBase_EntityHandle* entity_handles,
+                         int entity_handles_size,
+                         iBase_TagHandle tag_handle,
+                         const int* tag_values,
+                         int tag_values_size, 
+                         int *err)
+{
+  iMesh_setIntArrData(IMESH_INSTANCE(instance), entity_handles,
+		      entity_handles_size, tag_handle,
+		      tag_values, tag_values_size, err);
+  ERRORR("Failure to set interger tag values on an array of entities.");
+}
+
+void iGeom_setDblArrData(iGeom_Instance instance,
+                         const iBase_EntityHandle* entity_handles,
+                         int entity_handles_size,
+                         iBase_TagHandle tag_handle,
+                         const double* tag_values,
+                         const int tag_values_size, 
+                         int *err)
+{
+  iMesh_setDblArrData(IMESH_INSTANCE(instance), entity_handles,
+		      entity_handles_size, tag_handle,
+		      tag_values, tag_values_size, err);
+  ERRORR("Failure to set double tag values on an array of entities.");
+}
+
+void iGeom_setEHArrData(iGeom_Instance instance,
+                        const iBase_EntityHandle* entity_handles,
+                        int entity_handles_size,
+                        iBase_TagHandle tag_handle,
+                        const iBase_EntityHandle* tag_values,
+                        int tag_values_size, 
+                        int *err)
+{
+  iMesh_setEHArrData(IMESH_INSTANCE(instance), entity_handles,
+		     entity_handles_size, tag_handle,
+		     tag_values, tag_values_size, err);
+  ERRORR("Failure to set entity handle tag values on an array of entities.");
+}
+
+void iGeom_rmvArrTag(iGeom_Instance instance,
+                     const iBase_EntityHandle* entity_handles,
+                     int entity_handles_size,
+                     iBase_TagHandle tag_handle, 
+                     int *err)
+{
+  iMesh_rmvArrTag(IMESH_INSTANCE(instance), entity_handles,
+		  entity_handles_size, tag_handle, err);
+  ERRORR("Failure to remove tag values on an array of entities.");
+}
+
+void iGeom_getData(iGeom_Instance instance,
+                   iBase_EntityHandle entity_handle,
+                   iBase_TagHandle tag_handle,
+                   char** tag_value,
+                   int *tag_value_allocated,
+                   int *tag_value_size, 
+                   int *err)
+{
+  iMesh_getData(IMESH_INSTANCE(instance), entity_handle,
+		tag_handle, tag_value, tag_value_allocated,
+		tag_value_size, err);
+  ERRORR("Failure to get tag values of an entity.");
+}
+
+void iGeom_getIntData(iGeom_Instance instance,
+                      iBase_EntityHandle entity_handle,
+                      iBase_TagHandle tag_handle,
+                      int *out_data, 
+                      int *err)
+{
+  iMesh_getIntData(IMESH_INSTANCE(instance), entity_handle,
+		   tag_handle, out_data, err);
+  ERRORR("Failure to get integer tag values of an entity.");
+}
+
+void iGeom_getDblData(iGeom_Instance instance,
+                      const iBase_EntityHandle entity_handle,
+                      const iBase_TagHandle tag_handle,
+                      double *out_data, int *err)
+{
+  iMesh_getDblData(IMESH_INSTANCE(instance), entity_handle,
+		   tag_handle, out_data, err);
+  ERRORR("Failure to get double tag values of an entity.");
+}
+
+void iGeom_getEHData(iGeom_Instance instance,
+                     iBase_EntityHandle entity_handle,
+                     iBase_TagHandle tag_handle,
+                     iBase_EntityHandle *out_data, 
+                     int *err)
+{
+  iMesh_getEHData(IMESH_INSTANCE(instance), entity_handle,
+		  tag_handle, out_data, err);
+  ERRORR("Failure to get entity handle tag values of an entity.");
+}
+
+void iGeom_setData(iGeom_Instance instance,
+                   iBase_EntityHandle entity_handle,
+                   iBase_TagHandle tag_handle,
+                   const char* tag_value,
+                   int tag_value_size, 
+                   int *err)
+{
+  iMesh_setData(IMESH_INSTANCE(instance), entity_handle,
+		tag_handle, tag_value, tag_value_size, err);
+  ERRORR("Failure to set tag values of an entity.");
+}
+
+void iGeom_setIntData(iGeom_Instance instance,
+                      iBase_EntityHandle entity_handle,
+                      iBase_TagHandle tag_handle,
+                      int tag_value, 
+                      int *err)
+{
+  iMesh_setIntData(IMESH_INSTANCE(instance), entity_handle,
+		   tag_handle, tag_value, err);
+  ERRORR("Failure to set integer tag values of an entity.");
+}
+
+void iGeom_setDblData(iGeom_Instance instance,
+                      iBase_EntityHandle entity_handle,
+                      iBase_TagHandle tag_handle,
+                      double tag_value, 
+                      int *err)
+{
+  iMesh_setDblData(IMESH_INSTANCE(instance), entity_handle,
+		   tag_handle, tag_value, err);
+  ERRORR("Failure to set double tag values of an entity.");
+}
+
+void iGeom_setEHData(iGeom_Instance instance,
+                     iBase_EntityHandle entity_handle,
+                     iBase_TagHandle tag_handle,
+                     iBase_EntityHandle tag_value, 
+                     int *err)
+{
+  iMesh_setEHData(IMESH_INSTANCE(instance), entity_handle,
+		  tag_handle, tag_value, err);
+  ERRORR("Failure to set entity handle tag values of an entity.");
+}
+
+void iGeom_getAllTags(iGeom_Instance instance,
+                      iBase_EntityHandle entity_handle,
+                      iBase_TagHandle** tag_handles,
+                      int* tag_handles_allocated,
+                      int* tag_handles_size, 
+                      int *err)
+{
+  iMesh_getAllTags(IMESH_INSTANCE(instance), entity_handle,
+		   tag_handles, tag_handles_allocated,
+		   tag_handles_size, err);
+  ERRORR("Failure to get all tags.");
+}
+
+void iGeom_rmvTag(iGeom_Instance instance,
+                  iBase_EntityHandle entity_handle,
+                  iBase_TagHandle tag_handle, 
+                  int *err)
+{
+  iMesh_rmvTag(IMESH_INSTANCE(instance), entity_handle,
+	       tag_handle, err);
+  ERRORR("Failure to remove tag.");
+}
+
+void iGeom_subtract(iGeom_Instance instance,
+                    iBase_EntitySetHandle entity_set_1,
+                    iBase_EntitySetHandle entity_set_2,
+                    iBase_EntitySetHandle* result_entity_set, 
+                    int *err){ }
+
+void iGeom_intersect(iGeom_Instance instance,
+                     iBase_EntitySetHandle entity_set_1,
+                     iBase_EntitySetHandle entity_set_2,
+                     iBase_EntitySetHandle* result_entity_set, 
+                     int *err){ }
+
+void iGeom_unite(iGeom_Instance instance,
+                 iBase_EntitySetHandle entity_set_1,
+                 iBase_EntitySetHandle entity_set_2,
+                 iBase_EntitySetHandle* result_entity_set, 
+                 int *err){ }
+
+static inline void
+iGeom_processError( iBase_ErrorType code, const char* desc ) 
+{
+  std::strncpy( iGeom_LAST_ERROR.description, desc,
+                sizeof(iGeom_LAST_ERROR.description) );
+  iGeom_LAST_ERROR.error_type = code;
+}
+
+static void
+iGeom_get_adjacent_entities(iGeom_Instance instance,
+			    const MBEntityHandle from, 
+			    const int to_dim,
+			    MBRange &adjs,
+			    //std::vector<MBEntityHandle>& adjs,
+			    int* err)
+{
+  int this_dim = -1;
+  for (int i = 0; i < 4; i++) {
+    if (_my_gsets[i].find(from) != _my_gsets[i].end()) {
+      this_dim = i;
+      break;
+    }
+  }
+  
+  // check target dimension
+  if (-1 == this_dim) {
+    iGeom_processError(iBase_FAILURE, "Entity not a geometry entity.");
+    RETURN(iBase_FAILURE);
+  }
+  else if (0 > to_dim || 3 < to_dim) {
+    iGeom_processError(iBase_FAILURE, "To dimension must be between 0 and 3.");
+    RETURN(iBase_FAILURE);
+  }
+  else if (to_dim == this_dim) {
+    iGeom_processError(iBase_FAILURE, "To dimension must be different from entity dimension.");
+    RETURN(iBase_FAILURE);
+  }
+  
+  MBErrorCode rval;
+  if (to_dim > this_dim) {
+    rval = MBI->get_parent_meshsets(from, adjs, to_dim - this_dim);
+  }
+  else {
+    rval = MBI->get_child_meshsets(from, adjs, to_dim - this_dim);
+  }
+
+  RETURN(iBase_SUCCESS);
+}
+
+

Added: MOAB/trunk/tools/iGeom/iGeom_MOAB.hpp
===================================================================
--- MOAB/trunk/tools/iGeom/iGeom_MOAB.hpp	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/iGeom_MOAB.hpp	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,72 @@
+#ifndef IGEOM_MOAB_HPP
+#define IGEOM_MOAB_HPP
+
+#include "iGeom.h"
+#include "MBForward.hpp"
+
+class GeomTopoTool;
+
+/* map from MB's entity type to TSTT's entity type */
+extern const iBase_EntityType tstt_type_table[MBMAXTYPE+1];
+
+/* map to MB's entity type from TSTT's entity topology */
+extern const MBEntityType mb_topology_table[MBMAXTYPE+1];
+
+/* map from TSTT's tag types to MOAB's */
+extern const MBDataType mb_data_type_table[4];
+
+/* map from MOAB's tag types to tstt's */
+extern const iBase_TagValueType tstt_data_type_table[MB_MAX_DATA_TYPE+1];
+
+/* map from MOAB's MBErrorCode to tstt's */
+extern "C" const iBase_ErrorType iBase_ERROR_MAP[MB_FAILURE+1];
+
+/* Create ITAPS iterator */
+iGeom_EntityIterator create_itaps_iterator( MBRange& swap_range,
+                                            int array_size = 1 ); 
+
+/* Define macro for quick reference to MBInterface instance */
+static inline MBInterface* MBI_cast( iGeom_Instance i )  
+  { return reinterpret_cast<MBInterface*>(i); }         
+#define MBI MBI_cast(instance)
+
+/* Define macro for quick reference to MBInterface instance */
+static inline MBEntityHandle MBH_cast( iBase_EntityHandle h )  
+  { return reinterpret_cast<MBEntityHandle>(h); }         
+
+#define GETGTT(a) {if (_my_geomTopoTool == NULL) _my_geomTopoTool =	\
+	new GeomTopoTool(reinterpret_cast<MBInterface*>(a));}
+
+/* Most recently returned error code */
+//extern "C" iBase_Error iGeom_LAST_ERROR;
+
+#define ERRORR(a) {if (iBase_SUCCESS != *err) {iGeom_processError((iBase_ErrorType) *err, a); return;}}
+
+#define MBERRORR(a) {if (MB_SUCCESS != rval) {		\
+      iGeom_processError(iBase_FAILURE, a);		\
+      RETURN(iBase_FAILURE);}}
+
+#define RETURN(a) do {iGeom_LAST_ERROR.error_type = *err = (a); return;} while(false)
+
+#define MBRTN(a) RETURN(iBase_ERROR_MAP[(a)])
+
+#define CHKERR(err) if (MB_SUCCESS != (err)) MBRTN(err)
+
+#define MIN(a,b) (a > b ? b : a)
+
+#define IMESH_INSTANCE(a) reinterpret_cast<iMesh_Instance>(a)
+
+#define CHECK_SIZE(array, allocated, size, type, retval)	\
+  if (0 != allocated && NULL != array && allocated < (size)) {	\
+    iGeom_processError(iBase_MEMORY_ALLOCATION_FAILED,			\
+		       "Allocated array not large enough to hold returned contents."); \
+    RETURN(iBase_MEMORY_ALLOCATION_FAILED);				\
+  }									\
+  if ((size) && ((allocated) == 0 || NULL == (array))) {		\
+    array = (type*)malloc((size)*sizeof(type));				\
+    allocated=(size);							\
+    if (NULL == array) {iGeom_processError(iBase_MEMORY_ALLOCATION_FAILED, \
+					   "Couldn't allocate array.");RETURN(iBase_MEMORY_ALLOCATION_FAILED); } \
+  }
+
+#endif // IGEOM_MOAB_HPP

Added: MOAB/trunk/tools/iGeom/iGeom_f.h
===================================================================
--- MOAB/trunk/tools/iGeom/iGeom_f.h	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/iGeom_f.h	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,11 @@
+#ifndef IGEOM_F_H
+#define IGEOM_F_H
+
+#define iGeom_Instance integer
+#define iGeom_EntityIterator integer
+#define iGeom_EntityArrIterator integer
+
+#endif 
+
+#include "iBase_f.h"
+

Added: MOAB/trunk/tools/iGeom/iGeom_protos.h
===================================================================
--- MOAB/trunk/tools/iGeom/iGeom_protos.h	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/iGeom_protos.h	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,183 @@
+#include "MBCN_FCDefs.h"
+#ifdef MBCN_FC_FUNC_
+
+#define iGeom_getDescription MBCN_FC_FUNC_( igeom_getdescription, IGEOM_GETDESCRIPTION )
+#define iGeom_getErrorType MBCN_FC_FUNC_( igeom_geterrortype, IGEOM_GETERRORTYPE )
+#define iGeom_newGeom MBCN_FC_FUNC_( igeom_newgeom, IGEOM_NEWGEOM )
+#define iGeom_dtor MBCN_FC_FUNC_( igeom_dtor, IGEOM_DTOR )
+#define iGeom_load MBCN_FC_FUNC_( igeom_load, IGEOM_LOAD )
+#define iGeom_save MBCN_FC_FUNC_( igeom_save, IGEOM_SAVE )
+#define iGeom_getRootSet MBCN_FC_FUNC_( igeom_getrootset, IGEOM_GETROOTSET )
+#define iGeom_getBoundBox MBCN_FC_FUNC_( igeom_getboundbox, IGEOM_GETBOUNDBOX )
+#define iGeom_getEntities MBCN_FC_FUNC_( igeom_getentities, IGEOM_GETENTITIES )
+#define iGeom_getNumOfType MBCN_FC_FUNC_( igeom_getnumoftype, IGEOM_GETNUMOFTYPE )
+#define iGeom_getEntType MBCN_FC_FUNC_( igeom_getenttype, IGEOM_GETENTTYPE )
+#define iGeom_getArrType MBCN_FC_FUNC_( igeom_getarrtype, IGEOM_GETARRTYPE )
+#define iGeom_getEntAdj MBCN_FC_FUNC_( igeom_getentadj, IGEOM_GETENTADJ )
+#define iGeom_getArrAdj MBCN_FC_FUNC_( igeom_getarradj, IGEOM_GETARRADJ )
+#define iGeom_getEnt2ndAdj MBCN_FC_FUNC_( igeom_getent2ndadj, IGEOM_GETENT2NDADJ )
+#define iGeom_getArr2ndAdj MBCN_FC_FUNC_( igeom_getarr2ndadj, IGEOM_GETARR2NDADJ )
+#define iGeom_isEntAdj MBCN_FC_FUNC_( igeom_isentadj, IGEOM_ISENTADJ )
+#define iGeom_isArrAdj MBCN_FC_FUNC_( igeom_isarradj, IGEOM_ISARRADJ )
+#define iGeom_getTopoLevel MBCN_FC_FUNC_( igeom_gettopolevel, IGEOM_GETTOPOLEVEL )
+#define iGeom_getEntClosestPt MBCN_FC_FUNC_( igeom_getentclosestpt, IGEOM_GETENTCLOSESTPT )
+#define iGeom_getArrClosestPt MBCN_FC_FUNC_( igeom_getarrclosestpt, IGEOM_GETARRCLOSESTPT )
+#define iGeom_getEntNrmlXYZ MBCN_FC_FUNC_( igeom_getentnrmlxyz, IGEOM_GETENTNRMLXYZ )
+#define iGeom_getArrNrmlXYZ MBCN_FC_FUNC_( igeom_getarrnrmlxyz, IGEOM_GETARRNRMLXYZ )
+#define iGeom_getEntNrmlPlXYZ MBCN_FC_FUNC_( igeom_getentnrmlplxyz, IGEOM_GETENTNRMLPLXYZ )
+#define iGeom_getArrNrmlPlXYZ MBCN_FC_FUNC_( igeom_getarrnrmlplxyz, IGEOM_GETARRNRMLPLXYZ )
+#define iGeom_getEntTgntXYZ MBCN_FC_FUNC_( igeom_getenttgntxyz, IGEOM_GETENTTGNTXYZ )
+#define iGeom_getArrTgntXYZ MBCN_FC_FUNC_( igeom_getarrtgntxyz, IGEOM_GETARRTGNTXYZ )
+#define iGeom_getFcCvtrXYZ MBCN_FC_FUNC_( igeom_getfccvtrxyz, IGEOM_GETFCCVTRXYZ )
+#define iGeom_getEgCvtrXYZ MBCN_FC_FUNC_( igeom_getegcvtrxyz, IGEOM_GETEGCVTRXYZ )
+#define iGeom_getEntArrCvtrXYZ MBCN_FC_FUNC_( igeom_getentarrcvtrxyz, IGEOM_GETENTARRCVTRXYZ )
+#define iGeom_getEgEvalXYZ MBCN_FC_FUNC_( igeom_getegevalxyz, IGEOM_GETEGEVALXYZ )
+#define iGeom_getFcEvalXYZ MBCN_FC_FUNC_( igeom_getfcevalxyz, IGEOM_GETFCEVALXYZ )
+#define iGeom_getArrEgEvalXYZ MBCN_FC_FUNC_( igeom_getarregevalxyz, IGEOM_GETARREGEVALXYZ )
+#define iGeom_getArrFcEvalXYZ MBCN_FC_FUNC_( igeom_getarrfcevalxyz, IGEOM_GETARRFCEVALXYZ )
+#define iGeom_getEntBoundBox MBCN_FC_FUNC_( igeom_getentboundbox, IGEOM_GETENTBOUNDBOX )
+#define iGeom_getArrBoundBox MBCN_FC_FUNC_( igeom_getarrboundbox, IGEOM_GETARRBOUNDBOX )
+#define iGeom_getVtxCoord MBCN_FC_FUNC_( igeom_getvtxcoord, IGEOM_GETVTXCOORD )
+#define iGeom_getVtxArrCoords MBCN_FC_FUNC_( igeom_getvtxarrcoords, IGEOM_GETVTXARRCOORDS )
+#define iGeom_getPntRayIntsct MBCN_FC_FUNC_( igeom_getpntrayintsct, IGEOM_GETPNTRAYINTSCT )
+#define iGeom_getPntArrRayIntsct MBCN_FC_FUNC_( igeom_getpntarrrayintsct, IGEOM_GETPNTARRRAYINTSCT )
+#define iGeom_getPntClsf MBCN_FC_FUNC_( igeom_getpntclsf, IGEOM_GETPNTCLSF )
+#define iGeom_getPntArrClsf MBCN_FC_FUNC_( igeom_getpntarrclsf, IGEOM_GETPNTARRCLSF )
+#define iGeom_getEntNrmlSense MBCN_FC_FUNC_( igeom_getentnrmlsense, IGEOM_GETENTNRMLSENSE )
+#define iGeom_getArrNrmlSense MBCN_FC_FUNC_( igeom_getarrnrmlsense, IGEOM_GETARRNRMLSENSE )
+#define iGeom_getEgFcSense MBCN_FC_FUNC_( igeom_getegfcsense, IGEOM_GETEGFCSENSE )
+#define iGeom_getEgFcArrSense MBCN_FC_FUNC_( igeom_getegfcarrsense, IGEOM_GETEGFCARRSENSE )
+#define iGeom_getEgVtxSense MBCN_FC_FUNC_( igeom_getegvtxsense, IGEOM_GETEGVTXSENSE )
+#define iGeom_getEgVtxArrSense MBCN_FC_FUNC_( igeom_getegvtxarrsense, IGEOM_GETEGVTXARRSENSE )
+#define iGeom_measure MBCN_FC_FUNC_( igeom_measure, IGEOM_MEASURE )
+#define iGeom_getFaceType MBCN_FC_FUNC_( igeom_getfacetype, IGEOM_GETFACETYPE )
+#define iGeom_getParametric MBCN_FC_FUNC_( igeom_getparametric, IGEOM_GETPARAMETRIC )
+#define iGeom_isEntParametric MBCN_FC_FUNC_( igeom_isentparametric, IGEOM_ISENTPARAMETRIC )
+#define iGeom_isArrParametric MBCN_FC_FUNC_( igeom_isarrparametric, IGEOM_ISARRPARAMETRIC )
+#define iGeom_getEntUVtoXYZ MBCN_FC_FUNC_( igeom_getentuvtoxyz, IGEOM_GETENTUVTOXYZ )
+#define iGeom_getArrUVtoXYZ MBCN_FC_FUNC_( igeom_getarruvtoxyz, IGEOM_GETARRUVTOXYZ )
+#define iGeom_getEntUtoXYZ MBCN_FC_FUNC_( igeom_getentutoxyz, IGEOM_GETENTUTOXYZ )
+#define iGeom_getArrUtoXYZ MBCN_FC_FUNC_( igeom_getarrutoxyz, IGEOM_GETARRUTOXYZ )
+#define iGeom_getEntXYZtoUV MBCN_FC_FUNC_( igeom_getentxyztouv, IGEOM_GETENTXYZTOUV )
+#define iGeom_getEntXYZtoU MBCN_FC_FUNC_( igeom_getentxyztou, IGEOM_GETENTXYZTOU )
+#define iGeom_getArrXYZtoUV MBCN_FC_FUNC_( igeom_getarrxyztouv, IGEOM_GETARRXYZTOUV )
+#define iGeom_getArrXYZtoU MBCN_FC_FUNC_( igeom_getarrxyztou, IGEOM_GETARRXYZTOU )
+#define iGeom_getEntXYZtoUVHint MBCN_FC_FUNC_( igeom_getentxyztouvhint, IGEOM_GETENTXYZTOUVHINT )
+#define iGeom_getArrXYZtoUVHint MBCN_FC_FUNC_( igeom_getarrxyztouvhint, IGEOM_GETARRXYZTOUVHINT )
+#define iGeom_getEntUVRange MBCN_FC_FUNC_( igeom_getentuvrange, IGEOM_GETENTUVRANGE )
+#define iGeom_getEntURange MBCN_FC_FUNC_( igeom_getenturange, IGEOM_GETENTURANGE )
+#define iGeom_getArrUVRange MBCN_FC_FUNC_( igeom_getarruvrange, IGEOM_GETARRUVRANGE )
+#define iGeom_getArrURange MBCN_FC_FUNC_( igeom_getarrurange, IGEOM_GETARRURANGE )
+#define iGeom_getEntUtoUV MBCN_FC_FUNC_( igeom_getentutouv, IGEOM_GETENTUTOUV )
+#define iGeom_getVtxToUV MBCN_FC_FUNC_( igeom_getvtxtouv, IGEOM_GETVTXTOUV )
+#define iGeom_getVtxToU MBCN_FC_FUNC_( igeom_getvtxtou, IGEOM_GETVTXTOU )
+#define iGeom_getArrUtoUV MBCN_FC_FUNC_( igeom_getarrutouv, IGEOM_GETARRUTOUV )
+#define iGeom_getVtxArrToUV MBCN_FC_FUNC_( igeom_getvtxarrtouv, IGEOM_GETVTXARRTOUV )
+#define iGeom_getVtxArrToU MBCN_FC_FUNC_( igeom_getvtxarrtou, IGEOM_GETVTXARRTOU )
+#define iGeom_getEntNrmlUV MBCN_FC_FUNC_( igeom_getentnrmluv, IGEOM_GETENTNRMLUV )
+#define iGeom_getArrNrmlUV MBCN_FC_FUNC_( igeom_getarrnrmluv, IGEOM_GETARRNRMLUV )
+#define iGeom_getEntTgntU MBCN_FC_FUNC_( igeom_getenttgntu, IGEOM_GETENTTGNTU )
+#define iGeom_getArrTgntU MBCN_FC_FUNC_( igeom_getarrtgntu, IGEOM_GETARRTGNTU )
+#define iGeom_getEnt1stDrvt MBCN_FC_FUNC_( igeom_getent1stdrvt, IGEOM_GETENT1STDRVT )
+#define iGeom_getArr1stDrvt MBCN_FC_FUNC_( igeom_getarr1stdrvt, IGEOM_GETARR1STDRVT )
+#define iGeom_getEnt2ndDrvt MBCN_FC_FUNC_( igeom_getent2nddrvt, IGEOM_GETENT2NDDRVT )
+#define iGeom_getArr2ndDrvt MBCN_FC_FUNC_( igeom_getarr2nddrvt, IGEOM_GETARR2NDDRVT )
+#define iGeom_getFcCvtrUV MBCN_FC_FUNC_( igeom_getfccvtruv, IGEOM_GETFCCVTRUV )
+#define iGeom_getFcArrCvtrUV MBCN_FC_FUNC_( igeom_getfcarrcvtruv, IGEOM_GETFCARRCVTRUV )
+#define iGeom_isEntPeriodic MBCN_FC_FUNC_( igeom_isentperiodic, IGEOM_ISENTPERIODIC )
+#define iGeom_isArrPeriodic MBCN_FC_FUNC_( igeom_isarrperiodic, IGEOM_ISARRPERIODIC )
+#define iGeom_isFcDegenerate MBCN_FC_FUNC_( igeom_isfcdegenerate, IGEOM_ISFCDEGENERATE )
+#define iGeom_isFcArrDegenerate MBCN_FC_FUNC_( igeom_isfcarrdegenerate, IGEOM_ISFCARRDEGENERATE )
+#define iGeom_getTolerance MBCN_FC_FUNC_( igeom_gettolerance, IGEOM_GETTOLERANCE )
+#define iGeom_getEntTolerance MBCN_FC_FUNC_( igeom_getenttolerance, IGEOM_GETENTTOLERANCE )
+#define iGeom_getArrTolerance MBCN_FC_FUNC_( igeom_getarrtolerance, IGEOM_GETARRTOLERANCE )
+#define iGeom_initEntIter MBCN_FC_FUNC_( igeom_initentiter, IGEOM_INITENTITER )
+#define iGeom_initEntArrIter MBCN_FC_FUNC_( igeom_initentarriter, IGEOM_INITENTARRITER )
+#define iGeom_getNextEntIter MBCN_FC_FUNC_( igeom_getnextentiter, IGEOM_GETNEXTENTITER )
+#define iGeom_getNextEntArrIter MBCN_FC_FUNC_( igeom_getnextentarriter, IGEOM_GETNEXTENTARRITER )
+#define iGeom_resetEntIter MBCN_FC_FUNC_( igeom_resetentiter, IGEOM_RESETENTITER )
+#define iGeom_resetEntArrIter MBCN_FC_FUNC_( igeom_resetentarriter, IGEOM_RESETENTARRITER )
+#define iGeom_endEntIter MBCN_FC_FUNC_( igeom_endentiter, IGEOM_ENDENTITER )
+#define iGeom_endEntArrIter MBCN_FC_FUNC_( igeom_endentarriter, IGEOM_ENDENTARRITER )
+#define iGeom_copyEnt MBCN_FC_FUNC_( igeom_copyent, IGEOM_COPYENT )
+#define iGeom_sweepEntAboutAxis MBCN_FC_FUNC_( igeom_sweepentaboutaxis, IGEOM_SWEEPENTABOUTAXIS )
+#define iGeom_deleteAll MBCN_FC_FUNC_( igeom_deleteall, IGEOM_DELETEALL )
+#define iGeom_deleteEnt MBCN_FC_FUNC_( igeom_deleteent, IGEOM_DELETEENT )
+#define iGeom_createSphere MBCN_FC_FUNC_( igeom_createsphere, IGEOM_CREATESPHERE )
+#define iGeom_createPrism MBCN_FC_FUNC_( igeom_createprism, IGEOM_CREATEPRISM )
+#define iGeom_createBrick MBCN_FC_FUNC_( igeom_createbrick, IGEOM_CREATEBRICK )
+#define iGeom_createCylinder MBCN_FC_FUNC_( igeom_createcylinder, IGEOM_CREATECYLINDER )
+#define iGeom_createCone MBCN_FC_FUNC_( igeom_createcone, IGEOM_CREATECONE )
+#define iGeom_createTorus MBCN_FC_FUNC_( igeom_createtorus, IGEOM_CREATETORUS )
+#define iGeom_moveEnt MBCN_FC_FUNC_( igeom_moveent, IGEOM_MOVEENT )
+#define iGeom_rotateEnt MBCN_FC_FUNC_( igeom_rotateent, IGEOM_ROTATEENT )
+#define iGeom_reflectEnt MBCN_FC_FUNC_( igeom_reflectent, IGEOM_REFLECTENT )
+#define iGeom_scaleEnt MBCN_FC_FUNC_( igeom_scaleent, IGEOM_SCALEENT )
+#define iGeom_uniteEnts MBCN_FC_FUNC_( igeom_uniteents, IGEOM_UNITEENTS )
+#define iGeom_subtractEnts MBCN_FC_FUNC_( igeom_subtractents, IGEOM_SUBTRACTENTS )
+#define iGeom_intersectEnts MBCN_FC_FUNC_( igeom_intersectents, IGEOM_INTERSECTENTS )
+#define iGeom_sectionEnt MBCN_FC_FUNC_( igeom_sectionent, IGEOM_SECTIONENT )
+#define iGeom_imprintEnts MBCN_FC_FUNC_( igeom_imprintents, IGEOM_IMPRINTENTS )
+#define iGeom_mergeEnts MBCN_FC_FUNC_( igeom_mergeents, IGEOM_MERGEENTS )
+#define iGeom_createEntSet MBCN_FC_FUNC_( igeom_createentset, IGEOM_CREATEENTSET )
+#define iGeom_destroyEntSet MBCN_FC_FUNC_( igeom_destroyentset, IGEOM_DESTROYENTSET )
+#define iGeom_isList MBCN_FC_FUNC_( igeom_islist, IGEOM_ISLIST )
+#define iGeom_getNumEntSets MBCN_FC_FUNC_( igeom_getnumentsets, IGEOM_GETNUMENTSETS )
+#define iGeom_getEntSets MBCN_FC_FUNC_( igeom_getentsets, IGEOM_GETENTSETS )
+#define iGeom_addEntToSet MBCN_FC_FUNC_( igeom_addenttoset, IGEOM_ADDENTTOSET )
+#define iGeom_rmvEntFromSet MBCN_FC_FUNC_( igeom_rmventfromset, IGEOM_RMVENTFROMSET )
+#define iGeom_addEntArrToSet MBCN_FC_FUNC_( igeom_addentarrtoset, IGEOM_ADDENTARRTOSET )
+#define iGeom_rmvEntArrFromSet MBCN_FC_FUNC_( igeom_rmventarrfromset, IGEOM_RMVENTARRFROMSET )
+#define iGeom_addEntSet MBCN_FC_FUNC_( igeom_addentset, IGEOM_ADDENTSET )
+#define iGeom_rmvEntSet MBCN_FC_FUNC_( igeom_rmventset, IGEOM_RMVENTSET )
+#define iGeom_isEntContained MBCN_FC_FUNC_( igeom_isentcontained, IGEOM_ISENTCONTAINED )
+#define iGeom_isEntArrContained MBCN_FC_FUNC_( igeom_isentarrcontained, IGEOM_ISENTARRCONTAINED )
+#define iGeom_isEntSetContained MBCN_FC_FUNC_( igeom_isentsetcontained, IGEOM_ISENTSETCONTAINED )
+#define iGeom_addPrntChld MBCN_FC_FUNC_( igeom_addprntchld, IGEOM_ADDPRNTCHLD )
+#define iGeom_rmvPrntChld MBCN_FC_FUNC_( igeom_rmvprntchld, IGEOM_RMVPRNTCHLD )
+#define iGeom_isChildOf MBCN_FC_FUNC_( igeom_ischildof, IGEOM_ISCHILDOF )
+#define iGeom_getNumChld MBCN_FC_FUNC_( igeom_getnumchld, IGEOM_GETNUMCHLD )
+#define iGeom_getNumPrnt MBCN_FC_FUNC_( igeom_getnumprnt, IGEOM_GETNUMPRNT )
+#define iGeom_getChldn MBCN_FC_FUNC_( igeom_getchldn, IGEOM_GETCHLDN )
+#define iGeom_getPrnts MBCN_FC_FUNC_( igeom_getprnts, IGEOM_GETPRNTS )
+#define iGeom_createTag MBCN_FC_FUNC_( igeom_createtag, IGEOM_CREATETAG )
+#define iGeom_destroyTag MBCN_FC_FUNC_( igeom_destroytag, IGEOM_DESTROYTAG )
+#define iGeom_getTagName MBCN_FC_FUNC_( igeom_gettagname, IGEOM_GETTAGNAME )
+#define iGeom_getTagSizeValues MBCN_FC_FUNC_( igeom_gettagsizevalues, IGEOM_GETTAGSIZEVALUES )
+#define iGeom_getTagSizeBytes MBCN_FC_FUNC_( igeom_gettagsizebytes, IGEOM_GETTAGSIZEBYTES )
+#define iGeom_getTagHandle MBCN_FC_FUNC_( igeom_gettaghandle, IGEOM_GETTAGHANDLE )
+#define iGeom_getTagType MBCN_FC_FUNC_( igeom_gettagtype, IGEOM_GETTAGTYPE )
+#define iGeom_setEntSetData MBCN_FC_FUNC_( igeom_setentsetdata, IGEOM_SETENTSETDATA )
+#define iGeom_setEntSetIntData MBCN_FC_FUNC_( igeom_setentsetintdata, IGEOM_SETENTSETINTDATA )
+#define iGeom_setEntSetDblData MBCN_FC_FUNC_( igeom_setentsetdbldata, IGEOM_SETENTSETDBLDATA )
+#define iGeom_setEntSetEHData MBCN_FC_FUNC_( igeom_setentsetehdata, IGEOM_SETENTSETEHDATA )
+#define iGeom_getEntSetData MBCN_FC_FUNC_( igeom_getentsetdata, IGEOM_GETENTSETDATA )
+#define iGeom_getEntSetIntData MBCN_FC_FUNC_( igeom_getentsetintdata, IGEOM_GETENTSETINTDATA )
+#define iGeom_getEntSetDblData MBCN_FC_FUNC_( igeom_getentsetdbldata, IGEOM_GETENTSETDBLDATA )
+#define iGeom_getEntSetEHData MBCN_FC_FUNC_( igeom_getentsetehdata, IGEOM_GETENTSETEHDATA )
+#define iGeom_getAllEntSetTags MBCN_FC_FUNC_( igeom_getallentsettags, IGEOM_GETALLENTSETTAGS )
+#define iGeom_rmvEntSetTag MBCN_FC_FUNC_( igeom_rmventsettag, IGEOM_RMVENTSETTAG )
+#define iGeom_getArrData MBCN_FC_FUNC_( igeom_getarrdata, IGEOM_GETARRDATA )
+#define iGeom_getIntArrData MBCN_FC_FUNC_( igeom_getintarrdata, IGEOM_GETINTARRDATA )
+#define iGeom_getDblArrData MBCN_FC_FUNC_( igeom_getdblarrdata, IGEOM_GETDBLARRDATA )
+#define iGeom_getEHArrData MBCN_FC_FUNC_( igeom_geteharrdata, IGEOM_GETEHARRDATA )
+#define iGeom_setArrData MBCN_FC_FUNC_( igeom_setarrdata, IGEOM_SETARRDATA )
+#define iGeom_setIntArrData MBCN_FC_FUNC_( igeom_setintarrdata, IGEOM_SETINTARRDATA )
+#define iGeom_setDblArrData MBCN_FC_FUNC_( igeom_setdblarrdata, IGEOM_SETDBLARRDATA )
+#define iGeom_setEHArrData MBCN_FC_FUNC_( igeom_seteharrdata, IGEOM_SETEHARRDATA )
+#define iGeom_rmvArrTag MBCN_FC_FUNC_( igeom_rmvarrtag, IGEOM_RMVARRTAG )
+#define iGeom_getData MBCN_FC_FUNC_( igeom_getdata, IGEOM_GETDATA )
+#define iGeom_getIntData MBCN_FC_FUNC_( igeom_getintdata, IGEOM_GETINTDATA )
+#define iGeom_getDblData MBCN_FC_FUNC_( igeom_getdbldata, IGEOM_GETDBLDATA )
+#define iGeom_getEHData MBCN_FC_FUNC_( igeom_getehdata, IGEOM_GETEHDATA )
+#define iGeom_setData MBCN_FC_FUNC_( igeom_setdata, IGEOM_SETDATA )
+#define iGeom_setIntData MBCN_FC_FUNC_( igeom_setintdata, IGEOM_SETINTDATA )
+#define iGeom_setDblData MBCN_FC_FUNC_( igeom_setdbldata, IGEOM_SETDBLDATA )
+#define iGeom_setEHData MBCN_FC_FUNC_( igeom_setehdata, IGEOM_SETEHDATA )
+#define iGeom_getAllTags MBCN_FC_FUNC_( igeom_getalltags, IGEOM_GETALLTAGS )
+#define iGeom_rmvTag MBCN_FC_FUNC_( igeom_rmvtag, IGEOM_RMVTAG )
+#define iGeom_subtract MBCN_FC_FUNC_( igeom_subtract, IGEOM_SUBTRACT )
+#define iGeom_intersect MBCN_FC_FUNC_( igeom_intersect, IGEOM_INTERSECT )
+#define iGeom_unite MBCN_FC_FUNC_( igeom_unite, IGEOM_UNITE )
+
+#endif

Added: MOAB/trunk/tools/iGeom/testgeom.cc
===================================================================
--- MOAB/trunk/tools/iGeom/testgeom.cc	                        (rev 0)
+++ MOAB/trunk/tools/iGeom/testgeom.cc	2010-02-12 06:53:14 UTC (rev 3539)
@@ -0,0 +1,1521 @@
+/**
+ * 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.
+ * 
+ */
+/**
+ * \file testgeom.cc
+ *
+ * \brief testgeom, a unit test for the ITAPS geometry interface
+ *
+ */
+#include "iGeom.h"
+#include <iostream>
+#include <set>
+#include <algorithm>
+#include <vector>
+#include <iterator>
+#include <algorithm>
+#include <iomanip>
+#include <assert.h>
+#include <string.h>
+#include <math.h>
+#define CHECK( STR ) if (err != iBase_SUCCESS) return print_error( STR, err, geom, __FILE__, __LINE__ )
+
+#define STRINGIFY(S) XSTRINGIFY(S)
+#define XSTRINGIFY(S) #S
+
+static bool print_error( const char* desc, 
+                         int err,
+                         iGeom_Instance geom,
+                         const char* file,
+                         int line )
+{
+  char buffer[1024];
+  int err2 = err;
+  iGeom_getDescription( geom, buffer, &err2, sizeof(buffer) );
+  buffer[sizeof(buffer)-1] = '\0';
+  
+  std::cerr << "ERROR: " << desc << std::endl
+            << "  Error code: " << err << std::endl
+            << "  Error desc: " << buffer << std::endl
+            << "  At        : " << file << ':' << line << std::endl
+            ;
+  
+  return false; // must always return false or CHECK macro will break
+}
+
+typedef iBase_TagHandle TagHandle;
+typedef iBase_EntityHandle GentityHandle;
+typedef iBase_EntitySetHandle GentitysetHandle;
+
+/* Frees allocated arrays for us */
+template <typename T> class SimpleArray
+{
+  private:
+    T* arr;
+    int arrSize;
+    int arrAllocated;
+     
+  public:
+    SimpleArray() : arr(0) , arrSize(0), arrAllocated(0) {}
+    SimpleArray( unsigned s ) :arrSize(s), arrAllocated(s) {
+      arr = (T*)malloc(s*sizeof(T));
+      for (unsigned i = 0; i < s; ++i)
+        new (arr+i) T();
+    }
+    
+    ~SimpleArray() {
+      for (int i = 0; i < size(); ++i)
+        arr[i].~T();
+      free(arr);
+    }
+
+    T**  ptr()            { return &arr; }
+    int& size()           { return arrSize; }
+    int  size()     const { return arrSize; }
+    int& capacity()       { return arrAllocated; }
+    int  capacity() const { return arrAllocated; }
+    
+    typedef T* iterator;
+    typedef const T* const_iterator;
+    iterator       begin()       { return arr; }
+    const_iterator begin() const { return arr; }
+    iterator         end()       { return arr + arrSize; }
+    const_iterator   end() const { return arr + arrSize; }
+    
+    
+    T& operator[]( unsigned idx )       { return arr[idx]; }
+    T  operator[]( unsigned idx ) const { return arr[idx]; }
+};
+
+#define ARRAY_INOUT( A ) A.ptr(), &A.capacity(), &A.size()
+#define ARRAY_IN( A ) &A[0], A.size()
+
+bool gLoad_test(const std::string filename, iGeom_Instance);
+
+bool tags_test(iGeom_Instance geom);
+bool tag_get_set_test(iGeom_Instance geom);
+bool tag_info_test(iGeom_Instance geom);
+bool gentityset_test(iGeom_Instance geom, bool /*multiset*/, bool /*ordered*/);
+bool topology_adjacencies_test(iGeom_Instance geom);
+bool geometry_evaluation_test(iGeom_Instance geom);
+bool construct_test(iGeom_Instance geom);
+bool primitives_test(iGeom_Instance geom);
+bool transforms_test(iGeom_Instance geom);
+bool booleans_test(iGeom_Instance geom);
+bool shutdown_test(iGeom_Instance geom, std::string &engine_opt);
+bool save_entset_test(iGeom_Instance geom);
+bool mesh_size_test(iGeom_Instance geom);
+
+void handle_error_code(const bool result,
+                       int &number_failed,
+                       int &/*number_not_implemented*/,
+                       int &number_successful)
+{
+  if (result) {
+    std::cout << "Success";
+    number_successful++;
+  }
+  else {
+    std::cout << "Failure";    
+    number_failed++;
+  }
+}
+
+int main( int argc, char *argv[] )
+{
+    // Check command line arg
+  #ifdef FORCE_OCC
+    #ifndef HAVE_OCC
+      #error "Cannot force use of OCC w/out OCC support"
+    #endif
+  std::string filename = STRINGIFY(SRCDIR) "/../test/LeverArm.brep";
+    std::string engine_opt = ";engine=OCC";
+  #elif defined(HAVE_ACIS)
+    std::string filename = STRINGIFY(SRCDIR) "/testgeom.sat";
+    std::string engine_opt = ";engine=ACIS";
+  #elif defined(HAVE_OCC)
+    std::string filename = STRINGIFY(SRCDIR) "/../test/LeverArm.brep";
+    std::string engine_opt = ";engine=OCC";
+  #else
+    std::string filename = STRINGIFY(SRCDIR) "/brick.stp";
+    std::string engine_opt;
+  #endif
+  if (argc == 1) {
+    std::cout << "Using default input file: " << filename << std::endl;
+  }
+  else if (argc == 2) {
+    filename = argv[1];
+  }
+  else {
+    std::cerr << "Usage: " << argv[0] << " [geom_filename]" << std::endl;
+    return 1;
+  }
+
+  bool result;
+  int number_tests = 0;
+  int number_tests_successful = 0;
+  int number_tests_not_implemented = 0;
+  int number_tests_failed = 0;
+
+    // initialize the Mesh
+  int err;
+  iGeom_Instance geom;
+  iGeom_newGeom( engine_opt.c_str(), &geom, &err, engine_opt.length() );
+
+    // Print out Header information
+  std::cout << "\n\nITAPS GEOMETRY INTERFACE TEST PROGRAM:\n\n";
+    // gLoad test
+  std::cout << "   gLoad: ";
+  result = gLoad_test(filename, geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+  
+    // tags test
+  std::cout << "   tags: ";
+  result = tags_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+  /*
+    // gentitysets test
+  std::cout << "   gentity sets: ";
+  result = gentityset_test(geom, false, false);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+  */
+    // topology adjacencies test
+  std::cout << "   topology adjacencies: ";
+  result = topology_adjacencies_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+
+    // geometry evaluation test
+  std::cout << "   geometry evaluation: ";
+  result = geometry_evaluation_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+  /*
+    // construct test
+  std::cout << "   construct: ";
+  result = construct_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+  
+    // primitives test
+  std::cout << "   primitives: ";
+  result = primitives_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+
+    // transforms test
+  std::cout << "   transforms: ";
+  result = transforms_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+
+    // booleans test
+  std::cout << "   booleans: ";
+  result = booleans_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+  
+#if defined(HAVE_ACIS) && !defined(FORCE_OCC)
+  std::cout << "   mesh size: ";
+  result = mesh_size_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+
+    // save entset test
+  std::cout << "   save entset: ";
+  result = save_entset_test(geom);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+#endif  
+  */  
+    // shutdown test
+  std::cout << "   shutdown: ";
+  result = shutdown_test(geom, engine_opt);
+  handle_error_code(result, number_tests_failed,
+                    number_tests_not_implemented,
+                    number_tests_successful);
+  number_tests++;
+  std::cout << "\n";
+  
+
+    // summary
+
+  std::cout << "\nTSTT TEST SUMMARY: \n"
+            << "   Number Tests:           " << number_tests << "\n"
+            << "   Number Successful:      " << number_tests_successful << "\n"
+            << "   Number Not Implemented: " << number_tests_not_implemented << "\n"
+            << "   Number Failed:          " << number_tests_failed 
+            << "\n\n" << std::endl;
+  
+  return number_tests_failed;
+}
+
+/*!
+  @test 
+  Load Mesh
+  @li Load a mesh file
+*/
+bool gLoad_test(const std::string filename, iGeom_Instance geom)
+{
+  int err;
+  iGeom_load( geom, &filename[0], 0, &err, filename.length(), 0 );
+  CHECK( "ERROR : can not load a geometry" );
+  
+  iBase_EntitySetHandle root_set;
+  iGeom_getRootSet( geom, &root_set, &err );
+  CHECK( "ERROR : getRootSet failed!" );
+  
+    // print out the number of entities
+  std::cout << "Model contents: " << std::endl;
+  const char *gtype[] = {"vertices: ", "edges: ", "faces: ", "regions: "};
+  for (int i = 0; i <= 3; ++i) {
+    int count;
+    iGeom_getNumOfType( geom, root_set, i, &count, &err );
+    CHECK( "Error: problem getting entities after gLoad." );
+    std::cout << gtype[i] << count << std::endl;
+  }
+
+  return true;
+}
+
+/*!
+  @test 
+  Test tag creating, reading, writing, deleting
+  @li Load a mesh file
+*/
+bool tags_test(iGeom_Instance geom)
+{
+  bool success = true;
+
+  success = tag_info_test(geom);
+  if (!success) return success;
+  
+  success = tag_get_set_test(geom);
+  if (!success) return success;
+
+  return true;
+}
+
+bool tag_info_test(iGeom_Instance geom) 
+{
+  int err;
+  
+  iBase_EntitySetHandle root_set;
+  iGeom_getRootSet( geom, &root_set, &err );
+  CHECK( "ERROR : getRootSet failed!" );
+
+    // create an arbitrary tag, size 4
+  iBase_TagHandle this_tag, tmp_handle;
+  std::string tag_name("tag_info tag"), tmp_name;
+  iGeom_createTag( geom, &tag_name[0], 4, iBase_BYTES, &this_tag, &err, tag_name.length() );
+  CHECK( "ERROR : can not create a tag." );
+
+    // get information on the tag
+  
+  char name_buffer[256];
+  iGeom_getTagName( geom, this_tag, name_buffer, &err, sizeof(name_buffer) );
+  CHECK( "ERROR : Couldn't get tag name." );
+  if (tag_name != name_buffer) {
+    std::cerr << "ERROR: getTagName returned '" << name_buffer 
+              << "' for tag created as '" << tag_name << "'" << std::endl;
+    return false;
+  }
+  
+  
+  iGeom_getTagHandle( geom, &tag_name[0], &tmp_handle, &err, tag_name.length() );
+  CHECK( "ERROR : Couldn't get tag handle." );
+  if (tmp_handle != this_tag) {
+    std::cerr << "ERROR: getTagHandle didn't return consistent result." << std::endl;
+    return false;
+  }  
+
+  int tag_size;
+  iGeom_getTagSizeBytes( geom, this_tag, &tag_size, &err );
+  CHECK( "ERROR : Couldn't get tag size." );
+  if (tag_size != 4) {
+    std::cerr << "ERROR: getTagSizeBytes: expected 4, got " << tag_size << std::endl;
+    return false;
+  }
+
+  iGeom_getTagSizeValues( geom, this_tag, &tag_size, &err );
+  CHECK( "ERROR : Couldn't get tag size." );
+  if (tag_size != 4) {
+    std::cerr << "ERROR: getTagSizeValues: expected 4, got " << tag_size << std::endl;
+    return false;
+  }
+
+  int tag_type;
+  iGeom_getTagType( geom, this_tag, &tag_type, &err );
+  CHECK( "ERROR : Couldn't get tag type." );
+  if (tag_type != iBase_BYTES) {
+    std::cerr << "ERROR: getTagType: expected " << iBase_BYTES 
+              << ", got " << tag_type << std::endl;
+    return false;
+  }
+  
+  iGeom_destroyTag( geom, this_tag, true, &err );
+  CHECK( "ERROR : Couldn't delete a tag." );
+
+    // print information about all the tags in the model
+
+  std::set<iBase_TagHandle> tags;
+  SimpleArray<iBase_EntityHandle> entities;
+  iGeom_getEntities( geom, root_set, iBase_ALL_TYPES, 
+                     ARRAY_INOUT(entities),  &err );
+  CHECK( "getEntities( ..., iBase_ALL_TYPES, ... ) failed." );
+  for (int i = 0; i < entities.size(); ++i) {
+    SimpleArray<iBase_TagHandle> tag_arr;
+    iGeom_getAllTags( geom, entities[i], ARRAY_INOUT(tag_arr), &err);
+    CHECK( "getAllTags failed." );
+    std::copy( tag_arr.begin(), tag_arr.end(), std::inserter( tags, tags.begin() ) );
+  }
+  
+  std::cout << "Tags defined on model: ";
+  bool first = true;
+  for (std::set<iBase_TagHandle>::iterator sit = tags.begin(); sit != tags.end(); ++sit) {
+    iGeom_getTagName( geom, *sit, name_buffer, &err, sizeof(name_buffer) );
+    name_buffer[sizeof(name_buffer)-1] = '\0'; // mnake sure of NUL termination
+    CHECK( "getTagName failed." );
+    
+    if (!first) std::cout << ", ";
+    std::cout << name_buffer;
+    first = false;
+  }
+  if (first) std::cout << "<none>";
+  std::cout << std::endl;
+
+  return true;
+}
+
+bool tag_get_set_test(iGeom_Instance geom) 
+{
+  int err;
+  
+    // create an arbitrary tag, size 4
+  iBase_TagHandle this_tag;
+  std::string tag_name("tag_get_set tag");
+  iGeom_createTag( geom, &tag_name[0], sizeof(int), iBase_BYTES, &this_tag, &err, tag_name.length() );
+  CHECK( "ERROR : can not create a tag for get_set test." );
+  
+  iBase_EntitySetHandle root_set;
+  iGeom_getRootSet( geom, &root_set, &err );
+  CHECK( "ERROR : getRootSet failed!" );
+  
+    // set this tag to an integer on each entity; keep track of total sum
+  int sum = 0, num = 0, dim;
+  for (dim = 0; dim <= 3; dim++) {
+    SimpleArray<iBase_EntityHandle> gentity_handles;
+    iGeom_getEntities( geom, root_set, dim, ARRAY_INOUT( gentity_handles ), &err );
+    int num_ents = gentity_handles.size();
+    std::vector<int> tag_vals( num_ents );
+    for (int i = 0; i < num_ents; ++i) {
+      tag_vals[i] = num;
+      sum += num;
+      ++num;
+    }
+    
+    iGeom_setArrData( geom, ARRAY_IN( gentity_handles ),
+                      this_tag, 
+                      (char*)&tag_vals[0], tag_vals.size()*sizeof(int),
+                      &err );
+    CHECK( "ERROR : can't set tag on entities" );
+  }
+  
+    // check tag values for entities now
+  int get_sum = 0;
+  for (dim = 0; dim <= 3; dim++) {
+    SimpleArray<iBase_EntityHandle> gentity_handles;
+    iGeom_getEntities( geom, root_set, dim, ARRAY_INOUT( gentity_handles ), &err );
+    int num_ents = gentity_handles.size();
+    
+    SimpleArray<char> tag_vals;
+    iGeom_getArrData( geom, ARRAY_IN( gentity_handles ), this_tag, 
+                      ARRAY_INOUT( tag_vals ), &err );
+    CHECK( "ERROR : can't get tag on entities" );
+    
+    int* tag_ptr = (int*)(&tag_vals[0]);
+    for (int i = 0; i < num_ents; ++i)
+      get_sum += tag_ptr[i];
+  }
+  
+  if (get_sum != sum) {
+    std::cerr << "ERROR: getData didn't return consistent results." << std::endl;
+    return false;
+  }
+  
+  iGeom_destroyTag( geom, this_tag, true, &err );
+  CHECK( "ERROR : couldn't delete tag." );
+
+  return true;
+}
+
+/*!
+  @test
+  TSTT gentity sets test (just implemented parts for now)
+  @li Check gentity sets
+*/
+bool gentityset_test(iGeom_Instance geom, bool /*multiset*/, bool /*ordered*/)
+{
+  int num_type = 4;
+  iBase_EntitySetHandle ges_array[4];
+  int number_array[4];
+  int num_all_gentities_super = 0;
+  int ent_type = iBase_VERTEX;
+
+  int err;
+  iBase_EntitySetHandle root_set;
+  iGeom_getRootSet( geom, &root_set, &err );
+  CHECK( "ERROR : getRootSet failed!" );
+  
+    // get the number of sets in the whole model
+  int all_sets = 0;
+  iGeom_getNumEntSets( geom, root_set, 0, &all_sets, &err );
+  CHECK( "Problem getting the number of all gentity sets in whole model." );
+
+    // add gentities to entitysets by type
+  for (; ent_type < num_type; ent_type++) {
+      // initialize the entityset
+    iGeom_createEntSet( geom, true, &ges_array[ent_type], &err );
+    CHECK( "Problem creating entityset." );
+
+      // get entities by type in total "mesh"
+    SimpleArray<iBase_EntityHandle> gentities;
+    iGeom_getEntities( geom, root_set, ent_type, ARRAY_INOUT(gentities), &err );
+    CHECK( "Failed to get gentities by type in gentityset_test." );
+    
+      // add gentities into gentity set
+    iGeom_addEntArrToSet( geom, ARRAY_IN( gentities ), ges_array[ent_type], &err );
+    CHECK( "Failed to add gentities in entityset_test." );
+    
+      // Check to make sure entity set really has correct number of entities in it
+    iGeom_getNumOfType( geom, ges_array[ent_type], ent_type, &number_array[ent_type], &err );
+    CHECK( "Failed to get number of gentities by type in entityset_test." );
+
+      // compare the number of entities by type
+    int num_type_gentity = gentities.size();
+
+    if (number_array[ent_type] != num_type_gentity)
+    {
+      std::cerr << "Number of gentities by type is not correct"
+                << std::endl;
+      return false;
+    }
+
+      // add to number of all entities in super set
+    num_all_gentities_super += num_type_gentity;
+  }
+
+    // make a super set having all entitysets
+  iBase_EntitySetHandle super_set;
+  iGeom_createEntSet( geom, true, &super_set, &err );
+  CHECK( "Failed to create a super set in gentityset_test." );
+
+  for (int i = 0; i < num_type; i++) {
+    iGeom_addEntSet( geom, ges_array[i], super_set, &err );
+    CHECK( "Failed to create a super set in gentityset_test." );
+  }
+
+    //----------TEST BOOLEAN OPERATIONS----------------//
+
+  iBase_EntitySetHandle temp_ges1;
+  iGeom_createEntSet( geom, true, &temp_ges1, &err );
+  CHECK( "Failed to create a super set in gentityset_test." );
+
+    // Subtract
+    // add all EDGEs and FACEs to temp_es1
+    // get all EDGE entities
+  SimpleArray<iBase_EntityHandle> gedges, gfaces, temp_gentities1;
+  iGeom_getEntities( geom, ges_array[iBase_EDGE], iBase_EDGE, ARRAY_INOUT(gedges), &err );
+  CHECK( "Failed to get gedge gentities in gentityset_test." );
+
+    // add EDGEs to ges1
+  iGeom_addEntArrToSet( geom, ARRAY_IN(gedges), temp_ges1, &err );
+  CHECK( "Failed to add gedge gentities in gentityset_test." );
+
+    // get all FACE gentities
+  iGeom_getEntities( geom, ges_array[iBase_FACE], iBase_FACE, ARRAY_INOUT(gfaces), &err );
+  CHECK( "Failed to get gface gentities in gentityset_test." );
+
+    // add FACEs to es1
+  iGeom_addEntArrToSet( geom, ARRAY_IN(gfaces), temp_ges1, &err );
+  CHECK( "Failed to add gface gentities in gentityset_test." );
+
+    // subtract EDGEs
+  iGeom_subtract( geom, temp_ges1, ges_array[iBase_EDGE], &temp_ges1, &err );
+  CHECK( "Failed to subtract gentitysets in gentityset_test." );
+  
+  iGeom_getEntities( geom, temp_ges1, iBase_FACE, ARRAY_INOUT(temp_gentities1), &err );
+  CHECK( "Failed to get gface gentities in gentityset_test." );
+
+  if (gfaces.size() != temp_gentities1.size()) {
+    std::cerr << "Number of entitysets after subtraction not correct \
+             in gentityset_test." << std::endl;
+    return false;
+  }
+
+    // check there's nothing but gfaces in temp_ges1
+  int num_gents;
+  iGeom_getNumOfType( geom, temp_ges1, iBase_EDGE, &num_gents, &err );
+  CHECK( "Failed to get dimensions of gentities in gentityset_test." );
+  if (0 != num_gents) {
+    std::cerr << "Subtraction failed to remove all edges" << std::endl;
+    return false;
+  }
+
+    //------------Intersect------------
+    //
+
+    // clean out the temp_ges1
+  iGeom_rmvEntArrFromSet( geom, ARRAY_IN(gfaces), temp_ges1, &err );
+  CHECK( "Failed to remove gface gentities in gentityset_test." );
+
+    // check if it is really cleaned out
+  iGeom_getNumOfType( geom, temp_ges1, iBase_FACE, &num_gents, &err );
+  CHECK( "Failed to get number of gentities by type in gentityset_test." );
+
+  if (num_gents != 0) {
+    std::cerr << "failed to remove correctly." << std::endl;
+    return false;
+  }
+  
+    // add EDGEs to temp ges1
+  iGeom_addEntArrToSet( geom, ARRAY_IN(gedges), temp_ges1, &err );
+  CHECK( "Failed to add gedge gentities in gentityset_test." );
+
+    // add FACEs to temp ges1
+  iGeom_addEntArrToSet( geom, ARRAY_IN(gfaces), temp_ges1, &err );
+  CHECK( "Failed to add gface gentities in gentityset_test." );
+
+    // intersect temp_ges1 with gedges set 
+    // temp_ges1 entityset is altered
+  iGeom_intersect( geom, temp_ges1, ges_array[iBase_EDGE], &temp_ges1, &err );
+  CHECK( "Failed to intersect in gentityset_test." );
+  
+    // try to get FACEs, but there should be nothing but EDGE
+  iGeom_getNumOfType( geom, temp_ges1, iBase_FACE, &num_gents, &err );
+  CHECK( "Failed to get gface gentities in gentityset_test." );
+
+  if (num_gents != 0) {
+    std::cerr << "wrong number of gfaces." << std::endl;
+    return false;
+  }
+
+
+    //-------------Unite--------------
+
+    // get all regions
+  iBase_EntitySetHandle temp_ges2;
+  SimpleArray<iBase_EntityHandle> gregions;
+
+  iGeom_createEntSet( geom, true, &temp_ges2, &err );
+  CHECK( "Failed to create a temp gentityset in gentityset_test." );
+  
+  iGeom_getEntities( geom, ges_array[iBase_REGION], iBase_REGION, ARRAY_INOUT(gregions), &err );
+  CHECK( "Failed to get gregion gentities in gentityset_test." );
+  
+    // add REGIONs to temp es2
+  iGeom_addEntArrToSet( geom, ARRAY_IN(gregions), temp_ges2, &err );
+  CHECK( "Failed to add gregion gentities in gentityset_test." );
+
+    // unite temp_ges1 and temp_ges2
+    // temp_ges1 gentityset is altered
+  iGeom_unite( geom, temp_ges1, temp_ges2, &temp_ges1, &err );
+  CHECK( "Failed to unite in gentityset_test." );
+
+    // perform the check
+  iGeom_getNumOfType( geom, temp_ges1, iBase_REGION, &num_gents, &err );
+  CHECK( "Failed to get number of gregion gentities by type in gentityset_test." );
+  
+  if (num_gents != number_array[iBase_REGION]) {
+    std::cerr << "different number of gregions in gentityset_test." << std::endl;
+    return false;
+  }
+
+
+    //--------Test parent/child stuff in entiysets-----------
+
+    // Add 2 sets as children to another
+  iBase_EntitySetHandle parent_child;
+  iGeom_createEntSet( geom, true, &parent_child, &err );
+  CHECK( "Problem creating gentityset in gentityset_test." );
+
+  iGeom_addPrntChld( geom, ges_array[iBase_VERTEX], parent_child, &err );
+  CHECK( "Problem add parent in gentityset_test." );
+
+    // check if parent is really added
+  SimpleArray<iBase_EntitySetHandle> parents;
+  iGeom_getPrnts( geom, parent_child, 1, ARRAY_INOUT(parents), &err );
+  CHECK( "Problem getting parents in gentityset_test." );
+
+  if (parents.size() != 1) {
+    std::cerr << "number of parents is not correct in gentityset_test."
+              << std::endl;
+    return false;
+  }
+
+    // add parent and child
+  //sidl::array<void*> parent_child_array = sidl::array<void*>::create1d(1);
+  //int num_parent_child_array;
+  //sidl::array<void*> temp_gedge_array = sidl::array<void*>::create1d(1);
+  //int num_temp_gedge_array;
+  //parent_child_array.set(0, parent_child);
+  //temp_gedge_array.set(0, ges_array[TSTTG::EntityType_EDGE]);
+  iGeom_addPrntChld( geom, ges_array[iBase_EDGE], parent_child, &err );
+  CHECK( "Problem adding parent and child in gentityset_test." );
+
+  //sidl::array<void*> temp_gface_array = sidl::array<void*>::create1d(1);
+  //int num_temp_gface_array;
+  //temp_gface_array.set(0, ges_array[TSTTG::EntityType_FACE]);
+  iGeom_addPrntChld( geom, parent_child, ges_array[iBase_FACE], &err );
+  CHECK( "Problem adding parent and child in gentityset_test." );
+
+    // add child
+  iGeom_addPrntChld( geom, parent_child, ges_array[iBase_REGION], &err );
+  CHECK( "Problem adding child in gentityset_test." );
+
+    // get the number of parent gentitysets
+  num_gents = -1;
+  iGeom_getNumPrnt( geom, parent_child, 1, &num_gents, &err );
+  CHECK( "Problem getting number of parents in gentityset_test." );
+
+  if (num_gents != 2) {
+    std::cerr << "number of parents is not correct in gentityset_test."
+              << std::endl;
+    return false;
+  }
+
+    // get the number of child gentitysets
+  num_gents = -1;
+  iGeom_getNumChld( geom, parent_child, 1, &num_gents, &err );
+  CHECK( "Problem getting number of children in gentityset_test." );
+
+  if (num_gents != 2) {
+    std::cerr << "number of children is not correct in gentityset_test."
+              << std::endl;
+    return false;
+  }
+
+  SimpleArray<iBase_EntitySetHandle> children;
+  iGeom_getChldn( geom, parent_child, 1, ARRAY_INOUT(children), &err );
+  CHECK( "Problem getting children in gentityset_test." );
+
+  if (children.size() != 2) {
+    std::cerr << "number of children is not correct in gentityset_test."
+              << std::endl;
+    return false;
+  }
+
+    // remove children
+  iGeom_rmvPrntChld( geom, parent_child, ges_array[iBase_FACE], &err );
+  CHECK( "Problem removing parent child in gentityset_test." );
+
+    // get the number of child gentitysets
+  iGeom_getNumChld( geom, parent_child, 1, &num_gents, &err );
+  CHECK( "Problem getting number of children in gentityset_test." );
+
+  if (num_gents != 1) {
+    std::cerr << "number of children is not correct in gentityset_test."
+              << std::endl;
+    return false;
+  }
+
+    // parent_child and ges_array[TSTTG::EntityType_EDGE] should be related
+  int result = 0;
+  iGeom_isChildOf( geom, ges_array[iBase_EDGE], parent_child, &result, &err );
+  CHECK( "Problem checking relation in gentityset_test." );
+  if (!result) {
+    std::cerr << "parent_child and ges_array[TSTTG::EntityType_EDGE] should be related" << std::endl;
+    return false;
+  }
+
+    // ges_array[TSTTG::EntityType_FACE] and ges_array[TSTTG::REGION] are not related
+  result = 2;
+  iGeom_isChildOf( geom, ges_array[iBase_FACE], ges_array[iBase_REGION], &result, &err );
+  if (result) {
+    std::cerr << "ges_array[TSTTG::REGION] and ges_array[TSTTG::EntityType_FACE] should not be related" << std::endl;
+    return false;
+  }
+  
+
+    //--------test modify and query functions-----------------------------
+  
+    // check the number of gentity sets in whole mesh
+  SimpleArray<iBase_EntitySetHandle> gentity_sets;
+  iGeom_getEntSets( geom, root_set, 1, ARRAY_INOUT( gentity_sets ), &err );
+  CHECK( "Problem to get all gentity sets in mesh." );
+  
+  if (gentity_sets.size() != all_sets + 8) {
+    std::cerr << "the number of gentity sets in whole mesh should be 8 times of num_iter."
+              << std::endl;
+    return false;
+  }
+
+    // get all gentity sets in super set
+  SimpleArray<iBase_EntitySetHandle> ges_array1;
+  iGeom_getEntSets( geom, super_set, 1, ARRAY_INOUT( ges_array1 ), &err );
+  CHECK( "Problem to get gentity sets in super set." );
+
+    // get the number of gentity sets in super set
+  int num_super;
+  iGeom_getNumEntSets( geom, super_set, 1, &num_super, &err );
+  CHECK( "Problem to get the number of all gentity sets in super set." );
+  
+    // the number of gentity sets in super set should be same
+  if (num_super != ges_array1.size()) {
+    std::cerr << "the number of gentity sets in super set should be same." << std::endl;
+    return false;
+  }
+
+    // get all entities in super set
+  SimpleArray<iBase_EntitySetHandle> all_gentities;
+  iGeom_getEntSets( geom, super_set, 1, ARRAY_INOUT( all_gentities ), &err );
+  CHECK( "Problem to get all gentities in super set." );
+  
+    // compare the number of all gentities in super set
+  // HJK : num_hops is not implemented
+  //if (num_all_gentities_super != ARRAY_SIZE(all_gentities)) {
+  //std::cerr << "number of all gentities in super set should be same." << std::endl;
+  //success = false;
+  //}
+
+    // test add, remove and get all entitiy sets using super set
+    // check GetAllGentitysets works recursively and dosen't return
+    // multi sets
+  for (int k = 0; k < num_super; k++) {
+      // add gentity sets of super set to each gentity set of super set
+      // make multiple child super sets
+    iBase_EntitySetHandle ges_k = ges_array1[k];
+
+    for (int a = 0; a < ges_array1.size(); a++) {
+      iGeom_addEntSet( geom, ges_array1[a], ges_k, &err );
+      CHECK( "Problem to add entity set." );
+    }
+    
+      // add super set to each entity set
+    //    sidl::array<GentitysetHandle> superset_array
+    //= sidl::array<GentitysetHandle>::create1d(1);
+    //superset_array.set(0, super_set);
+    //int num_superset_array;
+    
+    iGeom_addEntSet( geom, super_set, ges_k, &err );
+    CHECK( "Problem to add super set to gentitysets." );
+
+      // add one gentity sets multiple times
+    // HJK: ??? how to deal this case?
+    //sidl::array<GentitysetHandle> temp_array1
+    //= sidl::array<GentitysetHandle>::create1d(1);
+    //int num_temp_array1;
+    //temp_array1.set(0, temp_ges1);
+
+    //for (int l = 0; l < 3; l++) {
+    iGeom_addEntSet( geom, temp_ges1, ges_k, &err );
+    CHECK( "Problem to add temp set to gentitysets." );
+      //}
+  }
+
+  return true;
+}
+  
+/*!
+ at test
+TSTTG topology adjacencies Test
+ at li Check topology information
+ at li Check adjacency
+*/
+// make each topological entity vectors, check their topology
+// types, get interior and exterior faces of model
+bool topology_adjacencies_test(iGeom_Instance geom)
+{
+  int i, err;
+  iBase_EntitySetHandle root_set;
+  iGeom_getRootSet( geom, &root_set, &err );
+  CHECK( "ERROR : getRootSet failed!" );
+
+  int top = iBase_VERTEX;
+  int num_test_top = iBase_ALL_TYPES;
+  std::vector< std::vector<iBase_EntityHandle> > gentity_vectors(num_test_top);
+
+  // fill the vectors of each topology entities
+  // like lines vector, polygon vector, triangle vector,
+  // quadrilateral, polyhedrron, tet, hex, prism, pyramid,
+  // septahedron vectors
+  for (i = top; i < num_test_top; i++) {
+    SimpleArray<iBase_EntityHandle> gentities;
+    iGeom_getEntities( geom, root_set, i, ARRAY_INOUT( gentities ), &err );
+    CHECK("Failed to get gentities in adjacencies_test.");
+  
+    gentity_vectors[i].resize( gentities.size() );
+    std::copy( gentities.begin(), gentities.end(), gentity_vectors[i].begin() );
+  }
+
+  // check number of entities for each topology
+  for (i = top; i < num_test_top; i++) {
+    int num_tops = 0;
+    iGeom_getNumOfType( geom, root_set, i, &num_tops, &err );
+    CHECK( "Failed to get number of gentities in adjacencies_test." );
+    
+    if (static_cast<int>(gentity_vectors[i].size()) != num_tops) {
+      std::cerr << "Number of gentities doesn't agree with number returned for dimension " 
+                << i << std::endl;
+      return false;
+    }
+  }
+
+  // check adjacencies in both directions
+  std::vector<iBase_EntityHandle>::iterator vit;
+  for (i = iBase_REGION; i >= iBase_VERTEX; i--) {
+    for (vit = gentity_vectors[i].begin(); vit != gentity_vectors[i].end(); vit++) {
+      iBase_EntityHandle this_gent = *vit;
+
+        // check downward adjacencies
+      for (int j = iBase_VERTEX; j < i; j++) {
+
+        SimpleArray<iBase_EntityHandle> lower_ents;
+        iGeom_getEntAdj( geom, this_gent, j, ARRAY_INOUT(lower_ents), &err );
+        CHECK( "Bi-directional adjacencies test failed." );
+
+          // for each of them, make sure they are adjacent to the upward ones
+        int num_lower = lower_ents.size();
+        for (int k = 0; k < num_lower; k++) {
+          SimpleArray<iBase_EntityHandle> upper_ents;
+          iGeom_getEntAdj( geom, lower_ents[k], i, ARRAY_INOUT(upper_ents), &err );
+          CHECK( "Bi-directional adjacencies test failed." );
+          if (std::find(upper_ents.begin(),upper_ents.end(), this_gent) ==
+              upper_ents.end()) {
+            std::cerr << "Didn't find lower-upper adjacency which was supposed to be there, dims = "
+                 << i << ", " << j << std::endl;
+            return false;
+          }
+        }
+      }
+    }
+  }
+
+  return true;
+}
+
+/*!
+ at test
+iGeom_MOAB topology adjacencies Test
+ at li Check topology information
+ at li Check adjacency
+*/
+// make each topological entity vectors, check their topology
+// types, get interior and exterior faces of model
+bool geometry_evaluation_test(iGeom_Instance geom)
+{
+  int i, err;
+  iBase_EntitySetHandle root_set;
+  iGeom_getRootSet( geom, &root_set, &err );
+  CHECK( "ERROR : getRootSet failed!" );
+
+  int top = iBase_VERTEX;
+  int num_test_top = iBase_ALL_TYPES;
+  std::vector< std::vector<iBase_EntityHandle> > gentity_vectors(num_test_top);
+
+  // fill the vectors of each topology entities
+  // like lines vector, polygon vector, triangle vector,
+  // quadrilateral, polyhedrron, tet, hex, prism, pyramid,
+  // septahedron vectors
+  for (i = top; i < num_test_top; i++) {
+    SimpleArray<iBase_EntityHandle> gentities;
+    iGeom_getEntities( geom, root_set, i, ARRAY_INOUT( gentities ), &err );
+    CHECK("Failed to get gentities in adjacencies_test.");
+  
+    gentity_vectors[i].resize( gentities.size() );
+    std::copy( gentities.begin(), gentities.end(), gentity_vectors[i].begin() );
+  }
+ 
+  // check adjacencies in both directions
+  double min[3], max[3], on[3];
+  double near[3] = {.0, .0, .0};
+  std::vector<iBase_EntityHandle>::iterator vit;
+  for (i = iBase_REGION; i >= iBase_VERTEX; i--) {
+    if (i != iBase_EDGE) {
+      for (vit = gentity_vectors[i].begin(); vit != gentity_vectors[i].end(); vit++) {
+	iBase_EntityHandle this_gent = *vit;
+	iGeom_getEntBoundBox(geom, this_gent, &min[0], &min[1], &min[2],
+			     &max[0], &max[1], &max[2], &err);
+	CHECK("Failed to get bounding box of entity.");
+	
+	iGeom_getEntClosestPt(geom, this_gent, near[0], near[1], near[2],
+			      &on[0], &on[1], &on[2], &err);
+	CHECK("Failed to get closest point on entity.");
+      }
+    }
+  }
+
+  return true;
+}
+
+/*!
+ at test
+TSTTG construct Test
+ at li Check construction of geometry
+*/
+bool construct_test(iGeom_Instance geom)
+{
+  int err;
+  iBase_EntityHandle new_body = 0;
+
+    // construct a cylinder, sweep it about an axis, and delete the result
+  iBase_EntityHandle cyl = 0;
+  iGeom_createCylinder( geom, 1.0, 1.0, 0.0, &cyl, &err );
+    // Is the minor radius really supposed to be zero??? - JK
+  CHECK( "Creating cylinder failed." );
+  
+    // move it onto the y axis
+  iGeom_moveEnt( geom, cyl, 0.0, 1.0, -0.5, &err );
+  CHECK( "Problems moving surface." );
+
+      // get the surface with max z
+  iBase_EntityHandle max_surf = 0;
+  SimpleArray<iBase_EntityHandle> surfs;
+  iGeom_getEntAdj( geom, cyl, iBase_FACE, ARRAY_INOUT(surfs), &err );
+  CHECK( "Problems getting max surf for rotation." );
+  
+  SimpleArray<double> max_corn, min_corn;
+  iGeom_getArrBoundBox( geom, ARRAY_IN(surfs), iBase_INTERLEAVED, 
+                        ARRAY_INOUT( min_corn ),
+                        ARRAY_INOUT( max_corn ),
+                        &err );
+  CHECK( "Problems getting max surf for rotation." );
+  double dtol = 1.0e-6;
+  for (int i = 0; i < surfs.size(); ++i) {
+    if ((max_corn[3*i+2]) <= dtol && (max_corn[3*i+2]) >= -dtol &&
+        (min_corn[3*i+2]) <= dtol && (min_corn[3*i+2]) >= -dtol) {
+      max_surf = surfs[i];
+      break;
+    }
+  }  
+  
+  if (0 == max_surf) {
+    std::cerr << "Couldn't find max surf for rotation." << std::endl;
+    return false;
+  }
+  
+    // sweep it around the x axis
+  iGeom_moveEnt( geom, cyl, 0.0, 1.0, 0.0, &err );
+  CHECK( "Problems moving surface." );
+
+  iGeom_sweepEntAboutAxis( geom, max_surf, 360.0, 1.0, 0.0, 0.0, &new_body, &err );
+  CHECK( "Problems sweeping surface about axis." );
+  
+    // now delete
+  iGeom_deleteEnt( geom, new_body, &err );
+  CHECK( "Problems deleting cylinder or swept surface body." );
+  
+    // if we got here, we were successful
+  return true;
+}
+
+static bool compare_box( const double* expected_min,
+                         const double* expected_max,
+                         const double* actual_min,
+                         const double* actual_max )
+{
+  bool same = true;
+  double dtol = 1.0e-6;
+  
+  for (int i = 0; i < 3; ++i)
+  {
+    if (expected_min[i] < actual_min[i] - dtol || 
+        expected_min[i]*10 >  actual_min[i] ||
+        expected_max[i] > actual_max[i] + dtol ||
+        expected_max[i]*10 < actual_max[i])  
+      same = false;
+  } 
+  return same;
+}
+
+bool primitives_test(iGeom_Instance geom) 
+{
+  int err;
+  SimpleArray<iBase_EntityHandle> prims(3);
+  iBase_EntityHandle prim;
+ 
+  iGeom_createBrick( geom, 1.0, 2.0, 3.0, &prim, &err );
+  CHECK( "createBrick failed." );
+  prims[0] = prim;
+  
+  iGeom_createCylinder( geom, 1.0, 4.0, 2.0, &prim, &err );
+  CHECK( "createCylinder failed." );
+  prims[1] = prim;
+  
+  iGeom_createTorus( geom, 2.0, 1.0, &prim, &err );
+  CHECK( "createTorus failed." );
+  prims[2] = prim;
+  
+    // verify the bounding boxes for Acis based entities
+  SimpleArray<double> max_corn, min_corn;
+  iGeom_getArrBoundBox( geom, ARRAY_IN(prims), iBase_INTERLEAVED, 
+                        ARRAY_INOUT(min_corn), ARRAY_INOUT(max_corn), &err );
+
+  double preset_min_corn[] = 
+      // min brick corner xyz
+    {-0.5, -1.0, -1.5, 
+      // min cyl corner xyz
+     -4.0, -2.0, -0.5,
+      // min torus corner xyz
+     -3.0, -3.0, -1.0
+    };
+  
+  double preset_max_corn[] = 
+      // max brick corner xyz
+    {0.5, 1.0, 1.5, 
+      // max cyl corner xyz
+     4.0, 2.0, 0.5,
+      // max torus corner xyz
+     3.0, 3.0, 1.0
+    };
+  
+  if (!compare_box( preset_min_corn, preset_max_corn,
+                    &min_corn[0], &max_corn[0] )) {
+    std::cerr << "Box check failed for brick" << std::endl;
+    return false;
+  }
+  
+  if (!compare_box( preset_min_corn+3, preset_max_corn+3,
+                    &min_corn[3], &max_corn[3] )) {
+    std::cerr << "Box check failed for cylinder" << std::endl;
+    return false;
+  }
+  
+  if (!compare_box( preset_min_corn+6, preset_max_corn+6,
+                    &min_corn[6], &max_corn[6] )) {
+    std::cerr << "Box check failed for torus" << std::endl;
+    return false;
+  }
+    // must have worked; delete the entities then return
+  for (int i = 0; i < 3; ++i) {
+    iGeom_deleteEnt( geom, prims[i], &err );
+    CHECK( "Problems deleting primitive after boolean check." );
+  }
+  
+  return true;
+}
+  
+bool transforms_test(iGeom_Instance geom) 
+{
+  int err;
+  
+    // construct a brick
+  iBase_EntityHandle brick = 0;
+  iGeom_createBrick( geom, 1.0, 2.0, 3.0, &brick, &err );
+  CHECK( "Problems creating brick for transforms test." );
+  
+    // move it, then test bounding box
+  iGeom_moveEnt( geom, brick, 0.5, 1.0, 1.5, &err );
+  CHECK( "Problems moving brick for transforms test." );
+  
+  double bb_min[3], bb_max[3];
+  iGeom_getEntBoundBox( geom, brick, bb_min, bb_min+1, bb_min+2, bb_max, bb_max+1, bb_max+2, &err );
+  CHECK( "Problems getting bounding box after move." );
+
+  double dtol = 1.0e-6;
+  if ((bb_min[0]) >= dtol || (bb_min[0]) <= -dtol || 
+      (bb_min[1]) >= dtol || (bb_min[1]) <= -dtol || 
+      (bb_min[2]) >= dtol || (bb_min[2]) <= -dtol ||
+      (bb_max[0]-1) >= dtol || 1-bb_max[0] >=dtol ||
+      (bb_max[1]-2) >= dtol || 2 - bb_max[1] >=dtol||
+      (bb_max[2]-3) >= dtol || 3 - bb_max[2] >= dtol) {
+    std::cerr << "Wrong bounding box after move." << std::endl;
+    return false;
+  }
+  
+    // now rotate it about +x, then test bounding box
+  iGeom_rotateEnt( geom, brick, 90, 1.0, 0.0, 0.0, &err );
+  CHECK( "Problems rotating brick for transforms test." );
+  
+  iGeom_getEntBoundBox( geom, brick, bb_min, bb_min+1, bb_min+2, bb_max, bb_max+1, bb_max+2, &err );
+  CHECK( "Problems getting bounding box after rotate." );
+
+  if ((bb_min[0]) >= dtol || -bb_min[0] >= dtol ||
+      (bb_min[1]+3) >= dtol || -(bb_min[1]+3) >= dtol ||
+      (bb_min[2]) >= dtol || -(bb_min[2]) >= dtol ||
+      (bb_max[0]-1) >= dtol || 1-bb_max[0] >= dtol ||
+      (bb_max[1]) >= dtol || -(bb_max[1]) >= dtol ||
+      (bb_max[2]-2) >= dtol || 2-bb_max[2] >=dtol) {
+    std::cerr << "Wrong bounding box after rotate." << std::endl;
+    return false;
+  }
+  
+    // now reflect through y plane; should recover original bb
+  iGeom_reflectEnt( geom, brick, 0.0, 1.0, 0.0, &err );
+  CHECK( "Problems reflecting brick for transforms test." );
+  
+  iGeom_getEntBoundBox( geom, brick, bb_min, bb_min+1, bb_min+2, bb_max, bb_max+1, bb_max+2, &err );
+  CHECK( "Problems getting bounding box after reflect." );
+  
+  if ((bb_min[0]) >= dtol || -(bb_min[0]) >= dtol ||(bb_min[1]) >= dtol || 
+      (bb_min[2]) >= dtol || -(bb_min[1]) >= dtol || -(bb_min[2]) >= dtol ||
+      (bb_max[0]-1) >= dtol || 1- bb_max[0] >= dtol ||
+      (bb_max[1]-3) >= dtol || 3 - bb_max[1] >= dtol ||
+      (bb_max[2]-2) >= dtol || 2 - bb_max[2] >= dtol) {
+    std::cerr << "Wrong bounding box after reflect." << std::endl;
+    return false;
+  }
+
+    // must have worked; delete the entities then return
+  iGeom_deleteEnt( geom, brick, &err );
+  CHECK( "Problems deleting brick after transforms check." );
+  return true;
+}
+
+
+bool booleans_test(iGeom_Instance geom) 
+{
+  int err;
+
+    // construct a brick size 1, and a cylinder rad 0.25 height 2
+  iBase_EntityHandle brick = 0, cyl = 0;
+  iGeom_createBrick( geom, 1.0, 0.0, 0.0, &brick, &err );
+  CHECK( "Problems creating brick for booleans test." );
+  iGeom_createCylinder( geom, 1.0, 0.25, 0.0, &cyl, &err );
+  CHECK( "Problems creating cylinder for booleans test." );
+
+    // subtract the cylinder from the brick
+  iBase_EntityHandle subtract_result = 0;
+  iGeom_subtractEnts( geom, brick, cyl, &subtract_result, &err );
+  CHECK( "Problems subtracting for booleans subtract test." );
+
+    // section the brick
+  iBase_EntityHandle section_result = 0;
+  iGeom_sectionEnt( geom, subtract_result, 1.0, 0.0, 0.0, 0.25, true, &section_result, &err );
+  CHECK( "Problems sectioning for booleans section test." );
+
+    // unite the section result with a new cylinder
+  iGeom_createCylinder( geom, 1.0, 0.25, 0.0, &cyl, &err );
+  CHECK( "Problems creating cylinder for unite test." );
+  iBase_EntityHandle unite_results;
+  iBase_EntityHandle unite_input[] = { section_result, cyl };
+  iGeom_uniteEnts( geom, unite_input, 2, &unite_results, &err );
+  CHECK( "Problems uniting for booleans unite test." );
+  
+  iGeom_deleteEnt( geom, unite_results, &err );
+  CHECK( "Problems deleting for booleans unite test." );
+  return true;
+}
+
+static int get_entities( iGeom_Instance geom, int entity_type,
+                          std::vector<iBase_EntityHandle>& entities_out,
+                          iBase_TagHandle id_tag = 0,
+                          std::vector<int>* ids_out = 0 )
+{
+  int err, num;
+  iBase_EntitySetHandle root;
+  iGeom_getRootSet( geom, &root, &err ); 
+  if (iBase_SUCCESS != err)
+    return err;
+  iGeom_getNumOfType( geom, root, entity_type, &num, &err ); 
+  if (iBase_SUCCESS != err)
+    return err;
+  
+  entities_out.resize(num);
+  int junk1 = entities_out.size(), junk2;
+  iBase_EntityHandle* junk_ptr = &entities_out[0];;
+  iGeom_getEntities( geom, root, entity_type, &junk_ptr, &junk1, &junk2, &err );
+  if (iBase_SUCCESS != err)
+    return err;
+  assert( num == junk1 && num == junk2 );
+  
+  if (!ids_out)
+    return iBase_SUCCESS;
+  
+  ids_out->resize(num);
+  int* int_ptr = &(*ids_out)[0];
+  iGeom_getIntArrData( geom, &entities_out[0], num, id_tag, &int_ptr, &junk1, &junk2, &err );
+  if (iBase_SUCCESS != err)
+    return err;
+  assert( num == junk1 && num == junk2 );
+  
+  return iBase_SUCCESS;
+}
+
+static int check_firmness( iGeom_Instance geom,
+                           const std::vector<iBase_EntityHandle>& entities,
+                           const std::vector<int>& ids,
+                           iBase_TagHandle firmness_tag,
+                           const char* expected_value,
+                           const char* ent_type_str )
+{
+  const int firmness_size = 4;
+  std::vector<char> firmness(firmness_size * entities.size());
+
+  char* byte_ptr = &firmness[0];
+  int err, junk1 = firmness.size(), junk2 = entities.size()*firmness_size;
+  iGeom_getArrData( geom, &entities[0], entities.size(), firmness_tag, &byte_ptr, &junk1, &junk2, &err ); 
+  if (iBase_SUCCESS != err)
+    return err;
+  
+  bool all_correct = true;
+  for (unsigned i = 0; i < entities.size(); ++i)
+    if (std::string(&firmness[firmness_size*i],firmness_size) != expected_value)
+      all_correct = false;
+  if (!all_correct) {
+    std::cout << "ERROR: Expected \"" << expected_value << "\" firmness "
+              << "for all " << ent_type_str << "." << std::endl;
+    std::cout << "ID  Actual  " << std::endl;
+    for (unsigned i = 0; i < entities.size(); ++i)
+      std::cout << std::setw(2) << ids[i] << "  "
+                << std::string(&firmness[firmness_size*i],firmness_size)
+                << std::endl;
+    return iBase_FAILURE;
+  }
+  
+  return iBase_SUCCESS;
+}
+
+static int count_num_with_tag( iGeom_Instance geom,
+                               const std::vector<iBase_EntityHandle>& ents,
+                               iBase_TagHandle tag )
+{
+  int err, bytes;
+  iGeom_getTagSizeBytes( geom, tag, &bytes, &err );
+  if (iBase_SUCCESS != err)
+    return -1;
+  std::vector<char> data(bytes);
+  
+  int success_count = 0;
+  for (size_t i = 0; i < ents.size(); ++i) {
+    char* ptr = &data[0];
+    int junk1 = bytes, junk2;
+    iGeom_getData( geom, ents[i], tag, &ptr, &junk1, &junk2, &err );
+    if (iBase_TAG_NOT_FOUND == err)
+      continue;
+    if (iBase_SUCCESS != err)
+      return -1;
+    ++success_count;
+  }
+  
+  return success_count;
+}
+  
+
+bool mesh_size_test(iGeom_Instance geom)
+{
+  const char* filename = STRINGIFY(SRCDIR) "/size.sat";
+  int err, junk1, junk2;
+  bool result = true;
+  
+  iGeom_deleteAll( geom, &err ); CHECK("");
+  iGeom_load( geom, filename, 0, &err, strlen(filename), 0 );
+  CHECK( "Failed to load input file: 'size.sat'" );
+  
+    // get tag handles
+  iBase_TagHandle interval, size, firmness, id;
+  iGeom_getTagHandle( geom, "MESH_INTERVAL", &interval, &err, strlen("MESH_INTERVAL") );
+  CHECK( "iGeom_getTagHandle(\"MESH_INTERVAL\")" );
+  iGeom_getTagHandle( geom, "MESH_SIZE", &size, &err, strlen("MESH_SIZE") );
+  CHECK( "iGeom_getTagHandle(\"MESH_SIZE\")" );
+  iGeom_getTagHandle( geom, "SIZE_FIRMNESS", &firmness, &err, strlen("SIZE_FIRMNESS") );
+  CHECK( "iGeom_getTagHandle(\"SIZE_FIRMNESS\")" );
+  iGeom_getTagHandle( geom, "GLOBAL_ID", &id, &err, strlen("GLOBAL_ID") );
+  CHECK( "iGeom_getTagHandle(\"GLOBAL_ID\")" );
+  
+    // get entity lists
+  std::vector<iBase_EntityHandle> verts, curves, surfs, vols;
+  std::vector<int> vert_ids, curve_ids, surf_ids, vol_ids;
+  err = get_entities( geom, iBase_VERTEX, verts,  id, &vert_ids  ); CHECK("");
+  err = get_entities( geom, iBase_EDGE,   curves, id, &curve_ids ); CHECK("");
+  err = get_entities( geom, iBase_FACE,   surfs,  id, &surf_ids  ); CHECK("");
+  err = get_entities( geom, iBase_REGION, vols,   id, &vol_ids   ); CHECK("");
+  
+    // expect interval count to be the same as ID for every curve
+  std::vector<int> intervals(curves.size());
+  int *int_ptr = &intervals[0];
+  junk1 = junk2 = curves.size();
+  iGeom_getIntArrData( geom, &curves[0], curves.size(), interval, &int_ptr, &junk1, &junk2, &err ); 
+  CHECK("Failed to get intervals for curves");
+  if (intervals != curve_ids) {
+    std::cout << "ERROR: Incorrect curve intervals for one or more curves." << std::endl;
+    std::cout << "ID  Expected  Actual" << std::endl;
+    for (unsigned i = 0; i < curves.size(); ++i)
+      std::cout << std::setw(2) << curve_ids[i] << "  "
+                << std::setw(8) << curve_ids[i] << "  "
+                << std::setw(6) << intervals[i] << std::endl;
+    result = false;
+  }
+  
+    // expect size to be the same as ID for every surface
+  std::vector<double> sizes(surfs.size());
+  double* dbl_ptr = &sizes[0];
+  junk1 = junk2 = surfs.size();
+  iGeom_getDblArrData( geom, &surfs[0], surfs.size(), size, &dbl_ptr, &junk1, &junk2, &err ); 
+  CHECK("Failed to get sizes for surfaces");
+  bool all_correct = true;
+  for (unsigned i = 0; i < surfs.size(); ++i)
+    if (fabs(sizes[i] - (double)surf_ids[i] ) > 1e-8)
+      all_correct = false;
+  if (!all_correct) {
+    std::cout << "ERROR: Incorrect mesh size for one or more surfaces." << std::endl;
+    std::cout << "ID  Expected  Actual  " << std::endl;
+    for (unsigned i = 0; i < surfs.size(); ++i)
+      std::cout << std::setw(2) << surf_ids[i] << "  "
+                << std::setw(8) << (double)surf_ids[i] << "  "
+                << std::setw(8) << sizes[i] << std::endl;
+    result = false;
+  }
+  
+  
+  err = result ? iBase_SUCCESS : iBase_FAILURE;
+  CHECK("Invalid size or interval data");
+    
+    // expect "HARD" firmness on all curves
+  err = check_firmness( geom, curves, curve_ids, firmness, "HARD", "curves" );
+  CHECK("Invalid curve firmness");
+    // expect "SOFT" firmness on all surfaces
+  err = check_firmness( geom, surfs, surf_ids, firmness, "SOFT", "surfaces" );
+  CHECK("Invalid surface firmness");
+  
+    // expect no firmnes on other entities
+  err = count_num_with_tag( geom, verts, firmness ) ? iBase_FAILURE : iBase_SUCCESS;
+  CHECK("Got firmness for vertex.");
+  err = count_num_with_tag( geom, vols, firmness ) ? iBase_FAILURE : iBase_SUCCESS;
+  CHECK("Got firmness for volume.");
+
+    // expect no interval tag on any entities except curves
+  err = count_num_with_tag( geom, verts, interval ) ? iBase_FAILURE : iBase_SUCCESS;
+  CHECK("Got interval count for vertex.");
+  err = count_num_with_tag( geom, vols, interval ) ? iBase_FAILURE : iBase_SUCCESS;
+  CHECK("Got interval count for volume.");
+
+    // expect no size tag on any entities except surfaces
+    // curves should have size of one of their parent surfaces
+  err = count_num_with_tag( geom, verts, size ) ? iBase_FAILURE : iBase_SUCCESS;
+  CHECK("Got mesh size for vertex.");
+  err = count_num_with_tag( geom, vols, size ) ? iBase_FAILURE : iBase_SUCCESS;
+  CHECK("Got mesh size for volume.");
+
+  return true;
+}
+
+bool shutdown_test(iGeom_Instance geom, std::string &engine_opt) 
+{
+  int err;
+
+    // test shutdown & startup of interface
+  iGeom_dtor(geom, &err);
+  CHECK( "Interface destruction didn't work properly." );
+  
+  iGeom_newGeom(engine_opt.c_str(), &geom, &err, engine_opt.length());
+  CHECK( "Interface re-construction didn't work properly." );
+  
+  iGeom_dtor(geom, &err);
+  CHECK( "2nd Interface destruction didn't work properly." );
+  
+  return true;
+}
+
+bool save_entset_test(iGeom_Instance geom) 
+{
+  int err;
+
+#ifdef FORCE_OCC
+  std::string filename = "testout.brep";
+#elif defined (HAVE_ACIS)
+  std::string filename = "testout.sat";
+#elif defined (HAVE_OCC)
+  std::string filename = "testout.brep";
+#else
+  std::string filename = "testout.sat";
+#endif
+
+    // initialize number of ents and sets to compare with later
+  int num_ents_bef, num_sets_bef;
+  iBase_EntitySetHandle root;
+  iGeom_getRootSet( geom, &root, &err ); 
+  CHECK("Failed to get root set.");
+  iGeom_getNumEntSets(geom, root, 1, &num_sets_bef, &err);
+  CHECK("Failed to get number of ent sets.");
+  iGeom_getNumOfType(geom, root, iBase_REGION, &num_ents_bef, &err);
+  CHECK("Failed to get number of entities.");
+
+    // create set, and entity to add to set
+  iBase_EntityHandle cyl;
+  iGeom_createCylinder( geom, 1.0, 0.25, 0.0, &cyl, &err );
+  CHECK( "Problems creating cylinder for save entset test." );
+  iBase_EntitySetHandle seth;
+  iGeom_createEntSet(geom, true, &seth, &err);
+  CHECK( "Problems creating entity set for save entset test." );
+
+    // add the entity
+  iGeom_addEntToSet(geom, cyl, seth, &err);
+  CHECK( "Problems adding entity to set for save entset test." );
+
+    // save/restore the model, and see if the entity is there
+  iGeom_save(geom, filename.c_str(), NULL, &err, filename.length(), 0);
+  CHECK( "Problems saving file for save entset test." );
+
+  iGeom_destroyEntSet(geom, seth, &err);
+  CHECK("Failed to destroy entity set.");
+  iGeom_deleteEnt(geom, cyl, &err);
+  CHECK("Failed to destroy entity.");
+  
+    // read the file back in
+  iGeom_load(geom, filename.c_str(), NULL, &err,
+             filename.length(), 0);
+  CHECK( "Problems reading file for save entset test." );
+
+    // check number of sets and entities
+  int num_ents_aft, num_sets_aft;
+  iGeom_getNumEntSets(geom, root, 1, &num_sets_aft, &err);
+  CHECK("Failed to get number of ent sets.");
+  iGeom_getNumOfType(geom, root, iBase_REGION, &num_ents_aft, &err);
+  CHECK("Failed to get number of entities.");
+  bool success = true;
+  if (num_ents_aft != 2*num_ents_bef + 1) {
+    print_error("Failed to get the right number of entities.",
+                iBase_FAILURE, geom, __FILE__, __LINE__);
+    success = false;
+  }
+  else if (num_sets_aft != 2*num_sets_bef + 1) {
+    print_error("Failed to get the right number of entity sets.",
+                iBase_FAILURE, geom, __FILE__, __LINE__);
+    success = false;
+  }
+
+    // otherwise, we succeeded
+  return success;
+}
+



More information about the moab-dev mailing list