1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    LSDynaMetaData.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 /*----------------------------------------------------------------------------
16  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
20 // .NAME LSDynaMetaData - Read LS-Dyna databases (d3plot)
21 // .SECTION Description
22 //    A class to hold metadata about a particular file (such as time steps,
23 //    the start of state information for each time step, the number of
24 //    adaptive remeshes, and the large collection of constants that determine
25 //    the available attributes). It contains an LSDynaFamily instance.
26 
27 #ifndef __LSDynaMetaData_h
28 #define __LSDynaMetaData_h
29 
30 #include "LSDynaExport.h"
31 #include "LSDynaFamily.h"
32 
33 #include <string>
34 #include <map>
35 #include <set>
36 #include <vector>
37 
38 class LSDynaMetaData
39 {
40 public:
41   LSDynaMetaData();
42 
43   bool AddPointArray( std::string name, int numComponents, int status );
44 
45   bool AddCellArray( int cellType, std::string name, int numComponents, int status );
46 
47   int GetTotalMaterialCount();
48 
49   void Reset();
50 
51   /** LS-Dyna cell types.
52    * These may be used as values for the \a cellType argument in member functions.
53    * One dataset is created for each cell type so that cells can have different
54    * attributes (temperature, pressure, etc.) defined over them.
55    * Note that \a NUM_CELL_TYPES is not a cell type, but an enumerant that
56    * specifies the total number of cell types. It is used to size arrays.
57    */
58   enum LSDYNA_TYPES{
59     PARTICLE = 0,
60     BEAM = 1,
61     SHELL = 2,
62     THICK_SHELL = 3,
63     SOLID = 4,
64     RIGID_BODY = 5,
65     ROAD_SURFACE = 6,
66     NUM_CELL_TYPES
67   };
68 
69   // If this is 0, the rest of the members have undefined
70   // values (although "derived-value" arrays will be
71   // initialized to NULL)
72   int FileIsValid;
73   int FileSizeFactor; // scale factor used to compute MaxFileLength
74   vtkIdType MaxFileLength; // Maximum size of any file (data too big is split into multiple files)
75 
76   LSDynaFamily Fam; // file family I/O aggregator
77 
78   char  Title[41];
79   int Dimensionality;
80   vtkIdType CurrentState; // time step
81   vtkIdType NumberOfNodes;
82   vtkIdType NumberOfCells[LSDynaMetaData::NUM_CELL_TYPES];
83   int ReadRigidRoadMvmt; // Are some of the quads rigid? (eliminating a lot of state)
84   int ConnectivityUnpacked; // Is the connectivity packed, 3 to a word?
85   std::map<std::string,vtkIdType> Dict;
86 
87   /// List of material IDs that indicate the associated shell element is rigid (and has no state data)
88   std::set<int> RigidMaterials;
89   /// List of material IDs that indicate the associated solid element represents an Eulerian or ALE fluid.
90   std::set<int> FluidMaterials;
91 
92   std::vector<std::string> PointArrayNames;
93   std::vector<int> PointArrayComponents;
94   std::vector<int> PointArrayStatus;
95 
96   std::map<int, std::vector<std::string> > CellArrayNames;
97   std::map<int, std::vector<int> > CellArrayComponents;
98   std::map<int, std::vector<int> > CellArrayStatus;
99 
100   std::vector<std::string> PartNames;
101   std::vector<int> PartIds;
102   std::vector<int> PartMaterials;
103   std::vector<int> PartStatus;
104 
105   std::vector<int> MaterialsOrdered;
106   std::vector<int> MaterialsUnordered;
107   std::vector<int> MaterialsLookup;
108 
109   std::vector<vtkIdType> RigidSurfaceSegmentSizes;
110   std::vector<double> TimeValues;
111 
112   // For the current time value, what file contains this state (0=d3plot,1=d3plot01, ...)
113   vtkIdType FileNumberThisState;
114   // For the current time value, what is the byte offset of the state in file FileNumberThisState?
115   vtkIdType FileOffsetThisState;
116   // Size of all data that appears before first state
117   vtkIdType PreStateSize;
118   // Number of bytes required to store a single timestep
119   vtkIdType StateSize;
120 
121   //Number of words into the state that the element deletion starts at
122   vtkIdType ElementDeletionOffset;
123 
124   //Number of words into the state that the SPH state data starts at
125   vtkIdType SPHStateOffset;
126 };
127 
128 #endif // __LSDynaMetaData_h
129