VTK  9.3.20240425
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
25VTK_ABI_NAMESPACE_BEGIN
26class vtkGenericCell;
27
28class VTKIOEXODUS_EXPORT vtkCPExodusIIElementBlockImpl : public vtkObject
29{
30public:
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.
48 void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds);
49 void GetFaceStream(vtkIdType cellId, vtkIdList* ptIds);
51 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds);
53 void GetIdsOfCellsOfType(int type, vtkIdTypeArray* array);
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
67protected:
70
71private:
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
100VTK_ABI_NAMESPACE_END
101#endif // vtkCPExodusIIElementBlock_h
vtkIdType InsertNextCell(int type, vtkIdList *ptIds)
vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkCellArray *faces)
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)
static vtkCPExodusIIElementBlockImpl * New()
Uses an Exodus II element block as a vtkMappedUnstructuredGrid's implementation.
object to represent cell connectivity
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
#define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl)
int vtkIdType
Definition vtkType.h:315
#define VTK_SIZEHINT(...)