7#include <arcane/geometry/euclidian/Euclidian3Geometry.h>
12#include <arcane/utils/FatalErrorException.h>
13#include <arcane/utils/NotImplementedException.h>
16NUMERICS_BEGIN_NAMESPACE
22 Real3 orientation, center;
25 switch (item.
type()) {
27 ComputeLine2(
this).computeOrientedMeasureAndCenter(item,orientation,center);
30 ComputeTriangle3(
this).computeOrientedMeasureAndCenter(item,orientation,center);
33 ComputeQuad4(
this).computeOrientedMeasureAndCenter(item,orientation,center);
36 ComputePentagon5(
this).computeOrientedMeasureAndCenter(item,orientation,center);
39 ComputeHexagon6(
this).computeOrientedMeasureAndCenter(item,orientation,center);
45 ComputePyramid5(
this).computeOrientedMeasureAndCenter(item,measure,center);
48 ComputePentaedron6(
this).computeOrientedMeasureAndCenter(item,measure,center);
51 ComputeHexaedron8(
this).computeOrientedMeasureAndCenter(item,measure,center);
68 Real3 orientation, center;
70 switch (item.
type()) {
72 ComputeLine2(
this).computeOrientedMeasureAndCenter(item,orientation,center);
75 ComputeTriangle3(
this).computeOrientedMeasureAndCenter(item,orientation,center);
78 ComputeQuad4(
this).computeOrientedMeasureAndCenter(item,orientation,center);
81 ComputePentagon5(
this).computeOrientedMeasureAndCenter(item,orientation,center);
84 ComputeHexagon6(
this).computeOrientedMeasureAndCenter(item,orientation,center);
88 return Real3(0,0,measure);
90 ComputePyramid5(
this).computeOrientedMeasureAndCenter(item,measure,center);
91 return Real3(0,0,measure);
93 ComputePentaedron6(
this).computeOrientedMeasureAndCenter(item,measure,center);
94 return Real3(0,0,measure);
96 ComputeHexaedron8(
this).computeOrientedMeasureAndCenter(item,measure,center);
97 return Real3(0,0,measure);
100 return Real3(0,0,measure);
103 return Real3(0,0,measure);
113 Real3 orientation, center;
116 switch (item.
type()) {
118 ComputeLine2(
this).computeOrientedMeasureAndCenter(item,orientation,center);
121 ComputeTriangle3(
this).computeOrientedMeasureAndCenter(item,orientation,center);
124 ComputeQuad4(
this).computeOrientedMeasureAndCenter(item,orientation,center);
127 ComputePentagon5(
this).computeOrientedMeasureAndCenter(item,orientation,center);
130 ComputeHexagon6(
this).computeOrientedMeasureAndCenter(item,orientation,center);
136 ComputePyramid5(
this).computeOrientedMeasureAndCenter(item,measure,center);
139 ComputePentaedron6(
this).computeOrientedMeasureAndCenter(item,measure,center);
142 ComputeHexaedron8(
this).computeOrientedMeasureAndCenter(item,measure,center);
144 case IT_Heptaedron10:
165 Real3 orientation, center;
167 switch (item.
type()) {
171 ComputeTriangle3(
this).computeOrientedMeasureAndCenter(item,orientation,center);
174 ComputeQuad4(
this).computeOrientedMeasureAndCenter(item,orientation,center);
177 ComputePentagon5(
this).computeOrientedMeasureAndCenter(item,orientation,center);
180 ComputeHexagon6(
this).computeOrientedMeasureAndCenter(item,orientation,center);
186 case IT_Heptaedron10:
191 case IT_AntiWedgeLeft6:
192 case IT_AntiWedgeRight6:
207 switch (item.
type()) {
220 ComputePyramid5(
this).computeOrientedMeasureAndCenter(item,measure,center);
223 ComputePentaedron6(
this).computeOrientedMeasureAndCenter(item,measure,center);
226 ComputeHexaedron8(
this).computeOrientedMeasureAndCenter(item,measure,center);
228 case IT_Heptaedron10:
235 ComputeHemiHexa7(
this).computeOrientedMeasureAndCenter(item,measure,center);
238 ComputeHemiHexa6(
this).computeOrientedMeasureAndCenter(item,measure,center);
241 ComputeHemiHexa5(
this).computeOrientedMeasureAndCenter(item,measure,center);
243 case IT_AntiWedgeLeft6:
244 ComputeAntiWedgeLeft6(
this).computeOrientedMeasureAndCenter(item,measure,center);
246 case IT_AntiWedgeRight6:
247 ComputeAntiWedgeRight6(
this).computeOrientedMeasureAndCenter(item,measure,center);
250 ComputeDiTetra5(
this).computeOrientedMeasureAndCenter(item,measure,center);
262 return computeTriangleCenter(coords[0],coords[1],coords[2]);
268 Real local_area =
math::normeR3(computeTriangleNormal(coords[0],coords[i],coords[i+1]));
269 center += local_area * computeTriangleCenter(coords[0],coords[i],coords[i+1]);
279 Real3 normal(0.,0.,0.);
281 normal += computeTriangleNormal(coords[0],coords[i],coords[i+1]);
289 const Real3 d = m-n ;
296Euclidian3Geometry::ComputeLine2::
299 orientation = m_coords[item.
node(1)] - m_coords[item.
node(0)];
300 center = 0.5 * (m_coords[item.
node(1)] + m_coords[item.
node(0)]);
304Euclidian3Geometry::ComputeTriangle3::
308 computeTriangleNormal(m_coords[item.
node(0)],
309 m_coords[item.
node(1)],
310 m_coords[item.
node(2)]);
313 computeTriangleCenter(m_coords[item.
node(0)],
314 m_coords[item.
node(1)],
315 m_coords[item.
node(2)]);
319Euclidian3Geometry::ComputeQuad4::
323 computeTriangleNormal(m_coords[item.
node(0)],
324 m_coords[item.
node(1)],
325 m_coords[item.
node(2)]) +
326 computeTriangleNormal(m_coords[item.
node(0)],
327 m_coords[item.
node(2)],
328 m_coords[item.
node(3)]);
331 computeQuadrilateralCenter(m_coords[item.
node(0)],
332 m_coords[item.
node(1)],
333 m_coords[item.
node(2)],
334 m_coords[item.
node(3)]);
338Euclidian3Geometry::ComputePentagon5::
342 computeTriangleNormal(m_coords[item.
node(0)],
343 m_coords[item.
node(1)],
344 m_coords[item.
node(2)]) +
345 computeTriangleNormal(m_coords[item.
node(0)],
346 m_coords[item.
node(2)],
347 m_coords[item.
node(3)]) +
348 computeTriangleNormal(m_coords[item.
node(0)],
349 m_coords[item.
node(3)],
350 m_coords[item.
node(4)]);
353 computePentagonalCenter(m_coords[item.
node(0)],
354 m_coords[item.
node(1)],
355 m_coords[item.
node(2)],
356 m_coords[item.
node(3)],
357 m_coords[item.
node(4)]);
362Euclidian3Geometry::ComputeHexagon6::
366 computeTriangleNormal(m_coords[item.
node(0)],
367 m_coords[item.
node(1)],
368 m_coords[item.
node(2)]) +
369 computeTriangleNormal(m_coords[item.
node(0)],
370 m_coords[item.
node(2)],
371 m_coords[item.
node(3)]) +
372 computeTriangleNormal(m_coords[item.
node(0)],
373 m_coords[item.
node(3)],
374 m_coords[item.
node(4)]) +
375 computeTriangleNormal(m_coords[item.
node(0)],
376 m_coords[item.
node(4)],
377 m_coords[item.
node(5)]);
380 computeHexagonalCenter(m_coords[item.
node(0)],
381 m_coords[item.
node(1)],
382 m_coords[item.
node(2)],
383 m_coords[item.
node(3)],
384 m_coords[item.
node(4)],
385 m_coords[item.
node(5)]);
390Euclidian3Geometry::ComputeTetraedron4::
391computeOrientedMeasureAndCenter(
const ItemWithNodes & item, Real & measure,
Real3 & center)
393 ARCANE_ASSERT((item.
type() == IT_Tetraedron4),(
"Bad item type: %d vs %d (Tetra4)",item.
type(),IT_Tetraedron4));
394 measure = computeTetraedronVolume(m_coords[item.
node(0)],
395 m_coords[item.
node(1)],
396 m_coords[item.
node(2)],
397 m_coords[item.
node(3)]);
398 center = computeTetraedronCenter(m_coords[item.
node(0)],
399 m_coords[item.
node(1)],
400 m_coords[item.
node(2)],
401 m_coords[item.
node(3)]);
405Euclidian3Geometry::ComputeTetraedron4::
408 ARCANE_ASSERT((item.
type() == IT_Tetraedron4),(
"Bad item type: %d vs %d (Tetra4)",item.
type(),IT_Tetraedron4));
413 area += math::abs(computeTriangleSurface(m_coords[face.
node(0)],
414 m_coords[face.
node(1)],
415 m_coords[face.
node(2)]));
422Euclidian3Geometry::ComputeGenericVolume::
423computeOrientedMeasureAndCenter(
const ItemWithNodes & item, Real & measure,
Real3 & center)
426 Real3 vcenter(0,0,0);
428 vcenter += m_coords[item.
node(i)];
433 center =
Real3(0,0,0);
440 const Real orientation = (face.
frontCell() == cell)?1:-1;
443 Real v = orientation * computeTetraedronVolume(m_coords[face.
node(0)],
444 m_coords[face.
node(1)],
445 m_coords[face.
node(2)],
447 center += v * computeTetraedronCenter(m_coords[face.
node(0)],
448 m_coords[face.
node(1)],
449 m_coords[face.
node(2)],
452 }
else if (face.
nbNode() == 4) {
454 const Real3 coords[5] = { m_coords[face.
node(0)],
455 m_coords[face.
node(1)],
456 m_coords[face.
node(2)],
457 m_coords[face.
node(3)],
458 m_coords[face.
node(0)] };
459 const Real3 fcenter = computeQuadrilateralCenter(coords[0],coords[1],coords[2],coords[3]);
461 const Real v = orientation * computeTetraedronVolume(coords[j], coords[j+1], fcenter, vcenter);
462 center += v * computeTetraedronCenter(coords[j], coords[j+1], fcenter, vcenter);
477Euclidian3Geometry::ComputeGenericVolume::
485 area += math::abs(computeTriangleSurface(m_coords[face.
node(0)],
486 m_coords[face.
node(1)],
487 m_coords[face.
node(2)]));
488 }
else if (face.
nbNode() == 4) {
489 area += math::abs(computeTriangleSurface(m_coords[item.
node(0)],
490 m_coords[item.
node(1)],
491 m_coords[item.
node(2)]))
492 + math::abs(computeTriangleSurface(m_coords[item.
node(0)],
493 m_coords[item.
node(3)],
494 m_coords[item.
node(3)]));
504NUMERICS_END_NAMESPACE
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
Face face(Int32 i) const
i-ème face de la maille
Int32 nbFace() const
Nombre de faces de la maille.
Cell frontCell() const
Maille devant la face (maille nulle si aucune)
Exception lorsqu'une erreur fatale est survenue.
Elément de maillage s'appuyant sur des noeuds (Edge,Face,Cell).
Node node(Int32 i) const
i-ème noeud de l'entité
Int32 nbNode() const
Nombre de noeuds de l'entité
Cell toCell() const
Converti l'entité en le genre Cell.
Int16 type() const
Type de l'entité
Exception lorsqu'une fonction n'est pas implémentée.
Exception lorsqu'une opération n'est pas supportée.
Classe gérant un vecteur de réel de dimension 3.
__host__ __device__ Real scaMul(Real2 u, Real2 v)
Produit scalaire de u par v dans .
__host__ __device__ double sqrt(double v)
Racine carrée de v.
Real normeR3(Real3 v1)
Norme d'un vecteur.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.
double Real
Type représentant un réel.