VTK  9.3.20240418
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 "vtkIOExodusModule.h" // For export macro
19 #include "vtkObject.h"
20 
21 #include "vtkMappedUnstructuredGrid.h" // For mapped unstructured grid wrapper
22 
23 #include <string> // For std::string
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkGenericCell;
27 
28 class VTKIOEXODUS_EXPORT vtkCPExodusIIElementBlockImpl : public vtkObject
29 {
30 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
43  int* elements, const std::string& type, int numElements, int nodesPerElement);
44 
45  // API for vtkMappedUnstructuredGrid's implementation.
47  int GetCellType(vtkIdType cellId);
48  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds);
49  void GetFaceStream(vtkIdType cellId, vtkIdList* ptIds);
51  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds);
55 
56  // This container is read only -- these methods do nothing but print a
57  // warning.
58  void Allocate(vtkIdType numCells, int extSize = 1000);
60  vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[])
61  VTK_SIZEHINT(ptIds, npts);
62  vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkCellArray* faces)
63  VTK_SIZEHINT(ptIds, npts);
64 
65  void ReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) VTK_SIZEHINT(pts, npts);
66 
67 protected:
70 
71 private:
73  void operator=(const vtkCPExodusIIElementBlockImpl&) = delete;
74 
75  // Convert between Exodus node ids and VTK point ids.
76  static vtkIdType NodeToPoint(const int& id) { return static_cast<vtkIdType>(id - 1); }
77  static int PointToNode(const vtkIdType& id) { return static_cast<int>(id + 1); }
78 
79  // Convenience methods to get pointers into the element array.
80  int* GetElementStart(vtkIdType cellId) const
81  {
82  return this->Elements + (cellId * this->CellSize);
83  }
84  int* GetElementEnd(vtkIdType cellId) const
85  {
86  return this->Elements + (cellId * this->CellSize) + this->CellSize;
87  }
88  int* GetStart() const { return this->Elements; }
89  int* GetEnd() const { return this->Elements + (this->NumberOfCells * this->CellSize); }
90 
91  int* Elements;
92  int CellType;
93  int CellSize;
94  vtkIdType NumberOfCells;
95 };
96 
99 
100 VTK_ABI_NAMESPACE_END
101 #endif // vtkCPExodusIIElementBlock_h
vtkIdType InsertNextCell(int type, vtkIdList *ptIds)
vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkCellArray *faces)
static vtkCPExodusIIElementBlockImpl * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array)
~vtkCPExodusIIElementBlockImpl() override
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
void ReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[])
int GetCellType(vtkIdType cellId)
void Allocate(vtkIdType numCells, int extSize=1000)
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[])
void GetPolyhedronFaces(vtkIdType cellId, vtkCellArray *faces)
bool SetExodusConnectivityArray(int *elements, const std::string &type, int numElements, int nodesPerElement)
Set the Exodus element block data.
void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds)
Uses an Exodus II element block as a vtkMappedUnstructuredGrid's implementation.
object to represent cell connectivity
Definition: vtkCellArray.h:286
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:133
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162
@ type
Definition: vtkX3D.h:516
@ string
Definition: vtkX3D.h:490
vtkMakeExportedMappedUnstructuredGrid(vtkCPExodusIIElementBlock, vtkCPExodusIIElementBlockImpl, VTKIOEXODUS_EXPORT)
int vtkIdType
Definition: vtkType.h:315
#define VTK_SIZEHINT(...)