[Bf-blender-cvs] [ee707916260] functions: rename BlockAllocator to ParticleAllocator

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


Commit: ee707916260b92dcba7c4200e6f0c1b822d8b556
Author: Jacques Lucke
Date:   Wed Jul 10 12:35:20 2019 +0200
Branches: functions
https://developer.blender.org/rBee707916260b92dcba7c4200e6f0c1b822d8b556

rename BlockAllocator to ParticleAllocator

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

M	source/blender/simulations/bparticles/action_interface.cpp
M	source/blender/simulations/bparticles/core.cpp
M	source/blender/simulations/bparticles/core.hpp
M	source/blender/simulations/bparticles/emitters.cpp
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 d2eab9d9394..8d28f3c94f9 100644
--- a/source/blender/simulations/bparticles/action_interface.cpp
+++ b/source/blender/simulations/bparticles/action_interface.cpp
@@ -23,7 +23,7 @@ void ActionInterface::execute_action_for_subset(ArrayRef<uint> indices,
 
   ParticleSet sub_particles(particles.block(), particle_indices);
   EventExecuteInterface sub_execute_interface(sub_particles,
-                                              interface.block_allocator(),
+                                              interface.particle_allocator(),
                                               sub_current_times,
                                               interface.event_storage(),
                                               interface.attribute_offsets(),
diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index 8bfe2199f21..675b549f052 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -32,11 +32,11 @@ ParticlesState::~ParticlesState()
 /* Block Allocator
  ******************************************/
 
-BlockAllocator::BlockAllocator(ParticlesState &state) : m_state(state)
+ParticleAllocator::ParticleAllocator(ParticlesState &state) : m_state(state)
 {
 }
 
-ParticlesBlock &BlockAllocator::get_non_full_block(StringRef particle_type_name)
+ParticlesBlock &ParticleAllocator::get_non_full_block(StringRef particle_type_name)
 {
   ParticlesContainer &container = m_state.particle_container(particle_type_name);
 
@@ -59,10 +59,10 @@ ParticlesBlock &BlockAllocator::get_non_full_block(StringRef particle_type_name)
   return block;
 }
 
-void BlockAllocator::allocate_block_ranges(StringRef particle_type_name,
-                                           uint size,
-                                           SmallVector<ParticlesBlock *> &r_blocks,
-                                           SmallVector<Range<uint>> &r_ranges)
+void ParticleAllocator::allocate_block_ranges(StringRef particle_type_name,
+                                              uint size,
+                                              SmallVector<ParticlesBlock *> &r_blocks,
+                                              SmallVector<Range<uint>> &r_ranges)
 {
   uint remaining_size = size;
   while (remaining_size > 0) {
@@ -84,12 +84,12 @@ void BlockAllocator::allocate_block_ranges(StringRef particle_type_name,
   }
 }
 
-AttributesInfo &BlockAllocator::attributes_info(StringRef particle_type_name)
+AttributesInfo &ParticleAllocator::attributes_info(StringRef particle_type_name)
 {
   return m_state.particle_container(particle_type_name).attributes_info();
 }
 
-std::unique_ptr<EmitTargetBase> BlockAllocator::request(StringRef particle_type_name, uint size)
+std::unique_ptr<EmitTargetBase> ParticleAllocator::request(StringRef particle_type_name, uint size)
 {
   SmallVector<ParticlesBlock *> blocks;
   SmallVector<Range<uint>> ranges;
@@ -104,8 +104,8 @@ std::unique_ptr<EmitTargetBase> BlockAllocator::request(StringRef particle_type_
 /* Emitter Interface
  ******************************************/
 
-EmitterInterface::EmitterInterface(BlockAllocator &block_allocator, TimeSpan time_span)
-    : m_block_allocator(block_allocator), m_time_span(time_span)
+EmitterInterface::EmitterInterface(ParticleAllocator &particle_allocator, TimeSpan time_span)
+    : m_particle_allocator(particle_allocator), m_time_span(time_span)
 {
 }
 
@@ -126,8 +126,8 @@ InstantEmitTarget &EventExecuteInterface::request_emit_target(StringRef particle
 
   SmallVector<ParticlesBlock *> blocks;
   SmallVector<Range<uint>> ranges;
-  m_block_allocator.allocate_block_ranges(particle_type_name, size, blocks, ranges);
-  AttributesInfo &attributes_info = m_block_allocator.attributes_info(particle_type_name);
+  m_particle_allocator.allocate_block_ranges(particle_type_name, size, blocks, ranges);
+  AttributesInfo &attributes_info = m_particle_allocator.attributes_info(particle_type_name);
 
   auto *target = new InstantEmitTarget(particle_type_name, attributes_info, blocks, ranges);
   m_emit_targets.append(target);
@@ -297,13 +297,13 @@ EventFilterInterface::EventFilterInterface(ParticleSet particles,
  *************************************************/
 
 EventExecuteInterface::EventExecuteInterface(ParticleSet particles,
-                                             BlockAllocator &block_allocator,
+                                             ParticleAllocator &particle_allocator,
                                              ArrayRef<float> current_times,
                                              EventStorage &event_storage,
                                              AttributeArrays attribute_offsets,
                                              float step_end_time)
     : m_particles(particles),
-      m_block_allocator(block_allocator),
+      m_particle_allocator(particle_allocator),
       m_current_times(current_times),
       m_kill_states(m_particles.attributes().get_byte("Kill State")),
       m_event_storage(event_storage),
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index 1534b8ef84d..6445689467f 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -296,15 +296,15 @@ class InstantEmitTarget : public EmitTargetBase {
  * be used by multiple threads at the same time.
  * It might hand out the same block more than once until it is full.
  */
-class BlockAllocator {
+class ParticleAllocator {
  private:
   ParticlesState &m_state;
   SmallVector<ParticlesBlock *> m_non_full_cache;
   SmallVector<ParticlesBlock *> m_allocated_blocks;
 
  public:
-  BlockAllocator(ParticlesState &state);
-  BlockAllocator(BlockAllocator &other) = delete;
+  ParticleAllocator(ParticlesState &state);
+  ParticleAllocator(ParticleAllocator &other) = delete;
 
   /**
    * Return a block that can hold new particles. It might create an entirely new one or use a
@@ -337,14 +337,14 @@ class BlockAllocator {
  */
 class EmitterInterface {
  private:
-  BlockAllocator &m_block_allocator;
+  ParticleAllocator &m_particle_allocator;
   TimeSpan m_time_span;
 
  public:
-  EmitterInterface(BlockAllocator &block_allocator, TimeSpan time_span);
+  EmitterInterface(ParticleAllocator &particle_allocator, TimeSpan time_span);
   ~EmitterInterface() = default;
 
-  BlockAllocator &block_allocator();
+  ParticleAllocator &particle_allocator();
 
   /**
    * Time span that new particles should be emitted in.
@@ -502,7 +502,7 @@ class EventFilterInterface {
 class EventExecuteInterface {
  private:
   ParticleSet m_particles;
-  BlockAllocator &m_block_allocator;
+  ParticleAllocator &m_particle_allocator;
   SmallVector<InstantEmitTarget *> m_emit_targets;
   ArrayRef<float> m_current_times;
   ArrayRef<uint8_t> m_kill_states;
@@ -512,7 +512,7 @@ class EventExecuteInterface {
 
  public:
   EventExecuteInterface(ParticleSet particles,
-                        BlockAllocator &block_allocator,
+                        ParticleAllocator &particle_allocator,
                         ArrayRef<float> current_times,
                         EventStorage &event_storage,
                         AttributeArrays attribute_offsets,
@@ -563,7 +563,7 @@ class EventExecuteInterface {
   /**
    * Get a block allocator. Not that the request_emit_target should usually be used instead.
    */
-  BlockAllocator &block_allocator();
+  ParticleAllocator &particle_allocator();
 
   /**
    * Get the entire event storage.
@@ -680,15 +680,15 @@ inline float &ParticlesState::current_time()
   return m_current_time;
 }
 
-/* BlockAllocator inline functions
+/* ParticleAllocator inline functions
  ********************************************/
 
-inline ParticlesState &BlockAllocator::particles_state()
+inline ParticlesState &ParticleAllocator::particles_state()
 {
   return m_state;
 }
 
-inline ArrayRef<ParticlesBlock *> BlockAllocator::allocated_blocks()
+inline ArrayRef<ParticlesBlock *> ParticleAllocator::allocated_blocks()
 {
   return m_allocated_blocks;
 }
@@ -724,9 +724,9 @@ inline StringRefNull EmitTargetBase::particle_type_name()
 /* EmitterInterface inline functions
  ***********************************************/
 
-inline BlockAllocator &EmitterInterface::block_allocator()
+inline ParticleAllocator &EmitterInterface::particle_allocator()
 {
-  return m_block_allocator;
+  return m_particle_allocator;
 }
 
 inline TimeSpan EmitterInterface::time_span()
@@ -867,9 +867,9 @@ inline T &EventFilterInterface::trigger_particle(uint index, float time_factor)
 /* EventExecuteInterface inline functions
  **********************************************/
 
-inline BlockAllocator &EventExecuteInterface::block_allocator()
+inline ParticleAllocator &EventExecuteInterface::particle_allocator()
 {
-  return m_block_allocator;
+  return m_particle_allocator;
 }
 
 inline EventStorage &EventExecuteInterface::event_storage()
diff --git a/source/blender/simulations/bparticles/emitters.cpp b/source/blender/simulations/bparticles/emitters.cpp
index ea35eac5c1f..c257e87c751 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -30,7 +30,7 @@ class PointEmitter : public Emitter {
 
   void emit(EmitterInterface &interface) override
   {
-    auto target = interface.block_allocator().request(m_particle_type_name, 1);
+    auto target = interface.particle_allocator().request(m_particle_type_name, 1);
     target->set_float3("Position", {m_point});
     target->set_float3("Velocity", {float3{-1, -1, 0}});
     target->fill_float("Birth Time", interface.time_span().end());
@@ -129,7 +129,7 @@ class SurfaceEmitter : public Emitter {
       sizes.append(size);
     }
 
-    auto target = interface.block_allocator().request(m_particle_type_name, positions.size());
+    auto target = interface.particle_allocator().request(m_particle_type_name, positions.size());
     target->set_float3("Position", positions);
     target->set_float3("Vel

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list