Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
BasicReaderWriter.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/* BasicReaderWriter.cc (C) 2000-2024 */
9/* */
10/* Lecture/Ecriture simple. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/std/internal/BasicReaderWriter.h"
15
16#include "arcane/utils/FatalErrorException.h"
17#include "arcane/utils/StringBuilder.h"
18#include "arcane/utils/ValueConvert.h"
19
20#include "arcane/core/IParallelMng.h"
21#include "arcane/core/ServiceBuilder.h"
22#include "arcane/core/ItemGroup.h"
23#include "arcane/core/ISerializedData.h"
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29namespace Arcane::impl
30{
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35String BasicReaderWriterCommon::
36_getArcaneDBTag()
37{
38 return "ArcaneCheckpointRestartDataBase";
39}
40
41String BasicReaderWriterCommon::
42_getOwnMetatadaFile(const String& path, Int32 rank)
43{
44 StringBuilder filename = path;
45 filename += "/own_metadata_";
46 filename += rank;
47 filename += ".txt";
48 return filename;
49}
50
51String BasicReaderWriterCommon::
52_getArcaneDBFile(const String& path, Int32 rank)
53{
54 StringBuilder filename = path;
55 filename += "/arcane_db_n";
56 filename += rank;
57 filename += ".acr";
58 return filename;
59}
60
61String BasicReaderWriterCommon::
62_getBasicVariableFile(Int32 version, const String& path, Int32 rank)
63{
64 if (version >= 3) {
65 return _getArcaneDBFile(path, rank);
66 }
67 StringBuilder filename = path;
68 filename += "/var___MAIN___";
69 filename += rank;
70 filename += ".txt";
71 return filename;
72}
73
74String BasicReaderWriterCommon::
75_getBasicGroupFile(const String& path, const String& name, Int32 rank)
76{
77 StringBuilder filename = path;
78 filename += "/group_";
79 filename += name;
80 filename += "_";
81 filename += rank;
82 filename += ".txt";
83 return filename;
84}
85
86Ref<IDataCompressor> BasicReaderWriterCommon::
87_createDeflater(IApplication* app, const String& name)
88{
89 ServiceBuilder<IDataCompressor> sf(app);
90 Ref<IDataCompressor> bc = sf.createReference(app, name);
91 return bc;
92}
93
94Ref<IHashAlgorithm> BasicReaderWriterCommon::
95_createHashAlgorithm(IApplication* app, const String& name)
96{
97 ServiceBuilder<IHashAlgorithm> sf(app);
98 Ref<IHashAlgorithm> bc = sf.createReference(app, name);
99 return bc;
100}
101
102void BasicReaderWriterCommon::
103_fillUniqueIds(const ItemGroup& group, Array<Int64>& uids)
104{
105 MeshUtils::fillUniqueIds(group.view(),uids);
106}
107
108/*---------------------------------------------------------------------------*/
109/*---------------------------------------------------------------------------*/
110
111String BasicReaderWriterCommon::
112_getMetaDataFileName(Int32 rank) const
113{
114 StringBuilder filename = m_path;
115 filename += "/metadata";
116 filename += "-";
117 filename += rank;
118 filename += ".txt";
119 return filename;
120}
121
122/*---------------------------------------------------------------------------*/
123/*---------------------------------------------------------------------------*/
124
125BasicReaderWriterCommon::
126BasicReaderWriterCommon(IApplication* app, IParallelMng* pm,
127 const String& path, eOpenMode open_mode)
128: TraceAccessor(pm->traceMng())
129, m_application(app)
130, m_parallel_mng(pm)
131, m_open_mode(open_mode)
132, m_path(path)
133{}
134
135/*---------------------------------------------------------------------------*/
136/*---------------------------------------------------------------------------*/
137
138} // namespace Arcane::impl
139
140/*---------------------------------------------------------------------------*/
141/*---------------------------------------------------------------------------*/
Fonctions utilitaires sur le maillage.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120