Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
GeomShapeView.cc
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/* GeomShapeView.cc (C) 2000-2014 */
9/* */
10/* Gestion des formes géométriques 2D et 3D. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/TraceAccessor.h"
15
16#include "arcane/geometric/GeomElement.h"
17#include "arcane/geometric/GeomShapeView.h"
18#include "arcane/geometric/CellConnectivity.h"
19//#include "arcane/geometric/CellGeomList.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24ARCANE_BEGIN_NAMESPACE
25GEOMETRIC_BEGIN_NAMESPACE
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29/*
30 * TODO: Verifier que les IT_* correspondents aux énumérations de GeomType.
31 */
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
36{
37 public:
38
40 {
41 for( int i=0; i<NB_BASIC_ITEM_TYPE; ++i )
42 GeomShapeView::global_cell_connectivity[i] = 0;
43
44 GeomShapeView::global_cell_connectivity[IT_NullType] = &m_null_connectivity;
45 GeomShapeView::global_cell_connectivity[IT_Vertex] = &m_vertex_connectivity;
46 GeomShapeView::global_cell_connectivity[IT_Line2] = &m_line2_connectivity;
47 GeomShapeView::global_cell_connectivity[IT_Triangle3] = &m_triangle3_connectivity;
48 GeomShapeView::global_cell_connectivity[IT_Quad4] = &m_quad4_connectivity;
49 GeomShapeView::global_cell_connectivity[IT_Pentagon5] = &m_pentagon5_connectivity;
50 GeomShapeView::global_cell_connectivity[IT_Hexagon6] = &m_hexagon6_connectivity;
51 GeomShapeView::global_cell_connectivity[IT_Tetraedron4] = &m_tetraedron4_connectivity;
52 GeomShapeView::global_cell_connectivity[IT_Pyramid5] = &m_pyramid5_connectivity;
53 GeomShapeView::global_cell_connectivity[IT_Pentaedron6] = &m_pentaedron6_connectivity;
54 GeomShapeView::global_cell_connectivity[IT_Hexaedron8] = &m_hexaedron8_connectivity;
55 GeomShapeView::global_cell_connectivity[IT_Heptaedron10] = &m_heptaedron10_connectivity;
56 GeomShapeView::global_cell_connectivity[IT_Octaedron12] = &m_octaedron12_connectivity;
57 }
58
59 public:
60 NullConnectivity m_null_connectivity;
61 VertexConnectivity m_vertex_connectivity;
62 Line2Connectivity m_line2_connectivity;
63 Triangle3Connectivity m_triangle3_connectivity;
64 Quad4Connectivity m_quad4_connectivity;
65 Pentagon5Connectivity m_pentagon5_connectivity;
66 Hexagon6Connectivity m_hexagon6_connectivity;
67 Tetraedron4Connectivity m_tetraedron4_connectivity;
68 Pyramid5Connectivity m_pyramid5_connectivity;
69 Pentaedron6Connectivity m_pentaedron6_connectivity;
70 Hexaedron8Connectivity m_hexaedron8_connectivity;
71 Heptaedron10Connectivity m_heptaedron10_connectivity;
72 Octaedron12Connectivity m_octaedron12_connectivity;
73};
74
75/*---------------------------------------------------------------------------*/
76/*---------------------------------------------------------------------------*/
77
78void GeomShapeView::
79initializeConnectivity()
80{
81 if (global_connectivity)
82 return;
83
84 global_connectivity = new GeomShapeConnectivity();
85}
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
90CellConnectivity* GeomShapeView::global_cell_connectivity[NB_BASIC_ITEM_TYPE];
91GeomShapeConnectivity* GeomShapeView::global_connectivity = 0;
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
101{
102 public:
105 {
106 }
107 public:
108 void computeNodePositionFromHexa(HexaElementConstView hexa);
109 void computeNodePositionFromQuad(QuadElementConstView quad);
110 private:
111 inline void
112 _addFaceD(Integer fid,Integer id1,Integer id2,Integer id3,Integer id4)
113 {
114 setFace(fid,
115 Real3( 0.25 * ( node(id1).x + node(id2).x + node(id3).x + node(id4).x ),
116 0.25 * ( node(id1).y + node(id2).y + node(id3).y + node(id4).y ),
117 0.25 * ( node(id1).z + node(id2).z + node(id3).z + node(id4).z )));
118 }
119
120 inline void
121 _addFace2D(Integer fid,Integer id1,Integer id2)
122 {
123 setFace(fid,
124 Real3( 0.5 * ( node(id1).x + node(id2).x ),
125 0.5 * ( node(id1).y + node(id2).y ),
126 0.0));
127 }
128};
129
130/*---------------------------------------------------------------------------*/
131/*---------------------------------------------------------------------------*/
132
133void GeomShapeView::
135{
136 _setNullItem(IT_Hexaedron8);
137
138 GeomShapeStdBuilder s(geom_cell.toMutableView());
140
141 geom_cell._setArray(*this);
142}
143
144/*---------------------------------------------------------------------------*/
145/*---------------------------------------------------------------------------*/
146
147void GeomShapeView::
149{
150 _setNullItem(IT_Quad4);
151
152 GeomShapeStdBuilder s(geom_cell.toMutableView());
154
155 geom_cell._setArray(*this);
156}
157
158/*---------------------------------------------------------------------------*/
159/*----- Définition des sous volumes de contrôle -----------------------------*/
160/*---------------------------------------------------------------------------*/
161/*---------------------------------------------------------------------------*/
162
163/*---------------------------------------------------------------------------*/
164/*--------------- En 2D -----------------------------------------------------*/
165
166void GeomShapeView::
167fillSubZoneElement(Quad4ElementView sub_zone, Integer id)
168{
169 const NodeConnectic & nc = nodeConnectic(id);
170
171 sub_zone.init(node(nodeAssociation(id)),face(nc.face(0)), center(),face(nc.face(1)));
172}
173
174/*---------------------------------------------------------------------------*/
175/*---------------------------------------------------------------------------*/
176
177void GeomShapeView::
178fillSubZoneQuad4(Quad4ElementView sub_zone,Integer i)
179{
180 switch(i){
181 case 0: sub_zone.init(node(0),face( 0),center(),face(3)); break;
182 case 1: sub_zone.init(node(1),face( 1),center(),face(0)); break;
183 case 2: sub_zone.init(node(2),face( 2),center(),face(1)); break;
184 case 3: sub_zone.init(node(3),face( 3),center(),face(2)); break;
185 }
186}
187
188/*---------------------------------------------------------------------------*/
189/*---------------------------------------------------------------------------*/
190
191void GeomShapeView::
192fillSubZoneTriangle3(Quad4ElementView sub_zone,Integer i)
193{
194 switch(i){
195 case 0: sub_zone.init(node(0),face(0),center(),node(0));break;
196 case 1: sub_zone.init(node(1),face(1),center(),face(0));break;
197 case 2: sub_zone.init(node(2),face(2),center(),face(1));break;
198 case 3: sub_zone.init(node(0),node(0),center(),face(2));break;
199 }
200}
201
202/*---------------------------------------------------------------------------*/
203/*---------------------------------------------------------------------------*/
204
205void GeomShapeView::
206fillSubZonePentagon5(QuadElementView,Integer)
207{
208 throw NotImplementedException(A_FUNCINFO);
209}
210
211/*---------------------------------------------------------------------------*/
212/*---------------------------------------------------------------------------*/
213
214void GeomShapeView::
215fillSubZoneHexagon6(QuadElementView,Integer)
216{
217 throw NotImplementedException(A_FUNCINFO);
218}
219
220/*---------------------------------------------------------------------------*/
221/*---------------------------------------------------------------------------*/
222
223void GeomShapeView::
224fillSubZoneElement(HexaElementView sub_zone,Integer i)
225{
226 const NodeConnectic & nc = nodeConnectic(i);
227
228 sub_zone.init(node(nodeAssociation(i)),
229 edge(nc.edge(0)),face(nc.face(0)),edge(nc.edge(1)),
230 edge(nc.edge(2)),face(nc.face(2)),center(),face(nc.face(1)));
231}
232
233/*---------------------------------------------------------------------------*/
234/*---------------------------------------------------------------------------*/
235
236void GeomShapeView::
237fillSubZoneHexaedron8(HexaElementView sub_zone,Integer i)
238{
239 switch(i){
240 case 0: sub_zone.init(node(0),edge( 0),face(0),edge( 3),edge( 4),face(2),center(),face(1)); break;
241 case 1: sub_zone.init(node(1),edge( 1),face(0),edge( 0),edge( 5),face(4),center(),face(2)); break;
242 case 2: sub_zone.init(node(2),edge( 2),face(0),edge( 1),edge( 6),face(5),center(),face(4)); break;
243 case 3: sub_zone.init(node(3),edge( 3),face(0),edge( 2),edge( 7),face(1),center(),face(5)); break;
244 case 4: sub_zone.init(node(4),edge(11),face(3),edge( 8),edge( 4),face(1),center(),face(2)); break;
245 case 5: sub_zone.init(node(5),edge( 8),face(3),edge( 9),edge( 5),face(2),center(),face(4)); break;
246 case 6: sub_zone.init(node(6),edge( 9),face(3),edge(10),edge( 6),face(4),center(),face(5)); break;
247 case 7: sub_zone.init(node(7),edge(10),face(3),edge(11),edge( 7),face(5),center(),face(1)); break;
248 }
249}
250
251/*---------------------------------------------------------------------------*/
252/*---------------------------------------------------------------------------*/
253
254void GeomShapeView::
255fillSubZonePyramid5(HexaElementView sub_zone,Integer i)
256{
257 switch(i){
258 case 0: sub_zone.init(node(0),edge(0),face(0),edge(3),edge(4),face(2),center(),face(1)); break;
259 case 1: sub_zone.init(node(1),edge(1),face(0),edge(0),edge(5),face(3),center(),face(2)); break;
260 case 2: sub_zone.init(node(2),edge(2),face(0),edge(1),edge(6),face(4),center(),face(3)); break;
261 case 3: sub_zone.init(node(3),edge(3),face(0),edge(2),edge(7),face(1),center(),face(4)); break;
262 case 4: sub_zone.init(node(4),node(4),node(4),node(4),edge(4),face(1),center(),face(2)); break;
263 case 5: sub_zone.init(node(4),node(4),node(4),node(4),edge(5),face(2),center(),face(3)); break;
264 case 6: sub_zone.init(node(4),node(4),node(4),node(4),edge(6),face(3),center(),face(4)); break;
265 case 7: sub_zone.init(node(4),node(4),node(4),node(4),edge(7),face(4),center(),face(1)); break;
266 }
267}
268
269/*---------------------------------------------------------------------------*/
270/*---------------------------------------------------------------------------*/
271
272void GeomShapeView::
273fillSubZonePentaedron6(HexaElementView sub_zone,Integer i)
274{
275 switch(i){
276 case 0: sub_zone.init(node(0),edge(0),face(0),edge(2),edge( 3),face(2),center(),face(1)); break;
277 case 1: sub_zone.init(node(1),edge(1),face(0),edge(0),edge( 4),face(4),center(),face(2)); break;
278 case 2: sub_zone.init(node(2),edge(2),face(0),edge(1),edge( 5),face(1),center(),face(4)); break;
279 case 3: sub_zone.init(node(3),edge(8),face(3),edge(6),edge( 3),face(1),center(),face(2)); break;
280 case 4: sub_zone.init(node(4),edge(6),face(3),edge(7),edge( 4),face(2),center(),face(4)); break;
281 case 5: sub_zone.init(node(5),edge(7),face(3),edge(8),edge( 5),face(4),center(),face(1)); break;
282 }
283}
284
285/*---------------------------------------------------------------------------*/
286/*---------------------------------------------------------------------------*/
287
288void GeomShapeView::
289fillSubZoneTetraedron4(HexaElementView sub_zone,Integer i)
290{
291 switch(i){
292 case 0: sub_zone.init(node(0),edge(0),face(0),edge( 2),edge(3),face(2),center(),face(1)); break;
293 case 1: sub_zone.init(node(1),edge(1),face(0),edge( 0),edge(4),face(3),center(),face(2)); break;
294 case 2: sub_zone.init(node(2),edge(2),face(0),edge( 1),edge(5),face(1),center(),face(3)); break;
295 case 3: sub_zone.init(node(3),edge(3),face(1),edge( 5),edge(4),face(2),center(),face(3)); break;
296 }
297}
298
299/*---------------------------------------------------------------------------*/
300/*---------------------------------------------------------------------------*/
301
302void GeomShapeView::
303fillSubZoneHeptaedron10(HexaElementView sub_zone,Integer i)
304{
305 switch(i){
306 case 0: sub_zone.init(node(0),edge( 0),face(0),edge( 4),edge(10),face(2),center(),face(6)); break;
307 case 1: sub_zone.init(node(1),edge( 1),face(0),edge( 0),edge(11),face(3),center(),face(2)); break;
308 case 2: sub_zone.init(node(2),edge( 2),face(0),edge( 1),edge(12),face(4),center(),face(3)); break;
309 case 3: sub_zone.init(node(3),edge( 3),face(0),edge( 2),edge(13),face(5),center(),face(4)); break;
310 case 4: sub_zone.init(node(4),edge( 4),face(0),edge( 3),edge(14),face(6),center(),face(5)); break;
311 case 5: sub_zone.init(node(5),edge( 9),face(1),edge( 5),edge(10),face(6),center(),face(2)); break;
312 case 6: sub_zone.init(node(6),edge( 5),face(1),edge( 6),edge(11),face(2),center(),face(3)); break;
313 case 7: sub_zone.init(node(7),edge( 6),face(1),edge( 7),edge(12),face(3),center(),face(4)); break;
314 case 8: sub_zone.init(node(8),edge( 7),face(1),edge( 8),edge(13),face(4),center(),face(5)); break;
315 case 9: sub_zone.init(node(9),edge( 8),face(1),edge( 9),edge(14),face(5),center(),face(6)); break;
316 }
317}
318
319/*---------------------------------------------------------------------------*/
320/*---------------------------------------------------------------------------*/
321
322void GeomShapeView::
323fillSubZoneOctaedron12(HexaElementView sub_zone,Integer i)
324{
325 switch(i){
326 case 0: sub_zone.init(node( 0),edge( 0),face(0),edge( 5),edge(12),face(2),center(),face(7)); break;
327 case 1: sub_zone.init(node( 1),edge( 1),face(0),edge( 0),edge(13),face(3),center(),face(2)); break;
328 case 2: sub_zone.init(node( 2),edge( 2),face(0),edge( 1),edge(14),face(4),center(),face(3)); break;
329 case 3: sub_zone.init(node( 3),edge( 3),face(0),edge( 2),edge(15),face(5),center(),face(4)); break;
330 case 4: sub_zone.init(node( 4),edge( 4),face(0),edge( 3),edge(16),face(6),center(),face(5)); break;
331 case 5: sub_zone.init(node( 5),edge( 5),face(0),edge( 4),edge(17),face(7),center(),face(6)); break;
332 case 6: sub_zone.init(node( 6),edge(11),face(1),edge( 6),edge(12),face(7),center(),face(2)); break;
333 case 7: sub_zone.init(node( 7),edge( 6),face(1),edge( 7),edge(13),face(2),center(),face(3)); break;
334 case 8: sub_zone.init(node( 8),edge( 7),face(1),edge( 8),edge(14),face(3),center(),face(4)); break;
335 case 9: sub_zone.init(node( 9),edge( 8),face(1),edge( 9),edge(15),face(4),center(),face(5)); break;
336 case 10: sub_zone.init(node(10),edge( 9),face(1),edge(10),edge(16),face(5),center(),face(6)); break;
337 case 11: sub_zone.init(node(11),edge(10),face(1),edge(11),edge(17),face(6),center(),face(7)); break;
338 }
339}
340
341/*---------------------------------------------------------------------------*/
342/*---------------------------------------------------------------------------*/
343
344/*---------------------------------------------------------------------------*/
345/*---------------------------------------------------------------------------*/
349void GeomShapeStdBuilder::
350computeNodePositionFromHexa(HexaElementConstView hexa)
351{
352 const Real3 nul_vector = Real3(0.,0.,0.);
353
354 // Calcule la position du centre.
356
357 for( Integer i = 0; i<8; ++i ){
358 setNode(i,hexa[i]);
359 c += node(i);
360 }
361
362 setCenter(0.125 * c);
363
364 // Calcul la position des centres des faces.
365 _addFaceD( 0 , 0 , 3 , 2 , 1 );
366 _addFaceD( 1 , 0 , 4 , 7 , 3 );
367 _addFaceD( 2 , 0 , 1 , 5 , 4 );
368 _addFaceD( 3 , 4 , 5 , 6 , 7 );
369 _addFaceD( 4 , 1 , 2 , 6 , 5 );
370 _addFaceD( 5 , 2 , 3 , 7 , 6 );
371}
372
373/*---------------------------------------------------------------------------*/
374/*---------------------------------------------------------------------------*/
378void GeomShapeStdBuilder::
379computeNodePositionFromQuad(QuadElementConstView quad)
380{
381 const Real3 nul_vector = Real3(0.,0.,0.);
382
383 // Calcule la position du centre.
385
386 for( Integer i = 0; i<4; ++i )
387 {
388 setNode(i,quad[i]);
389 c += node(i);
390 }
391
392 setCenter(0.25 * c);
393
394 // Calcul la position des centres des faces.
395 _addFace2D( 0 , 0 , 1 );
396 _addFace2D( 1 , 1 , 2 );
397 _addFace2D( 2 , 2 , 3 );
398 _addFace2D( 3 , 3 , 0 );
399}
400
401/*---------------------------------------------------------------------------*/
402/*---------------------------------------------------------------------------*/
403
405initFromHexaedron8(Hexaedron8ElementConstView hexa)
406{
408
409 view._setNullItem(IT_Hexaedron8);
410
411 GeomShapeStdBuilder s(toMutableView());
413
414 _setArray(view);
415
416 //view.initFromHexa(hexa,*this);
417 return view;
418}
419
420/*---------------------------------------------------------------------------*/
421/*---------------------------------------------------------------------------*/
422
423Quad4ShapeView GeomShape::
424initFromQuad4(Quad4ElementConstView quad)
425{
426 Quad4ShapeView view;
427
428 view._setNullItem(IT_Quad4);
429
430 GeomShapeStdBuilder s(toMutableView());
432
433 _setArray(view);
434
435 return view;
436}
437
438/*---------------------------------------------------------------------------*/
439/*---------------------------------------------------------------------------*/
440
441GEOMETRIC_END_NAMESPACE
442ARCANE_END_NAMESPACE
443
444/*---------------------------------------------------------------------------*/
445/*---------------------------------------------------------------------------*/
Vue modifiable sur un GeomShape.
void computeNodePositionFromHexa(HexaElementConstView hexa)
En 3D, calcule les psoitions à partir de l'hexaèdre hexa.
void computeNodePositionFromQuad(QuadElementConstView quad)
En 2D, calcule les positions à partir du quad quad.
Forme géométrique.
Definition GeomShape.h:55
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Informations de connectivité pour les éléments géométriques de type IT_NullType.
Classe gérant un vecteur de réel de dimension 3.
Definition Real3.h:132
Informations de connectivité pour les éléments géométriques de type GeomType::Heptaedron10.
Informations de connectivité pour les éléments géométriques de type GeomType::Hexaedron8.
Vue constante sur les éléments géométriques de type GeomType::Hexaedron8.
Vue modifiable sur les éléments géométriques de type GeomType::Hexaedron8.
void init(const Real3 &a0, const Real3 &a1, const Real3 &a2, const Real3 &a3, const Real3 &a4, const Real3 &a5, const Real3 &a6, const Real3 &a7)
Initialise la vue avec les coordonnées passées en argument.
Vue spécifique sur les formes géométriques de type GeomType::Hexaedron8.
Informations de connectivité pour les éléments géométriques de type GeomType::Hexagon6.
Informations de connectivité pour les éléments géométriques de type GeomType::Line2.
Informations de connectivité pour les éléments géométriques de type GeomType::Octaedron12.
Informations de connectivité pour les éléments géométriques de type GeomType::Pentaedron6.
Informations de connectivité pour les éléments géométriques de type GeomType::Pentagon5.
Informations de connectivité pour les éléments géométriques de type GeomType::Pyramid5.
Informations de connectivité pour les éléments géométriques de type GeomType::Quad4.
Vue constante sur les éléments géométriques de type GeomType::Quad4.
Vue modifiable sur les éléments géométriques de type GeomType::Quad4.
void init(const Real3 &a0, const Real3 &a1, const Real3 &a2, const Real3 &a3)
Initialise la vue avec les coordonnées passées en argument.
Vue spécifique sur les formes géométriques de type GeomType::Quad4.
Informations de connectivité pour les éléments géométriques de type GeomType::Tetraedron4.
Informations de connectivité pour les éléments géométriques de type GeomType::Triangle3.
Informations de connectivité pour les éléments géométriques de type GeomType::Vertex.
Structures de connectique locale des mailles.