VTK  9.4.20250311
vtkLSDynaPartCollection.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef vtkLSDynaPartCollection_h
5#define vtkLSDynaPartCollection_h
6
7#include "LSDynaMetaData.h" //needed for LSDynaMetaData::LSDYNA_TYPES enum
8#include "vtkIOLSDynaModule.h" // For export macro
9#include "vtkObject.h"
10
11VTK_ABI_NAMESPACE_BEGIN
12class vtkDataArray;
14class vtkPoints;
16class vtkLSDynaPart;
17
18class VTKIOLSDYNA_EXPORT vtkLSDynaPartCollection : public vtkObject
19{
20public:
21 class LSDynaPart;
23
25 void PrintSelf(ostream& os, vtkIndent indent) override;
26
27 // Description:
28 // Pass in the metadata to setup this collection.
29 // The optional min and max cell Id are used when in parallel to load balance the nodes.
30 // Meaning the collection will only store subsections of parts that fall within
31 // the range of the min and max
32 // Note: min is included, and max is excluded from the valid range of cells.
34 LSDynaMetaData* metaData, vtkIdType* mins = nullptr, vtkIdType* maxs = nullptr);
35
36 // Description:
37 // For a given part type returns the number of cells to read and the number
38 // of cells to skip first to not read
39 void GetPartReadInfo(const int& partType, vtkIdType& numberOfCells, vtkIdType& numCellsToSkip,
40 vtkIdType& numCellsToSkipEnd) const;
41
42 // Description:
43 // Finalizes the cell topology by mapping the cells point indexes
44 // to a relative number based on the cells this collection is storing
46
47 // Description: Register a cell of a given type and material index to the
48 // correct part
49 // NOTE: the cellIndex is relative to the collection. So in parallel
50 // the cellIndex will be from 0 to MaxId-MinId
51 void RegisterCellIndexToPart(const int& partType, const vtkIdType& matIdx,
52 const vtkIdType& cellIndex, const vtkIdType& npts);
53
55
57
58 // Description: Insert a cell of a given type and material index to the
59 // collection.
60 // NOTE: the cellIndex is relative to the collection. So in parallel
61 // the cellIndex will be from 0 to MaxId-MinId
62 void InsertCell(const int& partType, const vtkIdType& matIdx, const int& cellType,
63 const vtkIdType& npts, vtkIdType conn[8]);
64
65 // Description:
66 // Set for each part type what cells are deleted/dead
68 const int& partType, vtkUnsignedCharArray* death, const int& deadCellsAsGhostArray);
69
70 bool IsActivePart(const int& id) const;
71
72 // Description:
73 // Given a part will return the unstructured grid for the part.
74 // Note: You must call finalize before using this method
75 vtkUnstructuredGrid* GetGridForPart(const int& index) const;
76
77 int GetNumberOfParts() const;
78
80
81 // Description:
82 void ReadPointUserIds(const vtkIdType& numTuples, const char* name);
83
84 // Description:
85 void ReadPointProperty(const vtkIdType& numTuples, const vtkIdType& numComps, const char* name,
86 const bool& isProperty = true, const bool& isGeometryPoints = false,
87 const bool& isRoadPoints = false);
88
89 // Description:
90 // Adds a property for all parts of a certain type
91 void AddProperty(const LSDynaMetaData::LSDYNA_TYPES& type, const char* name, const int& offset,
92 const int& numComps);
93 void FillCellProperties(float* buffer, const LSDynaMetaData::LSDYNA_TYPES& type,
94 const vtkIdType& startId, const vtkIdType& numCells, const int& numPropertiesInCell);
95 void FillCellProperties(double* buffer, const LSDynaMetaData::LSDYNA_TYPES& type,
96 const vtkIdType& startId, const vtkIdType& numCells, const int& numPropertiesInCell);
97
98 // Description:
99 // Adds User Ids for all parts of a certain type
100 void ReadCellUserIds(const LSDynaMetaData::LSDYNA_TYPES& type, const int& status);
101
102 template <typename T>
103 void FillCellUserId(T* buffer, const LSDynaMetaData::LSDYNA_TYPES& type, const vtkIdType& startId,
104 const vtkIdType& numCells)
105 {
106 this->FillCellUserIdArray(buffer, type, startId, numCells);
107 }
108
109protected:
112
115
116 // Builds up the basic meta information needed for topology storage
118
119 // Description:
120 // Breaks down the buffer of cell properties to the cell properties we
121 // are interested in. This will remove all properties that aren't active or
122 // for parts we are not loading
123 template <typename T>
124 void FillCellArray(T* buffer, const LSDynaMetaData::LSDYNA_TYPES& type, const vtkIdType& startId,
125 vtkIdType numCells, const int& numTuples);
126
127 template <typename T>
129 const vtkIdType& startId, vtkIdType numCells);
130
131 // Description:
132 // Methods for adding points to the collection
133 void SetupPointPropertyForReading(const vtkIdType& numTuples, const vtkIdType& numComps,
134 const char* name, const bool& isIdType, const bool& isProperty, const bool& isGeometryPoints,
135 const bool& isRoadPoints);
136 template <typename T>
137 void FillPointProperty(const vtkIdType& numTuples, const vtkIdType& numComps,
138 vtkLSDynaPart** parts, vtkIdType numParts);
139
140private:
142 void operator=(const vtkLSDynaPartCollection&) = delete;
143
144 LSDynaMetaData* MetaData;
145
146 class LSDynaPartStorage;
147 LSDynaPartStorage* Storage;
148};
149
150VTK_ABI_NAMESPACE_END
151#endif // vtkLSDynaPartCollection_h
LSDYNA_TYPES
LS-Dyna cell types.
abstract superclass for arrays of numeric data
a simple class to control print indentation
Definition vtkIndent.h:108
void FillCellProperties(float *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, const vtkIdType &numCells, const int &numPropertiesInCell)
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 FillPointProperty(const vtkIdType &numTuples, const vtkIdType &numComps, vtkLSDynaPart **parts, vtkIdType numParts)
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:162
represent and manipulate 3D points
Definition vtkPoints.h:139
dynamic, self-adjusting array of unsigned char
dataset represents arbitrary combinations of all possible cell types
int vtkIdType
Definition vtkType.h:332