Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
DataFactoryMng.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/* DataFactoryMng.cc (C) 2000-2021 */
9/* */
10/* Gestionnaire de fabriques de données. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/impl/DataFactoryMng.h"
15
16#include "arcane/utils/PlatformUtils.h"
17#include "arcane/utils/Deleter.h"
18#include "arcane/utils/ITraceMng.h"
19#include "arcane/utils/FatalErrorException.h"
20
21#include "arcane/IApplication.h"
22#include "arcane/IData.h"
23#include "arcane/IDataStorageFactory.h"
24#include "arcane/MathUtils.h"
25
26#include "arcane/datatype/DataStorageTypeInfo.h"
27#include "arcane/datatype/DataStorageBuildInfo.h"
28
29#include "arcane/impl/SerializedData.h"
30#include "arcane/impl/DataFactory.h"
31#include "arcane/impl/DataOperation.h"
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
36namespace Arcane
37{
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42extern "C++" void
43arcaneRegisterSimpleData(IDataFactoryMng* df);
44
45/*---------------------------------------------------------------------------*/
46/*---------------------------------------------------------------------------*/
47
48DataFactoryMng::
49DataFactoryMng(IApplication* app)
50: TraceAccessor(app->traceMng())
51, m_application(app)
52, m_old_factory(new DataFactory(app))
53{
54}
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
59DataFactoryMng::
60~DataFactoryMng()
61{
62 delete m_old_factory;
63}
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
67
68Ref<IData> DataFactoryMng::
69createSimpleDataRef(const String& storage_type,const DataStorageBuildInfo& build_info)
70{
71 auto x = m_factories.find(storage_type);
72 if (x==m_factories.end())
73 ARCANE_FATAL("Can not find data factory named={0}",storage_type);
74 // Positionne les valeurs de \a build_info qui ne sont pas encore
75 // initialisées.
76 DataStorageBuildInfo b = build_info;
77 if (!b.memoryAllocator())
78 b.setMemoryAllocator(platform::getDefaultDataAllocator());
79
80 return x->second->createSimpleDataRef(b);
81}
82
83/*---------------------------------------------------------------------------*/
84/*---------------------------------------------------------------------------*/
85
86IDataOperation* DataFactoryMng::
87createDataOperation(Parallel::eReduceType rt)
88{
89 return arcaneCreateDataOperation(rt);
90}
91
92/*---------------------------------------------------------------------------*/
93/*---------------------------------------------------------------------------*/
94
95Ref<ISerializedData> DataFactoryMng::
96createSerializedDataRef(eDataType data_type,Int64 memory_size,
97 Integer nb_dim,Int64 nb_element,Int64 nb_base_element,
98 bool is_multi_size,Int64ConstArrayView dimensions)
99{
101 nb_base_element,is_multi_size,dimensions);
102}
103
104/*---------------------------------------------------------------------------*/
105/*---------------------------------------------------------------------------*/
106
107Ref<ISerializedData> DataFactoryMng::
108createEmptySerializedDataRef()
109{
111}
112
113/*---------------------------------------------------------------------------*/
114/*---------------------------------------------------------------------------*/
115
116void DataFactoryMng::
117build()
118{
119 arcaneRegisterSimpleData(this);
120}
121
122/*---------------------------------------------------------------------------*/
123/*---------------------------------------------------------------------------*/
124
125ITraceMng* DataFactoryMng::
126traceMng() const
127{
128 return TraceAccessor::traceMng();
129}
130
131/*---------------------------------------------------------------------------*/
132/*---------------------------------------------------------------------------*/
133
134void DataFactoryMng::
135registerDataStorageFactory(Ref<IDataStorageFactory> factory)
136{
137 DataStorageTypeInfo t = factory->storageTypeInfo();
138 m_factories.insert(std::make_pair(t.fullName(),factory));
139}
140
141/*---------------------------------------------------------------------------*/
142/*---------------------------------------------------------------------------*/
143
145arcaneCreateDataFactoryMngRef(IApplication* app)
146{
148 df->build();
149 return df;
150}
151
152/*---------------------------------------------------------------------------*/
153/*---------------------------------------------------------------------------*/
154
155} // End namespace Arcane
156
157/*---------------------------------------------------------------------------*/
158/*---------------------------------------------------------------------------*/
159
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Gestionnaire de fabrique d'une donnée.
Informations de type pour un conteneur de données.
Interface de l'application.
Interface d'une opération sur une donnée.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Vue constante d'un tableau de type T.
Interface du gestionnaire de traces.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Ref< ISerializedData > arcaneCreateSerializedDataRef(eDataType data_type, Int64 memory_size, Integer nb_dim, Int64 nb_element, Int64 nb_base_element, bool is_multi_size, Int64ConstArrayView dimensions)
Créé des données sérialisées.
Ref< ISerializedData > arcaneCreateEmptySerializedDataRef()
Créé des données sérialisées.
eDataType
Type d'une donnée.
Definition DataTypes.h:39
eReduceType
Types des réductions supportées.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Créé une référence sur un pointeur.