Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MeshMaterialVariableFactoryMng.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/* MeshMaterialVariableFactoryMng.cc (C) 2000-2022 */
9/* */
10/* Gestionnaire des fabriques de variables matériaux. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/TraceAccessor.h"
15#include "arcane/utils/FatalErrorException.h"
16
17#include "arcane/core/materials/MaterialVariableTypeInfo.h"
18#include "arcane/core/materials/IMeshMaterialVariableFactory.h"
19#include "arcane/core/materials/IMeshMaterialVariableFactoryMng.h"
20#include "arcane/core/materials/IMeshMaterialMng.h"
21
22#include <map>
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane::Materials
28{
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32// TODO: Utiliser Ref<>
34: public TraceAccessor
36{
37 public:
38
41
42 public:
43
44 void build() override;
45 ITraceMng* traceMng() const override;
49
50 private:
51
52 std::map<String, Ref<IMeshMaterialVariableFactory>> m_factories;
53};
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58MeshMaterialVariableFactoryMng::
59MeshMaterialVariableFactoryMng(IMeshMaterialMng* mm)
60: TraceAccessor(mm->traceMng())
61{
62}
63
64/*---------------------------------------------------------------------------*/
65/*---------------------------------------------------------------------------*/
66
67MeshMaterialVariableFactoryMng::
68~MeshMaterialVariableFactoryMng()
69{
70}
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
74
77{
78 auto x = m_factories.find(storage_type);
79 if (x == m_factories.end())
80 ARCANE_FATAL("Can not find mesh IMeshMaterialVariableFactory named={0}", storage_type);
81
82 return x->second->createVariable(build_info);
83}
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
104
107{
108 MaterialVariableTypeInfo t = factory->materialVariableTypeInfo();
109 m_factories.insert(std::make_pair(t.fullName(), factory));
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
116arcaneCreateMeshMaterialVariableFactoryMng(IMeshMaterialMng* mm)
117{
118 auto* x = new MeshMaterialVariableFactoryMng(mm);
119 x->build();
120 return x;
121}
122
123/*---------------------------------------------------------------------------*/
124/*---------------------------------------------------------------------------*/
125
126} // End namespace Arcane::Materials
127
128/*---------------------------------------------------------------------------*/
129/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Interface du gestionnaire des matériaux et des milieux d'un maillage.
Interface du gestionnaire de fabrique de variables matériaux.
Interface d'une variable matériau d'un maillage.
Informations caractérisant le type d'une variable matériau.
IMeshMaterialVariable * createVariable(const String &storage_type, const MaterialVariableBuildInfo &build_info) override
Créé une variable matériau.
ITraceMng * traceMng() const override
Gestionnaire de trace associé
void registerFactory(Ref< IMeshMaterialVariableFactory > factory) override
Enregistre la fabrique factory.
Interface du gestionnaire de traces.
Chaîne de caractères unicode.
ITraceMng * traceMng() const
Gestionnaire de trace.
Active toujours les traces dans les parties Arcane concernant les matériaux.