diff options
author | Jacques Lucke <mail@jlucke.com> | 2020-01-02 17:22:20 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2020-01-02 17:22:20 +0300 |
commit | 30b50638a03ff29b342d9d42c28c94fba5fe422b (patch) | |
tree | a5e07125b31b657a8379358d9dd97408feaf6d24 /source/blender/simulations | |
parent | 25fc970f445f7e4407a9f1568f74a6348157e3ff (diff) |
rename index_iterator to index_range
Diffstat (limited to 'source/blender/simulations')
5 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp b/source/blender/simulations/bparticles/c_wrapper.cpp index b48ecd90a2d..8b84e055a0f 100644 --- a/source/blender/simulations/bparticles/c_wrapper.cpp +++ b/source/blender/simulations/bparticles/c_wrapper.cpp @@ -310,7 +310,7 @@ void BParticles_modifier_cache_state(BParticlesModifierData *bpmd, cached_frame.particle_types = (BParticlesTypeCache *)MEM_calloc_arrayN( particle_sets.size(), sizeof(BParticlesTypeCache), __func__); - for (uint i : particle_sets.index_iterator()) { + for (uint i : particle_sets.index_range()) { ParticleSet &particles = *particle_sets[i]; BParticlesTypeCache &cached_type = cached_frame.particle_types[i]; diff --git a/source/blender/simulations/bparticles/emitters.cpp b/source/blender/simulations/bparticles/emitters.cpp index 763dfb1da69..3f0004751fd 100644 --- a/source/blender/simulations/bparticles/emitters.cpp +++ b/source/blender/simulations/bparticles/emitters.cpp @@ -71,7 +71,7 @@ static BLI_NOINLINE void get_average_triangle_weights(const Mesh *mesh, ArrayRef<float> vertex_weights, MutableArrayRef<float> r_looptri_weights) { - for (uint triangle_index : looptris.index_iterator()) { + for (uint triangle_index : looptris.index_range()) { const MLoopTri &looptri = looptris[triangle_index]; float triangle_weight = 0.0f; for (uint i = 0; i < 3; i++) { @@ -93,7 +93,7 @@ static BLI_NOINLINE void compute_cumulative_distribution( BLI_assert(weights.size() + 1 == r_cumulative_weights.size()); r_cumulative_weights[0] = 0; - for (uint i : weights.index_iterator()) { + for (uint i : weights.index_range()) { r_cumulative_weights[i + 1] = r_cumulative_weights[i] + weights[i]; } } @@ -168,7 +168,7 @@ static BLI_NOINLINE void compute_triangle_areas(Mesh *mesh, { BLI_assert(triangles.size() == r_areas.size()); - for (uint i : triangles.index_iterator()) { + for (uint i : triangles.index_range()) { const MLoopTri &triangle = triangles[i]; float3 v1 = mesh->mvert[mesh->mloop[triangle.tri[0]].v].co; @@ -210,7 +210,7 @@ static BLI_NOINLINE void sample_looptris(Mesh *mesh, MLoop *loops = mesh->mloop; MVert *verts = mesh->mvert; - for (uint i : triangles_to_sample.index_iterator()) { + for (uint i : triangles_to_sample.index_range()) { uint triangle_index = triangles_to_sample[i]; const MLoopTri &triangle = triangles[triangle_index]; @@ -268,7 +268,7 @@ void SurfaceEmitter::emit(EmitterInterface &interface) LargeScopedArray<float> triangle_areas(triangles.size()); compute_triangle_areas(mesh, triangles, triangle_areas); - for (uint i : triangles.index_iterator()) { + for (uint i : triangles.index_range()) { triangle_weights[i] *= triangle_areas[i]; } diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp index 9b24ad2afa9..97a12ff393b 100644 --- a/source/blender/simulations/bparticles/node_frontend.cpp +++ b/source/blender/simulations/bparticles/node_frontend.cpp @@ -208,7 +208,7 @@ class FunctionTreeData { Optional<NamedGenericTupleRef> compute_all_data_inputs(const FNode &fnode) { ScopedVector<uint> data_input_indices; - for (uint i : fnode.inputs().index_iterator()) { + for (uint i : fnode.inputs().index_range()) { if (m_function_tree_data_graph.is_mapped(fnode.input(i))) { data_input_indices.append(i); } diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp index 60146f4d095..2df31c3bb9e 100644 --- a/source/blender/simulations/bparticles/simulate.cpp +++ b/source/blender/simulations/bparticles/simulate.cpp @@ -27,7 +27,7 @@ BLI_NOINLINE static void find_next_event_per_particle( r_next_event_indices.fill_indices(mask, -1); r_time_factors_to_next_event.fill_indices(mask, 1.0f); - for (uint event_index : events.index_iterator()) { + for (uint event_index : events.index_range()) { Vector<uint> triggered_pindices; Vector<float> triggered_time_factors; @@ -36,7 +36,7 @@ BLI_NOINLINE static void find_next_event_per_particle( step_data, mask, r_time_factors_to_next_event, triggered_pindices, triggered_time_factors); event->filter(interface); - for (uint i : triggered_pindices.index_iterator()) { + for (uint i : triggered_pindices.index_range()) { uint pindex = triggered_pindices[i]; float time_factor = triggered_time_factors[i]; BLI_assert(time_factor <= r_time_factors_to_next_event[pindex]); @@ -153,7 +153,7 @@ BLI_NOINLINE static void execute_events(BlockStepData &step_data, { BLI_assert(events.size() == pindices_per_event.size()); - for (uint event_index : events.index_iterator()) { + for (uint event_index : events.index_range()) { Event *event = events[event_index]; ArrayRef<uint> pindices = pindices_per_event[event_index]; @@ -333,7 +333,7 @@ BLI_NOINLINE static void delete_tagged_particles_and_reorder(ParticleSet &partic auto kill_states = particles.attributes().get<bool>("Dead"); LargeScopedVector<uint> indices_to_delete; - for (uint i : kill_states.index_iterator()) { + for (uint i : kill_states.index_range()) { if (kill_states[i]) { indices_to_delete.append(i); } @@ -372,7 +372,7 @@ BLI_NOINLINE static void simulate_particles_from_birth_to_end_of_step( ArrayRef<float> birth_times = all_birth_times.slice(range); Array<float> remaining_durations(range.size()); - for (uint i : remaining_durations.index_iterator()) { + for (uint i : remaining_durations.index_range()) { remaining_durations[i] = end_time - birth_times[i]; } @@ -400,7 +400,7 @@ BLI_NOINLINE static void simulate_existing_particles( particles_vector.append(particles); }); - BLI::parallel_for(name_vector.index_iterator(), [&](uint index) { + BLI::parallel_for(name_vector.index_range(), [&](uint index) { ParticleSystemInfo *system_info = systems_to_simulate.lookup_ptr(name_vector[index]); ParticleSet *particles = particles_vector[index]; if (system_info == nullptr) { @@ -420,7 +420,7 @@ BLI_NOINLINE static void create_particles_from_emitters(SimulationState &simulat ArrayRef<Emitter *> emitters, FloatInterval time_span) { - BLI::parallel_for(emitters.index_iterator(), [&](uint emitter_index) { + BLI::parallel_for(emitters.index_range(), [&](uint emitter_index) { Emitter &emitter = *emitters[emitter_index]; EmitterInterface interface(simulation_state, particle_allocator, time_span); emitter.emit(interface); @@ -484,7 +484,7 @@ void simulate_particles(SimulationState &simulation_state, particle_sets_vector.append(new_particle_sets); }); - BLI::parallel_for(main_sets.index_iterator(), [&](uint index) { + BLI::parallel_for(main_sets.index_range(), [&](uint index) { ParticleSet &main_set = *main_sets[index]; ArrayRef<ParticleSet *> particle_sets = particle_sets_vector[index]; diff --git a/source/blender/simulations/bparticles/world_state.hpp b/source/blender/simulations/bparticles/world_state.hpp index 6b842700421..01b4c29d81b 100644 --- a/source/blender/simulations/bparticles/world_state.hpp +++ b/source/blender/simulations/bparticles/world_state.hpp @@ -50,7 +50,7 @@ struct VaryingFloat4x4 { MutableArrayRef<float4x4> r_results) const { BLI_assert(times.size() == r_results.size()); - for (uint i : times.index_iterator()) { + for (uint i : times.index_range()) { r_results[i] = this->interpolate(times[i] + time_offset); } } |