1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkExodusIIReader.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 /**
21  * @class   vtkExodusIIReader
22  * @brief   Read exodus 2 files .ex2
23  *
24  * vtkExodusIIReader is a unstructured grid source object that reads ExodusII
25  * files.  Most of the meta data associated with the file is loaded when
26  * UpdateInformation is called.  This includes information like Title, number
27  * of blocks, number and names of arrays. This data can be retrieved from
28  * methods in this reader. Separate arrays that are meant to be a single
29  * vector, are combined internally for convenience.  To be combined, the array
30  * names have to be identical except for a trailing X,Y and Z (or x,y,z).  By
31  * default cell and point arrays are not loaded.  However, the user can flag
32  * arrays to load with the methods "SetPointResultArrayStatus" and
33  * "SetElementResultArrayStatus".  The reader DOES NOT respond to piece requests
34  *
35  */
36 
37 #ifndef vtkExodusIIReader_h
38 #define vtkExodusIIReader_h
39 
40 #include "vtkIOExodusModule.h" // For export macro
41 #include "vtkMultiBlockDataSetAlgorithm.h"
42 
43 class vtkDataArray;
44 class vtkDataSet;
45 class vtkExodusIICache;
46 class vtkExodusIIReaderPrivate;
47 class vtkFloatArray;
48 class vtkGraph;
49 class vtkInformationIntegerKey;
50 class vtkIntArray;
51 class vtkPoints;
52 class vtkUnstructuredGrid;
53 
54 class VTKIOEXODUS_EXPORT vtkExodusIIReader : public vtkMultiBlockDataSetAlgorithm
55 {
56 public:
57   static vtkExodusIIReader* New();
58   vtkTypeMacro(vtkExodusIIReader, vtkMultiBlockDataSetAlgorithm);
59   void PrintSelf(ostream& os, vtkIndent indent) override;
60 
61   /**
62    * Determine if the file can be read with this reader.
63    */
64   virtual int CanReadFile(VTK_FILEPATH const char* fname);
65 
66   // virtual void Modified();
67 
68   /**
69    * Return the object's MTime. This is overridden to include the timestamp of its internal class.
70    */
71   vtkMTimeType GetMTime() override;
72 
73   /**
74    * Return the MTime of the internal data structure.
75    * This is really only intended for use by vtkPExodusIIReader in order
76    * to determine if the filename is newer than the metadata.
77    */
78   virtual vtkMTimeType GetMetadataMTime();
79 
80   ///@{
81   /**
82    * Specify file name of the Exodus file.
83    */
84   virtual void SetFileName(VTK_FILEPATH const char* fname);
85   vtkGetFilePathMacro(FileName);
86   ///@}
87 
88   ///@{
89   /**
90    * Specify file name of the xml file.
91    */
92   virtual void SetXMLFileName(VTK_FILEPATH const char* fname);
93   vtkGetFilePathMacro(XMLFileName);
94   ///@}
95 
96   ///@{
97   /**
98    * Which TimeStep to read.
99    */
100   vtkSetMacro(TimeStep, int);
101   vtkGetMacro(TimeStep, int);
102   ///@}
103 
104   /**
105    * Convenience method to set the mode-shape which is same as
106    * this->SetTimeStep(val-1);
107    */
SetModeShape(int val)108   void SetModeShape(int val) { this->SetTimeStep(val - 1); }
109 
110   ///@{
111   /**
112    * Since ModeShapes are expected to run from [1,N] rather than [0, N-1],
113    * this method will return the TimeStepRange offset by 1. Note this method
114    * returns the potential mode shapes range irrespective of whether
115    * this->HasModeShapes is set to true.
116    */
117   vtkGetVector2Macro(ModeShapesRange, int);
118   ///@}
119 
120   ///@{
121   /**
122    * Returns the available range of valid integer time steps.
123    * Note this method returns the potential timesteps range irrespective of
124    * whether this->HasModeShapes is set to false.
125    */
126   vtkGetVector2Macro(TimeStepRange, int);
127   ///@}
128 
129   ///@{
130   /**
131    * Extra cell data array that can be generated.  By default, this array
132    * is ON.  The value of the array is the integer id found
133    * in the exodus file. The name of the array is returned by
134    * GetBlockIdArrayName(). For cells representing elements from
135    * an Exodus element block, this is set to the element block ID. For
136    * cells representing edges from an Exodus edge block, this is the
137    * edge block ID. Similarly, this is the face block ID for cells
138    * representing faces from an Exodus face block. The same holds
139    * for cells representing entries of node, edge, face, side, and element sets.
140    */
141   virtual void SetGenerateObjectIdCellArray(vtkTypeBool g);
142   vtkTypeBool GetGenerateObjectIdCellArray();
143   vtkBooleanMacro(GenerateObjectIdCellArray, vtkTypeBool);
GetObjectIdArrayName()144   static const char* GetObjectIdArrayName() { return "ObjectId"; }
145   ///@}
146 
147   virtual void SetGenerateGlobalElementIdArray(vtkTypeBool g);
148   vtkTypeBool GetGenerateGlobalElementIdArray();
149   vtkBooleanMacro(GenerateGlobalElementIdArray, vtkTypeBool);
150 
151   virtual void SetGenerateGlobalNodeIdArray(vtkTypeBool g);
152   vtkTypeBool GetGenerateGlobalNodeIdArray();
153   vtkBooleanMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
154 
155   virtual void SetGenerateImplicitElementIdArray(vtkTypeBool g);
156   vtkTypeBool GetGenerateImplicitElementIdArray();
157   vtkBooleanMacro(GenerateImplicitElementIdArray, vtkTypeBool);
158 
159   virtual void SetGenerateImplicitNodeIdArray(vtkTypeBool g);
160   vtkTypeBool GetGenerateImplicitNodeIdArray();
161   vtkBooleanMacro(GenerateImplicitNodeIdArray, vtkTypeBool);
162 
163   virtual void SetGenerateFileIdArray(vtkTypeBool f);
164   vtkTypeBool GetGenerateFileIdArray();
165   vtkBooleanMacro(GenerateFileIdArray, vtkTypeBool);
166 
167   virtual void SetFileId(int f);
168   int GetFileId();
169 
170   ///@{
171   /**
172    * Extra cell data array that can be generated.  By default, this array
173    * is off.  The value of the array is the integer global id of the cell.
174    * The name of the array is returned by GetGlobalElementIdArrayName()
175    * ***NOTE*** No more "unique" global ID. Instead we have an arbitrary number of maps.
176    */
177   enum
178   {
179     SEARCH_TYPE_ELEMENT = 0,
180     SEARCH_TYPE_NODE,
181     SEARCH_TYPE_ELEMENT_THEN_NODE,
182     SEARCH_TYPE_NODE_THEN_ELEMENT,
183     ID_NOT_FOUND = -234121312
184   };
185   // NOTE: GetNumberOfObjectTypes must be updated whenever you add an entry to enum ObjectType {...}
186   enum ObjectType
187   {
188     // match Exodus macros from exodusII.h and exodusII_ext.h
189     EDGE_BLOCK = 6,
190     FACE_BLOCK = 8,
191     ELEM_BLOCK = 1,
192     NODE_SET = 2,
193     EDGE_SET = 7,
194     FACE_SET = 9,
195     SIDE_SET = 3,
196     ELEM_SET = 10,
197     NODE_MAP = 5,
198     EDGE_MAP = 11,
199     FACE_MAP = 12,
200     ELEM_MAP = 4,
201     GLOBAL = 13,
202     NODAL = 14,
203     // extended values (not in Exodus headers) for use with SetAllArrayStatus:
204     ASSEMBLY = 60,
205     PART = 61,
206     MATERIAL = 62,
207     HIERARCHY = 63,
208     // extended values (not in Exodus headers) for use in cache keys:
209     QA_RECORDS = 103,          //!< Exodus II Quality Assurance (QA) string metadata
210     INFO_RECORDS = 104,        //!< Exodus II Information Records string metadata
211     GLOBAL_TEMPORAL = 102,     //!< global data across timesteps
212     NODAL_TEMPORAL = 101,      //!< nodal data across timesteps
213     ELEM_BLOCK_TEMPORAL = 100, //!< element data across timesteps
214     GLOBAL_CONN = 99,          //!< connectivity assembled from all blocks+sets to be loaded
215     ELEM_BLOCK_ELEM_CONN = 98, //!< raw element block connectivity for elements (not edges/faces)
216     ELEM_BLOCK_FACE_CONN =
217       97, //!< raw element block connectivity for faces (references face blocks)
218     ELEM_BLOCK_EDGE_CONN =
219       96,                 //!< raw element block connectivity for edges (references edge blocks)
220     FACE_BLOCK_CONN = 95, //!< raw face block connectivity (references nodes)
221     EDGE_BLOCK_CONN = 94, //!< raw edge block connectivity (references nodes)
222     ELEM_SET_CONN = 93,   //!< element set connectivity
223     SIDE_SET_CONN = 92,   //!< side set connectivity
224     FACE_SET_CONN = 91,   //!< face set connectivity
225     EDGE_SET_CONN = 90,   //!< edge set connectivity
226     NODE_SET_CONN = 89,   //!< node set connectivity
227     NODAL_COORDS = 88,    //!< raw nodal coordinates (not the "squeezed" version)
228     OBJECT_ID = 87,       //!< object id (old BlockId) array
229     IMPLICIT_ELEMENT_ID = 108, //!< the implicit global index of each element given by exodus
230     IMPLICIT_NODE_ID = 107,    //!< the implicit global index of each node given by exodus
231     GLOBAL_ELEMENT_ID =
232       86, //!< element id array extracted for a particular block (yes, this is a bad name)
233     GLOBAL_NODE_ID =
234       85,            //!< nodal id array extracted for a particular block (yes, this is a bad name)
235     ELEMENT_ID = 84, //!< element id map (old-style elem_num_map or first new-style elem map) array
236     NODE_ID = 83,    //!< nodal id map (old-style node_num_map or first new-style node map) array
237     NODAL_SQUEEZEMAP = 82,  //!< the integer map use to "squeeze" coordinates and nodal arrays/maps
238     ELEM_BLOCK_ATTRIB = 81, //!< an element block attribute array (time-constant scalar per element)
239     FACE_BLOCK_ATTRIB = 80, //!< a face block attribute array (time-constant scalar per element)
240     EDGE_BLOCK_ATTRIB = 79, //!< an edge block attribute array (time-constant scalar per element)
241     FACE_ID = 105,      //!< face id map (old-style face_num_map or first new-style face map) array
242     EDGE_ID = 106,      //!< edge id map (old-style edge_num_map or first new-style edge map) array
243     ENTITY_COUNTS = 109 //!< polyhedra per-entity count ex_get_block returns the sum for polyhedra
244   };
245   ///@}
246 
GetGlobalElementIdArrayName()247   static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
GetPedigreeElementIdArrayName()248   static const char* GetPedigreeElementIdArrayName() { return "PedigreeElementId"; }
249   static int GetGlobalElementID(vtkDataSet* data, int localID);
250   static int GetGlobalElementID(vtkDataSet* data, int localID, int searchType);
GetImplicitElementIdArrayName()251   static const char* GetImplicitElementIdArrayName() { return "ImplicitElementId"; }
252 
GetGlobalFaceIdArrayName()253   static const char* GetGlobalFaceIdArrayName() { return "GlobalFaceId"; }
GetPedigreeFaceIdArrayName()254   static const char* GetPedigreeFaceIdArrayName() { return "PedigreeFaceId"; }
255   static int GetGlobalFaceID(vtkDataSet* data, int localID);
256   static int GetGlobalFaceID(vtkDataSet* data, int localID, int searchType);
GetImplicitFaceIdArrayName()257   static const char* GetImplicitFaceIdArrayName() { return "ImplicitFaceId"; }
258 
GetGlobalEdgeIdArrayName()259   static const char* GetGlobalEdgeIdArrayName() { return "GlobalEdgeId"; }
GetPedigreeEdgeIdArrayName()260   static const char* GetPedigreeEdgeIdArrayName() { return "PedigreeEdgeId"; }
261   static int GetGlobalEdgeID(vtkDataSet* data, int localID);
262   static int GetGlobalEdgeID(vtkDataSet* data, int localID, int searchType);
GetImplicitEdgeIdArrayName()263   static const char* GetImplicitEdgeIdArrayName() { return "ImplicitEdgeId"; }
264 
265   ///@{
266   /**
267    * Extra point data array that can be generated.  By default, this array
268    * is ON.  The value of the array is the integer id of the node.
269    * The id is relative to the entire data set.
270    * The name of the array is returned by GlobalNodeIdArrayName().
271    */
GetGlobalNodeIdArrayName()272   static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
GetPedigreeNodeIdArrayName()273   static const char* GetPedigreeNodeIdArrayName() { return "PedigreeNodeId"; }
274   static int GetGlobalNodeID(vtkDataSet* data, int localID);
275   static int GetGlobalNodeID(vtkDataSet* data, int localID, int searchType);
GetImplicitNodeIdArrayName()276   static const char* GetImplicitNodeIdArrayName() { return "ImplicitNodeId"; }
277   ///@}
278 
279   /**
280    * Get the name of the array that stores the mapping from side set
281    * cells back to the global id of the elements they bound.
282    */
GetSideSetSourceElementIdArrayName()283   static const char* GetSideSetSourceElementIdArrayName() { return "SourceElementId"; }
284 
285   /**
286    * Get the name of the array that stores the mapping from side set
287    * cells back to the canonical side of the elements they bound.
288    */
GetSideSetSourceElementSideArrayName()289   static const char* GetSideSetSourceElementSideArrayName() { return "SourceElementSide"; }
290   ///@{
291   /**
292    * Geometric locations can include displacements.  By default,
293    * this is ON.  The nodal positions are 'displaced' by the
294    * standard exodus displacement vector. If displacements
295    * are turned 'off', the user can explicitly add them by
296    * applying a warp filter.
297    */
298   virtual void SetApplyDisplacements(vtkTypeBool d);
299   vtkTypeBool GetApplyDisplacements();
300   vtkBooleanMacro(ApplyDisplacements, vtkTypeBool);
301   virtual void SetDisplacementMagnitude(float s);
302   float GetDisplacementMagnitude();
303   ///@}
304 
305   ///@{
306   /**
307    * Set/Get whether the Exodus sequence number corresponds to time steps or mode shapes.
308    * By default, HasModeShapes is false unless two time values in the Exodus file are identical,
309    * in which case it is true.
310    */
311   virtual void SetHasModeShapes(vtkTypeBool ms);
312   vtkTypeBool GetHasModeShapes();
313   vtkBooleanMacro(HasModeShapes, vtkTypeBool);
314   ///@}
315 
316   ///@{
317   /**
318    * Set/Get the time used to animate mode shapes.
319    * This is a number between 0 and 1 that is used to scale the \a DisplacementMagnitude
320    * in a sinusoidal pattern. Specifically, the displacement vector for each vertex is scaled by
321    * \f$ \mathrm{DisplacementMagnitude} cos( 2\pi \mathrm{ModeShapeTime} ) \f$ before it is
322    * added to the vertex coordinates.
323    */
324   virtual void SetModeShapeTime(double phase);
325   double GetModeShapeTime();
326   ///@}
327 
328   ///@{
329   /**
330    * If this flag is on (the default) and HasModeShapes is also on, then this
331    * reader will report a continuous time range [0,1] and animate the
332    * displacements in a periodic sinusoid.  If this flag is off and
333    * HasModeShapes is on, this reader ignores time.  This flag has no effect if
334    * HasModeShapes is off.
335    */
336   virtual void SetAnimateModeShapes(vtkTypeBool flag);
337   vtkTypeBool GetAnimateModeShapes();
338   vtkBooleanMacro(AnimateModeShapes, vtkTypeBool);
339   ///@}
340 
341   ///@{
342   /**
343    * When on, this option ignores the time values assigned to each time step in
344    * the file. This can be useful for Exodus files where different time steps
345    * are overloaded to represent different aspects of a data set rather than the
346    * data set at different time values.
347    */
348   virtual void SetIgnoreFileTime(bool flag);
349   bool GetIgnoreFileTime();
350   vtkBooleanMacro(IgnoreFileTime, bool);
351   ///@}
352 
353   ///@{
354   /**
355    * Access to meta data generated by UpdateInformation.
356    */
357   const char* GetTitle();
358   int GetDimensionality();
359   int GetNumberOfTimeSteps();
360   ///@}
361 
362   int GetNumberOfNodesInFile();
363   int GetNumberOfEdgesInFile();
364   int GetNumberOfFacesInFile();
365   int GetNumberOfElementsInFile();
366 
367   int GetObjectTypeFromName(const char* name);
368   const char* GetObjectTypeName(int);
369 
370   int GetNumberOfNodes();
371   int GetNumberOfObjects(int objectType);
372   int GetNumberOfEntriesInObject(int objectType, int objectIndex);
373   int GetObjectId(int objectType, int objectIndex);
374   const char* GetObjectName(int objectType, int objectIndex);
375   int GetObjectIndex(int objectType, const char* objectName);
376   int GetObjectIndex(int objectType, int id);
377   int GetObjectStatus(int objectType, int objectIndex);
GetObjectStatus(int objectType,const char * objectName)378   int GetObjectStatus(int objectType, const char* objectName)
379   {
380     return this->GetObjectStatus(objectType, this->GetObjectIndex(objectType, objectName));
381   }
382   void SetObjectStatus(int objectType, int objectIndex, int status);
383   void SetObjectStatus(int objectType, const char* objectName, int status);
384 
385   ///@{
386   /**
387    * By default arrays are not loaded.  These methods allow the user to select
388    * which arrays they want to load.  You can get information about the arrays
389    * by first caling UpdateInformation, and using GetPointArrayName ...
390    * (Developer Note) This meta data is all accessed through vtkExodusMetadata
391    */
392   int GetNumberOfObjectArrays(int objectType);
393   const char* GetObjectArrayName(int objectType, int arrayIndex);
394   int GetObjectArrayIndex(int objectType, const char* arrayName);
395   int GetNumberOfObjectArrayComponents(int objectType, int arrayIndex);
396   int GetObjectArrayStatus(int objectType, int arrayIndex);
GetObjectArrayStatus(int objectType,const char * arrayName)397   int GetObjectArrayStatus(int objectType, const char* arrayName)
398   {
399     return this->GetObjectArrayStatus(objectType, this->GetObjectArrayIndex(objectType, arrayName));
400   }
401   void SetObjectArrayStatus(int objectType, int arrayIndex, int status);
402   void SetObjectArrayStatus(int objectType, const char* arrayName, int status);
403   ///@}
404 
405   ///@{
406   /**
407    * By default attributes are not loaded.  These methods allow the user to select
408    * which attributes they want to load.  You can get information about the attributes
409    * by first caling UpdateInformation, and using GetObjectAttributeName ...
410    * (Developer Note) This meta data is all accessed through vtkExodusMetadata
411    */
412   int GetNumberOfObjectAttributes(int objectType, int objectIndex);
413   const char* GetObjectAttributeName(int objectType, int objectIndex, int attribIndex);
414   int GetObjectAttributeIndex(int objectType, int objectIndex, const char* attribName);
415   int GetObjectAttributeStatus(int objectType, int objectIndex, int attribIndex);
GetObjectAttributeStatus(int objectType,int objectIndex,const char * attribName)416   int GetObjectAttributeStatus(int objectType, int objectIndex, const char* attribName)
417   {
418     return this->GetObjectAttributeStatus(
419       objectType, objectIndex, this->GetObjectAttributeIndex(objectType, objectIndex, attribName));
420   }
421   void SetObjectAttributeStatus(int objectType, int objectIndex, int attribIndex, int status);
SetObjectAttributeStatus(int objectType,int objectIndex,const char * attribName,int status)422   void SetObjectAttributeStatus(int objectType, int objectIndex, const char* attribName, int status)
423   {
424     this->SetObjectAttributeStatus(objectType, objectIndex,
425       this->GetObjectAttributeIndex(objectType, objectIndex, attribName), status);
426   }
427   ///@}
428 
429   virtual vtkIdType GetTotalNumberOfNodes();
430   virtual vtkIdType GetTotalNumberOfEdges();
431   virtual vtkIdType GetTotalNumberOfFaces();
432   virtual vtkIdType GetTotalNumberOfElements();
433 
434   ///@{
435   /**
436    * By default all parts are loaded. These methods allow the user to select
437    * which parts they want to load.  You can get information about the parts
438    * by first caling UpdateInformation, and using GetPartArrayName ...
439    */
440   int GetNumberOfPartArrays();
441   const char* GetPartArrayName(int arrayIdx);
442   int GetPartArrayID(const char* name);
443   const char* GetPartBlockInfo(int arrayIdx);
444   void SetPartArrayStatus(int index, int flag);
445   void SetPartArrayStatus(const char*, int flag);
446   int GetPartArrayStatus(int index);
447   int GetPartArrayStatus(const char*);
448   ///@}
449 
450   ///@{
451   /**
452    * By default all materials are loaded. These methods allow the user to
453    * select which materials they want to load.  You can get information
454    * about the materials by first caling UpdateInformation, and using
455    * GetMaterialArrayName ...
456    */
457   int GetNumberOfMaterialArrays();
458   const char* GetMaterialArrayName(int arrayIdx);
459   int GetMaterialArrayID(const char* name);
460   void SetMaterialArrayStatus(int index, int flag);
461   void SetMaterialArrayStatus(const char*, int flag);
462   int GetMaterialArrayStatus(int index);
463   int GetMaterialArrayStatus(const char*);
464   ///@}
465 
466   ///@{
467   /**
468    * By default all assemblies are loaded. These methods allow the user to
469    * select which assemblies they want to load.  You can get information
470    * about the assemblies by first caling UpdateInformation, and using
471    * GetAssemblyArrayName ...
472    */
473   int GetNumberOfAssemblyArrays();
474   const char* GetAssemblyArrayName(int arrayIdx);
475   int GetAssemblyArrayID(const char* name);
476   void SetAssemblyArrayStatus(int index, int flag);
477   void SetAssemblyArrayStatus(const char*, int flag);
478   int GetAssemblyArrayStatus(int index);
479   int GetAssemblyArrayStatus(const char*);
480   ///@}
481 
482   ///@{
483   /**
484    * By default all hierarchy entries are loaded. These methods allow
485    * the user to
486    * select which hierarchy entries they want to load.  You can get information
487    * about the hierarchy entries by first caling UpdateInformation, and using
488    * GetHierarchyArrayName ...
489    * these methods do not call functions in metaData. They call functions on
490    * the ExodusXMLParser since it seemed silly to duplicate all the information
491    */
492   int GetNumberOfHierarchyArrays();
493   const char* GetHierarchyArrayName(int arrayIdx);
494   void SetHierarchyArrayStatus(int index, int flag);
495   void SetHierarchyArrayStatus(const char*, int flag);
496   int GetHierarchyArrayStatus(int index);
497   int GetHierarchyArrayStatus(const char*);
498   ///@}
499 
500   vtkGetMacro(DisplayType, int);
501   virtual void SetDisplayType(int type);
502 
503   /**
504    * return boolean indicating whether the type,name is a valid variable
505    */
506   int IsValidVariable(const char* type, const char* name);
507 
508   /**
509    * Return the id of the type,name variable
510    */
511   int GetVariableID(const char* type, const char* name);
512 
513   void SetAllArrayStatus(int otype, int status);
514   // Helper functions
515   // static int StringsEqual(const char* s1, char* s2);
516   // static void StringUppercase(const char* str, char* upperstr);
517   // static char *StrDupWithNew(const char *s);
518 
519   // time series query functions
520   int GetTimeSeriesData(int ID, const char* vName, const char* vType, vtkFloatArray* result);
521 
GetNumberOfEdgeBlockArrays()522   int GetNumberOfEdgeBlockArrays() { return this->GetNumberOfObjects(EDGE_BLOCK); }
GetEdgeBlockArrayName(int index)523   const char* GetEdgeBlockArrayName(int index) { return this->GetObjectName(EDGE_BLOCK, index); }
GetEdgeBlockArrayStatus(const char * name)524   int GetEdgeBlockArrayStatus(const char* name) { return this->GetObjectStatus(EDGE_BLOCK, name); }
SetEdgeBlockArrayStatus(const char * name,int flag)525   void SetEdgeBlockArrayStatus(const char* name, int flag)
526   {
527     this->SetObjectStatus(EDGE_BLOCK, name, flag);
528   }
529 
GetNumberOfFaceBlockArrays()530   int GetNumberOfFaceBlockArrays() { return this->GetNumberOfObjects(FACE_BLOCK); }
GetFaceBlockArrayName(int index)531   const char* GetFaceBlockArrayName(int index) { return this->GetObjectName(FACE_BLOCK, index); }
GetFaceBlockArrayStatus(const char * name)532   int GetFaceBlockArrayStatus(const char* name) { return this->GetObjectStatus(FACE_BLOCK, name); }
SetFaceBlockArrayStatus(const char * name,int flag)533   void SetFaceBlockArrayStatus(const char* name, int flag)
534   {
535     this->SetObjectStatus(FACE_BLOCK, name, flag);
536   }
537 
GetNumberOfElementBlockArrays()538   int GetNumberOfElementBlockArrays() { return this->GetNumberOfObjects(ELEM_BLOCK); }
GetElementBlockArrayName(int index)539   const char* GetElementBlockArrayName(int index) { return this->GetObjectName(ELEM_BLOCK, index); }
GetElementBlockArrayStatus(const char * name)540   int GetElementBlockArrayStatus(const char* name)
541   {
542     return this->GetObjectStatus(ELEM_BLOCK, name);
543   }
SetElementBlockArrayStatus(const char * name,int flag)544   void SetElementBlockArrayStatus(const char* name, int flag)
545   {
546     this->SetObjectStatus(ELEM_BLOCK, name, flag);
547   }
548 
GetNumberOfGlobalResultArrays()549   int GetNumberOfGlobalResultArrays() { return this->GetNumberOfObjectArrays(GLOBAL); }
GetGlobalResultArrayName(int index)550   const char* GetGlobalResultArrayName(int index)
551   {
552     return this->GetObjectArrayName(GLOBAL, index);
553   }
GetGlobalResultArrayStatus(const char * name)554   int GetGlobalResultArrayStatus(const char* name)
555   {
556     return this->GetObjectArrayStatus(GLOBAL, name);
557   }
SetGlobalResultArrayStatus(const char * name,int flag)558   void SetGlobalResultArrayStatus(const char* name, int flag)
559   {
560     this->SetObjectArrayStatus(GLOBAL, name, flag);
561   }
562 
GetNumberOfPointResultArrays()563   int GetNumberOfPointResultArrays() { return this->GetNumberOfObjectArrays(NODAL); }
GetPointResultArrayName(int index)564   const char* GetPointResultArrayName(int index) { return this->GetObjectArrayName(NODAL, index); }
GetPointResultArrayStatus(const char * name)565   int GetPointResultArrayStatus(const char* name)
566   {
567     return this->GetObjectArrayStatus(NODAL, name);
568   }
SetPointResultArrayStatus(const char * name,int flag)569   void SetPointResultArrayStatus(const char* name, int flag)
570   {
571     this->SetObjectArrayStatus(NODAL, name, flag);
572   }
573 
GetNumberOfEdgeResultArrays()574   int GetNumberOfEdgeResultArrays() { return this->GetNumberOfObjectArrays(EDGE_BLOCK); }
GetEdgeResultArrayName(int index)575   const char* GetEdgeResultArrayName(int index)
576   {
577     return this->GetObjectArrayName(EDGE_BLOCK, index);
578   }
GetEdgeResultArrayStatus(const char * name)579   int GetEdgeResultArrayStatus(const char* name)
580   {
581     return this->GetObjectArrayStatus(EDGE_BLOCK, name);
582   }
SetEdgeResultArrayStatus(const char * name,int flag)583   void SetEdgeResultArrayStatus(const char* name, int flag)
584   {
585     this->SetObjectArrayStatus(EDGE_BLOCK, name, flag);
586   }
587 
GetNumberOfFaceResultArrays()588   int GetNumberOfFaceResultArrays() { return this->GetNumberOfObjectArrays(FACE_BLOCK); }
GetFaceResultArrayName(int index)589   const char* GetFaceResultArrayName(int index)
590   {
591     return this->GetObjectArrayName(FACE_BLOCK, index);
592   }
GetFaceResultArrayStatus(const char * name)593   int GetFaceResultArrayStatus(const char* name)
594   {
595     return this->GetObjectArrayStatus(FACE_BLOCK, name);
596   }
SetFaceResultArrayStatus(const char * name,int flag)597   void SetFaceResultArrayStatus(const char* name, int flag)
598   {
599     this->SetObjectArrayStatus(FACE_BLOCK, name, flag);
600   }
601 
GetNumberOfElementResultArrays()602   int GetNumberOfElementResultArrays() { return this->GetNumberOfObjectArrays(ELEM_BLOCK); }
GetElementResultArrayName(int index)603   const char* GetElementResultArrayName(int index)
604   {
605     return this->GetObjectArrayName(ELEM_BLOCK, index);
606   }
GetElementResultArrayStatus(const char * name)607   int GetElementResultArrayStatus(const char* name)
608   {
609     return this->GetObjectArrayStatus(ELEM_BLOCK, name);
610   }
SetElementResultArrayStatus(const char * name,int flag)611   void SetElementResultArrayStatus(const char* name, int flag)
612   {
613     this->SetObjectArrayStatus(ELEM_BLOCK, name, flag);
614   }
615 
GetNumberOfNodeMapArrays()616   int GetNumberOfNodeMapArrays() { return this->GetNumberOfObjects(NODE_MAP); }
GetNodeMapArrayName(int index)617   const char* GetNodeMapArrayName(int index) { return this->GetObjectName(NODE_MAP, index); }
GetNodeMapArrayStatus(const char * name)618   int GetNodeMapArrayStatus(const char* name) { return this->GetObjectStatus(NODE_MAP, name); }
SetNodeMapArrayStatus(const char * name,int flag)619   void SetNodeMapArrayStatus(const char* name, int flag)
620   {
621     this->SetObjectStatus(NODE_MAP, name, flag);
622   }
623 
GetNumberOfEdgeMapArrays()624   int GetNumberOfEdgeMapArrays() { return this->GetNumberOfObjects(EDGE_MAP); }
GetEdgeMapArrayName(int index)625   const char* GetEdgeMapArrayName(int index) { return this->GetObjectName(EDGE_MAP, index); }
GetEdgeMapArrayStatus(const char * name)626   int GetEdgeMapArrayStatus(const char* name) { return this->GetObjectStatus(EDGE_MAP, name); }
SetEdgeMapArrayStatus(const char * name,int flag)627   void SetEdgeMapArrayStatus(const char* name, int flag)
628   {
629     this->SetObjectStatus(EDGE_MAP, name, flag);
630   }
631 
GetNumberOfFaceMapArrays()632   int GetNumberOfFaceMapArrays() { return this->GetNumberOfObjects(FACE_MAP); }
GetFaceMapArrayName(int index)633   const char* GetFaceMapArrayName(int index) { return this->GetObjectName(FACE_MAP, index); }
GetFaceMapArrayStatus(const char * name)634   int GetFaceMapArrayStatus(const char* name) { return this->GetObjectStatus(FACE_MAP, name); }
SetFaceMapArrayStatus(const char * name,int flag)635   void SetFaceMapArrayStatus(const char* name, int flag)
636   {
637     this->SetObjectStatus(FACE_MAP, name, flag);
638   }
639 
GetNumberOfElementMapArrays()640   int GetNumberOfElementMapArrays() { return this->GetNumberOfObjects(ELEM_MAP); }
GetElementMapArrayName(int index)641   const char* GetElementMapArrayName(int index) { return this->GetObjectName(ELEM_MAP, index); }
GetElementMapArrayStatus(const char * name)642   int GetElementMapArrayStatus(const char* name) { return this->GetObjectStatus(ELEM_MAP, name); }
SetElementMapArrayStatus(const char * name,int flag)643   void SetElementMapArrayStatus(const char* name, int flag)
644   {
645     this->SetObjectStatus(ELEM_MAP, name, flag);
646   }
647 
GetNumberOfNodeSetArrays()648   int GetNumberOfNodeSetArrays() { return this->GetNumberOfObjects(NODE_SET); }
GetNodeSetArrayName(int index)649   const char* GetNodeSetArrayName(int index) { return this->GetObjectName(NODE_SET, index); }
GetNodeSetArrayStatus(const char * name)650   int GetNodeSetArrayStatus(const char* name) { return this->GetObjectStatus(NODE_SET, name); }
SetNodeSetArrayStatus(const char * name,int flag)651   void SetNodeSetArrayStatus(const char* name, int flag)
652   {
653     this->SetObjectStatus(NODE_SET, name, flag);
654   }
655 
GetNumberOfSideSetArrays()656   int GetNumberOfSideSetArrays() { return this->GetNumberOfObjects(SIDE_SET); }
GetSideSetArrayName(int index)657   const char* GetSideSetArrayName(int index) { return this->GetObjectName(SIDE_SET, index); }
GetSideSetArrayStatus(const char * name)658   int GetSideSetArrayStatus(const char* name) { return this->GetObjectStatus(SIDE_SET, name); }
SetSideSetArrayStatus(const char * name,int flag)659   void SetSideSetArrayStatus(const char* name, int flag)
660   {
661     this->SetObjectStatus(SIDE_SET, name, flag);
662   }
663 
GetNumberOfEdgeSetArrays()664   int GetNumberOfEdgeSetArrays() { return this->GetNumberOfObjects(EDGE_SET); }
GetEdgeSetArrayName(int index)665   const char* GetEdgeSetArrayName(int index) { return this->GetObjectName(EDGE_SET, index); }
GetEdgeSetArrayStatus(const char * name)666   int GetEdgeSetArrayStatus(const char* name) { return this->GetObjectStatus(EDGE_SET, name); }
SetEdgeSetArrayStatus(const char * name,int flag)667   void SetEdgeSetArrayStatus(const char* name, int flag)
668   {
669     this->SetObjectStatus(EDGE_SET, name, flag);
670   }
671 
GetNumberOfFaceSetArrays()672   int GetNumberOfFaceSetArrays() { return this->GetNumberOfObjects(FACE_SET); }
GetFaceSetArrayName(int index)673   const char* GetFaceSetArrayName(int index) { return this->GetObjectName(FACE_SET, index); }
GetFaceSetArrayStatus(const char * name)674   int GetFaceSetArrayStatus(const char* name) { return this->GetObjectStatus(FACE_SET, name); }
SetFaceSetArrayStatus(const char * name,int flag)675   void SetFaceSetArrayStatus(const char* name, int flag)
676   {
677     this->SetObjectStatus(FACE_SET, name, flag);
678   }
679 
GetNumberOfElementSetArrays()680   int GetNumberOfElementSetArrays() { return this->GetNumberOfObjects(ELEM_SET); }
GetElementSetArrayName(int index)681   const char* GetElementSetArrayName(int index) { return this->GetObjectName(ELEM_SET, index); }
GetElementSetArrayStatus(const char * name)682   int GetElementSetArrayStatus(const char* name) { return this->GetObjectStatus(ELEM_SET, name); }
SetElementSetArrayStatus(const char * name,int flag)683   void SetElementSetArrayStatus(const char* name, int flag)
684   {
685     this->SetObjectStatus(ELEM_SET, name, flag);
686   }
687 
GetNumberOfNodeSetResultArrays()688   int GetNumberOfNodeSetResultArrays() { return this->GetNumberOfObjectArrays(NODE_SET); }
GetNodeSetResultArrayName(int index)689   const char* GetNodeSetResultArrayName(int index)
690   {
691     return this->GetObjectArrayName(NODE_SET, index);
692   }
GetNodeSetResultArrayStatus(const char * name)693   int GetNodeSetResultArrayStatus(const char* name)
694   {
695     return this->GetObjectArrayStatus(NODE_SET, name);
696   }
SetNodeSetResultArrayStatus(const char * name,int flag)697   void SetNodeSetResultArrayStatus(const char* name, int flag)
698   {
699     this->SetObjectArrayStatus(NODE_SET, name, flag);
700   }
701 
GetNumberOfSideSetResultArrays()702   int GetNumberOfSideSetResultArrays() { return this->GetNumberOfObjectArrays(SIDE_SET); }
GetSideSetResultArrayName(int index)703   const char* GetSideSetResultArrayName(int index)
704   {
705     return this->GetObjectArrayName(SIDE_SET, index);
706   }
GetSideSetResultArrayStatus(const char * name)707   int GetSideSetResultArrayStatus(const char* name)
708   {
709     return this->GetObjectArrayStatus(SIDE_SET, name);
710   }
SetSideSetResultArrayStatus(const char * name,int flag)711   void SetSideSetResultArrayStatus(const char* name, int flag)
712   {
713     this->SetObjectArrayStatus(SIDE_SET, name, flag);
714   }
715 
GetNumberOfEdgeSetResultArrays()716   int GetNumberOfEdgeSetResultArrays() { return this->GetNumberOfObjectArrays(EDGE_SET); }
GetEdgeSetResultArrayName(int index)717   const char* GetEdgeSetResultArrayName(int index)
718   {
719     return this->GetObjectArrayName(EDGE_SET, index);
720   }
GetEdgeSetResultArrayStatus(const char * name)721   int GetEdgeSetResultArrayStatus(const char* name)
722   {
723     return this->GetObjectArrayStatus(EDGE_SET, name);
724   }
SetEdgeSetResultArrayStatus(const char * name,int flag)725   void SetEdgeSetResultArrayStatus(const char* name, int flag)
726   {
727     this->SetObjectArrayStatus(EDGE_SET, name, flag);
728   }
729 
GetNumberOfFaceSetResultArrays()730   int GetNumberOfFaceSetResultArrays() { return this->GetNumberOfObjectArrays(FACE_SET); }
GetFaceSetResultArrayName(int index)731   const char* GetFaceSetResultArrayName(int index)
732   {
733     return this->GetObjectArrayName(FACE_SET, index);
734   }
GetFaceSetResultArrayStatus(const char * name)735   int GetFaceSetResultArrayStatus(const char* name)
736   {
737     return this->GetObjectArrayStatus(FACE_SET, name);
738   }
SetFaceSetResultArrayStatus(const char * name,int flag)739   void SetFaceSetResultArrayStatus(const char* name, int flag)
740   {
741     this->SetObjectArrayStatus(FACE_SET, name, flag);
742   }
743 
GetNumberOfElementSetResultArrays()744   int GetNumberOfElementSetResultArrays() { return this->GetNumberOfObjectArrays(ELEM_SET); }
GetElementSetResultArrayName(int index)745   const char* GetElementSetResultArrayName(int index)
746   {
747     return this->GetObjectArrayName(ELEM_SET, index);
748   }
GetElementSetResultArrayStatus(const char * name)749   int GetElementSetResultArrayStatus(const char* name)
750   {
751     return this->GetObjectArrayStatus(ELEM_SET, name);
752   }
SetElementSetResultArrayStatus(const char * name,int flag)753   void SetElementSetResultArrayStatus(const char* name, int flag)
754   {
755     this->SetObjectArrayStatus(ELEM_SET, name, flag);
756   }
757 
758   /**
759    * Reset the user-specified parameters and flush internal arrays
760    * so that the reader state is just as it was after the reader was
761    * instantiated.
762 
763    * It doesn't make sense to let users reset only the internal state;
764    * both the settings and the state are changed by this call.
765    */
766   void Reset();
767 
768   /**
769    * Reset the user-specified parameters to their default values.
770    * The only settings not affected are the filename and/or pattern
771    * because these have no default.
772 
773    * Resetting the settings but not the state allows users to
774    * keep the active cache but return to initial array selections, etc.
775    */
776   void ResetSettings();
777 
778   /**
779    * Clears out the cache entries.
780    */
781   void ResetCache();
782 
783   /**
784    * Set the size of the cache in MiB.
785    */
786   void SetCacheSize(double CacheSize);
787 
788   /**
789    * Get the size of the cache in MiB.
790    */
791   double GetCacheSize();
792 
793   ///@{
794   /**
795    * Should the reader output only points used by elements in the output mesh,
796    * or all the points. Outputting all the points is much faster since the
797    * point array can be read straight from disk and the mesh connectivity need
798    * not be altered. Squeezing the points down to the minimum set needed to
799    * produce the output mesh is useful for glyphing and other point-based
800    * operations. On large parallel datasets, loading all the points implies
801    * loading all the points on all processes and performing subsequent
802    * filtering on a much larger set.
803 
804    * By default, SqueezePoints is true for backwards compatibility.
805    */
806   void SetSqueezePoints(bool sp);
807   bool GetSqueezePoints();
808   ///@}
809 
810   virtual void Dump();
811 
812   /**
813    * SIL describes organization of/relationships between classifications
814    * eg. blocks/materials/hierarchies.
815    */
816   vtkGraph* GetSIL();
817 
818   ///@{
819   /**
820    * Every time the SIL is updated a this will return a different value.
821    */
822   vtkGetMacro(SILUpdateStamp, int);
823   ///@}
824 
825   ///@{
826   /**
827    * Get the max_name_length in the file. This is the amount of space allocated
828    * int the file for storing names of arrays, blocks, etc.
829    */
830   int GetMaxNameLength();
831   ///@}
832 
833   ///@{
834   /**
835    * Exodus reader outputs global variables and global temporal variables,
836    * together with some other variables as FieldData. These keys help identify
837    * which arrays in the FieldData are GLOBAL and which ones are
838    * GLOBAL_TEMPORAL.
839    *
840    * @sa vtkExtractExodusGlobalTemporalVariables.
841    */
842   static vtkInformationIntegerKey* GLOBAL_VARIABLE();
843   static vtkInformationIntegerKey* GLOBAL_TEMPORAL_VARIABLE();
844   ///@}
845 
846   ///@{
847   /**
848    * In previous versions, the reader added the type of elements in the block to
849    * the block name when no name was provided for the block. This has issues
850    * with consistency when naming blocks across ranks for partitioned files
851    * (see paraview/paraview#19110), hence we no longer do that. For legacy
852    * pipelines, one can enable the old behavior by setting this flag to true.
853    */
854   vtkSetMacro(UseLegacyBlockNames, bool);
855   vtkGetMacro(UseLegacyBlockNames, bool);
856   vtkBooleanMacro(UseLegacyBlockNames, bool);
857   ///@}
858 protected:
859   vtkExodusIIReader();
860   ~vtkExodusIIReader() override;
861 
862   // helper for finding IDs
863   static int GetIDHelper(const char* arrayName, vtkDataSet* data, int localID, int searchType);
864   static int GetGlobalID(const char* arrayName, vtkDataSet* data, int localID, int searchType);
865 
866   virtual void SetMetadata(vtkExodusIIReaderPrivate*);
867   vtkGetObjectMacro(Metadata, vtkExodusIIReaderPrivate);
868 
869   /**
870    * Returns true if the file given by XMLFileName exists.
871    * Return true if found, false otherwise
872    */
873   bool FindXMLFile();
874 
875   // Time query function. Called by ExecuteInformation().
876   // Fills the TimestepValues array.
877   void GetAllTimes(vtkInformationVector*);
878 
879   /**
880    * Populates the TIME_STEPS and TIME_RANGE keys based on file metadata.
881    */
882   void AdvertiseTimeSteps(vtkInformation* outputInfo);
883 
884   vtkTypeBool ProcessRequest(
885     vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
886   int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
887   int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
888   // int RequestDataOverTime( vtkInformation *, vtkInformationVector **, vtkInformationVector *);
889 
890   // Parameters for controlling what is read in.
891   char* FileName;
892   char* XMLFileName;
893   int TimeStep;
894   int TimeStepRange[2];
895   vtkTimeStamp FileNameMTime;
896   vtkTimeStamp XMLFileNameMTime;
897 
898   // Information specific for exodus files.
899 
900   // 1=display Block names
901   // 2=display Part names
902   // 3=display Material names
903   int DisplayType;
904 
905   // Metadata containing a description of the currently open file.
906   vtkExodusIIReaderPrivate* Metadata;
907 
908   int SILUpdateStamp;
909 
910   friend class vtkPExodusIIReader;
911 
912 private:
913   vtkExodusIIReader(const vtkExodusIIReader&) = delete;
914   void operator=(const vtkExodusIIReader&) = delete;
915 
916   void AddDisplacements(vtkUnstructuredGrid* output);
917   int ModeShapesRange[2];
918 
919   bool UseLegacyBlockNames;
920 };
921 
922 #endif
923