Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
core/materials/MatVarIndex.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* MatVarIndex.h (C) 2000-2022 */
9/* */
10/* Index sur les variables matériaux. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_MATERIALS_MATVARINDEX_H
13#define ARCANE_CORE_MATERIALS_MATVARINDEX_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/materials/MaterialsCoreGlobal.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane::Materials
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
38class ARCANE_CORE_EXPORT MatVarIndex
39{
40 public:
41
42 constexpr ARCCORE_HOST_DEVICE MatVarIndex(Int32 array_index,Int32 value_index)
43 : m_array_index(array_index), m_value_index(value_index)
44 {
45 }
46 ARCCORE_HOST_DEVICE MatVarIndex(){}
47
48 public:
49
51 constexpr ARCCORE_HOST_DEVICE Int32 arrayIndex() const { return m_array_index; }
52
54 constexpr ARCCORE_HOST_DEVICE Int32 valueIndex() const { return m_value_index; }
55
57 constexpr ARCCORE_HOST_DEVICE void setIndex(Int32 array_index,Int32 value_index)
58 {
59 m_array_index = array_index;
60 m_value_index = value_index;
61 }
62
63 constexpr ARCCORE_HOST_DEVICE void reset()
64 {
65 m_array_index = (-1);
66 m_value_index = (-1);
67 }
68
69 constexpr ARCCORE_HOST_DEVICE bool null() const
70 {
71 return m_value_index==(-1);
72 }
73
74 private:
75
76 Int32 m_array_index;
77 Int32 m_value_index;
78};
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
83ARCANE_CORE_EXPORT ARCCORE_HOST_DEVICE std::ostream&
84operator<<(std::ostream& o,const MatVarIndex& mvi);
85
86/*---------------------------------------------------------------------------*/
87/*---------------------------------------------------------------------------*/
88
89inline ARCCORE_HOST_DEVICE bool
90operator==(MatVarIndex mv1,MatVarIndex mv2)
91{
92 if (mv1.arrayIndex() != mv2.arrayIndex())
93 return false;
94 return mv1.valueIndex() == mv2.valueIndex();
95}
96
97inline bool ARCCORE_HOST_DEVICE operator!=(MatVarIndex mv1,MatVarIndex mv2)
98{
99 return !(operator==(mv1,mv2));
100}
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
108class ARCANE_CORE_EXPORT ComponentItemLocalId
109{
110 public:
111 constexpr ARCCORE_HOST_DEVICE ComponentItemLocalId() : m_local_id(-1,-1){}
112 constexpr ARCCORE_HOST_DEVICE explicit ComponentItemLocalId(MatVarIndex mvi) : m_local_id(mvi){}
113 public:
114 MatVarIndex ARCCORE_HOST_DEVICE localId() const { return m_local_id; }
115 private:
116 MatVarIndex m_local_id;
117};
118
119/*---------------------------------------------------------------------------*/
120/*---------------------------------------------------------------------------*/
125class ARCANE_CORE_EXPORT PureMatVarIndex
126{
127 public:
128 explicit ARCCORE_HOST_DEVICE PureMatVarIndex(Int32 idx) : m_index(idx){}
129 public:
130 Int32 ARCCORE_HOST_DEVICE valueIndex() const { return m_index; }
131 private:
132 Int32 m_index;
133};
134
135/*---------------------------------------------------------------------------*/
136/*---------------------------------------------------------------------------*/
137
138ARCANE_CORE_EXPORT ARCCORE_HOST_DEVICE std::ostream&
139operator<<(std::ostream& o,const ComponentItemLocalId& mvi);
140
141/*---------------------------------------------------------------------------*/
142/*---------------------------------------------------------------------------*/
143
144} // End namespace Arcane::Materials
145
146/*---------------------------------------------------------------------------*/
147/*---------------------------------------------------------------------------*/
148
149#endif
150
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Index d'un Item matériaux dans une variable.
Représente un index sur les variables matériaux et milieux.
constexpr ARCCORE_HOST_DEVICE Int32 arrayIndex() const
Retourne l'indice du tableau de valeur dans la liste des variables.
constexpr ARCCORE_HOST_DEVICE Int32 valueIndex() const
Retourne l'indice dans le tableau de valeur.
constexpr ARCCORE_HOST_DEVICE void setIndex(Int32 array_index, Int32 value_index)
Positionne l'index.
Index d'un Item matériaux pure dans une variable.
std::ostream & operator<<(std::ostream &o, eExecutionPolicy exec_policy)
Affiche le nom de la politique d'exécution.
Active toujours les traces dans les parties Arcane concernant les matériaux.