Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
KdiPostProcessor.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* KdiPostProcessor.cc (C) 2000-2024 */
9/* */
10/* Pos-traitement avec l'outil KDI. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/Collection.h"
15#include "arcane/utils/Enumerator.h"
16#include "arcane/utils/Iostream.h"
17#include "arcane/utils/ScopedPtr.h"
18#include "arcane/utils/StringBuilder.h"
19#include "arcane/utils/CheckedConvert.h"
20#include "arcane/utils/JSONWriter.h"
21#include "arcane/utils/IOException.h"
22
23#include "arcane/core/PostProcessorWriterBase.h"
24#include "arcane/core/Directory.h"
25#include "arcane/core/FactoryService.h"
26#include "arcane/core/IDataWriter.h"
27#include "arcane/core/IData.h"
28#include "arcane/core/IItemFamily.h"
29#include "arcane/core/VariableCollection.h"
30#include "arcane/core/IParallelMng.h"
31#include "arcane/core/IMesh.h"
32
33#include "arcane/std/KdiPostProcessor_axl.h"
34#include "arcane/std/internal/VtkCellTypes.h"
35
36#include "arcane/std/internal/Kdi.h"
37
38// Timers. Pas actif pour l'instant
39#define tic(a)
40#define tac(a)
41
42// Pour pouvoir fonctionner il faut que KDI soit installé et les variables
43// suivantes soient positionnées
44// export PYTHONPATH=/path/to/kdi/pykdi/src
45// export KDI_DICTIONARY_PATH=/path/to/kdi/pykdi/src/pykdi/dictionary
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
50namespace Arcane
51{
52
53/*---------------------------------------------------------------------------*/
54/*---------------------------------------------------------------------------*/
55
57: public TraceAccessor
58, public IDataWriter
59{
60 public:
61
63
64 public:
65
66 void beginWrite(const VariableCollection& vars) override;
67 void endWrite() override;
68 void setMetaData(const String& meta_data) override;
69 void write(IVariable* var, IData* data) override;
70
71 public:
72
73 void setTimes(RealConstArrayView times) { m_times = times; }
74 void setDirectoryName(const String& dir_name) { m_directory_name = dir_name; }
75
76 private:
77
78 IMesh* m_mesh;
79
82
85
88
91
92 bool m_is_master_io = false;
93
97 KDIBase* m_kdi_base = nullptr;
100 KDIChunk* m_kdi_chunk_partless = nullptr;
101
102 private:
103
104 template <typename DataType> PyArrayObject*
105 _numpyDataSet1D(Span<const DataType> values);
106 template <typename DataType> PyArrayObject*
107 _numpyDataSet1D(IData* data);
108 template <typename DataType> PyArrayObject*
109 _numpyDataSet2D(Span2<const DataType> values);
110
111 PyArrayObject* _numpyDataSetReal3D(IData* data);
112 PyArrayObject* _numpyDataSetReal2D(IData* data);
113
114 String _getFileNameForTimeIndex(Int32 index)
115 {
116 StringBuilder sb(m_mesh->name());
117 if (index >= 0) {
118 sb += "_";
119 sb += index;
120 }
121 sb += ".hdf";
122 return sb.toString();
123 }
124};
125
126/*---------------------------------------------------------------------------*/
127/*---------------------------------------------------------------------------*/
128
129KdiDataWriter::
130KdiDataWriter(IMesh* mesh, ItemGroupCollection groups)
131: TraceAccessor(mesh->traceMng())
132, m_mesh(mesh)
133, m_groups(groups)
134{
135 static bool python_initialize = false;
136 if (!python_initialize) {
137 // https://stackoverflow.com/questions/52828873/how-does-import-array-in-numpy-c-api-work
138 // auto start = chrono::steady_clock::now();
139 // OLD clock_t begin = clock();
140 tic("initialize");
141 Py_Initialize();
142 import_array1();
143 // auto end = chrono::steady_clock::now();
144 // cout << "Elapsed time in milliseconds: "
145 // << chrono::duration_cast<chrono::milliseconds>(end - start).count()
146 // << " ms" << endl;
147 // OLD clock_t end = clock();
148 // OLD calcule le temps écoulé en trouvant la différence (end - begin) et
149 // OLD divisant la différence par CLOCKS_PER_SEC pour convertir en secondes
150 // OLD double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
151 // OLD printf("The elapsed time is %f seconds", time_spent);
152 tac("initialize");
153
154 python_initialize = true;
155 }
156}
157
158/*---------------------------------------------------------------------------*/
159/*---------------------------------------------------------------------------*/
160
161void KdiDataWriter::
162beginWrite(const VariableCollection& vars)
163{
164 tic("beginWrite");
165
166 ARCANE_UNUSED(vars);
167
168 IParallelMng* pm = m_mesh->parallelMng();
169 const Int32 nb_rank = pm->commSize();
170
171 m_is_master_io = true;
172
173 Int32 time_index = m_times.size();
174 const bool is_first_call = (time_index < 2);
175 if (is_first_call)
176 pwarning() << "L'implémentation au format 'Kdi' est expérimentale";
177
178 String filename = _getFileNameForTimeIndex(time_index);
179
180 Directory dir(m_directory_name);
181
182 m_full_filename = dir.file(filename);
183 info(4) << "KdiDataWriter::beginWrite() file=" << m_full_filename;
184
185 if (time_index <= 1) {
186 if (m_is_master_io) {
187 dir.createDirectory();
188 }
189 }
190
191 info() << "KDI begin";
192 info() << "KDI createBase full_filename=" << m_full_filename;
193 std::string full_filename = m_full_filename.localstr();
194 m_kdi_full_filename = full_filename.substr(0, full_filename.find_last_of("/\\") + 1) + "Mesh_kdi";
195 info() << "KDI createBase kdi_full_filename=" << m_kdi_full_filename;
196 if (!m_kdi_base) {
197 info() << "KDI createBase m_kdi_base=nullptr";
198 //indique si un fichier est lisible (et donc si il existe)
199 std::string filename = m_kdi_full_filename + ".json";
200 ifstream fichier(filename.c_str());
201 if (!fichier.fail()) {
202 info() << "KDI createBase " << m_kdi_full_filename << " exist";
203 tic("loadVTKHDF");
204 m_kdi_base = loadVTKHDF(m_kdi_full_filename);
205 tac("loadVTKHDF");
206 info() << "KDI createBase in file";
207 }
208 else {
209 if (nb_rank != 1) {
210 ARCANE_FATAL("Today, not support parallel execution!");
211 }
212 info() << "KDI createBase " << m_kdi_full_filename << " not exist";
213 tic("createBase");
214 m_kdi_base = createBase(nb_rank, true); // true : active les traces
215 tac("createBase");
216 info() << "KDI createBase in memory";
217 }
218 }
219 else {
220 info() << "KDI already createBase";
221 }
222 info() << "KDI update";
223 m_kdi_base->update("UnstructuredGrid", "/mymesh");
224 info() << "KDI chunk";
225 double float_step = m_times[time_index - 1];
226 Int32 my_rank = pm->commRank();
227 info() << "KDI chunk " << float_step << " " << my_rank;
228 m_kdi_chunk = m_kdi_base->chunk(float_step, my_rank);
229 m_kdi_chunk_partless = m_kdi_base->chunk(float_step);
230
231 CellGroup all_cells = m_mesh->allCells();
232 NodeGroup all_nodes = m_mesh->allNodes();
233
234 const Int32 nb_cell = all_cells.size();
235 const Int32 nb_node = all_nodes.size();
236
237 Int32 total_nb_connected_node = 0;
238 {
239 ENUMERATE_CELL (icell, all_cells) {
240 Cell cell = *icell;
241 total_nb_connected_node += cell.nodeIds().size();
242 }
243 }
244
245 // Pour les connectivités, la taille du tableau est égal
246 // au nombre de mailles plus 1.
247 UniqueArray<Int64> cells_connectivity(total_nb_connected_node);
248 UniqueArray<Int64> cells_offset(nb_cell + 1);
249 UniqueArray<unsigned char> cells_ghost_type(nb_cell);
250 UniqueArray<unsigned char> cells_type(nb_cell);
251 UniqueArray<Int64> cells_uid(nb_cell);
252 cells_offset[0] = 0;
253 {
254 Int32 connected_node_index = 0;
255 ENUMERATE_CELL (icell, all_cells) {
256 Int32 index = icell.index();
257 Cell cell = *icell;
258
259 cells_uid[index] = icell->uniqueId();
260
261 Byte ghost_type = 0;
262 bool is_ghost = !cell.isOwn();
263 if (is_ghost)
264 ghost_type = VtkUtils::CellGhostTypes::DUPLICATECELL;
265 cells_ghost_type[index] = ghost_type;
266
267 unsigned char vtk_type = VtkUtils::arcaneToVtkCellType(cell.type());
268 cells_type[index] = vtk_type;
269 for (NodeLocalId node : cell.nodeIds()) {
270 cells_connectivity[connected_node_index] = node;
271 ++connected_node_index;
272 }
273 cells_offset[index + 1] = connected_node_index;
274 }
275 }
276
277 {
278 info() << "KDI chunk set connectivity begin";
279 info() << "KDI DTYPE C++ connectivity";
280 PyArrayObject* parray = _numpyDataSet1D<Int64>(cells_connectivity);
281 m_kdi_chunk->set("/mymesh/cells/connectivity", parray);
282 info() << "KDI chunk set connectivity end";
283 }
284 {
285 info() << "KDI chunk set cells types begin";
286 // PyArrayObject* parray = _numpyDataSet1D<unsigned char>(cells_type);
287 info() << "KDI DTYPE C++ cells types";
288 PyArrayObject* parray = _numpyDataSet1D<unsigned char>(cells_type);
289 m_kdi_chunk->set("/mymesh/cells/types", parray);
290 info() << "KDI chunk set cells types end";
291 }
292
293 // Sauve les uniqueIds, les types et les coordonnées des noeuds.
294 {
295 UniqueArray<Int64> nodes_uid(nb_node);
296 UniqueArray<unsigned char> nodes_ghost_type(nb_node);
297 VariableNodeReal3& nodes_coordinates(m_mesh->nodesCoordinates());
298 UniqueArray2<Real> points;
299 points.resize(nb_node, 3);
300 ENUMERATE_NODE (inode, all_nodes) {
301 Int32 index = inode.index();
302 Node node = *inode;
303
304 nodes_uid[index] = inode->uniqueId();
305
306 Byte ghost_type = 0;
307 bool is_ghost = !node.isOwn();
308 if (is_ghost)
309 ghost_type = VtkUtils::PointGhostTypes::DUPLICATEPOINT;
310 nodes_ghost_type[index] = ghost_type;
311
312 Real3 pos = nodes_coordinates[inode];
313 points[index][0] = pos.x;
314 points[index][1] = pos.y;
315 points[index][2] = pos.z;
316 }
317
318 {
319 info() << "KDI chunk set connectivity begin";
320 PyArrayObject* parray = _numpyDataSet2D<Real>(points);
321 m_kdi_chunk->set("/mymesh/points/cartesianCoordinates", parray);
322 info() << "KDI chunk set connectivity end";
323 }
324 // Fields points
325 {
326 const std::string namefield = m_kdi_base->update_fields("/mymesh/points/fields", "GlobalNodeId");
327 assert(namefield == "/mymesh/points/fields/GlobalNodeId");
328 info() << "KDI chunk set GlobalNodeId begin";
329 info() << "KDI DTYPE C++ GlobalNodeId";
330 PyArrayObject* parray = _numpyDataSet1D<Int64>(nodes_uid);
331 m_kdi_chunk->set(namefield, parray);
332 info() << "KDI chunk set GlobalNodeId end";
333 }
334 {
335 const std::string namefield = m_kdi_base->update_fields("/mymesh/points/fields", "vtkGhostType");
336 assert(namefield == "/mymesh/points/fields/vtkGhostType");
337 info() << "KDI chunk set node vtkGhostType begin";
338 info() << "KDI DTYPE C++ node vtkGhostType";
339 PyArrayObject* parray = _numpyDataSet1D<unsigned char>(nodes_ghost_type);
340 m_kdi_chunk->set(namefield, parray);
341 info() << "KDI chunk set node vtkGhostType end";
342 }
343 }
344
345 // Fields cells
346 {
347 const std::string namefield = m_kdi_base->update_fields("/mymesh/cells/fields", "GlobalCellId");
348 assert(namefield == "/mymesh/cells/fields/GlobalCellId");
349 info() << "KDI chunk set GlobalCellId begin";
350 info() << "KDI DTYPE C++ cell GlobalCellId";
351 PyArrayObject* parray = _numpyDataSet1D<Int64>(cells_uid);
352 m_kdi_chunk->set(namefield, parray);
353 info() << "KDI chunk set GlobalCellId end";
354 }
355 {
356 const std::string namefield = m_kdi_base->update_fields("/mymesh/cells/fields", "vtkGhostType");
357 assert(namefield == "/mymesh/cells/fields/vtkGhostType");
358 info() << "KDI chunk set cell vtkGhostType begin";
359 info() << "KDI DTYPE C++ cell vtkGhostType";
360 PyArrayObject* parray = _numpyDataSet1D<unsigned char>(cells_ghost_type);
361 m_kdi_chunk->set(namefield, parray);
362 info() << "KDI chunk set cell vtkGhostType end";
363 }
364 tac("beginWrite");
365}
366
367/*---------------------------------------------------------------------------*/
368/*---------------------------------------------------------------------------*/
369
370// https://omz-software.com/pythonista/numpy/reference/c-api.dtype.html
371// https://numpy.org/doc/stable/reference/arrays.dtypes.html
372namespace
373{
374 template <typename DataType> class KDITraits;
375
376 template <> class KDITraits<Int64>
377 {
378 public:
379
380 static int kdiType()
381 {
382 std::cout << "KDI DTYPE C++ PyArray_LONG" << std::endl;
383 return NPY_INT64;
384 }
385 };
386
387 template <> class KDITraits<Int32>
388 {
389 public:
390
391 static int kdiType()
392 {
393 std::cout << "KDI DTYPE C++ PyArray_INT" << std::endl;
394 return NPY_INT32;
395 }
396 };
397
398 template <> class KDITraits<double>
399 {
400 public:
401
402 static int kdiType()
403 {
404 std::cout << "KDI DTYPE C++ PyArray_DOUBLE" << std::endl;
405 return NPY_FLOAT64;
406 }
407 };
408
409 template <> class KDITraits<unsigned char>
410 {
411 public:
412
413 static int kdiType()
414 {
415 std::cout << "KDI DTYPE C++ PyArray_UINT8" << std::endl;
416 return NPY_UINT8;
417 }
418 };
419
420} // namespace
421
422/*---------------------------------------------------------------------------*/
423/*---------------------------------------------------------------------------*/
424
425// https://github.com/BorgwardtLab/GraphKernels/blob/master/src/GKextCPy/eigen.i
426template <typename DataType> PyArrayObject* KdiDataWriter::
427_numpyDataSet1D(Span<const DataType> values)
428{
429 info() << "KDI _numpyDataSet1D begin";
430 bool trace{ true };
431 npy_intp dims[]{ values.size() };
432 const int py_type = KDITraits<DataType>::kdiType();
433 info() << "KDI DTYPE C++ py_type " << py_type;
434 PyArrayObject* vec_array = reinterpret_cast<PyArrayObject*>(PyArray_SimpleNew(1, dims, py_type));
435 DataType* vec_array_pointer = static_cast<DataType*>(PyArray_DATA(vec_array));
436 KTRACE(trace, vec_array_pointer);
437 std::copy(values.data(), values.data() + values.size(), vec_array_pointer);
438 info() << "KDI _numpyDataSet1D end";
439 return vec_array;
440}
441
442/*---------------------------------------------------------------------------*/
443/*---------------------------------------------------------------------------*/
444
445// https://github.com/BorgwardtLab/GraphKernels/blob/master/src/GKextCPy/eigen.i
446template <typename DataType> PyArrayObject* KdiDataWriter::
447_numpyDataSet2D(Span2<const DataType> values)
448{
449 info() << "KDI _numpyDataSet2D begin";
450 bool trace{ true };
451 npy_intp dims[2] = { values.dim1Size(), values.dim2Size() };
452 const int py_type = KDITraits<DataType>::kdiType();
453 PyArrayObject* vec_array = reinterpret_cast<PyArrayObject*>(PyArray_SimpleNew(2, dims, py_type));
454 DataType* vec_array_pointer = static_cast<DataType*>(PyArray_DATA(vec_array));
455 KTRACE(trace, vec_array_pointer);
456 std::copy(values.data(), values.data() + values.dim1Size() * values.dim2Size(), vec_array_pointer);
457 info() << "KDI _numpyDataSet2D end";
458 return vec_array;
459}
460
461/*---------------------------------------------------------------------------*/
462/*---------------------------------------------------------------------------*/
463
464void KdiDataWriter::
465endWrite()
466{
467 tic("endWrite");
468
469 tic("saveVTKHDF");
470 m_kdi_chunk_partless->saveVTKHDF(m_kdi_full_filename);
471 tac("saveVTKHDF");
472 // m_kdi_base = loadVTKHDF(m_kdi_full_filename);
473 // N'est pas utile puisqu'on detruit cet objet apres chaque ecriture
474
475 // Ecrit le fichier contenant les temps (à partir de la version 5.5 de paraview)
476 // https://www.paraview.org/Wiki/ParaView_Release_Notes#JSON_based_new_meta_file_format_for_series_added
477 //
478 // Exemple:
479 // {
480 // "file-series-version" : "1.0",
481 // "files" : [
482 // { "name" : "foo1.vtk", "time" : 0 },
483 // { "name" : "foo2.vtk", "time" : 5.5 },
484 // { "name" : "foo3.vtk", "time" : 11.2 }
485 // ]
486 // }
487
488 if (!m_is_master_io)
489 return;
490
491 tac("endWrite");
492}
493
494/*---------------------------------------------------------------------------*/
495/*---------------------------------------------------------------------------*/
496
499{
500 ARCANE_UNUSED(meta_data);
501}
502
503/*---------------------------------------------------------------------------*/
504/*---------------------------------------------------------------------------*/
505
507write(IVariable* var, IData* data)
508{
509 tic("write");
510
511 info(4) << "Write Kdi var=" << var->name();
512
513 eItemKind item_kind = var->itemKind();
514
515 if (var->dimension() != 1)
516 ARCANE_FATAL("Only export of scalar item variable is implemented (name={0})", var->name());
517
518 {
519 info() << "KDI chunk set " << var->name() << " begin";
520 std::string namefield;
521 switch (item_kind) {
522 case IK_Cell:
523 namefield = m_kdi_base->update_fields("/mymesh/cells/fields", var->name().localstr());
524 break;
525 case IK_Node:
526 namefield = m_kdi_base->update_fields("/mymesh/points/fields", var->name().localstr());
527 break;
528 default:
529 ARCANE_FATAL("Only export of 'Cell' or 'Node' variable is implemented (name={0})", var->name());
530 }
531
532 info() << "KDI DTYPE C++ var->name() " << var->name();
533
534 eDataType data_type = var->dataType();
535 PyArrayObject* parray = nullptr;
536 switch (data_type) {
537 case DT_Real:
539 break;
540 case DT_Int64:
542 break;
543 case DT_Int32:
545 break;
546 case DT_Real3:
547 parray = _numpyDataSetReal3D(data);
548 break;
549 case DT_Real2:
550 parray = _numpyDataSetReal2D(data);
551 break;
552 default:
553 warning() << String::format("Export for datatype '{0}' is not supported (var_name={1})", data_type, var->name());
554 }
555
557 info() << "KDI chunk set " << var->name() << " end";
558 }
559
560 tac("write");
561}
562
563/*---------------------------------------------------------------------------*/
564/*---------------------------------------------------------------------------*/
565
566// https://github.com/BorgwardtLab/GraphKernels/blob/master/src/GKextCPy/eigen.i
567template <typename DataType> PyArrayObject* KdiDataWriter::
568_numpyDataSet1D(IData* data)
569{
570 auto* true_data = dynamic_cast<IArrayDataT<DataType>*>(data);
572 info() << "KDI _numpyDataSet1D var/data begin";
573 PyArrayObject* vec_array = _numpyDataSet1D(Span<const DataType>(true_data->view()));
574 info() << "KDI _numpyDataSet1D var/data end";
575 return vec_array;
576}
577
578/*---------------------------------------------------------------------------*/
579/*---------------------------------------------------------------------------*/
580
581// https://github.com/BorgwardtLab/GraphKernels/blob/master/src/GKextCPy/eigen.i
582PyArrayObject* KdiDataWriter::
583_numpyDataSetReal3D(IData* data)
584{
585 info() << "KDI _numpyDataSetReal3D var/data begin";
586 auto* true_data = dynamic_cast<IArrayDataT<Real3>*>(data);
587 ARCANE_CHECK_POINTER(true_data);
588 SmallSpan<const Real3> values(true_data->view());
589 Int32 nb_value = values.size();
590 // TODO: optimiser cela sans passer par un tableau temporaire
591 UniqueArray2<Real> scalar_values;
592 scalar_values.resize(nb_value, 3);
593 for (Int32 i = 0; i < nb_value; ++i) {
594 Real3 v = values[i];
595 scalar_values[i][0] = v.x;
596 scalar_values[i][1] = v.y;
597 scalar_values[i][2] = v.z;
598 }
599
600 PyArrayObject* vec_array = _numpyDataSet2D<Real>(scalar_values);
601 info() << "KDI _numpyDataSetReal3D var/data end";
602 return vec_array;
603}
604
605/*---------------------------------------------------------------------------*/
606/*---------------------------------------------------------------------------*/
607
608// https://github.com/BorgwardtLab/GraphKernels/blob/master/src/GKextCPy/eigen.i
609PyArrayObject* KdiDataWriter::
610_numpyDataSetReal2D(IData* data)
611{
612 info() << "KDI _numpyDataSetReal3D var/data begin";
613 // Converti en un tableau de 3 composantes dont la dernière vaudra 0.
614 auto* true_data = dynamic_cast<IArrayDataT<Real2>*>(data);
615 ARCANE_CHECK_POINTER(true_data);
616 SmallSpan<const Real2> values(true_data->view());
617 Int32 nb_value = values.size();
618 UniqueArray2<Real> scalar_values;
619 scalar_values.resize(nb_value, 3);
620 for (Int32 i = 0; i < nb_value; ++i) {
621 Real2 v = values[i];
622 scalar_values[i][0] = v.x;
623 scalar_values[i][1] = v.y;
624 scalar_values[i][2] = 0.0;
625 }
626
627 PyArrayObject* vec_array = _numpyDataSet2D<Real>(scalar_values);
628 info() << "KDI _numpyDataSetReal3D var/data end";
629 return vec_array;
630}
631
632/*---------------------------------------------------------------------------*/
633/*---------------------------------------------------------------------------*/
634
635/*---------------------------------------------------------------------------*/
636/*---------------------------------------------------------------------------*/
642{
643 public:
644
645 explicit KdiPostProcessor(const ServiceBuildInfo& sbi)
647 {
648 }
649
650 IDataWriter* dataWriter() override { return m_writer.get(); }
651 void notifyBeginWrite() override
652 {
653 auto w = std::make_unique<KdiDataWriter>(mesh(), groups());
654 w->setTimes(times());
656 w->setDirectoryName(dir.file("kdi"));
657 m_writer = std::move(w);
658 }
659 void notifyEndWrite() override
660 {
661 m_writer = nullptr;
662 }
663 void close() override {}
664
665 private:
666
667 std::unique_ptr<IDataWriter> m_writer;
668};
669
670/*---------------------------------------------------------------------------*/
671/*---------------------------------------------------------------------------*/
672
673ARCANE_REGISTER_SERVICE_KDIPOSTPROCESSOR(KdiPostProcessor,
674 KdiPostProcessor);
675
676/*---------------------------------------------------------------------------*/
677/*---------------------------------------------------------------------------*/
678
679} // namespace Arcane
680
681/*---------------------------------------------------------------------------*/
682/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
#define ENUMERATE_CELL(name, group)
Enumérateur générique d'un groupe de mailles.
#define ENUMERATE_NODE(name, group)
Enumérateur générique d'un groupe de noeuds.
Generation de la classe de base du Service.
Classe gérant un répertoire.
Definition Directory.h:33
Interface d'écriture des données d'une variable.
Definition IDataWriter.h:49
Interface d'une donnée.
Definition IData.h:33
virtual Int32 commRank() const =0
Rang de cette instance dans le communicateur.
virtual Int32 commSize() const =0
Nombre d'instance dans le communicateur.
Interface d'une variable.
Definition IVariable.h:54
KDIChunk * m_kdi_chunk
Identifiant Chunk de la sortie (vtps, ipart) et (vtps, partless)
void write(IVariable *var, IData *data) override
Ecrit les données data de la variable var.
String m_directory_name
Répertoire de sortie.
void setMetaData(const String &meta_data) override
Positionne les infos des méta-données.
KDIBase * m_kdi_base
Identifiant KDI de la sortie.
UniqueArray< Real > m_times
Liste des temps.
std::string m_kdi_full_filename
Nom du fichier HDF courant.
ItemGroupCollection m_groups
Liste des groupes à sauver.
String m_full_filename
Nom du fichier HDF courant.
Post-traitement utilisant Kdi.
void notifyBeginWrite() override
Notifie qu'une sortie va être effectuée avec les paramètres courants.
void close() override
Ferme l'écrivain. Après fermeture, il ne peut plus être utilisé
void notifyEndWrite() override
Notifie qu'une sortie vient d'être effectuée.
IDataWriter * dataWriter() override
Retourne l'écrivain associé à ce post-processeur.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
virtual RealConstArrayView times()
Liste des temps sauvés.
virtual const String & baseDirectoryName()
Nom du répertoire de sortie des fichiers.
virtual ItemGroupCollection groups()
Liste des groupes à sauver.
Structure contenant les informations pour créer un service.
Collection de variables.
Integer size() const
Nombre d'éléments du vecteur.
Vue constante d'un tableau de type T.
Constructeur de chaîne de caractère unicode.
Chaîne de caractères unicode.
const char * localstr() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
Definition String.cc:227
TraceMessage pwarning() const
TraceMessage warning() const
Flot pour un message d'avertissement.
TraceMessage info() const
Flot pour un message d'information.
Definition Kdi.h:144
Definition Kdi.h:42
ItemGroupT< Cell > CellGroup
Groupe de mailles.
Definition ItemTypes.h:183
ItemGroupT< Node > NodeGroup
Groupe de noeuds.
Definition ItemTypes.h:167
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Collection< ItemGroup > ItemGroupCollection
Collection de groupes d'éléments du maillage.
eItemKind
Genre d'entité de maillage.
@ IK_Node
Entité de maillage de genre noeud.
@ IK_Cell
Entité de maillage de genre maille.
unsigned char Byte
Type d'un octet.
Definition UtilsTypes.h:142
eDataType
Type d'une donnée.
Definition DataTypes.h:39
@ 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_Int64
Donnée de type entier 64 bits.
Definition DataTypes.h:44
@ DT_Real2
Donnée de type vecteur 2.
Definition DataTypes.h:46
@ DT_Real
Donnée de type réel.
Definition DataTypes.h:41