VTK  9.2.6
vtkCPExodusIIElementBlock.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCPExodusIIElementBlock.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
27#ifndef vtkCPExodusIIElementBlock_h
28#define vtkCPExodusIIElementBlock_h
29
30#include "vtkIOExodusModule.h" // For export macro
31#include "vtkObject.h"
32
33#include "vtkMappedUnstructuredGrid.h" // For mapped unstructured grid wrapper
34
35#include <string> // For std::string
36
37class vtkGenericCell;
38
39class VTKIOEXODUS_EXPORT vtkCPExodusIIElementBlockImpl : public vtkObject
40{
41public:
43 void PrintSelf(ostream& os, vtkIndent indent) override;
45
54 int* elements, const std::string& type, int numElements, int nodesPerElement);
55
56 // API for vtkMappedUnstructuredGrid's implementation.
59 void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds);
60 void GetFaceStream(vtkIdType cellId, vtkIdList* ptIds);
61 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds);
63 void GetIdsOfCellsOfType(int type, vtkIdTypeArray* array);
65
66 // This container is read only -- these methods do nothing but print a
67 // warning.
68 void Allocate(vtkIdType numCells, int extSize = 1000);
70 vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[])
71 VTK_SIZEHINT(ptIds, npts);
72 vtkIdType InsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkIdType nfaces,
73 const vtkIdType faces[]) VTK_SIZEHINT(ptIds, npts) VTK_SIZEHINT(faces, nfaces);
74 void ReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) VTK_SIZEHINT(pts, npts);
75
76protected:
79
80private:
82 void operator=(const vtkCPExodusIIElementBlockImpl&) = delete;
83
84 // Convert between Exodus node ids and VTK point ids.
85 static vtkIdType NodeToPoint(const int& id) { return static_cast<vtkIdType>(id - 1); }
86 static int PointToNode(const vtkIdType& id) { return static_cast<int>(id + 1); }
87
88 // Convenience methods to get pointers into the element array.
89 int* GetElementStart(vtkIdType cellId) const
90 {
91 return this->Elements + (cellId * this->CellSize);
92 }
93 int* GetElementEnd(vtkIdType cellId) const
94 {
95 return this->Elements + (cellId * this->CellSize) + this->CellSize;
96 }
97 int* GetStart() const { return this->Elements; }
98 int* GetEnd() const { return this->Elements + (this->NumberOfCells * this->CellSize); }
99
100 int* Elements;
101 int CellType;
102 int CellSize;
103 vtkIdType NumberOfCells;
104};
105
108
109#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:34
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:63
#define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl)
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)