[MOAB-dev] r3141 - MOAB/branches/python/tools/iMesh/python
jvporter at wisc.edu
jvporter at wisc.edu
Tue Sep 15 14:08:23 CDT 2009
Author: jvporter
Date: 2009-09-15 14:08:23 -0500 (Tue, 15 Sep 2009)
New Revision: 3141
Modified:
MOAB/branches/python/tools/iMesh/python/iMesh.c
MOAB/branches/python/tools/iMesh/python/iMesh_Python.h
MOAB/branches/python/tools/iMesh/python/iMesh_entSet.inl
MOAB/branches/python/tools/iMesh/python/iMesh_iter.inl
MOAB/branches/python/tools/iMesh/python/iMesh_tag.inl
MOAB/branches/python/tools/iMesh/python/setup.py
Log:
* Adjust internal naming scheme for PyTAPS to simplify addition
of iGeom interface
* Unglue setup.py from autotools
* Add support for alternate iXxx-Defs.inc files (e.g. iGeom)
Modified: MOAB/branches/python/tools/iMesh/python/iMesh.c
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iMesh.c 2009-09-15 16:57:33 UTC (rev 3140)
+++ MOAB/branches/python/tools/iMesh/python/iMesh.c 2009-09-15 19:08:23 UTC (rev 3141)
@@ -14,10 +14,7 @@
static PyTypeObject iMeshTag_Type;
static int NPY_IMESHTAG;
-static iMeshEntitySet_Object * iMeshEntitySet_New(iMesh_Object *mesh);
-static iMeshTag_Object * iMeshTag_New(iMesh_Object *mesh);
-
/* TODO: these are never freed! */
static PyObject *g_helper_module;
static PyObject *g_adj_list;
@@ -73,20 +70,20 @@
}
static iMeshEntitySet_Object *
-iMeshEntitySet_New(iMesh_Object *mesh)
+iMeshEntitySet_New(iMesh_Object *instance)
{
iMeshEntitySet_Object *o = iMeshEntitySet_NewRaw();
- o->mesh = mesh;
- Py_INCREF(o->mesh);
+ o->instance = instance;
+ Py_INCREF(o->instance);
return o;
}
static iMeshTag_Object *
-iMeshTag_New(iMesh_Object *mesh)
+iMeshTag_New(iMesh_Object *instance)
{
iMeshTag_Object *o = iMeshTag_NewRaw();
- o->mesh = mesh;
- Py_INCREF(o->mesh);
+ o->instance = instance;
+ Py_INCREF(o->instance);
return o;
}
@@ -100,8 +97,8 @@
return -1;
int err;
- iMesh_newMesh(options,&self->mesh,&err,strlen(options));
- if(checkError(self->mesh,err))
+ iMesh_newMesh(options,&self->handle,&err,strlen(options));
+ if(checkError(self->handle,err))
return -1;
return 0;
}
@@ -109,10 +106,10 @@
static void
iMeshObj_dealloc(iMesh_Object *self)
{
- if(self->mesh)
+ if(self->handle)
{
int err;
- iMesh_dtor(self->mesh,&err);
+ iMesh_dtor(self->handle,&err);
}
self->ob_type->tp_free((PyObject*)self);
}
@@ -123,8 +120,8 @@
iMeshEntitySet_Object *rootset = iMeshEntitySet_New(self);
int err;
- iMesh_getRootSet(self->mesh,&rootset->set.handle,&err);
- if(checkError(self->mesh,err))
+ iMesh_getRootSet(self->handle,&rootset->base.handle,&err);
+ if(checkError(self->handle,err))
{
Py_DECREF((PyObject*)rootset);
return NULL;
@@ -138,8 +135,8 @@
iMeshObj_getGeometricDimension(iMesh_Object *self,void *closure)
{
int dim,err;
- iMesh_getGeometricDimension(self->mesh,&dim,&err);
- if(checkError(self->mesh,err))
+ iMesh_getGeometricDimension(self->handle,&dim,&err);
+ if(checkError(self->handle,err))
return NULL;
return Py_BuildValue("i",dim);
@@ -158,8 +155,8 @@
int dim,err;
if(!PyArg_Parse(value,"i",&dim))
return -1;
- iMesh_setGeometricDimension(self->mesh,dim,&err);
- if(checkError(self->mesh,err))
+ iMesh_setGeometricDimension(self->handle,dim,&err);
+ if(checkError(self->handle,err))
return -1;
return 0;
@@ -169,8 +166,8 @@
iMeshObj_getDfltStorage(iMesh_Object *self,void *closure)
{
int order,err;
- iMesh_getDfltStorage(self->mesh,&order,&err);
- if(checkError(self->mesh,err))
+ iMesh_getDfltStorage(self->handle,&order,&err);
+ if(checkError(self->handle,err))
return NULL;
return Py_BuildValue("i",order);
@@ -182,8 +179,8 @@
int *adjtable=0;
int alloc=0,size,err;
- iMesh_getAdjTable(self->mesh,&adjtable,&alloc,&size,&err);
- if(checkError(self->mesh,err))
+ iMesh_getAdjTable(self->handle,&adjtable,&alloc,&size,&err);
+ if(checkError(self->handle,err))
return NULL;
npy_intp dims[] = {4,4};
@@ -197,8 +194,8 @@
if(!PyArg_ParseTuple(args,"i",&doReset))
return NULL;
- iMesh_areEHValid(self->mesh,doReset,&areInv,&err);
- if(checkError(self->mesh,err))
+ iMesh_areEHValid(self->handle,doReset,&areInv,&err);
+ if(checkError(self->handle,err))
return NULL;
return Py_BuildValue("i",areInv);
@@ -230,11 +227,11 @@
size = PyArray_SIZE(ents);
iBase_EntityHandle *data = PyArray_DATA(ents);
- iMesh_getVtxArrCoords(self->mesh,data,size,storage_order,&coords,
+ iMesh_getVtxArrCoords(self->handle,data,size,storage_order,&coords,
&coords_alloc,&coords_size,&err);
Py_DECREF(ents);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp outer;
@@ -249,9 +246,9 @@
else if(iBaseEntity_Check(obj))
{
double *v = malloc(3*sizeof(double));
- iMesh_getVtxCoord(self->mesh,iBaseEntity_GetHandle(obj), v+0,v+1,v+2,
+ iMesh_getVtxCoord(self->handle,iBaseEntity_GetHandle(obj), v+0,v+1,v+2,
&err);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp dims[] = {3};
@@ -284,10 +281,10 @@
size = PyArray_SIZE(ents);
data = PyArray_DATA(ents);
- iMesh_getEntArrTopo(self->mesh,data,size,&topos,&topo_alloc,&topo_size,
+ iMesh_getEntArrTopo(self->handle,data,size,&topos,&topo_alloc,&topo_size,
&err);
Py_DECREF(ents);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp dims[] = {topo_size};
@@ -298,8 +295,8 @@
int topo;
iBase_EntityHandle handle = ((iBaseEntity_Object*)obj)->handle;
- iMesh_getEntTopo(self->mesh,handle,&topo,&err);
- if(checkError(self->mesh,err))
+ iMesh_getEntTopo(self->handle,handle,&topo,&err);
+ if(checkError(self->handle,err))
return NULL;
return PyInt_FromLong(topo);
@@ -331,10 +328,10 @@
size = PyArray_SIZE(ents);
data = PyArray_DATA(ents);
- iMesh_getEntArrType(self->mesh,data,size,&types,&type_alloc,&type_size,
+ iMesh_getEntArrType(self->handle,data,size,&types,&type_alloc,&type_size,
&err);
Py_DECREF(ents);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp dims[] = {type_size};
@@ -344,8 +341,8 @@
{
int type;
iBase_EntityHandle handle = ((iBaseEntity_Object*)obj)->handle;
- iMesh_getEntType(self->mesh,handle,&type,&err);
- if(checkError(self->mesh,err))
+ iMesh_getEntType(self->handle,handle,&type,&err);
+ if(checkError(self->handle,err))
return NULL;
return PyInt_FromLong(type);
@@ -380,11 +377,11 @@
size = PyArray_SIZE(ents);
data = PyArray_DATA(ents);
- iMesh_getEntArrAdj(self->mesh,data,size,type_req,&adj,&adj_alloc,
+ iMesh_getEntArrAdj(self->handle,data,size,type_req,&adj,&adj_alloc,
&adj_size,&offsets,&offsets_alloc,&offsets_size,
&err);
Py_DECREF(ents);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp adj_dims[] = {adj_size};
@@ -413,9 +410,9 @@
int adj_alloc=0,adj_size;
iBase_EntityHandle handle = iBaseEntity_GetHandle(obj);
- iMesh_getEntAdj(self->mesh,handle,type_req,&adj,&adj_alloc,&adj_size,
+ iMesh_getEntAdj(self->handle,handle,type_req,&adj,&adj_alloc,&adj_size,
&err);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp dims[] = {adj_size};
@@ -451,11 +448,11 @@
size = PyArray_SIZE(ents);
data = PyArray_DATA(ents);
- iMesh_getEntArr2ndAdj(self->mesh,data,size,bridge_type,type_req,&adj,
+ iMesh_getEntArr2ndAdj(self->handle,data,size,bridge_type,type_req,&adj,
&adj_alloc,&adj_size,&offsets,&offsets_alloc,
&offsets_size,&err);
Py_DECREF(ents);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp adj_dims[] = {adj_size};
@@ -484,9 +481,9 @@
int adj_alloc=0,adj_size;
iBase_EntityHandle handle = iBaseEntity_GetHandle(obj);
- iMesh_getEnt2ndAdj(self->mesh,handle,bridge_type,type_req,&adj,
+ iMesh_getEnt2ndAdj(self->handle,handle,bridge_type,type_req,&adj,
&adj_alloc,&adj_size,&err);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp dims[] = {adj_size};
@@ -513,8 +510,8 @@
isList = (obj == Py_True);
- iMesh_createEntSet(self->mesh,isList,&set->set.handle,&err);
- if(checkError(self->mesh,err))
+ iMesh_createEntSet(self->handle,isList,&set->base.handle,&err);
+ if(checkError(self->handle,err))
{
Py_DECREF((PyObject*)set);
return NULL;
@@ -532,8 +529,8 @@
if(!PyArg_ParseTuple(args,"O!",&iBaseEntitySet_Type,&set))
return NULL;
- iMesh_destroyEntSet(self->mesh,set->handle,&err);
- if(checkError(self->mesh,err))
+ iMesh_destroyEntSet(self->handle,set->handle,&err);
+ if(checkError(self->handle,err))
return NULL;
Py_RETURN_NONE;
@@ -570,7 +567,7 @@
int coord_size = PyArray_SIZE(verts);
double *coords = PyArray_DATA(verts);
- iMesh_setVtxArrCoords(self->mesh,entities,ent_size,storage_order,
+ iMesh_setVtxArrCoords(self->handle,entities,ent_size,storage_order,
coords,coord_size,&err);
Py_DECREF(ents);
Py_DECREF(verts);
@@ -590,7 +587,7 @@
double *v = PyArray_DATA(verts);
iBase_EntityHandle entity = iBaseEntity_GetHandle(obj);
- iMesh_setVtxCoord(self->mesh,entity, v[0],v[1],v[2], &err);
+ iMesh_setVtxCoord(self->handle,entity, v[0],v[1],v[2], &err);
Py_DECREF(verts);
}
else
@@ -599,7 +596,7 @@
return NULL;
}
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
Py_RETURN_NONE;
@@ -636,10 +633,10 @@
iBase_EntityHandle *entities=0;
int ent_alloc=0,ent_size;
- iMesh_createVtxArr(self->mesh,count,storage_order,coords,coord_size,
+ iMesh_createVtxArr(self->handle,count,storage_order,coords,coord_size,
&entities,&ent_alloc,&ent_size,&err);
Py_DECREF(vertices);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
npy_intp dims[] = {ent_size};
@@ -657,10 +654,10 @@
double *v = PyArray_DATA(vertices);
iBaseEntity_Object *entity = iBaseEntity_New();
- iMesh_createVtx(self->mesh, v[0],v[1],v[2], &entity->handle,&err);
+ iMesh_createVtx(self->handle, v[0],v[1],v[2], &entity->handle,&err);
Py_DECREF(vertices);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
{
Py_DECREF((PyObject*)entity);
return NULL;
@@ -692,10 +689,10 @@
iBaseEntity_Object *entity = iBaseEntity_New();
- iMesh_createEnt(self->mesh,topo,lower,lower_size,&entity->handle,&status,
+ iMesh_createEnt(self->handle,topo,lower,lower_size,&entity->handle,&status,
&err);
Py_DECREF(ents);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
{
Py_DECREF((PyObject*)entity);
return NULL;
@@ -728,10 +725,10 @@
int *status;
int stat_alloc=0,stat_size;
- iMesh_createEntArr(self->mesh,topo,lower,lower_size,&entities,&ent_alloc,
+ iMesh_createEntArr(self->handle,topo,lower,lower_size,&entities,&ent_alloc,
&ent_size,&status,&stat_alloc,&stat_size,&err);
Py_DECREF(ents);
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
PyObject *pair = PyTuple_New(2);
@@ -763,13 +760,13 @@
{
int size = PyArray_SIZE(ents);
iBase_EntityHandle *entities = PyArray_DATA(ents);
- iMesh_deleteEntArr(self->mesh,entities,size,&err);
+ iMesh_deleteEntArr(self->handle,entities,size,&err);
Py_DECREF(ents);
}
else if(iBaseEntity_Check(obj))
{
iBase_EntityHandle entity = iBaseEntity_GetHandle(obj);
- iMesh_deleteEnt(self->mesh,entity,&err);
+ iMesh_deleteEnt(self->handle,entity,&err);
}
else
{
@@ -777,7 +774,7 @@
return NULL;
}
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
return NULL;
Py_RETURN_NONE;
}
@@ -803,9 +800,9 @@
tag = iMeshTag_New(self);
- iMesh_createTag(self->mesh,name,size,type,&tag->tag.handle,&err,
+ iMesh_createTag(self->handle,name,size,type,&tag->base.handle,&err,
strlen(name));
- if(checkError(self->mesh,err))
+ if(checkError(self->handle,err))
{
Py_DECREF((PyObject*)tag);
return NULL;
@@ -826,8 +823,8 @@
forced = (obj == Py_True);
- iMesh_destroyTag(self->mesh,tag->handle,forced,&err);
- if(checkError(self->mesh,err))
+ iMesh_destroyTag(self->handle,tag->handle,forced,&err);
+ if(checkError(self->handle,err))
return NULL;
Py_RETURN_NONE;
@@ -845,8 +842,8 @@
tag = iMeshTag_New(self);
- iMesh_getTagHandle(self->mesh,name,&tag->tag.handle,&err,strlen(name));
- if(checkError(self->mesh,err))
+ iMesh_getTagHandle(self->handle,name,&tag->base.handle,&err,strlen(name));
+ if(checkError(self->handle,err))
{
Py_DECREF((PyObject*)tag);
return NULL;
@@ -870,16 +867,16 @@
{
iBase_EntitySetHandle set = iBaseEntitySet_GetHandle(ents);
- iMesh_getAllEntSetTags(self->mesh,set,&tags,&alloc,&size,&err);
- if(checkError(self->mesh,err))
+ iMesh_getAllEntSetTags(self->handle,set,&tags,&alloc,&size,&err);
+ if(checkError(self->handle,err))
return NULL;
}
else if(iBaseEntity_Check(ents))
{
iBase_EntityHandle entity = iBaseEntity_GetHandle(ents);
- iMesh_getAllTags(self->mesh,entity,&tags,&alloc,&size,&err);
- if(checkError(self->mesh,err))
+ iMesh_getAllTags(self->handle,entity,&tags,&alloc,&size,&err);
+ if(checkError(self->handle,err))
return NULL;
}
else
@@ -894,7 +891,7 @@
}
-static PyMethodDef iMesh_methods[] = {
+static PyMethodDef iMeshObj_methods[] = {
{ "areEHValid", (PyCFunction)iMeshObj_areEHValid, METH_VARARGS,
"Return whether entity handles have changed since last reset or since "
"instance construction"
@@ -951,7 +948,7 @@
{0}
};
-static PyGetSetDef iMesh_getset[] = {
+static PyGetSetDef iMeshObj_getset[] = {
{ "rootSet", (getter)iMeshObj_getRootSet, 0,
"root set", 0
},
@@ -1017,9 +1014,9 @@
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
- iMesh_methods, /* tp_methods */
+ iMeshObj_methods, /* tp_methods */
0, /* tp_members */
- iMesh_getset, /* tp_getset */
+ iMeshObj_getset, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
@@ -1039,10 +1036,10 @@
iMeshEntSetArr_getitem(void *data,void *arr)
{
ArrDealloc_Object *b = (ArrDealloc_Object*)PyArray_BASE(arr);
- iMesh_Object *mesh = (iMesh_Object*)b->base;
- iMeshEntitySet_Object *o = iMeshEntitySet_New(mesh);
+ iMesh_Object *instance = (iMesh_Object*)b->base;
+ iMeshEntitySet_Object *o = iMeshEntitySet_New(instance);
- o->set.handle = *(iBase_EntitySetHandle*)data;
+ o->base.handle = *(iBase_EntitySetHandle*)data;
return (PyObject*)o;
}
@@ -1051,10 +1048,10 @@
iMeshTagArr_getitem(void *data,void *arr)
{
ArrDealloc_Object *b = (ArrDealloc_Object*)PyArray_BASE(arr);
- iMesh_Object *mesh = (iMesh_Object*)b->base;
- iMeshTag_Object *o = iMeshTag_New(mesh);
+ iMesh_Object *instance = (iMesh_Object*)b->base;
+ iMeshTag_Object *o = iMeshTag_New(instance);
- o->tag.handle = *(iBase_TagHandle*)data;
+ o->base.handle = *(iBase_TagHandle*)data;
return (PyObject*)o;
}
Modified: MOAB/branches/python/tools/iMesh/python/iMesh_Python.h
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iMesh_Python.h 2009-09-15 16:57:33 UTC (rev 3140)
+++ MOAB/branches/python/tools/iMesh/python/iMesh_Python.h 2009-09-15 19:08:23 UTC (rev 3141)
@@ -12,13 +12,13 @@
typedef struct
{
PyObject_HEAD
- iMesh_Instance mesh;
+ iMesh_Instance handle;
} iMesh_Object;
typedef struct
{
PyObject_HEAD
- iMesh_Object *mesh;
+ iMesh_Object *instance;
int is_arr;
union
{
@@ -29,8 +29,8 @@
typedef struct
{
- iBaseEntitySet_Object set;
- iMesh_Object *mesh;
+ iBaseEntitySet_Object base;
+ iMesh_Object *instance;
} iMeshEntitySet_Object;
#define iMeshEntitySet_NewRaw() \
@@ -41,12 +41,12 @@
PyObject_TypeCheck((o),&iMeshEntitySet_Type)
#define iMeshEntitySet_GetMesh(o) \
- ( ((iMeshEntitySet_Object*)(o))->mesh )
+ ( ((iMeshEntitySet_Object*)(o))->instance )
typedef struct
{
- iBaseTag_Object tag;
- iMesh_Object *mesh;
+ iBaseTag_Object base;
+ iMesh_Object *instance;
} iMeshTag_Object;
#define iMeshTag_NewRaw() \
@@ -57,7 +57,7 @@
PyObject_TypeCheck((o),&iMeshTag_Type)
#define iMeshTag_GetMesh(o) \
- ( ((iMeshTag_Object*)(o))->mesh )
+ ( ((iMeshTag_Object*)(o))->instance )
#ifndef _IMESH_MODULE
Modified: MOAB/branches/python/tools/iMesh/python/iMesh_entSet.inl
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iMesh_entSet.inl 2009-09-15 16:57:33 UTC (rev 3140)
+++ MOAB/branches/python/tools/iMesh/python/iMesh_entSet.inl 2009-09-15 19:08:23 UTC (rev 3141)
@@ -6,7 +6,7 @@
static void
iMeshEntSetObj_dealloc(iMeshEntitySet_Object *self)
{
- Py_XDECREF(self->mesh);
+ Py_XDECREF(self->instance);
((PyObject*)self)->ob_type->tp_free((PyObject*)self);
}
@@ -19,9 +19,9 @@
return NULL;
int err;
- iMesh_load(self->mesh->mesh,self->set.handle,name,options,&err,strlen(name),
- strlen(options));
- if(checkError(self->mesh->mesh,err))
+ iMesh_load(self->instance->handle,self->base.handle,name,options,&err,
+ strlen(name),strlen(options));
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
@@ -36,9 +36,9 @@
return NULL;
int err;
- iMesh_save(self->mesh->mesh,self->set.handle,name,options,&err,strlen(name),
- strlen(options));
- if(checkError(self->mesh->mesh,err))
+ iMesh_save(self->instance->handle,self->base.handle,name,options,&err,
+ strlen(name),strlen(options));
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
@@ -52,8 +52,8 @@
if(!PyArg_ParseTuple(args,"i",&type))
return NULL;
- iMesh_getNumOfType(self->mesh->mesh,self->set.handle,type,&num,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getNumOfType(self->instance->handle,self->base.handle,type,&num,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",num);
@@ -67,8 +67,8 @@
if(!PyArg_ParseTuple(args,"i",&topo))
return NULL;
- iMesh_getNumOfTopo(self->mesh->mesh,self->set.handle,topo,&num,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getNumOfTopo(self->instance->handle,self->base.handle,topo,&num,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",num);
@@ -85,9 +85,9 @@
if(!PyArg_ParseTuple(args,"ii",&type,&topo))
return NULL;
- iMesh_getEntities(self->mesh->mesh,self->set.handle,type,topo,&entities,
- &alloc,&size,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getEntities(self->instance->handle,self->base.handle,type,topo,
+ &entities,&alloc,&size,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
npy_intp dims[] = {size};
@@ -113,14 +113,14 @@
int *offsets=0;
int off_alloc=0,off_size;
- iMesh_getAdjEntIndices(self->mesh->mesh,self->set.handle,type_requestor,
- topo_requestor,type_requested,
+ iMesh_getAdjEntIndices(self->instance->handle,self->base.handle,
+ type_requestor,topo_requestor,type_requested,
&entities,&ent_alloc,&ent_size,
&adj_ents,&adj_alloc,&adj_size,
&indices, &ind_alloc,&ind_size,
&offsets, &off_alloc,&off_size,
&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
npy_intp ent_dims[] = {ent_size};
@@ -139,8 +139,8 @@
iMeshEntSetObj_isList(iMeshEntitySet_Object *self,void *closure)
{
int is_list,err;
- iMesh_isList(self->mesh->mesh,self->set.handle,&is_list,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_isList(self->instance->handle,self->base.handle,&is_list,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return PyBool_FromLong(is_list);
@@ -154,9 +154,9 @@
if(!PyArg_ParseTuple(args,"i",&num_hops))
return NULL;
- iMesh_getNumEntSets(self->mesh->mesh,self->set.handle,num_hops,&num_sets,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getNumEntSets(self->instance->handle,self->base.handle,num_hops,
+ &num_sets,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",num_sets);
@@ -171,14 +171,14 @@
if(!PyArg_ParseTuple(args,"i",&num_hops))
return NULL;
- iMesh_getEntSets(self->mesh->mesh,self->set.handle,num_hops,&sets,
+ iMesh_getEntSets(self->instance->handle,self->base.handle,num_hops,&sets,
&sets_alloc,&sets_size,&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
npy_intp dims[] = {sets_size};
return PyArray_NewFromMallocBase(1,dims,NPY_IMESHENTSET,sets,
- (PyObject*)self->mesh);
+ (PyObject*)self->instance);
}
static PyObject *
@@ -195,18 +195,21 @@
{
int size = PyArray_SIZE(ents);
iBase_EntityHandle *data = PyArray_DATA(ents);
- iMesh_addEntArrToSet(self->mesh->mesh,data,size,self->set.handle,&err);
+ iMesh_addEntArrToSet(self->instance->handle,data,size,
+ self->base.handle,&err);
Py_DECREF(ents);
}
else if(iBaseEntitySet_Check(obj))
{
iBaseEntitySet_Object *set = (iBaseEntitySet_Object*)obj;
- iMesh_addEntSet(self->mesh->mesh,set->handle,self->set.handle,&err);
+ iMesh_addEntSet(self->instance->handle,set->handle,self->base.handle,
+ &err);
}
else if(iBaseEntity_Check(obj))
{
iBaseEntity_Object *ent = (iBaseEntity_Object*)obj;
- iMesh_addEntToSet(self->mesh->mesh,ent->handle,self->set.handle,&err);
+ iMesh_addEntToSet(self->instance->handle,ent->handle,self->base.handle,
+ &err);
}
else
{
@@ -214,7 +217,7 @@
return NULL;
}
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
}
@@ -233,20 +236,21 @@
{
int size = PyArray_SIZE(ents);
iBase_EntityHandle *data = PyArray_DATA(ents);
- iMesh_rmvEntArrFromSet(self->mesh->mesh,data,size,self->set.handle,
- &err);
+ iMesh_rmvEntArrFromSet(self->instance->handle,data,size,
+ self->base.handle,&err);
Py_DECREF(ents);
}
else if(iBaseEntitySet_Check(obj))
{
iBaseEntitySet_Object *set = (iBaseEntitySet_Object*)obj;
- iMesh_rmvEntSet(self->mesh->mesh,set->handle,self->set.handle,&err);
+ iMesh_rmvEntSet(self->instance->handle,set->handle,self->base.handle,
+ &err);
}
else if(iBaseEntity_Check(obj))
{
iBaseEntity_Object *ent = (iBaseEntity_Object*)obj;
- iMesh_rmvEntFromSet(self->mesh->mesh,ent->handle,self->set.handle,
- &err);
+ iMesh_rmvEntFromSet(self->instance->handle,ent->handle,
+ self->base.handle,&err);
}
else
{
@@ -254,7 +258,7 @@
return NULL;
}
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
}
@@ -276,10 +280,11 @@
int size = PyArray_SIZE(ents);
iBase_EntityHandle *data = PyArray_DATA(ents);
- iMesh_isEntArrContained(self->mesh->mesh,self->set.handle,data,size,
- &contains,&contains_alloc,&contains_size,&err);
+ iMesh_isEntArrContained(self->instance->handle,self->base.handle,data,
+ size,&contains,&contains_alloc,&contains_size,
+ &err);
Py_DECREF(ents);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
npy_intp dims[] = {contains_size};
@@ -290,9 +295,9 @@
{
int contains;
iBaseEntitySet_Object *set = (iBaseEntitySet_Object*)obj;
- iMesh_isEntSetContained(self->mesh->mesh,self->set.handle,set->handle,
- &contains,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_isEntSetContained(self->instance->handle,self->base.handle,
+ set->handle,&contains,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return PyBool_FromLong(contains);
@@ -301,9 +306,9 @@
{
int contains;
iBaseEntity_Object *ent = (iBaseEntity_Object*)obj;
- iMesh_isEntContained(self->mesh->mesh,self->set.handle,ent->handle,
- &contains,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_isEntContained(self->instance->handle,self->base.handle,
+ ent->handle,&contains,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return PyBool_FromLong(contains);
@@ -326,8 +331,9 @@
if(!PyArg_ParseTuple(args,"O!",&iBaseEntitySet_Type,&set))
return NULL;
- iMesh_addPrntChld(self->mesh->mesh,self->set.handle,set->handle,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_addPrntChld(self->instance->handle,self->base.handle,set->handle,
+ &err);
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
@@ -342,8 +348,9 @@
if(!PyArg_ParseTuple(args,"O!",&iBaseEntitySet_Type,&set))
return NULL;
- iMesh_rmvPrntChld(self->mesh->mesh,self->set.handle,set->handle,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_rmvPrntChld(self->instance->handle,self->base.handle,set->handle,
+ &err);
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
@@ -358,9 +365,9 @@
if(!PyArg_ParseTuple(args,"O!",&iBaseEntitySet_Type,&set))
return NULL;
- iMesh_isChildOf(self->mesh->mesh,self->set.handle,set->handle,&is_child,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_isChildOf(self->instance->handle,self->base.handle,set->handle,
+ &is_child,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return PyBool_FromLong(is_child);
@@ -374,9 +381,9 @@
if(!PyArg_ParseTuple(args,"i",&num_hops))
return NULL;
- iMesh_getNumChld(self->mesh->mesh,self->set.handle,num_hops,&num_children,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getNumChld(self->instance->handle,self->base.handle,num_hops,
+ &num_children,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",num_children);
@@ -390,9 +397,9 @@
if(!PyArg_ParseTuple(args,"i",&num_hops))
return NULL;
- iMesh_getNumPrnt(self->mesh->mesh,self->set.handle,num_hops,&num_parents,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getNumPrnt(self->instance->handle,self->base.handle,num_hops,
+ &num_parents,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",num_parents);
@@ -407,14 +414,14 @@
if(!PyArg_ParseTuple(args,"i",&num_hops))
return NULL;
- iMesh_getChldn(self->mesh->mesh,self->set.handle,num_hops,&sets,
+ iMesh_getChldn(self->instance->handle,self->base.handle,num_hops,&sets,
&sets_alloc,&sets_size,&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
npy_intp dims[] = {sets_size};
return PyArray_NewFromMallocBase(1,dims,NPY_IMESHENTSET,sets,
- (PyObject*)self->mesh);
+ (PyObject*)self->instance);
}
static PyObject *
@@ -426,14 +433,14 @@
if(!PyArg_ParseTuple(args,"i",&num_hops))
return NULL;
- iMesh_getPrnts(self->mesh->mesh,self->set.handle,num_hops,&sets,
+ iMesh_getPrnts(self->instance->handle,self->base.handle,num_hops,&sets,
&sets_alloc,&sets_size,&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
npy_intp dims[] = {sets_size};
return PyArray_NewFromMallocBase(1,dims,NPY_IMESHENTSET,sets,
- (PyObject*)self->mesh);
+ (PyObject*)self->instance);
}
static PyObject *
@@ -458,14 +465,14 @@
int err;
iMeshEntitySet_Object *result;
- if(lhs->mesh->mesh != rhs->mesh->mesh)
+ if(lhs->instance->handle != rhs->instance->handle)
return NULL;
- result = iMeshEntitySet_New(lhs->mesh);
+ result = iMeshEntitySet_New(lhs->instance);
- iMesh_subtract(lhs->mesh->mesh,lhs->set.handle,rhs->set.handle,
- &result->set.handle,&err);
- if(checkError(lhs->mesh->mesh,err))
+ iMesh_subtract(lhs->instance->handle,lhs->base.handle,rhs->base.handle,
+ &result->base.handle,&err);
+ if(checkError(lhs->instance->handle,err))
{
Py_DECREF((PyObject*)result);
return NULL;
@@ -480,14 +487,14 @@
int err;
iMeshEntitySet_Object *result;
- if(lhs->mesh->mesh != rhs->mesh->mesh)
+ if(lhs->instance->handle != rhs->instance->handle)
return NULL;
- result = iMeshEntitySet_New(lhs->mesh);
+ result = iMeshEntitySet_New(lhs->instance);
- iMesh_intersect(lhs->mesh->mesh,lhs->set.handle,rhs->set.handle,
- &result->set.handle,&err);
- if(checkError(lhs->mesh->mesh,err))
+ iMesh_intersect(lhs->instance->handle,lhs->base.handle,rhs->base.handle,
+ &result->base.handle,&err);
+ if(checkError(lhs->instance->handle,err))
{
Py_DECREF((PyObject*)result);
return NULL;
@@ -502,14 +509,14 @@
int err;
iMeshEntitySet_Object *result;
- if(lhs->mesh->mesh != rhs->mesh->mesh)
+ if(lhs->instance->handle != rhs->instance->handle)
return NULL;
- result = iMeshEntitySet_New(lhs->mesh);
+ result = iMeshEntitySet_New(lhs->instance);
- iMesh_unite(lhs->mesh->mesh,lhs->set.handle,rhs->set.handle,
- &result->set.handle,&err);
- if(checkError(lhs->mesh->mesh,err))
+ iMesh_unite(lhs->instance->handle,lhs->base.handle,rhs->base.handle,
+ &result->base.handle,&err);
+ if(checkError(lhs->instance->handle,err))
{
Py_DECREF((PyObject*)result);
return NULL;
@@ -624,8 +631,8 @@
};
static PyMemberDef iMeshEntSetObj_members[] = {
- {"instance", T_OBJECT_EX, offsetof(iMeshEntitySet_Object, mesh), READONLY,
- "base iMesh instance"},
+ {"instance", T_OBJECT_EX, offsetof(iMeshEntitySet_Object, instance),
+ READONLY, "base iMesh instance"},
{0}
};
Modified: MOAB/branches/python/tools/iMesh/python/iMesh_iter.inl
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iMesh_iter.inl 2009-09-15 16:57:33 UTC (rev 3140)
+++ MOAB/branches/python/tools/iMesh/python/iMesh_iter.inl 2009-09-15 19:08:23 UTC (rev 3141)
@@ -14,22 +14,22 @@
&array_size) )
return -1;
- self->mesh = set->mesh;
- Py_INCREF(self->mesh);
+ self->instance = set->instance;
+ Py_INCREF(self->instance);
if(array_size == 1)
{
self->is_arr = 0;
- iMesh_initEntIter(self->mesh->mesh,set->set.handle,type,topo,
+ iMesh_initEntIter(self->instance->handle,set->base.handle,type,topo,
&self->iter,&err);
}
else
{
self->is_arr = 1;
- iMesh_initEntArrIter(self->mesh->mesh,set->set.handle,type,topo,
+ iMesh_initEntArrIter(self->instance->handle,set->base.handle,type,topo,
array_size,&self->arr_iter,&err);
}
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return -1;
return 0;
@@ -38,16 +38,16 @@
static void
iMeshIterObj_dealloc(iMeshIter_Object *self)
{
- if(self->mesh && self->iter)
+ if(self->instance && self->iter)
{
int err;
if(self->is_arr)
- iMesh_endEntArrIter(self->mesh->mesh,self->arr_iter,&err);
+ iMesh_endEntArrIter(self->instance->handle,self->arr_iter,&err);
else
- iMesh_endEntIter(self->mesh->mesh,self->iter,&err);
+ iMesh_endEntIter(self->instance->handle,self->iter,&err);
}
- Py_XDECREF(self->mesh);
+ Py_XDECREF(self->instance);
self->ob_type->tp_free((PyObject*)self);
}
@@ -56,11 +56,11 @@
{
int err;
if(self->is_arr)
- iMesh_resetEntArrIter(self->mesh->mesh,self->arr_iter,&err);
+ iMesh_resetEntArrIter(self->instance->handle,self->arr_iter,&err);
else
- iMesh_resetEntIter(self->mesh->mesh,self->iter,&err);
+ iMesh_resetEntIter(self->instance->handle,self->iter,&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
}
@@ -75,9 +75,9 @@
iBase_EntityHandle *entities=0;
int alloc=0,size;
- iMesh_getNextEntArrIter(self->mesh->mesh,self->arr_iter,&entities,
+ iMesh_getNextEntArrIter(self->instance->handle,self->arr_iter,&entities,
&alloc,&size,&has_data,&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
if(!has_data)
return NULL;
@@ -88,9 +88,9 @@
else
{
iBase_EntityHandle entity;
- iMesh_getNextEntIter(self->mesh->mesh,self->iter,&entity,&has_data,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getNextEntIter(self->instance->handle,self->iter,&entity,
+ &has_data,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
if(!has_data)
return NULL;
@@ -109,7 +109,7 @@
};
static PyMemberDef iMeshIterObj_members[] = {
- {"instance", T_OBJECT_EX, offsetof(iMeshIter_Object, mesh), READONLY,
+ {"instance", T_OBJECT_EX, offsetof(iMeshIter_Object, instance), READONLY,
"base iMesh instance"},
{0}
};
Modified: MOAB/branches/python/tools/iMesh/python/iMesh_tag.inl
===================================================================
--- MOAB/branches/python/tools/iMesh/python/iMesh_tag.inl 2009-09-15 16:57:33 UTC (rev 3140)
+++ MOAB/branches/python/tools/iMesh/python/iMesh_tag.inl 2009-09-15 19:08:23 UTC (rev 3141)
@@ -27,7 +27,7 @@
static void
iMeshTagObj_dealloc(iMeshTag_Object *self)
{
- Py_XDECREF(self->mesh);
+ Py_XDECREF(self->instance);
((PyObject*)self)->ob_type->tp_free((PyObject*)self);
}
@@ -36,8 +36,9 @@
{
char name[512];
int err;
- iMesh_getTagName(self->mesh->mesh,self->tag.handle,name,&err,sizeof(name));
- if(checkError(self->mesh->mesh,err))
+ iMesh_getTagName(self->instance->handle,self->base.handle,name,&err,
+ sizeof(name));
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("s",name);
@@ -47,8 +48,8 @@
iMeshTagObj_getSizeValues(iMeshTag_Object *self,void *closure)
{
int size,err;
- iMesh_getTagSizeValues(self->mesh->mesh,self->tag.handle,&size,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getTagSizeValues(self->instance->handle,self->base.handle,&size,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",size);
@@ -58,8 +59,8 @@
iMeshTagObj_getSizeBytes(iMeshTag_Object *self,void *closure)
{
int size,err;
- iMesh_getTagSizeBytes(self->mesh->mesh,self->tag.handle,&size,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getTagSizeBytes(self->instance->handle,self->base.handle,&size,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",size);
@@ -69,8 +70,8 @@
iMeshTagObj_getType(iMeshTag_Object *self,void *closure)
{
int type,err;
- iMesh_getTagType(self->mesh->mesh,self->tag.handle,&type,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getTagType(self->instance->handle,self->base.handle,&type,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("c",type_to_char(type));
@@ -91,8 +92,8 @@
if(typechar == 0)
{
/* infer the type of the data */
- iMesh_getTagType(self->mesh->mesh,self->tag.handle,&type,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getTagType(self->instance->handle,self->base.handle,&type,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
}
else
@@ -124,8 +125,8 @@
data_size = PyArray_SIZE(data_arr);
int *data = PyArray_DATA(data_arr);
- iMesh_setIntArrData(self->mesh->mesh,entities,ent_size,
- self->tag.handle,data,data_size,&err);
+ iMesh_setIntArrData(self->instance->handle,entities,ent_size,
+ self->base.handle,data,data_size,&err);
}
else if(type == iBase_DOUBLE)
{
@@ -136,8 +137,8 @@
data_size = PyArray_SIZE(data_arr);
double *data = PyArray_DATA(data_arr);
- iMesh_setDblArrData(self->mesh->mesh,entities,ent_size,
- self->tag.handle,data,data_size,&err);
+ iMesh_setDblArrData(self->instance->handle,entities,ent_size,
+ self->base.handle,data,data_size,&err);
}
else if(type == iBase_ENTITY_HANDLE)
{
@@ -148,8 +149,8 @@
data_size = PyArray_SIZE(data_arr);
iBase_EntityHandle *data = PyArray_DATA(data_arr);
- iMesh_setEHArrData(self->mesh->mesh,entities,ent_size,
- self->tag.handle,data,data_size,&err);
+ iMesh_setEHArrData(self->instance->handle,entities,ent_size,
+ self->base.handle,data,data_size,&err);
}
else /* iBase_BYTES */
{
@@ -159,8 +160,8 @@
data_size = PyArray_SIZE(data_arr);
char *data = PyArray_DATA(data_arr);
- iMesh_setArrData(self->mesh->mesh,entities,ent_size,
- self->tag.handle,data,data_size,&err);
+ iMesh_setArrData(self->instance->handle,entities,ent_size,
+ self->base.handle,data,data_size,&err);
}
Py_DECREF(ents);
@@ -175,7 +176,7 @@
PyObject *o = PyNumber_Int(data_obj);
if(o == NULL)
return NULL;
- iMesh_setEntSetIntData(self->mesh->mesh,set,self->tag.handle,
+ iMesh_setEntSetIntData(self->instance->handle,set,self->base.handle,
PyInt_AsLong(o),&err);
Py_DECREF(o);
}
@@ -184,7 +185,7 @@
PyObject *o = PyNumber_Float(data_obj);
if(o == NULL)
return NULL;
- iMesh_setEntSetDblData(self->mesh->mesh,set,self->tag.handle,
+ iMesh_setEntSetDblData(self->instance->handle,set,self->base.handle,
PyFloat_AsDouble(o),&err);
Py_DECREF(o);
}
@@ -192,7 +193,7 @@
{
if(!iBaseEntity_Check(data_obj))
return NULL;
- iMesh_setEntSetEHData(self->mesh->mesh,set,self->tag.handle,
+ iMesh_setEntSetEHData(self->instance->handle,set,self->base.handle,
iBaseEntity_GetHandle(data_obj),&err);
}
else /* iBase_BYTES */
@@ -204,8 +205,8 @@
char *data = PyArray_DATA(data_arr);
int data_size = PyArray_SIZE(data_arr);
- iMesh_setEntSetData(self->mesh->mesh,set,self->tag.handle,data,
- data_size,&err);
+ iMesh_setEntSetData(self->instance->handle,set,self->base.handle,
+ data,data_size,&err);
Py_DECREF(data_arr);
}
}
@@ -218,7 +219,7 @@
PyObject *o = PyNumber_Int(data_obj);
if(o == NULL)
return NULL;
- iMesh_setIntData(self->mesh->mesh,entity,self->tag.handle,
+ iMesh_setIntData(self->instance->handle,entity,self->base.handle,
PyInt_AsLong(o),&err);
Py_DECREF(o);
}
@@ -227,7 +228,7 @@
PyObject *o = PyNumber_Float(data_obj);
if(o == NULL)
return NULL;
- iMesh_setDblData(self->mesh->mesh,entity,self->tag.handle,
+ iMesh_setDblData(self->instance->handle,entity,self->base.handle,
PyFloat_AsDouble(o),&err);
Py_DECREF(o);
}
@@ -235,7 +236,7 @@
{
if(!iBaseEntity_Check(data_obj))
return NULL;
- iMesh_setEHData(self->mesh->mesh,entity,self->tag.handle,
+ iMesh_setEHData(self->instance->handle,entity,self->base.handle,
iBaseEntity_GetHandle(data_obj),&err);
}
else /* iBase_BYTES */
@@ -247,7 +248,7 @@
char *data = PyArray_DATA(data_arr);
int data_size = PyArray_SIZE(data_arr);
- iMesh_setData(self->mesh->mesh,entity,self->tag.handle,data,
+ iMesh_setData(self->instance->handle,entity,self->base.handle,data,
data_size,&err);
Py_DECREF(data_arr);
}
@@ -258,7 +259,7 @@
return NULL;
}
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
}
@@ -277,8 +278,8 @@
if(typechar == 0)
{
/* infer the type of the data */
- iMesh_getTagType(self->mesh->mesh,self->tag.handle,&type,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getTagType(self->instance->handle,self->base.handle,&type,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
}
else
@@ -303,9 +304,9 @@
int *data=0;
int alloc=0,size;
- iMesh_getIntArrData(self->mesh->mesh,entities,ent_size,
- self->tag.handle,&data,&alloc,&size,&err);
- if(!checkError(self->mesh->mesh,err))
+ iMesh_getIntArrData(self->instance->handle,entities,ent_size,
+ self->base.handle,&data,&alloc,&size,&err);
+ if(!checkError(self->instance->handle,err))
{
npy_intp dims[] = {size};
ret = PyArray_NewFromMalloc(1,dims,NPY_INT,data);
@@ -316,9 +317,9 @@
double *data=0;
int alloc=0,size;
- iMesh_getDblArrData(self->mesh->mesh,entities,ent_size,
- self->tag.handle,&data,&alloc,&size,&err);
- if(!checkError(self->mesh->mesh,err))
+ iMesh_getDblArrData(self->instance->handle,entities,ent_size,
+ self->base.handle,&data,&alloc,&size,&err);
+ if(!checkError(self->instance->handle,err))
{
npy_intp dims[] = {size};
ret = PyArray_NewFromMalloc(1,dims,NPY_DOUBLE,data);
@@ -329,9 +330,9 @@
iBase_EntityHandle *data=0;
int alloc=0,size;
- iMesh_getEHArrData(self->mesh->mesh,entities,ent_size,
- self->tag.handle,&data,&alloc,&size,&err);
- if(!checkError(self->mesh->mesh,err))
+ iMesh_getEHArrData(self->instance->handle,entities,ent_size,
+ self->base.handle,&data,&alloc,&size,&err);
+ if(!checkError(self->instance->handle,err))
{
npy_intp dims[] = {size};
ret = PyArray_NewFromMalloc(1,dims,NPY_IBASEENT,data);
@@ -342,9 +343,9 @@
char *data=0;
int alloc=0,size;
- iMesh_getArrData(self->mesh->mesh,entities,ent_size,
- self->tag.handle,&data,&alloc,&size,&err);
- if(!checkError(self->mesh->mesh,err))
+ iMesh_getArrData(self->instance->handle,entities,ent_size,
+ self->base.handle,&data,&alloc,&size,&err);
+ if(!checkError(self->instance->handle,err))
{
npy_intp dims[] = {size};
ret = PyArray_NewFromMalloc(1,dims,NPY_BYTE,data);
@@ -361,27 +362,27 @@
if(type == iBase_INTEGER)
{
int data;
- iMesh_getEntSetIntData(self->mesh->mesh,set,self->tag.handle,&data,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getEntSetIntData(self->instance->handle,set,
+ self->base.handle,&data,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",data);
}
else if(type == iBase_DOUBLE)
{
double data;
- iMesh_getEntSetDblData(self->mesh->mesh,set,self->tag.handle,&data,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getEntSetDblData(self->instance->handle,set,
+ self->base.handle,&data,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("d",data);
}
else if(type == iBase_ENTITY_HANDLE)
{
iBaseEntity_Object *data = iBaseEntity_New();
- iMesh_getEntSetEHData(self->mesh->mesh,set,self->tag.handle,
+ iMesh_getEntSetEHData(self->instance->handle,set,self->base.handle,
&data->handle,&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
{
Py_DECREF(data);
return NULL;
@@ -392,9 +393,9 @@
{
char *data=0;
int alloc=0,size;
- iMesh_getEntSetData(self->mesh->mesh,set,self->tag.handle,&data,
- &alloc,&size,&err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getEntSetData(self->instance->handle,set,self->base.handle,
+ &data,&alloc,&size,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
npy_intp dims[] = {size};
return PyArray_NewFromMalloc(1,dims,NPY_BYTE,data);
@@ -407,27 +408,27 @@
if(type == iBase_INTEGER)
{
int data;
- iMesh_getIntData(self->mesh->mesh,entity,self->tag.handle,&data,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getIntData(self->instance->handle,entity,self->base.handle,
+ &data,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("i",data);
}
else if(type == iBase_DOUBLE)
{
double data;
- iMesh_getDblData(self->mesh->mesh,entity,self->tag.handle,&data,
- &err);
- if(checkError(self->mesh->mesh,err))
+ iMesh_getDblData(self->instance->handle,entity,self->base.handle,
+ &data,&err);
+ if(checkError(self->instance->handle,err))
return NULL;
return Py_BuildValue("d",data);
}
else if(type == iBase_ENTITY_HANDLE)
{
iBaseEntity_Object *data = iBaseEntity_New();
- iMesh_getEHData(self->mesh->mesh,entity,self->tag.handle,
+ iMesh_getEHData(self->instance->handle,entity,self->base.handle,
&data->handle,&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
{
Py_DECREF(data);
return NULL;
@@ -438,9 +439,9 @@
{
char *data=0;
int alloc=0,size;
- iMesh_getData(self->mesh->mesh,entity,self->tag.handle,&data,
+ iMesh_getData(self->instance->handle,entity,self->base.handle,&data,
&alloc,&size,&err);
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
npy_intp dims[] = {size};
return PyArray_NewFromMalloc(1,dims,NPY_BYTE,data);
@@ -467,19 +468,19 @@
{
int ent_size = PyArray_SIZE(ents);
iBase_EntityHandle *entities = PyArray_DATA(ents);
- iMesh_rmvArrTag(self->mesh->mesh,entities,ent_size,self->tag.handle,
- &err);
+ iMesh_rmvArrTag(self->instance->handle,entities,ent_size,
+ self->base.handle,&err);
Py_DECREF(ents);
}
else if(iBaseEntitySet_Check(obj))
{
iBase_EntitySetHandle set = iBaseEntitySet_GetHandle(obj);
- iMesh_rmvEntSetTag(self->mesh->mesh,set,self->tag.handle,&err);
+ iMesh_rmvEntSetTag(self->instance->handle,set,self->base.handle,&err);
}
else if(iBaseEntity_Check(obj))
{
iBase_EntityHandle entity = iBaseEntity_GetHandle(obj);
- iMesh_rmvTag(self->mesh->mesh,entity,self->tag.handle,&err);
+ iMesh_rmvTag(self->instance->handle,entity,self->base.handle,&err);
}
else
{
@@ -487,7 +488,7 @@
return NULL;
}
- if(checkError(self->mesh->mesh,err))
+ if(checkError(self->instance->handle,err))
return NULL;
Py_RETURN_NONE;
}
@@ -507,7 +508,7 @@
};
static PyMemberDef iMeshTagObj_members[] = {
- {"instance", T_OBJECT_EX, offsetof(iMeshTag_Object, mesh), READONLY,
+ {"instance", T_OBJECT_EX, offsetof(iMeshTag_Object, instance), READONLY,
"base iMesh instance"},
{0}
};
Modified: MOAB/branches/python/tools/iMesh/python/setup.py
===================================================================
--- MOAB/branches/python/tools/iMesh/python/setup.py 2009-09-15 16:57:33 UTC (rev 3140)
+++ MOAB/branches/python/tools/iMesh/python/setup.py 2009-09-15 19:08:23 UTC (rev 3141)
@@ -6,6 +6,7 @@
import re
import os
import sys
+import string
def pair_fun(pre, post):
def tmp(self):
@@ -13,26 +14,27 @@
post(self)
return tmp
-def add_imesh_defs(imesh_dir, self):
- defs = parse_makefile( os.path.join(imesh_dir, 'iMesh-Defs.inc') )
+def add_itaps_defs(build_ext, itaps_dir, iface):
+ defs = parse_makefile( os.path.join(itaps_dir, iface+'-Defs.inc') )
+ prefix = string.upper(iface)
- lib_match = re.compile(r'(?:(?<=\s)|^)-([lL])\s*(\S*)')
- for match in lib_match.finditer( defs['IMESH_LIBS'] ):
- if match.group(1) == 'l':
- self.libraries.append( match.group(2) )
- elif match.group(1) == 'L':
- self.library_dirs.append( match.group(2) )
+ lib_match = re.compile(r'(?:(?<=\s)|^)-([lL])\s*(\S*)')
+ for match in lib_match.finditer( defs[prefix+'_LIBS'] ):
+ if match.group(1) == 'l':
+ build_ext.libraries.append( match.group(2) )
+ elif match.group(1) == 'L':
+ build_ext.library_dirs.append( match.group(2) )
+
+ inc_match = re.compile(r'(?:(?<=\s)|^)-(I)\s*(\S*)')
+ for match in inc_match.finditer( defs[prefix+'_INCLUDES'] ):
+ build_ext.include_dirs.append( match.group(2) )
- inc_match = re.compile(r'(?:(?<=\s)|^)-(I)\s*(\S*)')
- for match in inc_match.finditer( defs['IMESH_INCLUDES'] ):
- self.include_dirs.append( match.group(2) )
-
def new_init(self):
self.imesh_dir = None
def new_fin(self):
if self.imesh_dir:
- add_imesh_defs(self.imesh_dir, self)
+ add_itaps_defs(self, self.imesh_dir, 'iMesh')
build_ext.user_options.append(('imesh-dir=', None,
'root directory for iMesh interface'))
@@ -40,22 +42,17 @@
build_ext.finalize_options = pair_fun(build_ext.finalize_options, new_fin)
-def rebase(path):
- return os.path.normpath( os.path.join( os.path.abspath(sys.argv[0]),
- '../'+path) )
-
iBase = Extension('itaps.iBase',
- depends = map(rebase, ['common.h', 'iBase_Python.h']),
- sources = map(rebase, ['iBase.c'])
+ depends = ['common.h', 'iBase_Python.h'],
+ sources = ['iBase.c']
)
iMesh = Extension('itaps.iMesh',
- depends = map(rebase,
- ['common.h', 'errors.h', 'iMesh_Python.h',
- 'iBase_Python.h', 'iMesh_entSet.inl',
- 'iMesh_iter.inl', 'iMesh_tag.inl',
- 'numpy_extensions.h', 'numpy_extensions.inl']),
- sources = map(rebase, ['iMesh.c'])
+ depends = ['common.h', 'errors.h', 'iMesh_Python.h',
+ 'iBase_Python.h', 'iMesh_entSet.inl',
+ 'iMesh_iter.inl', 'iMesh_tag.inl',
+ 'numpy_extensions.h', 'numpy_extensions.inl'],
+ sources = ['iMesh.c']
)
class TestCommand(Command):
@@ -74,7 +71,7 @@
raise DistutilsOptionError('"verbosity" option must be an integer')
def run(self):
- root = rebase('test')
+ root = 'test'
old = os.getcwd()
tests = []
regex = re.compile(r'^(.*).py$')
@@ -108,7 +105,7 @@
self.target = '_build/' + self.builder
def run(self):
- root = rebase('doc')
+ root = 'doc'
old = os.getcwd()
os.chdir(root)
@@ -170,7 +167,7 @@
add_imesh_defs(self.imesh_dir, self)
def run(self):
- root = rebase('perf')
+ root = 'perf'
old = os.getcwd()
os.chdir(root)
@@ -209,7 +206,7 @@
raise DistutilsOptionError('"count" option must be an integer')
def run(self):
- root = rebase('perf')
+ root = 'perf'
old = os.getcwd()
os.chdir(root)
os.system('python perf.py -c%d "%s"' % (self.count, self.file))
@@ -224,7 +221,7 @@
requires = ['numpy'],
provides = ['itaps'],
- package_dir = {'itaps': rebase('pkg')},
+ package_dir = {'itaps': 'pkg'},
packages = ['itaps'],
ext_modules = [iBase, iMesh],
py_modules = ['itaps.helpers'],
More information about the moab-dev
mailing list