Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ComponentItemInternal.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/* ComponentItemInternal.cc (C) 2000-2024 */
9/* */
10/* Partie interne d'une maille matériau ou milieu. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/materials/ComponentItemInternal.h"
15
16#include "arcane/utils/FixedArray.h"
17#include "arcane/utils/FatalErrorException.h"
18
19#include <mutex>
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane::Materials
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
35{
36 public:
37
38 FixedArray<ConstituentItemIndex, 2> m_first_sub_constituent_item_id_list;
39 FixedArray<Int16, 2> m_component_id_list = { { -1, -1 } };
40 FixedArray<Int16, 2> m_nb_sub_constituent_item_list = {};
41 FixedArray<Int32, 2> m_global_item_local_id_list = { { NULL_ITEM_LOCAL_ID } };
42 FixedArray<ConstituentItemIndex, 2> m_super_component_item_local_id_list = {};
43 FixedArray<MatVarIndex, 2> m_var_index_list = { { MatVarIndex(-1, -1) } };
44};
45
46namespace
47{
49}
50
51/*---------------------------------------------------------------------------*/
52/*---------------------------------------------------------------------------*/
53
55ComponentItemSharedInfo* ComponentItemSharedInfo::null_shared_info_pointer = &ComponentItemSharedInfo::null_shared_info;
56namespace
57{
59}
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63
64void ComponentItemSharedInfo::
65_setNullInstance()
66{
67 auto init_func = []() {
68 ComponentItemSharedInfo* x = null_shared_info_pointer;
69 NullComponentItemSharedInfoContainer& c = global_null_component_item_shared_info_container;
70
71 x->m_storage_size = 0;
72 x->m_first_sub_constituent_item_id_data = c.m_first_sub_constituent_item_id_list.data() + 1;
73 x->m_super_component_item_local_id_data = c.m_super_component_item_local_id_list.data() + 1;
74 x->m_component_id_data = c.m_component_id_list.data() + 1;
75
76 x->m_nb_sub_constituent_item_data = c.m_nb_sub_constituent_item_list.data() + 1;
77 x->m_global_item_local_id_data = c.m_global_item_local_id_list.data() + 1;
78 x->m_var_index_data = c.m_var_index_list.data() + 1;
79 };
80 // Garanti que cela ne sera appelé qu'une seule fois et protège des appels
81 // concurrents.
82 std::call_once(component_set_null_instance_once_flag, init_func);
83}
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
88std::ostream&
89operator<<(std::ostream& o, const ConstituentItemIndex& id)
90{
91 o << id.localId();
92 return o;
93}
94
95/*---------------------------------------------------------------------------*/
96/*---------------------------------------------------------------------------*/
97
98void ConstituentItemLocalIdListView::
99_checkCoherency() const
100{
101 if (!m_component_shared_info)
102 ARCANE_FATAL("Null ComponentItemSharedInfo");
103}
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108} // End namespace Arcane::Materials
109
110/*---------------------------------------------------------------------------*/
111/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Informations partagées sur les 'ComponentItem'.
static ComponentItemSharedInfo null_shared_info
Pour l'entité nulle.
Représente un index sur les variables matériaux et milieux.
std::ostream & operator<<(std::ostream &o, eExecutionPolicy exec_policy)
Affiche le nom de la politique d'exécution.
Active toujours les traces dans les parties Arcane concernant les matériaux.