Arcane  v3.15.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
AbstractDataVisitor.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 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/* AbstractDataVisitor.cc (C) 2000-2024 */
9/* */
10/* Visiteur abstrait pour une donnée. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/NotImplementedException.h"
15#include "arcane/utils/TraceInfo.h"
16
17#include "arcane/core/AbstractDataVisitor.h"
18#include "arcane/core/IData.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29void AbstractDataVisitor::
30applyDataVisitor(IScalarData* data)
31{
32 data->visitScalar(this);
33}
34
35void AbstractDataVisitor::
36applyDataVisitor(IArrayData* data)
37{
38 data->visitArray(this);
39}
40
41void AbstractDataVisitor::
42applyDataVisitor(IArray2Data* data)
43{
44 data->visitArray2(this);
45}
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
50void AbstractScalarDataVisitor::
51_throwException(eDataType dt)
52{
53 String s = String::format("scalar visitor not implemented for data type '{0}'",
54 dataTypeName(dt));
55 throw NotImplementedException(A_FUNCINFO,s);
56}
57
58void AbstractScalarDataVisitor::
59applyVisitor(IScalarDataT<Byte>* data)
60{
61 ARCANE_UNUSED(data);
62 _throwException(DT_Byte);
63}
64
65void AbstractScalarDataVisitor::
66applyVisitor(IScalarDataT<Real>* data)
67{
68 ARCANE_UNUSED(data);
69 _throwException(DT_Real);
70}
71
72void AbstractScalarDataVisitor::
73applyVisitor(IScalarDataT<Int16>* data)
74{
75 ARCANE_UNUSED(data);
76 _throwException(DT_Int16);
77}
78
79void AbstractScalarDataVisitor::
80applyVisitor(IScalarDataT<Int32>* data)
81{
82 ARCANE_UNUSED(data);
83 _throwException(DT_Int32);
84}
85
86void AbstractScalarDataVisitor::
87applyVisitor(IScalarDataT<Int64>* data)
88{
89 ARCANE_UNUSED(data);
90 _throwException(DT_Int64);
91}
92
93void AbstractScalarDataVisitor::
94applyVisitor(IScalarDataT<Real2>* data)
95{
96 ARCANE_UNUSED(data);
97 _throwException(DT_Real2);
98}
99
100void AbstractScalarDataVisitor::
101applyVisitor(IScalarDataT<Real3>* data)
102{
103 ARCANE_UNUSED(data);
104 _throwException(DT_Real3);
105}
106
107void AbstractScalarDataVisitor::
108applyVisitor(IScalarDataT<Real2x2>* data)
109{
110 ARCANE_UNUSED(data);
111 _throwException(DT_Real2x2);
112}
113
114void AbstractScalarDataVisitor::
115applyVisitor(IScalarDataT<Real3x3>* data)
116{
117 ARCANE_UNUSED(data);
118 _throwException(DT_Real3x3);
119}
120
121void AbstractScalarDataVisitor::
122applyVisitor(IScalarDataT<String>* data)
123{
124 ARCANE_UNUSED(data);
125 _throwException(DT_String);
126}
127
128void AbstractScalarDataVisitor::
129applyVisitor(IScalarDataT<Int8>* data)
130{
131 ARCANE_UNUSED(data);
132 _throwException(DT_Int8);
133}
134
135void AbstractScalarDataVisitor::
136applyVisitor(IScalarDataT<Float16>* data)
137{
138 ARCANE_UNUSED(data);
139 _throwException(DT_Float16);
140}
141
142void AbstractScalarDataVisitor::
143applyVisitor(IScalarDataT<BFloat16>* data)
144{
145 ARCANE_UNUSED(data);
146 _throwException(DT_BFloat16);
147}
148
149void AbstractScalarDataVisitor::
150applyVisitor(IScalarDataT<Float32>* data)
151{
152 ARCANE_UNUSED(data);
153 _throwException(DT_Float32);
154}
155
156/*---------------------------------------------------------------------------*/
157/*---------------------------------------------------------------------------*/
158
159void AbstractArrayDataVisitor::
160_throwException(eDataType dt)
161{
162 String s = String::format("array visitor not implemented for data type '{0}'",
163 dataTypeName(dt));
164 throw NotImplementedException(A_FUNCINFO,s);
165}
166
167void AbstractArrayDataVisitor::
168applyVisitor(IArrayDataT<Byte>* data)
169{
170 ARCANE_UNUSED(data);
171 _throwException(DT_Byte);
172}
173
174void AbstractArrayDataVisitor::
175applyVisitor(IArrayDataT<Real>* data)
176{
177 ARCANE_UNUSED(data);
178 _throwException(DT_Real);
179}
180
181void AbstractArrayDataVisitor::
182applyVisitor(IArrayDataT<Int16>* data)
183{
184 ARCANE_UNUSED(data);
185 _throwException(DT_Int16);
186}
187
188void AbstractArrayDataVisitor::
189applyVisitor(IArrayDataT<Int32>* data)
190{
191 ARCANE_UNUSED(data);
192 _throwException(DT_Int32);
193}
194
195void AbstractArrayDataVisitor::
196applyVisitor(IArrayDataT<Int64>* data)
197{
198 ARCANE_UNUSED(data);
199 _throwException(DT_Int64);
200}
201
202void AbstractArrayDataVisitor::
203applyVisitor(IArrayDataT<Real2>* data)
204{
205 ARCANE_UNUSED(data);
206 _throwException(DT_Real2);
207}
208
209void AbstractArrayDataVisitor::
210applyVisitor(IArrayDataT<Real3>* data)
211{
212 ARCANE_UNUSED(data);
213 _throwException(DT_Real3);
214}
215
216void AbstractArrayDataVisitor::
217applyVisitor(IArrayDataT<Real2x2>* data)
218{
219 ARCANE_UNUSED(data);
220 _throwException(DT_Real2x2);
221}
222
223void AbstractArrayDataVisitor::
224applyVisitor(IArrayDataT<Real3x3>* data)
225{
226 ARCANE_UNUSED(data);
227 _throwException(DT_Real3x3);
228}
229
230void AbstractArrayDataVisitor::
231applyVisitor(IArrayDataT<String>* data)
232{
233 ARCANE_UNUSED(data);
234 _throwException(DT_String);
235}
236
237void AbstractArrayDataVisitor::
238applyVisitor(IArrayDataT<Int8>* data)
239{
240 ARCANE_UNUSED(data);
241 _throwException(DT_Int8);
242}
243
244void AbstractArrayDataVisitor::
245applyVisitor(IArrayDataT<Float16>* data)
246{
247 ARCANE_UNUSED(data);
248 _throwException(DT_Float16);
249}
250
251void AbstractArrayDataVisitor::
252applyVisitor(IArrayDataT<BFloat16>* data)
253{
254 ARCANE_UNUSED(data);
255 _throwException(DT_BFloat16);
256}
257
258void AbstractArrayDataVisitor::
259applyVisitor(IArrayDataT<Float32>* data)
260{
261 ARCANE_UNUSED(data);
262 _throwException(DT_Float32);
263}
264
265/*---------------------------------------------------------------------------*/
266/*---------------------------------------------------------------------------*/
267
268void AbstractArray2DataVisitor::
269_throwException(eDataType dt)
270{
271 String s = String::format("array2 visitor not implemented for data type '{0}'",
272 dataTypeName(dt));
273 throw NotImplementedException(A_FUNCINFO,s);
274}
275
276void AbstractArray2DataVisitor::
277applyVisitor(IArray2DataT<Byte>* data)
278{
279 ARCANE_UNUSED(data);
280 _throwException(DT_Byte);
281}
282
283void AbstractArray2DataVisitor::
284applyVisitor(IArray2DataT<Real>* data)
285{
286 ARCANE_UNUSED(data);
287 _throwException(DT_Real);
288}
289
290void AbstractArray2DataVisitor::
291applyVisitor(IArray2DataT<Int16>* data)
292{
293 ARCANE_UNUSED(data);
294 _throwException(DT_Int16);
295}
296
297void AbstractArray2DataVisitor::
298applyVisitor(IArray2DataT<Int32>* data)
299{
300 ARCANE_UNUSED(data);
301 _throwException(DT_Int32);
302}
303
304void AbstractArray2DataVisitor::
305applyVisitor(IArray2DataT<Int64>* data)
306{
307 ARCANE_UNUSED(data);
308 _throwException(DT_Int64);
309}
310
311void AbstractArray2DataVisitor::
312applyVisitor(IArray2DataT<Real2>* data)
313{
314 ARCANE_UNUSED(data);
315 _throwException(DT_Real2);
316}
317
318void AbstractArray2DataVisitor::
319applyVisitor(IArray2DataT<Real3>* data)
320{
321 ARCANE_UNUSED(data);
322 _throwException(DT_Real3);
323}
324
325void AbstractArray2DataVisitor::
326applyVisitor(IArray2DataT<Real2x2>* data)
327{
328 ARCANE_UNUSED(data);
329 _throwException(DT_Real2x2);
330}
331
332void AbstractArray2DataVisitor::
333applyVisitor(IArray2DataT<Real3x3>* data)
334{
335 ARCANE_UNUSED(data);
336 _throwException(DT_Real3x3);
337}
338
339void AbstractArray2DataVisitor::
340applyVisitor(IArray2DataT<Int8>* data)
341{
342 ARCANE_UNUSED(data);
343 _throwException(DT_Int8);
344}
345
346void AbstractArray2DataVisitor::
347applyVisitor(IArray2DataT<Float16>* data)
348{
349 ARCANE_UNUSED(data);
350 _throwException(DT_Float16);
351}
352
353void AbstractArray2DataVisitor::
354applyVisitor(IArray2DataT<BFloat16>* data)
355{
356 ARCANE_UNUSED(data);
357 _throwException(DT_BFloat16);
358}
359
360void AbstractArray2DataVisitor::
361applyVisitor(IArray2DataT<Float32>* data)
362{
363 ARCANE_UNUSED(data);
364 _throwException(DT_Float32);
365}
366
367/*---------------------------------------------------------------------------*/
368/*---------------------------------------------------------------------------*/
369
370void AbstractMultiArray2DataVisitor::
371_throwException(eDataType dt)
372{
373 String s = String::format("multiarray2 visitor not implemented for data type '{0}'",
374 dataTypeName(dt));
375 throw NotImplementedException(A_FUNCINFO,s);
376}
377
378/*---------------------------------------------------------------------------*/
379/*---------------------------------------------------------------------------*/
380
381}
382
383/*---------------------------------------------------------------------------*/
384/*---------------------------------------------------------------------------*/
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
eDataType
Type d'une donnée.
Definition DataTypes.h:39
@ DT_Float32
Donnée de type 'Float32'.
Definition DataTypes.h:52
@ DT_Real2x2
Donnée de type tenseur 3x3.
Definition DataTypes.h:48
@ DT_Int16
Donnée de type entier 16 bits.
Definition DataTypes.h:42
@ DT_Int8
Donnée de type entier sur 8 bits.
Definition DataTypes.h:53
@ DT_Real3x3
Donnée de type tenseur 3x3.
Definition DataTypes.h:49
@ DT_Int32
Donnée de type entier 32 bits.
Definition DataTypes.h:43
@ DT_Real3
Donnée de type vecteur 3.
Definition DataTypes.h:47
@ DT_Float16
Donnée de type 'Float16'.
Definition DataTypes.h:51
@ DT_Int64
Donnée de type entier 64 bits.
Definition DataTypes.h:44
@ DT_String
Donnée de type chaîne de caractère UTF-8.
Definition DataTypes.h:45
@ DT_BFloat16
Donnée de type 'BFloat16'.
Definition DataTypes.h:50
@ DT_Real2
Donnée de type vecteur 2.
Definition DataTypes.h:46
@ DT_Real
Donnée de type réel.
Definition DataTypes.h:41
@ DT_Byte
Donnée de type octet.
Definition DataTypes.h:40
const char * dataTypeName(eDataType type)
Nom du type de donnée.
Definition DataTypes.cc:70