1 #ifndef vtkExodusIIReaderPrivate_h 2 #define vtkExodusIIReaderPrivate_h 3 #ifndef __VTK_WRAP__ 4 #ifndef VTK_WRAPPING_CXX 5 6 // Do not include this file directly. It is only for use 7 // from inside the ExodusII reader and its descendants. 8 9 #include "vtkDeprecation.h" // for deprecation macros 10 #include "vtkExodusIICache.h" // for vtkExodusIICacheKey 11 #include "vtkExodusIIReader.h" // for vtkExodusIIReader 12 #include "vtkObject.h" 13 #include "vtkStdString.h" // for vtkStdString 14 #include "vtksys/RegularExpression.hxx" // for vtksys::RegularExpression 15 16 #include <map> // for std::map 17 #include <vector> // for std::vector 18 19 #include "vtkIOExodusModule.h" // For export macro 20 #include "vtk_exodusII.h" // for exodus APIs 21 class vtkDataArray; 22 class vtkExodusIIReaderParser; 23 class vtkIdTypeArray; 24 class vtkMultiBlockDataSet; 25 class vtkMutableDirectedGraph; 26 class vtkTypeInt64Array; 27 class vtkUnstructuredGrid; 28 29 /** This class holds metadata for an Exodus file. 30 * 31 */ 32 class VTKIOEXODUS_EXPORT vtkExodusIIReaderPrivate : public vtkObject 33 { 34 public: 35 static vtkExodusIIReaderPrivate* New(); 36 VTK_DEPRECATED_IN_9_1_0("Renamed to PrintSelf") PrintData(ostream & os,vtkIndent indent)37 void PrintData(ostream& os, vtkIndent indent) { this->PrintSelf(os, indent); } 38 void PrintSelf(ostream& os, vtkIndent indent) override; 39 vtkTypeMacro(vtkExodusIIReaderPrivate, vtkObject); 40 // virtual void Modified(); 41 42 /// Open an ExodusII file for reading. Returns 0 on success. 43 int OpenFile(const char* filename); 44 45 /// Close any ExodusII file currently open for reading. Returns 0 on success. 46 int CloseFile(); 47 48 /// Get metadata for an open file with handle \a exoid. 49 int RequestInformation(); 50 51 /// Returns the SIL. This valid only after BuildSIL() has been called. GetSIL()52 vtkMutableDirectedGraph* GetSIL() { return this->SIL; } 53 54 /// Read requested data and store in unstructured grid. 55 int RequestData(vtkIdType timeStep, vtkMultiBlockDataSet* output); 56 57 /** Description: 58 * Prepare a data set with the proper structure and arrays but no cells. 59 * This is used by the parallel reader when a process has no files assigned to it. 60 */ 61 int SetUpEmptyGrid(vtkMultiBlockDataSet* output); 62 63 /** Reset the class so that another file may be read. 64 * This does not change any user-specified parameters, such as 65 * which <b>generated</b> arrays should be present, whether there are 66 * mode shapes or time steps, etc. 67 * Note that which arrays should be loaded is a more delicate 68 * issue; if you set these after RequestInformation has been called, 69 * these will not be saved. 70 * Any settings you make <b>before</b> RequestInformation is called 71 * will be saved because they are stored in InitialArrayInfo and 72 * InitialObjectInfo. 73 */ 74 void Reset(); 75 76 /** Return user-specified variables to their default values. 77 * Calling ResetSettings() and then Reset() will return the class 78 * to a state just like it was after New() was called. 79 */ 80 void ResetSettings(); 81 82 /// Clears out any data in the cache and restores it to its initial state. 83 void ResetCache(); 84 85 /// Set the size of the cache in MiB. 86 void SetCacheSize(double size); 87 88 /// Get the size of the cache in MiB. 89 vtkGetMacro(CacheSize, double); 90 91 /** Return the number of time steps in the open file. 92 * You must have called RequestInformation() before 93 * invoking this member function. 94 */ GetNumberOfTimeSteps()95 int GetNumberOfTimeSteps() { return (int)this->Times.size(); } 96 97 /// Return whether subsequent RequestData() calls will produce the minimal 98 /// point set required to represent the output. 99 vtkGetMacro(SqueezePoints, int); 100 101 /// Set whether subsequent RequestData() calls will produce the minimal 102 /// point set required to represent the output. 103 void SetSqueezePoints(int sp); 104 105 /// Convenience routines that for producing (or not) the minimal point set 106 /// required to represent the output. 107 vtkBooleanMacro(SqueezePoints, int); 108 109 /// Return the number of nodes in the output (depends on SqueezePoints) 110 int GetNumberOfNodes(); 111 112 /** Returns the number of objects of a given type (e.g., EX_ELEM_BLOCK, 113 * EX_NODE_SET, ...). You must have called RequestInformation before 114 * invoking this member function. 115 */ 116 int GetNumberOfObjectsOfType(int otype); 117 118 /** Returns the number of arrays defined over objects of a given type 119 * (e.g., EX_ELEM_BLOCK, EX_NODE_SET, ...). 120 * You must have called RequestInformation before invoking this 121 * member function. 122 * 123 * N.B.: This method will eventually disappear. Really, what we should be 124 * providing is an interface to query the arrays defined on a particular 125 * object, not a class of objects. However, until the reader 126 * outputs multiblock datasets, we can't be that specific. 127 */ 128 int GetNumberOfObjectArraysOfType(int otype); 129 130 /** For a given object type, returns the name of the i-th object. 131 * You must have called RequestInformation before invoking this 132 * member function. 133 */ 134 const char* GetObjectName(int otype, int i); 135 136 /** For a given object type, return the user-assigned ID of the i-th object. 137 * You must have called RequestInformation before invoking this 138 * member function. 139 */ 140 int GetObjectId(int otype, int i); 141 142 /** For a given object type, return the size of the i-th object. 143 * The size is the number of entries. 144 * As an example, for an element block, it is the number of elements. 145 * You must have called RequestInformation before invoking this 146 * member function. 147 */ 148 int GetObjectSize(int otype, int i); 149 150 /** For a given object type, returns the status of the i-th object. 151 * You must have called RequestInformation before invoking this 152 * member function. 153 */ 154 int GetObjectStatus(int otype, int i); 155 156 /** For a given object type, returns the status of the i-th object, where i is 157 * an index into the unsorted object array. 158 * You must have called RequestInformation before invoking this 159 * member function. 160 */ 161 int GetUnsortedObjectStatus(int otype, int i); 162 163 /** For a given object type, sets the status of the i-th object. 164 * You must have called RequestInformation before invoking this 165 * member function. 166 */ 167 void SetObjectStatus(int otype, int i, int stat); 168 169 /** For a given object type, sets the status of the i-th object, 170 * where i is an index into the *unsorted* object array. 171 * You must have called RequestInformation before invoking this 172 * member function. 173 */ 174 void SetUnsortedObjectStatus(int otype, int i, int stat); 175 176 /** For a given object type, returns the name of the i-th array. 177 * You must have called RequestInformation before invoking this 178 * member function. 179 */ 180 const char* GetObjectArrayName(int otype, int i); 181 182 /** For a given object type, returns the number of components of the i-th 183 * array. You must have called RequestInformation before invoking this 184 * member function. 185 */ 186 int GetNumberOfObjectArrayComponents(int otype, int i); 187 188 /** For a given object type, returns the status of the i-th array. 189 * You must have called RequestInformation before invoking this 190 * member function. 191 */ 192 int GetObjectArrayStatus(int otype, int i); 193 194 /** For a given object type, sets the status of the i-th array. 195 * You must have called RequestInformation before invoking this 196 * member function. 197 */ 198 void SetObjectArrayStatus(int otype, int i, int stat); 199 200 /** Unlike object arrays, attributes are only defined over blocks (not sets) 201 * and are defined on a per-block (not a per-block-type) basis. 202 * In other words, there is no truth table for attributes. 203 * This means the interface is different because each block can have a 204 * different number of attributes with different names. 205 */ 206 int GetNumberOfObjectAttributes(int objectType, int objectIndex); 207 const char* GetObjectAttributeName(int objectType, int objectIndex, int attributeIndex); 208 int GetObjectAttributeIndex(int objectType, int objectIndex, const char* attribName); 209 int GetObjectAttributeStatus(int objectType, int objectIndex, int attribIndex); 210 void SetObjectAttributeStatus(int objectType, int objectIndex, int attribIndex, int status); 211 212 /// Generate an array containing the block or set ID associated with each cell. 213 vtkGetMacro(GenerateObjectIdArray, vtkTypeBool); 214 vtkSetMacro(GenerateObjectIdArray, vtkTypeBool); GetObjectIdArrayName()215 static const char* GetObjectIdArrayName() { return "ObjectId"; } 216 217 vtkSetMacro(GenerateGlobalElementIdArray, vtkTypeBool); 218 vtkGetMacro(GenerateGlobalElementIdArray, vtkTypeBool); GetGlobalElementIdArrayName()219 static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; } 220 221 vtkSetMacro(GenerateGlobalNodeIdArray, vtkTypeBool); 222 vtkGetMacro(GenerateGlobalNodeIdArray, vtkTypeBool); GetGlobalNodeIdArrayName()223 static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; } 224 225 vtkSetMacro(GenerateImplicitElementIdArray, vtkTypeBool); 226 vtkGetMacro(GenerateImplicitElementIdArray, vtkTypeBool); GetImplicitElementIdArrayName()227 static const char* GetImplicitElementIdArrayName() { return "ImplicitElementId"; } 228 229 vtkSetMacro(GenerateImplicitNodeIdArray, vtkTypeBool); 230 vtkGetMacro(GenerateImplicitNodeIdArray, vtkTypeBool); GetImplicitNodeIdArrayName()231 static const char* GetImplicitNodeIdArrayName() { return "ImplicitNodeId"; } 232 233 /** Should we generate an array defined over all cells 234 * (whether they are members of blocks or sets) indicating the source file? 235 */ 236 vtkSetMacro(GenerateFileIdArray, vtkTypeBool); 237 vtkGetMacro(GenerateFileIdArray, vtkTypeBool); GetFileIdArrayName()238 static const char* GetFileIdArrayName() { return "FileId"; } 239 240 /// Set/get the number that identifies this file in a series of files (defaults to 0). 241 vtkSetMacro(FileId, int); 242 vtkGetMacro(FileId, int); 243 GetGlobalVariableValuesArrayName()244 static const char* GetGlobalVariableValuesArrayName() { return "GlobalVariableValues"; } GetGlobalVariableNamesArrayName()245 static const char* GetGlobalVariableNamesArrayName() { return "GlobalVariableNames"; } 246 247 virtual void SetApplyDisplacements(vtkTypeBool d); 248 vtkGetMacro(ApplyDisplacements, vtkTypeBool); 249 250 virtual void SetDisplacementMagnitude(double s); 251 vtkGetMacro(DisplacementMagnitude, double); 252 253 vtkSetMacro(HasModeShapes, int); 254 vtkGetMacro(HasModeShapes, int); 255 256 vtkSetMacro(ModeShapeTime, double); 257 vtkGetMacro(ModeShapeTime, double); 258 259 vtkSetMacro(AnimateModeShapes, int); 260 vtkGetMacro(AnimateModeShapes, int); 261 262 vtkSetMacro(IgnoreFileTime, bool); 263 vtkGetMacro(IgnoreFileTime, bool); 264 265 vtkDataArray* FindDisplacementVectors(int timeStep); 266 GetModelParams()267 const struct ex_init_params* GetModelParams() const { return &this->ModelParameters; } 268 269 /// A struct to hold information about time-varying arrays 270 struct VTKIOEXODUS_EXPORT ArrayInfoType 271 { 272 /// The name of the array 273 vtkStdString Name; 274 /// The number of components in the array 275 int Components; 276 /** The type of "glomming" performed. 277 * Glomming is the process of aggregating one or more results variable names 278 * from the Exodus files into a single VTK result variable name with one or 279 * more components. 280 * One of: scalar, vector(2), vector(3), symtensor(6), integrationpoint. 281 */ 282 int GlomType; 283 /// Storage type of array (a type that can be passed to 284 /// vtkDataArray::Create()) 285 int StorageType; 286 /// The source of the array (Result or Attribute) 287 int Source; 288 /// Whether or not the array should be loaded by RequestData 289 int Status; 290 /// The name of each component of the array as defined by the Exodus file. 291 /// Empty for generated arrays. 292 std::vector<vtkStdString> OriginalNames; 293 /// The index of each component of the array as ordered by the Exodus file. 294 /// Empty for generated arrays. 295 std::vector<int> OriginalIndices; 296 /** A map describing which objects the variable is defined on. 297 * Each key (a pair<int,int>) is a block/set type and integer 298 * offset into the corresponding BlockInfo or SetInfo. 299 * Its value is true when the variable is defined on the 300 * block/set indicated by the key. 301 * Otherwise (if the key is absent from the map or present with a 302 * false value), the variable is not defined on that block/set. 303 */ 304 std::vector<int> ObjectTruth; 305 /// Clear all the structure members. 306 void Reset(); 307 }; 308 309 /// A struct to hold information about Exodus objects (blocks, sets, maps) 310 struct VTKIOEXODUS_EXPORT ObjectInfoType 311 { 312 /// Number of entries in this block. 313 int Size; 314 /// Should the reader load this block? 315 int Status; 316 /// User-assigned identification number 317 int Id; 318 /// User-assigned name 319 vtkStdString Name; 320 }; 321 322 /// A struct to hold information about Exodus maps 323 struct VTKIOEXODUS_EXPORT MapInfoType : public ObjectInfoType 324 { 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 /// Id (1-based) of first entry in file-local list across all blocks in file 332 vtkIdType FileOffset; 333 /** A map from nodal IDs in an Exodus file to nodal IDs in the output mesh. 334 * Should only be used when SqueezePoints is true. 335 * Otherwise, just subtract 1 from any Exodus node ID to get the VTK node ID. 336 */ 337 std::map<vtkIdType, vtkIdType> PointMap; 338 /** A map from nodal ids in the output mesh to those in an Exodus file. 339 * Should only be used when SqueezePoints is true. 340 * Otherwise, just add 1 to any VTK node ID to get the Exodus node ID. 341 */ 342 std::map<vtkIdType, vtkIdType> ReversePointMap; 343 /** The next vtk ID to use for a connectivity entry when point squeezing is on 344 * and no point ID exists. 345 */ 346 vtkIdType NextSqueezePoint; 347 /// Cached cell connectivity arrays for mesh 348 vtkUnstructuredGrid* CachedConnectivity; 349 BlockSetInfoTypeBlockSetInfoType350 BlockSetInfoType() { this->CachedConnectivity = nullptr; } 351 BlockSetInfoType(const BlockSetInfoType& block); 352 ~BlockSetInfoType(); 353 BlockSetInfoType& operator=(const BlockSetInfoType& block); 354 }; 355 356 /// A struct to hold information about Exodus blocks 357 struct VTKIOEXODUS_EXPORT BlockInfoType : public BlockSetInfoType 358 { 359 vtkStdString OriginalName; // useful to reset the name if XML metadata is invalid. 360 vtkStdString TypeName; 361 // number of boundaries per entry 362 // The index is the dimensionality of the entry. 0=node, 1=edge, 2=face 363 int BdsPerEntry[3]; 364 vtkIdType AttributesPerEntry; 365 std::vector<vtkStdString> AttributeNames; 366 std::vector<int> AttributeStatus; 367 // VTK cell type (a function of TypeName and BdsPerEntry...) 368 int CellType; 369 // Number of points per cell as used by VTK 370 // -- not what's in the file (i.e., BdsPerEntry[0] >= PointsPerCell) 371 int PointsPerCell; 372 }; 373 374 /// A struct to hold information about Exodus blocks 375 struct PartInfoType : public ObjectInfoType 376 { 377 std::vector<int> BlockIndices; 378 }; 379 struct AssemblyInfoType : public ObjectInfoType 380 { 381 std::vector<int> BlockIndices; 382 }; 383 struct MaterialInfoType : public ObjectInfoType 384 { 385 std::vector<int> BlockIndices; 386 }; 387 388 /// A struct to hold information about Exodus sets 389 struct SetInfoType : public BlockSetInfoType 390 { 391 int DistFact; // Number of distribution factors 392 // (for the entire block, not per array or entry) 393 }; 394 395 /// Tags to indicate how single-component Exodus arrays are glommed 396 /// (aggregated) into multi-component VTK arrays. 397 enum GlomTypes 398 { 399 Scalar = 0, //!< The array is a scalar 400 Vector2 = 1, //!< The array is a 2-D vector 401 Vector3 = 2, //!< The array is a 3-D vector 402 SymmetricTensor = 3, //!< The array is a symmetric tensor 403 // (order xx, yy, zz, xy, yz, zx) 404 IntegrationPoint = 4 //!< The array is a set of integration point values 405 }; 406 407 /// Tags to indicate the source of values for an array. 408 enum ArraySourceTypes 409 { 410 Result = 0, //!< The array is composed of results variables 411 // (that vary over time) 412 Attribute = 1, //!< The array is composed of attributes 413 // (constants over time) 414 Map = 2, //!< The array has a corresponding entry in MapInfo 415 Generated = 3 //!< The array is procedurally generated (e.g., BlockId) 416 }; 417 418 /// Time stamp from last time we were in RequestInformation 419 vtkTimeStamp InformationTimeStamp; 420 421 friend class vtkExodusIIReader; 422 friend class vtkPExodusIIReader; 423 424 virtual void SetParser(vtkExodusIIReaderParser*); 425 vtkGetObjectMacro(Parser, vtkExodusIIReaderParser); 426 427 // BUG #15632: This method allows vtkPExodusIIReader to pass time information 428 // from one spatial file to another and avoiding have to read it for each of 429 // the files. SetTimesOverrides(const std::vector<double> & times)430 void SetTimesOverrides(const std::vector<double>& times) 431 { 432 this->Times = times; 433 this->SkipUpdateTimeInformation = true; 434 } 435 436 // Because Parts, Materials, and assemblies are not stored as arrays, 437 // but rather as maps to the element blocks they make up, 438 // we cannot use the Get|SetObject__() methods directly. 439 440 int GetNumberOfParts(); 441 const char* GetPartName(int idx); 442 const char* GetPartBlockInfo(int idx); 443 int GetPartStatus(int idx); 444 int GetPartStatus(const vtkStdString& name); 445 void SetPartStatus(int idx, int on); 446 void SetPartStatus(const vtkStdString& name, int flag); 447 448 int GetNumberOfMaterials(); 449 const char* GetMaterialName(int idx); 450 int GetMaterialStatus(int idx); 451 int GetMaterialStatus(const vtkStdString& name); 452 void SetMaterialStatus(int idx, int on); 453 void SetMaterialStatus(const vtkStdString& name, int flag); 454 455 int GetNumberOfAssemblies(); 456 const char* GetAssemblyName(int idx); 457 int GetAssemblyStatus(int idx); 458 int GetAssemblyStatus(const vtkStdString& name); 459 void SetAssemblyStatus(int idx, int on); 460 void SetAssemblyStatus(const vtkStdString& name, int flag); 461 SetFastPathObjectType(vtkExodusIIReader::ObjectType type)462 void SetFastPathObjectType(vtkExodusIIReader::ObjectType type) 463 { 464 this->FastPathObjectType = type; 465 } SetFastPathObjectId(vtkIdType id)466 void SetFastPathObjectId(vtkIdType id) { this->FastPathObjectId = id; } 467 vtkSetStringMacro(FastPathIdType); 468 469 bool IsXMLMetadataValid(); 470 471 /** For a given object type, looks for an object in the collection 472 * of initial objects of the same name, or if the name is empty, then of 473 * the same id as "info". If found, info's Status is set to the status of 474 * the found object. 475 * You DO NOT need to have called RequestInformation before invoking this 476 * member function. 477 */ 478 void GetInitialObjectStatus(int otype, ObjectInfoType* info); 479 480 /** For a given array type, looks for an object in the collection 481 * of initial objects of the same name, or if the name is empty, then of 482 * the same id as "info". If found, info's Status is set to the status of 483 * the found object. 484 * You DO NOT need to have called RequestInformation before invoking this 485 * member function. 486 */ 487 void GetInitialObjectArrayStatus(int otype, ArrayInfoType* info); 488 489 /** For a given object type, creates and stores an ObjectInfoType 490 * object using the given name and status. If the name contains a "ID: %d" 491 * substring, then it is used to initialize the ObjectInfoType.Id value. 492 * You DO NOT need to have called RequestInformation before invoking this 493 * member function. 494 */ 495 void SetInitialObjectStatus(int otype, const char* name, int stat); 496 497 /** For a given array type, creates and stores an ArrayInfoType 498 * object using the given name and status. 499 * You DO NOT need to have called RequestInformation before invoking this 500 * member function. 501 */ 502 void SetInitialObjectArrayStatus(int otype, const char* name, int stat); 503 504 int UpdateTimeInformation(); 505 506 bool ProducedFastPathOutput; 507 508 protected: 509 vtkExodusIIReaderPrivate(); 510 ~vtkExodusIIReaderPrivate() override; 511 512 /// Build SIL. This must be called only after RequestInformation(). 513 void BuildSIL(); 514 515 /// Returns true when order and text of names are consistent with integration 516 /// points. Called from GlomArrayNames(). 517 int VerifyIntegrationPointGlom( 518 int nn, char** np, vtksys::RegularExpression& re, vtkStdString& field, vtkStdString& ele); 519 520 /// Aggregate Exodus array names into VTK arrays with multiple components 521 void GlomArrayNames(int i, int num_obj, int num_vars, char** var_names, int* truth_tab); 522 523 /// Add generated array information to array info lists. 524 void PrepareGeneratedArrayInfo(); 525 526 /** Read connectivity information and populate an unstructured grid with cells corresponding to a 527 * single block or set. 528 * 529 * If the connectivity hasn't changed since the last time RequestData was 530 * called, this copies a cache to the output. 531 * 532 * Otherwise, this routine iterates over all block and set types. 533 * For each type, it iterates over all objects of that type. 534 * For each object whose status is 1, it reads that object's connectivity 535 * entries from cache or disk and inserts cells into CachedConnectivity. 536 * If SqueezePoints is on, then connectivity entries are translated as 537 * required and PointMap is populated. 538 * Finally, CachedConnectivity is shallow-copied to the output. 539 * 540 * AssembleOutputConnectivity returns 1 if cache was used, 0 otherwise. 541 */ 542 int AssembleOutputConnectivity(vtkIdType timeStep, int otyp, int oidx, int conntypidx, 543 BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output); 544 /** Fill the output grid's point coordinates array. 545 * Returns 1 on success, 0 on failure. 546 * Failure occurs when the Exodus library is unable to read the point 547 * coordinates array. This can be caused when there is not enough memory 548 * or there is a file I/O problem. 549 */ 550 int AssembleOutputPoints( 551 vtkIdType timeStep, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output); 552 /** Add the requested arrays to the output grid's point data. 553 * This adds time-varying results arrays to the grid's vtkPointData object. 554 */ 555 int AssembleOutputPointArrays( 556 vtkIdType timeStep, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output); 557 /** Add the requested arrays to the output grid's cell data. 558 * This adds time-varying results arrays to the grid's vtkCellData object. 559 */ 560 int AssembleOutputCellArrays( 561 vtkIdType timeStep, int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output); 562 /** Add procedurally generated arrays to an output mesh. 563 * Currently, the only array that is procedurally generated is the object id 564 * array. Others may be added in the future. 565 */ 566 int AssembleOutputProceduralArrays( 567 vtkIdType timeStep, int otyp, int oidx, vtkUnstructuredGrid* output); 568 /// Add mesh-global field data such as QA records to the output mesh. 569 int AssembleOutputGlobalArrays( 570 vtkIdType timeStep, int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output); 571 /** Add maps to an output mesh. 572 * Maps are special integer arrays that may serve as GlobalId fields in 573 * vtkDataSetAttributes objects. 574 * Maps may be procedurally generated if no map is contained in a file. 575 * Maps are not time-varying. 576 */ 577 int AssembleOutputPointMaps( 578 vtkIdType timeStep, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output); 579 int AssembleOutputCellMaps( 580 vtkIdType timeStep, int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output); 581 /** Add fast-path time-varying data to field data of an output block or set. 582 */ 583 int AssembleArraysOverTime(vtkMultiBlockDataSet* output); 584 585 /** Fetch the face-connectivity for one face of one polyhedron. 586 * 587 * The number of points (or zero) is returned and 588 * facePtIds holds a pointer to the connectivity upon exit. 589 * The pointer is owned by this object's PolyhedralFaceConnArrays 590 * member and must be freed by calling FreePolyhedronFaceConnectivity(). 591 * However, you should only free the cache after processing all of 592 * the faces of interest (it is currently called once per polyhedral 593 * element block) so that the cost of generating the cache can be 594 * amortized across many calls. 595 * 596 * The point IDs returned in \a facePtIds do **not** include any mapping 597 * due to SqueezePoints (i.e., GetSqueezePointId is not called on 598 * each point). This is because multiple blocks may refer to the same 599 * face, but each block will have a different vtkPoints object. 600 */ 601 vtkIdType GetPolyhedronFaceConnectivity(vtkIdType fileLocalFaceId, vtkIdType*& facePtIds); 602 603 /// Free any arrays held by PolyhedralFaceConnArrays (for polyhedral-face-connectivity lookup). 604 void FreePolyhedronFaceArrays(); 605 606 /// Insert polyhedral cells (called from InsertBlockCells when a block is polyhedral). 607 void InsertBlockPolyhedra( 608 BlockInfoType* binfo, vtkIntArray* facesPerCell, vtkIdTypeArray* exoCellConn); 609 610 /// Insert cells from a specified block into a mesh 611 void InsertBlockCells(int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop); 612 613 /// Insert cells from a specified set into a mesh 614 void InsertSetCells(int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop); 615 616 /// Add a point array to an output grid's point data, squeezing if necessary 617 void AddPointArray(vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output); 618 619 /// Insert cells referenced by a node set. 620 void InsertSetNodeCopies(vtkIdTypeArray* refs, int otyp, int obj, SetInfoType* sinfo); 621 622 /// Insert cells referenced by an edge, face, or element set. 623 void InsertSetCellCopies(vtkIdTypeArray* refs, int otyp, int obj, SetInfoType* sinfo); 624 625 /// Insert cells referenced by a side set. 626 void InsertSetSides(vtkIdTypeArray* refs, int otyp, int obj, SetInfoType* sinfo); 627 628 /** Return an array for the specified cache key. If the array was not cached, 629 * read it from the file. 630 * This function can still return 0 if you are foolish enough to request an 631 * array not present in the file, grasshopper. 632 */ 633 vtkDataArray* GetCacheOrRead(vtkExodusIICacheKey); 634 635 /** Return the index of an object type (in a private list of all object types). 636 * This returns a 0-based index if the object type was found and -1 if it 637 * was not. 638 */ 639 int GetConnTypeIndexFromConnType(int ctyp); 640 641 /** Return the index of an object type (in a private list of all object types). 642 * This returns a 0-based index if the object type was found and -1 if it 643 * was not. 644 */ 645 int GetObjectTypeIndexFromObjectType(int otyp); 646 647 /** Return the number of objects of the given type. 648 * The integer typeIndex is not the type of the object (e.g., EX_ELEM_BLOCK), 649 * but is rather the index into the list of all object types 650 * (see obj_types in vtkExodusIIReader.cxx). 651 */ 652 int GetNumberOfObjectsAtTypeIndex(int typeIndex); 653 654 /** Return a pointer to the ObjectInfo of the specified type and index. 655 * The integer typeIndex is not the type of the object (e.g., EX_ELEM_BLOCK), 656 * but is rather the index into the list of all object types (see obj_types 657 * in vtkExodusIIReader.cxx). The integer objectIndex is not the ID of the 658 * object (i.e., the ID stored in the Exodus file), but is rather the index 659 * into the list of all objects of the given type. 660 */ 661 ObjectInfoType* GetObjectInfo(int typeIndex, int objectIndex); 662 663 /** Return a pointer to the ObjectInfo of the specified type and index, but 664 * using indices sorted by object ID. This is the same as GetObjectInfo() 665 * except that it uses the SortedObjectIndices member to permute the 666 * requested \a objectIndex and it takes an object type (e.g., EX_ELEM_BLOCK) 667 * rather than an object type index. 668 */ 669 ObjectInfoType* GetSortedObjectInfo(int objectType, int objectIndex); 670 671 /** Return a pointer to the ObjectInfo of the specified type and index, but 672 * using indices sorted by object ID. This is the same as 673 * GetSortedObjectInfo() except that \a objectIndex directly indexes the 674 * object info array rather SortedObjectIndices, and it takes an object 675 * type (e.g., EX_ELEM_BLOCK) rather than an object type index. 676 */ 677 ObjectInfoType* GetUnsortedObjectInfo(int objectType, int objectIndex); 678 679 /** Get the index of the block containing the entity referenced by the 680 * specified file-global ID. 681 * In this case, an entity is an edge, face, or element. 682 */ 683 int GetBlockIndexFromFileGlobalId(int otyp, int refId); 684 685 /** Get the block containing the entity referenced by the specified 686 * file-global ID. 687 * In this case, an entity is an edge, face, or element. 688 */ 689 BlockInfoType* GetBlockFromFileGlobalId(int otyp, int refId); 690 691 /** Find or create a new SqueezePoint ID (unique sequential list of points 692 * referenced by cells in blocks/sets with Status == 1) 693 */ 694 vtkIdType GetSqueezePointId(BlockSetInfoType* bsinfop, int i); 695 696 /// Determine the VTK cell type for a given edge/face/element block 697 void DetermineVtkCellType(BlockInfoType& binfo); 698 699 /** Find an ArrayInfo object for a specific object type using the name 700 * as a key. 701 */ 702 ArrayInfoType* FindArrayInfoByName(int otyp, const char* name); 703 704 /** Does the specified object type match? Avoid using these... they aren't 705 * robust against new types being implemented. 706 */ 707 int IsObjectTypeBlock(int otyp); 708 int IsObjectTypeSet(int otyp); 709 int IsObjectTypeMap(int otyp); 710 711 /** Given a map type (NODE_MAP, EDGE_MAP, ...) return the associated object 712 * type (NODAL, EDGE_BLOCK, ...) or vice-versa. 713 */ 714 int GetObjectTypeFromMapType(int mtyp); 715 int GetMapTypeFromObjectType(int otyp); 716 int GetTemporalTypeFromObjectType(int otyp); 717 718 /** Given a set connectivity type (NODE_SET_CONN, ...), return the associated 719 * object type (NODE_SET, ...) or vice-versa. 720 */ 721 int GetSetTypeFromSetConnType(int sctyp); 722 723 /** Given a block type (EDGE_BLOCK, ...), return the associated block 724 * connectivity type (EDGE_BLOCK_CONN, ...) or vice-versa. 725 */ 726 int GetBlockConnTypeFromBlockType(int btyp); 727 728 /** Function to trim space from names retrieved with ex_get_var_names. 729 * This was added because some meshes had displacement arrays named 730 * "DISPX ", "DISPY ", "DISPZ " (note trailing spaces), 731 * which prevented glomming and use of the vector field for displacements. 732 */ 733 void RemoveBeginningAndTrailingSpaces(int len, char** names, int maxNameLength); 734 735 /// Delete any cached connectivity information (for all blocks and sets) 736 void ClearConnectivityCaches(); 737 738 /** Maps a block type (EX_ELEM_BLOCK, EX_FACE_BLOCK, ...) to a list of blocks 739 * of that type. 740 */ 741 std::map<int, std::vector<BlockInfoType>> BlockInfo; 742 /** Maps a set type (EX_ELEM_SET, ..., EX_NODE_SET) to a list of sets of 743 * that type. 744 */ 745 std::map<int, std::vector<SetInfoType>> SetInfo; 746 /** Maps a map type (EX_ELEM_MAP, ..., EX_NODE_MAP) to a list of maps of that 747 * type. In old-style files, the only entries will be a single node and a 748 * single element map which have no specified ID number or name. In that 749 * case, an ID of 0 and a name of "Default" will be given to both. 750 */ 751 std::map<int, std::vector<MapInfoType>> MapInfo; 752 753 std::vector<PartInfoType> PartInfo; 754 std::vector<MaterialInfoType> MaterialInfo; 755 std::vector<AssemblyInfoType> AssemblyInfo; 756 757 /** Maps an object type to vector of indices that reorder objects of that 758 * type by their IDs. This is used by the user interface to access blocks, 759 * sets, and maps in ascending order. It is not used internally. 760 */ 761 std::map<int, std::vector<int>> SortedObjectIndices; 762 /// Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of arrays 763 // defined on that type. 764 std::map<int, std::vector<ArrayInfoType>> ArrayInfo; 765 766 /** Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of arrays 767 * defined on that type. Used to store initial status of arrays before 768 * RequestInformation can be called. 769 */ 770 std::map<int, std::vector<ArrayInfoType>> InitialArrayInfo; 771 772 /** Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of objects 773 * defined on that type. Used to store initial status of objects before 774 * RequestInformation can be called. 775 */ 776 std::map<int, std::vector<ObjectInfoType>> InitialObjectInfo; 777 778 /// These aren't the variables you're looking for. 779 int AppWordSize; 780 int DiskWordSize; 781 782 /** The version of Exodus that wrote the currently open file (or a negative 783 * number otherwise). 784 */ 785 float ExodusVersion; 786 787 /// The handle of the currently open file. 788 int Exoid; 789 790 /// Parameters describing the currently open Exodus file. 791 struct ex_init_params ModelParameters; 792 793 /// A list of time steps for which results variables are stored. 794 std::vector<double> Times; 795 bool SkipUpdateTimeInformation; 796 797 /** The time value. This is used internally when HasModeShapes is true and 798 * ignored otherwise. 799 */ 800 double ModeShapeTime; 801 802 vtkTypeBool GenerateObjectIdArray; 803 vtkTypeBool GenerateGlobalIdArray; 804 vtkTypeBool GenerateFileIdArray; 805 vtkTypeBool GenerateGlobalElementIdArray; 806 vtkTypeBool GenerateGlobalNodeIdArray; 807 vtkTypeBool GenerateImplicitElementIdArray; 808 vtkTypeBool GenerateImplicitNodeIdArray; 809 810 /** Defaults to 0. Set by vtkPExodusIIReader on each entry of ReaderList. 811 * Used to generate the file ID array over all output cells. 812 */ 813 int FileId; 814 815 /// A least-recently-used cache to hold raw arrays. 816 vtkExodusIICache* Cache; 817 // 818 /// The size of the cache in MiB. 819 double CacheSize; 820 821 vtkTypeBool ApplyDisplacements; 822 float DisplacementMagnitude; 823 vtkTypeBool HasModeShapes; 824 vtkTypeBool AnimateModeShapes; 825 826 bool IgnoreFileTime; 827 828 /** Should the reader output only points used by elements in the output mesh, 829 * or all the points. Outputting all the points is much faster since the 830 * point array can be read straight from disk and the mesh connectivity need 831 * not be altered. Squeezing the points down to the minimum set needed to 832 * produce the output mesh is useful for glyphing and other point-based 833 * operations. On large parallel datasets, loading all the points implies 834 * loading all the points on all processes and performing subsequent 835 * filtering on a much larger set. 836 * 837 * By default, SqueezePoints is true for backwards compatibility. 838 */ 839 int SqueezePoints; 840 841 /** Pointer to owning reader... this is not registered in order to avoid 842 * circular references. 843 */ 844 vtkExodusIIReader* Parent; 845 846 vtkExodusIIReaderParser* Parser; 847 848 /** Face connectivity for polyhedra. 849 * 850 * This is a map from face block index to ragged connectivity arrays for 851 * each face in a block. 852 * We store the ragged arrays of face connectivity without squeeze-points 853 * applied since multiple blocks (with different squeeze-points) can refer 854 * to the same face. 855 */ 856 std::map<int, std::vector<std::vector<vtkIdType>>> PolyhedralFaceConnArrays; 857 858 vtkExodusIIReader::ObjectType FastPathObjectType; 859 vtkIdType FastPathObjectId; 860 char* FastPathIdType; 861 862 vtkMutableDirectedGraph* SIL; 863 864 private: 865 vtkExodusIIReaderPrivate(const vtkExodusIIReaderPrivate&) = delete; 866 void operator=(const vtkExodusIIReaderPrivate&) = delete; 867 }; 868 869 #endif 870 #endif 871 #endif // vtkExodusIIReaderPrivate_h 872