Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
Connectivity.h
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/* Connectivity.h (C) 2000-2015 */
9/* */
10/* Descripteur de connectivité. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CONNECTIVITY_H
13#define ARCANE_CONNECTIVITY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/ArcaneTypes.h"
18#include "arcane/MeshVariable.h"
19#include "arcane/VariableTypes.h"
20
21#include <iostream>
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26ARCANE_BEGIN_NAMESPACE
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31class ARCANE_CORE_EXPORT Connectivity
32{
33public:
35
40 CT_Null = 0,
41 // From Node
42 // CT_NodeToNode = 1<<1,
43 CT_NodeToEdge = 1<< 2,
44 CT_NodeToFace = 1<< 3, // Utilisé dans UnstructuredMeshUtilities::localIdsFromConnectivity
45 CT_NodeToCell = 1<< 4,
46 // From Edge
47 CT_EdgeToNode = 1<< 5,
48 // CT_EdgeToEdge = 1<<6,
49 CT_EdgeToFace = 1<< 7,
50 CT_EdgeToCell = 1<< 8,
51 // From Face
52 CT_FaceToNode = 1<< 9,
53 CT_FaceToEdge = 1<<10,
54 CT_FaceToFace = 1<<11,
55 CT_FaceToCell = 1<<12,
56 // From Cell
57 CT_CellToNode = 1<<13,
58 CT_CellToEdge = 1<<14,
59 CT_CellToFace = 1<<15,
60 // CT_CellToCell = 1<<16,
61 CT_DoFToNode = 1<<17,
62 CT_DoFToEdge = 1<<18,
63 CT_DoFToFace = 1<<19,
64 CT_DoFToCell = 1<<20,
65 CT_DoFToDoF = 1<<21,
66 CT_DoFToParticle = 1<<22,
67
68 // Existing kind
69 CT_HasNode = 1<<23,
70 CT_HasEdge = 1<<24,
71 CT_HasFace = 1<<25,
72 CT_HasCell = 1<<26,
73
74 // Frozen mark
75 CT_Frozen = 1<<27,
76
77 // Dimension mark
78 CT_Dim1D = 1<<28,
79 CT_Dim2D = 1<<29,
80 CT_Dim3D = 1<<30,
81
82 // Types composés
83 // Connectivité par défaut
84 CT_Default = CT_NodeToCell + CT_NodeToFace
85 + CT_FaceToNode + CT_FaceToCell
86 + CT_CellToNode + CT_CellToFace
87 + CT_HasNode + CT_HasFace + CT_HasCell,
88
89 CT_Default1D = CT_NodeToCell // minimum en 1D
90 + CT_FaceToNode + CT_FaceToCell
91 + CT_CellToNode + CT_CellToFace
92 + CT_HasNode + CT_HasFace + CT_HasCell,
93
94 CT_Default2D = CT_NodeToCell // minimum en 2D
95 + CT_FaceToNode + CT_FaceToCell
96 + CT_CellToNode + CT_CellToFace
97 + CT_HasNode + CT_HasFace + CT_HasCell,
98
99
100 CT_Default3D = CT_NodeToCell // minimum en 3D
101 + CT_FaceToNode + CT_FaceToCell
102 + CT_CellToNode + CT_CellToFace
103 + CT_HasNode + CT_HasFace + CT_HasCell,
104
105 CT_FullConnectivity2D = CT_NodeToFace + CT_NodeToCell
106 + CT_FaceToNode + CT_FaceToCell
107 + CT_CellToNode + CT_CellToFace
108 + CT_HasNode + CT_HasFace + CT_HasCell,
109
110 CT_FullConnectivity3D = CT_NodeToEdge + CT_NodeToFace + CT_NodeToCell
111 + CT_EdgeToNode + CT_EdgeToFace + CT_EdgeToCell
112 + CT_FaceToNode + CT_FaceToEdge + CT_FaceToCell + CT_FaceToFace
113 + CT_CellToNode + CT_CellToEdge + CT_CellToFace +
114 + CT_HasNode + CT_HasEdge + CT_HasFace + CT_HasCell,
115
116 CT_EdgeConnectivity = CT_HasEdge
117 + CT_NodeToEdge + CT_FaceToEdge + CT_CellToEdge +
118 + CT_EdgeToNode + CT_EdgeToFace + CT_EdgeToCell,
119
120 CT_GraphConnectivity = CT_DoFToNode + CT_DoFToEdge + CT_DoFToFace + CT_DoFToCell + CT_DoFToDoF + CT_DoFToParticle
121 };
122
123
124public:
126 class Printer {
127 public:
128 Printer(const Integer connectivity) : m_connectivity(connectivity) { }
129 virtual ~Printer() { }
130 void print(std::ostream & o) const;
131 private:
132 const Integer m_connectivity;
133 };
134
135public:
138
140 virtual ~Connectivity();
141
142 bool hasFace() const { return hasConnectivity(CT_HasFace); }
143 bool hasEdge() const { return hasConnectivity(CT_HasEdge); }
144
145 void enableConnectivity(const Integer c);
146 void disableConnectivity(const Integer c);
147
148 bool hasConnectivity(const Integer c) const;
149 inline static bool hasConnectivity(const Integer connectivity, const Integer c);
150
151 bool isFrozen() const;
152 void freeze(IMesh * mesh);
153
154 static Integer getPrealloc(const Integer connectivity, eItemKind kindA, eItemKind kindB);
155
157 static void print(std::ostream & o, const Integer connectivity);
158
160 static Integer kindsToConnectivity(eItemKind kindA, eItemKind kindB);
161
162private:
163 VariableScalarInteger m_connectivity;
164
165 void _enableConnectivity(const Integer c);
166 void _disableConnectivity(const Integer c);
167 static inline bool _hasConnectivity(const Integer connectivity, const Integer c);
168
169 static void _checkValid(const Integer c);
170 void _checkFrozen() const;
171};
172
173/*---------------------------------------------------------------------------*/
174/*---------------------------------------------------------------------------*/
175
176inline bool Connectivity::
177hasConnectivity(const Integer connectivity, const Integer c)
178{
179 // _checkValid(c);
180 return _hasConnectivity(connectivity,c);
181}
182
183/*---------------------------------------------------------------------------*/
184
185inline bool Connectivity::
186_hasConnectivity(const Integer connectivity, const Integer c)
187{
188 return ((connectivity & c) != 0);
189}
190
191/*---------------------------------------------------------------------------*/
192
193ARCANE_CORE_EXPORT std::ostream & operator<<(std::ostream & o, const Connectivity::Printer & p);
194
195/*---------------------------------------------------------------------------*/
196/*---------------------------------------------------------------------------*/
197
198ARCANE_END_NAMESPACE
199
200/*---------------------------------------------------------------------------*/
201/*---------------------------------------------------------------------------*/
202
203#endif /* ARCANE_CONNECTIVITY_H */
Classe d'écriture d'un marqueur de connectivité
eConnectivityType
Flags de connectivité
std::ostream & operator<<(std::ostream &o, eExecutionPolicy exec_policy)
Affiche le nom de la politique d'exécution.