VTK  9.0.1
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
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:34
vtkLSDynaPart::CurrentPointPropInfo
InternalCurrentPointInfo * CurrentPointPropInfo
Definition: vtkLSDynaPart.h:179
vtkLSDynaPart::HasCells
bool HasCells() const
vtkLSDynaPart::Name
vtkStdString Name
Definition: vtkLSDynaPart.h:148
vtkStdString.h
vtkLSDynaPart::BuildUniquePoints
void BuildUniquePoints()
vtkLSDynaPart::Points
vtkPoints * Points
Definition: vtkLSDynaPart.h:165
vtkLSDynaPart::ReadPointBasedProperty
void ReadPointBasedProperty(float *data, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
vtkLSDynaPart::IsTopologyBuilt
bool IsTopologyBuilt() const
Definition: vtkLSDynaPart.h:66
vtkLSDynaPart::GenerateGrid
vtkUnstructuredGrid * GenerateGrid()
vtkLSDynaPart::InitPart
void InitPart(vtkStdString name, const vtkIdType &partId, const vtkIdType &userMaterialId, const vtkIdType &numGlobalPoints, const int &sizeOfWord)
vtkLSDynaPart::NumberOfPoints
vtkIdType NumberOfPoints
Definition: vtkLSDynaPart.h:153
vtkLSDynaPart::GlobalPointsUsed
InternalPointsUsed * GlobalPointsUsed
Definition: vtkLSDynaPart.h:175
vtkLSDynaPart::NumberOfGlobalPoints
vtkIdType NumberOfGlobalPoints
Definition: vtkLSDynaPart.h:154
vtkX3D::value
@ value
Definition: vtkX3D.h:226
vtkX3D::type
@ type
Definition: vtkX3D.h:522
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkLSDynaPart::AddCellProperty
void AddCellProperty(const char *name, const int &offset, const int &numComps)
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkLSDynaPart::DisableDeadCells
void DisableDeadCells()
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:54
vtkLSDynaPart::vtkLSDynaPart
vtkLSDynaPart()
vtkLSDynaPart::SetPartType
void SetPartType(int type)
detail::Type
Type
Definition: TestQtCommon.h:22
vtkLSDynaPart::GetPropertyData
void GetPropertyData(const char *name, const vtkIdType &numComps, const bool &isIdTypeArray, const bool &isProperty, const bool &isGeometry)
vtkLSDynaPart::GetUserMaterialId
vtkIdType GetUserMaterialId() const
Definition: vtkLSDynaPart.h:44
vtkLSDynaPart::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLSDynaPart::RemoveDeletedCells
vtkUnstructuredGrid * RemoveDeletedCells()
vtkLSDynaPart::New
static vtkLSDynaPart * New()
vtkLSDynaPart::BuildToplogy
void BuildToplogy()
vtkLSDynaPart::CellProperties
InternalCellProperties * CellProperties
Definition: vtkLSDynaPart.h:170
vtkLSDynaPart::DoubleBased
bool DoubleBased
Definition: vtkLSDynaPart.h:160
vtkLSDynaPart::GetPartId
vtkIdType GetPartId() const
Definition: vtkLSDynaPart.h:45
vtkLSDynaPart::PartType
LSDynaMetaData::LSDYNA_TYPES PartType() const
Definition: vtkLSDynaPart.h:39
vtkX3D::offset
@ offset
Definition: vtkX3D.h:444
vtkLSDynaPart::TopologyBuilt
bool TopologyBuilt
Definition: vtkLSDynaPart.h:159
vtkLSDynaPart::AddPointInformation
void AddPointInformation(T *buffer, T *pointData, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
vtkLSDynaPart::PartId
vtkIdType PartId
Definition: vtkLSDynaPart.h:150
vtkLSDynaPart::GetMinGlobalPointId
vtkIdType GetMinGlobalPointId() const
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkLSDynaPart::HasDeadCells
bool HasDeadCells
Definition: vtkLSDynaPart.h:157
vtkLSDynaPart::EnableCellUserIds
void EnableCellUserIds()
vtkLSDynaPart::GetMaxGlobalPointId
vtkIdType GetMaxGlobalPointId() const
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkLSDynaPart::ReadPointBasedProperty
void ReadPointBasedProperty(double *data, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
vtkLSDynaPart::BuildCells
void BuildCells()
vtkLSDynaPart::Type
LSDynaMetaData::LSDYNA_TYPES Type
Definition: vtkLSDynaPart.h:147
vtkLSDynaPart::Cells
InternalCells * Cells
Definition: vtkLSDynaPart.h:167
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkLSDynaPart::AllocateCellMemory
void AllocateCellMemory(const vtkIdType &numCells, const vtkIdType &cellLen)
vtkObject.h
vtkLSDynaPart::AddCell
void AddCell(const int &cellType, const vtkIdType &npts, vtkIdType conn[8])
vtkLSDynaPart::SetCellsDeadState
void SetCellsDeadState(unsigned char *dead, const vtkIdType &size)
LSDynaMetaData.h
vtkLSDynaPart::~vtkLSDynaPart
~vtkLSDynaPart() override
vtkLSDynaPart::hasValidType
bool hasValidType() const
vtkLSDynaPart::DeadCellsAsGhostArray
bool DeadCellsAsGhostArray
Definition: vtkLSDynaPart.h:156
vtkLSDynaPart::NumberOfCells
vtkIdType NumberOfCells
Definition: vtkLSDynaPart.h:152
LSDynaMetaData::LSDYNA_TYPES
LSDYNA_TYPES
LS-Dyna cell types.
Definition: LSDynaMetaData.h:58
vtkLSDynaPart::AddPointProperty
void AddPointProperty(const char *name, const vtkIdType &numComps, const bool &isIdTypeProperty, const bool &isProperty, const bool &isGeometryPoints)
vtkLSDynaPart
Definition: vtkLSDynaPart.h:28
vtkLSDynaPart::SetNextCellUserIds
void SetNextCellUserIds(const vtkIdType &value)
vtkLSDynaPart::ReadCellProperties
void ReadCellProperties(float *cellProperties, const vtkIdType &numCells, const vtkIdType &numPropertiesInCell)
vtkLSDynaPart::Grid
vtkUnstructuredGrid * Grid
Definition: vtkLSDynaPart.h:162
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:93
vtkLSDynaPart::UserMaterialId
vtkIdType UserMaterialId
Definition: vtkLSDynaPart.h:149
vtkLSDynaPart::ThresholdGrid
vtkUnstructuredGrid * ThresholdGrid
Definition: vtkLSDynaPart.h:163
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:35
vtkLSDynaPart::ReadCellProperties
void ReadCellProperties(double *cellsProperties, const vtkIdType &numCells, const vtkIdType &numPropertiesInCell)
vtkLSDynaPart::EnableDeadCells
void EnableDeadCells(const int &deadCellsAsGhostArray)