[MOAB-dev] Incomplete types versus void * in ITAPS interfaces

Onkar Sahni osahni at scorec.rpi.edu
Mon Sep 8 12:02:12 CDT 2008


There are two levels to what I mentioned (C and C++), and my critical
point is more on having iBase_VertexHandle, ..., iBase_RegionHandle etc.
on top of just iBase_EntityHandle.

I will provide my summary before details (as interested people can read
details below) I think move from void* to iBase_EntityHandlePrivate* will
be a good one but I will recommend to consider iBase_VertexHandle, ...,
iBase_RegionHandle... too.




Interested people can read on for some more details (and am hoping this
will be my last email on this issue):

Yes, there is iMesh_getEntType/Topo, but for low-level/atomic
functions I would hope user doesn't have to call iMesh_getEntType/Topo
(and user would have to if we only have iBase_EntityHandle, no
iBase_RegionHandle etc.) something like:

computeScalarIntergral(iBase_EntityHandle ent_hdl,...) {
  iMesh_getEntType(...,entType,...);
  switch(entType) {
   case REGION:
    computeScalarIntegralRegion(ent_hdl,...);
    break;
   case FACE:
    computeScalarIntegralFace(ent_hdl,...);
   ....
  }
}

And yes another way user can do this (so user can avoid iMesh_getEntType()
call within low-level/atomic functions like computeScalarIntegralRegion()
or computeScalarIntegralFace()):

  // collect all regions from list of contributors based on entType ...
  computeScalarIntergralForListOfRegions(list_rgn_hdls,...);
  // collect all faces from list of contributors based on entType
  computeScalarIntergralForListOfFaces(list_face_hdls,...);

>> By the way, iMesh already exposes implementation details. Infact ones
>> which I do not really like:
>> alloc=0;
>> iMesh_getEntAdj(...,alloc,...);
>> if(alloc)
>>   free(...); // oops
>
> What are you asking for, garbage collection?

  That memory was allocated using malloc/calloc... (this is implementation
detail).

> Note that there is no requirement that the typedef be the same for every
> implementation.

What I have been told is that in ITAPS paradigm you should not re-compile
code when changing implementation but rather just re-link.

Jed, may be I used inheritance in a wrong way (as I do agree with you that
I do not see user calling virtual functions). I was reluctant to use
inheritance in my first email and thats why said overloading before
inheritance... anyways thanks for all the discussions.

- Onkar




More information about the moab-dev mailing list