Blender V4.3
blender::offset_indices::OffsetIndices< T > Class Template Reference

#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< Tdata () const

Detailed Description

template<typename T>
class blender::offset_indices::OffsetIndices< T >

References an array of ascending indices. A pair of consecutive indices encode an index range. Another common way to store the same kind of data is to store the start and size of every range separately. Using offsets instead halves the memory consumption. The downside is that the array has to be one element longer than the total number of ranges. The extra element is necessary to be able to get the last index range without requiring an extra branch for the case.

This class is a thin wrapper around such an array that makes it easy to retrieve the index range at a specific index.

Definition at line 29 of file BLI_offset_indices.hh.

Constructor & Destructor Documentation

◆ OffsetIndices() [1/3]

template<typename T>
blender::offset_indices::OffsetIndices< T >::OffsetIndices ( )
default

Referenced by slice().

◆ OffsetIndices() [2/3]

template<typename T>
blender::offset_indices::OffsetIndices< T >::OffsetIndices ( const Span< T > offsets)
inline

Definition at line 37 of file BLI_offset_indices.hh.

References BLI_assert.

◆ OffsetIndices() [3/3]

template<typename T>
blender::offset_indices::OffsetIndices< T >::OffsetIndices ( const Span< T > offsets,
NoSortCheck  )
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 47 of file BLI_offset_indices.hh.

Member Function Documentation

◆ data()

◆ index_range()

template<typename T>
IndexRange blender::offset_indices::OffsetIndices< T >::index_range ( ) const
inline

Definition at line 69 of file BLI_offset_indices.hh.

References size().

Referenced by blender::ed::greasepencil::apply_mask_as_segment_selection(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_to_curve_nurblist(), blender::offset_indices::build_reverse_map(), buildAdjacencyMap(), blender::geometry::calc_new_edges(), construct_param_handle_subsurfed(), blender::geometry::create_merged_mesh(), blender::draw::create_sculpt_cage_ibo(), curve_populate_trans_data_structs(), blender::deform_drawing(), blender::io::alembic::ABCCurveWriter::do_write(), ED_mesh_split_faces(), ED_mesh_uv_loop_reset_ex(), blender::ed::curves::subdivide::exec(), export_hair_curves(), export_hair_curves_motion(), blender::draw::fill_curve_offsets_vbos(), blender::draw::fill_points_position_time_vbo(), blender::bke::find_nearest_faces(), blender::nodes::node_geo_points_to_curves_cc::grouped_sort(), blender::nodes::node_geo_sort_elements_cc::grouped_sort(), blender::offset_indices::GroupedSpan< T >::index_range(), blender::ed::sculpt_paint::greasepencil::interpolate_between_curves(), blender::geometry::make_new_offset_indices(), blender::draw::mesh_is_single_material(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), blender::bke::offsets_contain_single_point(), blender::bke::mesh::reverse_group_indices_in_groups(), blender::bke::mesh::sort_small_groups(), blender::nodes::node_geo_duplicate_elements_cc::threaded_id_offset_copy(), timeline_cache_draw_geometry_nodes(), and blender::geometry::weld_poly_find_doubles().

◆ is_empty()

template<typename T>
bool blender::offset_indices::OffsetIndices< T >::is_empty ( ) const
inline

◆ operator[]() [1/2]

template<typename T>
IndexRange blender::offset_indices::OffsetIndices< T >::operator[] ( const IndexRange indices) const
inline

Definition at line 83 of file BLI_offset_indices.hh.

References blender::IndexRange::from_begin_end(), and indices.

◆ operator[]() [2/2]

template<typename T>
IndexRange blender::offset_indices::OffsetIndices< T >::operator[] ( const int64_t index) const
inline

Definition at line 74 of file BLI_offset_indices.hh.

References BLI_assert, and blender::IndexRange::from_begin_end().

◆ size()

template<typename T>
int64_t blender::offset_indices::OffsetIndices< T >::size ( ) const
inline

Return the number of ranges encoded by the offsets, not including the last value used internally.

Definition at line 59 of file BLI_offset_indices.hh.

Referenced by BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_object_data_transfer_ex(), blender::bke::mesh::build_vert_to_edge_map(), blender::geometry::compute_curve_trim_parameters(), blender::nodes::node_geo_interpolate_curves_cc::compute_points_per_curve_by_group(), blender::nodes::node_geo_input_spline_length_cc::construct_curve_point_count_gvarray(), blender::offset_indices::copy_group_sizes(), blender::geometry::create_merged_mesh(), blender::draw::create_sculpt_cage_ibo(), blender::nodes::node_geo_curve_fill_cc::do_cdt_with_mask(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_curves_CurveGeometry(), blender::geometry::execute_realize_mesh_task(), export_hair_curves(), blender::geometry::extend_curves(), blender::geometry::extend_curves_curved(), blender::io::grease_pencil::extend_curves_geometry(), blender::nodes::node_geo_extrude_mesh_cc::extrude_individual_mesh_faces(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::offset_indices::gather_group_sizes(), blender::offset_indices::gather_selected_offsets(), blender::ed::greasepencil::grease_pencil_clean_loose_exec(), index_range(), blender::ed::sculpt_paint::greasepencil::interpolate_between_curves(), is_empty(), blender::geometry::join_curves_ranges(), blender::geometry::make_new_offset_indices(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), blender::point_counts_to_keep_concurrent(), blender::points_info_sequential(), blender::geometry::poly_find_doubles(), blender::geometry::resample_to_uniform(), blender::bke::mesh::reverse_group_indices_in_groups(), blender::bke::mesh::reverse_indices_in_groups(), blender::nodes::node_geo_scale_elements_cc::reverse_indices_in_groups(), blender::offset_indices::GroupedSpan< T >::size(), blender::offset_indices::sum_group_sizes(), blender::offset_indices::sum_group_sizes(), blender::ed::curves::convert_to_particle_system::try_convert_single_object(), and blender::geometry::weld_poly_find_doubles().

◆ slice()

template<typename T>
OffsetIndices blender::offset_indices::OffsetIndices< T >::slice ( const IndexRange range) const
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 95 of file BLI_offset_indices.hh.

References BLI_assert, blender::IndexRange::is_empty(), blender::IndexRange::last(), OffsetIndices(), blender::IndexRange::size(), and blender::IndexRange::start().

Referenced by blender::ed::curves::duplicate_curves(), and blender::geometry::resample_to_evaluated().

◆ total_size()

template<typename T>
T blender::offset_indices::OffsetIndices< T >::total_size ( ) const
inline

Return the total number of elements in the referenced arrays.

Definition at line 50 of file BLI_offset_indices.hh.

References T.

Referenced by blender::bke::mesh::build_vert_to_edge_map(), blender::draw::calc_edit_handles_ibo(), blender::geometry::calc_new_edges(), blender::bke::curves::bezier::calculate_evaluated_positions(), blender::geometry::curve_constraints::compute_segment_lengths(), blender::draw::create_edit_lines_ibo(), blender::draw::create_edit_points_position_and_data(), blender::draw::create_edit_points_selection(), blender::create_envelope_strokes(), blender::draw::create_sculpt_cage_ibo(), blender::ed::transform::curves::createTransCurvesVerts(), blender::ed::transform::greasepencil::createTransGreasePencilVerts(), blender::draw::curve_eval_render_wire_verts_edges_len_get(), blender::bke::curves_copy_curve_selection(), blender::nodes::node_geo_curve_fill_cc::do_cdt_with_mask(), blender::ed::curves::duplicate_curves(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_edges(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_instances(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_layers(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_CurvesGeometry(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_mesh(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_pointcloud(), blender::bke::CurvesGeometry::evaluated_points_num(), blender::geometry::execute_instances_tasks(), blender::io::grease_pencil::extend_curves_geometry(), blender::nodes::node_geo_extrude_mesh_cc::extrude_individual_mesh_faces(), blender::ed::greasepencil::find_curve_segments(), blender::offset_indices::GroupedSpan< T >::GroupedSpan(), blender::ed::sculpt_paint::greasepencil::interpolate_between_curves(), blender::bke::curves::bezier::interpolate_to_evaluated(), blender::geometry::join_instances(), blender::bke::mesh_calc_edges(), blender::geometry::mesh_copy_selection(), blender::geometry::mesh_copy_selection_keep_edges(), blender::geometry::mesh_copy_selection_keep_verts(), blender::geometry::offsets_to_map(), blender::ed::sculpt_paint::greasepencil::CloneOperation::on_stroke_begin(), blender::points_info_sequential(), blender::geometry::reorder_customdata_groups(), blender::ed::sculpt_paint::mask::sculpt_mask_filter_exec(), blender::geometry::smooth_curve_attribute(), blender::geometry::curve_constraints::solve_length_constraints(), blender::bke::greasepencil::Drawing::tag_topology_changed(), and blender::nodes::node_geo_duplicate_elements_cc::threaded_id_offset_copy().


The documentation for this class was generated from the following file: