VTK: IO/LSDyna/vtkLSDynaPartCollection.h Source File

| VTK 9.3.1

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
11 VTK_ABI_NAMESPACE_BEGIN
12 class vtkDataArray;
13 class vtkUnstructuredGrid;
14 class vtkPoints;
15 class vtkUnsignedCharArray;
16 class vtkLSDynaPart;
17
18 class VTKIOLSDYNA_EXPORT vtkLSDynaPartCollection : public vtkObject
19 {
20 public:
21 class LSDynaPart;
22 static vtkLSDynaPartCollection* New();
23
24 vtkTypeMacro(vtkLSDynaPartCollection, vtkObject);
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.
33 void InitCollection(
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
45 void FinalizeTopology();
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
54 void InitCellInsertion();
55
56 void AllocateParts();
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
67 void SetCellDeadFlags(
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
79 void DisbleDeadCells();
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
109 protected:
110 vtkLSDynaPartCollection();
111 ~vtkLSDynaPartCollection() override;
112
113 vtkIdType* MinIds;
114 vtkIdType* MaxIds;
115
116 // Builds up the basic meta information needed for topology storage
117 void BuildPartInfo();
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>
128 void FillCellUserIdArray(T* buffer, const LSDynaMetaData::LSDYNA_TYPES& type,
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
140 private:
141 vtkLSDynaPartCollection(const vtkLSDynaPartCollection&) = delete;
142 void operator=(const vtkLSDynaPartCollection&) = delete;
143
144 LSDynaMetaData* MetaData;
145
146 class LSDynaPartStorage;
147 LSDynaPartStorage* Storage;
148 };
149
150 VTK_ABI_NAMESPACE_END
151 #endif // vtkLSDynaPartCollection_h
LSDynaMetaData.h
LSDynaMetaData
Definition: LSDynaMetaData.h:24
LSDynaMetaData::LSDYNA_TYPES
LSDYNA_TYPES
LS-Dyna cell types.
Definition: LSDynaMetaData.h:44
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkLSDynaPartCollection
Definition: vtkLSDynaPartCollection.h:19
vtkLSDynaPartCollection::FillCellProperties
void FillCellProperties(float *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, const vtkIdType &numCells, const int &numPropertiesInCell)
vtkLSDynaPartCollection::GetGridForPart
vtkUnstructuredGrid * GetGridForPart(const int &index) const
vtkLSDynaPartCollection::GetNumberOfParts
int GetNumberOfParts() const
vtkLSDynaPartCollection::InitCollection
void InitCollection(LSDynaMetaData *metaData, vtkIdType *mins=nullptr, vtkIdType *maxs=nullptr)
vtkLSDynaPartCollection::SetCellDeadFlags
void SetCellDeadFlags(const int &partType, vtkUnsignedCharArray *death, const int &deadCellsAsGhostArray)
vtkLSDynaPartCollection::~vtkLSDynaPartCollection
~vtkLSDynaPartCollection() override
vtkLSDynaPartCollection::FillCellUserIdArray
void FillCellUserIdArray(T *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, vtkIdType numCells)
vtkLSDynaPartCollection::InsertCell
void InsertCell(const int &partType, const vtkIdType &matIdx, const int &cellType, const vtkIdType &npts, vtkIdType conn[8])
vtkLSDynaPartCollection::BuildPartInfo
void BuildPartInfo()
vtkLSDynaPartCollection::MaxIds
vtkIdType * MaxIds
Definition: vtkLSDynaPartCollection.h:114
vtkLSDynaPartCollection::InitCellInsertion
void InitCellInsertion()
vtkLSDynaPartCollection::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLSDynaPartCollection::RegisterCellIndexToPart
void RegisterCellIndexToPart(const int &partType, const vtkIdType &matIdx, const vtkIdType &cellIndex, const vtkIdType &npts)
vtkLSDynaPartCollection::IsActivePart
bool IsActivePart(const int &id) const
vtkLSDynaPartCollection::vtkLSDynaPartCollection
vtkLSDynaPartCollection()
vtkLSDynaPartCollection::FinalizeTopology
void FinalizeTopology()
vtkLSDynaPartCollection::FillCellProperties
void FillCellProperties(double *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, const vtkIdType &numCells, const int &numPropertiesInCell)
vtkLSDynaPartCollection::SetupPointPropertyForReading
void SetupPointPropertyForReading(const vtkIdType &numTuples, const vtkIdType &numComps, const char *name, const bool &isIdType, const bool &isProperty, const bool &isGeometryPoints, const bool &isRoadPoints)
vtkLSDynaPartCollection::MinIds
vtkIdType * MinIds
Definition: vtkLSDynaPartCollection.h:113
vtkLSDynaPartCollection::FillCellArray
void FillCellArray(T *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, vtkIdType numCells, const int &numTuples)
vtkLSDynaPartCollection::DisbleDeadCells
void DisbleDeadCells()
vtkLSDynaPartCollection::GetPartReadInfo
void GetPartReadInfo(const int &partType, vtkIdType &numberOfCells, vtkIdType &numCellsToSkip, vtkIdType &numCellsToSkipEnd) const
vtkLSDynaPartCollection::ReadPointProperty
void ReadPointProperty(const vtkIdType &numTuples, const vtkIdType &numComps, const char *name, const bool &isProperty=true, const bool &isGeometryPoints=false, const bool &isRoadPoints=false)
vtkLSDynaPartCollection::ReadPointUserIds
void ReadPointUserIds(const vtkIdType &numTuples, const char *name)
vtkLSDynaPartCollection::FillCellUserId
void FillCellUserId(T *buffer, const LSDynaMetaData::LSDYNA_TYPES &type, const vtkIdType &startId, const vtkIdType &numCells)
Definition: vtkLSDynaPartCollection.h:103
vtkLSDynaPartCollection::AllocateParts
void AllocateParts()
vtkLSDynaPartCollection::ReadCellUserIds
void ReadCellUserIds(const LSDynaMetaData::LSDYNA_TYPES &type, const int &status)
vtkLSDynaPartCollection::New
static vtkLSDynaPartCollection * New()
vtkLSDynaPartCollection::FillPointProperty
void FillPointProperty(const vtkIdType &numTuples, const vtkIdType &numComps, vtkLSDynaPart **parts, vtkIdType numParts)
vtkLSDynaPartCollection::AddProperty
void AddProperty(const LSDynaMetaData::LSDYNA_TYPES &type, const char *name, const int &offset, const int &numComps)
vtkLSDynaPart
Definition: vtkLSDynaPart.h:17
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:40
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:99
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkX3D::offset
@ offset
Definition: vtkX3D.h:438
vtkObject.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315