Blender V4.3
blender::array_utils Namespace Reference

Enumerations

enum class  BooleanMix { None , AllFalse , AllTrue , Mixed }
 

Functions

void copy (const GVArray &src, GMutableSpan dst, int64_t grain_size=4096)
 
template<typename T >
void copy (const VArray< T > &src, MutableSpan< T > dst, const int64_t grain_size=4096)
 
template<typename T >
void copy (const Span< T > src, MutableSpan< T > dst, const int64_t grain_size=4096)
 
void copy (const GVArray &src, const IndexMask &selection, GMutableSpan dst, int64_t grain_size=4096)
 
template<typename T >
void copy (const Span< T > src, const IndexMask &selection, MutableSpan< T > dst, const int64_t grain_size=4096)
 
template<typename T , typename IndexT >
void scatter (const Span< T > src, const Span< IndexT > indices, MutableSpan< T > dst, const int64_t grain_size=4096)
 
template<typename T >
void scatter (const Span< T > src, const IndexMask &indices, MutableSpan< T > dst, const int64_t grain_size=4096)
 
void gather (const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
 
void gather (GSpan src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
 
template<typename T >
void gather (const VArray< T > &src, const IndexMask &indices, MutableSpan< T > dst, const int64_t grain_size=4096)
 
template<typename T , typename IndexT >
void gather (const Span< T > src, const IndexMask &indices, MutableSpan< T > dst, const int64_t grain_size=4096)
 
template<typename T , typename IndexT >
void gather (const Span< T > src, const Span< IndexT > indices, MutableSpan< T > dst, const int64_t grain_size=4096)
 
template<typename T , typename IndexT >
void gather (const VArray< T > &src, const Span< IndexT > indices, MutableSpan< T > dst, const int64_t grain_size=4096)
 
template<typename T >
void gather_group_to_group (const OffsetIndices< int > src_offsets, const OffsetIndices< int > dst_offsets, const IndexMask &selection, const Span< T > src, MutableSpan< T > dst)
 
template<typename T >
void gather_group_to_group (const OffsetIndices< int > src_offsets, const OffsetIndices< int > dst_offsets, const IndexMask &selection, const VArray< T > src, MutableSpan< T > dst)
 
template<typename T >
void gather_to_groups (const OffsetIndices< int > dst_offsets, const IndexMask &src_selection, const Span< T > src, MutableSpan< T > dst)
 
void copy_group_to_group (OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, GSpan src, GMutableSpan dst)
 
template<typename T >
void copy_group_to_group (OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, Span< T > src, MutableSpan< T > dst)
 
void count_indices (Span< int > indices, MutableSpan< int > counts)
 
void invert_booleans (MutableSpan< bool > span)
 
void invert_booleans (MutableSpan< bool > span, const IndexMask &mask)
 
int64_t count_booleans (const VArray< bool > &varray)
 
int64_t count_booleans (const VArray< bool > &varray, const IndexMask &mask)
 
BooleanMix booleans_mix_calc (const VArray< bool > &varray, IndexRange range_to_check)
 
BooleanMix booleans_mix_calc (const VArray< bool > &varray)
 
template<typename T >
Vector< IndexRangefind_all_ranges (const Span< T > span, const T &value)
 
template<typename T >
void fill_index_range (MutableSpan< T > span, const T start=0)
 
template<typename T >
bool indexed_data_equal (const Span< T > all_values, const Span< int > indices, const Span< T > values)
 
bool indices_are_range (Span< int > indices, IndexRange range)
 
static bool all_equal (const Span< bool > span, const bool test)
 
static bool all_equal (const VArray< bool > &varray, const IndexRange range, const bool test)
 

Enumeration Type Documentation

◆ BooleanMix

Enumerator
None 
AllFalse 
AllTrue 
Mixed 

Definition at line 252 of file BLI_array_utils.hh.

Function Documentation

◆ all_equal() [1/2]

static bool blender::array_utils::all_equal ( const Span< bool > span,
const bool test )
static

◆ all_equal() [2/2]

static bool blender::array_utils::all_equal ( const VArray< bool > & varray,
const IndexRange range,
const bool test )
static

Definition at line 100 of file array_utils.cc.

References all_equal().

◆ booleans_mix_calc() [1/2]

BooleanMix blender::array_utils::booleans_mix_calc ( const VArray< bool > & varray)
inline

◆ booleans_mix_calc() [2/2]

◆ copy() [1/5]

void blender::array_utils::copy ( const GVArray & src,
const IndexMask & selection,
GMutableSpan dst,
int64_t grain_size = 4096 )

Fill the destination span by copying masked values from the src array. Threaded based on grain-size.

Definition at line 23 of file array_utils.cc.

References BLI_assert, blender::threading::parallel_for(), blender::GMutableSpan::size(), blender::GVArrayCommon::size(), blender::GMutableSpan::type(), and blender::GVArrayCommon::type().

◆ copy() [2/5]

◆ copy() [3/5]

template<typename T >
void blender::array_utils::copy ( const Span< T > src,
const IndexMask & selection,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

Fill the destination span by copying values from the src array. Threaded based on grain-size.

Definition at line 59 of file BLI_array_utils.hh.

References BLI_assert, blender::MutableSpan< T >::size(), and blender::Span< T >::size().

◆ copy() [4/5]

template<typename T >
void blender::array_utils::copy ( const Span< T > src,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

Fill the destination span by copying all values from the src array. Threaded based on grain-size.

Definition at line 37 of file BLI_array_utils.hh.

References BLI_assert, blender::Span< T >::index_range(), blender::threading::parallel_for(), blender::MutableSpan< T >::size(), and blender::Span< T >::size().

◆ copy() [5/5]

template<typename T >
void blender::array_utils::copy ( const VArray< T > & src,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

◆ copy_group_to_group() [1/2]

void blender::array_utils::copy_group_to_group ( OffsetIndices< int > src_offsets,
OffsetIndices< int > dst_offsets,
const IndexMask & selection,
GSpan src,
GMutableSpan dst )

Copy the src data from the groups defined by src_offsets to the groups in dst defined by dst_offsets. Groups to use are masked by selection, and it is assumed that the corresponding groups have the same size.

Definition at line 53 of file array_utils.cc.

References blender::GMutableSpan::slice(), and blender::GSpan::slice().

Referenced by blender::geometry::convert_curves_to_bezier(), blender::geometry::convert_curves_to_catmull_rom_or_poly(), blender::geometry::convert_curves_to_nurbs(), blender::bke::copy_attributes_group_to_group(), copy_group_to_group(), blender::geometry::copy_or_defaults_for_unselected_curves(), blender::bke::CurvesGeometry::evaluated_positions(), and blender::ed::curves::resize_curves().

◆ copy_group_to_group() [2/2]

template<typename T >
void blender::array_utils::copy_group_to_group ( OffsetIndices< int > src_offsets,
OffsetIndices< int > dst_offsets,
const IndexMask & selection,
Span< T > src,
MutableSpan< T > dst )

Definition at line 227 of file BLI_array_utils.hh.

References copy_group_to_group().

◆ count_booleans() [1/2]

int64_t blender::array_utils::count_booleans ( const VArray< bool > & varray)

◆ count_booleans() [2/2]

◆ count_indices()

◆ fill_index_range()

template<typename T >
void blender::array_utils::fill_index_range ( MutableSpan< T > span,
const T start = 0 )
inline

◆ find_all_ranges()

template<typename T >
Vector< IndexRange > blender::array_utils::find_all_ranges ( const Span< T > span,
const T & value )
inline

◆ gather() [1/6]

void blender::array_utils::gather ( const GVArray & src,
const IndexMask & indices,
GMutableSpan dst,
int64_t grain_size = 4096 )

Fill the destination span by gathering indexed values from the src array.

Definition at line 36 of file array_utils.cc.

References BLI_assert, blender::threading::parallel_for(), blender::GMutableSpan::size(), blender::GMutableSpan::type(), and blender::GVArrayCommon::type().

Referenced by blender::nodes::node_geo_duplicate_elements_cc::accumulate_counts_to_offsets(), blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::ed::transform::curves::append_positions_to_custom_data(), blender::ed::sculpt_paint::greasepencil::brush_point_influence_mask(), blender::nodes::node_geo_instances_to_points_cc::convert_instances_to_points(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curve_instances_to_grease_pencil_layers(), blender::bke::curves_copy_point_selection(), blender::ed::curves::duplicate_curves(), blender::draw::extract_data_mesh_mapped_corner(), blender::draw::extract_vert_index_mesh(), blender::draw::extract_vert_normals_mesh(), gather(), blender::bke::gather_attributes(), blender::io::hydra::gather_vert_data(), blender::nodes::node_geo_mesh_to_points_cc::geometry_set_mesh_to_points(), blender::nodes::node_geo_points_to_vertices_cc::geometry_set_points_to_vertices(), blender::draw::grease_pencil_cache_add_nurbs(), blender::draw::grease_pencil_edit_batch_ensure(), blender::ed::sculpt_paint::grease_pencil_fill_extension_lines_from_circles(), blender::geometry::mesh_to_curve_convert(), blender::nodes::node_geo_attribute_statistic_cc::node_geo_exec(), blender::nodes::node_geo_grease_pencil_to_curves_cc::node_geo_exec(), blender::bke::mesh::normals_calc_corners(), blender::geometry::propagate_edge_attributes(), blender::geometry::propagate_vert_attributes(), blender::ed::sculpt_paint::expand::spherical_falloff_create(), blender::io::obj::OBJMesh::store_normal_coords_and_indices(), blender::ed::sculpt_paint::boundary::twist_data_init_grids(), and blender::ed::sculpt_paint::boundary::twist_data_init_mesh().

◆ gather() [2/6]

template<typename T , typename IndexT >
void blender::array_utils::gather ( const Span< T > src,
const IndexMask & indices,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

Fill the destination span by gathering indexed values from the src array.

Definition at line 131 of file BLI_array_utils.hh.

References BLI_assert, and blender::MutableSpan< T >::size().

◆ gather() [3/6]

template<typename T , typename IndexT >
void blender::array_utils::gather ( const Span< T > src,
const Span< IndexT > indices,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

Fill the destination span by gathering indexed values from the src array.

Definition at line 149 of file BLI_array_utils.hh.

References BLI_assert, and blender::MutableSpan< T >::size().

◆ gather() [4/6]

template<typename T >
void blender::array_utils::gather ( const VArray< T > & src,
const IndexMask & indices,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

Fill the destination span by gathering indexed values from the src array.

Definition at line 116 of file BLI_array_utils.hh.

References BLI_assert, and blender::MutableSpan< T >::size().

◆ gather() [5/6]

template<typename T , typename IndexT >
void blender::array_utils::gather ( const VArray< T > & src,
const Span< IndexT > indices,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

Fill the destination span by gathering indexed values from the src array.

Definition at line 166 of file BLI_array_utils.hh.

References BLI_assert, blender::devirtualize_varray(), and blender::MutableSpan< T >::size().

◆ gather() [6/6]

void blender::array_utils::gather ( GSpan src,
const IndexMask & indices,
GMutableSpan dst,
int64_t grain_size = 4096 )

Fill the destination span by gathering indexed values from the src array.

Definition at line 48 of file array_utils.cc.

References blender::GVArray::ForSpan(), and gather().

◆ gather_group_to_group() [1/2]

template<typename T >
void blender::array_utils::gather_group_to_group ( const OffsetIndices< int > src_offsets,
const OffsetIndices< int > dst_offsets,
const IndexMask & selection,
const Span< T > src,
MutableSpan< T > dst )
inline

◆ gather_group_to_group() [2/2]

template<typename T >
void blender::array_utils::gather_group_to_group ( const OffsetIndices< int > src_offsets,
const OffsetIndices< int > dst_offsets,
const IndexMask & selection,
const VArray< T > src,
MutableSpan< T > dst )
inline

◆ gather_to_groups()

template<typename T >
void blender::array_utils::gather_to_groups ( const OffsetIndices< int > dst_offsets,
const IndexMask & src_selection,
const Span< T > src,
MutableSpan< T > dst )
inline

◆ indexed_data_equal()

template<typename T >
bool blender::array_utils::indexed_data_equal ( const Span< T > all_values,
const Span< int > indices,
const Span< T > values )

◆ indices_are_range()

bool blender::array_utils::indices_are_range ( Span< int > indices,
IndexRange range )

◆ invert_booleans() [1/2]

void blender::array_utils::invert_booleans ( MutableSpan< bool > span)

◆ invert_booleans() [2/2]

void blender::array_utils::invert_booleans ( MutableSpan< bool > span,
const IndexMask & mask )

Definition at line 90 of file array_utils.cc.

References invert_booleans().

◆ scatter() [1/2]

template<typename T >
void blender::array_utils::scatter ( const Span< T > src,
const IndexMask & indices,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

◆ scatter() [2/2]

template<typename T , typename IndexT >
void blender::array_utils::scatter ( const Span< T > src,
const Span< IndexT > indices,
MutableSpan< T > dst,
const int64_t grain_size = 4096 )
inline

Fill the specified indices of the destination with the values in the source span.

Definition at line 73 of file BLI_array_utils.hh.

References BLI_assert, blender::threading::parallel_for(), and blender::Span< T >::size().

Referenced by blender::ed::curves::resize_curves(), and scatter().