Arcane  v3.15.3.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MeshUniqueIdMng.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* MeshUniqueIdMng.cc (C) 2000-2025 */
9/* */
10/* Gestionnaire de couche fantômes d'un maillage. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/mesh/MeshUniqueIdMng.h"
15
16#include "arcane/utils/PlatformUtils.h"
17#include "arcane/utils/ArgumentException.h"
18#include "arcane/utils/FatalErrorException.h"
19#include "arcane/utils/ValueConvert.h"
20
21#include "arcane/core/IMeshUniqueIdMng.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane::mesh
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32MeshUniqueIdMng::
33MeshUniqueIdMng(ITraceMng* tm)
34: TraceAccessor(tm)
35{
36 _initFaceVersion();
37 _initEdgeVersion();
38}
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
43void MeshUniqueIdMng::
44setFaceBuilderVersion(Integer n)
45{
46 if (n<0)
47 ARCANE_THROW(ArgumentException,"Bad value for '{0}'<0",n);
48 m_face_builder_version = n;
49}
50
51/*---------------------------------------------------------------------------*/
52/*---------------------------------------------------------------------------*/
53
54void MeshUniqueIdMng::
55setEdgeBuilderVersion(Integer n)
56{
57 if (n<0)
58 ARCANE_THROW(ArgumentException,"Bad value for '{0}'<0",n);
59 m_edge_builder_version = n;
60}
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65void MeshUniqueIdMng::
66_initFaceVersion()
67{
68 m_face_builder_version = 1;
69
70 if (auto v = Convert::Type<Int32>::tryParseFromEnvironment("ARCANE_FACE_UNIQUE_ID_BUILDER_VERSION",true)){
71 m_face_builder_version = v.value();
72 return;
73 }
74
75 // Pour des raisons de compatibilité avec l'existant, on positionne les
76 // valeurs par défaut en fonction de certaines variables d'environnement.
77 // Il faudra supprimer ce comportement à terme (car de plus il s'applique
78 // à tous les maillages même ceux créés dynamiquement)
79
80 if (!platform::getEnvironmentVariable("ARCANE_NEW_MESHINIT2").null()){
81 m_face_builder_version = 3;
82 return;
83 }
84
85 if (!platform::getEnvironmentVariable("ARCANE_NO_FACE_RENUMBER").null()){
86 m_face_builder_version = 0;
87 return;
88 }
89
90 if (!platform::getEnvironmentVariable("ARCANE_NEW_MESHINIT").null()){
91 m_face_builder_version = 2;
92 return;
93 }
94}
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
99void MeshUniqueIdMng::
100_initEdgeVersion()
101{
102 m_edge_builder_version = 1;
103
104 if (auto v = Convert::Type<Int32>::tryParseFromEnvironment("ARCANE_EDGE_UNIQUE_ID_BUILDER_VERSION",true)){
105 m_edge_builder_version = v.value();
106 return;
107 }
108}
109
110/*---------------------------------------------------------------------------*/
111/*---------------------------------------------------------------------------*/
112
113void MeshUniqueIdMng::
114setUseNodeUniqueIdToGenerateEdgeAndFaceUniqueId(bool v)
115{
116 m_use_node_uid_to_generate_edge_and_face_uid = v;
117}
118
119/*---------------------------------------------------------------------------*/
120/*---------------------------------------------------------------------------*/
121
122} // End namespace Arcane::mesh
123
124/*---------------------------------------------------------------------------*/
125/*---------------------------------------------------------------------------*/
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.