Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ItemLoop.h File Reference

Types and macros for managing loops over mesh entities. More...

Include dependency graph for ItemLoop.h:

Go to the source code of this file.

Classes

class  Arcane::Loop::ItemLoopFunctor< ItemType >
 Template class to encapsulate a loop over entities. More...

Namespaces

namespace  Arcane
 -- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
namespace  Arcane::Loop
 Namespace containing various classes managing loops over entities.

Macros

#define ENUMERATE_ITEM_LAMBDA(item_type, iter, container)
 Enumerator over an entity via a lambda function.

Typedefs

typedef ItemLoopFunctor< CellArcane::Loop::ItemLoopFunctorCell
typedef ItemLoopFunctor< NodeArcane::Loop::ItemLoopFunctorNode

Functions

template<typename IterType, typename Lambda>
void Arcane::Loop::_InternalSimpleItemLoop (ItemVectorView view, const Lambda &lambda)
 Entity loop functor that allows for the removal of indirections if the local indices of a view are consecutive.

Detailed Description

Types and macros for managing loops over mesh entities.

Definition in file ItemLoop.h.

Macro Definition Documentation

◆ ENUMERATE_ITEM_LAMBDA

#define ENUMERATE_ITEM_LAMBDA ( item_type,
iter,
container )
Value:
Arcane::Loop::ItemLoopFunctor##item_type ::create((container)) << [=](Arcane::Loop::ItemLoopFunctor##item_type ::IterType iter)
Template class to encapsulate a loop over entities.
Definition ItemLoop.h:72

Enumerator over an entity via a lambda function.

Parameters
item_typeentity type (Arcane::Node, Arcane::Cell, Arcane::Edge, ....)
itername of the iterator
containerassociated container (of type Arcane::ItemGroup or Arcane::ItemVectorView).

This macro generates a lambda and therefore the expression must be terminated by a ';'.

For example, to iterate over all cells:

Real gamma = 1.4;
ENUMERATE_ITEM_LAMBDA(Cell,icell,allCells()){
Real pressure = pressure[icell];
Real adiabatic_cst = adiabatic_cst[icell];
Real density = density[icell];
internal_energy[icell] = pressure / ((gamma-1.0) * density);
};
#define ENUMERATE_ITEM_LAMBDA(item_type, iter, container)
Enumerator over an entity via a lambda function.
Definition ItemLoop.h:151

The iterator is of type item_type :: Index (for example Cell::Index for a cell). It therefore does not have the classic methods on entities (such as Arcane::Cell::nbNode()). The iterator only allows access to variable values.

The lambda is declared with [=] and it is therefore forbidden to modify the captured variables.

Warning
The syntax and semantics of this macro are experimental. This macro should only be used for testing.

Definition at line 151 of file ItemLoop.h.