VTK  9.4.20241226
vtkLSDynaPart.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
3
4#ifndef vtkLSDynaPart_h
5#define vtkLSDynaPart_h
6
7#include "LSDynaMetaData.h" //needed for lsdyna types
8#include "vtkIOLSDynaModule.h" // For export macro
9#include "vtkObject.h"
10#include "vtkStdString.h" //needed for string
11
12VTK_ABI_NAMESPACE_BEGIN
14class vtkPoints;
15
16class VTKIOLSDYNA_EXPORT vtkLSDynaPart : public vtkObject
17{
18public:
19 static vtkLSDynaPart* New();
20
21 vtkTypeMacro(vtkLSDynaPart, vtkObject);
22 void PrintSelf(ostream& os, vtkIndent indent) override;
23
24 // Description: Set the type of the part
25 void SetPartType(int type);
26
27 // Description: Returns the type of the part
28 LSDynaMetaData::LSDYNA_TYPES PartType() const { return Type; }
29
30 // Description: Returns if the type of the part is considered valid
31 bool hasValidType() const;
32
33 vtkIdType GetUserMaterialId() const { return UserMaterialId; }
34 vtkIdType GetPartId() const { return PartId; }
35 bool HasCells() const;
36
37 // Setup the part with some basic information about what it holds
38 void InitPart(vtkStdString name, const vtkIdType& partId, const vtkIdType& userMaterialId,
39 const vtkIdType& numGlobalPoints, const int& sizeOfWord);
40
41 // Reserves the needed space in memory for this part
42 // that way we never over allocate memory
43 void AllocateCellMemory(const vtkIdType& numCells, const vtkIdType& cellLen);
44
45 // Add a cell to the part
46 void AddCell(const int& cellType, const vtkIdType& npts, vtkIdType conn[8]);
47
48 // Description:
49 // Setups the part cell topology so that we can cache information
50 // between timesteps.
52
53 // Description:
54 // Returns if the toplogy for this part has been constructed
55 bool IsTopologyBuilt() const { return TopologyBuilt; }
56
57 // Description:
58 // Constructs the grid for this part and returns it.
60
61 // Description:
62 // allows the part to store dead cells
63 void EnableDeadCells(const int& deadCellsAsGhostArray);
64
65 // Description:
66 // removes the dead cells array if it exists from the grid
68
69 // Description:
70 // We set cells as dead to make them not show up during rendering
71 void SetCellsDeadState(unsigned char* dead, const vtkIdType& size);
72
73 // Description:
74 // allows the part to store user cell ids
76
77 // Description:
78 // Set the user ids for the cells of this grid
79 void SetNextCellUserIds(const vtkIdType& value);
80
81 // Description:
82 // Called to init point filling for a property
83 // is also able to set the point position of the grid too as that
84 // is stored as a point property
85 void AddPointProperty(const char* name, const vtkIdType& numComps, const bool& isIdTypeProperty,
86 const bool& isProperty, const bool& isGeometryPoints);
87
88 // Description:
89 // Given a chunk of point property memory copy it to the correct
90 // property on the part
91 void ReadPointBasedProperty(float* data, const vtkIdType& numTuples, const vtkIdType& numComps,
92 const vtkIdType& currentGlobalPointIndex);
93
94 void ReadPointBasedProperty(double* data, const vtkIdType& numTuples, const vtkIdType& numComps,
95 const vtkIdType& currentGlobalPointIndex);
96
97 // Description:
98 // Adds a property to the part
99 void AddCellProperty(const char* name, const int& offset, const int& numComps);
100
101 // Description:
102 // Given the raw data converts it to be the properties for this part
103 // The cell properties are woven together as a block for each cell
105 float* cellProperties, const vtkIdType& numCells, const vtkIdType& numPropertiesInCell);
107 double* cellsProperties, const vtkIdType& numCells, const vtkIdType& numPropertiesInCell);
108
109 // Description:
110 // Get the id of the lowest global point this part needs
111 // Note: Presumes topology has been built already
113
114 // Description:
115 // Get the id of the largest global point this part needs
116 // Note: Presumes topology has been built already
118
119protected:
121 ~vtkLSDynaPart() override;
122
124
127
128 void GetPropertyData(const char* name, const vtkIdType& numComps, const bool& isIdTypeArray,
129 const bool& isProperty, const bool& isGeometry);
130
131 template <typename T>
132 void AddPointInformation(T* buffer, T* pointData, const vtkIdType& numTuples,
133 const vtkIdType& numComps, const vtkIdType& currentGlobalPointIndex);
134
135 // basic info about the part
140
144
147
150
153
155
156 class InternalCells;
157 InternalCells* Cells;
158
159 class InternalCellProperties;
160 InternalCellProperties* CellProperties;
161
162 class InternalPointsUsed;
163 class DensePointsUsed;
164 class SparsePointsUsed;
165 InternalPointsUsed* GlobalPointsUsed;
166
167 // used when reading properties
168 class InternalCurrentPointInfo;
169 InternalCurrentPointInfo* CurrentPointPropInfo;
170
171private:
172 vtkLSDynaPart(const vtkLSDynaPart&) = delete;
173 void operator=(const vtkLSDynaPart&) = delete;
174};
175
176VTK_ABI_NAMESPACE_END
177#endif // vtkLSDynaPart_h
LSDYNA_TYPES
LS-Dyna cell types.
a simple class to control print indentation
Definition vtkIndent.h:108
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:162
represent and manipulate 3D points
Definition vtkPoints.h:139
Wrapper around std::string to keep symbols short.
dataset represents arbitrary combinations of all possible cell types
int vtkIdType
Definition vtkType.h:315