VTK  9.0.1
vtkUpdateCellsV8toV9.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkUpdateCellsV8toV9.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
20 #ifndef vtkUpdateCellsV8toV9_h
21 #define vtkUpdateCellsV8toV9_h
22 
23 #include "vtkCellArray.h"
24 #include "vtkCellData.h"
25 #include "vtkCellType.h"
26 #include "vtkCellTypes.h"
28 #include "vtkIdList.h"
29 #include "vtkIdTypeArray.h"
30 #include "vtkNew.h"
31 #include "vtkUnstructuredGrid.h"
32 
34 {
35  vtkNew<vtkIdList> oldpts, newpts;
36 
37  for (vtkIdType i = 0; i < output->GetNumberOfCells(); ++i)
38  {
42  {
43  output->GetCells()->GetCellAtId(i, oldpts);
44  newpts->DeepCopy(oldpts);
45 
46  int degs[3];
47  if (output->GetCellData()->SetActiveAttribute(
48  "HigherOrderDegrees", vtkDataSetAttributes::AttributeTypes::HIGHERORDERDEGREES) != -1)
49  {
51  double degs_double[3];
52  v->GetTuple(i, degs_double);
53  for (int ii = 0; ii < 3; ii++)
54  degs[ii] = static_cast<int>(degs_double[ii]);
55  }
56  else
57  {
58  int order =
59  static_cast<int>(round(std::cbrt(static_cast<int>(oldpts->GetNumberOfIds())))) - 1;
60  degs[0] = degs[1] = degs[2] = order;
61  }
62  for (int j = 0; j < oldpts->GetNumberOfIds(); j++)
63  {
65  if (j != newid)
66  {
67  newpts->SetId(j, oldpts->GetId(newid));
68  }
69  }
70  output->GetCells()->ReplaceCellAtId(i, newpts);
71  }
72  }
73 }
74 
76 {
77  int nCellTypes = cellTypes->GetNumberOfTypes();
78  for (vtkIdType i = 0; i < nCellTypes; ++i)
79  {
80  unsigned char type = cellTypes->GetCellType(i);
83  {
84  return true;
85  }
86  }
87  return false;
88 }
89 
90 #endif // vtkUpdateCellsV8toV9_h
91 // VTK-HeaderTest-Exclude: vtkUpdateCellsV8toV9.h
vtkDataSetAttributes::SetActiveAttribute
int SetActiveAttribute(const char *name, int attributeType)
Make the array with the given name the active attribute.
vtkCellTypes
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:47
vtkHigherOrderHexahedron::NodeNumberingMappingFromVTK8To9
static vtkIdType NodeNumberingMappingFromVTK8To9(const int order[3], const vtkIdType node_id_vtk8)
vtkX3D::type
@ type
Definition: vtkX3D.h:522
vtkCellArray::ReplaceCellAtId
void ReplaceCellAtId(vtkIdType cellId, vtkIdList *list)
Replaces the point ids for the specified cell with the supplied list.
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkCellTypes.h
vtkUnstructuredGrid::GetCellTypesArray
vtkUnsignedCharArray * GetCellTypesArray()
Get the array of all cell types in the grid.
vtkNeedsNewFileVersionV8toV9
bool vtkNeedsNewFileVersionV8toV9(vtkCellTypes *cellTypes)
Definition: vtkUpdateCellsV8toV9.h:75
vtkCellArray.h
VTK_LAGRANGE_HEXAHEDRON
@ VTK_LAGRANGE_HEXAHEDRON
Definition: vtkCellType.h:113
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkUpdateCellsV8toV9
void vtkUpdateCellsV8toV9(vtkUnstructuredGrid *output)
Definition: vtkUpdateCellsV8toV9.h:33
vtkHigherOrderHexahedron.h
vtkDataArray::GetTuple
virtual double * GetTuple(vtkIdType tupleIdx)=0
Get the data tuple at tupleIdx.
vtkUnstructuredGrid::GetNumberOfCells
vtkIdType GetNumberOfCells() override
Determine the number of cells composing the dataset.
vtkCellTypes::GetNumberOfTypes
vtkIdType GetNumberOfTypes()
Return the number of types in the list.
Definition: vtkCellTypes.h:94
vtkCellArray::GetCellAtId
void GetCellAtId(vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints)
Return the point ids for the cell at cellId.
Definition: vtkCellArray.h:1453
vtkUnstructuredGrid.h
vtkDataSet::GetCellData
vtkCellData * GetCellData()
Return a pointer to this dataset's cell data.
Definition: vtkDataSet.h:249
vtkCellTypes::GetCellType
unsigned char GetCellType(vtkIdType cellId)
Return the type of cell.
Definition: vtkCellTypes.h:109
vtkCellType.h
vtkNew< vtkIdList >
vtkIdTypeArray.h
vtkX3D::order
@ order
Definition: vtkX3D.h:446
vtkAOSDataArrayTemplate::GetTypedComponent
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
Definition: vtkAOSDataArrayTemplate.h:107
vtkNew.h
vtkCellData.h
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:92
vtkDataSetAttributes::GetHigherOrderDegrees
vtkDataArray * GetHigherOrderDegrees()
vtkUnstructuredGrid::GetCells
vtkCellArray * GetCells()
Return the unstructured grid connectivity array.
Definition: vtkUnstructuredGrid.h:291
VTK_HIGHER_ORDER_HEXAHEDRON
@ VTK_HIGHER_ORDER_HEXAHEDRON
Definition: vtkCellType.h:106
vtkIdList.h
VTK_BEZIER_HEXAHEDRON
@ VTK_BEZIER_HEXAHEDRON
Definition: vtkCellType.h:122