[MOAB-dev] r2236 - MOAB/trunk/tools/iMesh
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Thu Nov 13 12:35:34 CST 2008
Author: kraftche
Date: 2008-11-13 12:35:34 -0600 (Thu, 13 Nov 2008)
New Revision: 2236
Modified:
MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
Log:
o Fix an earlier checkin of mine that completely broke iMesh iterators
(current position was being initialized to some other, empty MBRange.)
o Fix iMesh_getNextEntArrIter: has_data must be set to false during the
last successful query. It previously only did so if the size of the
range was not a multiple of the iterator size such that it reached the
end of the range before completely filling the input array. This almost
always worked for array iterators, but resulting in single-entity
iterators being broken (as they share the same step code and the range
size is always a multple of one.)
Modified: MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp 2008-11-13 15:32:25 UTC (rev 2235)
+++ MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp 2008-11-13 18:35:34 UTC (rev 2236)
@@ -188,7 +188,7 @@
RangeIterator* iter = new RangeIterator;
if (iter) {
iter->iteratorRange.swap(range);
- iter->currentPos = range.begin();
+ iter->currentPos = iter->iteratorRange.begin();
iter->requestedSize = array_size;
}
return iter;
@@ -879,7 +879,7 @@
/*inout*/ iBase_EntityHandle** entity_handles,
/*inout*/ int* entity_handles_allocated,
/*out*/ int* entity_handles_size,
- int *is_end, int *err)
+ int *has_data, int *err)
{
RangeIterator *this_it = RANGE_ITERATOR(entArr_iterator);
@@ -889,21 +889,16 @@
CHECK_SIZE(*entity_handles, *entity_handles_allocated, expected_size,
iBase_EntityHandle, false);
- int j = 0, i;
- for (i = 0; i < this_it->requestedSize; ++i, ++this_it->currentPos)
+ int i = 0;
+ while (i < this_it->requestedSize && this_it->currentPos != this_it->iteratorRange.end())
{
- if (this_it->currentPos == this_it->iteratorRange.end()) {
- *is_end = false;
- *entity_handles_size = j;
- RETURN(iBase_SUCCESS);
- }
-
if (MBimesh->is_valid(*this_it->currentPos))
- (*entity_handles)[j++] = (iBase_EntityHandle)*this_it->currentPos;
+ (*entity_handles)[i++] = (iBase_EntityHandle)*(this_it->currentPos);
+ ++(this_it->currentPos);
}
- *is_end = true;
- *entity_handles_size = j;
+ *has_data = (this_it->currentPos != this_it->iteratorRange.end());
+ *entity_handles_size = i;
RETURN(iBase_SUCCESS);
}
More information about the moab-dev
mailing list