14#include "arcane/core/Connectivity.h"
15#include "arcane/core/IMesh.h"
28: m_connectivity(connectivity)
37enableConnectivity(
const Integer c)
40 _enableConnectivity(c);
46disableConnectivity(
const Integer c)
49 _disableConnectivity(c);
55hasConnectivity(
const Integer c)
const
58 return _hasConnectivity(m_connectivity(), c);
66 return _hasConnectivity(m_connectivity(), CT_Frozen);
74 const Integer dim = mesh->dimension();
78 _enableConnectivity(CT_Default1D);
79 _disableConnectivity(CT_EdgeConnectivity);
80 _enableConnectivity(CT_Dim1D);
83 _enableConnectivity(CT_Default2D);
84 _disableConnectivity(CT_EdgeConnectivity);
85 _enableConnectivity(CT_Dim2D);
88 _enableConnectivity(CT_Default3D);
89 _enableConnectivity(CT_Dim3D);
92 ARCANE_FATAL(
"Mesh ({0}) dimension must be set before frezing connectivity (current={1})", mesh->name(), dim);
95 if (_hasConnectivity(m_connectivity(), CT_Dim2D) && hasConnectivity(m_connectivity(), CT_Dim3D))
96 ARCANE_FATAL(
"A mesh cannot have both dimensions 2 and 3");
100 if (hasConnectivity(CT_HasNode))
101 _enableConnectivity(CT_CellToNode);
102 if (hasConnectivity(CT_HasEdge))
103 _enableConnectivity(CT_CellToEdge + CT_NodeToEdge + CT_EdgeToNode + CT_EdgeToCell);
104 if (hasConnectivity(CT_HasFace))
105 _enableConnectivity(CT_CellToFace);
107 _enableConnectivity(CT_Frozen);
118 if (hasConnectivity(connectivity, CT_Dim1D))
120 if (hasConnectivity(connectivity, CT_Dim2D)) {
122 throw FatalErrorException(A_FUNCINFO,
"A mesh cannot have both dimensions 1 and 2");
128 if (hasConnectivity(connectivity, CT_Dim3D)) {
130 throw FatalErrorException(A_FUNCINFO,
"A mesh cannot have both dimensions (1 or 2) and 3");
137 if (kindA > NB_ITEM_KIND || kindB > NB_ITEM_KIND)
138 throw FatalErrorException(A_FUNCINFO, String::format(
"Invalid connectivity kind ({0}To{1})", kindA, kindB));
145 Integer preallocs[8][8] = { { x, x, 2, 2, x, x, x, x },
146 { x, x, x, x, x, x, x, x },
147 { 2, x, x, 2, x, x, x, x },
148 { 2, x, 2, x, x, x, x, x },
149 { x, x, x, x, x, x, x, x },
150 { x, x, x, x, x, x, x, x },
151 { x, x, x, x, x, x, x, x },
152 { x, x, x, x, x, x, x, x } };
153 prealloc = preallocs[kindA][kindB];
158 Integer preallocs[8][8] = { { x, x, 4, 4, x, x, x, x },
159 { x, x, x, x, x, x, x, x },
160 { 4, x, x, 2, x, x, x, x },
161 { 4, x, 4, x, x, x, x, x },
162 { x, x, x, x, x, x, x, x },
163 { x, x, x, x, x, x, x, x },
164 { x, x, x, x, x, x, x, x },
165 { x, x, x, x, x, x, x, x } };
166 prealloc = preallocs[kindA][kindB];
171 Integer preallocs[8][8] = { { x, 6, 12, 8, x, x, x, x },
172 { 2, x, 4, 4, x, x, x, x },
173 { 4, 4, x, 2, x, x, x, x },
174 { 8, 12, 6, x, x, x, x, x },
175 { x, x, x, x, x, x, x, x },
176 { x, x, x, x, x, x, x, x },
177 { x, x, x, x, x, x, x, x },
178 { x, x, x, x, x, x, x, x } };
179 prealloc = preallocs[kindA][kindB];
182 throw FatalErrorException(A_FUNCINFO, String::format(
"Not supported mesh dimension (current={0}): must be 1, 2 or 3", dim));
186 throw FatalErrorException(A_FUNCINFO, String::format(
"Cannot request prealloc of {1} for {0} family", kindA, kindB));
189 if (hasConnectivity(connectivity, kindAkindBConnectivity)) {
205 if (hasConnectivity(connectivity, CT_NodeToEdge))
206 o << ((position++) ?
"|" :
"") <<
"NodeToEdge";
207 if (hasConnectivity(connectivity, CT_NodeToFace))
208 o << ((position++) ?
"|" :
"") <<
"NodeToFace";
209 if (hasConnectivity(connectivity, CT_NodeToCell))
210 o << ((position++) ?
"|" :
"") <<
"NodeToCell";
211 if (hasConnectivity(connectivity, CT_EdgeToNode))
212 o << ((position++) ?
"|" :
"") <<
"EdgeToNode";
215 if (hasConnectivity(connectivity, CT_EdgeToFace))
216 o << ((position++) ?
"|" :
"") <<
"EdgeToFace";
217 if (hasConnectivity(connectivity, CT_EdgeToCell))
218 o << ((position++) ?
"|" :
"") <<
"EdgeToCell";
219 if (hasConnectivity(connectivity, CT_FaceToNode))
220 o << ((position++) ?
"|" :
"") <<
"FaceToNode";
221 if (hasConnectivity(connectivity, CT_FaceToEdge))
222 o << ((position++) ?
"|" :
"") <<
"FaceToEdge";
223 if (hasConnectivity(connectivity, CT_FaceToFace))
224 o << ((position++) ?
"|" :
"") <<
"FaceToFace";
225 if (hasConnectivity(connectivity, CT_FaceToCell))
226 o << ((position++) ?
"|" :
"") <<
"FaceToCell";
227 if (hasConnectivity(connectivity, CT_CellToNode))
228 o << ((position++) ?
"|" :
"") <<
"CellToNode";
229 if (hasConnectivity(connectivity, CT_CellToEdge))
230 o << ((position++) ?
"|" :
"") <<
"CellToEdge";
231 if (hasConnectivity(connectivity, CT_CellToFace))
232 o << ((position++) ?
"|" :
"") <<
"CellToFace";
235 if (hasConnectivity(connectivity, CT_HasNode))
236 o << ((position++) ?
"|" :
"") <<
"HasNode";
237 if (hasConnectivity(connectivity, CT_HasEdge))
238 o << ((position++) ?
"|" :
"") <<
"HasEdge";
239 if (hasConnectivity(connectivity, CT_HasFace))
240 o << ((position++) ?
"|" :
"") <<
"HasFace";
241 if (hasConnectivity(connectivity, CT_HasCell))
242 o << ((position++) ?
"|" :
"") <<
"HasCell";
243 if (hasConnectivity(connectivity, CT_Frozen))
244 o << ((position++) ?
"|" :
"") <<
"Frozen";
247 if (hasConnectivity(connectivity, CT_Dim2D))
248 o << ((position++) ?
"|" :
"") <<
"Dim2D";
249 if (hasConnectivity(connectivity, CT_Dim3D))
250 o << ((position++) ?
"|" :
"") <<
"Dim3D";
258void Connectivity::Printer::print(std::ostream& o)
const
265std::ostream&
operator<<(std::ostream& o,
const Connectivity::Printer& p)
275_enableConnectivity(
const Integer c)
278 m_connectivity = m_connectivity() | c;
284_disableConnectivity(
const Integer c)
287 m_connectivity = m_connectivity() & ~c;
295 if ((c & ~CT_FullConnectivity3D) && (c & ~CT_GraphConnectivity))
304 if (m_connectivity() & CT_Frozen)
322 throw FatalErrorException(A_FUNCINFO, String::format(
"Connectivity from kind {0} not supported", kindA));
333 ARCANE_FATAL(
"Connectivity to kind {0} not supported", kindB);
348 return CT_DoFToParticle;
350 ARCANE_FATAL(
"Connectivity to kind {0} not supported", kindB);
354 return 1 << (4 * kindA + kindB + 1);
355 ARCANE_FATAL(
"Connectivity {0} to kind {1} is not supported", kindA, kindB);
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
static Integer kindsToConnectivity(eItemKind kindA, eItemKind kindB)
Conversion de type en connectivité
static void print(std::ostream &o, Integer connectivity)
Fonction d'écriture sur un flux.
Connectivity(VariableScalarInteger connectivity)
Exception lorsqu'une erreur fatale est survenue.
VariableRefScalarT< Integer > VariableScalarInteger
Variable scalaire de type entier.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.
eItemKind
Genre d'entité de maillage.
@ IK_Particle
Entité de maillage de genre particule.
@ IK_Node
Entité de maillage de genre noeud.
@ IK_Cell
Entité de maillage de genre maille.
@ IK_Face
Entité de maillage de genre face.
@ IK_DoF
Entité de maillage de genre degre de liberte.
@ IK_Edge
Entité de maillage de genre arête.
std::ostream & operator<<(std::ostream &ostr, eItemKind item_kind)
Opérateur de sortie sur un flot.