Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ConstituentItemLocalId.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/* ConstituentItemLocalId.h (C) 2000-2024 */
9/* */
10/* Index for material variables. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_MATERIALS_CONSTITUENTITEMLOCALID_H
13#define ARCANE_CORE_MATERIALS_CONSTITUENTITEMLOCALID_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/materials/MatVarIndex.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane::Materials
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \ingroup ArcaneMaterials
30 * \brief Index of a ConstituentItem in a variable.
31 */
32class ConstituentItemLocalId
33{
34 public:
35
36 constexpr ARCCORE_HOST_DEVICE ConstituentItemLocalId()
37 : m_local_id(-1, -1)
38 {}
39 constexpr ARCCORE_HOST_DEVICE explicit ConstituentItemLocalId(MatVarIndex mvi)
40 : m_local_id(mvi)
41 {}
42
43 public:
44
45 //! Generic index to access variable values.
46 constexpr ARCCORE_HOST_DEVICE MatVarIndex localId() const { return m_local_id; }
47
48 public:
49
50 ARCANE_CORE_EXPORT friend std::ostream&
51 operator<<(std::ostream& o, const ConstituentItemLocalId& mvi);
52
53 private:
54
55 MatVarIndex m_local_id;
56};
57
58/*---------------------------------------------------------------------------*/
59/*---------------------------------------------------------------------------*/
60/*!
61 * \ingroup ArcaneMaterials
62 * \brief Index of a MatItem in a variable.
63 */
64class MatItemLocalId
65: public ConstituentItemLocalId
66{
67 public:
68
69 MatItemLocalId() = default;
70 constexpr ARCCORE_HOST_DEVICE explicit MatItemLocalId(MatVarIndex mvi)
71 : ConstituentItemLocalId(mvi)
72 {}
73 constexpr ARCCORE_HOST_DEVICE MatItemLocalId(ComponentItemLocalId lid)
74 : ConstituentItemLocalId(lid)
75 {}
76};
77
78/*---------------------------------------------------------------------------*/
79/*---------------------------------------------------------------------------*/
80/*!
81 * \ingroup ArcaneMaterials
82 * \brief Index of an EnvItem in a variable.
83 */
84class EnvItemLocalId
85: public ConstituentItemLocalId
86{
87 public:
88
89 EnvItemLocalId() = default;
90 constexpr ARCCORE_HOST_DEVICE explicit EnvItemLocalId(MatVarIndex mvi)
91 : ConstituentItemLocalId(mvi)
92 {}
93 constexpr ARCCORE_HOST_DEVICE EnvItemLocalId(ComponentItemLocalId lid)
94 : ConstituentItemLocalId(lid)
95 {}
96};
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
101} // End namespace Arcane::Materials
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
106#endif
Index of a ConstituentItem in a variable.
constexpr __host__ __device__ MatVarIndex localId() const
Generic index to access variable values.
Represents an index on material and environment variables.
Always enables tracing in Arcane parts concerning materials.