VTK
vtkLSDynaPartCollection.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkLSDynaPartCollection.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 vtkLSDynaPartCollection_h
16#define vtkLSDynaPartCollection_h
17
18#include "vtkIOLSDynaModule.h" // For export macro
19#include "LSDynaMetaData.h" //needed for LSDynaMetaData::LSDYNA_TYPES enum
20#include "vtkObject.h"
21
22class vtkDataArray;
24class vtkPoints;
26class vtkLSDynaPart;
27
28class VTKIOLSDYNA_EXPORT vtkLSDynaPartCollection: public vtkObject
29{
30public:
31 class LSDynaPart;
33
35 virtual void PrintSelf(ostream &os, vtkIndent indent);
36
37 //Description:
38 //Pass in the metadata to setup this collection.
39 //The optional min and max cell Id are used when in parallel to load balance the nodes.
40 //Meaning the collection will only store subsections of parts that fall within
41 //the range of the min and max
42 //Note: min is included, and max is excluded from the valid range of cells.
44 vtkIdType* mins=NULL, vtkIdType* maxs=NULL);
45
46
47 //Description:
48 //For a given part type returns the number of cells to read and the number
49 //of cells to skip first to not read
50 void GetPartReadInfo(const int& partType, vtkIdType& numberOfCells,
51 vtkIdType& numCellsToSkip,vtkIdType& numCellsToSkipEnd) const;
52
53 //Description:
54 //Finalizes the cell topology by mapping the cells point indexes
55 //to a relative number based on the cells this collection is storing
57
58
59 //Description: Register a cell of a given type and material index to the
60 //correct part
61 //NOTE: the cellIndex is relative to the collection. So in parallel
62 //the cellIndex will be from 0 to MaxId-MinId
63 void RegisterCellIndexToPart(const int& partType,const vtkIdType& matIdx,
64 const vtkIdType& cellIndex,const vtkIdType& npts);
65
67
69
70 //Description: Insert a cell of a given type and material index to the
71 //collection.
72 //NOTE: the cellIndex is relative to the collection. So in parallel
73 //the cellIndex will be from 0 to MaxId-MinId
74 void InsertCell(const int& partType,const vtkIdType& matIdx,
75 const int& cellType,const vtkIdType& npts, vtkIdType conn[8]);
76
77 //Description:
78 //Set for each part type what cells are deleted/dead
79 void SetCellDeadFlags(const int& partType, vtkUnsignedCharArray *death,
80 const int& deadCellsAsGhostArray);
81
82 bool IsActivePart(const int& id) const;
83
84 //Description:
85 //Given a part will return the unstructured grid for the part.
86 //Note: You must call finalize before using this method
88
89 int GetNumberOfParts() const;
90
92
93 //Description:
94 void ReadPointUserIds(const vtkIdType& numTuples,const char* name);
95
96 //Description:
98 const vtkIdType& numTuples,
99 const vtkIdType& numComps,
100 const char* name,
101 const bool &isProperty=true,
102 const bool& isGeometryPoints=false,
103 const bool& isRoadPoints=false);
104
105
106
107 //Description:
108 //Adds a property for all parts of a certain type
110 const int& offset, const int& numComps);
112 const vtkIdType& startId, const vtkIdType& numCells,
113 const int& numPropertiesInCell);
115 const vtkIdType& startId, const vtkIdType& numCells,
116 const int& numPropertiesInCell);
117
118 //Description:
119 //Adds User Ids for all parts of a certain type
121 const LSDynaMetaData::LSDYNA_TYPES& type, const int& status);
122
123 template<typename T>
125 const vtkIdType& startId, const vtkIdType& numCells)
126 {
127 this->FillCellUserIdArray(buffer,type,startId,numCells);
128 }
129
130protected:
133
136
137 //Builds up the basic meta information needed for topology storage
139
140 //Description:
141 //Breaks down the buffer of cell properties to the cell properties we
142 //are interested in. This will remove all properties that aren't active or
143 //for parts we are not loading
144 template<typename T>
146 const vtkIdType& startId, vtkIdType numCells, const int& numTuples);
147
148 template<typename T>
150 const vtkIdType& startId, vtkIdType numCells);
151
152 //Description:
153 //Methods for adding points to the collection
155 const vtkIdType& numTuples,
156 const vtkIdType& numComps,
157 const char* name,
158 const bool& isIdType,
159 const bool& isProperty,
160 const bool& isGeometryPoints,
161 const bool& isRoadPoints);
162 template<typename T>
163 void FillPointProperty(const vtkIdType& numTuples,
164 const vtkIdType& numComps,
165 vtkLSDynaPart** parts, const vtkIdType numParts);
166
167private:
168 vtkLSDynaPartCollection( const vtkLSDynaPartCollection& ) VTK_DELETE_FUNCTION;
169 void operator = ( const vtkLSDynaPartCollection& ) VTK_DELETE_FUNCTION;
170
171 LSDynaMetaData *MetaData;
172
173 class LSDynaPartStorage;
174 LSDynaPartStorage* Storage;
175};
176
177
178
179#endif // LSDYNAPARTS_H
LSDYNA_TYPES
LS-Dyna cell types.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
a simple class to control print indentation
Definition: vtkIndent.h:40
void FillCellProperties(float *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, const vtkIdType &numCells, const int &numPropertiesInCell)
void FillPointProperty(const vtkIdType &numTuples, const vtkIdType &numComps, vtkLSDynaPart **parts, const vtkIdType numParts)
vtkUnstructuredGrid * GetGridForPart(const int &index) const
static vtkLSDynaPartCollection * New()
int GetNumberOfParts() const
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetCellDeadFlags(const int &partType, vtkUnsignedCharArray *death, const int &deadCellsAsGhostArray)
void InitCollection(LSDynaMetaData *metaData, vtkIdType *mins=NULL, vtkIdType *maxs=NULL)
void FillCellUserIdArray(T *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, vtkIdType numCells)
void InsertCell(const int &partType, const vtkIdType &matIdx, const int &cellType, const vtkIdType &npts, vtkIdType conn[8])
void RegisterCellIndexToPart(const int &partType, const vtkIdType &matIdx, const vtkIdType &cellIndex, const vtkIdType &npts)
bool IsActivePart(const int &id) const
void FillCellProperties(double *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, const vtkIdType &numCells, const int &numPropertiesInCell)
void SetupPointPropertyForReading(const vtkIdType &numTuples, const vtkIdType &numComps, const char *name, const bool &isIdType, const bool &isProperty, const bool &isGeometryPoints, const bool &isRoadPoints)
void FillCellArray(T *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, vtkIdType numCells, const int &numTuples)
void GetPartReadInfo(const int &partType, vtkIdType &numberOfCells, vtkIdType &numCellsToSkip, vtkIdType &numCellsToSkipEnd) const
void ReadPointProperty(const vtkIdType &numTuples, const vtkIdType &numComps, const char *name, const bool &isProperty=true, const bool &isGeometryPoints=false, const bool &isRoadPoints=false)
void ReadPointUserIds(const vtkIdType &numTuples, const char *name)
void FillCellUserId(T *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, const vtkIdType &numCells)
void ReadCellUserIds(const LSDynaMetaData::LSDYNA_TYPES &type, const int &status)
void AddProperty(const LSDynaMetaData::LSDYNA_TYPES &type, const char *name, const int &offset, const int &numComps)
abstract base class for most VTK objects
Definition: vtkObject.h:60
represent and manipulate 3D points
Definition: vtkPoints.h:40
dynamic, self-adjusting array of unsigned char
dataset represents arbitrary combinations of all possible cell types
CellTypeInDataSet cellType(vtkDataSet *input)
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ offset
Definition: vtkX3D.h:438
int vtkIdType
Definition: vtkType.h:287