Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Hdf5VariableInfoBase.cc
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/* Hdf5ItemVariableInfo.cc (C) 2000-2023 */
9/* */
10/* Reading variables in HDF5 format. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ITraceMng.h"
15#include "arcane/utils/StringBuilder.h"
16#include "arcane/utils/HashTableMap.h"
17#include "arcane/utils/NotImplementedException.h"
18#include "arcane/utils/NotSupportedException.h"
19#include "arcane/utils/ArgumentException.h"
20
21#include "arcane/hdf5/Hdf5VariableInfoBase.h"
22
23#include "arcane/core/MeshVariable.h"
24#include "arcane/core/IItemFamily.h"
25#include "arcane/core/IMesh.h"
26#include "arcane/core/IMeshSubMeshTransition.h"
27#include "arcane/core/IVariable.h"
28#include "arcane/core/IVariableMng.h"
29#include "arcane/core/IParallelMng.h"
30
31#include <typeinfo>
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
36namespace Arcane
37{
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42template <typename VariableType, typename DataType>
43class Hdf5ItemVariableInfo
44: public Hdf5VariableInfoBase
45{
46 public:
47
48 Hdf5ItemVariableInfo(IMesh* mesh, IVariable* v);
49
50 public:
51
52 VariableType& trueVariable() { return m_variable; }
53 virtual IVariable* variable() const { return m_variable.variable(); }
54
55 public:
56
57 virtual void readVariable(Hdf5Utils::HFile& hfile, const String& filename,
58 Hdf5Utils::StandardTypes& st, const String& ids_hpath, IData* data);
60
61 private:
62
63 void _readStandardArray(Array<DataType>& buffer, Array<Int64>& unique_ids, const String& ids_hpath,
64 hid_t file_id, Hdf5Utils::StandardTypes& st);
65 void _writeStandardArray(Array<DataType>& buffer, hid_t file_id, Hdf5Utils::StandardTypes& st);
66
67 private:
68
69 VariableType m_variable;
70};
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
74
75template <typename VariableType, typename DataType>
76class Hdf5ScalarVariableInfo
77: public Hdf5VariableInfoBase
78{
79 public:
80
81 Hdf5ScalarVariableInfo(IVariable* v);
82
83 public:
84
85 VariableType& trueVariable() { return m_variable; }
86 virtual IVariable* variable() const { return m_variable.variable(); }
87
88 public:
89
90 virtual void readVariable(Hdf5Utils::HFile& hfile, const String& filename,
91 Hdf5Utils::StandardTypes& st, const String& ids_hpath,
92 IData* data);
93 virtual void writeVariable(Hdf5Utils::HFile& hfile, Hdf5Utils::StandardTypes& st);
94
95 private:
96
97 void _readStandardArray(Array<DataType>& buffer,
98 hid_t file_id, Hdf5Utils::StandardTypes& st);
99 void _writeStandardArray(Array<DataType>& buffer, hid_t file_id, Hdf5Utils::StandardTypes& st);
100
101 private:
102
103 VariableType m_variable;
104};
105
106/*---------------------------------------------------------------------------*/
107/*---------------------------------------------------------------------------*/
108
109Hdf5VariableInfoBase* Hdf5VariableInfoBase::
110create(IMesh* mesh, const String& name, const String& family_name)
111{
112 IItemFamily* family = mesh->findItemFamily(family_name, true);
113 IVariable* var = family->findVariable(name, true);
114 return Hdf5VariableInfoBase::create(var);
115}
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
119
120Hdf5VariableInfoBase* Hdf5VariableInfoBase::
121create(IVariable* var)
122{
123 _checkValidVariable(var);
124 Hdf5VariableInfoBase* var_info = 0;
125 IItemFamily* item_family = var->itemFamily();
126 if (item_family) {
127 IMesh* mesh = item_family->mesh();
128 if (var->isPartial()) {
129 switch (var->dataType()) {
130 case DT_Real:
132 break;
133 case DT_Real2:
135 break;
136 case DT_Real2x2:
138 break;
139 case DT_Real3:
141 break;
142 case DT_Real3x3:
144 break;
145 case DT_Byte:
147 break;
148 case DT_Int32:
150 break;
151 case DT_Int64:
153 break;
154 default:
155 throw FatalErrorException(A_FUNCINFO, "Bad variable type");
156 break;
157 }
158 }
159 else {
160 switch (var->dataType()) {
161 case DT_Real:
163 break;
164 case DT_Real2:
166 break;
167 case DT_Real2x2:
169 break;
170 case DT_Real3:
172 break;
173 case DT_Real3x3:
175 break;
176 case DT_Byte:
178 break;
179 case DT_Int32:
181 break;
182 case DT_Int64:
184 break;
185 default:
186 throw FatalErrorException(A_FUNCINFO, "Bad variable type");
187 break;
188 }
189 }
190 }
191 else {
192 if (var->dimension() == 0) {
193 switch (var->dataType()) {
194 case DT_Real:
196 break;
197 case DT_Real2:
199 break;
200 case DT_Real2x2:
202 break;
203 case DT_Real3:
205 break;
206 case DT_Real3x3:
208 break;
209 case DT_Byte:
211 break;
212 case DT_Int32:
214 break;
215 case DT_Int64:
217 break;
218 default:
219 throw FatalErrorException(A_FUNCINFO, "Bad variable type");
220 break;
221 }
222 }
223 }
224 if (!var_info)
225 throw NotSupportedException(A_FUNCINFO,
226 String::format("IData for variable '{0}'", var->fullName()));
227 return var_info;
228}
229
230/*---------------------------------------------------------------------------*/
231/*---------------------------------------------------------------------------*/
232
233void Hdf5VariableInfoBase::
234_checkValidVariable(IVariable* var)
235{
236 IItemFamily* item_family = var->itemFamily();
237 if (item_family) {
238 if (var->dimension() == 1)
239 return;
240 }
241 else {
242 if (var->dimension() == 0)
243 return;
244 }
245
246 ARCANE_FATAL("Bad variable '{0}'. Variable has to be an item variable and have dimension"
247 "'1' or be a scalar variable",
248 var->fullName());
249}
250
251/*---------------------------------------------------------------------------*/
252/*---------------------------------------------------------------------------*/
253
256 const String& hdf_path, Integer save_type)
257{
258 IVariable* var = variable();
259 ItemGroup group = var->itemGroup();
260 IParallelMng* pm = group.mesh()->parallelMng();
261 ItemGroup enumerate_group = group.own();
262 Integer nb_item = enumerate_group.size();
263 ITraceMng* tm = pm->traceMng();
264
265 // For now, the parallel method creates a buffer
266 // of the total number of array elements
268 Int64UniqueArray unique_ids(nb_item);
269 {
270 Integer index = 0;
271 ENUMERATE_ITEM (iitem, enumerate_group) {
272 unique_ids[index] = (*iitem).uniqueId();
273 ++index;
274 }
275 }
276
277 if (save_type & SAVE_IDS) {
278 Hdf5Utils::StandardArrayT<Int64> ids_writer(hfile.id(), hdf_path + "_Ids");
279 ids_writer.parallelWrite(pm, st, unique_ids, unique_ids);
280 }
281
282 // For now, we can only save 2D arrays where the number
283 // of elements in the second dimension is identical. This causes a problem
284 // if all entities do not have the same number of nodes. To
285 // avoid this problem, we calculate the maximum possible number of nodes and
286 // use this value. For entities that have fewer nodes, we
287 // add NaN as coordinates. This is not optimal, especially
288 // if only one entity has many more nodes than the others, but
289 // it works in all cases.
290 if (save_type & SAVE_COORDS) {
291 IMesh* mesh = enumerate_group.mesh();
292 VariableNodeReal3& nodes_coords(mesh->toPrimaryMesh()->nodesCoordinates());
293 eItemKind item_kind = enumerate_group.itemKind();
294 if (item_kind == IK_Edge || item_kind == IK_Face || item_kind == IK_Cell) {
295 Integer index = 0;
296 Real3UniqueArray coords;
297 Real3UniqueArray centers;
298 Integer max_nb_node = 0;
299 const Real nan_value = std::numeric_limits<Real>::quiet_NaN();
300 const Real3 real3_nan = Real3(nan_value, nan_value, nan_value);
301 {
302 ENUMERATE_ITEMWITHNODES(iitem, enumerate_group)
303 {
304 ItemWithNodes item = (*iitem).toItemWithNodes();
305 Integer nb_node = item.nbNode();
306 if (nb_node > max_nb_node)
307 max_nb_node = nb_node;
308 }
309 max_nb_node = pm->reduce(Parallel::ReduceMax, max_nb_node);
310 }
311 Int32UniqueArray items_type(nb_item);
312 ENUMERATE_ITEMWITHNODES(iitem, enumerate_group)
313 {
314 ItemWithNodes item = (*iitem).toItemWithNodes();
315 Integer nb_node = item.nbNode();
316 Real3 item_center;
317 for (NodeLocalId inode : item.nodeIds()) {
318 coords.add(nodes_coords[inode]);
319 item_center += nodes_coords[inode];
320 }
321 item_center /= nb_node;
322 // Add NaN for remaining coordinates
323 for (Integer k = nb_node; k < max_nb_node; ++k)
324 coords.add(real3_nan);
325 centers.add(item_center);
326 items_type[index] = item.typeInfo()->typeId();
327 ++index;
328 }
329 Hdf5Utils::StandardArrayT<Real3> coords_writer(hfile.id(), hdf_path + "_Coords");
330 coords_writer.parallelWrite(pm, st, coords, unique_ids);
331 Hdf5Utils::StandardArrayT<Real3> centers_writer(hfile.id(), hdf_path + "_Center");
332 centers_writer.parallelWrite(pm, st, centers, unique_ids);
333 Hdf5Utils::StandardArrayT<Int32> types_writer(hfile.id(), hdf_path + "_Types");
334 types_writer.parallelWrite(pm, st, items_type, unique_ids);
335 }
336 else if (item_kind == IK_Node) {
337 Real3UniqueArray coords;
338 ENUMERATE_NODE (iitem, enumerate_group) {
339 coords.add(nodes_coords[iitem]);
340 }
341 Hdf5Utils::StandardArrayT<Real3> coords_writer(hfile.id(), hdf_path + "_Center");
342 coords_writer.parallelWrite(pm, st, coords, unique_ids);
343 }
344 else
345 tm->pwarning() << "Can not save coordinates for family name="
346 << enumerate_group.itemFamily()->name();
347 }
348}
349
350/*---------------------------------------------------------------------------*/
351/*---------------------------------------------------------------------------*/
352
353void Hdf5VariableInfoBase::
354readGroupInfo(Hdf5Utils::HFile& hfile, Hdf5Utils::StandardTypes& st,
355 const String& hdf_path, Int64Array& uids, Real3Array& centers)
356{
357 IVariable* var = variable();
358 ItemGroup group = var->itemGroup();
359 IParallelMng* pm = group.mesh()->parallelMng();
360 ItemGroup enumerate_group = group;
361 ITraceMng* tm = pm->traceMng();
362 bool is_master = pm->isMasterIO();
363
364 // Read the saved unique ids
365 Int64UniqueArray dummy_uids;
366 Int64UniqueArray saved_unique_ids;
367 Hdf5Utils::StandardArrayT<Int64> ids_reader(hfile.id(), hdf_path + "_Ids");
368 Integer nb_old_item = 0;
369 if (is_master) {
370 ids_reader.readDim();
371 nb_old_item = arcaneCheckArraySize(ids_reader.dimensions()[0]);
372 tm->info() << "NB_OLD_ITEM nb=" << nb_old_item;
373 saved_unique_ids.resize(nb_old_item);
374 dummy_uids.resize(nb_old_item);
375 }
376 ids_reader.parallelRead(pm, st, saved_unique_ids, dummy_uids);
377
378 Real3UniqueArray saved_centers(nb_old_item);
379 Hdf5Utils::StandardArrayT<Real3> centers_reader(hfile.id(), hdf_path + "_Center");
380 if (is_master)
381 centers_reader.readDim();
382 centers_reader.parallelRead(pm, st, saved_centers, dummy_uids);
383 tm->info() << "READ SAVED CENTERS nb=" << saved_centers.size();
384
385 uids.copy(saved_unique_ids);
386 centers.copy(saved_centers);
387}
388
389/*---------------------------------------------------------------------------*/
390/*---------------------------------------------------------------------------*/
391
392/*---------------------------------------------------------------------------*/
393/*---------------------------------------------------------------------------*/
394
395template <typename VariableType, typename DataType>
399, m_variable(v)
400{
401 ARCANE_UNUSED(mesh);
402}
403
404/*---------------------------------------------------------------------------*/
405/*---------------------------------------------------------------------------*/
406
407template <typename VariableType, typename DataType> void
409readVariable(Hdf5Utils::HFile& hfile, const String& filename,
410 Hdf5Utils::StandardTypes& st, const String& ids_hpath, IData* var_data)
411{
412 ARCANE_UNUSED(ids_hpath);
413
414 if (!var_data)
415 var_data = variable()->data();
416 if (!var_data)
417 throw ArgumentException(A_FUNCINFO, "Null var_data");
419 IArrayDataT<DataType>* data_array = dynamic_cast<IArrayDataT<DataType>*>(var_data);
420 if (!data_array) {
421 const char* n = typeid(var_data).name();
422 throw FatalErrorException(A_FUNCINFO, String::format("Bad type for IData '{0}'", n));
423 }
424 ArrayView<DataType> var_value = data_array->view();
425 IVariable* var = m_variable.variable();
426 IVariableMng* vm = var->variableMng();
427 ITraceMng* tm = vm->traceMng();
428 IParallelMng* pm = vm->parallelMng();
429 bool is_master = pm->isMasterIO();
430 //Integer master_rank = pm->masterIORank();
431 if (is_master) {
432 if (hfile.id() < 0)
433 hfile.openRead(filename);
434 }
435
436 Int64UniqueArray unique_ids;
437 _readStandardArray(buffer, unique_ids, ids_hpath, hfile.id(), st);
438
439 Integer buf_size = buffer.size();
440 //ArrayView<DataType> var_value = m_variable.asArray();
441 Integer nb_var_value = var_value.size();
442 if (var->isPartial()) {
443 // In the case of a partial variable, we must first
444 // put the value for each uid into a hash table,
445 // then iterate through the variable group and fill
446 // the value for each uid.
447 HashTableMapT<Int64, DataType> values_from_uid(buf_size, true);
448 for (Integer z = 0; z < buf_size; ++z) {
449 values_from_uid.add(unique_ids[z], buffer[z]);
450 }
451 ItemGroup var_group = m_variable.itemGroup();
452 ENUMERATE_ITEM (iitem, var_group) {
453 Item item = *iitem;
454 Int64 uid = item.uniqueId();
455 if (m_correspondance_functor) {
456 uid = m_correspondance_functor->getOldUniqueId(uid, iitem.index());
457 }
458 typename HashTableMapT<Int64, DataType>::Data* data = values_from_uid.lookup(uid);
459 if (!data)
460 throw FatalErrorException(A_FUNCINFO,
461 String::format("Can not find item uid='{0}' reading variable '{1}'",
462 uid, var->fullName()));
463 DataType value = data->value();
464 var_value[iitem.index()] = value;
465 }
466 }
467 else {
468 Int32UniqueArray local_ids(buf_size);
469 var->itemFamily()->itemsUniqueIdToLocalId(local_ids, unique_ids, false);
470 for (Integer z = 0; z < buf_size; ++z) {
471 Integer lid = local_ids[z];
472 if (lid == NULL_ITEM_LOCAL_ID)
473 continue;
474 if (lid > nb_var_value)
475 throw FatalErrorException(A_FUNCINFO, String::format("Bad item index '{0}' max={1}", lid, nb_var_value));
476 var_value[lid] = buffer[z];
477 }
478 }
479 tm->info(4) << "End of read for variable '" << var->fullName() << "'";
480}
481
482/*---------------------------------------------------------------------------*/
483/*---------------------------------------------------------------------------*/
484
485template <typename VariableType, typename DataType> void
488 const String& ids_hpath, hid_t file_id,
490{
491 ARCANE_UNUSED(ids_hpath);
492
493 IVariable* var = m_variable.variable();
494 IVariableMng* vm = var->variableMng();
495 ITraceMng* tm = vm->traceMng();
496 IParallelMng* pm = vm->parallelMng();
497 bool is_master = pm->isMasterIO();
498
499 Hdf5Utils::StandardArrayT<DataType> values(file_id, path());
500
501 if (is_master) {
502 if (!ids_hpath.null())
503 values.setIdsPath(ids_hpath);
504 values.readDim();
505 Int64ConstArrayView dims(values.dimensions());
506 Integer nb_dim = dims.size();
507 if (nb_dim != 1)
508 tm->fatal() << "Only one-dimension array are allowed "
509 << " dim=" << nb_dim << " var_name=" << var->fullName() << " path=" << path();
510 Integer nb_item = arcaneCheckArraySize(dims[0]);
511 tm->info(4) << "NB_ITEM: nb_item=" << nb_item;
512 buffer.resize(nb_item);
513 unique_ids.resize(nb_item);
514 }
515 values.parallelRead(pm, st, buffer, unique_ids);
516#if 0
517 {
518 Integer index=0;
519 Integer nb_item = buffer.size();
520 for( Integer i=0; i<nb_item; ++i ){
521 ++index;
522 tm->info() << " VAR_VAL i=" << i << " value=" << buffer[i] << " uid=" << unique_ids[i];
523 if (index>20)
524 break;
525 }
526 }
527#endif
528}
529
530/*---------------------------------------------------------------------------*/
531/*---------------------------------------------------------------------------*/
532
533template <typename VariableType, typename DataType> void
536{
537 Hdf5Utils::StandardArrayT<DataType> values(file_id, path());
538 //ITraceMng* tm = m_mesh->traceMng();
539 //tm->info() << "WRITE STANDARD ARRAY N=" << buffer.size();
540 values.write(st, buffer);
541}
542
543/*---------------------------------------------------------------------------*/
544/*---------------------------------------------------------------------------*/
545
546template <typename VariableType, typename DataType> void
549{
550 IVariable* var = m_variable.variable();
551 IVariableMng* vm = var->variableMng();
552 IParallelMng* pm = vm->parallelMng();
553 ITraceMng* tm = vm->traceMng();
554
555 ItemGroup group = m_variable.itemGroup();
556 ItemGroup enumerate_group = group.own();
557 if (var->isPartial())
558 enumerate_group = group;
559
560 Integer nb_item = enumerate_group.size();
561
562 UniqueArray<DataType> values(nb_item);
563 Int64UniqueArray unique_ids(nb_item);
564 tm->info(4) << "WRITE VARIABLE name=" << m_variable.name()
565 << " is_partial=" << m_variable.variable()->isPartial();
566
567 {
568 Integer index = 0;
569 ENUMERATE_ITEM (iitem, enumerate_group) {
570 if (iitem->isOwn()) {
571 values[index] = m_variable[iitem];
572 unique_ids[index] = iitem->uniqueId();
573 //tm->info() << "WRITE uid=" << iitem->uniqueId()
574 // << " value=" << m_variable[iitem];
575 ++index;
576 }
577 }
578 values.resize(index);
579 unique_ids.resize(index);
580 }
581 // For now, the parallel method creates a buffer
582 // of the total number of array elements
584 {
585 Hdf5Utils::StandardArrayT<DataType> values_writer(hfile.id(), path());
586 values_writer.parallelWrite(pm, st, values, unique_ids);
587 }
588}
589
590/*---------------------------------------------------------------------------*/
591/*---------------------------------------------------------------------------*/
592
593/*---------------------------------------------------------------------------*/
594/*---------------------------------------------------------------------------*/
595
596template <typename VariableType, typename DataType>
600, m_variable(v)
601{
602}
603
604/*---------------------------------------------------------------------------*/
605/*---------------------------------------------------------------------------*/
606
607template <typename VariableType, typename DataType> void
608Hdf5ScalarVariableInfo<VariableType, DataType>::
609readVariable(Hdf5Utils::HFile& hfile, const String& filename,
610 Hdf5Utils::StandardTypes& st, const String& ids_hpath, IData* data)
611{
612 ARCANE_UNUSED(ids_hpath);
613
614 UniqueArray<DataType> buffer;
615 IVariable* var = m_variable.variable();
616 IVariableMng* vm = var->variableMng();
617 ITraceMng* tm = vm->traceMng();
618 IParallelMng* pm = vm->parallelMng();
619 bool is_master = pm->isMasterIO();
620 //Integer master_rank = pm->masterIORank();
621 if (is_master) {
622 if (hfile.id() < 0)
623 hfile.openRead(filename);
624 }
625
626 Int64UniqueArray unique_ids;
627 _readStandardArray(buffer, hfile.id(), st);
628
629 Integer buf_size = buffer.size();
630 if (!data)
631 data = m_variable.variable()->data();
632 IArrayDataT<DataType>* true_data = dynamic_cast<IArrayDataT<DataType>*>(data);
633 if (!true_data)
634 throw FatalErrorException("Can not convert IData to IArrayDataT");
635 ArrayView<DataType> var_value = m_variable.asArray();
636 for (Integer z = 0; z < buf_size; ++z)
637 var_value[z] = buffer[z];
638 tm->info(4) << "End of read for variable '" << var->fullName() << "'";
639}
640
641/*---------------------------------------------------------------------------*/
642/*---------------------------------------------------------------------------*/
643
644template <typename VariableType, typename DataType> void
647{
648 IVariable* var = m_variable.variable();
649 IVariableMng* vm = var->variableMng();
650 ITraceMng* tm = vm->traceMng();
651 IParallelMng* pm = vm->parallelMng();
652 bool is_master = pm->isMasterIO();
653
654 Hdf5Utils::StandardArrayT<DataType> values(file_id, path());
655
656 if (is_master) {
657 values.readDim();
658 Int64ConstArrayView dims(values.dimensions());
659 Integer nb_dim = dims.size();
660 if (nb_dim != 1)
661 tm->fatal() << "Only one-dimension array are allowed "
662 << " dim=" << nb_dim << " var_name=" << var->fullName() << " path=" << path();
663 Integer nb_item = arcaneCheckArraySize(dims[0]);
664 tm->info(4) << "NB_ITEM: nb_item=" << nb_item;
665 buffer.resize(nb_item);
666 }
667 values.read(st, buffer);
668#if 0
669 {
670 Integer index=0;
671 Integer nb_item = buffer.size();
672 for( Integer i=0; i<nb_item; ++i ){
673 ++index;
674 tm->info() << " VAR_VAL i=" << i << " value=" << buffer[i];
675 if (index>20)
676 break;
677 }
678 }
679#endif
680}
681
682/*---------------------------------------------------------------------------*/
683/*---------------------------------------------------------------------------*/
684
685template <typename VariableType, typename DataType> void
688{
689 Hdf5Utils::StandardArrayT<DataType> values(file_id, path());
690 values.write(st, buffer);
691}
692
693/*---------------------------------------------------------------------------*/
694/*---------------------------------------------------------------------------*/
695
696template <typename VariableType, typename DataType> void
699{
700 IVariable* var = m_variable.variable();
701 IVariableMng* vm = var->variableMng();
702 IParallelMng* pm = vm->parallelMng();
703 ITraceMng* tm = vm->traceMng();
704 bool is_master = pm->isMasterIO();
705
706 ConstArrayView<DataType> var_values = m_variable.asArray();
707 Integer size = var_values.size();
708 UniqueArray<DataType> values(size);
709 for (Integer i = 0; i < size; ++i)
710 values[i] = var_values[i];
711
712 // Since it is a scalar variable, we consider that all
713 // processors have the same value. Therefore, only the master processor
714 // writes.
715 if (is_master) {
716 //{
717 Int64UniqueArray unique_ids;
718 Hdf5Utils::StandardArrayT<DataType> values_writer(hfile.id(), path());
719 tm->info(4) << "WRITE SCALAR VARIABLE name=" << m_variable.variable()->fullName();
720 values_writer.write(st, values);
721 //values_writer.parallelWrite(pm,st,values,unique_ids);
722 }
723}
724
725/*---------------------------------------------------------------------------*/
726/*---------------------------------------------------------------------------*/
727
728} // End namespace Arcane
729
730/*---------------------------------------------------------------------------*/
731/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
#define ENUMERATE_ITEM(name, group)
Generic enumerator for a node group.
#define ENUMERATE_NODE(name, group)
Generic enumerator for a node group.
Modifiable view of an array of type T.
Base class for 1D data vectors.
void resize(Int64 s)
Changes the number of elements in the array to s.
void copy(Span< const T > rhs)
Copies the values from rhs into the instance.
void add(ConstReferenceType val)
Adds element val to the end of the array.
Constant view of an array of type T.
Hash table for associative arrays.
virtual void writeVariable(Hdf5Utils::HFile &hfile, Hdf5Utils::StandardTypes &st)
Encapsulates a hid_t for a file.
Encapsulates a simple dataset from an HDF5 file that represents an array.
Definition of standard Arcane types for hdf5.
Base class for reading or writing a variable.
void writeGroup(Hdf5Utils::HFile &hfile, Hdf5Utils::StandardTypes &st, const String &hdf_path, Integer save_type)
const String & path() const
Path in the Hdf5 file containing the variable value.
Interface of a 1D array data item of type T.
Definition IData.h:300
Interface of a data item.
Definition IData.h:34
Interface of an entity family.
Definition IItemFamily.h:83
virtual String name() const =0
Family name.
virtual IVariable * findVariable(const String &name, bool throw_exception=false)=0
Searches for the variable name name associated with this family.
virtual IMesh * mesh() const =0
Associated mesh.
virtual IParallelMng * parallelMng()=0
Parallelism manager.
Interface of the parallelism manager for a subdomain.
virtual ITraceMng * traceMng() const =0
Trace manager.
virtual bool isMasterIO() const =0
true if the instance is a master I/O manager.
virtual char reduce(eReduceType rt, char v)=0
Performs a reduction of type rt on the real v and returns the value.
virtual TraceMessage pwarning()=0
Stream for a parallel warning message.
virtual TraceMessage info()=0
Stream for an information message.
Variable manager interface.
virtual IParallelMng * parallelMng() const =0
Associated parallelism manager.
virtual ITraceMng * traceMng()=0
Message manager.
Interface of a variable.
Definition IVariable.h:40
virtual eDataType dataType() const =0
Data type managed by the variable (Real, Integer, ...).
virtual String fullName() const =0
Full variable name (with family prefix).
virtual bool isPartial() const =0
Indicates if the variable is partial.
virtual Integer dimension() const =0
Dimension of the variable.
virtual ItemGroup itemGroup() const =0
Associated mesh group.
virtual IItemFamily * itemFamily() const =0
Associated entity family.
virtual IVariableMng * variableMng() const =0
Variable manager associated with the variable.
Mesh entity group.
Definition ItemGroup.h:51
Integer size() const
Number of elements in the group.
Definition ItemGroup.h:93
IItemFamily * itemFamily() const
Entity family to which this group belongs (0 for the null group).
Definition ItemGroup.h:128
eItemKind itemKind() const
Group kind. This is the kind of its elements.
Definition ItemGroup.h:114
IMesh * mesh() const
Mesh to which this group belongs (0 for the null group).
Definition ItemGroup.h:131
ItemGroup own() const
Group equivalent to this one but containing only the local elements of the subdomain.
Definition ItemGroup.cc:182
Int16 typeId() const
Type number.
Mesh element based on nodes (Edge,Face,Cell).
Definition Item.h:773
Int32 nbNode() const
Number of nodes of the entity.
Definition Item.h:837
NodeLocalIdView nodeIds() const
List of nodes of the entity.
Definition Item.h:846
Base class for a mesh element.
Definition Item.h:84
const ItemTypeInfo * typeInfo() const
Information about the entity type.
Definition Item.h:406
ItemWithNodes toItemWithNodes() const
Converts the entity to the ItemWithNodes kind.
Definition Item.h:1802
Class managing a 3-dimensional real vector.
Definition Real3.h:132
1D data vector with value semantics (STL style).
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
@ ReduceMax
Maximum of values.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Array< Int64 > Int64Array
Dynamic one-dimensional array of 64-bit integers.
Definition UtilsTypes.h:125
Integer arcaneCheckArraySize(unsigned long long size)
Checks that size can be converted into an 'Integer' to serve as the size of an array....
UniqueArray< Int64 > Int64UniqueArray
Dynamic 1D array of 64-bit integers.
Definition UtilsTypes.h:339
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
UniqueArray< Real3 > Real3UniqueArray
Dynamic 1D array of rank 3 vectors.
Definition UtilsTypes.h:363
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:480
UniqueArray< Int32 > Int32UniqueArray
Dynamic 1D array of 32-bit integers.
Definition UtilsTypes.h:341
eItemKind
Mesh entity type.
@ IK_Node
Node mesh entity.
@ IK_Cell
Cell mesh entity.
@ IK_Face
Face mesh entity.
@ IK_Edge
Edge mesh entity.
double Real
Type representing a real number.
@ DT_Real2x2
2x2 tensor data type
Definition DataTypes.h:50
@ DT_Real3x3
3x3 tensor data type
Definition DataTypes.h:51
@ DT_Int32
32-bit integer data type
Definition DataTypes.h:45
@ DT_Real3
Vector 3 data type.
Definition DataTypes.h:49
@ DT_Int64
64-bit integer data type
Definition DataTypes.h:46
@ DT_Real2
Vector 2 data type.
Definition DataTypes.h:48
@ DT_Real
Real data type.
Definition DataTypes.h:43
@ DT_Byte
Byte data type.
Definition DataTypes.h:42
Array< Real3 > Real3Array
Dynamic one-dimensional array of rank 3 vectors.
Definition UtilsTypes.h:149