12#ifndef ARCANE_ITEMFUNCTOR_H
13#define ARCANE_ITEMFUNCTOR_H
17#include "arcane/utils/RangeFunctor.h"
18#include "arcane/utils/Functor.h"
20#include "arcane/core/Item.h"
21#include "arcane/core/ItemVectorView.h"
41class ARCANE_CORE_EXPORT AbstractItemRangeFunctor
46 static const Integer DEFAULT_GRAIN_SIZE = 400;
61 Int32 m_block_size = 0;
63 Int32 m_block_grain_size = 0;
78template <
typename InstanceType,
typename ItemType>
79class ItemRangeFunctorT
80:
public AbstractItemRangeFunctor
88 ItemRangeFunctorT(
ItemVectorView items_view, InstanceType* instance,
89 FunctionType function,
Integer grain_size = DEFAULT_GRAIN_SIZE)
90 : AbstractItemRangeFunctor(items_view, grain_size)
91 , m_instance(instance)
92 , m_function(function)
98 InstanceType* m_instance;
99 FunctionType m_function;
109 (m_instance->*m_function)(sub_view);
121template <
typename LambdaType>
122class LambdaItemRangeFunctorT
123:
public AbstractItemRangeFunctor
127 LambdaItemRangeFunctorT(
ItemVectorView items_view,
const LambdaType& lambda_function,
128 Int32 grain_size = DEFAULT_GRAIN_SIZE)
129 : AbstractItemRangeFunctor(items_view, grain_size)
130 , m_lambda_function(lambda_function)
138 Int32 true_begin = 0;
144 if constexpr (std::is_invocable_v<LambdaType, ItemVectorView>)
145 m_lambda_function(sub_view);
147 m_lambda_function(sub_view, true_begin);
152 const LambdaType& m_lambda_function;
161class ItemGroupComputeFunctor
166 ItemGroupComputeFunctor() =
default;
Int32 nbBlock() const
Number of blocks.
Int32 blockGrainSize() const
Desired size of an iteration interval.
Interface of a functor on an iteration interval.
virtual void executeFunctor(Int32 begin, Int32 size)
Executes the associated method.
View on a typed array of entities.
View on a vector of entities.
void executeFunctor(Int32 begin, Int32 size) override
Executes the associated method.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
std::int32_t Int32
Signed integer type of 32 bits.