4 * Provide a mapping to VTK CellType enum
6 * @author sebastien jourdain - sebastien.jourdain@kitware.com
11 POLY_VERTEX(2, -1), //
15 TRIANGLE_STRIP(6, -1), //
24 PENTAGONAL_PRISM(15, 10), //
25 HEXAGONAL_PRISM(16, 12), //
26 QUADRATRIC_EDGE(21, 3), //
27 QUADRATRIC_TRIANGLE(22, 6), //
28 QUADRATRIC_QUAD(23, 8), //
29 QUADRATRIC_TETRA(24, 10), //
30 QUADRATRIC_HEXAHEDRON(25, 20), //
31 QUADRATRIC_WEDGE(26, 15), //
32 QUADRATRIC_PYRAMID(27, 13);
34 private CellType(int id, int nbPoints) {
36 this.nbPoints = nbPoints;
40 * @return the id that VTK is using to identify it cell type.
47 * @return the number of points that cell type own or -1 for cell that have
48 * a dynamic number of points.
50 public int GetNumberOfPoints() {
55 * @return true if the number of points can not be given by the cell type
57 public boolean IsDynamicNumberOfPoints() {
58 return nbPoints == -1;
63 * @return an instance of CellType based on the vtk cell id.
65 public static CellType GetCellType(int vtkCellId) {
66 if (MAPPING == null) {
69 for (CellType cellType : values()) {
70 max = Math.max(max, cellType.GetId());
72 MAPPING = new CellType[max + 1];
73 for (CellType cellType : values()) {
74 MAPPING[cellType.GetId()] = cellType;
77 return MAPPING[vtkCellId];
82 private static CellType[] MAPPING;