VTK  9.3.20240424
vtkIOSSReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3// SPDX-License-Identifier: BSD-3-Clause
4
162#ifndef vtkIOSSReader_h
163#define vtkIOSSReader_h
164
165#include "vtkIOIOSSModule.h" // for export macros
166#include "vtkNew.h" // for vtkNew
167#include "vtkReaderAlgorithm.h"
168
169#include <map> // for std::map
170
171VTK_ABI_NAMESPACE_BEGIN
173class vtkDataAssembly;
176class vtkStringArray;
177
178class VTKIOIOSS_EXPORT vtkIOSSReader : public vtkReaderAlgorithm
179{
180public:
183 void PrintSelf(ostream& os, vtkIndent indent) override;
184
186
189 void AddFileName(VTK_FILEPATH const char* fname);
191 VTK_FILEPATH const char* GetFileName(int index) const;
194
198 void SetFileName(VTK_FILEPATH const char* fname);
199
201
205 vtkSetStringMacro(DatabaseTypeOverride);
206 vtkGetStringMacro(DatabaseTypeOverride);
208
210
214 void SetDisplacementMagnitude(double magnitude);
217
219
231
233
236 void SetFieldSuffixSeparator(const char* value);
239
241
245 void SetScanForRelatedFiles(bool value);
246 vtkGetMacro(ScanForRelatedFiles, bool);
247 vtkBooleanMacro(ScanForRelatedFiles, bool);
249
251
264 vtkSetVector2Macro(FileRange, int);
265 vtkGetVector2Macro(FileRange, int);
266 vtkSetClampMacro(FileStride, int, 1, VTK_INT_MAX);
267 vtkGetMacro(FileStride, int);
269
271
276 void SetCaching(bool value);
277 vtkGetMacro(Caching, bool);
278 vtkBooleanMacro(Caching, bool);
280
282
288 vtkGetMacro(MergeExodusEntityBlocks, bool);
289 vtkBooleanMacro(MergeExodusEntityBlocks, bool);
291
293
303 void SetElementAndSideIds(bool value);
304 vtkGetMacro(ElementAndSideIds, bool);
305 vtkBooleanMacro(ElementAndSideIds, bool);
307
309
316 vtkSetMacro(GenerateFileId, bool);
317 vtkGetMacro(GenerateFileId, bool);
318 vtkBooleanMacro(GenerateFileId, bool);
320
322
326 vtkSetMacro(ReadIds, bool);
327 vtkGetMacro(ReadIds, bool);
328 vtkBooleanMacro(ReadIds, bool);
330
332
341 vtkGetMacro(RemoveUnusedPoints, bool);
342 vtkBooleanMacro(RemoveUnusedPoints, bool);
344
346
350 vtkSetMacro(ApplyDisplacements, bool);
351 vtkGetMacro(ApplyDisplacements, bool);
352 vtkBooleanMacro(ApplyDisplacements, bool);
354
356
359 vtkSetMacro(ReadGlobalFields, bool);
360 vtkGetMacro(ReadGlobalFields, bool);
361 vtkBooleanMacro(ReadGlobalFields, bool);
363
365
374 vtkGetMacro(ReadAllFilesToDetermineStructure, bool);
375 vtkBooleanMacro(ReadAllFilesToDetermineStructure, bool);
377
379
383 vtkSetMacro(ReadQAAndInformationRecords, bool);
384 vtkGetMacro(ReadQAAndInformationRecords, bool);
385 vtkBooleanMacro(ReadQAAndInformationRecords, bool);
387
389
401 vtkGetObjectMacro(Controller, vtkMultiProcessController);
403
405
411 void AddProperty(const char* name, int value);
412 void AddProperty(const char* name, double value);
413 void AddProperty(const char* name, void* value);
414 void AddProperty(const char* name, const char* value);
415 void RemoveProperty(const char* name);
418
420 {
432
433 BLOCK_START = NODEBLOCK,
434 BLOCK_END = NODESET,
435 SET_START = NODESET,
436 SET_END = NUMBER_OF_ENTITY_TYPES,
437 ENTITY_START = NODEBLOCK,
438 ENTITY_END = NUMBER_OF_ENTITY_TYPES,
439 };
440
441 static bool GetEntityTypeIsBlock(int type) { return (type >= BLOCK_START && type < BLOCK_END); }
442 static bool GetEntityTypeIsSet(int type) { return (type >= SET_START && type < SET_END); }
443 static const char* GetDataAssemblyNodeNameForEntityType(int type);
444 static const char* GetMergedEntityNameForEntityType(int type);
445
447 vtkDataArraySelection* GetNodeBlockSelection() { return this->GetEntitySelection(NODEBLOCK); }
448 vtkDataArraySelection* GetEdgeBlockSelection() { return this->GetEntitySelection(EDGEBLOCK); }
449 vtkDataArraySelection* GetFaceBlockSelection() { return this->GetEntitySelection(FACEBLOCK); }
451 {
452 return this->GetEntitySelection(ELEMENTBLOCK);
453 }
455 {
456 return this->GetEntitySelection(STRUCTUREDBLOCK);
457 }
458 vtkDataArraySelection* GetNodeSetSelection() { return this->GetEntitySelection(NODESET); }
459 vtkDataArraySelection* GetEdgeSetSelection() { return this->GetEntitySelection(EDGESET); }
460 vtkDataArraySelection* GetFaceSetSelection() { return this->GetEntitySelection(FACESET); }
461 vtkDataArraySelection* GetElementSetSelection() { return this->GetEntitySelection(ELEMENTSET); }
462 vtkDataArraySelection* GetSideSetSelection() { return this->GetEntitySelection(SIDESET); }
463
465 vtkDataArraySelection* GetNodeBlockFieldSelection() { return this->GetFieldSelection(NODEBLOCK); }
466 vtkDataArraySelection* GetEdgeBlockFieldSelection() { return this->GetFieldSelection(EDGEBLOCK); }
467 vtkDataArraySelection* GetFaceBlockFieldSelection() { return this->GetFieldSelection(FACEBLOCK); }
469 {
470 return this->GetFieldSelection(ELEMENTBLOCK);
471 }
473 {
474 return this->GetFieldSelection(STRUCTUREDBLOCK);
475 }
476 vtkDataArraySelection* GetNodeSetFieldSelection() { return this->GetFieldSelection(NODESET); }
477 vtkDataArraySelection* GetEdgeSetFieldSelection() { return this->GetFieldSelection(EDGESET); }
478 vtkDataArraySelection* GetFaceSetFieldSelection() { return this->GetFieldSelection(FACESET); }
480 {
481 return this->GetFieldSelection(ELEMENTSET);
482 }
483 vtkDataArraySelection* GetSideSetFieldSelection() { return this->GetFieldSelection(SIDESET); }
484
488 {
489 this->RemoveAllEntitySelections();
490 this->RemoveAllFieldSelections();
491 }
492
494
499 const std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type) const;
500 const std::map<std::string, vtkTypeInt64>& GetNodeBlockIdMap() const
501 {
502 return this->GetEntityIdMap(NODEBLOCK);
503 }
504 const std::map<std::string, vtkTypeInt64>& GetEdgeBlockIdMap() const
505 {
506 return this->GetEntityIdMap(EDGEBLOCK);
507 }
508 const std::map<std::string, vtkTypeInt64>& GetFaceBlockIdMap() const
509 {
510 return this->GetEntityIdMap(FACEBLOCK);
511 }
512 const std::map<std::string, vtkTypeInt64>& GetElementBlockIdMap() const
513 {
514 return this->GetEntityIdMap(ELEMENTBLOCK);
515 }
516 const std::map<std::string, vtkTypeInt64>& GetStructuredBlockIdMap() const
517 {
518 return this->GetEntityIdMap(STRUCTUREDBLOCK);
519 }
520 const std::map<std::string, vtkTypeInt64>& GetNodeSetIdMap() const
521 {
522 return this->GetEntityIdMap(NODESET);
523 }
524 const std::map<std::string, vtkTypeInt64>& GetEdgeSetIdMap() const
525 {
526 return this->GetEntityIdMap(EDGESET);
527 }
528 const std::map<std::string, vtkTypeInt64>& GetFaceSetIdMap() const
529 {
530 return this->GetEntityIdMap(FACESET);
531 }
532 const std::map<std::string, vtkTypeInt64>& GetElementSetIdMap() const
533 {
534 return this->GetEntityIdMap(ELEMENTSET);
535 }
536 const std::map<std::string, vtkTypeInt64>& GetSideSetIdMap() const
537 {
538 return this->GetEntityIdMap(SIDESET);
539 }
541
543
550 {
551 return this->GetEntityIdMapAsString(NODEBLOCK);
552 }
554 {
555 return this->GetEntityIdMapAsString(EDGEBLOCK);
556 }
558 {
559 return this->GetEntityIdMapAsString(FACEBLOCK);
560 }
562 {
563 return this->GetEntityIdMapAsString(ELEMENTBLOCK);
564 }
566 {
567 return this->GetEntityIdMapAsString(STRUCTUREDBLOCK);
568 }
569 vtkStringArray* GetNodeSetIdMapAsString() const { return this->GetEntityIdMapAsString(NODESET); }
570 vtkStringArray* GetEdgeSetIdMapAsString() const { return this->GetEntityIdMapAsString(EDGESET); }
571 vtkStringArray* GetFaceSetIdMapAsString() const { return this->GetEntityIdMapAsString(FACESET); }
573 {
574 return this->GetEntityIdMapAsString(ELEMENTSET);
575 }
576 vtkStringArray* GetSideSetIdMapAsString() const { return this->GetEntityIdMapAsString(SIDESET); }
578
580
593
601 vtkGetMacro(AssemblyTag, int);
602
604
608 bool AddSelector(const char* selector);
610 void SetSelector(const char* selector);
612
614
618 const char* GetSelector(int index) const;
620
622
625 int ReadMetaData(vtkInformation* metadata) override;
626 int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
627 int ReadPoints(int, int, int, int, vtkDataObject*) override { return 1; }
628 int ReadArrays(int, int, int, int, vtkDataObject*) override { return 1; }
630
635
640
645 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
646
648
649protected:
651
653 ~vtkIOSSReader() override;
654
655 // For use by vtkIOSSReaderInternal.
656 std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type);
657
658 int FillOutputPortInformation(int port, vtkInformation* info) override;
659
661
664
665private:
666 vtkIOSSReader(const vtkIOSSReader&) = delete;
667 void operator=(const vtkIOSSReader&) = delete;
668 vtkNew<vtkDataArraySelection> EntitySelection[NUMBER_OF_ENTITY_TYPES];
669 vtkNew<vtkDataArraySelection> EntityFieldSelection[NUMBER_OF_ENTITY_TYPES];
670 std::map<std::string, vtkTypeInt64> EntityIdMap[NUMBER_OF_ENTITY_TYPES + 1];
671 vtkNew<vtkStringArray> EntityIdMapStrings[NUMBER_OF_ENTITY_TYPES + 1];
672
673 vtkMultiProcessController* Controller;
674 bool Caching;
675 bool MergeExodusEntityBlocks;
676 bool ElementAndSideIds;
677 bool GenerateFileId;
678 bool ScanForRelatedFiles;
679 bool ReadIds;
680 bool RemoveUnusedPoints;
681 bool ApplyDisplacements;
682 bool ReadAllFilesToDetermineStructure;
683 bool ReadGlobalFields;
684 bool ReadQAAndInformationRecords;
685 char* DatabaseTypeOverride;
686 int FileRange[2];
687 int FileStride;
688};
689
690VTK_ABI_NAMESPACE_END
691#endif
Store on/off settings for data arrays, etc.
hierarchical representation to use with vtkPartitionedDataSetCollection
general representation of visualization data
Internal methods and state for the IOSS reader.
Reader for IOSS (Sierra IO System)
vtkStringArray * GetFaceSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
const std::map< std::string, vtkTypeInt64 > & GetFaceSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
void RemoveAllEntitySelections()
vtkDataArraySelection * GetFaceSetSelection()
vtkStringArray * GetElementBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
static const char * GetDataAssemblyNodeNameForEntityType(int type)
void AddFileName(VTK_FILEPATH const char *fname)
API to set the filenames.
int GetNumberOfSelectors() const
API to access selectors.
int ReadArrays(int, int, int, int, vtkDataObject *) override
Implementation for vtkReaderAlgorithm API.
VTK_FILEPATH const char * GetFileName(int index) const
API to set the filenames.
void RemoveAllFieldSelections()
void RemoveAllSelections()
void SetMergeExodusEntityBlocks(bool value)
When this flag is on, blocks/sets of exodus like types will be merged.
~vtkIOSSReader() override
vtkStringArray * GetEntityIdMapAsString(int type) const
This API is not really meant for public use and may change without notices.
int ReadPoints(int, int, int, int, vtkDataObject *) override
Implementation for vtkReaderAlgorithm API.
std::string GetFieldSuffixSeparator()
Set the character used to separate suffix from the field.
vtkDataArraySelection * GetSideSetFieldSelection()
vtkDataArraySelection * GetNodeBlockFieldSelection()
vtkDataArraySelection * GetEdgeSetFieldSelection()
vtkStringArray * GetStructuredBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
const std::map< std::string, vtkTypeInt64 > & GetEdgeSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetElementBlockSelection()
vtkStringArray * GetFaceBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetEntitySelection(int type)
vtkStringArray * GetElementSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
void ClearProperties()
IOSS databases support various properties that affect how the database is read.
static vtkIOSSReader * New()
vtkDataArraySelection * GetFaceSetFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetElementBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataAssembly * GetAssembly()
Assemblies provide yet another way of selection blocks/sets to load, if available in the dataset.
vtkDataArraySelection * GetElementBlockFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetSideSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
const std::map< std::string, vtkTypeInt64 > & GetEdgeBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
const std::map< std::string, vtkTypeInt64 > & GetNodeBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
static const char * GetMergedEntityNameForEntityType(int type)
static bool GetEntityTypeIsSet(int type)
const std::map< std::string, vtkTypeInt64 > & GetElementSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
void AddProperty(const char *name, int value)
IOSS databases support various properties that affect how the database is read.
vtkDataArraySelection * GetElementSetFieldSelection()
vtkDataArraySelection * GetEdgeBlockFieldSelection()
void SetFieldSuffixSeparator(const char *value)
Set the character used to separate suffix from the field.
static vtkInformationIntegerKey * ENTITY_TYPE()
void SetRemoveUnusedPoints(bool)
Node related data, including point coordinates, point field data etc.
vtkDataArraySelection * GetSideSetSelection()
vtkMTimeType GetMTime() override
Overridden to take into account mtimes for vtkDataArraySelection instances.
int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject *output) override
Implementation for vtkReaderAlgorithm API.
vtkDataArraySelection * GetFaceBlockSelection()
void SetCaching(bool value)
When this flag is on, caching of data across time-steps is enabled.
int ReadMetaData(vtkInformation *metadata) override
Implementation for vtkReaderAlgorithm API.
std::map< std::string, vtkTypeInt64 > & GetEntityIdMap(int type)
void SetFileName(VTK_FILEPATH const char *fname)
Set a single filename.
const char * GetSelector(int index) const
API to access selectors.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Overridden to release handles at the end of each pass.
void RemoveProperty(const char *name)
IOSS databases support various properties that affect how the database is read.
const std::map< std::string, vtkTypeInt64 > & GetEntityIdMap(int type) const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetNodeBlockSelection()
vtkDataArraySelection * GetNodeSetFieldSelection()
vtkStringArray * GetNodeBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
void ClearFileNames()
API to set the filenames.
void AddProperty(const char *name, const char *value)
IOSS databases support various properties that affect how the database is read.
static bool GetEntityTypeIsBlock(int type)
void SetController(vtkMultiProcessController *controller)
Get/Set the controller to use when working in parallel.
vtkStringArray * GetEdgeSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
int GetNumberOfFileNames() const
API to set the filenames.
const std::map< std::string, vtkTypeInt64 > & GetNodeSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetStructuredBlockFieldSelection()
bool AddSelector(const char *selector)
API to specify selectors that indicate which branches on the assembly are chosen.
static vtkInformationIntegerKey * ENTITY_ID()
void SetElementAndSideIds(bool value)
When this flag is on and MergeExodusEntityBlocks is off, side sets of exodus data will be annotated w...
bool GetGroupNumericVectorFieldComponents()
Set whether the reader should treat numeric suffixes for a vector field as vector components.
vtkDataArraySelection * GetNodeSetSelection()
void SetDisplacementMagnitude(double magnitude)
When displacements are being applied, they are scaled by this amount.
void SetScanForRelatedFiles(bool value)
When set to true, the reader can automatically locate and load additional files that are part of the ...
const std::map< std::string, vtkTypeInt64 > & GetStructuredBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetFieldSelection(int type)
vtkIOSSReaderInternal * Internals
double GetDisplacementMagnitude()
When displacements are being applied, they are scaled by this amount.
void AddProperty(const char *name, double value)
IOSS databases support various properties that affect how the database is read.
vtkDataArraySelection * GetFaceBlockFieldSelection()
vtkStringArray * GetSideSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
const std::map< std::string, vtkTypeInt64 > & GetFaceBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkStringArray * GetNodeSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetEdgeBlockSelection()
vtkDataArraySelection * GetEdgeSetSelection()
void ClearSelectors()
API to specify selectors that indicate which branches on the assembly are chosen.
static bool DoTestFilePatternMatching()
Runs a bunch of tests for file pattern matching.
void AddProperty(const char *name, void *value)
IOSS databases support various properties that affect how the database is read.
void SetGroupNumericVectorFieldComponents(bool value)
Set whether the reader should treat numeric suffixes for a vector field as vector components.
void SetSelector(const char *selector)
API to specify selectors that indicate which branches on the assembly are chosen.
vtkDataArraySelection * GetElementSetSelection()
vtkDataArraySelection * GetStructuredBlockSelection()
void SetReadAllFilesToDetermineStructure(bool)
When set to true (default), the reader will read all files to determine structure of the dataset beca...
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkStringArray * GetEdgeBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition vtkIndent.h:108
Key for integer values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
Allocate and hold a VTK object.
Definition vtkNew.h:160
Superclass for readers that implement a simplified API.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_FILEPATH