|
Blender V5.0
|
#include <BLI_offset_indices.hh>
Public Member Functions | |
| OffsetIndices ()=default | |
| OffsetIndices (const Span< T > offsets) | |
| OffsetIndices (const Span< T > offsets, NoSortCheck) | |
| T | total_size () const |
| int64_t | size () const |
| bool | is_empty () const |
| IndexRange | index_range () const |
| IndexRange | operator[] (const int64_t index) const |
| IndexRange | operator[] (const IndexRange indices) const |
| OffsetIndices | slice (const IndexRange range) const |
| Span< T > | data () const |
This class is a thin wrapper around an array of increasing indices that makes it easy to retrieve an index range at a specific index. Each index range is typically a representation of a contiguous chunk of a larger array.
Another common way to store many index ranges is to store the start and size of every range. Using OffsetIndices instead requires that chunks are ordered consecutively but halves the memory consumption. Another downside is that the underlying array has to be one element longer than the total number of ranges. The extra element necessary to encode the size of the last range without requiring a branch for each range access.
Definition at line 34 of file BLI_offset_indices.hh.
|
default |
|
inline |
Definition at line 42 of file BLI_offset_indices.hh.
|
inline |
Same as above, but skips the debug check that indices are sorted, because that can have a high performance impact making debug builds unusable for files that would be fine otherwise. This can be used when it is known that the indices are sorted already.
Definition at line 52 of file BLI_offset_indices.hh.
|
inline |
Definition at line 106 of file BLI_offset_indices.hh.
|
inline |
Definition at line 74 of file BLI_offset_indices.hh.
|
inline |
Definition at line 69 of file BLI_offset_indices.hh.
|
inline |
Definition at line 88 of file BLI_offset_indices.hh.
|
inline |
Definition at line 79 of file BLI_offset_indices.hh.
|
inline |
Return the number of ranges encoded by the offsets, not including the last value used internally.
Definition at line 64 of file BLI_offset_indices.hh.
|
inline |
Return a subset of the offsets describing the specified range of source elements. This is a slice into the source ranges rather than the indexed elements described by the offset values.
Definition at line 100 of file BLI_offset_indices.hh.
|
inline |
Return the total number of elements in the referenced arrays.
Definition at line 55 of file BLI_offset_indices.hh.
Referenced by blender::bke::mesh::normals_calc_corners().