Arcane  v3.15.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
VtkCellTypes.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* VtkCellTypes.cc (C) 2000-2024 */
9/* */
10/* Définitions des types de maille de VTK. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/internal/VtkCellTypes.h"
15
16#include "arcane/utils/IOException.h"
17#include "arcane/utils/FatalErrorException.h"
18
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30Int16 VtkUtils::
31vtkToArcaneCellType(int vtk_type, Int32 nb_node)
32{
33 switch (vtk_type) {
34 case VTK_EMPTY_CELL:
35 return IT_NullType;
36 case VTK_VERTEX:
37 return IT_Vertex;
38 case VTK_LINE:
39 return IT_Line2;
40 case VTK_QUADRATIC_EDGE:
41 return IT_Line3;
42 case VTK_TRIANGLE:
43 return IT_Triangle3;
44 case VTK_QUAD:
45 return IT_Quad4;
46 case VTK_QUADRATIC_QUAD:
47 return IT_Quad8;
48 case VTK_POLYGON: // VTK_POLYGON (a tester...)
49 if (nb_node == 5)
50 return IT_Pentagon5;
51 if (nb_node == 6)
52 return IT_Hexagon6;
53 ARCANE_THROW(IOException, "Unsupported VtkCellType VTK_POLYGON with nb_node={0}", nb_node);
54 case VTK_TETRA:
55 return IT_Tetraedron4;
56 case VTK_QUADRATIC_TETRA:
57 return IT_Tetraedron10;
58 case VTK_PYRAMID:
59 return IT_Pyramid5;
60 case VTK_WEDGE:
61 return IT_Pentaedron6;
62 case VTK_HEXAHEDRON:
63 return IT_Hexaedron8;
64 case VTK_QUADRATIC_HEXAHEDRON:
65 return IT_Hexaedron20;
66 case VTK_PENTAGONAL_PRISM:
67 return IT_Heptaedron10;
68 case VTK_HEXAGONAL_PRISM:
69 return IT_Octaedron12;
70 // NOTE GG: les types suivants ne sont pas bon pour VTK.
71 //case 27: it = IT_Enneedron14; break; //
72 //case 28: it = IT_Decaedron16; break; // VTK_HEXAGONAL_PRISM
73 //case 29: it = IT_Heptagon7; break; // VTK_HEPTAGON
74 //case 30: it = IT_Octogon8; break; // VTK_OCTAGON
75 default:
76 ARCANE_THROW(IOException, "Unsupported VtkCellType '{0}'", vtk_type);
77 }
78}
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
83unsigned char VtkUtils::
84arcaneToVtkCellType(Int16 arcane_type)
85{
86 switch (arcane_type) {
87 case IT_NullType:
88 return VTK_EMPTY_CELL;
89 case IT_Vertex:
90 return VTK_VERTEX;
91 case IT_Line2:
92 return VTK_LINE;
93 case IT_Line3:
94 return VTK_QUADRATIC_EDGE;
95 case IT_CellLine2:
96 return VTK_LINE;
97 case IT_Triangle3:
98 return VTK_TRIANGLE;
99 case IT_Triangle6:
100 return VTK_QUADRATIC_TRIANGLE;
101 case IT_Quad4:
102 return VTK_QUAD;
103 case IT_Quad8:
104 return VTK_QUADRATIC_QUAD;
105 case IT_Pentagon5:
106 return VTK_POLYGON;
107 // VTK_POLYGON (a tester...)
108 case IT_Hexagon6:
109 return VTK_POLYGON;
110 // VTK_POLYGON (a tester ...)
111 case IT_Tetraedron4:
112 return VTK_TETRA;
113 case IT_Tetraedron10:
114 return VTK_QUADRATIC_TETRA;
115 case IT_Pyramid5:
116 return VTK_PYRAMID;
117 case IT_Pentaedron6:
118 return VTK_WEDGE;
119 case IT_Hexaedron8:
120 return VTK_HEXAHEDRON;
121 case IT_Hexaedron20:
122 return VTK_QUADRATIC_HEXAHEDRON;
123 case IT_Heptaedron10:
124 return VTK_PENTAGONAL_PRISM;
125 case IT_Octaedron12:
126 return VTK_HEXAGONAL_PRISM;
127 default:
128 ARCANE_FATAL("Unsuported item type for VtkWriter type={0}", arcane_type);
129 }
130}
131
132/*---------------------------------------------------------------------------*/
133/*---------------------------------------------------------------------------*/
134
135} // namespace Arcane::VtkUtils
136
137/*---------------------------------------------------------------------------*/
138/*---------------------------------------------------------------------------*/
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Déclarations des types généraux de Arcane.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:149
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-