VTK  9.0.2
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 #ifndef __VTK_WRAP__
18 
19 #include "LSDynaMetaData.h" //needed for lsdyna types
20 #include "vtkIOLSDynaModule.h" // For export macro
21 #include "vtkObject.h"
22 #include "vtkStdString.h" //needed for string
23 
25 class vtkPoints;
26 
27 class VTKIOLSDYNA_EXPORT vtkLSDynaPart : public vtkObject
28 {
29 public:
30  static vtkLSDynaPart* New();
31 
32  vtkTypeMacro(vtkLSDynaPart, vtkObject);
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
35  // Description: Set the type of the part
36  void SetPartType(int type);
37 
38  // Description: Returns the type of the part
40 
41  // Description: Returns if the type of the part is considered valid
42  bool hasValidType() const;
43 
44  vtkIdType GetUserMaterialId() const { return UserMaterialId; }
45  vtkIdType GetPartId() const { return PartId; }
46  bool HasCells() const;
47 
48  // Setup the part with some basic information about what it holds
49  void InitPart(vtkStdString name, const vtkIdType& partId, const vtkIdType& userMaterialId,
50  const vtkIdType& numGlobalPoints, const int& sizeOfWord);
51 
52  // Reserves the needed space in memory for this part
53  // that way we never over allocate memory
54  void AllocateCellMemory(const vtkIdType& numCells, const vtkIdType& cellLen);
55 
56  // Add a cell to the part
57  void AddCell(const int& cellType, const vtkIdType& npts, vtkIdType conn[8]);
58 
59  // Description:
60  // Setups the part cell topology so that we can cache information
61  // between timesteps.
62  void BuildToplogy();
63 
64  // Description:
65  // Returns if the toplogy for this part has been constructed
66  bool IsTopologyBuilt() const { return TopologyBuilt; }
67 
68  // Description:
69  // Constructs the grid for this part and returns it.
71 
72  // Description:
73  // allows the part to store dead cells
74  void EnableDeadCells(const int& deadCellsAsGhostArray);
75 
76  // Description:
77  // removes the dead cells array if it exists from the grid
79 
80  // Description:
81  // We set cells as dead to make them not show up during rendering
82  void SetCellsDeadState(unsigned char* dead, const vtkIdType& size);
83 
84  // Description:
85  // allows the part to store user cell ids
87 
88  // Description:
89  // Set the user ids for the cells of this grid
91 
92  // Description:
93  // Called to init point filling for a property
94  // is also able to set the point position of the grid too as that
95  // is stored as a point property
96  void AddPointProperty(const char* name, const vtkIdType& numComps, const bool& isIdTypeProperty,
97  const bool& isProperty, const bool& isGeometryPoints);
98 
99  // Description:
100  // Given a chunk of point property memory copy it to the correct
101  // property on the part
102  void ReadPointBasedProperty(float* data, const vtkIdType& numTuples, const vtkIdType& numComps,
103  const vtkIdType& currentGlobalPointIndex);
104 
105  void ReadPointBasedProperty(double* data, const vtkIdType& numTuples, const vtkIdType& numComps,
106  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  // Get the id of the lowest global point this part needs
122  // Note: Presumes topology has been built already
124 
125  // Description:
126  // Get the id of the largest global point this part needs
127  // Note: Presumes topology has been built already
129 
130 protected:
132  ~vtkLSDynaPart() override;
133 
135 
137  void BuildCells();
138 
139  void GetPropertyData(const char* name, const vtkIdType& numComps, const bool& isIdTypeArray,
140  const bool& isProperty, const bool& isGeometry);
141 
142  template <typename T>
143  void AddPointInformation(T* buffer, T* pointData, const vtkIdType& numTuples,
144  const vtkIdType& numComps, const vtkIdType& currentGlobalPointIndex);
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  class DensePointsUsed;
175  class SparsePointsUsed;
176  InternalPointsUsed* GlobalPointsUsed;
177 
178  // used when reading properties
179  class InternalCurrentPointInfo;
180  InternalCurrentPointInfo* CurrentPointPropInfo;
181 
182 private:
183  vtkLSDynaPart(const vtkLSDynaPart&) = delete;
184  void operator=(const vtkLSDynaPart&) = delete;
185 };
186 
187 #endif
188 #endif // VTKLSDYNAPART
LSDYNA_TYPES
LS-Dyna cell types.
a simple class to control print indentation
Definition: vtkIndent.h:34
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:44
vtkIdType NumberOfPoints
bool HasCells() const
vtkUnstructuredGrid * RemoveDeletedCells()
vtkIdType GetMaxGlobalPointId() const
void BuildToplogy()
InternalPointsUsed * GlobalPointsUsed
InternalCells * Cells
vtkIdType GetPartId() const
Definition: vtkLSDynaPart.h:45
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:66
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:39
abstract base class for most VTK objects
Definition: vtkObject.h:63
represent and manipulate 3D points
Definition: vtkPoints.h:34
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:35
dataset represents arbitrary combinations of all possible cell types
@ value
Definition: vtkX3D.h:226
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
@ size
Definition: vtkX3D.h:259
@ offset
Definition: vtkX3D.h:444
@ data
Definition: vtkX3D.h:321
int vtkIdType
Definition: vtkType.h:338