VTK  9.7.1
vtkCPExodusIIElementBlock.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkCPExodusIIElementBlock_h
16 #define vtkCPExodusIIElementBlock_h
17 
18 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
19 #include "vtkIOExodusModule.h" // For export macro
20 #include "vtkObject.h"
21 
22 #include "vtkMappedUnstructuredGrid.h" // For mapped unstructured grid wrapper
23 
24 #include <string> // For std::string
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkGenericCell;
28 
29 class VTK_DEPRECATED_IN_9_7_0("No longer needed") VTKIOEXODUS_EXPORT vtkCPExodusIIElementBlockImpl
30  : public vtkObject
31 {
32 public:
34  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
44  bool SetExodusConnectivityArray(
45  int* elements, const std::string& type, int numElements, int nodesPerElement);
46 
47  // API for vtkMappedUnstructuredGrid's implementation.
48  vtkIdType GetNumberOfCells();
49  int GetCellType(vtkIdType cellId);
50  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds);
51  void GetFaceStream(vtkIdType cellId, vtkIdList* ptIds);
52  void GetPolyhedronFaces(vtkIdType cellId, vtkCellArray* faces);
53  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds);
54  int GetMaxCellSize();
55  void GetIdsOfCellsOfType(int type, vtkIdTypeArray* array);
56  int IsHomogeneous();
57 
58  // This container is read only -- these methods do nothing but print a
59  // warning.
60  void Allocate(vtkIdType numCells, int extSize = 1000);
61  vtkIdType InsertNextCell(int type, vtkIdList* ptIds);
62  vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[])
63  VTK_SIZEHINT(ptIds, npts);
64  vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkCellArray* faces)
65  VTK_SIZEHINT(ptIds, npts);
66 
67  void ReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) VTK_SIZEHINT(pts, npts);
68 
69 protected:
72 
73 private:
75  void operator=(const vtkCPExodusIIElementBlockImpl&) = delete;
76 
77  // Convert between Exodus node ids and VTK point ids.
78  static vtkIdType NodeToPoint(const int& id) { return static_cast<vtkIdType>(id - 1); }
79  static int PointToNode(const vtkIdType& id) { return static_cast<int>(id + 1); }
80 
81  // Convenience methods to get pointers into the element array.
82  int* GetElementStart(vtkIdType cellId) const
83  {
84  return this->Elements + (cellId * this->CellSize);
85  }
86  int* GetElementEnd(vtkIdType cellId) const
87  {
88  return this->Elements + (cellId * this->CellSize) + this->CellSize;
89  }
90  int* GetStart() const { return this->Elements; }
91  int* GetEnd() const { return this->Elements + (this->NumberOfCells * this->CellSize); }
92 
93  int* Elements;
94  int CellType;
95  int CellSize;
96  vtkIdType NumberOfCells;
97 };
98 
100  VTK_DEPRECATED_IN_9_7_0("No longer needed") VTKIOEXODUS_EXPORT);
101 
102 VTK_ABI_NAMESPACE_END
103 #endif // vtkCPExodusIIElementBlock_h
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
provides thread-safe access to cells
VTKACCELERATORSVTKMDATAMODEL_EXPORT vtkIdType IsHomogeneous(vtkCellArray *cells)
VTKIOCATALYSTCONDUIT_EXPORT int GetCellType(const std::string &shape)
Get vtk cell type from conduit shape name throw a runtime_error on unsupported type.
a simple class to control print indentation
Definition: vtkIndent.h:28
list of point or cell ids
Definition: vtkIdList.h:25
#define VTK_SIZEHINT(...)
vtkMakeExportedMappedUnstructuredGrid(vtkCPExodusIIElementBlock, vtkCPExodusIIElementBlockImpl, VTKIOEXODUS_EXPORT)
Uses an Exodus II element block as a vtkMappedUnstructuredGrid's implementation.
object to represent cell connectivity
Definition: vtkCellArray.h:177
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
#define VTK_DEPRECATED_IN_9_7_0(reason)