14#include "arcane/Connectivity.h"
15#include "arcane/IMesh.h"
28: m_connectivity(connectivity)
45enableConnectivity(
const Integer c)
48 _enableConnectivity(c);
54disableConnectivity(
const Integer c)
57 _disableConnectivity(c);
63hasConnectivity(
const Integer c)
const
66 return _hasConnectivity(m_connectivity(), c);
74 return _hasConnectivity(m_connectivity(), CT_Frozen);
82 const Integer dim = mesh->dimension();
86 _enableConnectivity(CT_Default1D);
87 _disableConnectivity(CT_EdgeConnectivity);
88 _enableConnectivity(CT_Dim1D);
91 _enableConnectivity(CT_Default2D);
92 _disableConnectivity(CT_EdgeConnectivity);
93 _enableConnectivity(CT_Dim2D);
96 _enableConnectivity(CT_Default3D);
97 _enableConnectivity(CT_Dim3D);
100 ARCANE_FATAL(
"Mesh ({0}) dimension must be set before frezing connectivity (current={1})", mesh->name(), dim);
103 if (_hasConnectivity(m_connectivity(), CT_Dim2D) && hasConnectivity(m_connectivity(), CT_Dim3D))
104 ARCANE_FATAL(
"A mesh cannot have both dimensions 2 and 3");
108 if (hasConnectivity(CT_HasNode))
109 _enableConnectivity(CT_CellToNode);
110 if (hasConnectivity(CT_HasEdge))
111 _enableConnectivity(CT_CellToEdge + CT_NodeToEdge + CT_EdgeToNode + CT_EdgeToCell);
112 if (hasConnectivity(CT_HasFace))
113 _enableConnectivity(CT_CellToFace);
115 _enableConnectivity(CT_Frozen);
126 if (hasConnectivity(connectivity, CT_Dim1D))
128 if (hasConnectivity(connectivity, CT_Dim2D)) {
130 throw FatalErrorException(A_FUNCINFO,
"A mesh cannot have both dimensions 1 and 2");
136 if (hasConnectivity(connectivity, CT_Dim3D)) {
138 throw FatalErrorException(A_FUNCINFO,
"A mesh cannot have both dimensions (1 or 2) and 3");
145 if (kindA > NB_ITEM_KIND || kindB > NB_ITEM_KIND)
146 throw FatalErrorException(A_FUNCINFO, String::format(
"Invalid connectivity kind ({0}To{1})", kindA, kindB));
153 Integer preallocs[8][8] = { { x, x, 2, 2, x, x, x, x },
154 { x, x, x, x, x, x, x, x },
155 { 2, x, x, 2, x, x, x, x },
156 { 2, x, 2, x, x, x, x, x },
157 { x, x, x, x, x, x, x, x },
158 { x, x, x, x, x, x, x, x },
159 { x, x, x, x, x, x, x, x },
160 { x, x, x, x, x, x, x, x } };
161 prealloc = preallocs[kindA][kindB];
166 Integer preallocs[8][8] = { { x, x, 4, 4, x, x, x, x },
167 { x, x, x, x, x, x, x, x },
168 { 4, x, x, 2, x, x, x, x },
169 { 4, x, 4, x, x, x, x, x },
170 { x, x, x, x, x, x, x, x },
171 { x, x, x, x, x, x, x, x },
172 { x, x, x, x, x, x, x, x },
173 { x, x, x, x, x, x, x, x } };
174 prealloc = preallocs[kindA][kindB];
179 Integer preallocs[8][8] = { { x, 6, 12, 8, x, x, x, x },
180 { 2, x, 4, 4, x, x, x, x },
181 { 4, 4, x, 2, x, x, x, x },
182 { 8, 12, 6, x, x, x, x, x },
183 { x, x, x, x, x, x, x, x },
184 { x, x, x, x, x, x, x, x },
185 { x, x, x, x, x, x, x, x },
186 { x, x, x, x, x, x, x, x } };
187 prealloc = preallocs[kindA][kindB];
190 throw FatalErrorException(A_FUNCINFO, String::format(
"Not supported mesh dimension (current={0}): must be 1, 2 or 3", dim));
194 throw FatalErrorException(A_FUNCINFO, String::format(
"Cannot request prealloc of {1} for {0} family", kindA, kindB));
197 if (hasConnectivity(connectivity, kindAkindBConnectivity)) {
208print(std::ostream& o,
const Integer connectivity)
210 Integer position = 0;
213 if (hasConnectivity(connectivity, CT_NodeToEdge))
214 o << ((position++) ?
"|" :
"") <<
"NodeToEdge";
215 if (hasConnectivity(connectivity, CT_NodeToFace))
216 o << ((position++) ?
"|" :
"") <<
"NodeToFace";
217 if (hasConnectivity(connectivity, CT_NodeToCell))
218 o << ((position++) ?
"|" :
"") <<
"NodeToCell";
219 if (hasConnectivity(connectivity, CT_EdgeToNode))
220 o << ((position++) ?
"|" :
"") <<
"EdgeToNode";
223 if (hasConnectivity(connectivity, CT_EdgeToFace))
224 o << ((position++) ?
"|" :
"") <<
"EdgeToFace";
225 if (hasConnectivity(connectivity, CT_EdgeToCell))
226 o << ((position++) ?
"|" :
"") <<
"EdgeToCell";
227 if (hasConnectivity(connectivity, CT_FaceToNode))
228 o << ((position++) ?
"|" :
"") <<
"FaceToNode";
229 if (hasConnectivity(connectivity, CT_FaceToEdge))
230 o << ((position++) ?
"|" :
"") <<
"FaceToEdge";
231 if (hasConnectivity(connectivity, CT_FaceToFace))
232 o << ((position++) ?
"|" :
"") <<
"FaceToFace";
233 if (hasConnectivity(connectivity, CT_FaceToCell))
234 o << ((position++) ?
"|" :
"") <<
"FaceToCell";
235 if (hasConnectivity(connectivity, CT_CellToNode))
236 o << ((position++) ?
"|" :
"") <<
"CellToNode";
237 if (hasConnectivity(connectivity, CT_CellToEdge))
238 o << ((position++) ?
"|" :
"") <<
"CellToEdge";
239 if (hasConnectivity(connectivity, CT_CellToFace))
240 o << ((position++) ?
"|" :
"") <<
"CellToFace";
243 if (hasConnectivity(connectivity, CT_HasNode))
244 o << ((position++) ?
"|" :
"") <<
"HasNode";
245 if (hasConnectivity(connectivity, CT_HasEdge))
246 o << ((position++) ?
"|" :
"") <<
"HasEdge";
247 if (hasConnectivity(connectivity, CT_HasFace))
248 o << ((position++) ?
"|" :
"") <<
"HasFace";
249 if (hasConnectivity(connectivity, CT_HasCell))
250 o << ((position++) ?
"|" :
"") <<
"HasCell";
251 if (hasConnectivity(connectivity, CT_Frozen))
252 o << ((position++) ?
"|" :
"") <<
"Frozen";
255 if (hasConnectivity(connectivity, CT_Dim2D))
256 o << ((position++) ?
"|" :
"") <<
"Dim2D";
257 if (hasConnectivity(connectivity, CT_Dim3D))
258 o << ((position++) ?
"|" :
"") <<
"Dim3D";
266void Connectivity::Printer::print(std::ostream& o)
const
273std::ostream&
operator<<(std::ostream& o,
const Connectivity::Printer& p)
283_enableConnectivity(
const Integer c)
286 m_connectivity = m_connectivity() | c;
292_disableConnectivity(
const Integer c)
295 m_connectivity = m_connectivity() & ~c;
301_checkValid(
const Integer c)
303 if ((c & ~CT_FullConnectivity3D) && (c & ~CT_GraphConnectivity))
312 if (m_connectivity() & CT_Frozen)
330 throw FatalErrorException(A_FUNCINFO, String::format(
"Connectivity from kind {0} not supported", kindA));
341 ARCANE_FATAL(
"Connectivity to kind {0} not supported", kindB);
356 return CT_DoFToParticle;
358 ARCANE_FATAL(
"Connectivity to kind {0} not supported", kindB);
362 return 1 << (4 * kindA + kindB + 1);
363 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, const Integer connectivity)
Fonction d'écriture sur un flux.
Connectivity(VariableScalarInteger connectivity)
Exception lorsqu'une erreur fatale est survenue.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
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.
Int32 Integer
Type représentant un entier.