VTK  9.3.0
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 VTK_ABI_NAMESPACE_BEGIN
14 class vtkPoints;
15 
16 class VTKIOLSDYNA_EXPORT vtkLSDynaPart : public vtkObject
17 {
18 public:
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
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.
51  void BuildToplogy();
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
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 
119 protected:
121  ~vtkLSDynaPart() override;
122 
124 
126  void BuildCells();
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 
171 private:
172  vtkLSDynaPart(const vtkLSDynaPart&) = delete;
173  void operator=(const vtkLSDynaPart&) = delete;
174 };
175 
176 VTK_ABI_NAMESPACE_END
177 #endif // vtkLSDynaPart_h
LSDYNA_TYPES
LS-Dyna cell types.
a simple class to control print indentation
Definition: vtkIndent.h:38
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
vtkUnstructuredGrid * GenerateGrid()
vtkIdType PartId
void BuildCells()
vtkUnstructuredGrid * ThresholdGrid
vtkIdType GetUserMaterialId() const
Definition: vtkLSDynaPart.h:33
vtkIdType NumberOfPoints
bool HasCells() const
vtkUnstructuredGrid * RemoveDeletedCells()
vtkIdType GetMaxGlobalPointId() const
void BuildToplogy()
InternalPointsUsed * GlobalPointsUsed
InternalCells * Cells
vtkIdType GetPartId() const
Definition: vtkLSDynaPart.h:34
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
Definition: vtkLSDynaPart.h:55
void SetCellsDeadState(unsigned char *dead, const vtkIdType &size)
~vtkLSDynaPart() override
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)
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()
static vtkLSDynaPart * New()
void AddPointInformation(T *buffer, T *pointData, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
LSDynaMetaData::LSDYNA_TYPES PartType() const
Definition: vtkLSDynaPart.h:28
abstract base class for most VTK objects
Definition: vtkObject.h:61
represent and manipulate 3D points
Definition: vtkPoints.h:38
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
dataset represents arbitrary combinations of all possible cell types
@ value
Definition: vtkX3D.h:220
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
@ size
Definition: vtkX3D.h:253
@ offset
Definition: vtkX3D.h:438
@ data
Definition: vtkX3D.h:315
int vtkIdType
Definition: vtkType.h:315