iterator question.

Mark Beall mbeall at simmetrix.com
Thu Oct 29 10:48:38 CDT 2009


So is the iGeom behavior different than the iMesh one then?

The iGeom behavior doesn't make sense if the iterator is iterating on  
an empty list (behavior is undefined). The simple fix is to return a  
null for the value, but then lists can't have nulls (not sure if they  
can anyhow) and the flag returned by iGeom_getNextEntIter isn't  
actually needed in that case (since the behavior if you just look at  
the entity is the same as the iMesh iterator).

mark

On Oct 29, 2009, at 11:34 AM, Carl Ollivier-Gooch wrote:

> Jason Kraftcheck wrote:
>> Mark Shephard wrote:
>>> The Simmetrix people have been looking at the ITAPS iMesh, iMeshP,  
>>> iRel
>>> and iGeom interfaces.
>>>
>>> One of the questions they have sent us has to do with iterators  
>>> and is:
>>>
>>> "Are iMesh_getNextEntIter and iGeom_getNextEntIter supposed to  
>>> have the
>>> same behavior as their documentation describes two different  
>>> behaviors -
>>> iMesh_getNextEntIter indicates whether the current call returned  
>>> data
>>> (which is fairly standard behavior for an  
>>> iterator),iGeom_getNextEntIter
>>> indicates whether the next call will return data (which is kind of  
>>> odd
>>> behavior for an iterator)."
>>>
>>> I would think they should have the same behavior and the iMesh  
>>> behavior
>>> is the right one. Comments please.
>>>
>> I think (if I correctly recall the that group discussion about  
>> this) that
>> the iMesh one is the correct one.  Returning information about next  
>> call, as
>> the iGeom one does, is not usable in mesh modification scenarios  
>> (consider
>> iterator at second to last entity when last entity is deleted.)
>
> Jason has identified precisely the reason that the iMesh iterator  
> behavior was changed.
>
> Carl
>
>
> -- 
> ------------------------------------------------------------------------
> Dr. Carl Ollivier-Gooch, P.Eng.                   Voice:  
> +1-604-822-1854
> Associate Professor                                 Fax:  
> +1-604-822-2403
> Department of Mechanical Engineering             email: cfog at mech.ubc.ca
> University of British Columbia              http://www.mech.ubc.ca/~cfog
> Vancouver, BC  V6T 1Z4                  http://tetra.mech.ubc.ca/ANSLab/
> ------------------------------------------------------------------------



More information about the tstt-interface mailing list