VTK  9.7.20260911
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
12#include <cstdint> // for std::int32_t and std::int64_t
13
14VTK_ABI_NAMESPACE_BEGIN
16class vtkPoints;
17
18class VTKIOLSDYNA_EXPORT vtkLSDynaPart : public vtkObject
19{
20public:
21 static vtkLSDynaPart* New();
22
23 vtkTypeMacro(vtkLSDynaPart, vtkObject);
24 void PrintSelf(ostream& os, vtkIndent indent) override;
25
26 // Description: Set the type of the part
27 void SetPartType(int type);
28
29 // Description: Returns the type of the part
31
32 // Description: Returns if the type of the part is considered valid
33 bool hasValidType() const;
34
36 vtkIdType GetPartId() const { return PartId; }
37 bool HasCells() const;
38
39 // Setup the part with some basic information about what it holds
40 void InitPart(vtkStdString name, const vtkIdType& partId, const vtkIdType& userMaterialId,
41 const vtkIdType& numGlobalPoints, const int& sizeOfWord);
42
43 // Reserves the needed space in memory for this part
44 // that way we never over allocate memory
45 void AllocateCellMemory(const vtkIdType& numCells, const vtkIdType& cellLen);
46
47 // Add a cell to the part
48 void AddCell(const int& cellType, const vtkIdType& npts, vtkIdType conn[8]);
49
50 // Description:
51 // Setups the part cell topology so that we can cache information
52 // between timesteps.
54
55 // Description:
56 // Returns if the topology for this part has been constructed
57 bool IsTopologyBuilt() const { return TopologyBuilt; }
58
59 // Description:
60 // Constructs the grid for this part and returns it.
62
63 // Description:
64 // allows the part to store dead cells
65 void EnableDeadCells(const int& deadCellsAsGhostArray);
66
67 // Description:
68 // removes the dead cells array if it exists from the grid
70
71 // Description:
72 // We set cells as dead to make them not show up during rendering
73 void SetCellsDeadState(unsigned char* dead, const vtkIdType& size);
74
75 // Description:
76 // allows the part to store user cell ids
78
79 // Description:
80 // Set the user ids for the cells of this grid
81 void SetNextCellUserIds(const vtkIdType& value);
82
83 // Description:
84 // Called to init point filling for a property
85 // is also able to set the point position of the grid too as that
86 // is stored as a point property
87 void AddPointProperty(const char* name, const vtkIdType& numComps, const bool& isIdTypeProperty,
88 const bool& isProperty, const bool& isGeometryPoints);
89
90 // Description:
91 // Given a chunk of point property memory copy it to the correct
92 // property on the part
93 void ReadPointBasedProperty(float* data, const vtkIdType& numTuples, const vtkIdType& numComps,
94 const vtkIdType& currentGlobalPointIndex);
95
96 void ReadPointBasedProperty(double* data, const vtkIdType& numTuples, const vtkIdType& numComps,
97 const vtkIdType& currentGlobalPointIndex);
98
99 // Description:
100 // Given a chunk of integer point property memory (user ids) copy it
101 // to the id type property on the part, converting each value
102 void ReadPointBasedProperty(std::int32_t* data, const vtkIdType& numTuples,
103 const vtkIdType& numComps, const vtkIdType& currentGlobalPointIndex);
104
105 void ReadPointBasedProperty(std::int64_t* data, const vtkIdType& numTuples,
106 const vtkIdType& numComps, const vtkIdType& currentGlobalPointIndex);
107
108 // Description:
109 // Adds a property to the part
110 void AddCellProperty(const char* name, const int& offset, const int& numComps);
111
112 // Description:
113 // Given the raw data converts it to be the properties for this part
114 // The cell properties are woven together as a block for each cell
116 float* cellProperties, const vtkIdType& numCells, const vtkIdType& numPropertiesInCell);
118 double* cellsProperties, const vtkIdType& numCells, const vtkIdType& numPropertiesInCell);
119
120 // Description:
121 // Returns if any cell property has been registered on this part
122 bool HasCellProperties() const;
123
124 // Description:
125 // Get the id of the lowest global point this part needs
126 // Note: Presumes topology has been built already
128
129 // Description:
130 // Get the id of the largest global point this part needs
131 // Note: Presumes topology has been built already
133
134protected:
136 ~vtkLSDynaPart() override;
137
139
142
143 void GetPropertyData(const char* name, const vtkIdType& numComps, const bool& isIdTypeArray,
144 const bool& isProperty, const bool& isGeometry);
145
146 // basic info about the part
151
155
158
161
164
166
167 class InternalCells;
168 InternalCells* Cells;
169
170 class InternalCellProperties;
171 InternalCellProperties* CellProperties;
172
173 class InternalPointsUsed;
174 InternalPointsUsed* GlobalPointsUsed;
175
176 // used when reading properties
177 class InternalCurrentPointInfo;
178 InternalCurrentPointInfo* CurrentPointPropInfo;
179
180private:
181 template <typename T, typename U>
182 void AddPointInformation(T* buffer, U* pointData, const vtkIdType& numTuples,
183 const vtkIdType& numComps, const vtkIdType& currentGlobalPointIndex);
184
185 vtkLSDynaPart(const vtkLSDynaPart&) = delete;
186 void operator=(const vtkLSDynaPart&) = delete;
187};
188
189VTK_ABI_NAMESPACE_END
190#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 ReadPointBasedProperty(std::int32_t *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 ReadPointBasedProperty(std::int64_t *data, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
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
bool HasCellProperties() const
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()
LSDynaMetaData::LSDYNA_TYPES PartType() const
represent and manipulate 3D points
Definition vtkPoints.h:140
Wrapper around std::string to keep symbols short.
dataset represents arbitrary combinations of all possible cell types
int vtkIdType
Definition vtkType.h:363