14#include "arcane/core/IMesh.h"
16#include "arcane/core/AbstractItemOperationByBasicType.h"
18#include "arcane/geometry/BarycentricGeomShapeComputer.h"
19#include "arcane/geometry/GeomShapeMng.h"
24namespace Arcane::geometric
33template <>
void BarycentricGeomShapeComputer::
41 for (
Integer i = 0; i < 4; ++i) {
44 elem.setCenter(0.25 * c);
47 _setFace2D(0, elem, 0, 1);
48 _setFace2D(1, elem, 1, 2);
49 _setFace2D(2, elem, 2, 3);
50 _setFace2D(3, elem, 3, 0);
70template <>
void BarycentricGeomShapeComputer::
81 elem.setCenter(c / 3.0);
84 _setFace2D(0, elem, 0, 1);
85 _setFace2D(1, elem, 1, 2);
86 _setFace2D(2, elem, 2, 0);
88 elem.setFace(3, elem.node(0));
108template <>
void BarycentricGeomShapeComputer::
114 Real3 c = nul_vector;
116 for (
Integer i = 0; i < 8; ++i)
119 elem.setCenter(0.125 * c);
122 _setFace3D(0, elem, 0, 3, 2, 1);
123 _setFace3D(1, elem, 0, 4, 7, 3);
124 _setFace3D(2, elem, 0, 1, 5, 4);
125 _setFace3D(3, elem, 4, 5, 6, 7);
126 _setFace3D(4, elem, 1, 2, 6, 5);
127 _setFace3D(5, elem, 2, 3, 7, 6);
145template <>
void BarycentricGeomShapeComputer::
151 Real3 c = nul_vector;
153 for (
Integer i = 0; i < 5; ++i)
155 elem.setCenter(0.2 * c);
158 _setFace3D(0, elem, 0, 3, 2, 1);
159 _setFace3D(1, elem, 0, 4, 3);
160 _setFace3D(2, elem, 0, 1, 4);
161 _setFace3D(3, elem, 1, 2, 4);
162 _setFace3D(4, elem, 2, 3, 4);
165 elem.setFace(5, elem.node(4));
183template <>
void BarycentricGeomShapeComputer::
189 Real3 c = nul_vector;
191 for (
Integer i = 0; i < 6; ++i)
194 elem.setCenter((1. / 6.) * c);
196 _setFace3D(0, elem, 0, 2, 1);
197 _setFace3D(1, elem, 0, 3, 5, 2);
198 _setFace3D(2, elem, 0, 1, 4, 3);
199 _setFace3D(3, elem, 3, 4, 5);
200 _setFace3D(4, elem, 1, 2, 5, 4);
218template <>
void BarycentricGeomShapeComputer::
224 Real3 c = nul_vector;
226 for (
Integer i = 0; i < 4; ++i) {
230 elem.setCenter(0.25 * c);
232 _setFace3D(0, elem, 0, 2, 1);
233 _setFace3D(1, elem, 0, 3, 2);
234 _setFace3D(2, elem, 0, 1, 3);
235 _setFace3D(3, elem, 3, 1, 2);
253template <>
void BarycentricGeomShapeComputer::
259 Real3 c = nul_vector;
261 for (
Integer i = 0; i < 10; ++i) {
264 elem.setCenter(0.1 * c);
266 elem.setFace(0, 0.2 * (elem.node(0) + elem.node(4) + elem.node(3) + elem.node(2) + elem.node(1)));
267 elem.setFace(1, 0.2 * (elem.node(5) + elem.node(6) + elem.node(7) + elem.node(8) + elem.node(9)));
269 _setFace3D(2, elem, 0, 1, 6, 5);
270 _setFace3D(3, elem, 1, 2, 7, 6);
271 _setFace3D(4, elem, 2, 3, 8, 7);
272 _setFace3D(5, elem, 3, 4, 9, 8);
273 _setFace3D(6, elem, 4, 0, 5, 9);
291template <>
void BarycentricGeomShapeComputer::
297 Real3 c = nul_vector;
299 for (
Integer i = 0; i < 12; ++i) {
303 elem.setCenter((1. / 12.) * c);
305 elem.setFace(0, (1. / 6.) * (elem.node(0) + elem.node(5) + elem.node(4) + elem.node(3) + elem.node(2) + elem.node(1)));
306 elem.setFace(1, (1. / 6.) * (elem.node(6) + elem.node(7) + elem.node(8) + elem.node(9) + elem.node(10) + elem.node(11)));
307 _setFace3D(2, elem, 0, 1, 7, 6);
308 _setFace3D(3, elem, 1, 2, 8, 7);
309 _setFace3D(4, elem, 2, 3, 9, 8);
310 _setFace3D(5, elem, 3, 4, 10, 9);
311 _setFace3D(6, elem, 4, 5, 11, 10);
312 _setFace3D(7, elem, 5, 0, 6, 11);
365class BarycentricGeomShapeComputerByType
374 : m_shape_mng(shape_mng)
375 , m_node_coords(node_coords)
379 template <GeomType ItemType>
void
392 ARCANE_UNUSED(cells);
397 ARCANE_UNUSED(cells);
402 ARCANE_UNUSED(cells);
407 ARCANE_UNUSED(cells);
413 _applyGeneric<GeomType::Quad4>(cells);
417 _applyGeneric<GeomType::Triangle3>(cells);
422 _applyGeneric<GeomType::Hexaedron8>(cells);
427 _applyGeneric<GeomType::Pyramid5>(cells);
432 _applyGeneric<GeomType::Pentaedron6>(cells);
437 _applyGeneric<GeomType::Tetraedron4>(cells);
442 _applyGeneric<GeomType::Heptaedron10>(cells);
447 _applyGeneric<GeomType::Octaedron12>(cells);
Abstract operator on entities sorted by type.
Exception when a fatal error has occurred.
void applyOperation(IItemOperationByBasicType *operation) const
Applies the operation operation to the entities of the group.
View on a vector of entities.
Int16 type() const
Entity type.
Class managing a 3-dimensional real vector.
static void computeTetraedron4(GeomShapeMutableView elem)
Calculates the positions of the nodes of a tetrahedral cell.
static void computeOctaedron12(GeomShapeMutableView elem)
Calculates the positions of the nodes of a prismatic cell with a hexagonal base.
static void setNodes(GeomShapeMutableView elem, const VariableNodeReal3 &node_coord, Cell cell)
Fills the node information of the cell cell with the coordinates of node_coord.
static void computeAll(GeomShapeMutableView elem, const VariableNodeReal3 &coords, Cell cell)
Calculates the information for the cell cell.
static void computeTriangle3(GeomShapeMutableView elem)
Calculates the positions of the nodes of a triangular cell.
static void computeQuad4(GeomShapeMutableView elem)
Calculates the positions of the nodes of a quadrilateral cell.
static void computeHeptaedron10(GeomShapeMutableView elem)
Calculates the positions of the nodes of a prismatic cell with a pentagonal base.
static void compute(GeomShapeMutableView elem)
Template method.
static void computePentaedron6(GeomShapeMutableView elem)
Calculates the positions of the nodes of a pentahedral cell.
static void computePyramid5(GeomShapeMutableView elem)
Calculates the positions of the nodes of a pyramidal cell.
static void computeHexaedron8(GeomShapeMutableView elem)
Calculates the positions of the nodes of a hexahedral cell.
Class managing the GeomShapes of a mesh.
Mutable view on a GeomShape.
Enumeration specifying the type of polygon or polyhedron associated with a geometric element or shape...
@ Tetraedron4
Tetrahedron.
@ Octaedron12
Hexagonal prism.
@ Heptaedron10
Pentagonal prism.
ItemGroupT< Cell > CellGroup
Group of cells.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
Int32 Integer
Type representing an integer.