You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
852 B

  1. #pragma once
  2. #include <ecs/config.h>
  3. #include <ecs/core/system/parallelism/strategy/split_base.h>
  4. namespace ecs {
  5. namespace core {
  6. namespace system {
  7. namespace parallelism {
  8. template<typename T_parameters>
  9. struct split_evenly
  10. : private split_base
  11. {
  12. public:
  13. using parameters_type = T_parameters;
  14. template<typename T_context, typename T_instance, typename T_func>
  15. inline void operator()(T_context& context, T_instance& instance, T_func&& func) const
  16. {
  17. auto split_count = parameters_type::get_split_count();
  18. auto total_count = instance.subscribed_count();
  19. auto per_split = total_count / split_count;
  20. executor_proxy<T_context, T_instance> ep { context, instance, split_count, per_split };
  21. func(instance, ep);
  22. }
  23. };
  24. } } } }