Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
MeshMaterialVariableFactoryRegisterer.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/* MeshMaterialFactoryRegisterer.cc (C) 2000-2022 */
9/* */
10/* Singleton permettant d'enregister une fabrique de variable matériaux. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/materials/MeshMaterialVariableFactoryRegisterer.h"
15
16#include "arcane/utils/Ref.h"
17#include "arcane/core/materials/IMeshMaterialVariableFactory.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane::Materials
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
30{
31 using CreateFunc = MeshMaterialVariableFactoryVariableRefCreateFunc;
32
33 public:
34
36 CreateFunc func)
37 : m_variable_type_info(var_type_info)
38 , m_function(func)
39 {
40 }
41
43 {
44 ARCANE_CHECK_POINTER(m_function);
45 return (*m_function)(build_info);
46 }
47
49 {
50 return m_variable_type_info;
51 }
52
53 private:
54
55 MaterialVariableTypeInfo m_variable_type_info;
56 CreateFunc m_function;
57};
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
61
62typename MeshMaterialVariableFactoryRegisterer::BaseInfo MeshMaterialVariableFactoryRegisterer::m_global_infos;
63
64typename MeshMaterialVariableFactoryRegisterer::BaseInfo& MeshMaterialVariableFactoryRegisterer::
65registererInfo()
66{
67 return m_global_infos;
68}
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
73Ref<IMeshMaterialVariableFactory> MeshMaterialVariableFactoryRegisterer::
75{
76 auto* x = new MeshMaterialVariableFactory(m_variable_type_info, m_function);
77 return makeRef<IMeshMaterialVariableFactory>(x);
78}
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
83} // End namespace Arcane::Materials
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
Interface d'une variable matériau d'un maillage.
Informations caractérisant le type d'une variable matériau.
Ref< IMeshMaterialVariableFactory > createFactory()
Créé une fabrique pour ce type de variable.
MaterialVariableTypeInfo materialVariableTypeInfo() const override
Informations sur le type de variable créée.
IMeshMaterialVariable * createVariable(const MaterialVariableBuildInfo &build_info) override
Créé une variable matériau.
Active toujours les traces dans les parties Arcane concernant les matériaux.