Skip to content
  • Mark OLESEN's avatar
    ENH: globalIndex and CompactListList improvements · cfb75264
    Mark OLESEN authored
    - provide a globalIndex::calcOffsets() taking an indirect list, which
      enables convenient offsets calculation from a variety of inputs.
    
    - new CompactListList unpack variant: copy_unpack()
      The copy_unpack() works somewhat like std::copy() in that it writes
      the generated sublists to iterator positions, which makes this
      type of code possible:
    
          CompactListList<label> compact = ...;
          DynamicList<face> extracted;
    
          compact.copy_unpack<face>
          (
              std::back_inserter(extracted),
              labelRange(4, 10)
          );
    
      -and-
    
          const label nOldFaces = allFaces.size();
          allFaces.resize(allFaces + nNewFaces);
    
          auto iter = allFaces.begin(nOldFaces);
    
          iter = compact.copy_unpack<face>(iter, /* selection 1 */);
          ...
          iter = compact.copy_unpack<face>(iter, /* selection 2 */);
    
    ENH: globalIndex resize()
    
    - can be used to shrink or grow the offsets table.
      Any extension of the offsets table corresponds to 'slots'
      with 0 local size.
    cfb75264