23 src.materialize_to_uninitialized(range, dst.data());
36 src.materialize_to_uninitialized(selection.slice(range), dst.data());
48 src.materialize_compressed_to_uninitialized(indices.slice(range), dst.slice(range).data());
78 for (const int i : indices.slice(range)) {
79 atomic_add_and_fetch_int32(&counts[i], 1);
88 for (const int i : range) {
101 return std::all_of(span.
begin(), span.
end(), [&](
const bool value) { return value == test; });
107 range.
begin(), range.
end(), [&](
const int64_t i) { return varray[i] == test; });
167 return *
static_cast<const bool *
>(info.
data) ? varray.
size() : 0;
176 const Span<bool> slice = span.slice(range);
177 return init + std::count(slice.begin(), slice.end(), true);
186 int64_t value = init;
188 for (const int64_t i : range) {
189 value += int64_t(varray[i]);
197 return *
static_cast<const bool *
>(info.
data) ?
mask.size() : 0;
200 mask.foreach_segment([&](
const IndexMaskSegment segment) {
212 return *
static_cast<const bool *
>(info.
data) == value;
225 if (std::optional<IndexRange> range = sliced_mask.to_range()) {
226 return span.slice(*range).contains(value);
229 const IndexMaskSegment segment = sliced_mask.segment(segment_i);
230 for (const int i : segment) {
231 if (span[i] == value) {
240 return threading::parallel_reduce(
241 indices_to_check.index_range(),
248 constexpr int64_t MaxChunkSize = 512;
250 for (
int64_t start = range.
start(); start < slice_end; start += MaxChunkSize) {
251 const int64_t end = std::min<int64_t>(start + MaxChunkSize, slice_end);
252 const int64_t size = end - start;
253 const IndexMask sliced_mask = indices_to_check.slice(start, size);
254 std::array<bool, MaxChunkSize> values;
255 auto values_end = values.begin() + size;
256 varray.materialize_compressed(sliced_mask, values);
257 if (std::find(values.begin(), values_end, value) != values_end) {
280 [&](
const IndexRange part,
const bool is_range) {
281 const Span<int> local_indices = indices.slice(part);
282 const IndexRange local_range = range.slice(part);
284 std::equal(local_indices.begin(), local_indices.end(), local_range.begin());
286 std::logical_and<>());
int BLI_system_thread_count(void)
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
constexpr int64_t one_after_last() const
constexpr int64_t start() const
void copy_from(GSpan values)
GMutableSpan slice(const int64_t start, int64_t size) const
const CPPType & type() const
GSpan slice(const int64_t start, int64_t size) const
const CPPType & type() const
IndexRange index_range() const
static GVArray from_span(GSpan span)
constexpr int64_t first() const
constexpr Iterator end() const
constexpr int64_t size() const
constexpr Iterator begin() const
constexpr IndexRange index_range() const
constexpr IndexRange index_range() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr const T & first() const
constexpr const T * end() const
constexpr const T * begin() const
IndexRange index_range() const
CommonVArrayInfo common_info() const
IndexMask slice(IndexRange range) const
int64_t min_array_size() const
IndexRange index_range() const
void foreach_index(Fn &&fn) const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void invert_booleans(MutableSpan< bool > span)
void count_indices(Span< int > indices, MutableSpan< int > counts)
void copy(const GVArray &src, GMutableSpan dst, int64_t grain_size=4096)
bool indices_are_range(Span< int > indices, IndexRange range)
void copy_group_to_group(OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, GSpan src, GMutableSpan dst)
BooleanMix booleans_mix_calc(const VArray< bool > &varray, IndexRange range_to_check)
bool contains(const VArray< bool > &varray, const IndexMask &indices_to_check, bool value)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
static bool all_equal(const Span< bool > span, const bool test)
int64_t count_booleans(const VArray< bool > &varray)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
static void init(bNodeTree *, bNode *node)