vtkExodusIIReaderPrivate.h 32.2 KB
Newer Older
1
2
3
#ifndef __vtkExodusIIReaderPrivate_h
#define __vtkExodusIIReaderPrivate_h

4
5
// Do not include this file directly. It is only for use
// from inside the ExodusII reader and its descendants.
6
7
8
9
10

#include "vtkToolkits.h" // make sure VTK_USE_PARALLEL is properly set
#include "vtkExodusIICache.h"
#include "vtksys/RegularExpression.hxx"

11
12
#include <map>
#include <vector>
13

14
#include "vtk_exodusII.h"
VTK Developers's avatar
VTK Developers committed
15
#include "vtkIOExodusModule.h" // For export macro
16
17
class vtkExodusIIReaderParser;
class vtkMutableDirectedGraph;
18
19
20
21

/** This class holds metadata for an Exodus file.
  *
  */
VTK Developers's avatar
VTK Developers committed
22
class VTKIOEXODUS_EXPORT vtkExodusIIReaderPrivate : public vtkObject
23
24
25
26
{
public:
  static vtkExodusIIReaderPrivate* New();
  void PrintData( ostream& os, vtkIndent indent );
27
  vtkTypeMacro(vtkExodusIIReaderPrivate,vtkObject);
28
  //virtual void Modified();
29
30
31
32
33
34
35
36
37
38

  /// Open an ExodusII file for reading. Returns 0 on success.
  int OpenFile( const char* filename );

  /// Close any ExodusII file currently open for reading. Returns 0 on success.
  int CloseFile();

  /// Get metadata for an open file with handle \a exoid.
  int RequestInformation();

39
40
41
42
  /// Returns the SIL. This valid only after BuildSIL() has been called.
  vtkMutableDirectedGraph* GetSIL()
    { return this->SIL; }

43
44
45
  /// Read requested data and store in unstructured grid.
  int RequestData( vtkIdType timeStep, vtkMultiBlockDataSet* output );

46
47
48
49
  /** Description:
    * Prepare a data set with the proper structure and arrays but no cells.
    * This is used by the parallel reader when a process has no files assigned to it.
    */
50
51
52
53
54
55
56
57
58
59
  int SetUpEmptyGrid( vtkMultiBlockDataSet* output );

  /** Reset the class so that another file may be read.
    * This does not change any user-specified parameters, such as
    * which <b>generated</b> arrays should be present, whether there are
    * mode shapes or time steps, etc.
    * Note that which arrays should be loaded is a more delicate
    * issue; if you set these after RequestInformation has been called,
    * these will not be saved.
    * Any settings you make <b>before</b> RequestInformation is called
60
    * will be saved because they are stored in InitialArrayInfo and
61
62
63
64
65
66
67
68
69
70
71
72
73
    * InitialObjectInfo.
    */
  void Reset();

  /** Return user-specified variables to their default values.
    * Calling ResetSettings() and then Reset() will return the class
    * to a state just like it was after New() was called.
    */
  void ResetSettings();

  /// Clears out any data in the cache and restores it to its initial state.
  void ResetCache();

74
  /// Set the size of the cache in MiB.
75
  void SetCacheSize(double size);
76
77
78
79

  /// Get the size of the cache in MiB.
  vtkGetMacro(CacheSize, double);

80
  /** Return the number of time steps in the open file.
81
    * You must have called RequestInformation() before
82
83
84
85
86
87
88
89
90
91
    * invoking this member function.
    */
  int GetNumberOfTimeSteps() { return (int) this->Times.size(); }

  /// Return the current time step
  vtkGetMacro(TimeStep,int);

  /// Set the current time step for subsequent calls to RequestData().
  vtkSetMacro(TimeStep,int);

92
  /// Return whether subsequent RequestData() calls will produce the minimal
93
94
95
  /// point set required to represent the output.
  vtkGetMacro(SqueezePoints,int);

96
  /// Set whether subsequent RequestData() calls will produce the minimal
97
98
99
  /// point set required to represent the output.
  void SetSqueezePoints( int sp );

100
  /// Convenience routines that for producing (or not) the minimal point set
101
102
103
104
105
106
  /// required to represent the output.
  vtkBooleanMacro(SqueezePoints,int);

  /// Return the number of nodes in the output (depends on SqueezePoints)
  int GetNumberOfNodes();

107
108
  /** Returns the number of objects of a given type (e.g., EX_ELEM_BLOCK,
    * EX_NODE_SET, ...). You must have called RequestInformation before
109
110
111
112
    * invoking this member function.
    */
  int GetNumberOfObjectsOfType( int otype );

113
  /** Returns the number of arrays defined over objects of a given type
114
    * (e.g., EX_ELEM_BLOCK, EX_NODE_SET, ...).
115
    * You must have called RequestInformation before invoking this
116
117
    * member function.
    *
118
119
    * N.B.: This method will eventually disappear. Really, what we should be
    * providing is an interface to query the arrays defined on a particular
120
121
122
123
124
    * object, not a class of objects. However, until the reader
    * outputs multiblock datasets, we can't be that specific.
    */
  int GetNumberOfObjectArraysOfType( int otype );

125
126
  /** For a given object type, returns the name of the i-th object.
    * You must have called RequestInformation before invoking this
127
128
129
130
131
    * member function.
    */
  const char* GetObjectName( int otype, int i );

  /** For a given object type, return the user-assigned ID of the i-th object.
132
    * You must have called RequestInformation before invoking this
133
134
135
136
137
138
139
    * member function.
    */
  int GetObjectId( int otype, int i );

  /** For a given object type, return the size of the i-th object.
    * The size is the number of entries.
    * As an example, for an element block, it is the number of elements.
140
    * You must have called RequestInformation before invoking this
141
142
143
144
145
    * member function.
    */
  int GetObjectSize( int otype, int i );

  /** For a given object type, returns the status of the i-th object.
146
    * You must have called RequestInformation before invoking this
147
148
149
150
151
152
    * member function.
    */
  int GetObjectStatus( int otype, int i );

  /** For a given object type, returns the status of the i-th object, where i is
    * an index into the unsorted object array.
153
    * You must have called RequestInformation before invoking this
154
155
156
157
158
    * member function.
    */
  int GetUnsortedObjectStatus( int otype, int i );

  /** For a given object type, sets the status of the i-th object.
159
    * You must have called RequestInformation before invoking this
160
161
162
163
164
165
    * member function.
    */
  void SetObjectStatus( int otype, int i, int stat );

  /** For a given object type, sets the status of the i-th object,
    * where i is an index into the *unsorted* object array.
166
    * You must have called RequestInformation before invoking this
167
168
169
170
    * member function.
    */
  void SetUnsortedObjectStatus( int otype, int i, int stat );

171
172
  /** For a given object type, returns the name of the i-th array.
    * You must have called RequestInformation before invoking this
173
174
175
176
    * member function.
    */
  const char* GetObjectArrayName( int otype, int i );

177
178
  /** For a given object type, returns the number of components of the i-th
    * array. You must have called RequestInformation before invoking this
179
180
181
182
183
    * member function.
    */
  int GetNumberOfObjectArrayComponents( int otype, int i );

  /** For a given object type, returns the status of the i-th array.
184
    * You must have called RequestInformation before invoking this
185
186
187
188
189
    * member function.
    */
  int GetObjectArrayStatus( int otype, int i );

  /** For a given object type, sets the status of the i-th array.
190
    * You must have called RequestInformation before invoking this
191
192
193
194
195
196
197
    * member function.
    */
  void SetObjectArrayStatus( int otype, int i, int stat );

  /** Unlike object arrays, attributes are only defined over blocks (not sets)
    * and are defined on a per-block (not a per-block-type) basis.
    * In other words, there is no truth table for attributes.
198
    * This means the interface is different because each block can have a
199
200
201
    * different number of attributes with different names.
    */
  int GetNumberOfObjectAttributes( int objectType, int objectIndex );
202
203
  const char* GetObjectAttributeName( int objectType,
                                      int objectIndex,
204
                                      int attributeIndex );
205
206
  int GetObjectAttributeIndex( int objectType,
                               int objectIndex,
207
                               const char* attribName );
208
209
  int GetObjectAttributeStatus( int objectType,
                                int objectIndex,
210
                                int attribIndex );
211
212
  void SetObjectAttributeStatus( int objectType,
                                 int objectIndex,
213
214
215
216
217
218
219
220
221
                                 int attribIndex, int status );

  /// Generate an array containing the block or set ID associated with each cell.
  vtkGetMacro(GenerateObjectIdArray,int);
  vtkSetMacro(GenerateObjectIdArray,int);
  static const char* GetObjectIdArrayName() { return "ObjectId"; }

  vtkSetMacro(GenerateGlobalElementIdArray,int);
  vtkGetMacro(GenerateGlobalElementIdArray,int);
222
  static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
223
224
225

  vtkSetMacro(GenerateGlobalNodeIdArray,int);
  vtkGetMacro(GenerateGlobalNodeIdArray,int);
226
  static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
227

228
229
  vtkSetMacro(GenerateImplicitElementIdArray,int);
  vtkGetMacro(GenerateImplicitElementIdArray,int);
230
  static const char* GetImplicitElementIdArrayName() { return "ImplicitElementId"; }
231
232
233

  vtkSetMacro(GenerateImplicitNodeIdArray,int);
  vtkGetMacro(GenerateImplicitNodeIdArray,int);
234
  static const char* GetImplicitNodeIdArrayName() { return "ImplicitNodeId"; }
235

236
237
238
239
240
  /** Should we generate an array defined over all cells
    * (whether they are members of blocks or sets) indicating the source file?
    */
  vtkSetMacro(GenerateFileIdArray,int);
  vtkGetMacro(GenerateFileIdArray,int);
241
  static const char* GetFileIdArrayName() { return "FileId"; }
242
243
244
245
246

  /// Set/get the number that identifies this file in a series of files (defaults to 0).
  vtkSetMacro(FileId,int);
  vtkGetMacro(FileId,int);

247
248
249
250
  static const char *GetGlobalVariableValuesArrayName()
    { return "GlobalVariableValues"; }
  static const char *GetGlobalVariableNamesArrayName()
    { return "GlobalVariableNames"; }
251
252
253
254
255
256
257
258
259
260
261
262
263

  virtual void SetApplyDisplacements( int d );
  vtkGetMacro(ApplyDisplacements,int);

  virtual void SetDisplacementMagnitude( double s );
  vtkGetMacro(DisplacementMagnitude,double);

  vtkSetMacro(HasModeShapes,int);
  vtkGetMacro(HasModeShapes,int);

  vtkSetMacro(ModeShapeTime,double);
  vtkGetMacro(ModeShapeTime,double);

264
265
266
  vtkSetMacro(AnimateModeShapes, int);
  vtkGetMacro(AnimateModeShapes, int);

267
268
  vtkDataArray* FindDisplacementVectors( int timeStep );

269
  const struct ex_init_params* GetModelParams() const
270
271
272
    { return &this->ModelParameters; }

  /// A struct to hold information about time-varying arrays
273
  struct VTKIOEXODUS_EXPORT ArrayInfoType {
274
275
276
277
278
279
    /// The name of the array
    vtkStdString Name;
    /// The number of components in the array
    int Components;
    /** The type of "glomming" performed.
     * Glomming is the process of aggregating one or more results variable names
280
     * from the Exodus files into a single VTK result variable name with one or
281
282
283
284
     * more components.
     * One of: scalar, vector(2), vector(3), symtensor(6), integrationpoint.
     */
    int GlomType;
285
    /// Storage type of array (a type that can be passed to
286
287
288
289
290
291
    /// vtkDataArray::Create())
    int StorageType;
    /// The source of the array (Result or Attribute)
    int Source;
    /// Whether or not the array should be loaded by RequestData
    int Status;
292
    /// The name of each component of the array as defined by the Exodus file.
293
    /// Empty for generated arrays.
294
    std::vector<vtkStdString> OriginalNames;
295
    /// The index of each component of the array as ordered by the Exodus file.
296
    /// Empty for generated arrays.
297
    std::vector<int> OriginalIndices;
298
299
300
301
302
303
304
305
    /** A map describing which objects the variable is defined on.
     * Each key (a pair<int,int>) is a block/set type and integer
     * offset into the corresponding BlockInfo or SetInfo.
     * Its value is true when the variable is defined on the
     * block/set indicated by the key.
     * Otherwise (if the key is absent from the map or present with a
     * false value), the variable is not defined on that block/set.
     */
306
    std::vector<int> ObjectTruth;
307
308
309
310
311
    /// Clear all the structure members.
    void Reset();
  };

  /// A struct to hold information about Exodus objects (blocks, sets, maps)
312
  struct VTKIOEXODUS_EXPORT ObjectInfoType {
313
314
315
316
317
318
319
320
321
322
323
    /// Number of entries in this block.
    int Size;
    /// Should the reader load this block?
    int Status;
    /// User-assigned identification number
    int Id;
    /// User-assigned name
    vtkStdString Name;
  };

  /// A struct to hold information about Exodus maps
324
  struct VTKIOEXODUS_EXPORT MapInfoType : public ObjectInfoType {
325
326
  };

327
  /// A struct to hold information about Exodus blocks or sets
328
  /// (they have some members in common)
329
  struct VTKIOEXODUS_EXPORT BlockSetInfoType : public ObjectInfoType {
330
331
332
333
334
335
    /// Id (1-based) of first entry in file-local list across all blocks in file
    vtkIdType FileOffset;
    /** A map from nodal IDs in an Exodus file to nodal IDs in the output mesh.
      * Should only be used when SqueezePoints is true.
      * Otherwise, just subtract 1 from any Exodus node ID to get the VTK node ID.
      */
336
    std::map<vtkIdType,vtkIdType> PointMap;
337
338
339
340
    /** A map from nodal ids in the output mesh to those in an Exodus file.
      * Should only be used when SqueezePoints is true.
      * Otherwise, just add 1 to any VTK node ID to get the Exodus node ID.
      */
341
    std::map<vtkIdType,vtkIdType> ReversePointMap;
342
    /** The next vtk ID to use for a connectivity entry when point squeezing is on
343
344
345
346
347
348
      * and no point ID exists.
      */
    vtkIdType NextSqueezePoint;
    /// Cached cell connectivity arrays for mesh
    vtkUnstructuredGrid* CachedConnectivity;

Robert Maynard's avatar
Robert Maynard committed
349
350
    BlockSetInfoType(){this->CachedConnectivity=0;}
    BlockSetInfoType(const BlockSetInfoType& block);
351
    ~BlockSetInfoType();
352
353
354
  };

  /// A struct to hold information about Exodus blocks
355
  struct VTKIOEXODUS_EXPORT BlockInfoType : public BlockSetInfoType {
356
    vtkStdString OriginalName; // useful to reset the name if XML metadata is invalid.
357
358
359
    vtkStdString TypeName;
    // number of boundaries per entry
    // The index is the dimensionality of the entry. 0=node, 1=edge, 2=face
360
    int BdsPerEntry[3];
361
    int AttributesPerEntry;
362
363
    std::vector<vtkStdString> AttributeNames;
    std::vector<int> AttributeStatus;
364
    // VTK cell type (a function of TypeName and BdsPerEntry...)
365
366
    int CellType;
    // Number of points per cell as used by VTK
367
    // -- not what's in the file (i.e., BdsPerEntry[0] >= PointsPerCell)
Robert Maynard's avatar
Robert Maynard committed
368
    int PointsPerCell;
369
370
371
372
  };

  /// A struct to hold information about Exodus blocks
  struct PartInfoType : public ObjectInfoType {
373
    std::vector<int> BlockIndices;
374
375
  };
  struct AssemblyInfoType : public ObjectInfoType {
376
    std::vector<int> BlockIndices;
377
378
  };
  struct MaterialInfoType : public ObjectInfoType {
379
    std::vector<int> BlockIndices;
380
381
382
383
  };

  /// A struct to hold information about Exodus sets
  struct SetInfoType : public BlockSetInfoType {
384
    int DistFact;     // Number of distribution factors
385
386
387
                      // (for the entire block, not per array or entry)
  };

388
  /// Tags to indicate how single-component Exodus arrays are glommed
389
390
391
392
393
  /// (aggregated) into multi-component VTK arrays.
  enum GlomTypes {
    Scalar=0,          //!< The array is a scalar
    Vector2=1,         //!< The array is a 2-D vector
    Vector3=2,         //!< The array is a 3-D vector
394
    SymmetricTensor=3, //!< The array is a symmetric tensor
395
396
397
398
399
400
                       //   (order xx, yy, zz, xy, yz, zx)
    IntegrationPoint=4 //!< The array is a set of integration point values
  };

  /// Tags to indicate the source of values for an array.
  enum ArraySourceTypes {
401
    Result=0,        //!< The array is composed of results variables
402
                     //   (that vary over time)
403
    Attribute=1,     //!< The array is composed of attributes
404
405
406
407
408
409
410
                     //   (constants over time)
    Map=2,           //!< The array has a corresponding entry in MapInfo
    Generated=3      //!< The array is procedurally generated (e.g., BlockId)
  };

  /// Time stamp from last time we were in RequestInformation
  vtkTimeStamp InformationTimeStamp;
411

412
  friend class vtkExodusIIReader;
413
  friend class vtkPExodusIIReader;
414

415
416
  virtual void SetParser( vtkExodusIIReaderParser* );
  vtkGetObjectMacro(Parser,vtkExodusIIReaderParser);
417
418

  // Because Parts, Materials, and assemblies are not stored as arrays,
419
  // but rather as maps to the element blocks they make up,
420
421
422
423
424
425
426
427
428
  // we cannot use the Get|SetObject__() methods directly.

  int GetNumberOfParts();
  const char* GetPartName(int idx);
  const char* GetPartBlockInfo(int idx);
  int GetPartStatus(int idx);
  int GetPartStatus(vtkStdString name);
  void SetPartStatus(int idx, int on);
  void SetPartStatus(vtkStdString name, int flag);
429

430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
  int GetNumberOfMaterials();
  const char* GetMaterialName(int idx);
  int GetMaterialStatus(int idx);
  int GetMaterialStatus(vtkStdString name);
  void SetMaterialStatus(int idx, int on);
  void SetMaterialStatus(vtkStdString name, int flag);

  int GetNumberOfAssemblies();
  const char* GetAssemblyName(int idx);
  int GetAssemblyStatus(int idx);
  int GetAssemblyStatus(vtkStdString name);
  void SetAssemblyStatus(int idx, int on);
  void SetAssemblyStatus(vtkStdString name, int flag);

  void SetFastPathObjectType(vtkExodusIIReader::ObjectType type)
    {this->FastPathObjectType = type;};
  void SetFastPathObjectId(vtkIdType id){this->FastPathObjectId = id;};
  vtkSetStringMacro(FastPathIdType);

  bool IsXMLMetadataValid();

  /** For a given object type, looks for an object in the collection
452
    * of initial objects of the same name, or if the name is empty, then of
453
    * the same id as "info". If found, info's Status is set to the status of
454
455
    * the found object.
    * You DO NOT need to have called RequestInformation before invoking this
456
457
458
459
460
    * member function.
    */
  void GetInitialObjectStatus( int otype, ObjectInfoType *info );

  /** For a given array type, looks for an object in the collection
461
    * of initial objects of the same name, or if the name is empty, then of
462
    * the same id as "info". If found, info's Status is set to the status of
463
464
    * the found object.
    * You DO NOT need to have called RequestInformation before invoking this
465
466
467
468
469
    * member function.
    */
  void GetInitialObjectArrayStatus( int otype, ArrayInfoType *info );

  /** For a given object type, creates and stores an ObjectInfoType
470
    * object using the given name and status. If the name contains a "ID: %d"
471
    * substring, then it is used to initialize the ObjectInfoType.Id value.
472
    * You DO NOT need to have called RequestInformation before invoking this
473
474
475
476
477
478
    * member function.
    */
  void SetInitialObjectStatus( int otype, const char *name, int stat );

  /** For a given array type, creates and stores an ArrayInfoType
    * object using the given name and status.
479
    * You DO NOT need to have called RequestInformation before invoking this
480
481
482
483
484
485
    * member function.
    */
  void SetInitialObjectArrayStatus( int otype, const char *name, int stat );

  int UpdateTimeInformation();

486
487
  bool ProducedFastPathOutput;

488
489
490
491
protected:
  vtkExodusIIReaderPrivate();
  ~vtkExodusIIReaderPrivate();

492
493
494
  /// Build SIL. This must be called only after RequestInformation().
  void BuildSIL();

495
  /// Returns true when order and text of names are consistent with integration
496
  /// points. Called from GlomArrayNames().
497
498
499
500
  int VerifyIntegrationPointGlom( int nn,
                                  char** np,
                                  vtksys::RegularExpression& re,
                                  vtkStdString& field,
501
502
503
                                  vtkStdString& ele );

  /// Aggregate Exodus array names into VTK arrays with multiple components
504
505
506
507
  void GlomArrayNames( int i,
                       int num_obj,
                       int num_vars,
                       char** var_names,
508
509
510
511
512
513
514
                       int* truth_tab );

  /// Add generated array information to array info lists.
  void PrepareGeneratedArrayInfo();

  /** Read connectivity information and populate an unstructured grid with cells corresponding to a single block or set.
    *
515
    * If the connectivity hasn't changed since the last time RequestData was
516
    * called, this copies a cache to the output.
517
    *
518
519
    * Otherwise, this routine iterates over all block and set types.
    * For each type, it iterates over all objects of that type.
520
    * For each object whose status is 1, it reads that object's connectivity
521
    * entries from cache or disk and inserts cells into CachedConnectivity.
522
    * If SqueezePoints is on, then connectivity entries are translated as
523
524
    * required and PointMap is populated.
    * Finally, CachedConnectivity is shallow-copied to the output.
525
    *
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
    * AssembleOutputConnectivity returns 1 if cache was used, 0 otherwise.
    */
  int AssembleOutputConnectivity( vtkIdType timeStep,
    int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop,
    vtkUnstructuredGrid* output );
  /** Fill the output grid's point coordinates array.
    * Returns 1 on success, 0 on failure.
    * Failure occurs when the Exodus library is unable to read the point
    * coordindates array. This can be caused when there is not enough memory
    * or there is a file I/O problem.
    */
  int AssembleOutputPoints( vtkIdType timeStep,
    BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
  /** Add the requested arrays to the output grid's point data.
    * This adds time-varying results arrays to the grid's vtkPointData object.
    */
  int AssembleOutputPointArrays( vtkIdType timeStep,
    BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
  /** Add the requested arrays to the output grid's cell data.
    * This adds time-varying results arrays to the grid's vtkCellData object.
    */
  int AssembleOutputCellArrays( vtkIdType timeStep,
    int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
  /** Add procedurally generated arrays to an output mesh.
550
    * Currently, the only array that is procedurally generated is the object id
551
552
    * array. Others may be added in the future.
    */
553
  int AssembleOutputProceduralArrays( vtkIdType timeStep,
554
555
556
557
558
    int otyp, int oidx, vtkUnstructuredGrid* output );
  /// Add mesh-global field data such as QA records to the output mesh.
  int AssembleOutputGlobalArrays( vtkIdType timeStep,
    int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
  /** Add maps to an output mesh.
559
    * Maps are special integer arrays that may serve as GlobalId fields in
560
561
562
563
564
565
566
567
568
569
    * vtkDataSetAttributes objects.
    * Maps may be procedurally generated if no map is contained in a file.
    * Maps are not time-varying.
    */
  int AssembleOutputPointMaps( vtkIdType timeStep,
    BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
  int AssembleOutputCellMaps( vtkIdType timeStep,
    int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
  /** Add fast-path time-varying data to field data of an output block or set.
    */
570
  int AssembleArraysOverTime(vtkMultiBlockDataSet* output);
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595

  /// Insert cells from a specified block into a mesh
  void InsertBlockCells(
    int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop );

  /// Insert cells from a specified set into a mesh
  void InsertSetCells(
    int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop );

  /// Add a point array to an output grid's point data, squeezing if necessary
  void AddPointArray(
    vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );

  /// Insert cells referenced by a node set.
  void InsertSetNodeCopies(
    vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );

  /// Insert cells referenced by an edge, face, or element set.
  void InsertSetCellCopies(
    vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );

  /// Insert cells referenced by a side set.
  void InsertSetSides(
    vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );

596
  /** Return an array for the specified cache key. If the array was not cached,
597
    * read it from the file.
598
    * This function can still return 0 if you are foolish enough to request an
599
600
601
602
603
    * array not present in the file, grasshopper.
    */
  vtkDataArray* GetCacheOrRead( vtkExodusIICacheKey );

  /** Return the index of an object type (in a private list of all object types).
604
    * This returns a 0-based index if the object type was found and -1 if it
605
606
607
608
609
    * was not.
    */
  int GetConnTypeIndexFromConnType( int ctyp );

  /** Return the index of an object type (in a private list of all object types).
610
    * This returns a 0-based index if the object type was found and -1 if it
611
612
613
614
615
    * was not.
    */
  int GetObjectTypeIndexFromObjectType( int otyp );

  /** Return the number of objects of the given type.
616
617
    * The integer typeIndex is not the type of the object (e.g., EX_ELEM_BLOCK),
    * but is rather the index into the list of all object types
618
619
620
621
622
    * (see obj_types in vtkExodusIIReader.cxx).
    */
  int GetNumberOfObjectsAtTypeIndex( int typeIndex );

  /** Return a pointer to the ObjectInfo of the specified type and index.
623
624
625
626
    * The integer typeIndex is not the type of the object (e.g., EX_ELEM_BLOCK),
    * but is rather the index into the list of all object types (see obj_types
    * in vtkExodusIIReader.cxx). The integer objectIndex is not the ID of the
    * object (i.e., the ID stored in the Exodus file), but is rather the index
627
628
629
630
    * into the list of all objects of the given type.
    */
  ObjectInfoType* GetObjectInfo( int typeIndex, int objectIndex );

631
632
633
634
  /** Return a pointer to the ObjectInfo of the specified type and index, but
    * using indices sorted by object ID. This is the same as GetObjectInfo()
    * except that it uses the SortedObjectIndices member to permute the
    * requested \a objectIndex and it takes an object type (e.g., EX_ELEM_BLOCK)
635
636
637
638
    * rather than an object type index.
    */
  ObjectInfoType* GetSortedObjectInfo( int objectType, int objectIndex );

639
640
641
642
  /** Return a pointer to the ObjectInfo of the specified type and index, but
    * using indices sorted by object ID. This is the same as
    * GetSortedObjectInfo() except that \a objectIndex directly indexes the
    * object info array rather SortedObjectIndices, and it takes an object
643
644
645
646
    * type (e.g., EX_ELEM_BLOCK) rather than an object type index.
    */
  ObjectInfoType* GetUnsortedObjectInfo( int objectType, int objectIndex );

647
  /** Get the index of the block containing the entity referenced by the
648
649
650
651
652
    * specified file-global ID.
    * In this case, an entity is an edge, face, or element.
    */
  int GetBlockIndexFromFileGlobalId( int otyp, int refId );

653
  /** Get the block containing the entity referenced by the specified
654
655
656
657
658
    * file-global ID.
    * In this case, an entity is an edge, face, or element.
    */
  BlockInfoType* GetBlockFromFileGlobalId( int otyp, int refId );

659
  /** Find or create a new SqueezePoint ID (unique sequential list of points
660
661
662
663
664
665
666
    * referenced by cells in blocks/sets with Status == 1)
    */
  vtkIdType GetSqueezePointId( BlockSetInfoType* bsinfop, int i );

  /// Determine the VTK cell type for a given edge/face/element block
  void DetermineVtkCellType( BlockInfoType& binfo );

667
  /** Find an ArrayInfo object for a specific object type using the name
668
669
670
671
    *  as a key.
    */
  ArrayInfoType* FindArrayInfoByName( int otyp, const char* name );

672
  /** Does the specified object type match? Avoid using these... they aren't
673
674
675
676
677
678
    * robust against new types being implemented.
    */
  int IsObjectTypeBlock( int otyp );
  int IsObjectTypeSet( int otyp );
  int IsObjectTypeMap( int otyp );

679
  /** Given a map type (NODE_MAP, EDGE_MAP, ...) return the associated object
680
681
682
683
684
685
    * type (NODAL, EDGE_BLOCK, ...) or vice-versa.
    */
  int GetObjectTypeFromMapType( int mtyp );
  int GetMapTypeFromObjectType( int otyp );
  int GetTemporalTypeFromObjectType( int otyp );

686
  /** Given a set connectivity type (NODE_SET_CONN, ...), return the associated
687
688
689
690
    * object type (NODE_SET, ...) or vice-versa.
    */
  int GetSetTypeFromSetConnType( int sctyp );

691
  /** Given a block type (EDGE_BLOCK, ...), return the associated block
692
693
694
695
696
    * connectivity type (EDGE_BLOCK_CONN, ...) or vice-versa.
    */
  int GetBlockConnTypeFromBlockType( int btyp );

  /** Function to trim space from names retrieved with ex_get_var_names.
697
   * This was added because some meshes had displacement arrays named
698
699
700
701
702
703
704
705
   * "DISPX ", "DISPY ", "DISPZ " (note trailing spaces),
   * which prevented glomming and use of the vector field for displacements.
   */
  void RemoveBeginningAndTrailingSpaces( int len, char **names );

  /// Delete any cached connectivity information (for all blocks and sets)
  void ClearConnectivityCaches();

706
  /** Maps a block type (EX_ELEM_BLOCK, EX_FACE_BLOCK, ...) to a list of blocks
707
708
    * of that type.
    */
709
  std::map<int,std::vector<BlockInfoType> > BlockInfo;
710
  /** Maps a set type (EX_ELEM_SET, ..., EX_NODE_SET) to a list of sets of
711
712
    *  that type.
    */
713
  std::map<int,std::vector<SetInfoType> > SetInfo;
714
715
716
  /** Maps a map type (EX_ELEM_MAP, ..., EX_NODE_MAP) to a list of maps of that
    * type. In old-style files, the only entries will be a single node and a
    * single element map which have no specified ID number or name. In that
717
718
    * case, an ID of 0 and a name of "Default" will be given to both.
    */
719
  std::map<int,std::vector<MapInfoType> > MapInfo;
720

721
722
723
  std::vector<PartInfoType> PartInfo;
  std::vector<MaterialInfoType> MaterialInfo;
  std::vector<AssemblyInfoType> AssemblyInfo;
724

725
726
  /** Maps an object type to vector of indices that reorder objects of that
    * type by their IDs. This is used by the user interface to access blocks,
727
728
    * sets, and maps in ascending order. It is not used internally.
    */
729
  std::map<int,std::vector<int> > SortedObjectIndices;
730
  /// Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of arrays
731
  //  defined on that type.
732
  std::map<int,std::vector<ArrayInfoType> > ArrayInfo;
733
734

  /** Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of arrays
735
    * defined on that type. Used to store initial status of arrays before
736
737
    * RequestInformation can be called.
    */
738
  std::map<int,std::vector<ArrayInfoType> > InitialArrayInfo;
739

740
741
  /** Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of objects
    * defined on that type. Used to store initial status of objects before
742
743
    * RequestInformation can be called.
    */
744
  std::map<int,std::vector<ObjectInfoType> > InitialObjectInfo;
745
746
747
748
749

  /// These aren't the variables you're looking for.
  int AppWordSize;
  int DiskWordSize;

750
  /** The version of Exodus that wrote the currently open file (or a negative
751
752
753
754
755
756
757
758
759
760
761
    * number otherwise).
    */
  float ExodusVersion;

  /// The handle of the currently open file.
  int Exoid;

  /// Parameters describing the currently open Exodus file.
  struct ex_init_params ModelParameters;

  /// A list of time steps for which results variables are stored.
762
  std::vector<double> Times;
763
764
765
766

  /// The current time step
  int TimeStep;

767
  /** The time value. This is used internally when HasModeShapes is true and
768
769
770
771
772
773
774
775
776
    * ignored otherwise.
    */
  double ModeShapeTime;

  int GenerateObjectIdArray;
  int GenerateGlobalIdArray;
  int GenerateFileIdArray;
  int GenerateGlobalElementIdArray;
  int GenerateGlobalNodeIdArray;
777
778
  int GenerateImplicitElementIdArray;
  int GenerateImplicitNodeIdArray;
779
780
781
782
783
784
785
786

  /** Defaults to 0. Set by vtkPExodusIIReader on each entry of ReaderList.
    * Used to generate the file ID array over all output cells.
    */
  int FileId;

  /// A least-recently-used cache to hold raw arrays.
  vtkExodusIICache* Cache;
787
788
789
  //
  /// The size of the cache in MiB.
  double CacheSize;
790
791
792
793

  int ApplyDisplacements;
  float DisplacementMagnitude;
  int HasModeShapes;
794
  int AnimateModeShapes;
795

796
797
798
799
800
801
802
  /** Should the reader output only points used by elements in the output mesh,
    * or all the points. Outputting all the points is much faster since the
    * point array can be read straight from disk and the mesh connectivity need
    * not be altered. Squeezing the points down to the minimum set needed to
    * produce the output mesh is useful for glyphing and other point-based
    * operations. On large parallel datasets, loading all the points implies
    * loading all the points on all processes and performing subsequent
803
804
    * filtering on a much larger set.
    *
Kyle Lutz's avatar
Kyle Lutz committed
805
    * By default, SqueezePoints is true for backwards compatibility.
806
807
808
    */
  int SqueezePoints;

809
  /** Pointer to owning reader... this is not registered in order to avoid
810
811
812
813
    * circular references.
    */
  vtkExodusIIReader* Parent;

814
  vtkExodusIIReaderParser* Parser;
815
816
817
818
819

  vtkExodusIIReader::ObjectType FastPathObjectType;
  vtkIdType FastPathObjectId;
  char* FastPathIdType;

820
  vtkMutableDirectedGraph* SIL;
821
822
823
824
825
826
private:
  vtkExodusIIReaderPrivate( const vtkExodusIIReaderPrivate& ); // Not implemented.
  void operator = ( const vtkExodusIIReaderPrivate& ); // Not implemented.
};

#endif // __vtkExodusIIReaderPrivate_h
827
// VTK-HeaderTest-Exclude: vtkExodusIIReaderPrivate.h