VTK
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
18#include "vtkIOLSDynaModule.h" // For export macro
19#include "vtkObject.h"
20#include "LSDynaMetaData.h" //needed for lsdyna types
21#include "vtkStdString.h" //needed for string
22
24class vtkPoints;
25
26class VTKIOLSDYNA_EXPORT vtkLSDynaPart: public vtkObject
27{
28public:
29 static vtkLSDynaPart *New();
30
31 vtkTypeMacro(vtkLSDynaPart,vtkObject);
32 virtual void PrintSelf(ostream &os, vtkIndent indent);
33
34 //Description: Set the type of the part
35 void SetPartType(int type);
36
37 //Description: Returns the type of the part
38 LSDynaMetaData::LSDYNA_TYPES PartType() const { return Type; }
39
40 //Description: Returns if the type of the part is considered valid
41 bool hasValidType() const;
42
43 vtkIdType GetUserMaterialId() const { return UserMaterialId; }
44 vtkIdType GetPartId() const { return PartId; }
45 bool HasCells() const;
46
47 //Setup the part with some basic information about what it holds
49 const vtkIdType& partId,
50 const vtkIdType& userMaterialId,
51 const vtkIdType& numGlobalPoints,
52 const int& sizeOfWord);
53
54 //Reserves the needed space in memory for this part
55 //that way we never over allocate memory
56 void AllocateCellMemory(const vtkIdType& numCells, const vtkIdType& cellLen);
57
58 //Add a cell to the part
59 void AddCell(const int& cellType, const vtkIdType& npts, vtkIdType conn[8]);
60
61 //Description:
62 //Setups the part cell topology so that we can cache information
63 //between timesteps.
65
66 //Description:
67 //Returns if the toplogy for this part has been constructed
68 bool IsTopologyBuilt() const { return TopologyBuilt; }
69
70 //Description:
71 //Constructs the grid for this part and returns it.
73
74 //Description:
75 //allows the part to store dead cells
76 void EnableDeadCells(const int& deadCellsAsGhostArray);
77
78 //Description:
79 //removes the dead cells array if it exists from the grid
81
82 //Description:
83 //We set cells as dead to make them not show up during rendering
84 void SetCellsDeadState(unsigned char *dead, const vtkIdType &size);
85
86 //Description:
87 //allows the part to store user cell ids
89
90 //Description:
91 //Set the user ids for the cells of this grid
93
94
95 //Description:
96 //Called to init point filling for a property
97 //is also able to set the point position of the grid too as that
98 //is stored as a point property
99 void AddPointProperty(const char* name, const vtkIdType& numComps,
100 const bool& isIdTypeProperty, const bool &isProperty,
101 const bool& isGeometryPoints);
102
103 //Description:
104 //Given a chunk of point property memory copy it to the correct
105 //property on the part
107 const vtkIdType& numTuples,
108 const vtkIdType& numComps,
109 const vtkIdType& currentGlobalPointIndex);
110
112 const vtkIdType& numTuples,
113 const vtkIdType& numComps,
114 const vtkIdType& currentGlobalPointIndex);
115
116 //Description:
117 //Adds a property to the part
118 void AddCellProperty(const char* name, const int& offset, const int& numComps);
119
120 //Description:
121 //Given the raw data converts it to be the properties for this part
122 //The cell properties are woven together as a block for each cell
123 void ReadCellProperties(float *cellProperties, const vtkIdType& numCells,
124 const vtkIdType &numPropertiesInCell);
125 void ReadCellProperties(double *cellsProperties, const vtkIdType& numCells,
126 const vtkIdType &numPropertiesInCell);
127
128 //Description:
129 //Get the id of the lowest global point this part needs
130 //Note: Presumes topology has been built already
132
133 //Description:
134 //Get the id of the largest global point this part needs
135 //Note: Presumes topology has been built already
137
138protected:
141
143
146
147 void GetPropertyData(const char* name, const vtkIdType &numComps,
148 const bool &isIdTypeArray, const bool& isProperty, const bool& isGeometry);
149
150 template<typename T>
151 void AddPointInformation(T *buffer,T *pointData,
152 const vtkIdType& numTuples,
153 const vtkIdType& numComps,
154 const vtkIdType& currentGlobalPointIndex);
155
156 //basic info about the part
161
165
168
171
174
176
177 class InternalCells;
178 InternalCells *Cells;
179
180 class InternalCellProperties;
181 InternalCellProperties *CellProperties;
182
183 class InternalPointsUsed;
184 class DensePointsUsed;
185 class SparsePointsUsed;
186 InternalPointsUsed *GlobalPointsUsed;
187
188 //used when reading properties
189 class InternalCurrentPointInfo;
190 InternalCurrentPointInfo *CurrentPointPropInfo;
191
192private:
193 vtkLSDynaPart( const vtkLSDynaPart& ) VTK_DELETE_FUNCTION;
194 void operator = ( const vtkLSDynaPart& ) VTK_DELETE_FUNCTION;
195};
196
197#endif // VTKLSDYNAPART
LSDYNA_TYPES
LS-Dyna cell types.
a simple class to control print indentation
Definition: vtkIndent.h:40
void SetNextCellUserIds(const vtkIdType &value)
InternalCellProperties * CellProperties
void ReadPointBasedProperty(float *data, const vtkIdType &numTuples, const vtkIdType &numComps, const vtkIdType &currentGlobalPointIndex)
void AddCellProperty(const char *name, const int &offset, const int &numComps)
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
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
Definition: vtkLSDynaPart.h:43
vtkIdType NumberOfPoints
bool HasCells() const
vtkIdType GetMaxGlobalPointId() const
void BuildToplogy()
InternalPointsUsed * GlobalPointsUsed
InternalCells * Cells
vtkIdType GetPartId() const
Definition: vtkLSDynaPart.h:44
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:68
void SetCellsDeadState(unsigned char *dead, const vtkIdType &size)
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
Definition: vtkLSDynaPart.h:38
abstract base class for most VTK objects
Definition: vtkObject.h:60
represent and manipulate 3D points
Definition: vtkPoints.h:40
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
dataset represents arbitrary combinations of all possible cell types
CellTypeInDataSet cellType(vtkDataSet *input)
@ 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:287