| 601 | private: |
| 602 | |
| 603 | void computeIndices() |
| 604 | { |
| 605 | // Once indices have been added, and before using them, this function is called to |
| 606 | // compute the new indices. |
| 607 | if( m_indicesComputed ) |
| 608 | { |
| 609 | return; |
| 610 | } |
| 611 | |
| 612 | m_indicesComputed = true; |
| 613 | |
| 614 | for( unsigned int blockId = 0; blockId < m_fromOldIds.size(); blockId++ ) |
| 615 | { |
| 616 | auto &block = m_fromOldIds[ blockId ]; |
| 617 | if( !block ) |
| 618 | { |
| 619 | continue; |
| 620 | } |
| 621 | |
| 622 | for( int i = 0; i < m_blockSize; i++ ) |
| 623 | { |
| 624 | if( (*block)[i] != -1 ) |
| 625 | { |
| 626 | (*block)[i] = m_numIdsUsed; |
| 627 | m_numIdsUsed++; |
| 628 | } |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | for( int &id : m_newIndices ) |
| 633 | { |
| 634 | int blockId = id / m_blockSize; |
| 635 | int subIndex = id % m_blockSize; |
| 636 | |
| 637 | id = (*m_fromOldIds[ blockId ])[subIndex]; |
| 638 | } |
| 639 | } |
| 640 | |
| 641 | // IntVectorData to hold the new indices |
| 642 | IntVectorDataPtr m_newIndicesData; |