Arcane  v4.1.0.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
arcane/src/arcane/utils/ForLoopRanges.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ForLoopRanges.h (C) 2000-2025 */
9/* */
10/* Intervalles d'itérations pour les boucles. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_FORLOOPRANGES_H
13#define ARCANE_UTILS_FORLOOPRANGES_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/base/ForLoopRanges.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27//! Applique le fonctor \a func sur une boucle 1D.
28template <typename IndexType, template <int T, typename> class LoopBoundType,
29 typename Lambda, typename... ReducerArgs>
30inline void
31arcaneSequentialFor(LoopBoundType<1, IndexType> bounds, const Lambda& func, ReducerArgs... reducer_args)
32{
33 for (Int32 i0 = bounds.template lowerBound<0>(); i0 < bounds.template upperBound<0>(); ++i0)
34 func(MDIndex<1>(i0), reducer_args...);
36}
37
38//! Applique le fonctor \a func sur une boucle 2D.
39template <typename IndexType, template <int T, typename> class LoopBoundType, typename Lambda> inline void
40arcaneSequentialFor(LoopBoundType<2, IndexType> bounds, const Lambda& func)
41{
42 arccoreSequentialFor(bounds,func);
43}
44
45//! Applique le fonctor \a func sur une boucle 3D.
46template <typename IndexType, template <int T, typename> class LoopBoundType, typename Lambda> inline void
47arcaneSequentialFor(LoopBoundType<3, IndexType> bounds, const Lambda& func)
48{
49 arccoreSequentialFor(bounds,func);
50}
51
52//! Applique le fonctor \a func sur une boucle 4D.
53template <typename IndexType, template <int, typename> class LoopBoundType, typename Lambda> inline void
54arcaneSequentialFor(LoopBoundType<4, IndexType> bounds, const Lambda& func)
55{
56 arccoreSequentialFor(bounds,func);
57}
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
61
62} // End namespace Arcane
63
64/*---------------------------------------------------------------------------*/
65/*---------------------------------------------------------------------------*/
66
67#endif
static void applyReducerArgs(ReducerArgs &... reducer_args)
Applique les fonctors des arguments additionnels.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
void arcaneSequentialFor(LoopBoundType< 1, IndexType > bounds, const Lambda &func, ReducerArgs... reducer_args)
Applique le fonctor func sur une boucle 1D.
void arccoreSequentialFor(LoopBoundType< 1, IndexType > bounds, const Lambda &func, ReducerArgs... reducer_args)
Applique le fonctor func sur une boucle 1D.
std::int32_t Int32
Type entier signé sur 32 bits.