Blender V5.0
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 >

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.

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 42 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 52 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 74 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(), blender::ed::curves::compress_intervals(), construct_param_handle_subsurfed(), blender::geometry::create_merged_mesh(), blender::ed::transform::curves::curve_populate_trans_data_structs(), blender::deform_drawing(), blender::io::alembic::ABCCurveWriter::do_write(), ED_mesh_split_faces(), blender::ed::curves::subdivide::exec(), export_hair_curves(), export_hair_curves_motion(), 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(), blender::geometry::mesh_triangulate(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), blender::bke::offsets_contain_single_point(), blender::io::usd::USDNurbsReader::read_curve_sample(), blender::bke::mesh::reverse_group_indices_in_groups(), blender::bke::compare_geometry::sort_curves(), blender::bke::mesh::sort_small_groups(), blender::bke::tests::TEST(), blender::index_mask::tests::TEST(), 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 88 of file BLI_offset_indices.hh.

References begin(), 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 79 of file BLI_offset_indices.hh.

References begin(), 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 64 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::ed::curves::compress_intervals(), 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::bke::copy_attributes_group_to_group(), blender::offset_indices::copy_group_sizes(), blender::draw::create_lines_ibo_no_cyclic(), blender::draw::create_lines_ibo_with_cyclic(), blender::geometry::create_merged_mesh(), 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_curve_curved(), blender::geometry::extend_curves(), blender::io::grease_pencil::extend_curves_geometry(), blender::draw::extract_edituv_tris_mesh(), blender::ed::curves::pen_tool::extrude_curves(), blender::ed::greasepencil::extrude_grease_pencil_curves(), 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::geometry::face_tris_mask(), blender::bke::curves::foreach_selected_point_ranges_per_curve_(), blender::bke::gather_attributes_group_to_group(), blender::offset_indices::gather_group_sizes(), blender::geometry::gather_selected_offsets(), blender::offset_indices::gather_selected_offsets(), blender::bke::mesh::MeshToTangentQuadsTris::GetNumFaces(), blender::ed::greasepencil::grease_pencil_clean_loose_exec(), index_range(), blender::ed::curves::pen_tool::insert_point_to_curve(), blender::ed::sculpt_paint::greasepencil::interpolate_between_curves(), is_empty(), blender::geometry::join_curves_ranges(), blender::geometry::make_new_offset_indices(), blender::geometry::mesh_triangulate(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), blender::geometry::ngon_indices_of_tris(), blender::point_counts_to_keep_concurrent(), blender::points_info_sequential(), blender::geometry::poly_find_doubles(), blender::geometry::resample_to_uniform(), blender::ed::greasepencil::resize_single_curve(), 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::bke::compare_geometry::sort_curves(), blender::offset_indices::sum_group_sizes(), blender::offset_indices::sum_group_sizes(), blender::ed::curves::convert_to_particle_system::try_convert_single_object(), update_custom_knots(), 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 100 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(), blender::geometry::face_tris_mask(), 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 55 of file BLI_offset_indices.hh.

References T.

Referenced by blender::bke::mesh::build_vert_to_edge_map(), blender::geometry::ngon::calc_corner_tris(), 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::bke::copy_attributes_group_to_group(), blender::draw::create_edit_points_data(), blender::draw::create_edit_points_selection(), blender::create_envelope_strokes(), blender::draw::create_lines_ibo_no_cyclic(), blender::draw::create_lines_ibo_with_cyclic(), blender::geometry::create_point_to_vert_map(), 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::draw::extract_edituv_tris_mesh(), blender::nodes::node_geo_extrude_mesh_cc::extrude_individual_mesh_faces(), blender::geometry::face_tris_mask(), blender::ed::greasepencil::find_curve_segments(), blender::io::csv::flatten_valid_attribute_chunks(), blender::offset_indices::GroupedSpan< T >::GroupedSpan(), blender::draw::handle_range_left(), blender::draw::handle_range_right(), blender::draw::handles_and_points_num(), blender::ed::sculpt_paint::greasepencil::interpolate_between_curves(), blender::bke::curves::bezier::interpolate_to_evaluated(), blender::geometry::join_instances(), blender::ed::mesh::join_objects_exec(), blender::ed::mesh::join_shape_keys(), blender::bke::calc_edges::mask_first_distinct_edges(), 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::mesh_triangulate(), blender::geometry::ngon_indices_of_tris(), blender::bke::CurvesGeometry::nurbs_custom_knots_update_size(), 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: