VTK  9.3.0
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);
50 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds);
52 void GetIdsOfCellsOfType(int type, vtkIdTypeArray* array);
54
55 // This container is read only -- these methods do nothing but print a
56 // warning.
57 void Allocate(vtkIdType numCells, int extSize = 1000);
59 vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[])
60 VTK_SIZEHINT(ptIds, npts);
61 vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkIdType nfaces,
62 const vtkIdType faces[]) VTK_SIZEHINT(ptIds, npts) VTK_SIZEHINT(faces, nfaces);
63 void ReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) VTK_SIZEHINT(pts, npts);
64
65protected:
68
69private:
71 void operator=(const vtkCPExodusIIElementBlockImpl&) = delete;
72
73 // Convert between Exodus node ids and VTK point ids.
74 static vtkIdType NodeToPoint(const int& id) { return static_cast<vtkIdType>(id - 1); }
75 static int PointToNode(const vtkIdType& id) { return static_cast<int>(id + 1); }
76
77 // Convenience methods to get pointers into the element array.
78 int* GetElementStart(vtkIdType cellId) const
79 {
80 return this->Elements + (cellId * this->CellSize);
81 }
82 int* GetElementEnd(vtkIdType cellId) const
83 {
84 return this->Elements + (cellId * this->CellSize) + this->CellSize;
85 }
86 int* GetStart() const { return this->Elements; }
87 int* GetEnd() const { return this->Elements + (this->NumberOfCells * this->CellSize); }
88
89 int* Elements;
90 int CellType;
91 int CellSize;
92 vtkIdType NumberOfCells;
93};
94
97
98VTK_ABI_NAMESPACE_END
99#endif // vtkCPExodusIIElementBlock_h
vtkIdType InsertNextCell(int type, vtkIdList *ptIds)
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)
vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkIdType nfaces, const vtkIdType faces[])
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[])
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.
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:23
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:29
abstract base class for most VTK objects
Definition vtkObject.h:49
#define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl)
int vtkIdType
Definition vtkType.h:315
#define VTK_SIZEHINT(...)