VTK  9.2.6
vtkLSDynaPart.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkLSDynaPart.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
15#ifndef vtkLSDynaPart_h
16#define vtkLSDynaPart_h
17
18#include "LSDynaMetaData.h" //needed for lsdyna types
19#include "vtkIOLSDynaModule.h" // For export macro
20#include "vtkObject.h"
21#include "vtkStdString.h" //needed for string
22
24class vtkPoints;
25
26class VTKIOLSDYNA_EXPORT vtkLSDynaPart : public vtkObject
27{
28public:
29 static vtkLSDynaPart* New();
30
31 vtkTypeMacro(vtkLSDynaPart, vtkObject);
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
34 // Description: Set the type of the part
35 void SetPartType(int type);
36
37 // Description: Returns the type of the part
38 LSDynaMetaData::LSDYNA_TYPES PartType() const { return Type; }
39
40 // Description: Returns if the type of the part is considered valid
41 bool hasValidType() const;
42
43 vtkIdType GetUserMaterialId() const { return UserMaterialId; }
44 vtkIdType GetPartId() const { return PartId; }
45 bool HasCells() const;
46
47 // Setup the part with some basic information about what it holds
48 void InitPart(vtkStdString name, const vtkIdType& partId, const vtkIdType& userMaterialId,
49 const vtkIdType& numGlobalPoints, const int& sizeOfWord);
50
51 // Reserves the needed space in memory for this part
52 // that way we never over allocate memory
53 void AllocateCellMemory(const vtkIdType& numCells, const vtkIdType& cellLen);
54
55 // Add a cell to the part
56 void AddCell(const int& cellType, const vtkIdType& npts, vtkIdType conn[8]);
57
58 // Description:
59 // Setups the part cell topology so that we can cache information
60 // between timesteps.
62
63 // Description:
64 // Returns if the toplogy for this part has been constructed
65 bool IsTopologyBuilt() const { return TopologyBuilt; }
66
67 // Description:
68 // Constructs the grid for this part and returns it.
70
71 // Description:
72 // allows the part to store dead cells
73 void EnableDeadCells(const int& deadCellsAsGhostArray);
74
75 // Description:
76 // removes the dead cells array if it exists from the grid
78
79 // Description:
80 // We set cells as dead to make them not show up during rendering
81 void SetCellsDeadState(unsigned char* dead, const vtkIdType& size);
82
83 // Description:
84 // allows the part to store user cell ids
86
87 // Description:
88 // Set the user ids for the cells of this grid
89 void SetNextCellUserIds(const vtkIdType& value);
90
91 // Description:
92 // Called to init point filling for a property
93 // is also able to set the point position of the grid too as that
94 // is stored as a point property
95 void AddPointProperty(const char* name, const vtkIdType& numComps, const bool& isIdTypeProperty,
96 const bool& isProperty, const bool& isGeometryPoints);
97
98 // Description:
99 // Given a chunk of point property memory copy it to the correct
100 // property on the part
101 void ReadPointBasedProperty(float* data, const vtkIdType& numTuples, const vtkIdType& numComps,
102 const vtkIdType& currentGlobalPointIndex);
103
104 void ReadPointBasedProperty(double* data, const vtkIdType& numTuples, const vtkIdType& numComps,
105 const vtkIdType& currentGlobalPointIndex);
106
107 // Description:
108 // Adds a property to the part
109 void AddCellProperty(const char* name, const int& offset, const int& numComps);
110
111 // Description:
112 // Given the raw data converts it to be the properties for this part
113 // The cell properties are woven together as a block for each cell
115 float* cellProperties, const vtkIdType& numCells, const vtkIdType& numPropertiesInCell);
117 double* cellsProperties, const vtkIdType& numCells, const vtkIdType& numPropertiesInCell);
118
119 // Description:
120 // Get the id of the lowest global point this part needs
121 // Note: Presumes topology has been built already
123
124 // Description:
125 // Get the id of the largest global point this part needs
126 // Note: Presumes topology has been built already
128
129protected:
131 ~vtkLSDynaPart() override;
132
134
137
138 void GetPropertyData(const char* name, const vtkIdType& numComps, const bool& isIdTypeArray,
139 const bool& isProperty, const bool& isGeometry);
140
141 template <typename T>
142 void AddPointInformation(T* buffer, T* pointData, const vtkIdType& numTuples,
143 const vtkIdType& numComps, const vtkIdType& currentGlobalPointIndex);
144
145 // basic info about the part
150
154
157
160
163
165
166 class InternalCells;
167 InternalCells* Cells;
168
169 class InternalCellProperties;
170 InternalCellProperties* CellProperties;
171
172 class InternalPointsUsed;
173 class DensePointsUsed;
174 class SparsePointsUsed;
175 InternalPointsUsed* GlobalPointsUsed;
176
177 // used when reading properties
178 class InternalCurrentPointInfo;
179 InternalCurrentPointInfo* CurrentPointPropInfo;
180
181private:
182 vtkLSDynaPart(const vtkLSDynaPart&) = delete;
183 void operator=(const vtkLSDynaPart&) = delete;
184};
185
186#endif // vtkLSDynaPart_h
LSDYNA_TYPES
LS-Dyna cell types.
a simple class to control print indentation
Definition vtkIndent.h:40
void SetNextCellUserIds(const vtkIdType &value)
InternalCellProperties * CellProperties
void ReadPointBasedProperty(float *data, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AddCellProperty(const char *name, const int &offset, const int &numComps)
LSDynaMetaData::LSDYNA_TYPES Type
void AddCell(const int &cellType, const vtkIdType &npts, vtkIdType conn[8])
void AddPointProperty(const char *name, const vtkIdType &numComps, const bool &isIdTypeProperty, const bool &isProperty, const bool &isGeometryPoints)
vtkStdString Name
vtkUnstructuredGrid * Grid
bool DeadCellsAsGhostArray
vtkIdType NumberOfGlobalPoints
vtkIdType PartId
void BuildCells()
vtkUnstructuredGrid * ThresholdGrid
vtkIdType GetUserMaterialId() const
vtkIdType NumberOfPoints
bool HasCells() const
vtkIdType GetMaxGlobalPointId() const
void BuildToplogy()
InternalPointsUsed * GlobalPointsUsed
InternalCells * Cells
vtkIdType GetPartId() const
InternalCurrentPointInfo * CurrentPointPropInfo
vtkIdType NumberOfCells
void DisableDeadCells()
vtkIdType GetMinGlobalPointId() const
void InitPart(vtkStdString name, const vtkIdType &partId, const vtkIdType &userMaterialId, const vtkIdType &numGlobalPoints, const int &sizeOfWord)
void EnableDeadCells(const int &deadCellsAsGhostArray)
vtkPoints * Points
bool IsTopologyBuilt() const
void SetCellsDeadState(unsigned char *dead, const vtkIdType &size)
~vtkLSDynaPart() override
vtkUnstructuredGrid * GenerateGrid()
void GetPropertyData(const char *name, const vtkIdType &numComps, const bool &isIdTypeArray, const bool &isProperty, const bool &isGeometry)
vtkIdType UserMaterialId
void ReadCellProperties(float *cellProperties, const vtkIdType &numCells, const vtkIdType &numPropertiesInCell)
void BuildUniquePoints()
void AllocateCellMemory(const vtkIdType &numCells, const vtkIdType &cellLen)
static vtkLSDynaPart * New()
vtkUnstructuredGrid * RemoveDeletedCells()
void ReadPointBasedProperty(double *data, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
bool hasValidType() const
void ReadCellProperties(double *cellsProperties, const vtkIdType &numCells, const vtkIdType &numPropertiesInCell)
void SetPartType(int type)
void EnableCellUserIds()
void AddPointInformation(T *buffer, T *pointData, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
LSDynaMetaData::LSDYNA_TYPES PartType() const
abstract base class for most VTK objects
Definition vtkObject.h:63
represent and manipulate 3D points
Definition vtkPoints.h:40
Wrapper around std::string to keep symbols short.
dataset represents arbitrary combinations of all possible cell types
int vtkIdType
Definition vtkType.h:332