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