VTK  9.2.6
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 "LSDynaMetaData.h" //needed for LSDynaMetaData::LSDYNA_TYPES enum
19#include "vtkIOLSDynaModule.h" // For export macro
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 void PrintSelf(ostream& os, vtkIndent indent) override;
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 LSDynaMetaData* metaData, vtkIdType* mins = nullptr, vtkIdType* maxs = nullptr);
45
46 // Description:
47 // For a given part type returns the number of cells to read and the number
48 // of cells to skip first to not read
49 void GetPartReadInfo(const int& partType, vtkIdType& numberOfCells, vtkIdType& numCellsToSkip,
50 vtkIdType& numCellsToSkipEnd) const;
51
52 // Description:
53 // Finalizes the cell topology by mapping the cells point indexes
54 // to a relative number based on the cells this collection is storing
56
57 // Description: Register a cell of a given type and material index to the
58 // correct part
59 // NOTE: the cellIndex is relative to the collection. So in parallel
60 // the cellIndex will be from 0 to MaxId-MinId
61 void RegisterCellIndexToPart(const int& partType, const vtkIdType& matIdx,
62 const vtkIdType& cellIndex, const vtkIdType& npts);
63
65
67
68 // Description: Insert a cell of a given type and material index to the
69 // collection.
70 // NOTE: the cellIndex is relative to the collection. So in parallel
71 // the cellIndex will be from 0 to MaxId-MinId
72 void InsertCell(const int& partType, const vtkIdType& matIdx, const int& cellType,
73 const vtkIdType& npts, vtkIdType conn[8]);
74
75 // Description:
76 // Set for each part type what cells are deleted/dead
78 const int& partType, vtkUnsignedCharArray* death, const int& deadCellsAsGhostArray);
79
80 bool IsActivePart(const int& id) const;
81
82 // Description:
83 // Given a part will return the unstructured grid for the part.
84 // Note: You must call finalize before using this method
85 vtkUnstructuredGrid* GetGridForPart(const int& index) const;
86
87 int GetNumberOfParts() const;
88
90
91 // Description:
92 void ReadPointUserIds(const vtkIdType& numTuples, const char* name);
93
94 // Description:
95 void ReadPointProperty(const vtkIdType& numTuples, const vtkIdType& numComps, const char* name,
96 const bool& isProperty = true, const bool& isGeometryPoints = false,
97 const bool& isRoadPoints = false);
98
99 // Description:
100 // Adds a property for all parts of a certain type
101 void AddProperty(const LSDynaMetaData::LSDYNA_TYPES& type, const char* name, const int& offset,
102 const int& numComps);
103 void FillCellProperties(float* buffer, const LSDynaMetaData::LSDYNA_TYPES& type,
104 const vtkIdType& startId, const vtkIdType& numCells, const int& numPropertiesInCell);
105 void FillCellProperties(double* buffer, const LSDynaMetaData::LSDYNA_TYPES& type,
106 const vtkIdType& startId, const vtkIdType& numCells, const int& numPropertiesInCell);
107
108 // Description:
109 // Adds User Ids for all parts of a certain type
110 void ReadCellUserIds(const LSDynaMetaData::LSDYNA_TYPES& type, const int& status);
111
112 template <typename T>
113 void FillCellUserId(T* buffer, const LSDynaMetaData::LSDYNA_TYPES& type, const vtkIdType& startId,
114 const vtkIdType& numCells)
115 {
116 this->FillCellUserIdArray(buffer, type, startId, numCells);
117 }
118
119protected:
122
125
126 // Builds up the basic meta information needed for topology storage
128
129 // Description:
130 // Breaks down the buffer of cell properties to the cell properties we
131 // are interested in. This will remove all properties that aren't active or
132 // for parts we are not loading
133 template <typename T>
134 void FillCellArray(T* buffer, const LSDynaMetaData::LSDYNA_TYPES& type, const vtkIdType& startId,
135 vtkIdType numCells, const int& numTuples);
136
137 template <typename T>
139 const vtkIdType& startId, vtkIdType numCells);
140
141 // Description:
142 // Methods for adding points to the collection
143 void SetupPointPropertyForReading(const vtkIdType& numTuples, const vtkIdType& numComps,
144 const char* name, const bool& isIdType, const bool& isProperty, const bool& isGeometryPoints,
145 const bool& isRoadPoints);
146 template <typename T>
147 void FillPointProperty(const vtkIdType& numTuples, const vtkIdType& numComps,
148 vtkLSDynaPart** parts, const vtkIdType numParts);
149
150private:
152 void operator=(const vtkLSDynaPartCollection&) = delete;
153
154 LSDynaMetaData* MetaData;
155
156 class LSDynaPartStorage;
157 LSDynaPartStorage* Storage;
158};
159
160#endif // vtkLSDynaPartCollection_h
LSDYNA_TYPES
LS-Dyna cell types.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:56
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
void InitCollection(LSDynaMetaData *metaData, vtkIdType *mins=nullptr, vtkIdType *maxs=nullptr)
void SetCellDeadFlags(const int &partType, vtkUnsignedCharArray *death, const int &deadCellsAsGhostArray)
~vtkLSDynaPartCollection() override
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 PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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:63
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
int vtkIdType
Definition: vtkType.h:332