Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
VariableRefArray2.cc
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/* VariableRefArray2.cc (C) 2000-2021 */
9/* */
10/* Classe gérant une référence sur une variable tableau 2D. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/VariableRefArray2.h"
15
16#include "arcane/utils/FatalErrorException.h"
17
18#include "arcane/Array2Variable.h"
19#include "arcane/VariableBuildInfo.h"
20#include "arcane/VariableInfo.h"
21#include "arcane/VariableDataTypeTraits.h"
22#include "arcane/IParallelMng.h"
23#include "arcane/VariableFactoryRegisterer.h"
24#include "arcane/core/internal/IDataInternal.h"
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29namespace Arcane
30{
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35template<class DataType> VariableFactoryRegisterer
36VariableRefArray2T<DataType>::
37m_auto_registerer(_autoCreate,_internalVariableTypeInfo());
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42template<typename DataType> VariableTypeInfo
43VariableRefArray2T<DataType>::
44_internalVariableTypeInfo()
45{
46 return VariableTypeInfo(IK_Unknown,VariableDataTypeTraitsT<DataType>::type(),2,0,false);
47}
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
52template<typename DataType> VariableInfo
53VariableRefArray2T<DataType>::
54_internalVariableInfo(const VariableBuildInfo& vbi)
55{
56 VariableTypeInfo vti = _internalVariableTypeInfo();
57 DataStorageTypeInfo sti = vti._internalDefaultDataStorage();
58 return VariableInfo(vbi.name(),vbi.itemFamilyName(),vbi.itemGroupName(),vbi.meshName(),vti,sti);
59}
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63
64template<class DataType> VariableRef*
65VariableRefArray2T<DataType>::
66_autoCreate(const VariableBuildInfo& vb)
67{
68 return new ThatClass(vb);
69}
70
71/*---------------------------------------------------------------------------*/
72/*---------------------------------------------------------------------------*/
73
74template<typename DataType>
77: VariableRef(vbi)
78, m_private_part(PrivatePartType::getReference(vbi,_internalVariableInfo(vbi)))
79{
80 _internalInit(m_private_part);
81}
82
83/*---------------------------------------------------------------------------*/
84/*---------------------------------------------------------------------------*/
85
86template<class DataType>
89: VariableRef(rhs)
90, Array2View<DataType>(rhs)
91, m_private_part(rhs.m_private_part)
92{
94}
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
99template<class DataType> VariableRefArray2T<DataType>::
101: VariableRef(var)
102, m_private_part(PrivatePartType::getReference(var))
103{
104 this->_internalInit(this->m_private_part);
105}
106
107/*---------------------------------------------------------------------------*/
108/*---------------------------------------------------------------------------*/
109
110template<class DataType> void
113{
115 m_private_part = rhs.m_private_part;
116 updateFromInternal();
117}
118
119/*---------------------------------------------------------------------------*/
120/*---------------------------------------------------------------------------*/
121
122template<typename DataType> VariableRefArray2T<DataType>::
124{
125}
126
127/*---------------------------------------------------------------------------*/
128/*---------------------------------------------------------------------------*/
129
130template<class DataType> void
133{
135 m_private_part = rhs.m_private_part;
136 updateFromInternal();
137}
138
139/*---------------------------------------------------------------------------*/
140/*---------------------------------------------------------------------------*/
141
142template<typename DataType> void
144resize(Integer s)
145{
146 m_private_part->directResize(s);
147}
148
149/*---------------------------------------------------------------------------*/
150/*---------------------------------------------------------------------------*/
151
152template<typename DataType> void
154resize(Integer dim1_size,Integer dim2_size)
155{
156 m_private_part->directResize(dim1_size,dim2_size);
157}
158
159/*---------------------------------------------------------------------------*/
160/*---------------------------------------------------------------------------*/
161
162template<typename DataType> void
164fill(const DataType& value)
165{
166 m_private_part->trueData()->_internal()->_internalDeprecatedValue().fill(value);
167}
168
169/*---------------------------------------------------------------------------*/
170/*---------------------------------------------------------------------------*/
171
172template<typename DataType> void VariableRefArray2T<DataType>::
174{
175 ArrayBase::operator=(m_private_part->valueView());
176 BaseClass::updateFromInternal();
177}
178
179/*---------------------------------------------------------------------------*/
180/*---------------------------------------------------------------------------*/
181
182template<typename T> auto VariableRefArray2T<T>::
184{
185 return _internalTrueData()->_internalDeprecatedValue();
186}
187
188/*---------------------------------------------------------------------------*/
189/*---------------------------------------------------------------------------*/
190
191template <typename T> IArray2DataInternalT<T>*
194{
195 if (!(property() & IVariable::PPrivate))
196 ARCANE_FATAL("variable '{0}': getting internal data container is only valid on private variable", name());
197 return m_private_part->trueData()->_internal();
198}
199
200/*---------------------------------------------------------------------------*/
201/*---------------------------------------------------------------------------*/
202
203template class VariableRefArray2T<Byte>;
204template class VariableRefArray2T<Real>;
205template class VariableRefArray2T<Int16>;
206template class VariableRefArray2T<Int32>;
207template class VariableRefArray2T<Int64>;
208template class VariableRefArray2T<Real2>;
209template class VariableRefArray2T<Real3>;
210template class VariableRefArray2T<Real2x2>;
211template class VariableRefArray2T<Real3x3>;
212
213/*---------------------------------------------------------------------------*/
214/*---------------------------------------------------------------------------*/
215
216} // End namespace Arcane
217
218/*---------------------------------------------------------------------------*/
219/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
@ PPrivate
Indique que la variable est privée.
Definition IVariable.h:114
Paramètres nécessaires à la construction d'une variable.
Variable tableau bi dimensionnel.
void refersTo(const VariableRefArray2T< DataType > &rhs)
Positionne la référence de l'instance à la variable rhs.
VariableRefArray2T(const VariableBuildInfo &vb)
Construit une référence à une variable tableau spécifiée dans vb.
virtual void resize(Integer new_size)
Réalloue le nombre d'éléments de la première dimension du tableau.
void fill(const DataType &value)
Remplit la variable avev la valeur value.
ContainerType & internalContainer()
Retourne le conteneur des valeurs de cette variable.
Array2< DataType > ContainerType
Type de la classe gérant la valeur de la variable.
void operator=(const VariableRefArray2T< DataType > &rhs)
Opérateur de recopie.
virtual void updateFromInternal()
Mise à jour à partir de la partie interne.
virtual ~VariableRefArray2T()
Libère les ressources.
Référence à une variable.
Definition VariableRef.h:56
VariableRef & operator=(const VariableRef &from)
Opérateur de recopie.
void _internalInit(IVariable *)
Initialisation interne de la variable.
Vue modifiable pour un tableau 2D.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
@ IK_Unknown
Entité de maillage de genre inconnu ou non initialisé