forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LSDynaMetaData.cxx
129 lines (109 loc) · 3.94 KB
/
LSDynaMetaData.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*=========================================================================
Program: Visualization Toolkit
Module: LSDynaMetaData.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "LSDynaMetaData.h"
//------------------------------------------------------------------------------
LSDynaMetaData::LSDynaMetaData()
{
this->FileIsValid = 0;
this->Dimensionality = 0;
this->NumberOfNodes = 0;
this->FileSizeFactor = 7;
this->MaxFileLength = this->FileSizeFactor * 512 * 512 * 8;
this->Title[0] = '\0';
this->ReleaseNumber[0] = '\0';
this->CodeVersion = 0.0;
this->PreStateSize = 0;
this->StateSize = 0;
this->CurrentState = 0;
this->ElementDeletionOffset = 0;
this->SPHStateOffset = 0;
std::vector<std::string> blankNames;
std::vector<int> blankNumbers;
for (int cellType = 0; cellType < LSDynaMetaData::NUM_CELL_TYPES; ++cellType)
{
this->NumberOfCells[cellType] = 0;
this->CellArrayNames[cellType] = blankNames;
this->CellArrayComponents[cellType] = blankNumbers;
this->CellArrayStatus[cellType] = blankNumbers;
}
}
//------------------------------------------------------------------------------
bool LSDynaMetaData::AddPointArray(const std::string& name, int numComponents, int status)
{
for (unsigned i = 0; i < this->PointArrayNames.size(); ++i)
{
if (this->PointArrayNames[i] == name)
{
return false;
}
}
this->PointArrayNames.push_back(name);
this->PointArrayComponents.push_back(numComponents);
this->PointArrayStatus.push_back(status);
return true;
}
//------------------------------------------------------------------------------
bool LSDynaMetaData::AddCellArray(
int cellType, const std::string& name, int numComponents, int status)
{
for (unsigned i = 0; i < this->CellArrayNames[cellType].size(); ++i)
{
if (this->CellArrayNames[cellType][i] == name)
{
return false;
}
}
this->CellArrayNames[cellType].push_back(name);
this->CellArrayComponents[cellType].push_back(numComponents);
this->CellArrayStatus[cellType].push_back(status);
return true;
}
//------------------------------------------------------------------------------
vtkIdType LSDynaMetaData::GetTotalMaterialCount()
{
return this->Dict["NUMMAT8"] + this->Dict["NUMMATT"] + this->Dict["NUMMAT4"] +
this->Dict["NUMMAT2"] + this->Dict["NGPSPH"] + this->Dict["NSURF"];
// Dict["NUMMAT"] is the subset of Dict["NUMMAT4"] materials that are rigid body materials
// FIXME: Should NSURF be in here at all? I don't have any datasets w/ NSURF > 0, so I can't test.
}
//------------------------------------------------------------------------------
void LSDynaMetaData::Reset()
{
this->FileIsValid = 0;
this->FileSizeFactor = 7;
this->MaxFileLength = this->FileSizeFactor * 512 * 512 * 8;
this->Title[0] = '\0';
this->ReleaseNumber[0] = '\0';
this->CodeVersion = 0.0;
this->PreStateSize = 0;
this->StateSize = 0;
this->CurrentState = 0;
this->Dict.clear();
this->Fam.Reset();
this->PointArrayNames.clear();
this->PointArrayComponents.clear();
this->PointArrayStatus.clear();
for (int cellType = 0; cellType < LSDynaMetaData::NUM_CELL_TYPES; ++cellType)
{
this->CellArrayNames[cellType].clear();
this->CellArrayComponents[cellType].clear();
this->CellArrayStatus[cellType].clear();
}
this->PartNames.clear();
this->PartIds.clear();
this->PartMaterials.clear();
this->PartStatus.clear();
this->MaterialsOrdered.clear();
this->MaterialsUnordered.clear();
this->MaterialsLookup.clear();
this->RigidSurfaceSegmentSizes.clear();
this->TimeValues.clear();
}