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