VTK: IO/Exodus/vtkCPExodusIIElementBlock.h Source File

| VTK 9.3.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 "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:
31 static vtkCPExodusIIElementBlockImpl* New();
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33 vtkTypeMacro(vtkCPExodusIIElementBlockImpl, vtkObject);
34
42 bool SetExodusConnectivityArray(
43 int* elements, const std::string& type, int numElements, int nodesPerElement);
44
45 // API for vtkMappedUnstructuredGrid's implementation.
46 vtkIdType GetNumberOfCells();
47 int GetCellType(vtkIdType cellId);
48 void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds);
49 void GetFaceStream(vtkIdType cellId, vtkIdList* ptIds);
50 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds);
51 int GetMaxCellSize();
52 void GetIdsOfCellsOfType(int type, vtkIdTypeArray* array);
53 int IsHomogeneous();
54
55 // This container is read only -- these methods do nothing but print a
56 // warning.
57 void Allocate(vtkIdType numCells, int extSize = 1000);
58 vtkIdType InsertNextCell(int type, vtkIdList* ptIds);
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
65 protected:
66 vtkCPExodusIIElementBlockImpl();
67 ~vtkCPExodusIIElementBlockImpl() override;
68
69 private:
70 vtkCPExodusIIElementBlockImpl(const vtkCPExodusIIElementBlockImpl&) = delete;
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
95 vtkMakeExportedMappedUnstructuredGrid(
96 vtkCPExodusIIElementBlock, vtkCPExodusIIElementBlockImpl, VTKIOEXODUS_EXPORT);
97
98 VTK_ABI_NAMESPACE_END
99 #endif // vtkCPExodusIIElementBlock_h
vtkCPExodusIIElementBlockImpl
Definition: vtkCPExodusIIElementBlock.h:29
vtkCPExodusIIElementBlockImpl::InsertNextCell
vtkIdType InsertNextCell(int type, vtkIdList *ptIds)
vtkCPExodusIIElementBlockImpl::New
static vtkCPExodusIIElementBlockImpl * New()
vtkCPExodusIIElementBlockImpl::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCPExodusIIElementBlockImpl::IsHomogeneous
int IsHomogeneous()
vtkCPExodusIIElementBlockImpl::GetIdsOfCellsOfType
void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array)
vtkCPExodusIIElementBlockImpl::~vtkCPExodusIIElementBlockImpl
~vtkCPExodusIIElementBlockImpl() override
vtkCPExodusIIElementBlockImpl::GetCellPoints
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
vtkCPExodusIIElementBlockImpl::InsertNextCell
vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkIdType nfaces, const vtkIdType faces[])
vtkCPExodusIIElementBlockImpl::ReplaceCell
void ReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[])
vtkCPExodusIIElementBlockImpl::GetCellType
int GetCellType(vtkIdType cellId)
vtkCPExodusIIElementBlockImpl::Allocate
void Allocate(vtkIdType numCells, int extSize=1000)
vtkCPExodusIIElementBlockImpl::GetPointCells
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
vtkCPExodusIIElementBlockImpl::InsertNextCell
vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[])
vtkCPExodusIIElementBlockImpl::vtkCPExodusIIElementBlockImpl
vtkCPExodusIIElementBlockImpl()
vtkCPExodusIIElementBlockImpl::GetNumberOfCells
vtkIdType GetNumberOfCells()
vtkCPExodusIIElementBlockImpl::SetExodusConnectivityArray
bool SetExodusConnectivityArray(int *elements, const std::string &type, int numElements, int nodesPerElement)
Set the Exodus element block data.
vtkCPExodusIIElementBlockImpl::GetFaceStream
void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds)
vtkCPExodusIIElementBlockImpl::GetMaxCellSize
int GetMaxCellSize()
vtkCPExodusIIElementBlock
Uses an Exodus II element block as a vtkMappedUnstructuredGrid's implementation.
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:38
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:32
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:37
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkMakeExportedMappedUnstructuredGrid
vtkMakeExportedMappedUnstructuredGrid(vtkCPExodusIIElementBlock, vtkCPExodusIIElementBlockImpl, VTKIOEXODUS_EXPORT)
vtkMappedUnstructuredGrid.h
vtkObject.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:36