[Bf-blender-cvs] [d7fd4ed39ce] functions: rename particle_indices to pindices

Jacques Lucke noreply at git.blender.org
Wed Jul 10 17:18:20 CEST 2019


Commit: d7fd4ed39ce5d53412300e2860b9fe5465d2a13a
Author: Jacques Lucke
Date:   Wed Jul 10 16:30:45 2019 +0200
Branches: functions
https://developer.blender.org/rBd7fd4ed39ce5d53412300e2860b9fe5465d2a13a

rename particle_indices to pindices

===================================================================

M	source/blender/simulations/bparticles/action_interface.cpp
M	source/blender/simulations/bparticles/action_interface.hpp
M	source/blender/simulations/bparticles/core.cpp
M	source/blender/simulations/bparticles/core.hpp
M	source/blender/simulations/bparticles/simulate.cpp

===================================================================

diff --git a/source/blender/simulations/bparticles/action_interface.cpp b/source/blender/simulations/bparticles/action_interface.cpp
index 2fdc99c2eec..ac2b4bbe54d 100644
--- a/source/blender/simulations/bparticles/action_interface.cpp
+++ b/source/blender/simulations/bparticles/action_interface.cpp
@@ -10,13 +10,13 @@ void ActionInterface::execute_action_for_subset(ArrayRef<uint> indices,
                                                 std::unique_ptr<Action> &action)
 {
   SmallVector<float> sub_current_times;
-  SmallVector<uint> particle_indices;
+  SmallVector<uint> pindices;
   for (uint i : indices) {
-    particle_indices.append(m_particles.get_particle_index(i));
+    pindices.append(m_particles.get_particle_index(i));
     sub_current_times.append(m_current_times[i]);
   }
 
-  ParticleSet sub_particles(m_particles.block(), particle_indices);
+  ParticleSet sub_particles(m_particles.block(), pindices);
   ActionInterface sub_interface(m_particle_allocator,
                                 m_array_allocator,
                                 sub_particles,
diff --git a/source/blender/simulations/bparticles/action_interface.hpp b/source/blender/simulations/bparticles/action_interface.hpp
index d6483ae6568..992c765faa7 100644
--- a/source/blender/simulations/bparticles/action_interface.hpp
+++ b/source/blender/simulations/bparticles/action_interface.hpp
@@ -86,7 +86,7 @@ class ActionInterface {
   AttributeArrays attribute_offsets();
   float remaining_time_in_step(uint pindex);
   ArrayRef<float> current_times();
-  void kill(ArrayRef<uint> particle_indices);
+  void kill(ArrayRef<uint> pindices);
   void execute_action_for_subset(ArrayRef<uint> indices, std::unique_ptr<Action> &action);
   ParticleAllocator &particle_allocator();
   ArrayAllocator &array_allocator();
@@ -144,10 +144,10 @@ inline ArrayRef<float> ActionInterface::current_times()
   return m_current_times;
 }
 
-inline void ActionInterface::kill(ArrayRef<uint> particle_indices)
+inline void ActionInterface::kill(ArrayRef<uint> pindices)
 {
   auto kill_states = m_particles.attributes().get_byte("Kill State");
-  for (uint pindex : particle_indices) {
+  for (uint pindex : pindices) {
     kill_states[pindex] = 1;
   }
 }
diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index aa59051f4ae..b61a014d2e4 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -247,7 +247,7 @@ EventFilterInterface::EventFilterInterface(ParticleSet particles,
                                            float end_time,
                                            ArrayRef<float> known_min_time_factors,
                                            EventStorage &r_event_storage,
-                                           SmallVector<uint> &r_filtered_particle_indices,
+                                           SmallVector<uint> &r_filtered_pindices,
                                            SmallVector<float> &r_filtered_time_factors)
     : m_particles(particles),
       m_attribute_offsets(attribute_offsets),
@@ -255,7 +255,7 @@ EventFilterInterface::EventFilterInterface(ParticleSet particles,
       m_end_time(end_time),
       m_known_min_time_factors(known_min_time_factors),
       m_event_storage(r_event_storage),
-      m_filtered_particle_indices(r_filtered_particle_indices),
+      m_filtered_pindices(r_filtered_pindices),
       m_filtered_time_factors(r_filtered_time_factors)
 {
 }
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index b02b6b17f90..467ce20c49a 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -220,10 +220,10 @@ struct ParticleSet {
    * Invariants:
    *   - Every index must exist at most once.
    *   - The indices must be sorted. */
-  ArrayRef<uint> m_particle_indices;
+  ArrayRef<uint> m_pindices;
 
  public:
-  ParticleSet(ParticlesBlock &block, ArrayRef<uint> particle_indices);
+  ParticleSet(ParticlesBlock &block, ArrayRef<uint> pindices);
 
   /**
    * Return the block that contains the particles of this set.
@@ -402,7 +402,7 @@ class EventFilterInterface {
   ArrayRef<float> m_known_min_time_factors;
 
   EventStorage &m_event_storage;
-  SmallVector<uint> &m_filtered_particle_indices;
+  SmallVector<uint> &m_filtered_pindices;
   SmallVector<float> &m_filtered_time_factors;
 
   /* Size can be increased when necessary. */
@@ -415,7 +415,7 @@ class EventFilterInterface {
                        float end_time,
                        ArrayRef<float> known_min_time_factors,
                        EventStorage &r_event_storage,
-                       SmallVector<uint> &r_filtered_particle_indices,
+                       SmallVector<uint> &r_filtered_pindices,
                        SmallVector<float> &r_filtered_time_factors);
 
   /**
@@ -678,8 +678,8 @@ inline bool EmitterInterface::is_first_step()
 /* ParticleSet inline functions
  *******************************************/
 
-inline ParticleSet::ParticleSet(ParticlesBlock &block, ArrayRef<uint> particle_indices)
-    : m_block(&block), m_particle_indices(particle_indices)
+inline ParticleSet::ParticleSet(ParticlesBlock &block, ArrayRef<uint> pindices)
+    : m_block(&block), m_pindices(pindices)
 {
 }
 
@@ -695,33 +695,32 @@ inline AttributeArrays ParticleSet::attributes()
 
 inline ArrayRef<uint> ParticleSet::indices()
 {
-  return m_particle_indices;
+  return m_pindices;
 }
 
 inline uint ParticleSet::get_particle_index(uint i)
 {
-  return m_particle_indices[i];
+  return m_pindices[i];
 }
 
 inline Range<uint> ParticleSet::range()
 {
-  return Range<uint>(0, m_particle_indices.size());
+  return Range<uint>(0, m_pindices.size());
 }
 
 inline uint ParticleSet::size()
 {
-  return m_particle_indices.size();
+  return m_pindices.size();
 }
 
 inline bool ParticleSet::indices_are_trivial()
 {
-  if (m_particle_indices.size() == 0) {
+  if (m_pindices.size() == 0) {
     return true;
   }
   else {
     /* This works due to the invariants mentioned above. */
-    return m_particle_indices.first() == 0 &&
-           m_particle_indices.last() == m_particle_indices.size() - 1;
+    return m_pindices.first() == 0 && m_pindices.last() == m_pindices.size() - 1;
   }
 }
 
@@ -781,7 +780,7 @@ inline void EventFilterInterface::trigger_particle(uint pindex, float time_facto
   BLI_assert(0.0f <= time_factor && time_factor <= 1.0f);
 
   if (time_factor <= m_known_min_time_factors[pindex]) {
-    m_filtered_particle_indices.append(pindex);
+    m_filtered_pindices.append(pindex);
     m_filtered_time_factors.append(time_factor);
   }
 }
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index 9cd1cbe4db2..c79137e83c5 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -23,16 +23,15 @@ static uint get_max_event_storage_size(ArrayRef<Event *> events)
   return max_size;
 }
 
-BLI_NOINLINE static void find_next_event_per_particle(
-    ParticleSet particles,
-    AttributeArrays &attribute_offsets,
-    ArrayRef<float> durations,
-    float end_time,
-    ArrayRef<Event *> events,
-    EventStorage &r_event_storage,
-    ArrayRef<int> r_next_event_indices,
-    ArrayRef<float> r_time_factors_to_next_event,
-    VectorAdaptor<uint> &r_particle_indices_with_event)
+BLI_NOINLINE static void find_next_event_per_particle(ParticleSet particles,
+                                                      AttributeArrays &attribute_offsets,
+                                                      ArrayRef<float> durations,
+                                                      float end_time,
+                                                      ArrayRef<Event *> events,
+                                                      EventStorage &r_event_storage,
+                                                      ArrayRef<int> r_next_event_indices,
+                                                      ArrayRef<float> r_time_factors_to_next_event,
+                                                      VectorAdaptor<uint> &r_pindices_with_event)
 {
   for (uint pindex : particles.indices()) {
     r_next_event_indices[pindex] = -1;
@@ -40,7 +39,7 @@ BLI_NOINLINE static void find_next_event_per_particle(
   }
 
   for (uint event_index = 0; event_index < events.size(); event_index++) {
-    SmallVector<uint> triggered_particle_indices;
+    SmallVector<uint> triggered_pindices;
     SmallVector<float> triggered_time_factors;
 
     Event *event = events[event_index];
@@ -50,12 +49,12 @@ BLI_NOINLINE static void find_next_event_per_particle(
                                    end_time,
                                    r_time_factors_to_next_event,
                                    r_event_storage,
-                                   triggered_particle_indices,
+                                   triggered_pindices,
                                    triggered_time_factors);
     event->filter(interface);
 
-    for (uint i = 0; i < triggered_particle_indices.size(); i++) {
-      uint pindex = triggered_particle_indices[i];
+    for (uint i = 0; i < triggered_pindices.size(); i++) {
+      uint pindex = triggered_pindices[i];
       float time_factor = triggered_time_factors[i];
       BLI_assert(time_factor <= r_time_factors_to_next_event[pindex]);
 
@@ -67,7 +66,7 @@ BLI_NOINLINE static void find_next_event_per_particle(
   for (uint index : particles.range()) {
     uint pindex = particles.get_particle_index(index);
     if (r_next_event_indices[pindex] != -1) {
-      r_particle_indices_with_event.append(pindex);
+      r_pindices_with_event.append(pindex);
     }
   }
 }
@@ -100,35 +99,34 @@ BLI_NOINLINE static void forward_particles_to_next_event_or_end(
 }
 
 BLI_NOINLINE static void update_remaining_attribute_offsets(
-    ArrayRef<uint> particle_indices_with_event,
+    ArrayRef<uint> pindices_with_event,
     ArrayRef<float> time_factors_to_next_event,
     AttributeArrays attribute_offsets)
 {
   for (uint attribute_index : attribute_offs

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list