Arcane
v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
DumpW.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
/* DumpW.cc (C) 2000-2022 */
9
/* */
10
/* Wrapper de IDataWriter sous l'ancienne interface IDumpW. */
11
/*---------------------------------------------------------------------------*/
12
/*---------------------------------------------------------------------------*/
13
14
#include "arcane/utils/ArcanePrecomp.h"
15
#include "arcane/utils/NotSupportedException.h"
16
17
#include "arcane/ArcaneTypes.h"
18
#include "arcane/utils/String.h"
19
#include "arcane/utils/Real2.h"
20
#include "arcane/utils/Real3.h"
21
#include "arcane/utils/Real2x2.h"
22
#include "arcane/utils/Real3x3.h"
23
#include "arcane/utils/Array.h"
24
#include "arcane/utils/Array2.h"
25
#include "arcane/utils/Array2View.h"
26
#include "arcane/utils/MultiArray2.h"
27
#include "arcane/utils/MultiArray2View.h"
28
#include "arcane/IData.h"
29
#include "arcane/IVariable.h"
30
#include "arcane/VariableCollection.h"
31
#include "arcane/std/DumpW.h"
32
#include "arcane/AbstractDataVisitor.h"
33
34
/*---------------------------------------------------------------------------*/
35
/*---------------------------------------------------------------------------*/
36
37
namespace
Arcane
38
{
39
40
/*---------------------------------------------------------------------------*/
41
/*---------------------------------------------------------------------------*/
42
43
class
DumpW::DataVisitor
44
:
public
AbstractDataVisitor
45
{
46
public
:
47
48
DataVisitor
(
DumpW
* dump,
IVariable
*
var
)
49
: m_dump(dump)
50
, m_var(
var
)
51
{}
52
53
public
:
54
55
void
applyVisitor(
IScalarDataT<Byte>
* data) { _applyVisitorT(data); }
56
void
applyVisitor(
IScalarDataT<Real>
* data) { _applyVisitorT(data); }
57
void
applyVisitor(
IScalarDataT<Int16>
* data) { _applyVisitorT(data); }
58
void
applyVisitor(
IScalarDataT<Int32>
* data) { _applyVisitorT(data); }
59
void
applyVisitor(
IScalarDataT<Int64>
* data) { _applyVisitorT(data); }
60
void
applyVisitor(
IScalarDataT<Real2>
* data) { _applyVisitorT(data); }
61
void
applyVisitor(
IScalarDataT<Real3>
* data) { _applyVisitorT(data); }
62
void
applyVisitor(
IScalarDataT<Real2x2>
* data) { _applyVisitorT(data); }
63
void
applyVisitor(
IScalarDataT<Real3x3>
* data) { _applyVisitorT(data); }
64
void
applyVisitor(
IScalarDataT<String>
* data) { _applyVisitorT(data); }
65
66
void
applyVisitor(
IArrayDataT<Byte>
* data) { _applyVisitorT(data); }
67
void
applyVisitor(
IArrayDataT<Real>
* data) { _applyVisitorT(data); }
68
void
applyVisitor(
IArrayDataT<Int16>
* data) { _applyVisitorT(data); }
69
void
applyVisitor(
IArrayDataT<Int32>
* data) { _applyVisitorT(data); }
70
void
applyVisitor(
IArrayDataT<Int64>
* data) { _applyVisitorT(data); }
71
void
applyVisitor(
IArrayDataT<Real2>
* data) { _applyVisitorT(data); }
72
void
applyVisitor(
IArrayDataT<Real3>
* data) { _applyVisitorT(data); }
73
void
applyVisitor(
IArrayDataT<Real2x2>
* data) { _applyVisitorT(data); }
74
void
applyVisitor(
IArrayDataT<Real3x3>
* data) { _applyVisitorT(data); }
75
void
applyVisitor(
IArrayDataT<String>
* data) { _applyVisitorT(data); }
76
77
void
applyVisitor(
IArray2DataT<Byte>
* data) { _applyVisitorT(data); }
78
void
applyVisitor(
IArray2DataT<Real>
* data) { _applyVisitorT(data); }
79
void
applyVisitor(
IArray2DataT<Int16>
* data) { _applyVisitorT(data); }
80
void
applyVisitor(
IArray2DataT<Int32>
* data) { _applyVisitorT(data); }
81
void
applyVisitor(
IArray2DataT<Int64>
* data) { _applyVisitorT(data); }
82
void
applyVisitor(
IArray2DataT<Real2>
* data) { _applyVisitorT(data); }
83
void
applyVisitor(
IArray2DataT<Real3>
* data) { _applyVisitorT(data); }
84
void
applyVisitor(
IArray2DataT<Real2x2>
* data) { _applyVisitorT(data); }
85
void
applyVisitor(
IArray2DataT<Real3x3>
* data) { _applyVisitorT(data); }
86
87
void
applyVisitor(
IMultiArray2DataT<Byte>
* data) { _applyVisitorT(data); }
88
void
applyVisitor(
IMultiArray2DataT<Real>
* data) { _applyVisitorT(data); }
89
void
applyVisitor(
IMultiArray2DataT<Int16>
* data) { _applyVisitorT(data); }
90
void
applyVisitor(
IMultiArray2DataT<Int32>
* data) { _applyVisitorT(data); }
91
void
applyVisitor(
IMultiArray2DataT<Int64>
* data) { _applyVisitorT(data); }
92
void
applyVisitor(
IMultiArray2DataT<Real2>
* data) { _applyVisitorT(data); }
93
void
applyVisitor(
IMultiArray2DataT<Real3>
* data) { _applyVisitorT(data); }
94
void
applyVisitor(
IMultiArray2DataT<Real2x2>
* data) { _applyVisitorT(data); }
95
void
applyVisitor(
IMultiArray2DataT<Real3x3>
* data) { _applyVisitorT(data); }
96
97
protected
:
98
99
template
<
typename
T>
void
_applyVisitorT(
IScalarDataT<T>
* data);
100
template
<
typename
T>
void
_applyVisitorT(
IArrayDataT<T>
* data);
101
template
<
typename
T>
void
_applyVisitorT(
IArray2DataT<T>
* data);
102
template
<
typename
T>
void
_applyVisitorT(
IMultiArray2DataT<T>
* data);
103
104
private
:
105
106
DumpW
* m_dump;
107
IVariable
* m_var;
108
};
109
110
/*---------------------------------------------------------------------------*/
111
/*---------------------------------------------------------------------------*/
112
113
template
<
typename
T>
void
DumpW::DataVisitor::
114
_applyVisitorT(
IScalarDataT<T>
* data)
115
{
116
UniqueArray<T>
vtmp
(1);
117
vtmp
[0] = data->value();
118
m_dump->
writeVal
(*m_var,
vtmp
);
119
}
120
121
/*---------------------------------------------------------------------------*/
122
/*---------------------------------------------------------------------------*/
123
124
template
<
typename
T>
void
DumpW::DataVisitor::
125
_applyVisitorT(
IArrayDataT<T>
* data)
126
{
127
ArrayView<T>
view = data->view();
128
m_dump->writeVal(*m_var,
ArrayView<T>
(view.size(), view.data()));
129
}
130
131
/*---------------------------------------------------------------------------*/
132
/*---------------------------------------------------------------------------*/
133
134
template
<
typename
T>
void
DumpW::DataVisitor::
135
_applyVisitorT(IArray2DataT<T>* data)
136
{
137
ConstArray2View<T> values = data->view();
138
m_dump->writeVal(*m_var, values);
139
}
140
141
/*---------------------------------------------------------------------------*/
142
/*---------------------------------------------------------------------------*/
143
144
template
<
typename
T>
void
DumpW::DataVisitor::
145
_applyVisitorT(IMultiArray2DataT<T>* data)
146
{
147
ConstMultiArray2View<T> values = data->value();
148
m_dump->writeVal(*m_var, values);
149
}
150
151
/*---------------------------------------------------------------------------*/
152
/*---------------------------------------------------------------------------*/
153
154
DumpW::
155
DumpW
()
156
{
157
}
158
159
/*---------------------------------------------------------------------------*/
160
/*---------------------------------------------------------------------------*/
161
162
DumpW::
163
~DumpW
()
164
{
165
}
166
167
/*---------------------------------------------------------------------------*/
168
169
void
DumpW::
170
beginWrite
(
const
VariableCollection
&
vars
)
171
{
172
ARCANE_UNUSED(
vars
);
173
this->
beginWrite
();
174
}
175
176
/*---------------------------------------------------------------------------*/
177
178
void
DumpW::
179
write
(
IVariable
*
var
,
IData
* data)
180
{
181
DumpW::DataVisitor
v(
this
,
var
);
182
data->
visit
(&v);
183
}
184
185
/*---------------------------------------------------------------------------*/
186
/*---------------------------------------------------------------------------*/
187
188
}
// End namespace Arcane
189
190
/*---------------------------------------------------------------------------*/
191
/*---------------------------------------------------------------------------*/
Arcane::AbstractDataVisitor
Visiteur abstrait pour une donnée.
Definition
AbstractDataVisitor.h:147
Arcane::DumpW::DataVisitor
Definition
DumpW.cc:45
Arcane::DumpW
wrapper transformant des appels à l'interface IDataWriter en ex IDumpW
Definition
DumpW.h:45
Arcane::DumpW::beginWrite
virtual void beginWrite()=0
Notifie le début d'écriture.
Arcane::DumpW::DumpW
DumpW()
Constructeur.
Definition
DumpW.cc:155
Arcane::DumpW::writeVal
virtual void writeVal(IVariable &v, ConstArrayView< Byte > a)=0
Ecriture pour la variable v du tableau a.
Arcane::DumpW::write
void write(IVariable *var, IData *data)
Ecrit les données data de la variable var.
Definition
DumpW.cc:179
Arcane::DumpW::~DumpW
virtual ~DumpW()
Libère les ressources.
Definition
DumpW.cc:163
Arcane::IData
Interface d'une donnée.
Definition
IData.h:33
Arcane::IData::visit
virtual void visit(IDataVisitor *visitor)=0
Applique le visiteur à la donnée.
Arcane::IVariable
Interface d'une variable.
Definition
IVariable.h:54
Arcane::LimaWrapper
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition
Lima.cc:120
Arcane::VariableCollection
Collection de variables.
Definition
VariableCollection.h:81
Arcane
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Definition
AcceleratorGlobal.h:36
arcane
std
DumpW.cc
Généré le Lundi 18 Novembre 2024 03:01:42 pour Arcane par
1.9.8