[cgma-dev] r2617 - cgm/trunk/itaps
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Fri Jan 30 19:26:13 CST 2009
Author: kraftche
Date: 2009-01-30 19:26:13 -0600 (Fri, 30 Jan 2009)
New Revision: 2617
Modified:
cgm/trunk/itaps/CGMAIterator.hpp
cgm/trunk/itaps/iGeom.h
cgm/trunk/itaps/iGeom_CGMA.cc
cgm/trunk/itaps/testgeom.cc
Log:
o Add has_data argument to iGeom_getNextEntArrIter for consistency with iMesh
o For modify methods that do not change the handle value, pass handle
by copy rather than reference.
o Add iMesh_isEntArrContained for consistency with iMesh
Modified: cgm/trunk/itaps/CGMAIterator.hpp
===================================================================
--- cgm/trunk/itaps/CGMAIterator.hpp 2009-01-30 23:48:25 UTC (rev 2616)
+++ cgm/trunk/itaps/CGMAIterator.hpp 2009-01-31 01:26:13 UTC (rev 2617)
@@ -78,6 +78,9 @@
* nor the remaining number of entities.
*/
int size() const { return mSize; }
+
+ bool at_end() const
+ { return mIter == mArray.end(); }
private:
Modified: cgm/trunk/itaps/iGeom.h
===================================================================
--- cgm/trunk/itaps/iGeom.h 2009-01-30 23:48:25 UTC (rev 2616)
+++ cgm/trunk/itaps/iGeom.h 2009-01-31 01:26:13 UTC (rev 2617)
@@ -1999,6 +1999,7 @@
iBase_EntityHandle** entity_handles,
int* entity_handles_allocated,
int* entity_handles_size,
+ int* has_data,
int* err );
/**\brief Reset the iterator
@@ -2125,7 +2126,7 @@
*
*/
void iGeom_moveEnt( iGeom_Instance,
- iBase_EntityHandle* geom_entity,
+ iBase_EntityHandle geom_entity,
double x,
double y,
double z,
@@ -2135,7 +2136,7 @@
*
*/
void iGeom_rotateEnt( iGeom_Instance,
- iBase_EntityHandle* geom_entity,
+ iBase_EntityHandle geom_entity,
double angle,
double axis_normal_x,
double axis_normal_y,
@@ -2146,7 +2147,7 @@
*
*/
void iGeom_reflectEnt( iGeom_Instance,
- iBase_EntityHandle* geom_entity,
+ iBase_EntityHandle geom_entity,
double plane_normal_x,
double plane_normal_y,
double plane_normal_z,
@@ -2156,7 +2157,7 @@
*
*/
void iGeom_scaleEnt( iGeom_Instance,
- iBase_EntityHandle* geom_entity,
+ iBase_EntityHandle geom_entity,
double scale_x,
double scale_y,
double scale_z,
@@ -2192,7 +2193,7 @@
*
*/
void iGeom_sectionEnt( iGeom_Instance,
- iBase_EntityHandle* geom_entity,
+ iBase_EntityHandle geom_entity,
double plane_normal_x,
double plane_normal_y,
double plane_normal_z,
@@ -2411,6 +2412,25 @@
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
Modified: cgm/trunk/itaps/iGeom_CGMA.cc
===================================================================
--- cgm/trunk/itaps/iGeom_CGMA.cc 2009-01-30 23:48:25 UTC (rev 2616)
+++ cgm/trunk/itaps/iGeom_CGMA.cc 2009-01-31 01:26:13 UTC (rev 2617)
@@ -235,8 +235,6 @@
extern "C" {
-static bool cgm_initialized = false;
-
void iGeom_getDescription( iGeom_Instance geom,
char* descr,
int* err,
@@ -525,12 +523,14 @@
/*inout*/ iBase_EntityHandle **entity_handles,
int *entity_handles_allocated,
int *entity_handles_size,
+ int* has_data,
int* err
)
{
CGMAIterator* iterator = reinterpret_cast<CGMAIterator*>(entArr_iterator);
CHECK_SIZE(*entity_handles, iBase_EntityHandle, iterator->size());
iterator->next( (RefEntity**)*entity_handles, *entity_handles_size );
+ *has_data = iterator->at_end();
}
@@ -3645,6 +3645,26 @@
RETURN(iBase_SUCCESS);
}
+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 )
+{
+ // go through each entity and look up its dimension
+ CHECK_SIZE(*is_contained, int, num_entity_handles);
+ *is_contained_size = num_entity_handles;
+
+ *err = iBase_SUCCESS;
+ for (int i = 0; i < num_entity_handles && iBase_SUCCESS == *err; ++i)
+ iGeom_isEntContained( instance, containing_set, entity_handles[i], (*is_contained)+i, err );
+
+ RETURN(*err);
+}
+
void
iGeom_isEntSetContained (iGeom_Instance instance,
/*in*/ iBase_EntitySetHandle containing_entity_set,
@@ -5293,14 +5313,14 @@
void
iGeom_moveEnt (iGeom_Instance instance,
- /*inout*/ iBase_EntityHandle *geom_entity,
+ /*inout*/ iBase_EntityHandle geom_entity,
/*in*/ double x,
/*in*/ double y,
/*in*/ double z,
int* err)
{
CubitVector vec(x, y, z);
- Body *this_bod = dynamic_cast<Body*>(ENTITY_HANDLE(*geom_entity));
+ Body *this_bod = dynamic_cast<Body*>(ENTITY_HANDLE(geom_entity));
CubitStatus result;
if (NULL != this_bod) {
result = gqt->translate(this_bod, vec);
@@ -5312,7 +5332,7 @@
RETURN(iBase_SUCCESS);
}
- BasicTopologyEntity *this_bte = dynamic_cast<BasicTopologyEntity*>(ENTITY_HANDLE(*geom_entity));
+ BasicTopologyEntity *this_bte = dynamic_cast<BasicTopologyEntity*>(ENTITY_HANDLE(geom_entity));
if (NULL != this_bte) {
// non-body move; check to see if there are any siblings to this entity in the
// same body; if so, we can't move it; if not, get the body and move that; if
@@ -5352,7 +5372,7 @@
void
iGeom_rotateEnt (iGeom_Instance instance,
- /*inout*/ iBase_EntityHandle *geom_entity,
+ /*inout*/ iBase_EntityHandle geom_entity,
/*in*/ double angle,
/*in*/ double axis_normal_x,
/*in*/ double axis_normal_y,
@@ -5360,7 +5380,7 @@
int* err)
{
CubitVector this_axis(axis_normal_x, axis_normal_y, axis_normal_z);
- Body *this_bod = dynamic_cast<Body*>(ENTITY_HANDLE(*geom_entity));
+ Body *this_bod = dynamic_cast<Body*>(ENTITY_HANDLE(geom_entity));
CubitStatus result;
if (NULL != this_bod) {
result = gqt->rotate(this_bod, this_axis, angle);
@@ -5371,7 +5391,7 @@
RETURN(iBase_SUCCESS);
}
- BasicTopologyEntity *this_bte = dynamic_cast<BasicTopologyEntity*>(ENTITY_HANDLE(*geom_entity));
+ BasicTopologyEntity *this_bte = dynamic_cast<BasicTopologyEntity*>(ENTITY_HANDLE(geom_entity));
if (NULL != this_bte) {
result = gqt->rotate(this_bte, this_axis, angle);
if (CUBIT_SUCCESS != result) {
@@ -5386,14 +5406,14 @@
void
iGeom_reflectEnt (iGeom_Instance instance,
- /*inout*/ iBase_EntityHandle *geom_entity,
+ /*inout*/ iBase_EntityHandle geom_entity,
/*in*/ double plane_normal_x,
/*in*/ double plane_normal_y,
/*in*/ double plane_normal_z,
int* err)
{
CubitVector this_plane(plane_normal_x, plane_normal_y, plane_normal_z);
- Body *this_bod = dynamic_cast<Body*>(ENTITY_HANDLE(*geom_entity));
+ Body *this_bod = dynamic_cast<Body*>(ENTITY_HANDLE(geom_entity));
DLIList<Body*> bods;
bods.append(this_bod);
CubitStatus result;
@@ -5406,7 +5426,7 @@
RETURN(iBase_SUCCESS);
}
- BasicTopologyEntity *this_bte = dynamic_cast<BasicTopologyEntity*>(ENTITY_HANDLE(*geom_entity));
+ BasicTopologyEntity *this_bte = dynamic_cast<BasicTopologyEntity*>(ENTITY_HANDLE(geom_entity));
if (NULL != this_bte) {
result = gqt->reflect(this_bte, this_plane);
if (CUBIT_SUCCESS != result) {
@@ -5421,14 +5441,14 @@
void
iGeom_scaleEnt (iGeom_Instance instance,
- /*inout*/ iBase_EntityHandle *geom_entity,
+ /*inout*/ iBase_EntityHandle geom_entity,
/*in*/ double scale_x,
/*in*/ double scale_y,
/*in*/ double scale_z,
int* err)
{
CubitVector factor(scale_x, scale_y, scale_z);
- Body *this_bod = dynamic_cast<Body*>(ENTITY_HANDLE(*geom_entity));
+ Body *this_bod = dynamic_cast<Body*>(ENTITY_HANDLE(geom_entity));
CubitStatus result;
if (NULL != this_bod) {
result = gqt->scale(this_bod, factor);
@@ -5439,7 +5459,7 @@
RETURN(iBase_SUCCESS);
}
- BasicTopologyEntity *this_bte = dynamic_cast<BasicTopologyEntity*>(ENTITY_HANDLE(*geom_entity));
+ BasicTopologyEntity *this_bte = dynamic_cast<BasicTopologyEntity*>(ENTITY_HANDLE(geom_entity));
// non-body move; check to see if there are any siblings to this entity in the
// same body; if so, we can't move it; if not, get the body and move that; if
// there is no body, it's a free entity and we can move it anyway
@@ -5595,7 +5615,7 @@
void
iGeom_sectionEnt (iGeom_Instance instance,
- /*inout*/ iBase_EntityHandle *geom_entity,
+ /*inout*/ iBase_EntityHandle geom_entity,
/*in*/ double plane_normal_x,
/*in*/ double plane_normal_y,
/*in*/ double plane_normal_z,
@@ -5604,9 +5624,9 @@
/*out*/ iBase_EntityHandle *geom_entity2,
int* err)
{
- Body *this_body = dynamic_cast<Body*>(ENTITY_HANDLE(*geom_entity));
+ Body *this_body = dynamic_cast<Body*>(ENTITY_HANDLE(geom_entity));
if (NULL == this_body) {
- RefVolume *this_vol = dynamic_cast<RefVolume*>(ENTITY_HANDLE(*geom_entity));
+ RefVolume *this_vol = dynamic_cast<RefVolume*>(ENTITY_HANDLE(geom_entity));
if (NULL != this_vol)
this_body = this_vol->get_body_ptr();
}
Modified: cgm/trunk/itaps/testgeom.cc
===================================================================
--- cgm/trunk/itaps/testgeom.cc 2009-01-30 23:48:25 UTC (rev 2616)
+++ cgm/trunk/itaps/testgeom.cc 2009-01-31 01:26:13 UTC (rev 2617)
@@ -935,7 +935,7 @@
CHECK( "Creating cylinder failed." );
// move it onto the y axis
- iGeom_moveEnt( geom, &cyl, 0.0, 1.0, -0.5, &err );
+ iGeom_moveEnt( geom, cyl, 0.0, 1.0, -0.5, &err );
CHECK( "Problems moving surface." );
// get the surface with max z
@@ -966,7 +966,7 @@
}
// sweep it around the x axis
- iGeom_moveEnt( geom, &cyl, 0.0, 1.0, 0.0, &err );
+ 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 );
@@ -1076,7 +1076,7 @@
CHECK( "Problems creating brick for transforms test." );
// move it, then test bounding box
- iGeom_moveEnt( geom, &brick, 0.5, 1.0, 1.5, &err );
+ 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];
@@ -1095,7 +1095,7 @@
}
// now rotate it about +x, then test bounding box
- iGeom_rotateEnt( geom, &brick, 90, 1.0, 0.0, 0.0, &err );
+ 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 );
@@ -1112,7 +1112,7 @@
}
// now reflect through y plane; should recover original bb
- iGeom_reflectEnt( geom, &brick, 0.0, 1.0, 0.0, &err );
+ 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 );
@@ -1152,7 +1152,7 @@
// section the brick
iBase_EntityHandle section_result = 0;
- iGeom_sectionEnt( geom, &subtract_result, 1.0, 0.0, 0.0, 0.25, true, §ion_result, &err );
+ iGeom_sectionEnt( geom, subtract_result, 1.0, 0.0, 0.0, 0.25, true, §ion_result, &err );
CHECK( "Problems sectioning for booleans section test." );
// unite the section result with a new cylinder
More information about the cgma-dev
mailing list